Skip to content

[4.2-dev] Wait for CDC task storage in the role-policy test - #33451

Merged
XuPeng-SH merged 1 commit into
matrixorigin:4.2-devfrom
XuPeng-SH:test/42-cdc-task-service-readiness
Nov 29, 2026
Merged

XuPeng-SH merged 1 commit into
matrixorigin:4.2-devfrom
XuPeng-SH:test/42-cdc-task-service-readiness

Conversation

@XuPeng-SH

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • Test and CI

Which issue(s) this PR fixes:

Related to #32744.

What this PR does / why we need it:

On 4.2-dev, the embedded SQL endpoint can accept connections while the CN is still waiting for its task service to be published. In the failed Coverage job, the role-policy test sent its unrestricted CDC resume request during that window. The handler took its nil-service path and returned success before the test reached the real missing-task check. Failed coverage worker.

Before the existing CDC assertions, wait for the admin CN's published task service and a successful read from its backing store. The readiness probe uses the test context, retries the store's existing not-ready result and does not mutate CDC state. The same fixture still checks the expected missing-task error and the active-policy rejection.

Validation

  • Go 1.26.4, Linux/amd64. The exact TestMandatoryRoleRulesAcrossConnections passed with -race -short -tags matrixone_test -count=1 and with set-mode coverage over the startup and CDC owners.
  • Incremental formatting, vet, pinned molint and golangci-lint for ./pkg/tests/issues/isolated passed.
  • A local run of the original test reproduced the nil-service assertion. With a local test overlay holding the first four CN0 task-service publication attempts, the fixed test waited for publication and passed both missing-task checks.

@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 commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

@XuPeng-SH

XuPeng-SH commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: c5c953bf897826e5797b51f48922bad0187234ad

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: c5c953bf897826e5797b51f48922bad0187234ad

Assessment: approve

No actionable defects found. The test waits for the admin CN’s published task service and probes its backing store using existing capabilities, while preserving the CDC and role-policy assertions.

Model: gpt-6.1-terra / max

Session: 01a226fb-40e1-7c82-8448-1a1fd4af5968 · slot 1 · generation 36

Validation:

  • Isolation preflight passed; receipt: checks/1795966087900610250-3.json.

  • git diff --check passed; receipt: checks/1795966087874802698-3.json.

  • The focused two-CN TestMandatoryRoleRulesAcrossConnections passed with -race, -short and the matrixone_test tag; log: role-policy-race.log; receipt: checks/1795966659785706018-3.json.

  • A race-enabled diagnostic probe passed after observing delayed service publication and an initially unavailable store; log: readiness-probe-final.log; receipt: checks/1795966773537625814-3.json.

Limitations:

  • The diagnostic probe used the real task-service holder with an in-memory store; the focused integration test used the SQL-backed store.

  • The helper retries ErrNotReady and reports other store errors immediately. The full suite and coverage run were not repeated.

@XuPeng-SH
XuPeng-SH merged commit 2bdc8da into matrixorigin:4.2-dev Nov 29, 2026
18 of 20 checks passed
@XuPeng-SH
XuPeng-SH deleted the test/42-cdc-task-service-readiness branch November 29, 2026 15:42
XuPeng-SH added a commit that referenced this pull request Nov 30, 2026
## What type of PR is this?

- [x] BUG

## Which issue(s) this PR fixes:

Related to #26820. Applies the final-row CHECK behavior from #26912 to
`4.2-dev`.

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

Enforce CHECK on the rows that ordinary and joined UPDATE, UPDATE
IGNORE, upserts, and foreign-key actions actually write. Evaluate
explicit assignments once, select a complete source row per update
target, and derive generated values in dependency order. CHECK,
generated keys, and the write use the same row values.

- DedupJoin validates each image that another conflict will overwrite.
The existing vectorized CHECK validates the emitted image before no-op
write suppression, including a single conflicting row. A subsequent
valid assignment cannot hide a rejected intermediate value.
- SQL-equal explicit assignments retain observable representations.
Implicit `ON UPDATE` values and dependent generated columns are
finalized before CHECK. A generated column is evaluated once, including
in a no-op where a provisional timestamp would have caused a cast error.
Final write suppression compares the materialized values, including a
timestamp changed by an earlier conflict.
- Validate unsupported generated primary and unique key movement during
each repeat fold. Pre-resolved conflict targets require stable encoded
keys throughout folding, independently of CHECK and implicit `ON
UPDATE`. Both fold and final-row validation use the same key encoding
and return 20313 for unsupported movement.
- Eligible single-row generated primary key updates reuse UPDATE's
new-key duplicate check and lock. Delete by the old key and maintain
regular secondary-index entries by their original owner.
- Foreign-key actions validate the generated child row, preserve the
NULL-component exemption, and compare outgoing keys with SQL equality.
Changed non-NULL references use the existing parent lookup and lock when
the parent is outside the write closure. REPLACE child Datalink
admission stays bound to the final child values. Its existing guards
cover generated changes that would require unsupported index maintenance
or an unstable referenced parent.

The rebase uses the shared CDC task-store readiness check from #33451
and removes the temporary local task-service setup. Intermediate
generated-key checks reuse one encoded key snapshot per repeated group
that needs it. The final plan checks the emitted key. The change reuses
the existing plan fields, per-worker scratch and write path.

### Validation

- Go 1.26.4, darwin/arm64. Fresh race runs passed in 10 Go packages
covering planner, executor, compile, hash-build, multi-update, protocol
types and consumers. The mandatory-role-rule integration test passed.
Scoped golangci-lint reported zero issues. The pinned molint tool
reported 11 existing diagnostics in eight files identical to the release
base. Formatting, err-check and generated-plan binding verification
passed.
- At the previous PR head, direct UPDATE rejected negative zero with
3819. Matched and fresh duplicate groups and a singleton upsert accepted
the same invalid representation. The fixed MySQL TCP probe passed all
nine cases, including statement rollback inside an explicit transaction,
reuse of a prepared statement after an error, a secondary UNIQUE
conflict, an encoded generated key, and generated-cast boundaries.
- Five BVT fixtures passed 704/704 statements on an isolated cluster.
CHECK 245, generated columns 174, modern duplicate-key DML 203, VARCHAR
casts 47, prepared projections 35.
- Local timing for a prepared 4,096-conflict statement, five measured
executions after warm-up, median before → after: plain 5.19 → 5.25 ms,
check only 6.21 → 6.06 ms, implicit generated 7.09 → 7.14 ms. This is a
single-CN comparison of these workloads.

[Hosted
checks](https://github.com/matrixorigin/matrixone/pull/33324/checks)

This branch was previously deployed

1 inactive deployment
ci — c5c953bf Deployed Nov 29, 2026 by XuPeng-SH via Matrixone Utils CI / pr-size-label #66888
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