Repository navigation
feat: add Sirius Substrait read admission - #26737
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? |
aunjgr
left a comment
There was a problem hiding this comment.
Addressed both blockers in 3b713e8 after merging current upstream/main with 40452d6.
-
FileServiceLeaseJournal no longer creates or trusts a process-local admission mutex. Its constructor now requires a JournalAdmissionCoordinator whose contract serializes the named namespace across CN/process boundaries, honors cancellation, and fences callback ownership. StoreIfCapacity holds that coordinator across the live-record scan and the complete batch publication; Load uses the same boundary. The regression now creates independent journal A/B/C instances over one backing prefix and uses an explicit barrier: B reaches the shared coordinator while A owns the scan+publish critical section, exactly one maximum=1 write succeeds, and C replays exactly one live lease. There is no unsafe local default for later runtime wiring to accidentally use.
-
DATE and TIMESTAMP are now rejected as typed EligibilityType declines for both scanned columns and literals, and both are removed from the capability document. The regressions use MatrixOne DATE/TIMESTAMP values at 1970-01-01 and cover the public Export path for scans and projected literals. This avoids claiming equivalence until the Unix-epoch/range/session-timezone contract is implemented end-to-end.
Validation after the final edit: go list/build/vet pass for all six owning packages; controlled normal and race package tests pass for substrait, compile, disttae/sidecar, disttae/logtailreplay, tae/db/gc/v3, and disttae; the deterministic capacity regression passes -race -count=100; make err-check and git diff --check pass.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep re-reviewed exact head 3b713e81845ffc86f237dfd5504a2fe24fa33759, including the latest response and the full exporter → admission/journal/resolver → disttae snapshot → TAE GC lifecycle. DATE/TIMESTAMP now fail closed correctly, but two blockers remain.
-
P1 — the distributed capacity invariant is still only an interface contract, not an implementation (
pkg/sql/plan/substrait/journal.go:54-103,substrait_test.go:610-667,1212-1258). The production tree contains noJournalAdmissionCoordinatorimplementation and no productionNewFileServiceLeaseJournalwiring at all. The regression gives all three journals the sametestJournalAdmission, whose exclusion is still one process-localcontextMutex; constructing separate journal objects does not test independent CN/process coordinators over shared storage. Thus the previous cross-CNmaximum=1counterexample has been moved behind a caller-supplied interface but is not actually closed by this PR. Please provide and exercise the real fenced cluster-wide coordinator (including ownership loss/cancellation), or keep persistent multi-CN admission out of the claimed usable contract until that implementation lands. -
P1 — expected size ineligibility is surfaced as an operational query failure instead of native fallback (
pkg/sql/plan/substrait/admission.go:869-877). A table whose snapshot is valid but whose manifest exceeds the advertised 64-MiB offload bound is simply not eligible for Sirius; it is not corrupt state. CurrentAdmitreturnsmoerr.NewInternalErrorfor that case, and it also string-wraps every provider error, destroying any typedEligibilityError. A public-path counterexample using an otherwise valid candidate and aMaxManifestBytes+1snapshot yieldsIsNotEligible(err) == falsewithschema or manifest mismatch. Once the optimizer calls this cut point, a query that MatrixOne can execute natively will fail instead of falling back. Classify side-effect-free size/capability declines before lease publication asEligibilitySnapshotand preserve typed provider declines throughAdmit; add the public compile/admission fallback regression.
Normal tests pass for substrait, compile, disttae/sidecar, logtailreplay, and TAE GC; the critical journal/resolve/protection tests also pass under -race -count=10. These tests do not cover the missing production coordinator or the size-classification counterexample above. Required CI is green and git diff --check passes.
|
@XuPeng-SH Thanks for the re-review. Both blockers are addressed in 9b0db02 after merging current upstream/main (no rebase).
Fresh validation on the pushed tree: all affected normal and race package suites pass; the real two-CN journal test passes under -race -count=100; all four exclusive-lock lifecycle tests pass separately under -race -count=100; go list/build/vet pass for lockservice, substrait, sidecar, and compile; make err-check and git diff --check pass. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep re-review — REQUEST_CHANGES
Reviewed exact head 9b0db025d5157c6c77bcd7b75dc9fcfd17f30910 against merge-base b84a6627060539173f9ee243e8523792a3ad2200, including all existing review threads and the latest author response.
-
P1 — a remote lock-table owner can orphan-unlock the new exclusive callback while it is still running (
pkg/lockservice/service.go:314-398,pkg/lockservice/service_remote.go:631-653,pkg/lockservice/service.go:2175-2220)RunExclusiveLockrecords callback ownership only on the originating service's syntheticactiveTxn. When the synthetic lock is remote, the lock-table owner checks the holder throughCheckActiveTxn; that handler reports only frontendTxnIterFunctransactions and unknown-commit resolver ownership, so the random callback txn is reported inactive. The waiter orphan path then obtains an allocator fence and unlocks the holder without canceling or joining its callback.A deterministic two-CN counterexample pre-binds the synthetic table to CN B, blocks a
RunExclusiveLockcallback started from CN A, then starts the same-row callback on CN B. The log reportsfound orphan remote txn, and CN B enters while CN A is still blocked. The existing serialization and journal-capacity tests miss this because CN A creates the binding and is also the first holder;isValidRemoteTxnreturns true immediately whenCreatedOn == owner serviceID.This reopens the original capacity race: two journal callbacks can both scan the same live count and publish, so
maximum=1can again yield two durable live leases and make replacement replay fail. Please make exclusive-callback ownership participate in the remote active/orphan protocol, and require orphan cleanup to cancel and join the callback before releasing its lock. Add the pre-bound-remote-owner regression, not only the local-owner topology. -
P2 — a native-valid UINT64 LIMIT outside Substrait's signed range is not classified for fallback (
pkg/sql/plan/substrait/export.go:459-478,1052-1081)The real binder accepts
SELECT a FROM select_test.bind_select LIMIT 18446744073709551615and producesLiteral_U64Val(math.MaxUint64).nonnegativeIntLiteralreturns an internal error aboveMaxInt64, andfetchwraps it as another internal error, soExportreturnsIsNotEligible(err) == false. Once the cut point is enabled, this MatrixOne-valid query fails instead of falling back even though the only issue is an unsupported Substrait fetch bound. Return a typed eligibility decline for representability/capability limits and add the real-bound public-path regression.
Validation: controlled CGo full package tests pass for lockservice, substrait, compile, disttae/sidecar, disttae/logtailreplay, and TAE GC; focused disttae tests pass; the journal/authority race targets pass under -race -count=10. Both counterexamples above fail deterministically on the exact head. CI is green but does not cover either topology/value boundary.
iamlinjunhong
left a comment
There was a problem hiding this comment.
Deep review of exact head 9b0db025d5157c6c77bcd7b75dc9fcfd17f30910 against merge-base b84a6627060539173f9ee243e8523792a3ad2200.
One blocking P1 finding is recorded inline.
Lifecycle audit summary:
| Check | Result |
|---|---|
| Q1: one effective cleanup/ownership owner | Failed across remote lock-table-owner failover: old and new callbacks can both mutate the journal namespace. |
| Q2: every wait terminates | Local caller cancellation, service close, bind-change join, and panic cleanup are covered; the failover gap occurs before the old client observes cancellation. |
| Q3: every accumulation is bounded | Lease maps, replay batches, resolver payloads, and protection counts have explicit bounds. |
I read the full PR conversation, all reviews, and all review threads; the prior findings are resolved on the current head. This is iamlinjunhong’s first review. All 31 checks are complete and successful, and git diff --check passes.
|
@XuPeng-SH please re-review current head Your two blockers on Fresh validation on the merged head: all affected normal suites pass; the four exclusive-lock lifecycle tests and cross-manager journal-capacity test pass under |
|
Addressed the latest XuPeng-SH review in 06998de and 61f27ce after merging current main at 25d41df.
Validation on the merged head: complete normal and race packages pass for lockservice and substrait; focused race regressions pass with count=20; go vet and make err-check pass; coverage is 87.6% for lockservice and 84.6% for substrait; git diff --check passes. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
P1 blocker: allocator timeout invalidation can still transfer this exclusive callback before the old callback is joined. The generation check only makes a stale validation lose after a successful renewal. If disableTableBindsAtGeneration wins with the current generation (lock_table_allocator.go:448-460), the next requester is immediately published as owner (lines 630-643); the old origin learns about the loss only on its next renewal (service.go:447-450), so its callback can still be inside the FileService capacity scan/write (journal.go:115-137).\n\nI reproduced this on the exact current head with a three-CN counterexample: pre-bind the table to B, start the callback from A, sample the current generation after the admission renewal, let invalidation of that generation succeed, then acquire from C. C enters the same exclusive row before A is allowed to return. The race test reproduces under -race -count=5; A can even return nil when it finishes before its next renewal. The new TestRunExclusiveLockFencesRemoteOwnerOrphanAndRebind snapshots the generation before admission renewal and only proves the opposite ordering, where stale invalidation loses.\n\nBecause the journal writes carry no allocator epoch/CAS, a completed old write cannot be retracted. Please fence the durable store (or make failover handoff wait for old callback completion) and add a regression where current-generation invalidation wins and the successor still cannot enter/publish until the old callback is joined.
|
@XuPeng-SH Thanks — the current-generation counterexample is valid. I addressed it at head
The push hook merged current Validation on the exact final head: focused Substrait regressions pass; full |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep-reviewed exact head b915ff7fa0bc3d579a91a301e957e45544c4b566.
The prior current-generation invalidation blocker is resolved by withdrawing the unsafe production contract: the lockservice-backed coordinator and public FileService journal constructor are gone, pkg/lockservice has no remaining PR diff against current main, and the FileService journal/coordinator seam is package-internal with an explicit durable-handoff requirement. Consequently the unfenceable multi-CN write path from the previous counterexample is no longer reachable through a claimed production API.
I also rechecked the resulting journal/replay/revocation invariants and the main-merge nullability adjustment. The complete pkg/sql/plan/substrait suite passes on this exact head, including capacity serialization, authority/release linearization, replay bounds, rollback, resolver authorization, and eligibility regressions. All live CI checks are terminal and green.
iamlinjunhong
left a comment
There was a problem hiding this comment.
Deep review of exact head b915ff7fa0bc3d579a91a301e957e45544c4b566 against merge-base 494d77c8443b51694e0cbac7fc0a03b9a7f887eb.
The previous P1 on journal_coordinator.go was explicitly answered by the author and is resolved on this head: the production coordinator and all PR lockservice changes were withdrawn. One new blocking P1 is recorded inline; no additional P0/P2/P3 findings were confirmed.
| Lifecycle check | Result |
|---|---|
| Q1: one effective cleanup/ownership owner | Failed: absolute expiry can remove the object pin before sidecar execution reaches Finish. |
| Q2: every wait terminates | Resolver byte admission, audit, HTTP shutdown, and lease cleanup have bounded cancellation/timeout paths; no hang was confirmed. |
| Q3: every accumulation is bounded | Lease count, manifest/schema size, replay batches, resolver in-flight bytes, and object enumeration are bounded. |
All 31 checks are complete with accepted conclusions, and git diff --check passes.
iamlinjunhong
left a comment
There was a problem hiding this comment.
Deep re-review of exact head d83ae49e46bb1bf1f054afa602ec329b8a2f878c against merge-base 75d61d06bfaa2c3a7f86bab5ccf461df42acf20f.
The previous P1 was explicitly answered by the author and is resolved on this head: expiry now revokes resolver access only; expired unreleased leases remain protected, survive replay, and retain capacity until the terminal execution owner has stopped/joined readers and calls Release. This preserves the fail-closed storage contract for the next execution PR without reintroducing premature unpinning.
No current P0, P1, P2, or P3 findings were confirmed. I rechecked the full exporter → admission/journal/resolver → disttae snapshot → TAE GC call chain, failure cleanup, replay, concurrency bounds, compatibility gates, tests, PR conversation, reviews, and review threads. All 31 checks have accepted conclusions (18 pass, 13 skipped), and git diff --check passes.
Merge Queue Status
This pull request spent 43 minutes 14 seconds in the queue, including 42 minutes 35 seconds running CI. Required conditions to merge
|
What type of PR is this?
Which issue(s) this PR fixes:
issue #26156, #26157
What this PR does / why we need it:
This is PR 2 of the revised #26154 Sirius offload split. It combines the logical Substrait export contract with snapshot-safe TAE read admission so the next PR can focus on execution and result transport without reopening storage correctness.
The change:
TaeReadand resolver protobuf wire contracts without exposing object locations in the plan;Validation:
pkg/sql/plan/substrait,pkg/vm/engine/disttae/sidecar, andpkg/vm/engine/tae/db/gc/v3;pkg/sql/compile;git diff --check.