Skip to content

[core] Fix FileStore tag manager ignoring the table branch - #9868

Open
thswlsqls wants to merge 1 commit into
apache:masterfrom
thswlsqls:fix/tag-manager-honor-table-branch
Open

thswlsqls wants to merge 1 commit into
apache:masterfrom
thswlsqls:fix/tag-manager-honor-table-branch

Conversation

@thswlsqls

Copy link
Copy Markdown
Contributor

Purpose

fix #9867

  • AbstractFileStore.newTagManager() used DEFAULT_MAIN_BRANCH, while snapshotManager() and AbstractFileStoreTable.tagManager() honor options.branch(). Pass options.branch(); main tables are unaffected.
  • Branch tables: ExpireSnapshotsImpl now protects tagged snapshots instead of deleting their manifest list and data files.
  • Flink rollback_to / rollback_to_as_latest and Spark rollback procedures find branch tags.
  • Automatic tags and _SUCCESS files land in the branch tag/ directory.
  • Same pattern as [core] Fix scan from tag on branch table. #9044 (StaticFromTagStartingScanner); the main-branch default dates from [Feature] Support Flink read / write data branch #3029.

Tests

  • Added PrimaryKeySimpleTableTest#testExpireSnapshotsKeepsBranchTag: tags a branch snapshot, expires to one snapshot, asserts store and table tag directories match and the tag stays readable. Without the fix the directories differ and, past that assertion, the tag read hits FileNotFoundException on the manifest list.
  • mvn -pl paimon-core -Dtest=PrimaryKeySimpleTableTest test — 136 tests passed.
  • mvn -pl paimon-core clean install (checkstyle, spotless, enforcer, surefire) — 5437 tests, 0 failures; only PostgresqlCatalogTest (needs Docker) could not start locally.

AbstractFileStore.newTagManager() always built the TagManager for the
main branch, while snapshotManager(), changelogManager() and
AbstractFileStoreTable.tagManager() honor options.branch(). On a branch
table this made ExpireSnapshotsImpl miss branch tags, so the manifest
list and data files of a tagged snapshot were deleted; it also created
automatic tags and _SUCCESS files under the main tag directory and made
the rollback procedures fail to find branch tags.

Pass options.branch() instead. Main tables are unaffected because
options.branch() is "main" there.

Generated-by: Claude Code
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.

[Bug] FileStore tag manager ignores the table branch, so branch tags are not protected from snapshot expiration

1 participant