Skip to content

Fix replay promotion CI regressions on main - #29426

Merged
XuPeng-SH merged 1 commit into
matrixorigin:mainfrom
XuPeng-SH:codex/main-tae-promotion-ci-fix
Sep 28, 2026
Merged

XuPeng-SH merged 1 commit into
matrixorigin:mainfrom
XuPeng-SH:codex/main-tae-promotion-ci-fix

Conversation

@XuPeng-SH

Copy link
Copy Markdown
Contributor

Problem

Current main fails UT, Coverage UT, and SCA after #29421. The replay promotion test calls SendConfig with two arguments although the API requires a snapshot timestamp. A separate replay case accepts five L0 decay points during promotion preflight, but the task-trigger converter requires exactly four, so it fails later with a different error.

These failures also appear in #29423 CI, but neither failure is introduced by that PR.

Change

  • Pass the zero timestamp in the scheduler unit test, matching the current API.
  • Enforce the existing four-point trigger contract at promotion preflight, before workers start; reject extra points instead of silently truncating them.
  • Update the replay regression case to expect that validation error.

Validation

  • mo-cgo-test -count=1 -timeout=4m ./pkg/vm/engine/tae/db/merge ./pkg/vm/engine/tae/db/test — passed.
  • Focused scheduler and replay promotion tests — passed.

@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 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 of 791918f8d30c4346908dda31342b456a3a4f397d against main / merge-base 9b7c2c23dba737232d975d66bd04628199e1a436.

Recommendation: approve from the code-review perspective. No blocking finding in the complete three-file diff.

  • Expected behavior is justified: the L0 curve consumes [4]float64, and ToMMsgTaskTrigger already rejects every other length on main. Five points cannot be preserved by this representation. Changing promotion validation from < 4 to != 4 aligns the existing contract; it does not introduce a new rejection of a previously usable configuration. Valid four-point settings and normal configuration conversion are unchanged.
  • The test is not weakened to make CI green: the extra-point case now exercises the existing terminal promotion-failure assertions: remain in replay mode, reject another handoff and new transactions with the same error, and leave write-mode cron jobs absent. The valid custom-setting case still checks the exact recovered trigger. The invalid configuration is rejected before starting write workers; replay has already crossed its stop boundary, so this remains a terminal failure rather than a safely retryable preflight rejection.
  • The zero timestamp is appropriate here: the scheduler test asserts rejection of a nonempty queue before the scheduler starts. It never applies this configuration or tests commit ordering. Supplying types.TS{} restores the API call without changing that oracle; separate scheduler cases cover real commit-timestamp ordering.
  • Unhappy paths, performance, and engineering scope: traced settings decoding through promotion failure cleanup and the queued-message path. The production change is one constant-time length comparison; it adds no allocations, waits, goroutines, or abstractions. Existing test fixtures are reused and total source line count is unchanged.

Validation reused from this exact source revision (Linux/amd64, Go 1.26.4):

  • Full normal tests for pkg/vm/engine/tae/db/merge and pkg/vm/engine/tae/db/test: passed.
  • Individual -race -count=1 runs of TestPromotionPreflightRejectsQueuedOrPreviouslyRunScheduler and TestIssue29415ReplayPromotionLateTableAndSettings: passed, with real terminal exit status.
  • Local incremental checks on both changed packages: gofmt clean, go vet passed, go vet -vettool=molint passed with empty reports, and golangci-lint --new-from-rev <merge-base> reported 0 issues.

Full GitHub UT/SCA/Coverage/BVT checks are still running; these local results are not a claim of green full CI. Submitted as COMMENT because the authenticated account is also the PR author; the code-review recommendation is approval.

@XuPeng-SH
XuPeng-SH merged commit b9013dc into matrixorigin:main Sep 28, 2026
24 checks passed
@XuPeng-SH
XuPeng-SH deleted the codex/main-tae-promotion-ci-fix branch September 28, 2026 04:04
XuPeng-SH added a commit that referenced this pull request Sep 28, 2026
## What type of PR is this?

