Repository navigation
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
Queue requested — the merge queue status continues in this comment ↓. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Request changes
P2: Historical LCA lookup failure can silently read a different table
lcaProbeTableDefAtSnapshot suppresses any GetRelationById error when allowMismatchedEndpointFallback is true and returns the current endpoint definition. handleDelsOnLCA then uses that definition's current database/table name for time-travel SQL, without verifying that the name resolves to the same table ID at the probe snapshot.
A concrete shape is: create ancestor a with (1, 10) and an unrelated x with (1, 99); branch child from a; rename x away and a to x; delete key 1 in child; then compare child with the current x. At the fork snapshot the LCA is still table a, while the name x refers to the unrelated table. If the historical ID lookup encounters an error at this probe (for example, a transient catalog/storage error), the new fallback issues db.x{MO_TS='<fork>'}; because that SQL can succeed, the unrelated (1, 99) is accepted as the LCA row instead of returning the lookup error. This can silently corrupt DIFF results and conflict decisions in MERGE/PICK. The earlier name-based path already had this identity risk; the new historical-reopen/fallback logic leaves it open in the path this PR is changing.
Please keep the SQL fast path only when its historical table identity is established (or verify the historical name resolves to the expected ID). Otherwise use a relation already proven to be opened at exactly that snapshot, or propagate the lookup error. Add a regression with a reused historical table name and an injected by-ID lookup failure; it should either read the correct LCA by ID or fail closed, never accept the decoy. Also cover the ordinary success path and preserve the existing snapshot-matched reader fallback.
I checked the failure using a temporary exact-head frontend test: with a mocked historical-ID lookup and SQL executor, successful ID lookup generated SQL for original_name and returned the modeled LCA; injected lookup failure generated SQL for reused_name and accepted the modeled decoy. This was a fault-injected frontend test, not a live-storage end-to-end reproduction. The current-head multi-CN BVT artifact reports the new diff_older_ancestor_snapshot.sql case at 103/103.
Cleanup
lcaProbeColumnLayout is now a wrapper used only by tests; production calls buildLCAProbeColumnLayout directly. Please remove the unused production wrapper and have the tests exercise the real builder. I found no prior human review threads on this PR.
🚫 Left the queue · queue conditions no longer match15 min in the queue, with no time running CI. So far
Reason Pull request #32970 has been dequeued Queue conditions are not satisfied:
To get back in the queue
Requeue requested — the merge queue status continues in this comment ↓. Times in UTC · dashboard · how the merge queue works |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 4b0c7d6b52934c830c6a0c82542681bf013ccb22
Assessment: request_changes
The historical table-name issue is resolved, and the older-snapshot DIFF and sibling PICK checks passed. The reader still resolves the same historical relation twice per batch. Reuse the verified relation for the scan.
Model: gpt-6.2-sol / xhigh
Session: 01a1f0a0-5126-78f3-9ab8-ef4e87f2f119 · slot 0 · generation 3
- P2
pkg/frontend/data_branch_hashdiff.go:879: A nonempty historical LCA probe or hydration batch takes the reader path after resolving a relation at the required snapshot.
Impact: The reader creates a second snapshot workspace and repeats the same catalog lookup for every batch. When the historical table version has aged out of the catalog cache, both lookups query catalog storage.
Evidence:lcaProbeTableDefAtSnapshotresolves the owner, table ID and timestamp, then passes the verified relation to the scanner as a fallback. The scanner opens the same relation again atpkg/frontend/data_branch_helpers.go:423. The focused test atpkg/frontend/data_branch_hashdiff_test.go:1030passed and explicitly requires two successful by-ID lookups. Use the verified handle for schema and range reads, preserving the existing owner and snapshot checks.
Validation:
-
Verified the frozen checkout and patch. Isolation preflight, native prerequisites and the candidate service build passed.
-
Passed 126 focused frontend tests and 213 subtests, including the updated bounded hydration fixture and historical lookup failure controls.
-
Matched expected rows and errors for all 131 SQL fixture statements on an isolated CN. Additional sibling PICK checks verified SKIP and ACCEPT across COPY ALTER. Frozen CI reports successful proxy and pessimistic multi-CN BVT jobs. Receipts and logs are mapped in
review-validation.md.
Limitations:
- The local SQL probe checked rows and errors on one CN. Multi-CN coverage comes from frozen CI. The duplicate lookup count is verified, while its end-to-end latency cost was not measured.
|
Addressed the duplicate historical lookup flagged in review 6037060782 in |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 3967ea75318b7397c008d7599909366395571c39
Assessment: approve
DIFF uses the earlier ancestor observation, sibling PICK keeps each fork’s baseline, and MERGE rejects destination snapshots before applying changes. The historical table-name and duplicate lookup findings are resolved. The reader reuses the relation resolved for the requested table ID, owner, and snapshot.
Model: gpt-6.2-sol / xhigh
Session: 01a20d47-b35e-7bd2-9d5c-61978a866730 · slot 0 · generation 6
Validation:
-
Verified the frozen checkout, patch, pinned policy, and all 12 discussion entries. Matched nine check receipts to retained logs.
-
The focused frontend run passed 127 tests and 218 subtests, including all newly added tests and the one-lookup, snapshot-mismatch, and renamed-column cases.
-
Matched all 131 SQL fixture statements to the expected result file and independently checked the core DIFF rows and summary counts in both directions. Frozen CI reported passing unit tests, static analysis, and both multi-CN BVT lanes.
Limitations:
- Local SQL verification checked the fixture and its expected results. Live SQL coverage came from frozen CI and the author’s report for the reviewed head.
🚫 Left the queue · pull request merged manually29 min in the queue, with no time running CI. So far
Reason Pull request #32970 has been merged manually at 835455b Tick the box to put this pull request back in the merge queue (same as
Times in UTC · dashboard · how the merge queue works |
What type of PR is this?
Which issue(s) this PR fixes:
issue #32968
What this PR does / why we need it:
Summary
Fixes
DATA BRANCH DIFF(and related snapshot/LCA probe paths) when comparing a cloned branch against an older ancestor snapshot (T_old < CloneTS), along with snapshot handling and probe bugs exposed during that scenario.Root Cause & Changes
pkg/frontend/data_branch.go,pkg/frontend/data_branch_types.go,pkg/frontend/data_branch_hashdiff.go):tarLCASnapshot/baseLCASnapshotheuristics with explicitlcaProbeAnchorsandlcaProbeSnapshotssoDATA BRANCH DIFFcomparing a clone against an older ancestor snapshot collects ancestor writes betweenT_oldandCloneTSproperly and preserves PICK conflict behavior when requested.tarRelSnapshot,baseRelSnapshot,lcaRelSnapshot,resolvedRelSnapshots) ingetRelations,diffOnBase,decideCollectRange, andbuildSideCollectRange, propagating per-segment snapshots (collectRange.segmentSnapshot/relSnapshot) intoconstructChangeHandleandlcaFallbackRangeRelso hydration and compaction stay aligned with each segment's snapshot.MO_TSformatting (pkg/frontend/data_branch.go,pkg/frontend/data_branch_hashdiff.go):tarLCAColNamesandbaseLCAColNamesseparately inreconcileDataBranchEndpointSchemaand selected the activelcaColNamesaccording to the earlier anchor (baseAnchor < tarAnchor), building snapshot-accurate column layouts viabuildLCAProbeColumnLayoutandlcaProbeTableDefAtSnapshot.{MO_TS='<TS.ToString()>'}instead of{MO_TS=<PhysicalTime>}.MERGEguard (pkg/frontend/data_branch.go,pkg/frontend/data_branch_helpers.go,pkg/frontend/data_branch_hashdiff.go):scanSnapshotRelationByIDWithFallbackImpl/runLCAProbeWithReaderFallbackWithPreopenedto the resolved snapshot relation and fixedownerScopedChangesHandle.Close/historicalDataBranchChangesHandle.Nextlifecycle handling.handleBranchMerge("destination snapshot option is not supported for DATA BRANCH MERGE").pkg/frontend/data_branch_test.go,pkg/frontend/data_branch_hashdiff_test.go,pkg/frontend/data_branch_helpers_test.go,test/distributed/cases/git4data/branch/diff/diff_older_ancestor_snapshot.{sql,result}):COPY ALTER, fake/composite PKs, in-place column renames, same-table snapshot DIFF, sibling PICK, andMERGE/PICKsnapshot edge cases).Non-Goals / Deferred (Pre-Existing Out-of-Scope)
clone.go:699/data_branch.go:3069), siblingPICKafter inherited delete (data_branch_types.go:213/data_branch_output.go:331), cross-DB same-table-nameOUTPUT FILE(data_branch_output.go:1336),COPY ALTER ADDcombined with pre-fork in-place rename (data_branch.go:2556), andOUTPUT FILECSV logical time (data_branch_output.go:1514,1612) are pre-existing baseline items left out of scope.TestHandleDelsOnLCA_SQLPaths(PR 1's added subtest runs with 0 mpool warnings).QA Decision
DATA BRANCH DIFF/MERGEwith historical snapshots; adds BVT suitetest/distributed/cases/git4data/branch/diff/diff_older_ancestor_snapshot.sql).Verification (Exact Final HEAD
ec76fb92283ccca6dca962a8c2daec6c5b9ef2b4)PASS(104 top-level / 172 subtests inr6-final-unit-focused.log, plus 4/4 subtests inr6-final-unit-pr1-supplement.log, 0 failures, 0 skipped;TestLCAProbeRenamedSnapshotSQLAndReaderParity0 mpool warnings).make build-with-prebuilt-native->vcs.revision=ec76fb92283ccca6dca962a8c2daec6c5b9ef2b4,vcs.modified=false.make static-check-selected STATIC_CHECK_PACKAGES=./pkg/frontend GOLANGCI_LINT_CONCURRENCY=4->0 issues..diff_older_ancestor_snapshot:103/103(100%).diff,merge,pick,edge/branch_binary_pk):4429/4429(100%).