fix: Iceberg renames now delete the old Glue entry via doRenameOperation#142
Draft
jamespfaulkner wants to merge 3 commits into
Draft
fix: Iceberg renames now delete the old Glue entry via doRenameOperation#142jamespfaulkner wants to merge 3 commits into
jamespfaulkner wants to merge 3 commits into
Conversation
…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>
…letes-old-glue-entry
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
!isIcebergPredicateguard inonAlterTableso Iceberg table renames are routed throughdoRenameOperation, which creates the new Glue entry and deletes the old oneupdateOrCreateTable(newTable), which only upserted the new name and left the old entry (e.g.db.table_iceberg) as an orphan in GlueIsIcebergTablePredicatefield, import, and both constructor initializationsFixes Bug 2 from #140.
How it works
Iceberg's own
GlueCatalog.renameTabledoes:GetTable(read old entry) →CreateTable(new name, samemetadata_location) →DeleteTable(old name). OurdoRenameOperationmatches this sequence:create(newTable)(using HMS event data which includesmetadata_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 fromonAlterIcebergTable_RenameTableSkipsRenameOperation; now assertscreateTable("table_renamed")called,deleteTable(tableName)called,updateTablenever called, metric outcome"renamed"ApiaryGlueSyncTesttests pass (35 tests)mvn test -pl hive-event-listeners/apiary-gluesync-listener -am— 125 tests, 0 failures🤖 Generated with Claude Code