Skip to content

test: reduce race fixture work and fix ISCP and cross-CN test synchronization - #30334

Merged
XuPeng-SH merged 12 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/ut-race-followup-20261015
Oct 16, 2026
Merged

XuPeng-SH merged 12 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/ut-race-followup-20261015

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

Fixes #30291
Fixes #30324

Related investigation: #30309, #30322, #30323. These three are not fixed by this PR: the original CI failures have not been reproduced or sufficiently attributed. Additional process diagnostics are not presented as a root-cause fix.

What this PR does / why we need it:

Reduce redundant race-test work and remove wall-clock assumptions while preserving the behavior under test. This is a follow-up to merged #30277; its savings are not counted again here.

Implementation and test design

  • Release frontend process/file-service fixtures on every test exit, check protocol packet buffers directly, and replace redundant allocator scans with complete byte verification.
  • Replace the large PK-filter expectation matrix's diagnostic work with direct, independent selection oracles. Preserve vector-print behavior in explicit golden tests.
  • Exercise append visibility at every prefix around bitmap word boundaries with both 64- and 128-bit timestamps rather than growing 10,000 redundant MVCC nodes. Retain the aggregation spill boundary with a smaller real fixture.
  • Run scheduler harness cases concurrently only when they have isolated temporary directories and no process-global environment mutation. Preserve the process pool defaults, cancellation, cleanup and report ownership. Include batched embedded reports in heartbeat monitoring and collect bounded process diagnostics even when no Bash trace exists.
  • Construct constant NULL vectors with the existing vector allocator instead of constructing an unrelated Process and its file services. Remove the unused helper.
  • Give functional embedded task discovery an explicit one-second test-only interval through the existing testing configuration owner. Keep scenario overrides effective. Production timing, persistent formats and mixed-version behavior are unchanged.
  • In the CDC restart regression, capture the stopped daemon's task ID and claim generation, then expire only that claim's heartbeat. The real restarted runner must still claim the task and satisfy the original durable-watermark and row-result assertions. The fixture no longer waits for a production-length lease to expire.
  • For [Bug]: ISCP long-drain revalidation race test can expire before first runner lookup #30291, use virtual time for the three related ISCP drain/revalidation tests. Preserve deadline values, cancellation/error assertions and first-lookup ordering; keep unrelated real workers outside the virtual-time bubble.
  • For [Bug]: CI late_snapshot TRUNCATE test observes original table ID #30324, establish the existing SYNCCOMMIT fence at four cross-CN producer/consumer boundaries. Keep table-identity, foreign-key, row and lineage assertions. The original CI stale-read flake was not deterministically reproduced locally; the missing causal boundary is addressed without changing production consistency semantics.

Local measurements and limits

Measurements are sequential local comparisons, not promises about whole-CI time:

Scope Before After Interpretation
Two public CDC lifecycle tests 104.4 s 36.4 s About 68 s saved across discovery and restart-fixture changes
Allocator owning-package sample 30.9 s 7.9 s Retains all allocation sizes and full-byte checks
Readutil owning-package sample 18.7 s 6.8 s Independent expected-selection checks
MVCC visibility sample 17.0 s 1.2 s Same measured covered blocks; explicit bitmap boundaries
Complete light-stage comparison 410.2 s 409.3 s Wall time essentially unchanged; CPU about 3.8% lower, PSS peak about 13.8% lower

Do not add these package timings together as CI critical-path savings. A ten-minute whole-CI reduction has not been demonstrated.

A four-process issues/embedded experiment saved 4 min 39 s but increased total CPU by 42% and PSS peak from 5.30 to 7.10 GiB. That scheduler change was rejected and is absent from this PR. Its complete test outcomes were identical, but its speedup is not claimed as a delivered benefit.

The universal test-only one-second discovery setting has a cost: a six-root control showed CPU 19.26 -> 21.59 CPU-seconds with essentially unchanged wall time. This is a local tradeoff for faster functional transitions, not evidence that all test workloads use less CPU.

Validation

Completed locally before the final rebase:

  • Owning-package normal/race tests and incremental configured vet/lint for the changed closures, including frontend, allocator, readutil, aggregation, MVCC, scheduler fixtures, ISCP and the constant-NULL consumers.
  • Full SQL integration package: 279 named passes in normal mode and the same 279 in race mode after the CDC lease change.
  • ISCP owning-package normal/race runs; a deliberate OS scheduling delay reproduces the original pre-lookup timeout assumption and the virtual-time treatment passes.
  • Focused multi-CN replacement-revalidation regressions with the original public SQL and metadata assertions.
  • Complete light-stage comparison: all original named outcomes retained, three added independent PK-filter test outcomes, unchanged skips. Representative coverage-block comparisons retained for the rewritten fixtures; this is not a claim of identical whole-repository coverage. Two unrelated asynchronous frontend warning blocks differed across coverage runs and are not hidden by padding tests.
  • Real public SQL issues/embedded stage runs in the rejected concurrency experiment retained all 2,663 named passes and 15 existing skips. This validates those test outcomes, not the final default schedule's performance.
  • No new retries, enlarged failure timeouts, test skips, production data-format changes or additional CI runners.

Post-rebase validation

Rebased cleanly onto main 48dbe277b6; final head 9fbf3952ea. git range-diff confirms all 12 patches are unchanged by the rebase.

  • Passed native provenance verification using the controlled GCC CPU-release profile.
  • Passed git diff --check, shell syntax and gofmt checks.
  • Passed go vet -mod=readonly and repository-configured incremental golangci-lint across all 15 changed Go packages (0 issues).
  • Passed the following real go test -race -short -tags matrixone_test -count=1 runs:
Package / selection Named passes Existing skips Package result
optools 330 0 pass
pkg/frontend 5883 1 pass
pkg/sql/compile 3272 0 pass
pkg/tests/sqlintegration 282 0 pass
pkg/tests/issues (focused #30324 regression) 18 0 pass

These are executed results at the rebased head; the earlier measurements retain their original pre-rebase provenance. No pending CI, whole-workflow BVT, full-repository race run or whole-repository coverage verdict is claimed.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@XuPeng-SH

XuPeng-SH commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · done

Commit: 9fbf3952eaa63d2d0b8fec22dd10be61d5ed052a

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mo-bot review · mo-bot-local · review

Commit: 9fbf3952eaa63d2d0b8fec22dd10be61d5ed052a

Assessment: approve

Reviewed the complete 25-file delta and affected callers. The design reuses existing allocation, configuration, cleanup and synchronization owners, preserves behavioral assertions, and reduces fixture work without adding production SQL overhead. No blocking defects remain.

Model: gpt-6-astra / xhigh

Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1

Validation:

  • Isolation preflight passed. Verified 192 native inputs and 62 artifact hashes; source remained unchanged.

  • Full normal tests passed in 13 owning packages. Full race tests passed in optools and malloc; focused race checks passed across eight additional packages.

  • All four virtual-time tests passed 100 individual race iterations.

  • Real CDC restart, takeover and cross-CN replacement-revalidation tests passed normally and under race detection. CDC restart additionally passed two consecutive race iterations.

  • Changed-file formatting, diff checks, shell syntax, removed-helper references, incremental go vet and configured golangci-lint passed; lint reported zero issues.

  • Single-sample race comparisons using base-test overlays: managed allocation 7.69→1.06s, PK-filter construction 5.70→3.21s, MVCC visibility 11.97s→below log resolution.

  • Reconciled 16 successful check receipts with commands, source fingerprints and retained logs. Audit passed: /home/xupeng/.local/state/mo-bot/jobs/09877638e8b06ba8a1d7e8fc/attempt-1/evidence-audit.json.

Limitations:

  • Validation ran on Linux CPU. Frozen CI was pending; no whole-workflow BVT or repository-wide race pass is claimed.

  • Performance samples used a shared host and establish fixture improvements, not whole-CI savings. More frequent test-only task polling retains the author's disclosed CPU tradeoff.

  • Linked issue bodies were absent from supplied evidence. PK-filter coverage remains differential; MVCC coverage exercises bitmap boundaries, not alternate timestamp formats. Pre-rebase author claims were not treated as current-head execution evidence.

@XuPeng-SH
XuPeng-SH merged commit a85d90e into matrixorigin:main Oct 16, 2026
@XuPeng-SH
XuPeng-SH deleted the codex/ut-race-followup-20261015 branch October 16, 2026 00:58
XuPeng-SH pushed a commit that referenced this pull request Oct 16, 2026
…30382)

## What type of PR is this?

- [ ] API-change
- [ ] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [x] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

Fixes #30344

## What this PR does / why we need it:


`TestIssue30090ReplaceViewLifecycleOrder/prepared_reader_rebinds_after_replace`
replaces a view on CN1 and immediately re-executes the prepared reader
on CN0, expecting the replacement result (5). Under
sacrificing-freshness consistency a CN read snapshot is bounded by its
own applied logtail watermark, so CN0 can still legally observe the
pre-replacement view and return the old result (3); CI under load hits
this window intermittently.

The prepared-plan invalidation path itself is sound: PREPARE captures
the view ObjectRef in the plan schemas, and EXECUTE detects the
replacement through the catalog cache (`HasNewerVersion` sees the new
relation id) once CN0 has consumed the commit, then rebuilds the plan.

This PR establishes CN1 -> CN0 visibility with the existing
`mo_ctl('cn', 'SYNCCOMMIT', '')` fence before the revalidation
assertion, the same boundary fence main's #30334 added for other
cross-CN tests. No sleeps, retries, relaxed expectations, or skips are
introduced; the expected value 5 and all other assertions are unchanged.

Local validation on Darwin/arm64: focused run passes all five subtests;
`-count=5 -race` repeat run passes.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
mergify Bot pushed a commit that referenced this pull request Oct 18, 2026
### Design record

- Added versioned design: `docs/design/20261010-alter-copy-pre-publication.md`.
- The design records the speculative-preparation/publication split, authoritative after-copy source-frontier revalidation, persisted-delete coverage, actual nested lock state, terminal retry and whole-transaction rollback ownership, transaction-local relation and workspace-write handling, alternatives, compatibility, source-state cost model, and validation map.
- Independent design approval of that exact revision is still required before implementation approval.

### Root cause

`ALTER TABLE ... COPY` acquired the transaction-scoped global SNAPSHOT lineage-owner gate before temporary-table creation, physical row copy, auto-increment reconciliation, and unaffected-index cloning. Every independent branch ALTER therefore held the stable `mo_catalog.mo_feature_registry` row for `SNAPSHOT` until commit. Under the reported 500-worker workload, unrelated ALTERs serialized behind each other and eventually returned MySQL 1205 lock-wait timeouts or MySQL 2013 connection losses.

Moving physical work before that gate also exposed correctness obligations:

- ALTER must not hold source locks while waiting for the lineage gate.
- Unlocked preflight must not take authoritative owner-row locks.
- Publication must reject source replacement, same-ID schema changes, row changes, and lineage-state changes that happened during physical preparation.
- If a concurrent same-table ALTER removes an index table between preparation and resolution, missing metadata must become a controlled definition-change retry rather than a nil-pointer panic.

### Exact changes

- Split unlocked lineage inspection and timestamp selection from authoritative, gate-protected lineage preparation in `pkg/sql/compile/alter.go`.
- Run lock-free temporary-table creation, physical row copy, auto-increment reconciliation, and unaffected-index cloning before acquiring the global lineage-owner gate. The temporary CREATE passes `WithDisableLock`, so it does not retain the source database shared lock or temporary target table exclusive lock.
- Acquire the lineage gate before source database, catalog-table, and physical-table locks. Existing upstream TRUNCATE behavior already uses compatible ordering; the existing TRUNCATE interleaving test is updated to observe physical work before the gate and gate acquisition before source locks.
- Preserve late broad admission after rebase onto `4022729da2`, while adopting upstream's `admitBroadTableLifecycleRC` API and logical-ID-aware historical-source probes.
- After gate acquisition, advance the RC snapshot, re-resolve the source, and reject source-ID replacement, same-ID table-definition-version changes, source data changes since copy, foreign-key state changes, stale lineage, late historical ownership, and same-statement lineage column replacement before publication.
- Preserve the physical-copy timestamp when lineage becomes relevant only during late publication.
- Replace the post-copy CDC handle probe with `SourceCommitTSAfterCopy(copyTS)`. It uses the authoritative partition-state frontier, excludes only current-transaction workspace writes, includes in-memory rows, data objects, and persisted tombstone objects, fails closed for unavailable providers, and short-circuits once a source frontier exceeds the copy timestamp.
- Aggregate `SourceCommitTSAfterCopy` across every combined partition member, short-circuiting after any member exceeds the copy timestamp and failing closed for missing member providers; a local write on one member no longer suppresses checks for other rows or partitions.
- Convert post-physical source replacement, definition-version, source-data, lifecycle-admission-retry, and source-lock-refresh races to terminal `ErrTxnWriteConflict`; RC statement retry therefore cannot repeat physical preparation while retaining locks. The frontend classifies this conflict as a whole-transaction rollback in both autocommit and explicit-transaction mode.
- Convert a nil source-index object or definition returned by unlocked `Resolve` into `ErrTxnNeedRetryWithDefChanged`, preventing the CI-observed stale-index-generation panic.
- Add the optional `RelationCreatedInCurrentTxn` and after-copy source-frontier relation capabilities with disttae primary, combined-table, and delegate implementations. Relation-created sources skip the committed probe; existing relations with local writes still check committed mutations from other transactions.
- Add deterministic source-lock retry coverage for optimistic ALTER, catalog-table contention, and physical-table contention.
- Update the concurrent stale-index integration test to require terminal error 20601 for a post-copy source-admission race, explicitly retry that statement in a new transaction, and retain the final schema/index/default assertions.

### Issue-to-test proof

- Independent ALTERs no longer serialize: `TestAlterCopyPhysicalWorkDoesNotWaitForLineageOwnerGate` proves both independent physical inserts start while the lineage gate is held elsewhere.
- Lifecycle lock order is acyclic: `TestAlterCopyAndDropUseGateBeforeSourceLocks`, `TestAlterCopyAndTruncateUseGateBeforeSourceLocks`, and `TestAlterCopyAndTruncateSerializeBeforeTableLocks` prove ALTER physical work starts before the gate and both ALTER and TRUNCATE record gate acquisition before source locks.
- Source-lock retry contracts are explicit: `TestLockAlterCopySourceRetryContracts` proves optimistic transactions take no source locks, while catalog-table and physical-table retry errors are converted to `ErrTxnNeedRetryWithDefChanged`.
- Unlocked preflight is read-only and race-safe: `TestInspectAlterDataBranchLineageSeesBranchCreatedAfterPreflight` and `TestAlterTableHasLatestHistoricalBranchSourceUsesFreshUnlockedProbe` prove a late branch is rediscovered by authoritative postgate preparation.
- Stale-copy protection is terminal: `TestAlterCopyRejectsSourceReplacementAfterGate`, `TestAlterCopyRejectsSourceDataChangeAfterCopy`, and `TestAlterCopyRejectsSameIDSourceDefChangeAfterGate` reject replacement, row changes, and same-ID definition changes before publication.
- Missing index metadata is controlled: `TestCloneUnaffectedIndexesRetriesWhenSourceIndexDisappears` proves the definition-change retry path instead of a nil dereference.
- Publication and rollback remain correct: `TestAlterCopyLateLineagePublicationUsesCopyTimestamp`, `TestAlterCopyFailsAfterPhysicalWorkWithoutReleasingGate`, and same-statement replacement coverage verify the original timestamp, injected failure, and no publication after stale-copy discovery.
- Transaction-local state is handled explicitly: `TestAlterCopySkipsSourceChangesForRelationCreatedInCurrentTxn` skips the probe only for relation-created sources, while `TestAlterCopyChecksCommittedChangesDespiteTransactionLocalWrites` proves local writes do not suppress another transaction's committed change. `SourceCommitTS` itself still fails closed for async-index callers.
- Nested CREATE does not retain catalog locks: `TestAlterCopyCreateOptionsDisablesNestedCreateLock` proves `WithDisableLock`.
- The source frontier is bounded and authoritative: `TestAlterCopySourceChangedSinceCopyUsesSourceCommitTS` and `TestAlterCopySourceChangedSinceCopyFailsClosedWithoutProvider` cover unchanged, changed, and unavailable states; `TestSourceCommitTSAtIncludesPersistedTombstone` proves a persisted DELETE advances the frontier.
- Partition aggregation is correct: `TestCombinedTxnTableSourceCommitTSReturnsMax`, `TestCombinedTxnTableSourceCommitTSShortCircuits`, `TestCombinedTxnTableSourceCommitTSFailsClosedForMissingProvider`, and `TestCombinedTxnTableSourceCommitTSPropagatesMemberError` cover member maxima, short-circuiting, and fail-closed behavior.
- Terminal conflicts do not enter RC statement retry: `TestAlterCopyPostPublicationConflictIsNotStatementRetryable` checks both `isRetryErr` and `canRetry`.
- The reported concurrency shape passes: 500 independent branch tables and 500 concurrent ALTER sessions complete with zero lock-wait and zero connection-loss failures.

### Reproduction

- Issue baseline at `77dbf5464466b1d5ae784e7d17d92cd1c1c8d17d`: 301/500 workers completed, 199/500 failed, 172 failures were MySQL 1205, and 27 failures were MySQL 2013.
- Deterministic pre-fix ALTER ablation: replacing only `pkg/sql/compile/alter.go` with its base-compatible version causes `TestAlterCopyPhysicalWorkDoesNotWaitForLineageOwnerGate` to time out while both independent physical inserts wait behind the global lineage gate.
- CI regression: old run `37943988958` panicked in `constructTableClone` from `cloneUnaffectedIndexes` during `TestIssue277xxDDLConsistency/27725_concurrent_alter_retries_a_stale_physical_index_generation`. The missing-index retry guard and exact integration test now pass.
- Definition-guard ablation: removing only the postgate definition-version comparison causes `TestAlterCopyRejectsSameIDSourceDefChangeAfterGate` to lose the expected retry error.
- Real workload: 500 workers, 500 independent branch tables, a one-row base, and a 120-second command timeout completed in 71.995 seconds with 500/500 successful ALTERs, 500/500 observed columns, 0 failed ALTERs, 0 MySQL 1205 errors, 0 MySQL 2013 errors, and successful database cleanup (`/tmp/mo-29208-concurrency-500-revision-r6.out`).
- Source-frontier cost: `BenchmarkSourceCommitTSAtUnchanged250KObject` modeled one unchanged 250,000-row non-appendable object with a threshold after every row commit and measured `44075 ns/op`, `1125 B/op`, and `4 allocs/op` on Apple M5 (`darwin/arm64`, 10 GOMAXPROCS).

### Tests

- Previous review-response, CI-regression, and rebase validation on head `104cac3d12`:
`.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=1200s ./pkg/sql/compile ./pkg/vm/engine/disttae ./pkg/vm/engine/disttae/logtailreplay`
— passed after the rebase onto `42d42546fd2c2b2449cb81cea47f81d300139753`: compile in 18.925s, disttae in 11.943s, and logtailreplay in 8.386s.
`.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=900s -run '^TestIssue27055DatabaseCloneReadsExplicitTransactionSource$' ./pkg/tests/issues`
— passed in 13.087s after the transaction-local workspace-write fix.
`.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s -run '^(TestTxnTableHasTransactionLocalWrites|TestCombinedTxnTableHasTransactionLocalWritesShortCircuits|TestAlterCopySkipsSourceChangesForTransactionLocalWrites)$' ./pkg/vm/engine/disttae ./pkg/sql/compile`
— passed in 1.370s and 1.403s.
- Rebase integration on `433a8dc26c`:
`.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s ./pkg/sql/compile`
— passed in 15.293s.
`.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s ./pkg/vm/engine/disttae ./pkg/vm/engine`
— passed in 9.901s and 1.537s.
`.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=900s -run '^(TestIssue277xxDDLConsistency|TestIssue29400CopyAlterRetainedGatePromotionFastFails)$' ./pkg/tests/issues`
— passed in 18.517s.
`.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=900s ./pkg/frontend ./pkg/sql/plan`
— passed in 37.126s and 36.724s.
`gofmt -l`, `git diff --check`, and `git status --porcelain=v1 -uall` — clean.
- Exact CI regression:
`.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s -run '^TestIssue277xxDDLConsistency/27725_concurrent_alter_retries_a_stale_physical_index_generation$' -v ./pkg/tests/issues`
— passed in 11.668s on the latest rebased head.
- Exact-head focused closure:
`.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s -run '^(TestCloneUnaffectedIndexesRetriesWhenSourceIndexDisappears|TestAlterCopyAndTruncateSerializeBeforeTableLocks|TestIssue277xxDDLConsistency/27725_concurrent_alter_retries_a_stale_physical_index_generation)$' ./pkg/sql/compile ./pkg/tests/issues`
— compile tests passed; the exact integration subtest was rerun explicitly as above.
- Coverage-closing lock contracts on `e3de6b6204`:
`.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s -run '^TestLockAlterCopySourceRetryContracts$' ./pkg/sql/compile`
— passed.
`.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s -run '^(TestAlterCopyPhysicalWorkDoesNotWaitForLineageOwnerGate|TestAlterCopyAndDropUseGateBeforeSourceLocks|TestAlterCopyAndTruncateUseGateBeforeSourceLocks|TestAlterCopyFailsAfterPhysicalWorkWithoutReleasingGate|TestAlterCopyLateLineagePublicationUsesCopyTimestamp|TestAlterCopyRejectsSourceReplacementAfterGate|TestAlterCopyRejectsSourceDataChangeAfterCopy|TestAlterCopySkipsSourceChangesForRelationCreatedInCurrentTxn|TestAlterCopyRejectsSameIDSourceDefChangeAfterGate|TestAlterCopyRejectsSameStatementReplacementDiscoveredAfterGate)$' ./pkg/sql/compile`
— passed.
`.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s -coverprofile=<profile> -run '^TestLockAlterCopySourceRetryContracts$' ./pkg/sql/compile`
— passed; the profile records executions of `alter.go` blocks `1187`, `1199`, and `1210`, the three previously uncovered changed blocks that caused the 73.61% PR coverage result.
- Full owning package:
`.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s ./pkg/sql/compile`
— passed in 14.577s on the rebased head `e3de6b6204`.
- Adjacent engine packages:
`.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s ./pkg/vm/engine/disttae`
— passed in 7.745s.
`.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s ./pkg/vm/engine`
— passed in 0.827s.
- Race stress:
`.agents/skills/mo-dev/scripts/mo-cgo-test -race -count=10 -timeout=300s -run '^(TestAlterCopyPhysicalWorkDoesNotWaitForLineageOwnerGate|TestAlterCopyAndDropUseGateBeforeSourceLocks|TestAlterCopyAndTruncateSerializeBeforeTableLocks|TestCloneUnaffectedIndexesRetriesWhenSourceIndexDisappears)$' ./pkg/sql/compile`
— passed in 4.688s.
- Static validation:
`GOWORK=off CGO_CFLAGS="-I<cgo> -I<thirdparties>/include" go vet -mod=readonly ./pkg/sql/compile ./pkg/vm/engine ./pkg/vm/engine/disttae`
— passed.
- Build:
`make build` — passed; only the existing duplicate-library linker warning was emitted.
- BVT:
`cd /tmp/mo-29208-bvt-r3 && bash /Users/ghs-mo/MOWorkSpace/mo-tester/run.sh -n -p <worktree>/test/distributed/cases/ -i diff_schema_evolve,merge_schema_evolve,alter_table_historical_lineage`
— 492/492 passed: `diff_schema_evolve` 278/278, `merge_schema_evolve` 139/139, and `alter_table_historical_lineage` 75/75.
- Real concurrency:
`ulimit -n 2048 && python3 /tmp/mo-29208-concurrency-500.py`
— 500/500 successful ALTERs, 500/500 columns verified, 0 failures, 0 MySQL 1205, 0 MySQL 2013; database dropped.
- Final hygiene:
`gofmt -l` on the seven changed Go files, `git diff --check`, and `git status --porcelain=v1 -uall` — clean and limited to the focused seven-file scope.

The BVT and real-workload runs passed on this implementation before the latest rebase. The latest semantic rebase onto `f09d4788fd` applied cleanly; upstream changed unique-index duplicate precheck code in `pkg/sql/compile` and did not alter this PR's ALTER COPY production files. Latest exact-head validation on `79e45f24b5`:

- `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=900s ./pkg/sql/compile` — passed in 16.208s.
- `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=900s -run '^TestIssue277xxDDLConsistency/27725_concurrent_alter_terminal_conflict_supports_external_retry$' ./pkg/tests/issues` — passed in 11.308s.
- `gofmt -l` on all changed Go files, `git diff --check`, and `git status --porcelain=v1 -uall` — clean and limited to the focused PR scope.

### Residual risk

- The global lineage gate remains intentionally serialized for atomic publication and genuinely conflicting owner operations; this PR narrows and orders the held section rather than removing the ordering guarantee.
- Future lifecycle owners that take both source locks and the lineage gate must preserve gate-before-source-lock ordering.
- Future lineage invariants must be added to the postgate revalidation path.
- The 500-session proof uses a one-row base to isolate the failing ALTER concurrency path; deterministic barriers and race tests provide the row-count-independent ordering proof. The full reported 250,000-row throughput workload was not rerun; the committed 250,000-row unchanged-object benchmark measures the new serialized source-frontier cost, and broader multi-object storage layouts remain a performance envelope to monitor.
- The old run's two Compose failures were infrastructure failures while pulling the `createbuckets` image (`unauthorized: access to the requested resource is not authorized`); no matching issue was found. The old `pr-size-label` failure was an unrelated runner-proxy TLS failure tracked by #27127.

### Current exact head: `cf9a1735b7`

Rebased onto current `main` `02a2823c20` and resolved both semantic rebase boundaries:

- kept pre-publication, unlocked ALTER COPY preparation;
- integrated upstream forward-FK admission by computing `replacementAdmission.createNames` before physical CREATE and passing that admission into nested `withDropLifecycle`;
- kept upstream frontend rollback classification and added `ErrTxnWriteConflict` to the whole-transaction rollback set.

The source mutation proof now closes both DELETE lifecycle counterexamples:

- retained tombstone entries, including soft-deleted objects, remain source-change proof; actual retention truncation is represented by the partition state-start floor;
- appendable tombstones read non-aborted per-row commit timestamps with the same snapshot semantics as the delete reader;
- non-appendable tombstones read per-block commit-ts zonemaps;
- unavailable tombstone files or commit-ts metadata fail closed;
- the unused public `RelationHasTransactionLocalWrites` chain was removed while preserving the private async-index local-write guard.

The concurrent ALTER integration test now distinguishes the newly upstream pre-copy FK name-pin fast-fail (`ErrLockConflict`) from terminal post-copy `ErrTxnWriteConflict`; both are externally retryable, and final schema/index assertions remain unchanged.

Latest exact-head local validation:

- `CGO_CFLAGS=... go test ./pkg/vm/engine/disttae/logtailreplay -run 'TestSourceCommitTSAt|TestMaxCommitTS' -count=1` — passed.
- `CGO_CFLAGS=... go test ./pkg/vm/engine/disttae ./pkg/sql/compile ./pkg/frontend ./pkg/common/moerr -run 'TestSourceCommitTS|TestCombinedTxnTableSourceCommitTS|TestTxnTableDelegateSourceCommitTS|TestAlterCopy|Test_isErrorRollbackWholeTxn|TestStaticRollbackSetIsInfrastructureOnly|Test.*Rollback.*Txn' -count=1` — passed before the final one-commit rebase; the production delta is unchanged by that test-only upstream commit.
- `CGO_CFLAGS=... go test ./pkg/tests/issues -run 'TestIssue277xxDDLConsistency/27725_concurrent_alter_conflict_supports_external_retry' -count=1` — passed on the exact final head.
- `git diff --check` — passed; the working tree is clean.

Freshness update: rebased exact head `cba088b792` onto `main` `02a2823c20`. The only new upstream commit changes join-expression ownership and has no file overlap with this PR. Revalidated on the exact head: focused logtail source-frontier tests, focused ALTER COPY compile tests, the concurrent ALTER integration test, and `git diff --check`; all passed.

### Coverage CI follow-up and rebase validation

Coverage run `38204952772` exposed one PR-owned test expectation and two unrelated upstream failures:

- `TestIssue29400CopyAlterRetainedGatePromotionFastFails/exclusive_gate` expected the competing ALTER to wait, but upstream pre-copy FK admission now fast-fails with `ErrLockConflict` when it meets the retained source lock. The test now accepts that expected conflict and proves the UPDATE owner can execute its next statement, commit value `2`, and complete the target `DROP TABLE` without deadlock.
- `TestPartitionTopNRejectsUnsupportedOrderType` is the existing clean-main issue #29968.
- `TestTruncateLifecycleRCWaitPolicy` is the existing clean-main issue #29971.

Exact-head validation:

- `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=240s -run '^TestIssue29400CopyAlterRetainedGatePromotionFastFails$' ./pkg/tests/issues` — passed in 12.889s.
- `gofmt -w pkg/tests/issues/issue_29400_test.go`, `git diff --check`, and `git status --porcelain=v1 -uall` — clean before commit.

The branch already contained `main` `02a2823c20` for that test-only follow-up.

### Rebase onto `main` `7af631bdf7`

The exact head is now `cf9a1735b7`, rebased onto current `main` `7af631bdf7`. The rebase applied cleanly and incorporates the upstream fixes for the two clean-main coverage blockers:

