Skip to content

test(disttae): guard catalog replacement across lineage snapshot advance - #30602

Merged
XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/test-30541-main
Oct 19, 2026
Merged

XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/test-30541-main

Conversation

@XuPeng-SH

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:

Related to #30541. Production fixes are already present on main through #29539 and #29754; the release-branch correction is #30576.

What this PR does / why we need it:

Add the missing deterministic catalog regression for COPY ALTER's DROP/rename window. Existing main tests cover transferred data deletes and replacement keys, but do not check the same-name catalog replacement and the next real txnDatabase.Delete singleton guard.

The test commits an original table, creates its transaction-local replacement, drops and renames through the real engine APIs, synchronously flushes mo_catalog.mo_tables on TN, and advances through the shared lineage helper. It then requires exactly the replacement table ID and successfully executes the next real Delete.

There is no statement boundary between flush and verification: a normal boundary could repair the stale tombstone and hide the original defect. Setup reuses EnginePack with long checkpoint scanning, one PK column, two table identities, and no user data rows. Pack, setup/RC transactions and query results register cleanup immediately. No production hook, state, guard relaxation or runtime change is introduced.

Validation on Go 1.27.1 / Darwin arm64 CPU, with matching native provenance:

  • New focused regression passes normally and with race; the normal test body takes about 0.75 s.
  • Full ./pkg/vm/engine/test passes normally (162.995 s) and with race (226.079 s): 167 top-level passes in each mode; two existing tests remain skipped and are not claimed as executed.
  • An external Go overlay changes only the shared helper back to raw operator advancement. Its witness confirms both original and replacement IDs, then catches the real delete table failed: query failed panic from db.Delete. The mutation is not delivered.
  • The exact new test also passes 37 repetitions under race in one process (31.277 s total); count selected from a 30-second budget and a measured 0.79 s single-test race duration.
  • After main advanced to d0e7f9a552f, the exact regression also passes normally and with race using an external overlay of the complete upstream delta. Full-package results above apply to the frozen 8732827 base; the overlay check is focused compatibility evidence.
  • go vet, repository-pinned molint and configured incremental golangci-lint against 873282742714436bff407dfcdbbe879147162bd3 pass; formatting and diff integrity pass.

Commands:

.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=900s ./pkg/vm/engine/test
.agents/skills/mo-dev/scripts/mo-cgo-test -race -count=1 -timeout=1200s ./pkg/vm/engine/test

This is regression coverage for the existing main fix, not a new production fix. It does not claim deterministic public SQL scheduling of a mid-ALTER flush, execution of the original Matrixflow upgrade workload, crash recovery, or a workload performance improvement.

Main already advances lineage snapshots through the workspace owner. Add a
deterministic regression for the catalog consumer behind issue matrixorigin#30541:
real DROP/rename, TN catalog flush, shared lineage refresh, exact replacement
ID, and the next real Delete without an intervening statement boundary.

Reuse EnginePack with minimal catalog state and register resource cleanup
immediately. Keep production behavior and the strict cardinality guard intact.

Related to matrixorigin#30541.
@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 →

@mergify mergify Bot added the kind/test-ci label Oct 19, 2026
@matrix-meow matrix-meow added the size/S Denotes a PR that changes [10,99] lines label Oct 19, 2026
@XuPeng-SH

XuPeng-SH commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: 732297f741f133582d96011cd4cabcd8f61dbf5e

Review completed. Read the assessment.

@XuPeng-SH

XuPeng-SH commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-xupeng · superseded

Commit: 732297f741f133582d96011cd4cabcd8f61dbf5e

"interrupted"

@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: 732297f741f133582d96011cd4cabcd8f61dbf5e

Assessment: approve

Reviewed the complete 91-line test addition and surrounding snapshot, catalog, SQL-executor and cleanup paths. The test appropriately reuses the engine integration harness, preserves the critical no-statement-boundary window, and verifies replacement identity plus the real deletion guard. Cleanup is sound, coverage is distinct, and production execution costs are unchanged. No actionable findings remain.

Model: gpt-6-astra / xhigh

Session: 01a13dcf-1586-7a01-9000-d45e20995cf8 · slot 1 · generation 1

Validation:

  • Verified frozen head/base, clean source, complete patch, formatting and matching native inputs. Missing native prerequisites were rebuilt through the repository owner in the diagnostic directory; provenance verification passed.

  • Focused test passed twice normally (0.63 seconds each) and once with the race detector (0.77 seconds), using the supplied isolated executor.

  • An overlay negative control bypassing workspace tombstone transfer failed at the intended assertion: both replacement and original table IDs became visible. Candidate source remained unchanged.

  • Full pkg/vm/engine/test suite passed in 162.518 seconds: 167 top-level passes, zero failures, and two existing skips (TestCCPRSyncProtectionRetry and Test_MultiTxnRollbackStatementS3).

  • Reconciled commands, source fingerprints, exit receipts and retained logs in /home/xupeng/.local/state/mo-bot/jobs/65445d9e14bf7231fb522533/attempt-1/receipt-reconciliation.json; reconciliation receipt 1792407181587510658-4.json exited successfully.

Limitations:

  • Validation covers the engine-level regression, not the complete Matrixflow upgrade incident or public SQL ALTER scheduling. Issue #30541's body was not supplied; its relevant contract was assessed through the frozen PR description and source.

  • Local race validation covered the focused test, not the full package. Pending frozen CI and author claims without retained execution artifacts were not counted as passing validation.

@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.

Deep review: APPROVE recommendation; no blocking findings.

Reviewed the complete 91-line addition at 732297f against main d0e7f9a, including the existing snapshot owner, ALTER COPY callers, catalog delete guard, internal executor and fixture cleanup. No subagents were used for this review.

The design is appropriate: main already contains the production corrections from #29539 and #29754. This PR adds the missing catalog-consumer regression while retaining workspace ownership of snapshot advancement and tombstone relocation. No redundant state machine, execution path, production hook or runtime cost is introduced.

The test exercises real DROP/rename, synchronous TN catalog flush, the shared lineage helper, exact replacement identity and the next real Delete. The critical interval contains no statement boundary that could repair the stale tombstone before verification. Inspected mutation artifacts show that raw operator advancement exposes both catalog rows and triggers the original deleteTable panic. Existing tests independently cover repeated advancement, statement rollback, subsequent merge, partial transfer I/O failure and cancellation; duplicating those fixtures here would add cost without distinct coverage.

Unhappy paths and cost: immediate cleanup releases query results before active transactions and the engine pack, including assertion-failure paths. Existing context-aware flush and snapshot wait owners are reused. Setup is bounded to one database, two table identities and zero user data rows; the new test body takes roughly 0.7 seconds.

Evidence verified and reused: frozen-candidate owning-package normal and race runs each have 167 top-level passes and two existing skips; the exact new test passed 37 race repetitions; vet, molint and incremental lint passed. All 18 upstream overlay files and the new test were verified byte-for-byte against the current merged head; focused normal/race validation of that content passed. Full-package results apply to the frozen candidate, not a newly executed full-package run on the merged head. Latest GitHub UT/SCA checks were still pending when reviewed.

Comment disposition: no inline review threads exist; the existing completed review has no actionable findings. The paused/interrupted bot notices are operational status messages.

Scope: this PR satisfies the missing regression-coverage goal. The original Matrixflow/MOI upgrade workload has not been rerun, so the complete issue #30541 end-to-end acceptance remains open.

Submitted as COMMENT because the authenticated account is the PR author; the code-review recommendation is APPROVE.

This branch was previously deployed

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

Labels

kind/test-ci size/S Denotes a PR that changes [10,99] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants