Repository navigation
[4.2-dev] Backport six startup, RPC and memory-lifetime fixes - #32332
LeftHandCold merged 11 commits into
Conversation
…xorigin#28384) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#28383 ## What this PR does / why we need it: Retire unaccounted off-heap realloc's address-keyed ownership and profiling identity **before** the physical allocator can release/reuse the old address. Shard locks alone cannot protect allocation generations when retirement happens after address reuse. - Detach ownership and capture the exact profile sample before physical realloc. - Restore both on physical failure, preserving the old payload and accounting. - On success, retire the captured sample without looking up a potentially reused old address; register the new allocation normally. - Keep allocator calls outside metadata locks. No new retained state, background work, production injection hooks or transient allocation caches. - Leave accounted allocate-copy-free, cross-pool/source provenance, on-heap behavior and allocator algorithms unchanged. This PR deliberately excludes the earlier allocator performance experiments. ### Test plan / QA reference Validated on **10.222.1.55, Linux/amd64, Go 1.26.6**, based on main `34aff8c5e2c8388514a194d5f5d3a5e5110cfe65`. Native inputs/artifact provenance were verified. No mo-service was started for this focused mpool change. | Scenario | Evidence | |---|---| | Actual mmap release/cache publication boundary | Identical deterministic test fails on base with stale ownership and passes on fix. Existing cache gauge observes metadata at publication; no scheduler-dependent assertion. | | Profile address reuse | Controlled old/new allocation-generation samples; new owner's sample survives old realloc retirement. | | Physical allocation failure | Isolated Linux subprocess imposes RLIMIT_AS, covering libc/mmap-sized old allocations and accounted/unaccounted paths. Checks exact metadata/lease, payload, pool/global/profile counts and final cleanup. | | Concurrent allocation/realloc/free | 8 workers, preserved prefix, zeroed growth, final pool accounting; focused race x100 passes. Baseline stress also passes: this is not the reproducer. | | Existing consumers and boundaries | Full mpool suite includes PtrLen replace/append, source provenance, zero-capacity views, cap rejection, overflow and allocation-account tests. | ```sh TEST=.agents/skills/mo-dev/scripts/mo-cgo-test TZ=UTC "$TEST" -v -count=1 -timeout=120s ./pkg/common/mpool TZ=UTC "$TEST" -race -json -count=1 -timeout=120s ./pkg/common/mpool TZ=UTC "$TEST" -race -count=100 -timeout=120s -run '^TestConcurrentReallocAddressReuse$' ./pkg/common/mpool TZ=UTC "$TEST" -race -count=100 -timeout=120s -run '^TestReallocRetiresMetadataBeforeCachePublication$' ./pkg/common/mpool TZ=UTC "$TEST" -race -count=100 -timeout=120s -run '^TestProfileReallocAddressReuse$' ./pkg/common/mpool TZ=UTC "$TEST" -run '^$' -bench '^BenchmarkProfileAllocFree$' -benchtime=200ms -count=3 ./pkg/common/mpool ``` All above pass on the candidate. Owning normal/race package durations: 0.216s / 3.088s. Exact race tests measured below timer resolution, so bounded stress uses 100 repetitions. `go vet` with repository CGo include/library settings and `git diff --check` pass. Matched base/fix profile alloc/free benchmark medians (three 200ms samples): | Case | Base | Fix | Allocations, both | |---|---:|---:|---:| | Stack profiling | 1178 ns/op | 1146 ns/op | 0 B/op, 0 allocs/op | | Accounted provenance control | 398.2 ns/op | 394.1 ns/op | 0 B/op, 0 allocs/op | No alloc/free regression observed in this microbenchmark; no claim of SQL-level speedup or reproduced server crash. ### Pre-PR review Independent **GPT-6 medium** reviewed the implementation and subsequently the deterministic release-boundary test and final validation evidence. Final result: **approve / no unresolved blockers**. Reviewer verified candidate file hashes match the tested 55 worktree. Ownership, rollback, address reuse, lock/wait bounds, test cleanup and performance scope were reviewed. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> (cherry picked from commit 585a38e)
…9352) ## What type of PR is this? - [x] BUG ## What this PR does / why we need it A prepared compiled scope can retain its closed execution reader after the pipeline resets TableScan. That reader can keep an obsolete disttae PartitionState, including row/batch backing, reachable for the lifetime of an idle prepared handle. After pipeline cleanup in Scope.Run, clear only Scope.DataSource.R. The reader remains live during execution and is closed by the existing pipeline operator reset; reusable relation metadata remains cached. The next EXECUTE builds its own reader as before. The regression first failed against upstream/main with Close called and TableScan.Reader nil but Scope.DataSource.R still nonnil. It now covers success, read error/panic, active-reader use, exactly-once close, direct and single-reader ParallelRun paths, and two-worker parallel-generated scopes. Validation: full pkg/sql/compile and pkg/frontend tests, go vet, incremental golangci-lint, and diff check pass. A candidate real MySQL prepared-session replay and quantitative heap/RSS study were not run. This PR fixes the demonstrated reference chain, but does not claim to resolve the separate matrixorigin#29270 OOM incident. ## Which issue(s) this PR fixes Fixes matrixorigin#29326 Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> (cherry picked from commit c701ffa)
- [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring Fixes matrixorigin#29560. `TestJoinCoordinatorStage` completed its five SQL subtests, but cluster cleanup timed out after 40 minutes. FIN held the receive-state mutex while waiting for synchronous send completion. The exiting writer's deferred session Close needed the same mutex before it could drain and fail the queued FIN Future. Server shutdown then waited forever for that writer. Claim FIN in the existing receive-state registry, release its mutex before cache access/write admission/send completion, and retire receive/send sequence state only after successful flush. The inline terminal claim rejects duplicate FIN and later requests on that stream while unrelated streams can progress. Close can independently drain pending sends; closed sessions cannot recreate receive state. Complete the same response ownership boundary: release pre-send FIN rejections, configure the pipeline server's existing MORPC drop-release callback, use the cached message ID after goetty encoding, and snapshot Future flags before completion can return them to their pool. Ordinary Future cancellation semantics remain unchanged to protect borrowed payload lifetime. No new queue, worker, timer, retry, wire format, catalog format, or persisted-data format. The terminal flag lives only in an existing active-stream entry. This removes network-length receive-state lock contention and the shutdown deadlock; no SQL throughput improvement is claimed. - Deterministic white-box reproduction fails on clean production code at main `113d374b2e5167238d8411c117dfe879aef8bad6`; explicitly releasing the queued Future allows both blocked calls to finish. - Candidate tests cover queued FIN with no writer, real writer failure and Stopper completion, duplicate FIN/later-request exclusion, unrelated stream progress, invalid authority/pending cache, canceled admission with a full queue, exact message/Future releases, and zero retained state/queue gauges. - Each of eight focused FIN tests: independent `-race -count=100` runs passed; cleanup-adjusted cases were revalidated. - MORPC owning package: normal with `-vet=all` and race passed. - CN service owning package: normal with `-vet=all` and race passed. - Compile FIN lifecycle/ACK success/error/timeout consumers passed. - Real two-CN `TestJoinCoordinatorStage`: normal 18.012s and race 23.311s, including cluster teardown and port-lease release. All five SQL subtests retained. - Incremental golangci-lint for the affected packages and final test delta: 0 issues. - Local environment: Darwin arm64, Go 1.26.4, repository native build and CGo wrapper. This is not a claim of a Linux CI pass; CI remains pending and is not waited on. Design and final overall review completed using actual `gpt-6.1-sol` / `xhigh`. Final decision: PASS, no unresolved material code or validation blockers. Reviewed base `113d374b2e5167238d8411c117dfe879aef8bad6` plus all five final delivery files; source fingerprints match the validation ledger. Session `01a0f77c-c1ba-76e3-ae82-ba019248459d`. (cherry picked from commit 32f5498)
…#29586) MORPC idle GC can close a healthy connection while an accepted unary RPC is still waiting for its response. Unary requests do not lock the backend, and heartbeats intentionally do not refresh business activity. In matrixorigin#29582, the CN received `backend connection closed` after approximately 59 seconds, while the TN completed the five-minute checkpoint later. Recheck idle eligibility under the existing backend state and Future-map locks. A live ordinary unary Future prevents idle sealing. Seal request/stream admission before scheduling existing bounded asynchronous cleanup, so a previously selected handle cannot admit work after GC. Preserve completed/canceled/deadline cleanup, stream locks, draining ownership and pool accounting when cleanup slots are full. No new occupancy counter, worker, timer, retry path or public interface is introduced; the Future scan runs only for aged candidates. The CI follow-up repaired the prepared-authorization fixture's stale call to a retired table-only helper using the active object-scoped helper with `objectTypeTable`. The latest main now owns the identical fixture correction, so it is no longer an additional file in this PR's diff. All authorization assertions remain, and the retired production wrapper remains removed. ISCP lease validation now uses the executor callback's logical row count across batches. A valid constant vector can represent two rows with one physical string: the old reader incorrectly accepted that as one runner. Reject multiple logical rows before copying data, copy only the single runner, and reject NULL/empty runners. Existing transaction/result cleanup and system-account execution remain unchanged. Consolidate the reader tests into nine orthogonal cases while reducing that test file by two lines. Approved by: @XuPeng-SH (cherry picked from commit ff4468a)
…n#30536) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#30532 ## What this PR does / why we need it: Public MORPC client-session close could release the transport reference owned by an active writer. When the application read owner also closed, Goetty freed the buffers while Encode/Flush still used them, explaining the zero-capacity ByteBuf panic during restart shutdown. Separate socket interruption from final buffer release using existing Goetty ownership: public close disconnects and cancels writes; only the writer finalizer or rejected-start rollback releases the writer reference. Keep generation-aware session retirement unchanged. This adds no lock, copy, allocation, or per-message work to the normal path and changes no wire/storage format or dependency. Deterministic regression coverage uses real Goetty sessions and explicit barriers to check borrowed-buffer lifetime, rejected writer startup, blocked flush/payload writes, message release, and final buffer reclamation. The active-Encode test fails on the unchanged production base (two buffers freed prematurely) and passes with this fix. This reproduces the lifetime defect; it does not claim to reproduce the exact original CI instruction interleaving. Validation (Linux/amd64, Go 1.27.1, canonical isolated native build): - Full MORPC normal and race suites pass. - Three new regression roots each pass 100 race repetitions; refined blocked-I/O cases pass normally too. - Incremental gofmt, vet, pinned golangci-lint and molint pass. - Exact `TestDataBranchDiffAcrossCheckpointGCAndRestart/flush_only_restart`: coverage PASS (original 510-package manifest, set mode, 7.2s); race PASS (8.93s). A short private TMPDIR was required because the shared lease directory is owned by another user; a first private path exceeded Linux Unix socket length. Those setup failures are excluded from the passing results. The same saved instrumented coverage binary was executed with the corrected runtime directory. - Design and final overall review: gpt-6.1-sol / xhigh, PASS with no remaining blockers. Remote CI remains pending. No new SQL behavior is introduced; the existing embedded restart case is the affected service-level validation. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> (cherry picked from commit 2508ce7)
…play (matrixorigin#30761) During the first catalog replay, a logtail receive/consumer error calls `pause(false)`: the receiver stops, but the first-connect retry loop still owns recovery. If the in-progress replay then succeeds, the old success path publishes ready and returns without reconnecting. The receiver waits for resume, the connector waits for a signal, and bootstrap cannot obtain a fresh snapshot timestamp. - Give each connector one completion notification for its first successful catalog replay. - A receiver paused before that handoff requests the existing reconnect path when replay completes. This also covers an error that sampled `first=true` before the handoff but calls `pause(false)` afterward. - Serialize first ready publication with `pause`; do not admit transactions from an initial connection already known to be paused. - Preserve first-subscription retries and cancellation. Reuse the existing transport recreation, consumer cleanup, system-table subscription and catalog replay; do not simply resume a failed stream. The production change is limited to `logtail_consumer.go`. There is no change to Raft, WAL, persistence, wire protocols, timeouts, query execution, or the established reconnect algorithm. The additional state is one channel per connector, closed once by its owner; normal queries incur no new work. Base: official main `67c91c5bdf6c669f63331778634215f7aa3e8f58`. Local platform: Darwin/arm64, Go 1.27.1, native dependencies built with the repository's `make cgo` and tests run with `mo-cgo-test`. - Deterministic handoff tests cover failure before/after replay, a delayed stale `pause(false)`, first-connect retry, cancellation, no premature admission, and one recovery signal per pause. A real LogtailClient/receiver stream-close control is included. Focused race tests pass with `-count=20`. - `pkg/vm/engine/disttae`: complete package passes normally and with `-race`. - `TestCNFirstReplayDisconnect`: uses real CN/TN/LogService, existing replay/receive fault points, a fresh TN timestamp fence, real bootstrap, and SQL create/insert/read assertions. Normal and race runs pass. It uses no new production fault hook and does not need a large catalog. - Negative control: the identical integration test with the exact base production file times out at the fresh-TN-timestamp assertion. Only that production file is overlaid; its blob is verified against the base commit. The test deliberately detects the stall before entering bootstrap's five-minute timeout. - Incremental golangci-lint v2.14.0: 0 issues. Scoped `go vet`, `molint`, formatting and diff checks pass. - Complete service package with the repository's existing `-race -short` selection: PASS (49.819s). The new real-service recovery test is not skipped in short mode. The **unfiltered service package is not green**: `TestTaskSchedulerCanAllocateTask` and `TestCronTask` report `task store not ready`; both were independently reproduced with the exact base production file. Base and candidate full-race runs also stalled in the existing `TestTaskSchedulerCanReallocateTask` cleanup (`task_test.go:193`, unbuffered `halt <- true`); stacks were captured and those runs stopped. These are not passing results and are not modified by this PR. The new recovery test itself passes in both modes. The fix covers the confirmed initial-replay/disconnect handoff, not arbitrary bootstrap failures or an unavailable TN. Upgrade automation should still verify actual SQL readiness before advancing DN; Pod Ready alone is insufficient. The incident cluster was not modified, and its full rolling upgrade was not repeated as part of this PR. Approved by: @XuPeng-SH (cherry picked from commit 1362ffb)
…lay recovery Keep 4.2 queue instrumentation and inline the existing user-unary traffic predicate instead of importing Main read-window machinery. Port the first-replay service regression to the existing embed owner and isolate process-wide faults; verify a fresh TN timestamp and two real prepared-statement executions. Original fixes remain in independent provenance-preserving commits.
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? |
Use the existing synchronous observer fixture instead of starting a real allocator and background keeper for a synthetic epoch sequence. Preserve bounded history and stale-response checks, and verify stale-holder removal plus FIFO/map consistency. This removes the test-side race reported by PR 32332 UT without changing production code or readiness timeouts.
|
已推送修复 commit 已核对本轮 UT(run 42497643221 / job 128783390103,head 1. 已确认并修复:allocator observer 测试和后台 keeper 竞争
这一用例及相关 lockservice 生产代码在 PR head 与基线 修复只改变这个用例的夹具:复用已有的最小
2. 尚未复现:共享分片集群初始化超时
CI 同期有 HAKeeper proposal/client 超时及 Raft 本次不为这个未复现问题修改生产逻辑、提高 readiness 超时或跳过用例。此前几轮失败项不同,不能归为同一分片故障持续失败。 验证环境:Go 1.26.4 / Darwin arm64,
本次修复仅针对已确认的测试夹具竞态。完整 Linux CI 和共享 Runner 下的分片启动结果仍需新一轮 CI 确认,不把本地定向通过等同于全套 CI 通过。 |
iamlinjunhong
left a comment
There was a problem hiding this comment.
Reviewed exact head 5c31351ad8a6e6919be773504165edfb26aa684b against 4.2-dev@0351bc89d7478ccd908fbc7b084ff0dd71a0ee80, within the six-backport scope of #32157. No confirmed in-scope findings. APPROVE.
The full 23-file diff and affected callers were checked, including these ownership and progress boundaries:
| Area | Review result |
|---|---|
| Unary idle GC | Pending user Futures protect admission; sealing precedes bounded cleanup, including saturated cleanup capacity. |
| FIN and transport close | Terminal claim excludes later requests without holding the receive lock during send; rejected responses have a release owner; writer finalization retains buffer ownership. |
| Off-heap realloc | Metadata/profile identity is detached before address reuse and restored on physical allocation failure; accounted allocation retains its existing path. |
| First replay and prepared reuse | Existing connector receives the recovery handoff; paused first replay does not publish readiness; completed Reader references are removed after pipeline cleanup. |
| Test follow-ups and ISCP | Logical cardinality/NULL handling, isolated replay admission, cross-CN visibility fence and allocator-observer fixture retain their behavioral assertions. |
CI is not uniformly successful: the supplied review snapshot contains 29 completed checks: 14 success, 13 skipped, 2 neutral, with no failed or pending checks. CI Required, UT, and coverage succeeded. Skipped/neutral checks are not counted as passed.
Local read-only verification: git diff --check and the prescribed PR artifact checker passed; the source worktree remains clean. No local tests were run: the supplied exact-head CI was reused, and static inspection identified no uncertainty requiring a targeted execution. This is not release or rolling-upgrade qualification.
Previous-feedback reconciliation was skipped because this is the first review and the supplied review/inline history is empty. Documentation-specific validation was skipped because no documentation files changed.
|
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: 5c31351ad8a6e6919be773504165edfb26aa684b
Assessment: approve
The six backports preserve existing admission, cleanup and recovery ownership. The FIN bit and replay notification provide necessary synchronization, and fixture fixes retain their behavioral assertions. No actionable in-scope defects remain.
Model: gpt-6.1-sol / max
Session: 01a1a004-9884-72c0-ad39-f096c4209c4a · slot 1 · generation 0
Validation:
-
Reviewed all 23 changed paths, all 4 discussion entries, linked issues and affected ownership/lifecycle paths.
-
Static audit passed: whitespace, formatting of all 23 Go files, source integrity and discussion coverage; receipt 1794201183956107040-2. Source remains unchanged.
-
Verified the pinned Goetty dependency; receipt 1794200700596608616-2. Receipts and logs are reconciled in validation-ledger.json.
-
Frozen exact-head CI: 14 success, 13 skipped, 2 neutral; successful build, UT, SCA, coverage, proxy/pessimistic BVT and CI Required.
Limitations:
-
No local product tests or stress runs were executed; author-reported runs were assessed against matching source and current CI.
-
No production workload benchmark or release/rolling-upgrade qualification was performed.
## What type of PR is this? - [ ] API-change - [x] BUG - [x] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to #32146. ## What this PR does / why we need it: Backport the large-variable-length write memory fixes and their lifecycle dependencies to `v4.2.8-hotfix`. A 196,092-row fixture with very large JSON/text values completes its batched UPDATE on 4.2.8 but OOM-kills a 20-GiB CN during the subsequent VARCHAR-to-INT COPY ALTER. The backports bound CN spill runs and pooled writer retention while preserving buffer/object ownership through completion, cancellation, and failure. Cherry-picked with source provenance, in order: #32081, #32155, #32332, #32164, #32398, #32454, and #32065. The target branch's existing #32704 is retained. There are no manual production-code changes to the seven backports. Validation on head `cc1d6c51a156e232182030b093bbf9bfc1ae95c1`: - Fresh native build succeeds with actual-head version/commit metadata. Formatting and `git diff --check` pass. All seven commits have identical added/removed lines and paths to their source commits; only #32155 has documentation-only unchanged-context differences. - Actual-head full-data run PASS: 196,092 rows, 147,941 converted rows; PK/row count, payload byte lengths and CRC sums, final statuses, and INT type verified. All roles report `OOMKilled=false`. - CN limit and total memory+swap are both 20 GiB, 6 CPUs, GOMEMLIMIT 1 GiB, cache 2 GiB. Sampled CN RSS peak: **12.4115 GiB** (2-second sampling). Sampled cgroup usage peak: 19.7955 GiB; kernel cgroup high-water reached 20 GiB, with zero failcnt/OOM. RSS is not total container memory, so this does not imply 7.6 GiB of container headroom. - Driver start through final verification: **431.90 s (7m12s)**, including token UPDATE **221.59 s**, token COPY ALTER **200.84 s**, and remaining validation/setup. Service startup and cold-backup restore are excluded. - Native-toolchain scoped regressions pass: nine owning packages (2,302 tests/subtests); compile import/cancellation selector (153); focused race checks across mpool, rscthrottler, objectio and ioutil (93). Runs use `-count=1`, the repository CGo test wrapper, and default vet checks. No failures; task services are stopped. Full-repository CI/review is not part of this local validation, and further GitHub results are not awaited. The workload measures the MOI offset212 token-table migration, with placeholder companion tables, rather than all MOI deployment phases. Logical restore uses a shared DISK backend and changes the original physical object layout; customer data and raw logs are not included in this PR. Single-run timings are not a statistical performance benchmark. Revision `b6b9f3ba40d7bb9e598b2a8846b7ed166b4a48b7` (test-only follow-up): - Carries #32439's unordered two-observation reset assertion and #28467's 512-MiB RLIMIT target; closes the actual fixture-owned increment service; adapts first-replay setup to this release's embed API and TCP SQL transport. Production changes in the seven backports remain identical to their sources. - New local validation (Darwin/arm64, Go 1.27.1, CGo wrapper, `-count=1`): owning production packages build; all four changed test packages vet; `objectio/ioutil` full coverage and race pass; `mpool` coverage passes; `sql/compile` full normal and race pass with `TMPDIR=/private/tmp`; first-replay startup/disconnect/reconnect/prepared SQL passes normal and race. Spill-reset and fixture-ownership tests each pass `-race -count=100`. Formatting, diff whitespace, and delivery artifact checks pass. - Run 43449877707 attempt 1 failed SCA job 131969091882 (`make static-check-analysis`) on missing `embed.WithDataPath`; coverage job 131969165708 reports that build error, RLIMIT runtime allocation failure, and the fixture closure assertion. These backported test defects are addressed here; the old run is not rerun because the push triggers fresh CI. Pinned molint rebuilt for the local Go version exits zero but emits inherited analyzer diagnostics; this is not a zero-diagnostic SCA claim. - Local Parquet fanout failures also reproduce in an unmodified archive of target base `b572b5cd95a25d404cd0f0df32629b39c6fff120`; full PR compile normal/race pass with a short temporary root. No Parquet code/test is changed. Linux-only RLIMIT execution is reused from #28467's upstream coverage/race evidence; not executed on this Darwin host. Original migration and other upstream validation above retain their stated revisions/configurations; the customer-data migration was not repeated for these test changes. New CI is not awaited. Raw local logs remain outside the source tree. --------- Co-authored-by: aptend <[email protected]> Co-authored-by: XuPeng-SH <[email protected]> Co-authored-by: GreatRiver <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: 和光同尘 <[email protected]> Co-authored-by: jiangxinmeng1 <[email protected]>
The original backport carried matrixorigin#32332 and matrixorigin#32398 from 4.2.8. Retain the matrixorigin#32065 cleanup error propagation and mpool allocation accounting. The independent startup, RPC, realloc, prepared-reader, and IVF changes can be reviewed separately.
What type of PR is this?
Which issue(s) this PR fixes:
issue #32157 (first batch only; keep the tracking issue open)
What this PR does / why we need it:
Backport six focused startup, RPC, and memory-lifetime fixes onto
4.2-dev@02fcfbc898f595b4f8eeb3545c6970e6d3711e85. These old paths are still present on that release baseline. This is deliberately not a bulk backport of the tracking issue's 30 entries and is not release approval.readSingleTaskRunner.Each source retains an independent
cherry-pick -xcommit. Release-adaptation commit72fb70919a9b98213af778cc7a4d6525e97dd7c4uses 4.2's existing Future predicate and queue instrumentation rather than importing unrelated Main machinery. The real first-replay regression uses 4.2's existingpkg/embedcluster owner, with process-wide faults isolated in a dedicated test package, and also checks real MySQL prepared-statement reuse.Scope and design review
Deliberately not included
Tested with
Original backport validation:
72fb70919a9b98213af778cc7a4d6525e97dd7c4. Local runs used Go 1.26.4, Darwin arm64, native libraries built from this release tree,GOMAXPROCS=2,-p=1and normallyGOMEMLIMIT=2GiB. Earlier pre-commit runs retain their working-tree identity; their relevant source content matches that original validation commit. No historical Main test result is presented as a test of this backport.[1,2], then[2]. The dedicated test package isolates faults from the shared embed cluster.TestSingleCNCluster02fcfbc898plus only regression probes reproduces three real failures: stale metadata at allocator-cache publication, queued-FIN close deadlock, and buffers freed during active Encode. Candidate passes the same oracles. The baseline physical-allocation-failure test already passes and is retained as compatibility coverage, not claimed as a new failing counterexample.Linux used existing immutable build image
sha256:44069beb9d61e8d1d6766f1d214eb94843257616bc8c9291ee53fae1edbbd7fa, fresh candidate/base native builds and separate source/cache directories. Containers had 2 CPUs, 4 GiB memory+swap limit, 512 PIDs and no network. Existing services on 50 were not changed.The first capped full CN runs failed
Test_service_handleGoMemLimit/set_4Gi: that test assumes the initial Go memory limit isMaxInt64, but the explicit test environment supplied 2 GiB. The exact capped case on clean baseline02fcfbc898fails with the same expected-MaxInt64/actual-2147483648 signature. We did not weaken its assertion or change product code. The package is run with that one case excluded under the cap, and the exact scalar-only case is separately run in normal/race withGOMEMLIMITunset. Original failed receipts remain failed.Stress: 21 individually selected MORPC/mpool/compile/disttae cases passed independent
-race -count=100runs on Darwin. The isolated embed recovery case passed its proportional repeat (T=17.25s,B=30s,N=1). Linux cache-publication retirement passed-race -count=100; physical allocation failure passed-race -count=29(T=1.03s,B=30s). Selections are non-empty and recorded by individual test name.Commands use the repository CGo wrapper, with serial package builds:
go vetpassed for all seven affected production/test packages;git diff --checkpassed. Incremental golangci-lint was not validated: locally installed versions are incompatible with the repository's v2 config/Go 1.26 toolchain. No lint configuration or dependencies were changed to bypass this limitation. No full BVT, production workload benchmark or rolling-upgrade qualification is claimed; PR CI and release qualification remain separate.Incidental bug findings
pkg/tests/service.buildCNConfigon the target baseline validates a newly generated CN UUID before registering its service runtime, causing a nil-runtime panic before the cluster starts. This is already addressed upstream by #30380 (0723ae37b1); disposition: Duplicate / not included. The new regression uses the existing embed fixture, which already registers the runtime and catalog definitions. It does not patch or claim validation of the legacy service fixture, and does not pull in the broader CN-drain changes from #30380.Ordinary off-heap profiling has a separate pre-existing enable/allocate/disable/free boundary: the pool returns to zero but the profile pointer/in-use sample remains recorded. An isolated baseline probe reproduced it; disposition: Created #32334 / not included. This is diagnostic metadata retention, not a demonstrated native-buffer leak or customer OOM, and does not change this batch's scope or review conclusion.
CI test follow-up
Follow-up commit:
6404268dae8b5d78a12fb0459b67991c8893a9cd.After the 4.2-dev merge, UT and coverage exposed a process-admission deadlock in
TestCNFirstReplayDisconnect: the shared embed fixture held the runner-wide lock while its test process waited for a child that needed the same lock. Move the existing recovery test into its own test package, remove the recursive subprocess, and acquire the existing process admission before starting replay deadlines. Fault injection remains process-isolated, and the real fresh-TN-timestamp and two prepared-execution result oracles are retained.The coverage run also failed an existing dropped-user authorization assertion across two CNs. The reader uses its locally applied statement snapshot, so the test now fences the committed DROP and verifies through independent CN1 SQL that the user is absent before checking that the already-authenticated session is denied. This establishes denial after visibility; it does not claim instantaneous cross-CN revocation or prove the precise cause of that CI failure. The unmodified 4.2-dev baseline passed three normal repetitions.
Follow-up validation on Linux/amd64, Go 1.26.4, matching branch-local native libraries:
6c7dca5dafter the shared cluster starts; the independent test passes with the same lock held by another process for over 40 seconds, then released, including under-race. A separate cancellation control confirms admission times out before faults or a cluster start.pkg/embedandpkg/embed/firstreplaysuites run together with-p=2: PASS (230.547s and 17.923s). Existing process-admission exclusivity, reentrancy and cancellation tests also pass under-race.TestIssue29399AuthorizationScopeAndRevokedRole: three normal repetitions and one-racerun pass, including the CN1 public-SQL visibility and retained-session denial checks.-tags matrixone_test -short -covermode=setexecution of both scenarios passes with cnservice, MORPC, mpool, ISCP, compile, disttae and frontend instrumented. This is not the full CI coverage producer.go vetpass for the affected packages; repository-configured golangci-lint 2.6.2 built with Go 1.26.4 reports 0 issues for the follow-up diff. The original backport diff passed arm64 SCA on6c7dca5d.gpt-6.1-terra/max. Independent overall review:gpt-6.1-sol/max, no material code blocker; final evidence reconciled before delivery.The follow-up changes only tests; it adds no production hot-path work. Full post-push CI and release/upgrade qualification are separate and are not claimed as passed here.