Repository navigation
fix(objectio): isolate shared metadata load cancellation - #29779
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? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Reviewed commit 94449d9bd382269c29c0396daa7c5410494dafa5 against merge-base d7621ea017db4e43dbde9e5a855ba7b2ad920784. APPROVE — no blocking finding. All three changed files reviewed, including the complete test additions.
The fix belongs in the existing objectio metadata-result coordinator. Fileservice's IOMerger owns physical read/cache-fill notification; it does not supply this uncached decoded-result/error contract. The new group/current/users state has a concrete purpose: preserve the latest takeover result for already-admitted waiters while allowing independent callers after a terminal result. The owner executes its closure once, and re-election occurs only after an attributed cancellation. No SQL retry, detached context, duplicate cache or alternative execution path is introduced.
Checked cancellation/deadline ownership, mixed error trees, cache rejection/pressure skip, delayed waiters, repeated abandoned generations, independent later owners, and panic/incomplete loads. Channel close publishes result fields; the election mutex protects current/users and is not held across I/O. Terminal and last-user cleanup close group lifetime, including the old-waiter/new-owner boundary. ReadExtent retains its existing success/error read-result cleanup ownership. No new unbounded history or retry resource was found.
Validation:
- Exact-head CI run is successful. The Proxy BVT log explicitly reports
publication_subscription/pub_sub4.sql: 122/122, no failures/ignored/abnormal results, 7.071s. This includes the original prepared subscription/local/subscription rebinding query. Reused the author's recorded focused race stress, readutil/static checks and repeated same-instance BVT/teardown evidence. - Independent adjacent challenge: after the original owner's cancellation, the elected replacement either returns a storage failure or panics after another waiter joins. The peer must receive the terminal failure without another load; the group must disappear; the same key must load successfully again. Repeated the cycle on the same key. Reviewer probe passed
-race -count=100; full objectio package also passed-race -count=1(6.673s), with the repository CGo wrapper on Go 1.27.1/Darwin arm64. - Restoring the actual base implementation makes the changed cancellation regression fail with a live waiter receiving the owner's cancellation, confirming the discriminating control.
git diff --checkpassed.
Performance is not zero-cost on misses. A reviewer microbenchmark with I/O removed and admission deliberately disabled isolates coordinator overhead: serial medians were 109→173ns (GOMAXPROCS=1) / 84→132ns (8); 8-worker disjoint-key throughput cost was 299→399ns/op. Allocation increased 176→192 B/op, 2→3 allocs/op. Three samples per mode; same inputs except the base/head cache.go implementation. The normal outer metadata/BloomFilter cache-hit path is unchanged. This bounded cold-path cost is justified by the correctness fix; these measurements do not establish TP throughput or latency impact.
Incremental quality: implementation +107/-22, tests +620/-4, docs 0. The tests exercise distinct error/generation boundaries and real metadata/BF readers with one object/row, deterministic admission barriers, exact results/read counts, and cleanup before restoring globals. Existing panic and cleanup assertions remain. No unused new state or unnecessary abstraction identified. There are no prior human review comments or inline threads to close; the only existing comment is the paused review bot.
Merge Queue Status
This pull request spent 3 minutes 32 seconds in the queue, with no time running CI. ReasonPull request #29779 has been dequeued Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.
HintYou should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. Waiting for any of
All conditions
Tick the box to put this pull request back in the merge queue (same as
|
…agnostics (#32905) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to #32389. Backports the metadata cancellation fix from #29779. ## What this PR does / why we need it: When parallel readers share a metadata or Bloom filter load, a normal pipeline stop can cancel the load owner. A waiter whose own context is still live used to receive that owner's cancellation as its read result. This can interrupt or underfill an IVF training sample. The existing cache coordination now lets a live waiter take over after the owner returns a cancellation attributable to its context. Each caller can issue at most one load under its own context, with at most one active owner per key. Real I/O errors, mixed errors, and the waiter's own cancellation or deadline retain their semantics. Cache hits bypass load coordination. Scope cancellation that survives classification gets a structured event before cleanup changes context state. It records the phase, original and returned errors, observed context causes, and trace or transaction correlation. - Bare cancellation or deadline matching the reader's own context is a bounded DEBUG event. Unattributed, mixed, and actual storage failures remain visible at ERROR. A normal stop while building parallel readers is DEBUG and still contributes to its existing counter. - Typed terminal sends do not wait for channel capacity. Connector, dispatch, and remote notification report an unqueued terminal as DEBUG when the edge already holds a durable terminal state. A missing channel or still-active edge remains WARN. Existing cleanup counters stay intact, and cleanup logs share the existing strict time budget. - An optional disk-cache write canceled by its caller is DEBUG and does not inflate the disk-cache error rate. Real write or cleanup failures remain WARN and count as errors. The SQL results, terminal delivery and storage format stay the same. Cache hit behavior is unchanged. The cold metadata path adds one small group allocation and synchronizes admission and cleanup. A single-threaded coordination-only microbenchmark measured 481 to 533 ns/op, excluding object I/O. ### Validation - Full race runs for `pkg/objectio`, `pkg/sql/compile`, and `pkg/vm/engine/readutil`. Retained cache ownership cases were also stress-tested under race. Cleanup owners and consumers were covered by the final race run. - Scope and reader log checks distinguish matching cancellation from failure while contexts are live. Disk-cache tests cover matching cancellation, deadline, mixed errors, and a real cleanup failure racing cancellation. Existing terminal delivery and event budget checks continue to pass under race. - Incremental gofmt, diff check, and golangci-lint passed. Any molint findings in the selected packages also occur on the base revision. - Earlier controlled SIFT1M runs demonstrated the shared-load defect and validated the cache-only correction. The first cancellation source of the historical TKE failures remains unconfirmed. - On the delivery code, a local three-CN cluster built an IVF index three times over 1M SIFT128 rows with `vector_ip_ops lists=500`, returned 10 rows from the normalized vector query each time, and dropped each index. The local launcher used an isolated proxy port. The INFO log contained no reader cancellation errors, false terminal timeout warnings, or disk-cache cancellation warnings during these builds.
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #29704
What this PR does / why we need it:
Concurrent metadata reads share a
dedupLoadresult, but their cancellation ownership is independent. An empty subscription branch can finish normally and cancel the loader while another branch still needs the same object metadata. Previously, the live waiter inherited the loader'scontext canceled, causing the prepared JDBC metadata query to fail.A controlled local replay of the prepared SQL reproduced this path: the loader's pipeline stopped normally, while the waiter received its error with a still-live context. The same replay succeeds with this fix. All temporary scheduling/cold-cache diagnostics have been removed.
Changes
Validation
Local validation with Go 1.27.1 on Darwin arm64, using the repository CGo test wrapper:
pkg/objectio: full package tests, coverage, and full package race test passed.-race -count=100, including deterministic delayed-reelection cases (cached, rejected cache admission, takeover failure, and independent later owner).pkg/vm/engine/readutil: full package tests passed.publication_subscription/pub_sub4.sqlon a local two-CN + Proxy cluster: 122/122 on two consecutive runs, no failed, ignored, or abnormal cases; teardown verified after each run. Preserves the prepared subscription/local/subscription 3 / 2 / 3 oracle.gofmt,go vet, and incremental golangci-lint 2.14.0 passed.The delayed-reelection regression tests failed against the initial patch and pass with the group-lifetime fix. After merging upstream
mainat908166384d, reran the full objectio tests/coverage/race, focused race stress, readutil tests, static checks, service build, and two-CN + Proxy BVT listed above.No generated files, SQL expectations, CI configuration, or diagnostic artifacts are included.