Repository navigation
Fix replay promotion CI regressions on main - #29426
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
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, andToMMsgTaskTriggeralready rejects every other length on main. Five points cannot be preserved by this representation. Changing promotion validation from< 4to!= 4aligns 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/mergeandpkg/vm/engine/tae/db/test: passed. - Individual
-race -count=1runs ofTestPromotionPreflightRejectsQueuedOrPreviouslyRunSchedulerandTestIssue29415ReplayPromotionLateTableAndSettings: passed, with real terminal exit status. - Local incremental checks on both changed packages: gofmt clean,
go vetpassed,go vet -vettool=molintpassed with empty reports, andgolangci-lint --new-from-rev <merge-base>reported0 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.
## 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.
Problem
Current
mainfails UT, Coverage UT, and SCA after #29421. The replay promotion test callsSendConfigwith 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
Validation
mo-cgo-test -count=1 -timeout=4m ./pkg/vm/engine/tae/db/merge ./pkg/vm/engine/tae/db/test— passed.