[core] Fix main table's CatalogEnvironment used when switching branch on fallback table#7878
Merged
Merged
Conversation
…t regression) When a REST catalog returns the main table's snapshot for a branch query, SnapshotManager.latestSnapshotId() returns the wrong snapshot ID. This causes a mismatch between latestSnapshotId() (from REST) and safelyGetAllSnapshots() (from filesystem), which is the root cause of the Frankfurt eu-central-1 "safelyGetAllSnapshots did not include latest snapshot" error on tables with branches. The test verifies: 1. The mismatch when a buggy REST loader returns the main table's snapshot 2. No mismatch when the loader correctly returns the branch's snapshot 3. copyWithBranch correctly propagates the loader Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…logEnvironment When a table has scan.fallback-branch or scan.primary-branch set, getTable() returns a FallbackReadFileStoreTable. Calling switchToBranch() on it delegates to switchWrappedToBranch(), which previously passed the main table's CatalogEnvironment to the branch table. This caused REST snapshot loading (via SnapshotLoader) to query the main table's endpoint instead of the branch's (e.g. tableName$branch_branchName), returning the wrong snapshot ID. Fix: create a branch-aware CatalogEnvironment by copying the wrapped table's environment with an Identifier that includes the branch name. Co-Authored-By: Claude Opus 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.
Purpose
When a table has
scan.fallback-branchorscan.primary-branchset,switchToBranch()passed the maintable's
CatalogEnvironmentto the branch table. This caused REST snapshot loading to query the maintable instead of the branch, returning the wrong snapshot ID.
Fix: copy the
CatalogEnvironmentwith a branch-awareIdentifier.Tests
FallbackReadFileStoreTableTest.testSwitchToBranch