Repository navigation
fix: preserve retry outcomes and consolidate lifecycle coverage - #29663
Conversation
Reuse one process per sequential fixture-focused parent test while preserving every case oracle and cleanup path. Refs #29249
Reuse one process for stateless typed conversion, bit, and MakeSet leaves while preserving each leaf's cleanup and oracle. Refs #29249
Reuse parent-owned processes for sequential JSON member-of cases while preserving vector metadata and cleanup. Refs #29249
Reuse one parent-owned process for sequential Convert USING charset cases while preserving per-case vectors and assertions. Refs #29249
Reuse one parent-owned process across sequential datetime zone-map cases while preserving per-case timezone setup and scratch cleanup. Refs #29249
Replace scheduler sleeps with synchronous cancellation and pause barriers, and verify the paused retry path is actually exercised. Refs #29249
Replace scheduler sleep with an observable waiter phase barrier and join the wait goroutine before assertions and pooled cleanup. Refs #29249
Replace the scheduler sleep with a synctest barrier and hold the consumer registration until the drain has observed its completion signal. Refs #29249
Make retry-all behavior explicit instead of relying on a nil classifier that Policy.Do treats as no retry. Replace timing-based duration coverage with a zero-backoff boundary assertion and remove duplicate retry tests.\n\nRefs #29249
Drive the watermark queue directly and invoke cronRun as a barrier so persistence assertions do not depend on scheduler ticks, polling retries, or random sleeps. Keep the concurrent case concurrent with an explicit start gate.\n\nRefs #29249
XuPeng-SH
left a comment
There was a problem hiding this comment.
Review decision: changes required before merging.
The three findings in the previous review are substantively addressed: Future argument forwarding/readiness, mixed CDC registration/removal with shared-index consistency, and bounded cron observation/shutdown. The design direction is reasonable: the existing Policy owns retry duration, and cron reconciliation retains its existing owner. However, a new executed counterexample shows that the upstream executor still overrides the authoritative terminal retry outcome with historical failure state. Please fix the inline P2 before merging.
Validation on a625495: temporary overlay tests for context cancellation after a retryable failure, and task pause/cancel after a connection-reset failure, fail their intended error assertions (including under race). Removing only the historical lastErr return override in a control overlay makes all three scenarios pass. Repository source was not modified. Nine owning packages pass race on this head; async evidence is reused because its source and dependency closure are unchanged. Current-head CI SCA, Ubuntu UT, and the actually executed multi-CN BVT checks succeed; skipped checks are not counted as passing.
Non-blocking cleanup in the same retry closure: the retry_success logging branch is unreachable because the successful operation sets lastErr=nil before the branch requires lastErr!=nil. The begin := time.Now() value is also discarded without a metrics consumer. Remove this dead work or give it an actual consumer.
The publication package's approximately 17.9-second improvement is test latency, not a production throughput measurement. No subagents were used and no review documents were committed.
|
|
||
| policy := e.retryPolicy | ||
| policy.MaxAttempts = e.calculateMaxAttempts() | ||
| policy.MaxDuration = e.retryDuration |
There was a problem hiding this comment.
[P2] The retry closure is not fully integrated with Policy's terminal outcome: see the historical lastErr return override at sql_executor.go:764-765. Preserve the terminal error returned by Policy.Do instead of overriding it with lastErr. After a retryable query failure, context cancellation or ActiveRoutine pause/cancel can terminate the policy without updating lastErr. This fallback then returns the obsolete query error to ExecSQL's caller: errors.Is(err, context.Canceled) fails, and pause/cancel are reported as connection reset. I reproduced all three cases on this head, including under race; a control overlay removing only this fallback makes all three pass. Return the policy's terminal err after the deliberate ErrNonRetryable mapping and retain historical operation errors only for diagnostics. Extend the existing execWithRetry tests to cover cancellation/deadline and pause/cancel arriving after a retryable failure, rather than only before execution.
There was a problem hiding this comment.
Fixed in c785a9f. Policy.Do now owns the terminal result; the historical-error override, unreachable retry-success branch, and unconsumed timer read are removed. Existing tests cover cancellation/deadline and pause/cancel after a transient failure with zero/positive attempt timeouts, plus cleanup, success and exhaustion controls. Restoring only the old override fails eight regression leaves. Publication normal/race, both targeted timer roots x100 race, and incremental configured SCA pass. gpt-6.1-sol/xhigh final overall review approves delivery with no unresolved material blocker. PR body follows the template and closes #29670. CI on this pushed head remains pending; no CI pass is claimed.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep review of c785a9f against 15cc623: no new material blocker found. The design is acceptable.
All four earlier findings are substantively addressed:
- Policy.Do retains authority over terminal retry errors; historical operation errors no longer override cancellation/deadline or task pause/cancel. This closes the defect tracked by #29670.
- Cron/CDC observations are bounded and failure cleanup is retained; the same-class TestWait correction cancels and joins before waiter recycling.
- Future argument forwarding, nil/order/pointer identity, independence, and readiness before Get are asserted again. Dropped-argument and suppressed-readiness mutations fail.
- CDC registration/removal exercises shared subscription indexes, preserves a surviving anchor, and checks exact membership and final seven-map emptiness. The neighbor-deletion mutation fails.
Responsibility and complexity: the existing Policy owns retry admission, duration/backoff, and terminal outcomes; the executor owns attempt contexts and the deliberate exhaustion mapping. Cron tests reuse the production reconciliation owner. No duplicate retry state machine or execution path was introduced. Unreachable success logging and the unused clock read were removed. Successful child-context ownership transfers to the caller; failed attempts are cleaned up.
Additional QA in this review: temporary test overlays challenged a disabled duration budget with absent/present backoff and zero/positive attempt timeouts, plus a transient failure followed by a distinct nonretryable error. Both exact roots pass under race. Restoring only the historical error override fails eight existing regression leaves while controls pass. No repository source was changed for these probes.
Validation: current publication whole-package normal 0.317s and race 1.757s pass; two selected retry roots each pass 100 race repetitions. Configured incremental golangci 2.14, vet, custom molint, and error checks pass. All 40 changed-file fingerprints match the reviewed evidence; unaffected package evidence is reused only where the source/dependency closure remains unchanged.
Increment: production 4 files +92/-68 (net +24); tests 36 files +1453/-1818 (net -365); tracked documentation unchanged. Overall net -341. Publication test latency decreased by about 17.9 seconds; this is not a production throughput measurement. Behavioral and failure-path oracles, rather than line counts, support the cleanup.
Limits: no new BVT run in this read-only review. Earlier multi-CN BVT evidence belongs to the parent head and is not counted as current-head validation. At the review's final CI snapshot, Linux SCA, Ubuntu UT, coverage UT, and shared build were still running; skipped checks are not counted as passing. This review does not assert that CI is green.
No subagents were used; no review documents were committed to the branch.
#29669) Main BigData still spends extra time generating hidden primary keys and appending ordinary CSV values. Reduce those costs at their existing owners. The investigation uses the complete 22-case/340-statement [Main run](https://github.com/matrixorigin/mo-nightly-regression/actions/runs/37489307309) and [4.2 attempt 2](https://github.com/matrixorigin/mo-nightly-regression/actions/runs/37334858166). - **Hidden primary-key allocation:** #29527 bounds speculative reservations to protect visible AUTO_INCREMENT from huge planner estimates. Bulk fake-PK generation consequently makes frequent allocator requests; private COPY executes allocator metadata SQL repeatedly in its growing transaction workspace. Prefetch now follows successfully assigned actual rows, saturating at 1M, while the initial reservation remains 10k. Qualification requires authoritative hidden fake-PK ownership, default service policy, unit step and default session series. Explicit service/table policies and visible user columns retain their policy. Cold/reset owners obtain the qualification in the existing catalog snapshot. - **Ordinary append:** skip empty metadata preparation/publication only when the existing scalar, sidecar and preflight state proves the operations have no effect. Keep physical data/bitmap admission, borrowed ownership, JSON checks, metadata transitions and failure rollback. - **Spill regression coverage:** retain the codec implementation already merged in #29646 unchanged. Consolidate one `BenchmarkSelectedRowsVarlenaDecode` with inline/nullable/64B long values, 23/24B boundaries, VECF32/VECF64, account peak and reusable destinations. Preserve all upstream codec tests and the four distinct PR boundary/capacity/invalid-length/borrowed-owner cases. The real MergeGroup consumer still checks spill/reload, exact DISTINCT values and resource release; its fixed test ledger makes forced spill independent of host pressure. The allocator change directly applies to no-PK writes and DROP-PK COPY that generate fake keys. ADD-PK COPY is a safety control here; its complete performance difference has additional contributors. Existing #26706 locking, #29664 and all main changes are preserved. No regression-runner or BigData coverage changes are included. ### Review integration and fresh component comparison [Review 5444104534](#29669 (review)) is addressed by merging current main and removing this PR's duplicate production decoder rewrite. Both conflicting codec files are reconciled; there is one decoder and one benchmark. The former 72%–74% decoder improvement belongs to the now-merged #29646 and is **not** incremental evidence for this PR. Fresh baseline: `3d796acf87081d48cb01449dce2a34d366534b24`, including #29646 and #29663. Delivery also integrates `ea011906d61dfe2b023993dbbbe2e778459776f8` (#29662); that subsequent frontend catalog lookup change is outside the measured vector/allocator dependency paths. Both benchmark binaries use the exact same fixtures; allocator qualification goes through production `GetAutoColumnFromDef` with a hidden column in both versions. The baseline overlay restores all six remaining production files to the named main revision and excludes only the new private-field UT when compiling the baseline. Vector measurements use Go1.27.0, Linux/amd64, GOAMD64=v3, GOEXPERIMENT=simd, the same provenance-checked native build, CPU6, GOMAXPROCS=1 and four alternating pairs at 300ms per workload. | Workload | Fresh result versus main | | --- | --- | | 1M actual generated IDs in batches of 8192, private-mode and committed caches | 101 → 8 range requests; 1,010,000 → 1,052,192 reserved values, initial reservation 10k | | 8192 ordinary BIGINT appends | 34.16% lower component latency; zero allocations retained | | 8192 ordinary inline / area VARCHAR appends | 15.12% / 17.75% lower component latency; zero allocations retained | | 8192 NULL BIGINT / VARCHAR appends | 12.56% / 9.92% lower component latency; allocation counts unchanged | | Prepared / literal / binary-prefix append controls | 0.84% lower / 4.56% higher / 1.01% lower component latency | | Consolidated main codec control | All 18 shape/size cells pass; 3 heap allocations per reusable decode; no additional decoder speedup claimed | The literal-prefix cost is an accepted guard overhead outside the ordinary CSV path. The allocator probe uses an in-memory store: its request/reservation counts are evidence, its timing does not reproduce SQL workspace cost. The historical estimate-prefetch control still reserves 2,000,010,000 values in 3 requests; that policy is not restored. These are component measurements, not a completed billion-row or 8-hour acceptance run. ### Validation after integration - Complete owning/consumer packages pass: vector, incrservice, group and mergeutil (669 top-level tests, all passed). The later frontend-only main commit leaves their tested source/dependency paths unchanged. - Complete vector/incrservice/group packages pass under race on integrated head `6537884aa4c5b936863f289fe20af43ce91d85f4`. - Real authenticated two-CN `TestBigDataBulkWriteAndPrimaryKeyCopyPreserveRows` passes in 9.00s: 32,768 rows, cold catalog lookup, ADD/DROP PK COPY, exact values/NULLs/vector payloads, duplicate COPY rejection with continued writes, and visible fake-PK-name user control. - Existing `TestIssue29602IndexBackfillLocksStayScopedToPrivateTargets` passes in 0.28s, preserving #26706 cross-CN row locks, uniqueness rejection, rollback and release. - Bulk-demand tests cover 2M IDs in private and committed CREATE owners, explicit config/table/session/step opt-outs, failure, terminal uint64, cold rebuild and cross-CN uniqueness. Existing estimate-gap protections remain and pass. - Real accounted MergeGroup VECF32/F64 spill/reload checks exact DISTINCT values, NULL and terminal memory/disk/FD release. All upstream codec UTs plus PR boundary, exact-capacity/one-byte-short, borrowed-owner and failed-decode reuse checks pass. - Fresh paired append measurements, both allocator count probes and all 18 consolidated codec benchmark cells reach PASS. Three independent focused source reviews have no remaining blocker. - `vet=all` for the five affected/consumer packages passes. Repository-config incremental golangci-lint v2.14.0 (Go1.27) reports zero issues; gofmt and final diff checks pass. The original-head CI was green before main integration. Its result is historical evidence; the updated head requires its new CI checks before merge. Commands, with the repository native prerequisites built: ```sh GOAMD64=v3 GOEXPERIMENT=simd .agents/skills/mo-dev/scripts/mo-cgo-test \ -count=1 -timeout=180s ./pkg/container/vector ./pkg/incrservice \ ./pkg/sql/colexec/group ./pkg/objectio/mergeutil GOAMD64=v3 GOEXPERIMENT=simd .agents/skills/mo-dev/scripts/mo-cgo-test \ -race -count=1 -timeout=180s ./pkg/container/vector ./pkg/incrservice ./pkg/sql/colexec/group GOAMD64=v3 GOEXPERIMENT=simd .agents/skills/mo-dev/scripts/mo-cgo-test \ -count=1 -timeout=300s \ -run '^(TestBigDataBulkWriteAndPrimaryKeyCopyPreserveRows|TestIssue29602IndexBackfillLocksStayScopedToPrivateTargets)$' \ ./pkg/tests/issues GOAMD64=v3 GOEXPERIMENT=simd .agents/skills/mo-dev/scripts/mo-cgo-test \ -run '^$' -bench '^BenchmarkAutoIDCacheBulkAllocationRequests$' -benchtime=1x ./pkg/incrservice ``` ### Limits and follow-up acceptance Successful assignment demand is not committed-row count; later SQL/transaction failure need not undo it. The adaptive asynchronous span is bounded; synchronous real-batch/concurrency demand retains its existing policy. Qualification adds one catalog aggregate to cold GetColumns, including visible-user tables, rather than each allocation. Frozen BigData YAML and the inspected operator configuration pipeline contain no explicit cache count; the installed Pod TOML was not retrieved. Verify actual activation and remaining critical-path time in the next complete BigData run before claiming end-to-end recovery. Approved by: @XuPeng-SH
What type of PR is this?
Which issue(s) this PR fixes:
Refs #29249
Closes #29670
What this PR does / why we need it:
Consolidate lifecycle and failure coverage at existing owners, remove duplicate test paths, and replace timing assumptions with observable completion.
The complete 40-file delta is +1,545/-1,886 lines (net -341): production net +24, tests net -365, no tracked documentation changes. The latest correction removes 14 production lines and adds 135 net test lines to close demonstrated missing error/ownership scenarios. No new fixture, retry layer, SQL statement behavior, wire format, or schema change.
Validation
Local Go 1.27.0, GOMAXPROCS=2, package build parallelism=1, recorded repository CGo setup:
No additional BVT was run for the Go executor error-classification correction; SQL result/wire/schema contracts are unchanged. Parent head a625495 CI SCA, Ubuntu UT, and actually executed multi-CN BVT checks succeeded; those results are historical. CI on the final pushed head is pending and is not represented as passing.