- [x] BUG
- [x] Improvement
- [x] Test and CI

## Which issue(s) this PR fixes:

Fixes #29414

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

A sys-owned publication can reference a physical database owned by
another account. The old DROP guard checked the publisher account and
database name while planning, so the target account could drop a
published database; a later same-name database could then be blocked by
the stale publication.

CREATE/ALTER PUBLICATION now takes a shared lock on the source account's
exact `mo_database` key and revalidates the resolved database ID. DROP
DATABASE takes its existing exclusive lock, refreshes its pessimistic-RC
snapshot, reopens the database, and checks all publishers for that
physical ID before deleting it. Post-lock index metadata cleanup also
uses the reopened ID, so a prepared DROP cannot clean the wrong
incarnation after a same-name replacement. The obsolete planner-time
publication decision is removed.

The fresh catalog and the 4.0.8 upgrade both add an index on
`mo_pubs(database_id)`. Upgrade checks for named publications with
missing or stale IDs and stops for explicit repair instead of admitting
unprotected historical rows. `DATABASE *` retains its special ID=0
behavior. Upgrade should run after a stopped cutover; mixed old/new
publication writers are not covered. This change addresses pessimistic
RC; fixed-SI DROP support remains separate (#29417/#29400).

Validation:
- `make cgo -j4` and `make build-with-prebuilt-native -j4` on the
feature worktree.
- Full `pkg/frontend`, `pkg/sql/plan`, `pkg/sql/compile`, and
`pkg/bootstrap/versions/v4_0_8` Go package tests passed; `pkg/frontend`
also passed with `-race`.
- New BVT specifies cross-account/same-name identity, comment-only and
source-changing ALTER, prepared DROP, atomic DROP ACCOUNT, and prepared
DROP after same-name replacement. The same SQL behavior was exercised
twice on an isolated locally built service; the BVT runner itself was
not available locally.
- Ten overlapping CREATE PUBLICATION vs DROP DATABASE runs produced both
commit orders without a dangling publication or dual success. This is a
timing challenge, not an exhaustive deterministic schedule proof.
- A committed two-CN integration regression now observes the exact
`mo_database` lock waiter before testing DROP rollback, commit,
same-name replacement, and `KILL QUERY`. It asserts physical-ID binding,
rejection of a published source DROP, no dangling publication after
failure or cancellation, and successful follow-up work. The focused test
passed normally and with `-race` on `1847a9d8d3`.
- Live `EXPLAIN` of the runtime literal-ID predicate chose `Index Table
Scan on mo_pubs.idx_mo_pubs_database_id`. The upgrade audit SQL parsed
and planned as a one-time MARK join.


Additional validation for the latest fix:
- DROP DATABASE lookup errors: eight focused cases covering
pre/post-lock lookup, missing database vs timeout, and IF EXISTS passed.
- `TestIssue26640ClusterRestoreRebindsSubscriptionPrivileges` passed
twice before rebase and once on the rebased production head
`0e4bcb1c39`; the subsequent commit adds only the publication
concurrency test. Full `pkg/frontend` and `pkg/sql/compile` package
tests passed.

CI update: the failed run on `e37552ef22` started before #29426 fixed
main's missing `SendConfig` argument and five-point decay test
expectation. This PR is rebased onto that fix at head `1847a9d8d3`,
based on `b9013dc6bb`. On that base, both previously failing TAE tests
and `TestIssue26640ClusterRestoreRebindsSubscriptionPrivileges` passed.
The focused publication concurrency regression passed in normal and race
modes. New-head CI is pending; this is not a full CI pass. The PR also
fixes its own earlier cluster-restore `txnOp is nil` failure and
cancellation barrier race.

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XS Denotes a PR that changes [1, 9] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants