Skip to content

fix: Iceberg renames now delete the old Glue entry via doRenameOperation#142

Draft
jamespfaulkner wants to merge 3 commits into
mainfrom
fix/iceberg-rename-deletes-old-glue-entry
Draft

fix: Iceberg renames now delete the old Glue entry via doRenameOperation#142
jamespfaulkner wants to merge 3 commits into
mainfrom
fix/iceberg-rename-deletes-old-glue-entry

Conversation

@jamespfaulkner

Copy link
Copy Markdown
Contributor

Summary

  • Removes the !isIcebergPredicate guard in onAlterTable so Iceberg table renames are routed through doRenameOperation, which creates the new Glue entry and deletes the old one
  • Previously, Iceberg renames fell through to updateOrCreateTable(newTable), which only upserted the new name and left the old entry (e.g. db.table_iceberg) as an orphan in Glue
  • Removes the now-unused IsIcebergTablePredicate field, import, and both constructor initializations

Fixes Bug 2 from #140.

How it works

Iceberg's own GlueCatalog.renameTable does: GetTable (read old entry) → CreateTable (new name, same metadata_location) → DeleteTable (old name). Our doRenameOperation matches this sequence:
create(newTable) (using HMS event data which includes metadata_location) → copyPartitions (no-op for Iceberg since Glue holds no partition metadata for Iceberg tables) → deleteIfUnchanged(oldTable)
(optimistic guard from #141 — leaves an orphan rather than risk incorrectly deleting a table overwritten by a concurrent rename).

Test plan

  • onAlterIcebergTable_RenameTable — renamed from onAlterIcebergTable_RenameTableSkipsRenameOperation; now asserts createTable("table_renamed") called, deleteTable(tableName) called,
    updateTable never called, metric outcome "renamed"
  • All existing ApiaryGlueSyncTest tests pass (35 tests)
  • mvn test -pl hive-event-listeners/apiary-gluesync-listener -am — 125 tests, 0 failures

🤖 Generated with Claude Code

jamespfaulkner and others added 3 commits July 3, 2026 13:28
…ion (#140)

Removes the !isIcebergPredicate guard in onAlterTable so Iceberg renames go
through doRenameOperation (create new + copy partitions + deleteIfUnchanged old)
the same as Hive renames. Previously, Iceberg renames fell through to
updateOrCreateTable which only wrote the new entry, leaving the old _iceberg
table as an orphan in Glue.

IsIcebergTablePredicate is no longer used in ApiaryGlueSync and has been removed.

Fixes Bug 2 from #140.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…a events

Bare create() throws AlreadyExistsException if a rename event is replayed
(Kafka at-least-once delivery, or a retry after a partial failure). Switching
to createOrUpdateTable() makes the rename idempotent: if the new Glue entry
already exists it falls through to update, then proceeds to deleteIfUnchanged.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant