Repository navigation
fix: preserve transaction visibility for table clone - #26293
Conversation
a37a215 to
e644873
Compare
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? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
[P1] Handle a zero-history table when it is the LCA itself
The new fallback covers a created-and-dropped table only while walking one side of a path. It does not cover the same zero-history node when it is the LCA of two surviving sibling branches: diffOnBase resolves a non-endpoint LCA with getRelationById at the pre-commit clone timestamp and returns immediately on the missing relation, before resolveSameTransactionDataBranchRelation / hasZeroHistory can run.
I reproduced this on this exact head with an authenticated embedded cluster:
begin;
data branch create table issue_26113.f1 from issue_26113.src;
insert into issue_26113.f1 values (4, shared txn change);
data branch create table issue_26113.f2 from issue_26113.f1;
data branch create table issue_26113.f3 from issue_26113.f1;
drop table issue_26113.f1;
commit;
data branch diff issue_26113.f2 against issue_26113.f3 output count;Both endpoints have identical inherited data, so the expected count is 0. Instead the last statement fails with internal error: can not find table by id <f1-id>. This is the same transaction-visibility class addressed by the PR, but in a branched DAG rather than the currently tested linear chain. Please make zero-history resolution apply systemically to LCA resolution as well and add a sibling-LCA regression test.
|
Addressed the latest zero-history LCA review finding in fbedd96.
Exact-head local validation:
@XuPeng-SH please re-review the current head. |
fbedd96 to
e4e1154
Compare
XuPeng-SH
left a comment
There was a problem hiding this comment.
Re-reviewed the updated head and the author's responses. The previous zero-history LCA blocker is now closed: classification requires stable-ID misses at the historical probe and both endpoint creation timestamps, schema/range construction handles the absent ancestor without swallowing unrelated errors, and the symmetric whole-endpoint comparison preserves inherited and divergent rows. The full authenticated issue regression (including sibling LCA, dropped intermediates, COPY GRANTS, commit/rollback) passes locally, as do the focused UnionBatch fast-path tests under -race.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Re-reviewed the updated head, including the author’s response to the zero-history LCA blocker. The prior nine commits are patch-equivalent across the rebase; the new LCA fallback is guarded by missing stable-ID probes and endpoint CTS bounds, preserves schema/range derivation, and compares endpoint histories symmetrically. The embedded issue regression (including sibling LCA, linear lineage, COPY GRANTS, and rollback cases) and focused frontend Data Branch suite pass locally. No remaining blocking findings.
What type of PR is this?
Which issue(s) this PR fixes:
issue #26113
What this PR does / why we need it:
Clone restore currently injects a generated
MO_TSeven inside an explicit transaction. That forces source resolution through a cloned snapshot transaction, which cannot see a table created earlier by the shared transaction.This change:
BEGIN;COPY GRANTSunless the user explicitly requested a snapshot;edge TS < creation CTS <= endpoint snapshot;User-provided snapshot hints remain intact for both data and grants, ordinary autocommit clones retain the existing generated-hint path, and historical ancestors continue to resolve at their original clone snapshot.
Regression coverage uses a real embedded cluster and one MySQL connection to verify:
COPY GRANTSpreserves snapshot data and privileges;COPY GRANTS, and three-level Data Branch chains read their own uncommitted DDL;src -> b1 -> b2 -> b3lineage and matching protect snapshots;b3 against srcDIFF after dropping intermediateb1return the expected counts;mo_branch_metadata, and branch protect snapshots atomically.Local validation on exact head
e4e1154df21a59df41e35e0b90d366f5f11f6578:-race: PASS (T=20.739s,B=30s,N=1)./pkg/tests/issues -race: PASS (367.233s)UnionBatchregressions under-race -count=100: PASS./pkg/container/vector -race: PASS (3.071s)./pkg/frontend -race: PASS (27.134s)go vet: PASStest/distributed/cases/git4data/clone/clone_can_rollback.sqland.result; exact-head CI execution pendinggit diff --check: PASSgit range-diff; the only upstream change in a touched production file is non-overlappingPASS review=PASS validation=PENDING, diff hash718fee756f387d451f79c27514863104d891973cb3ca27296c92c5349f2995bdQA handoff
BEGINto build multi-levelCREATE TABLE ... CLONE,COPY GRANTS, andDATA BRANCH CREATE TABLEchains; verify read-your-own-DDL, explicit snapshot data/grant preservation, commit lineage/protect snapshots, direct and deep post-commit DIFF after dropping an intermediate ancestor, and rollback cleanup of tables, privileges, metadata, and branch snapshots. Retain an autocommit control.