- `TestPartitionTopNRejectsUnsupportedOrderType` (#29968) now passes on the rebased head.
- `TestTruncateLifecycleRCWaitPolicy` (#29971) now passes on the rebased head.
- The PR-owned `TestIssue29400CopyAlterRetainedGatePromotionFastFails` regression also passes after the rebase.

Exact-head validation:

- `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=240s -run '^TestIssue29400CopyAlterRetainedGatePromotionFastFails$' ./pkg/tests/issues` — passed in 26.805s.
- `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=120s -run '^TestPartitionTopNRejectsUnsupportedOrderType$' ./pkg/sql/colexec/partition` — passed in 3.080s.
- `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=240s -run '^TestTruncateLifecycleRCWaitPolicy$|^TestAlterCopyAndTruncateSerializeBeforeTableLocks$' ./pkg/sql/compile` — passed in 3.543s.
- `gofmt -l` over all changed Go files, `git diff --check`, and `git status --porcelain=v1 -uall` — clean after the rebase.


### Review update and current exact head: `f8894b6a0f`

Rebased cleanly onto current `main` `11914526ba` and addressed the pessimistic-RC independent-ALTER publication finding:

- `admitReplacementNames` no longer runs before physical COPY preparation. Pessimistic-RC ALTER COPY now acquires the broad SNAPSHOT gate first, then pins replacement endpoint names with `WaitPolicy_Wait`.
- ALTER records the transaction's retained lock-table baseline before preparation. Gate waiting is permitted only when every retained lock table is new relative to that baseline and is certified by the workspace as created in the transaction. Pre-existing, source, catalog, or unprovable locks retain the fast-fail policy, preventing `G -> name -> G` reverse edges.
- Nested temporary CREATE and row copy propagate `WithDisableLock`; nested execution skips pre-pipeline metadata/table locks and lock operators. TRUNCATE keeps its existing fast-fail replacement-name policy.
- `TestIssue29400IndependentCopyAltersProgressInPessimisticRC` covers both a held explicit publisher and overlapping autocommit publishers. It uses separate connections, observes the independent ALTER waiting at the gate, proves it does not fail while the holder retains the gate, and proves both ALTERs finish after release.
- The exact-head validation passed for `./pkg/sql/compile` and `./pkg/tests/issues` with `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s`, including the new independent-publisher integration test. `gofmt -l` over changed Go files, `git diff --check`, and the final clean-tree check also passed.
- The versioned design and implementation now record this `G -> private preparation locks -> replacement names -> source` publication order and its liveness proof.

### Rebase onto `main` `b09f2c6fc5`

Rebased cleanly onto `main` `b09f2c6fc5` at exact head `3e5069423d`.

- The rebase introduced no semantic conflicts; the full PR delta remains scoped to the ALTER COPY publication lifecycle and its tests/design.
- Re-ran the full affected package set after the rebase:
- `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s ./pkg/sql/compile ./pkg/tests/issues ./pkg/frontend ./pkg/vm/engine/disttae ./pkg/vm/engine/disttae/logtailreplay`
- All five packages passed.

### Current exact head after the latest rebase: `2e45e40035`

Rebased cleanly onto current `main` `cd8d5abf96`.

- The rebase applied without conflicts. Its only overlapping paths with this PR were `pkg/sql/compile/compile.go` and `pkg/sql/compile/compile_test.go`, where upstream renamed the vector-index scan node; the ALTER COPY ownership changes remained semantically unchanged.
- Re-ran the focused affected package set after the rebase:
- `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s ./pkg/sql/compile`
- `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s ./pkg/tests/issues ./pkg/vm/engine/disttae ./pkg/vm/engine/disttae/logtailreplay`
- All four packages passed.
- `git diff --check`, `gofmt -l` over changed Go files, and the clean-tree check passed before push.


### Review update and exact head: `e088a231b9`

Rebased cleanly onto current `main` `175a645a85` and closed the unaffected-index preparation finding:

- The private ALTER-COPY temporary CREATE now opts out of transient index CDC and idxcron task registration. Because no transient tasks are registered, ALTER also skips their catalog cleanup; post-rename publication retains the existing final task-registration path. This removes the `mo_tables`/`mo_database` lock retention introduced by transient task cleanup while preserving final index-task ownership.
- IVF-FLAT `DeleteBeforeClone` now executes its private replacement hidden-table cleanup with `WithDisableLock`, so the nested DELETE acquires neither catalog metadata locks nor row locks.
- `TestIssue29400IndependentCopyAltersProgressInPessimisticRC` now enables `experimental_ivf_index`, creates an unchanged IVF-FLAT index, and covers both a held explicit publisher and overlapping autocommit publishers. The unrelated ALTER waits at the publication gate and completes after release.
- `TestAlterCopyCreateOptionsDisablesNestedCreateLock` asserts the new skip-registration option. `TestScopeAlterTableCopyInsertTmpDataPipelineFlush` now proves private preparation no longer calls `CopyTableDef` for transient task cleanup while retaining its nil-context pipeline-flush oracle.
- The versioned design records the lock-free cleanup and symmetric registration/cleanup policy.

Exact-head validation after the rebase:

- `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s -run '^TestIssue29400IndependentCopyAltersProgressInPessimisticRC$' ./pkg/tests/issues` — passed.
- `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=120s -run '^TestScopeAlterTableCopyInsertTmpDataPipelineFlush$' ./pkg/sql/compile` — passed.
- `gofmt -l` over all changed Go files, `git diff --check`, and `git status --porcelain=v1 -uall` — clean on the exact head.

Additional validation on the identical code before the unrelated one-commit rebase (`896fa84927` on `main` `3e50e1b32d`):

- `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s ./pkg/sql/compile` — passed.
- `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s ./pkg/tests/issues` — passed.
- `.agents/skills/mo-dev/scripts/mo-cgo-test -race -count=1 -timeout=600s -run '^TestIssue29400IndependentCopyAltersProgressInPessimisticRC$' ./pkg/tests/issues` — passed.


### Current exact head after latest rebase: `6596f9dc04`

Rebased cleanly onto current `main` `e5111936b9` after the PR was reported behind.

- `git range-diff` confirms all ten PR commits are patch-equivalent to the prior head `e088a231b9`; only their base changed.
- The worktree remained clean, and no PR code or tests were modified by this rebase.
- No new semantic validation is claimed for this commit-only rebase. The exact prior-head focused validations above remain the latest code-specific evidence.

### Current exact head after latest rebase: `abd5a45122`

Rebased onto current `main` `21f19ae063` after `main` advanced twice during the refresh:

- First rebased `6596f9dc04` onto `main` `6b0da62260` at `3574aa681f`; `git range-diff` confirmed all ten PR commits were patch-equivalent.
- After the push, the live PR snapshot showed `main` had advanced to `21f19ae063`. Fetched that base and rebased again to `abd5a45122`.
- `git range-diff` between the `3574aa681f` and `abd5a45122` ranges confirms all ten PR commits remain patch-equivalent. The new upstream commit overlaps this PR only in `pkg/sql/compile/compile.go`/`compile2.go`; the automatic rebase preserves both the ALTER private-preparation locking changes and upstream prepared zero-limit producer behavior.
- `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s ./pkg/sql/compile` — passed.
- `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s -run '^TestIssue29400IndependentCopyAltersProgressInPessimisticRC$' ./pkg/tests/issues` — passed.
- `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s -run '^TestPreparedZeroLimitReuse$' ./pkg/tests/sqlintegration` — passed.
- `gofmt -l` over changed Go files, `git diff --check`, protected-scope check, and the final clean-tree check passed on the exact head.



### Review update and current exact head: `7f243d2e4c`

Rebased onto current `main` `fcad62a8ff` and closed the Compile-pool registration-policy escape found in review `PRR_kwDOFEPiGM8AAAABR92hOw`:

- `Compile.clear` resets `skipIndexTaskRegistration` with the other per-statement flags (`disableLock`, `skipDataBranchReclaim`, `keepAutoIncrement`) before the object returns to the global reuse pool, and `NewCompile` re-initializes it. The ALTER COPY private-registration opt-out is now a property of the single private preparation generation and can no longer reach an unrelated later `CREATE TABLE` with an inline async/IVF index through pool reuse (`compile.go`).
- The intentional current-generation suppression is unchanged; the versioned design records the pool-boundary ownership of the opt-out (`docs/design/20261010-alter-copy-pre-publication.md`).
- `ignoreCheckExperimental`, the only other assigned-but-unreset sibling in `txnExecutor.Exec`, is pre-existing upstream state from #22428 and is currently assigned-but-never-read; it is outside this PR's introduced delta and left untouched.

Proof on the exact head:

- `TestCompileClearResetsSkipIndexTaskRegistration` exercises the pool reset directly; mutation-verified: removing only the `clear` reset makes it fail while the rest of the fix stays.
- `TestCompilePoolHandoffClearsPrivateIndexRegistrationPolicy` deterministically reproduces the review's Release -> same-object `NewCompile` pool handoff (single-P, GC disabled) and proves the next frontend Compile starts with the ordinary registration policy.
- `TestIssue29400OrdinaryIndexedCreateRegistersTasksAfterCopyPreparation` proves, on one CN connection, that an ordinary inline IVF-FLAT `CREATE TABLE` registers its `mo_catalog.mo_index_update` `ivfflat_reindex` task before and after `ALTER ... ALGORITHM=COPY` private preparation, and that publication re-registers the replacement index's task.

Validation on the exact head:

- `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s ./pkg/sql/compile` — passed in 27.431s.
- `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s ./pkg/vm/engine/disttae` — passed in 10.236s.
- `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s ./pkg/vm/engine/disttae/logtailreplay` — passed in 27.991s.
- `- `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=1800s ./pkg/tests/issues` — passed in 552.697s (177 tests, 0 failures; includes all `TestIssue29400*` roots and the new registration control). An earlier run of this suite on the same head failed once with a transient `internal error: cn service bootstrap` while the embedded cluster was starting; the identical rerun and every focused cluster test passed.`
- `gofmt -l` over changed Go files, `git diff --check`, the protected-scope check, and the clean-tree check passed on the exact head.

CI-blocker follow-up: the tracked unrelated blocker #30047 (logservice `gossip_fixture_test.go` obsolete `randomPorts.allocate` signature failing UT/SCA/Coverage on run `38347106648`) was closed at `2026-10-13T08:30:47Z`; its fix landed on `main` in `35c8dd5854` and is incorporated by this rebase. This PR does not modify `pkg/logservice`. The push creates a new head and a fresh CI run; the stale failed run is not rerun.


### Current exact head after latest rebase: `4c5051fc77`

Rebased onto current `main` `5d971d07a7` after the PR was reported behind.

- `git range-diff` confirms all eleven PR commits are patch-equivalent to the prior head `7f243d2e4c`; only their base changed.
- The single new upstream commit `5d971d07a7` (empty indexed FK cascades / self-FK ALTER) touches `pkg/sql/plan` and BVT cases with no file overlap with this PR.
- Exact-head revalidation: `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s ./pkg/sql/compile` — passed in 16.425s; `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s -run '^TestIssue29400OrdinaryIndexedCreateRegistersTasksAfterCopyPreparation$' ./pkg/tests/issues` — passed in 8.110s.
- `gofmt -l`, `git diff --check`, the protected-scope check, and the clean-tree check passed on the exact head.


### Current exact head after latest rebase: `8e5c8b3b53`

Rebased onto current `main` `e17fc0f7fe` after the PR was reported behind again.

- `git range-diff` confirms all eleven PR commits are patch-equivalent to the prior head `4c5051fc77`; only their base changed.
- The two new upstream commits (`6ca4363a73` information_schema rewritten-column hiding, `e17fc0f7fe` prepared row-rule invalidation) touch `pkg/sql/plan`, `pkg/frontend` production files, and BVT cases with no file overlap with this PR.
- Exact-head revalidation: `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s ./pkg/sql/compile` — passed in 19.691s; the focused frontend rollback-classification tests this PR extends (`Test_isErrorRollbackWholeTxn`, `TestStaticRollbackSetIsInfrastructureOnly`, and the surrounding rollback roots) — passed in 2.152s; `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s -run '^TestIssue29400OrdinaryIndexedCreateRegistersTasksAfterCopyPreparation$' ./pkg/tests/issues` — passed in 9.078s.
- `gofmt -l`, `git diff --check`, the protected-scope check, and the clean-tree check passed on the exact head.


### Current exact head after latest rebase: `60e84f43df`

Rebased onto current `main` `c4a210802d` after the PR was reported behind again.

- `git range-diff` confirms all eleven PR commits are patch-equivalent to the prior head `8e5c8b3b53`; only their base changed.
- The four new upstream commits (`5652252431` window hash partitioning, `959d12d3b9` Starlark NULL boundary, `838bf5d1f8` docs MO-scan branch, `c4a210802d` Iceberg adapter module tidy) have no file overlap with this PR's source or test files; the Iceberg commit's workflow change is upstream-owned and untouched here.
- Exact-head revalidation: `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s ./pkg/sql/compile` — passed in 18.864s; `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s -run '^TestIssue29400OrdinaryIndexedCreateRegistersTasksAfterCopyPreparation$' ./pkg/tests/issues` — passed in 8.837s.
- `gofmt -l`, `git diff --check`, the protected-scope check, and the clean-tree check passed on the exact head.


### Current exact head after latest rebase: `cd2c40fd52`

Rebased onto current `main` `a53390c57d` after the PR was reported behind again.

- `git range-diff` confirms all eleven PR commits are patch-equivalent to the prior head `60e84f43df`; only their base changed.
- The two new upstream commits are `ec7a910a02` (TIME assignment bounds for external LOAD) and `a53390c57d` (BuildJsonPlan statistics snapshot race). The LOAD commit also touches `pkg/sql/compile/compile.go` in the extern-scan region; the rebase auto-merged it with this PR's `NewCompile`/`clear` flag changes, and both `skipIndexTaskRegistration` resets are verified present on the exact head (compile.go:161 and compile.go:571).
- Exact-head revalidation: `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s ./pkg/sql/compile` — passed in 14.119s (includes `TestCompileClearResetsSkipIndexTaskRegistration` and `TestCompilePoolHandoffClearsPrivateIndexRegistrationPolicy`); `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s -run '^TestIssue29400OrdinaryIndexedCreateRegistersTasksAfterCopyPreparation$' ./pkg/tests/issues` — passed in 7.801s.
- `gofmt -l`, `git diff --check`, the protected-scope check, and the clean-tree check passed on the exact head.


### Current exact head after latest rebase: `f796e46fb0`

Rebased onto current `main` `071a79b77f` after the PR was reported behind again.

- `git range-diff` confirms all eleven PR commits are patch-equivalent to the prior head `cd2c40fd52`; only their base changed.
- The single new upstream commit `071a79b77f` (preserve row rewrite rules through CTAS) touches `pkg/sql/compile/ddl.go` (`populateCreatedTable`, CTAS INSERT privilege region) and `pkg/sql/compile/sql_executor.go` (rewrite-option attachment in `txnExecutor.Exec`), both outside this PR's hunks; the rebase auto-merged and all three `skipIndexTaskRegistration` sites are verified present (compile.go:161, compile.go:571, sql_executor.go:618).
- Exact-head revalidation: `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s ./pkg/sql/compile` — passed in 16.696s (includes both pool-boundary regression tests); `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s -run '^TestIssue29400OrdinaryIndexedCreateRegistersTasksAfterCopyPreparation$' ./pkg/tests/issues` — passed in 8.558s.
- `gofmt -l`, `git diff --check`, the protected-scope check, and the clean-tree check passed on the exact head.


### Current exact head after latest rebase: `ad74f1e810`

Rebased onto current `main` `5a0570ea70` after the PR was reported behind again.

- `git range-diff` confirms all eleven PR commits are patch-equivalent to the prior head `f796e46fb0`; only their base changed.
- The three new upstream commits (`2e139d84bf` Kafka Connect recovery qualification harness, `ac98d7bd1f` scalar DESCRIBE view reflection coverage, `5a0570ea70` docs/skills template validation) are test/documentation changes with no file overlap with this PR.
- Exact-head revalidation: `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s ./pkg/sql/compile` — passed in 23.443s (includes both pool-boundary regression tests); `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s -run '^TestIssue29400OrdinaryIndexedCreateRegistersTasksAfterCopyPreparation$' ./pkg/tests/issues` — passed in 8.945s.
- `gofmt -l`, `git diff --check`, the protected-scope check, and the clean-tree check passed on the exact head.



### Review update and current exact head: 173bf86f72

Addresses aptend's test-reliability P2 from the deep re-review of `ad74f1e810e2d1b6c360129e326155dc3fa4875c` (that review closed the previous P1 pool-leak blocker and substantiated no further production blocker). The P2: the new pool-handoff regression asserted `sync.Pool` pointer identity, which the pool's documented contract and the race runtime do not support — `Put` drops values with probability 1/4 under the race detector — so the canonical `-race -count=100` validation could fail randomly on a correct implementation (19/100 on the reviewer's run, reproduced locally at compile_test.go:203).

This cycle adds one commit, test-only. At commit time `main` was unchanged (`5a0570ea70083c9365719009a5ed8d7618f9ed91`); it advanced to `55a019f0b0` during validation, so this commit was then rebased before pushing - see the rebase section below for the patch-equivalence record.

- `TestCompilePoolHandoffClearsPrivateIndexRegistrationPolicy` is now a drop-tolerant, policy-based oracle. Each of 16 rounds seeds the exact leak payload through the real boundary — private executor `Compile` with its executor-set policy, `Release` (`Compile.clear` then `sync.Pool.Put`) — and requires the ordinary registration policy on the frontend `Compile` constructed next by the public `NewCompile`, whichever object the pool returns. Pointer identity is only logged; a legitimate pool drop can never fail the root. Drops cannot mask a leak: inheritance requires a `Put` the pool kept, every kept seed is asserted on the immediately following construction, and with both reset layers present the root is green by construction.
- Non-masking is verified by mutation: with both the `clear()` reset and the `NewCompile` init removed, the root fails deterministically without `-race` at round 0, and fails all 3 invocations with `-race -count=3`; with the resets present, the canonical race command is fully green. The `clear()` reset layer keeps its deterministic, pool-free probe `TestCompileClearResetsSkipIndexTaskRegistration` (removing only the `clear` reset still fails it).
- Exact-head revalidation: `-race -tags matrixone_test -count=100 -timeout=120s -run '^TestCompilePoolHandoffClearsPrivateIndexRegistrationPolicy$' ./pkg/sql/compile` — PASS 8.500s (100/100); the same command without `-race` — PASS (7.344s); full `./pkg/sql/compile` package - PASS 18.046s.
- `gofmt -l`, `git diff --check`, the protected-scope check, and the clean-tree check passed on the exact head.

### Rebase onto current main: `173bf86f72` (`173bf86f7228cfc5c3ac604294e2581803ee4294`)

`main` advanced from `5a0570ea70` to `55a019f0b0` during the validation above, so the branch was rebased before pushing.

- `git range-diff` confirms all twelve PR commits (the eleven prior patches plus the new drop-tolerant handoff test) are patch-equivalent to the pre-rebase head `01fb35bb3a`; only their base changed.
- The three new upstream commits (`944b721d1b` JOIN reset buffers across execution generations — `pkg/sql/colexec/{dedupjoin,hashjoin,indexjoin,loopjoin}`, `821250ea88` recursive-CTE test cases, `55a019f0b0` canonical collation admission tests) have no file overlap with this PR; the rebase auto-merged.
- Exact-head revalidation after the rebase: `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s ./pkg/sql/compile` — PASS in 18.046s (includes both pool-boundary regression tests); `.agents/skills/mo-dev/scripts/mo-cgo-test -race -tags matrixone_test -count=100 -timeout=120s -run '^TestCompilePoolHandoffClearsPrivateIndexRegistrationPolicy$' ./pkg/sql/compile` — PASS in 8.500s, no failure in 100 runs; `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s -run '^TestIssue29400OrdinaryIndexedCreateRegistersTasksAfterCopyPreparation$' ./pkg/tests/issues` — PASS in 18.363s.
- `gofmt -l`, `git diff --check`, the protected-scope check, and the clean-tree check passed on the exact head.



### Current exact head after latest rebase: `2990b63c36` (`2990b63c36c8cd5d6c652f8927503af2a95361cd`)

Rebased onto current `main` `b2e8bc4789` after `main` advanced again while the previous section was being pushed (`55a019f0b0` -> `b2e8bc4789`).

- `git range-diff` confirms all twelve PR commits (the eleven prior patches plus the drop-tolerant handoff test) are patch-equivalent to the prior head `173bf86f7228cfc5c3ac604294e2581803ee4294`; only their base changed.
- The single new upstream commit `b2e8bc4789` (remap reused CTE readers after projection pruning) touches `pkg/sql/plan/{cte_reuse.go,query_builder.go}` plus CTE test cases, with no file overlap with this PR; the rebase auto-merged.
- Exact-head revalidation: `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s ./pkg/sql/compile` — PASS in 25.422s (includes both pool-boundary regression tests); `.agents/skills/mo-dev/scripts/mo-cgo-test -race -tags matrixone_test -count=100 -timeout=120s -run '^TestCompilePoolHandoffClearsPrivateIndexRegistrationPolicy$' ./pkg/sql/compile` — PASS in 8.389s, no failure in 100 runs; `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s -run '^TestIssue29400OrdinaryIndexedCreateRegistersTasksAfterCopyPreparation$' ./pkg/tests/issues` — PASS in 8.846s.
- `gofmt -l`, `git diff --check`, the protected-scope check, and the clean-tree check passed on the exact head.



### Current exact head after latest rebase: `0ed0f79634` (`0ed0f79634b20a0f8b8c74d525f91999dc4cd3f1`)

Rebased onto current `main` `fab7b5c043` after the behind event (head `2990b63c36` was reported behind `main` advanced `b2e8bc4789` -> `fab7b5c043` shortly after the previous cycle's push).

- `git range-diff` confirms all twelve PR commits (the eleven prior patches plus the drop-tolerant handoff test) are patch-equivalent to the prior head `2990b63c36c8cd5d6c652f8927503af2a95361cd`; only their base changed.
- The single new upstream commit `fab7b5c043` (preserve join predicate ownership during reordering, #30056) touches `pkg/sql/plan/associative_law.go` plus a plan regression test, with no file overlap with this PR; the rebase auto-merged.
- Exact-head revalidation: `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s ./pkg/sql/compile` — PASS in 14.853s (includes both pool-boundary regression tests); `.agents/skills/mo-dev/scripts/mo-cgo-test -race -tags matrixone_test -count=100 -timeout=120s -run '^TestCompilePoolHandoffClearsPrivateIndexRegistrationPolicy$' ./pkg/sql/compile` — PASS in 10.348s, no failure in 100 runs; `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=600s -run '^TestIssue29400OrdinaryIndexedCreateRegistersTasksAfterCopyPreparation$' ./pkg/tests/issues` — PASS in 7.680s (first invocation of this root during the cycle aborted with `[build failed]`: the Go linker could not reopen cached cgo objects after a build-cache eviction; the identical command was rerun and passed in 7.680s, so the abort was a toolchain cache eviction, not a test failure).
- `gofmt -l`, `git diff --check`, the protected-scope check, and the clean-tree check passed on the exact head. The prior head's in-flight CI run is superseded by this push; the new head produces a fresh CI run.



### Current exact head after latest rebase: `16023e02d6` (`16023e02d691abaa1e46fc0481d40cc0509c1c2e`)

Rebased onto current `main` `51300cbd01` after the behind event (head `0ed0f79634` was reported behind; `main` advanced `fab7b5c043` -> `51300cbd01`).

- The single new upstream commit `51300cbd01` (prevent table rename from bypassing role row filters, #29186) is the first upstream commit during this PR's life that also modifies this PR's main production file: `pkg/sql/compile/alter.go` (+183 — new `checkRoleRuleRenameAdmission*` admission gates at the `Scope.RenameTable` entry and the rename-action path of `Scope.AlterTable`, plus new `role_rule_lifecycle.go`), `alter_test.go`, `types.go` (new `Scope.roleRuleRenameAdmissionChecked`), frontend rename/rewrite-rule files, and two `pkg/tests/issues` roots.
- The rebase auto-merged. Semantic integration verified: the rename admission is orthogonal to this PR's ALTER COPY lifecycle — it runs for user rename statements/actions, while `alterTableCopy` publication (broad gate -> endpoint name pins -> source locking/revalidation -> private-replica replace) is untouched by the upstream hunks. Upstream's insertion anchor `reconcileAlterCopyAutoIncrement` is pre-existing `main` machinery from #26197, not part of this PR. `git range-diff` shows eleven commits patch-equivalent and commit 1 (`fix(alter): avoid global lineage gate during physical copy`) with only its import-hunk context shifted by upstream's import additions; no patch content changed.
- Exact-head revalidation, run over the full affected package set because upstream added tests inside the same packages this PR touches: `./pkg/sql/compile` - PASS 13.688s (includes both this PR's lifecycle/pool regression roots and upstream's new rename-admission roots); `./pkg/frontend` - PASS 34.112s (includes upstream's rewrite-rule/authenticate roots and this PR's whole-transaction rollback roots); the canonical race command `-race -tags matrixone_test -count=100 -timeout=120s -run '^TestCompilePoolHandoffClearsPrivateIndexRegistrationPolicy$' ./pkg/sql/compile` - PASS 18.887s, no failure in 100 runs; full `./pkg/tests/issues` - PASS 413.353s (includes upstream's new/updated issue_29133/issue_29095 roots and this PR's issue_29400/issue_277xx roots).
- `gofmt -l`, `git diff --check`, the protected-scope check, and the clean-tree check passed on the exact head. The prior head's in-flight CI run is superseded by this push; the new head produces a fresh CI run.



### Current exact head after latest rebase: `cb0ded487f` (`cb0ded487f49a9ad3113c654ccf1404949eec24a`)

Rebased onto current `main` `fd4767e488` after the behind event (head `16023e02d6` was reported behind; `main` advanced `51300cbd01` -> `fd4767e488`).

- The single new upstream commit `fd4767e488` (exclude fake primary key from LAST_INSERT_ID, #30004) touches `pkg/incrservice` and its test cases only, with no file overlap with this PR and no interaction with the ALTER COPY preparation/publication lifecycle; the rebase auto-merged and the prior role-filter reconciliation record above remains the current one.
- `git range-diff` confirms all twelve PR commits are patch-equivalent to the prior head `16023e02d691abaa1e46fc0481d40cc0509c1c2e`; only their base changed.
- Exact-head revalidation: `./pkg/sql/compile` - PASS 14.348s (includes both pool-boundary regression tests); the canonical race command `-race -tags matrixone_test -count=100 -timeout=120s -run '^TestCompilePoolHandoffClearsPrivateIndexRegistrationPolicy$' ./pkg/sql/compile` - PASS 8.890s, no failure in 100 runs; focused `TestIssue29400OrdinaryIndexedCreateRegistersTasksAfterCopyPreparation` in `./pkg/tests/issues` - PASS 8.838s; the upstream-changed `./pkg/incrservice` package - PASS 5.350s.
- `gofmt -l`, `git diff --check`, the protected-scope check, and the clean-tree check passed on the exact head. The prior head's in-flight CI run is superseded by this push; the new head produces a fresh CI run.



### Current exact head after latest rebase: `a9d969890c` (`a9d969890c8a2e9076840237c163af588bce19fb`)

Rebased onto current `main` `a33dcfb2e5` after the behind event (head `cb0ded487f` was reported behind; `main` advanced `fd4767e488` -> `a33dcfb2e5`).

- The single new upstream commit `a33dcfb2e5` (perf: reduce wide-schema work and redundant gossip fixture startup, #30200) touches `pkg/sql/plan/{default_binder.go,build_show_util.go,types.go}` plus plan/logservice tests, with no file overlap with this PR and no interaction with the ALTER COPY preparation/publication lifecycle; the rebase auto-merged and the prior role-filter reconciliation record remains the current one.
- `git range-diff` confirms all twelve PR commits are patch-equivalent to the prior head `cb0ded487f49a9ad3113c654ccf1404949eec24a`; only their base changed.
- Exact-head revalidation: `./pkg/sql/compile` - PASS 21.080s (includes both pool-boundary regression tests and exercises upstream's plan-binder change through the normal compilation paths); the canonical race command `-race -tags matrixone_test -count=100 -timeout=120s -run '^TestCompilePoolHandoffClearsPrivateIndexRegistrationPolicy$' ./pkg/sql/compile` - PASS 7.788s, no failure in 100 runs; focused `TestIssue29400OrdinaryIndexedCreateRegistersTasksAfterCopyPreparation` in `./pkg/tests/issues` - PASS 7.968s.
- `gofmt -l`, `git diff --check`, the protected-scope check, and the clean-tree check passed on the exact head. The prior head's in-flight CI run is superseded by this push; the new head produces a fresh CI run.



### Current exact head after latest rebase: `7f086296db` (`7f086296db9f32e3ebcd1d59ef36da325bd20fd9`)

Rebased onto current `main` `b1a6da4e16` after the behind event (head `a9d969890c` was reported behind; `main` advanced `a33dcfb2e5` -> `b1a6da4e16`).

- The single new upstream commit `b1a6da4e16` (fix(parser): reject overflowing type lengths and scales, #30176) touches `pkg/sql/parsers/dialect/mysql` plus tests, with no file overlap with this PR and no interaction with the ALTER COPY preparation/publication lifecycle; the rebase auto-merged and the prior role-filter reconciliation record remains the current one.
- `git range-diff` confirms all twelve PR commits are patch-equivalent to the prior head `a9d969890c8a2e9076840237c163af588bce19fb`; only their base changed.
- Exact-head revalidation: `./pkg/sql/compile` - PASS 13.528s (includes both pool-boundary regression tests); the canonical race command `-race -tags matrixone_test -count=100 -timeout=120s -run '^TestCompilePoolHandoffClearsPrivateIndexRegistrationPolicy$' ./pkg/sql/compile` - PASS 9.102s, no failure in 100 runs; focused `TestIssue29400OrdinaryIndexedCreateRegistersTasksAfterCopyPreparation` in `./pkg/tests/issues` - PASS 9.154s.
- `gofmt -l`, `git diff --check`, the protected-scope check, and the clean-tree check passed on the exact head. The prior head's in-flight CI run is superseded by this push; the new head produces a fresh CI run. For the record, the prior head `a9d969890c`'s CI had already passed SCA Linux/arm64, UT Coverage on Ubuntu/x86, and the PROXY BVT compose before this rebase superseded it; its remaining checks were still queued/in progress and are replaced by the new run.




### Current exact head after review fix and rebase: `f0840a56e0` (`f0840a56e0d382b3219b449a69a84a53bc957dbe`)

Handles the shared P1 from aptend's thread and XuPeng-SH's mo-bot review (timestamp-only snapshot rewind after workspace-owned advancement), plus the behind event, in one cycle.

- Rebase: `main` advanced `b1a6da4e16` -> `bdbbd17792` (19 upstream commits: parser/plan/aggregate/function fixes, fileservice ENOSPC handling, race-UT runtime reduction, Sirius update; zero file overlap with this PR's delta). The rebase auto-merged; `git range-diff` confirms all twelve prior commits patch-equivalent.
- P1 fix (new commit `fix(alter): retain workspace-owned snapshot on copy return`): `alterTableCopy` no longer rewinds only the transaction timestamp after the pre-copy `databranchutils.AdvanceLineageSnapshot` workspace advancement. The rewind defer reintroduced by this PR's first commit was the exact defect main's #29539 removed; after `Workspace.AdvanceSnapshot` relocates transaction-local tombstones, a timestamp-only rewind leaves the workspace and snapshot in different generations and resurrects relocated deletes of earlier uncommitted DML. The workspace-owned advanced snapshot is now retained on every return path, matching the publication-side advance and the other owners; the duplicated `isTemp`/non-temporary advance branches collapsed into one mode-gated call. The design doc records the ownership rule and its #29539 lineage.
- New tests: `TestAlterCopyRetainsWorkspaceAdvancedSnapshotOnEveryReturn` (pessimistic-RC `Scope.AlterTableCopy`; any `SetSnapshotTS` rewind fails the test; retention asserted across the workspace-advance-failure and post-advance physical-copy-failure returns; mutation-verified in both directions) and `TestIssue29400CopyAlterKeepsRelocatedWorkspaceDeletesAfterReturn` (real cluster: uncommitted in-memory DELETEs survive a forced DN flush and the ALTER COPY return inside the same pessimistic-RC transaction and after commit).
- Exact-head validation: full `./pkg/sql/compile` - PASS 14.987s; the canonical race command `-race -tags matrixone_test -count=100 -timeout=120s -run '^TestCompilePoolHandoffClearsPrivateIndexRegistrationPolicy$' ./pkg/sql/compile` - PASS 7.286s, no failure in 100 runs; both new roots - PASS; full `./pkg/tests/issues` - PASS 329.117s.
- `gofmt -l`, `git diff --check`, the protected-scope check, and the clean-tree check passed on the exact head. The prior head's green CI run is superseded by this push; the new head produces a fresh CI run.




### Current exact head after latest rebase: `ebda98e960` (`ebda98e960e398f4436338f6353f1064d5009161`)

Rebased onto current `main` `501c85ecdd` after the behind event (head `f0840a56e0` was reported behind; `main` advanced `bdbbd17792` -> `501c85ecdd`). No code change in this cycle.

- The single new upstream commit `501c85ecdd` (perf(test): shorten embed and isolated race process lifetimes, #30249) touches `Makefile`, `optools/run_ut.sh`, and `optools/ut_embedded_schedule_test.go` only — test-infrastructure files with zero overlap with this PR's delta; the rebase auto-merged.
- `git range-diff` confirms all thirteen PR commits patch-equivalent to the prior head `f0840a56e0d382b3219b449a69a84a53bc957dbe`; only their base changed.
- Exact-head validation: full `./pkg/sql/compile` - PASS 13.871s; the canonical race command (`-race -tags matrixone_test -count=100 -timeout=120s -run '^TestCompilePoolHandoffClearsPrivateIndexRegistrationPolicy$' ./pkg/sql/compile`) - PASS 6.486s, no failure in 100 runs; focused issue roots in `./pkg/tests/issues` (`TestIssue29400CopyAlterKeepsRelocatedWorkspaceDeletesAfterReturn`, `TestIssue29400OrdinaryIndexedCreateRegistersTasksAfterCopyPreparation`, `TestIssue29400IndependentCopyAltersProgressInPessimisticRC`) - PASS 9.997s.
- `gofmt -l`, `git diff --check`, the protected-scope check, and the clean-tree check passed on the exact head. The prior head's in-flight CI run is superseded by this push; the new head produces a fresh CI run.




### Current exact head after latest rebase: `9c2e6a6257` (`9c2e6a62574f0b34881fb14a48561ebe4cd054dd`)

Rebased onto current `main` `f2093ae4b3` after the behind event (head `ebda98e960` was reported behind; `main` advanced `501c85ecdd` -> `f2093ae4b3`). No code change in this cycle.

- The two new upstream commits — `f2093ae4b3` (fix(json): reject wildcard and range paths in JSON_KEYS, #28328) and `bb2b725d0a` (fix(shardservice): preserve immutable read cache snapshots, #30187) — touch `pkg/common/moerr/error.go`, `pkg/container/bytejson`, `pkg/shardservice`, `pkg/sql/plan/function` JSON files, and BVT cases, with zero file overlap with this PR's delta. The rebase auto-merged.
- `git range-diff` confirms all thirteen PR commits patch-equivalent to the approved head `ebda98e960e398f4436338f6353f1064d5009161`; only their base changed, so the aptend implementation APPROVE (`PRR_kwDOFEPiGM8AAAABSZFhbw`) and the mo-bot approve (`PRR_kwDOFEPiGM8AAAABSZQRVg`), both recorded on `ebda98e960`, and the amended-design PASS (issuecomment-6186238709) review exactly this code.
- Exact-head validation: full `./pkg/sql/compile` - PASS 14.281s; the canonical race command (`-race -tags matrixone_test -count=100 -timeout=120s -run '^TestCompilePoolHandoffClearsPrivateIndexRegistrationPolicy$' ./pkg/sql/compile`) - PASS 9.351s, no failure in 100 runs; the upstream-adjacent `./pkg/common/moerr` - PASS 0.492s; focused issue roots in `./pkg/tests/issues` (`TestIssue29400CopyAlterKeepsRelocatedWorkspaceDeletesAfterReturn`, `TestIssue29400OrdinaryIndexedCreateRegistersTasksAfterCopyPreparation`, `TestIssue29400IndependentCopyAltersProgressInPessimisticRC`) - PASS 8.902s.
- `gofmt -l`, `git diff --check`, the protected-scope check, and the clean-tree check passed on the exact head. The prior head's terminally green CI run (38688137369, CI Required SUCCESS) is superseded by this push; the new head produces a fresh CI run.




### Current exact head after latest rebase: `ce9ed59493` (`ce9ed594933ffe3cf2ea8403b561956d1c833eac`)

Rebased onto current `main` `461bc8e349` after the behind event (head `9c2e6a6257` was reported behind; `main` advanced `f2093ae4b3` -> `461bc8e349`). No code change in this cycle.

- The two new upstream commits — `461bc8e349` (fix(plan): omit overwritten implicit fulltext ordering, #30189) and `b5a4d5c795` (fix(frontend): enforce Starlark OUT and INOUT parameter types, #30134) — touch `pkg/sql/plan` fulltext-index files, `pkg/frontend` Starlark files, and embed/config tests, with zero file overlap with this PR's delta. The rebase auto-merged.
- `git range-diff` confirms all thirteen PR commits patch-equivalent to the approved head `9c2e6a62574f0b34881fb14a48561ebe4cd054dd`; only their base changed, so the aptend implementation APPROVE (`PRR_kwDOFEPiGM8AAAABSZFhbw`), the mo-bot approve (`PRR_kwDOFEPiGM8AAAABSZQRVg`), and the amended-design PASS (issuecomment-6186238709) continue to review exactly this code.
- Exact-head validation: full `./pkg/sql/compile` - PASS 15.167s; the canonical race command (`-race -tags matrixone_test -count=100 -timeout=120s -run '^TestCompilePoolHandoffClearsPrivateIndexRegistrationPolicy$' ./pkg/sql/compile`) - PASS 7.856s, no failure in 100 runs; the upstream-modified `./pkg/frontend` (includes both this PR's whole-transaction rollback roots and upstream's new Starlark roots) - PASS 28.287s; focused issue roots in `./pkg/tests/issues` (relocated workspace-delete retention, ordinary indexed-CREATE registration, indexed independent pessimistic-RC publishers) - PASS 9.759s.
- `gofmt -l`, `git diff --check`, the protected-scope check, and the clean-tree check passed on the exact head. The prior head's in-flight CI run is superseded by this push; the new head produces a fresh CI run.



### Current exact head after latest rebase: `a0e40253d0` (`a0e40253d0488e9c9f0b96752dec0724296df85d`)

Rebased onto current `main` `c46b893f61` after the behind event (head `ce9ed59493` was reported behind base `461bc8e349`, then conflicting while `main` advanced `461bc8e349` -> `83222fa837` -> `c46b893f61`). No PR-side behavior change in this cycle.

- The base hop through `83222fa837` picks up `8795f3699b` (revert: restore fulltext planner before #30189, #30285), upstream's fix for the CI blocker that failed the previous head's run `38703760162`: #30189's widened `tryApplyCoveredFulltext2` missed the stale call site at `apply_indices_fulltext_snapshot_test.go:180-182` and broke the `pkg/sql/plan` test build, failing SCA Linux/arm64, UT Coverage Ubuntu/x86, and UT Test Ubuntu/x86, blocking the Coverage merge at its `Verify coverage prerequisites` step, and turning the `CI Required` gatekeeper red — one verified root cause, pre-existing on `main`, with this PR contributing zero lines to `pkg/sql/plan`. The current base additionally contains the properly re-landed fulltext work `e8b3ed7f21` (fix(plan): integrate fulltext ordering and covered score limits, #30289); `mo-cgo-test -run '^$' ./pkg/sql/plan` passes on this head, so the defect is gone from the merge result.
- The rebase required a semantic interleave in two hunks where upstream `b6789851ca` (#30222) added the statement-retry `lastInsertIDBaseline` to the exact `Compile` flag block this PR extends: `types.go` now declares both upstream's `lastInsertIDBaseline uint64` (with its retry-restore comment) and this PR's `skipIndexTaskRegistration bool`, and `clear()` resets both (`c.lastInsertIDBaseline = 0` upstream; `c.skipIndexTaskRegistration = false` this PR, beside the other per-statement flags). Upstream's compile2.go save/restore pair is untouched and this PR's pool boundary is unchanged. Upstream `a85d90efc9` (#30334) also added cross-CN `SYNCCOMMIT` fences to its own `TestIssue29400CopyAlterRetainedGatePromotionFastFails` root inside `pkg/tests/issues/issue_29400_test.go`; the merged file keeps those fences and this PR's roots. The whitespace part of the resolution was folded into commit 10, preserving the clean 13-commit stack.
- `git range-diff` shows eleven PR commits patch-equivalent; commits 10 and 11 differ only by the interleaved upstream field/reset inside their existing hunks — every line the PR itself adds is unchanged, so the aptend implementation APPROVE (`PRR_kwDOFEPiGM8AAAABSZFhbw`), the mo-bot approve (`PRR_kwDOFEPiGM8AAAABSZQRVg`), the design-first PASS (issuecomment-6141109182), and the amended-design PASS (issuecomment-6186238709) continue to review exactly this code.
- Exact-head validation: full `./pkg/sql/compile` - PASS 34.197s (includes this PR's lifecycle/pool roots and upstream's new retry-baseline and calendar-interval roots); full `./pkg/frontend` - PASS 21.086s (includes upstream's show-metadata/authenticate changes and this PR's whole-transaction rollback roots); `./pkg/sql/plan` build check - ok 1.443s; the canonical race command (`-race -tags matrixone_test -count=100 -timeout=120s -run '^TestCompilePoolHandoffClearsPrivateIndexRegistrationPolicy$' ./pkg/sql/compile`) - PASS 4.120s, no failure in 100 runs; focused roots in `./pkg/tests/issues` (relocated workspace-delete retention, ordinary indexed-CREATE registration, indexed independent pessimistic-RC publishers, plus upstream's re-fenced retained-gate root in the shared file) - PASS 11.945s.
- `gofmt -l`, `git diff --check`, the protected-scope check, and the clean-tree check passed on the exact head. The previous head's red run `38703760162` (verified upstream-caused) is superseded; this push produces a fresh CI run for the new head.



### Current exact head after latest rebase: `2f4f928170` (`2f4f928170cb614dd8570ff6f4151f98dc1d4821`)

Rebased onto current `main` `76deafc806` after the behind event (head `a0e40253d0` was reported behind; `main` advanced `c46b893f61` -> `76deafc806`). No code change in this cycle.

- The single new upstream commit `76deafc806` (fix: report SELECT division-by-zero warnings, #30314) touches `pkg/sql/compile` expression/remoterun protocol files plus new division-warning test roots, `pkg/sql/plan/function/arithmetic.go` plus new plan test roots, rege…
XuPeng-SH added a commit that referenced this pull request Dec 1, 2026
## What type of PR is this?

- [x] Test and CI

## What does this PR do?

Backport the ISCP drain test changes from #30334 to `4.2-dev`.

The coverage run on #33590 failed in
`TestDrainIndexCdcTaskConsumerBoundsPersistentNotReady`. The test used a
30 ms wall-clock readiness deadline and also required at least one drain
RPC. The runner had been discovered, but the deadline elapsed before the
mock received the first request. The UT producer exited before
publishing its profile, which also blocked the coverage merge.

Use `testing/synctest` for the persistent-not-ready, runner discovery,
and long-drain tests. Construct their process fixtures before entering
the test bubble. Synthetic time advances when the test goroutines block.
The existing assertions about drain requests, readiness timeout, the
statement deadline, and runner changes no longer depend on the CI runner
honoring a 30 ms wall-clock window.

[Failing coverage
job](https://github.com/matrixorigin/matrixone/actions/runs/46680668814/job/142761918411?pr=33590)

## Verification

- Full `pkg/sql/compile` short suite passed with coverage
instrumentation (63.1% statement coverage).
- All three backported tests and the fresh-runner retry test, repeated
100 times each under the race detector at `GOMAXPROCS=1` and `4`.
- Incremental static analysis reported zero issues.

This branch was previously deployed

1 inactive deployment
ci — 9fbf3952 Deployed Oct 16, 2026 by XuPeng-SH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working kind/enhancement kind/refactor Code refactor kind/test-ci size/XL Denotes a PR that changes [1000, 1999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: CI late_snapshot TRUNCATE test observes original table ID [Bug]: ISCP long-drain revalidation race test can expire before first runner lookup

2 participants