Skip to content

test: stabilize task creation after CN failover - #33296

Merged
XuPeng-SH merged 1 commit into
matrixorigin:mainfrom
XuPeng-SH:fix/task-failover-test-20702
Nov 26, 2026
Merged

XuPeng-SH merged 1 commit into
matrixorigin:mainfrom
XuPeng-SH:fix/task-failover-test-20702

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 issue #32745 (main flaky CI/UT tracker).

What this PR does / why we need it:

TestTaskSchedulerExpiresLostRunnerWithoutReplay sometimes fails when the surviving CN creates a follow-up task. The old task has expired, but the follow-up INSERT can still hit a stale lock-table binding and roll back with MySQL error 20702. This occurred on clean main and on #33010.

Retry the survivor's follow-up INSERT under the original test deadline only after the explicit driver response that rolls back the transaction. Keep the exact-one-row, survivor ownership, and one-execution assertions. Preserve ambiguous write failures, since task metadata IDs are not unique.

Validation

  • Full pkg/tests/service race suite passed, including the two-CN failover and no-replay assertions.
  • Focused race tests at the final revision passed for 20702 rollback, an unknown commit result, a mixed error, and deadline expiry.
  • CI incremental selection was ./pkg/tests/service. Formatting, diff checks, err-check, molint and golangci-lint passed with zero lint issues.

@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 26, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

@XuPeng-SH

XuPeng-SH commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: bc852db8898cfb78120a770f890b616591009ebf

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

Assessment: approve

The test now retries the survivor's follow-up task creation only for a direct lock-table binding error, within the original deadline. The underlying TN rejects that error before commit, while ambiguous and joined client errors are returned without retry. The existing expiration, survivor ownership, exact-row and no-replay assertions remain in place.

Model: gpt-6.1-terra / max

Session: 01a21559-2c14-7273-a4d2-83e9387fd8ce · slot 2 · generation 5

Validation:

  • Preflight passed, and native prerequisites were built from inputs matching the frozen source: checks/1795678455267615651-2.json, checks/1795678517401859578-2.json, native-build.log and native-source-check.log.

  • The selected service tests passed with -race -count=1: TestCreateTaskAfterFailover and TestTaskSchedulerExpiresLostRunnerWithoutReplay, including its two-CN failover. The log shows all four retry subtests and the integration test ran: checks/1795678774659663592-2.json and service-tests.log.

  • git diff --check passed: checks/1795678556320654901-2.json and diff-check.log.

Limitations:

  • The two-CN run did not demonstrate that it encountered error 20702; the retry and non-retry cases were exercised by deterministic injected errors. The author's reported full service race suite was not independently rerun, and the frozen CI UT job was queued.

@XuPeng-SH
XuPeng-SH merged commit ba80b48 into matrixorigin:main Nov 26, 2026

This branch was previously deployed

1 inactive deployment
ci — bc852db8 Deployed Nov 26, 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/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants