Skip to content

test(logservice): synchronize TestFailedBootstrap - #28553

Merged
XuPeng-SH merged 1 commit into
matrixorigin:mainfrom
gouhongshen:agent/issue-28551-3d0b60ba
Sep 10, 2026
Merged

XuPeng-SH merged 1 commit into
matrixorigin:mainfrom
gouhongshen:agent/issue-28551-3d0b60ba

Conversation

@gouhongshen

@gouhongshen gouhongshen commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • BUG
  • API-change
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

Related to #28551

What this PR does / why we need it:

Root cause

Before the current main baseline, TestFailedBootstrap directly overwrote bootstrapCheckDeadline while the HAKeeper ticker could read it. The broader fixture race is now eliminated by #28554, which runs manual bootstrap tests with workers disabled. This test still bypassed the deadline owner to force expiry instead of using the existing explicit-time bootstrap-check seam.

Changes

  • Drive failure expiry through checkBootstrapWithSetterAt with a deliberately expired time.
  • Use the production state setter and require that the replicated state transition succeeds.
  • Preserve the failure oracle: incomplete bootstrap transitions to HAKeeperBootstrapFailed.

Issue-to-test proof

TestFailedBootstrap exercises the same incomplete-bootstrap failure path without mutating the production-owned deadline. The normal bootstrap and remote WAL-recovery consumers of the shared helper remain covered as controls.

Tests

  • .agents/skills/mo-dev/scripts/mo-cgo-test -list ^(TestFailedBootstrap|TestBootstrap|TestBootstrapWaitsForRemoteWALRecovery)$ ./pkg/logservice
  • .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=180s -run ^(TestFailedBootstrap|TestBootstrap|TestBootstrapWaitsForRemoteWALRecovery)$ ./pkg/logservice (passed after rebase onto main@ac660ae56e, 1.545s)
  • .agents/skills/mo-dev/scripts/mo-cgo-test -race -count=100 -timeout=240s -run ^TestFailedBootstrap$ ./pkg/logservice (passed after rebase onto main@ac660ae56e, 19.269s)

BVT is not applicable: this is an internal Go test ownership and state-transition contract with no SQL or client-visible behavior.

Residual risk

Production code is unchanged. #28554 in the base branch owns ticker isolation for manual bootstrap fixtures; this PR is limited to the deadline-driving seam. Fresh Linux CI is required after the rebase.

@gouhongshen

gouhongshen commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor Author

The prior arm64 SCA blocker #28546 is resolved on main by #28555 at 7c643f469b9162dec19b7f880e4cf6b2c12507d9, which removes the exact unused five-line execInternalTxnSQL wrapper reported by the failed job.

This PR is now rebased onto current main@ac660ae56ecd37bab3dd8c61193617a323377029 at af555e451d1e7ded09f2aca42213acc63236a04a. The focused normal and race regression tests pass locally; the new head has its own CI run pending. No unrelated CI blockers remain.

@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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed exact head e59b5573249a85f0c37a04ed67e21e33a1248e10 against base/merge-base f6aa238d6d535a344ee41d23d5f3bbcf9ecd7912. No blocker found.

The fail branch now exercises the existing explicit-time seam with the real replicated state setter and checks its error. The supplied time is at or after the established deadline: bootstrap first sets now+window, and the later test call supplies a later now+the same window. The predicate uses !now.Before(deadline), so equality is also expired; there is no sleep or scheduling race needed to reach failure. The manual fixture in the current base disables the background ticker before startup, eliminating a competing deadline/state owner.

The final HAKeeperBootstrapFailed assertion remains intact, while normal bootstrap and remote WAL-recovery controls still use their existing paths. Fresh-store isolation, deferred store cleanup, proposal timeout/cancellation, and leak checks are preserved. This small test-only change adds no resources, shared global mutation, platform-specific code, or meaningful runtime cost; feature-design and SQL BVT gates are not applicable.

git diff --check passed. The PR records named normal control runs and TestFailedBootstrap under -race -count=100 (22.131s); no duplicate long test or CI wait was performed for this force review. Approval is for the reviewed code, not a claim that pending Linux CI has completed.

@gouhongshen
gouhongshen force-pushed the agent/issue-28551-3d0b60ba branch from c04a565 to af555e4 Compare September 10, 2026 02:21
@XuPeng-SH
XuPeng-SH merged commit fc621e3 into matrixorigin:main Sep 10, 2026
21 of 22 checks passed
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

- [x] BUG
- [ ] API-change
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [x] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

Related to matrixorigin#28551

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

### Root cause

Before the current `main` baseline, `TestFailedBootstrap` directly
overwrote `bootstrapCheckDeadline` while the HAKeeper ticker could read
it. The broader fixture race is now eliminated by matrixorigin#28554, which runs
manual bootstrap tests with workers disabled. This test still bypassed
the deadline owner to force expiry instead of using the existing
explicit-time bootstrap-check seam.

### Changes

- Drive failure expiry through `checkBootstrapWithSetterAt` with a
deliberately expired time.
- Use the production state setter and require that the replicated state
transition succeeds.
- Preserve the failure oracle: incomplete bootstrap transitions to
`HAKeeperBootstrapFailed`.

### Issue-to-test proof

`TestFailedBootstrap` exercises the same incomplete-bootstrap failure
path without mutating the production-owned deadline. The normal
bootstrap and remote WAL-recovery consumers of the shared helper remain
covered as controls.

### Tests

- `.agents/skills/mo-dev/scripts/mo-cgo-test -list
^(TestFailedBootstrap|TestBootstrap|TestBootstrapWaitsForRemoteWALRecovery)$
./pkg/logservice`
- `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=180s -run
^(TestFailedBootstrap|TestBootstrap|TestBootstrapWaitsForRemoteWALRecovery)$
./pkg/logservice` (passed after rebase onto main@ac660ae56e, 1.545s)
- `.agents/skills/mo-dev/scripts/mo-cgo-test -race -count=100
-timeout=240s -run ^TestFailedBootstrap$ ./pkg/logservice` (passed after
rebase onto main@ac660ae56e, 19.269s)

BVT is not applicable: this is an internal Go test ownership and
state-transition contract with no SQL or client-visible behavior.

### Residual risk

Production code is unchanged. matrixorigin#28554 in the base branch owns ticker
isolation for manual bootstrap fixtures; this PR is limited to the
deadline-driving seam. Fresh Linux CI is required after the rebase.
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

- [x] BUG
- [ ] API-change
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [x] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

Related to matrixorigin#28551

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

### Root cause

Before the current `main` baseline, `TestFailedBootstrap` directly
overwrote `bootstrapCheckDeadline` while the HAKeeper ticker could read
it. The broader fixture race is now eliminated by matrixorigin#28554, which runs
manual bootstrap tests with workers disabled. This test still bypassed
the deadline owner to force expiry instead of using the existing
explicit-time bootstrap-check seam.

### Changes

- Drive failure expiry through `checkBootstrapWithSetterAt` with a
deliberately expired time.
- Use the production state setter and require that the replicated state
transition succeeds.
- Preserve the failure oracle: incomplete bootstrap transitions to
`HAKeeperBootstrapFailed`.

### Issue-to-test proof

`TestFailedBootstrap` exercises the same incomplete-bootstrap failure
path without mutating the production-owned deadline. The normal
bootstrap and remote WAL-recovery consumers of the shared helper remain
covered as controls.

### Tests

- `.agents/skills/mo-dev/scripts/mo-cgo-test -list
^(TestFailedBootstrap|TestBootstrap|TestBootstrapWaitsForRemoteWALRecovery)$
./pkg/logservice`
- `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=180s -run
^(TestFailedBootstrap|TestBootstrap|TestBootstrapWaitsForRemoteWALRecovery)$
./pkg/logservice` (passed after rebase onto main@ac660ae56e, 1.545s)
- `.agents/skills/mo-dev/scripts/mo-cgo-test -race -count=100
-timeout=240s -run ^TestFailedBootstrap$ ./pkg/logservice` (passed after
rebase onto main@ac660ae56e, 19.269s)

BVT is not applicable: this is an internal Go test ownership and
state-transition contract with no SQL or client-visible behavior.

### Residual risk

Production code is unchanged. matrixorigin#28554 in the base branch owns ticker
isolation for manual bootstrap fixtures; this PR is limited to the
deadline-driving seam. Fresh Linux CI is required after the rebase.
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

- [x] BUG
- [ ] API-change
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [x] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

Related to matrixorigin#28551

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

### Root cause

Before the current `main` baseline, `TestFailedBootstrap` directly
overwrote `bootstrapCheckDeadline` while the HAKeeper ticker could read
it. The broader fixture race is now eliminated by matrixorigin#28554, which runs
manual bootstrap tests with workers disabled. This test still bypassed
the deadline owner to force expiry instead of using the existing
explicit-time bootstrap-check seam.

### Changes

- Drive failure expiry through `checkBootstrapWithSetterAt` with a
deliberately expired time.
- Use the production state setter and require that the replicated state
transition succeeds.
- Preserve the failure oracle: incomplete bootstrap transitions to
`HAKeeperBootstrapFailed`.

### Issue-to-test proof

`TestFailedBootstrap` exercises the same incomplete-bootstrap failure
path without mutating the production-owned deadline. The normal
bootstrap and remote WAL-recovery consumers of the shared helper remain
covered as controls.

### Tests

- `.agents/skills/mo-dev/scripts/mo-cgo-test -list
^(TestFailedBootstrap|TestBootstrap|TestBootstrapWaitsForRemoteWALRecovery)$
./pkg/logservice`
- `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=180s -run
^(TestFailedBootstrap|TestBootstrap|TestBootstrapWaitsForRemoteWALRecovery)$
./pkg/logservice` (passed after rebase onto main@ac660ae56e, 1.545s)
- `.agents/skills/mo-dev/scripts/mo-cgo-test -race -count=100
-timeout=240s -run ^TestFailedBootstrap$ ./pkg/logservice` (passed after
rebase onto main@ac660ae56e, 19.269s)

BVT is not applicable: this is an internal Go test ownership and
state-transition contract with no SQL or client-visible behavior.

### Residual risk

Production code is unchanged. matrixorigin#28554 in the base branch owns ticker
isolation for manual bootstrap fixtures; this PR is limited to the
deadline-driving seam. Fresh Linux CI is required after the rebase.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deep review of the fix for issue #28551. The supplied /pull/28551 URL resolves to that issue; #28553 is its corresponding merged fix.

Reviewed exact head af555e451d1e7ded09f2aca42213acc63236a04a against base/merge-base ac660ae56ecd37bab3dd8c61193617a323377029: one test file, 4 additions / 4 deletions. No code blocker found.

  • Root-cause closure: #28554's manual fixture is already in this base. It sets DisableWorkers before store construction, and startHAKeeperReplica checks that flag before launching the ticker. The manual test therefore owns the bootstrap deadline/manager/callback. Merely changing the deadline assignment would not fix the original race without this prerequisite.
  • Correctness and unhappy paths: bootstrap establishes a nonzero deadline at an earlier time.Now()+window; the test supplies a later time.Now()+the same window, so the existing !now.Before(deadline) predicate takes the expiry branch without a scheduler-dependent sleep. The real setBootstrapState remains in use, its error is now required to be nil, and the subsequent replicated-state read still requires HAKeeperBootstrapFailed. Existing deadline-before/at/after, setter-error, success, and remote-WAL-recovery controls remain intact.
  • Lifecycle/engineering: the fixture retains its deferred store shutdown and leak check; the change adds no resources, waits, global state, production locks, or background workers. It reuses the existing explicit-time seam, adds no production code and no net lines, and introduces no production performance cost. No additional design document or SQL BVT is warranted for this test-only change.

Evidence: the author records focused normal controls and TestFailedBootstrap -race -count=100 after rebasing to this base (19.269s), and the exact-head arm64 SCA check succeeded. This review inspected exact-revision source and the complete diff; it did not rerun those tests.

Validation limit: exact-head CI run 34429102291 finished with a failed Ubuntu/x86 UT job (102720745075) and failed CI Required. Its retained annotation says only Process completed with exit code 2; the run-log API now returns HTTP 410. Consequently I cannot attribute that failure to another module or claim the full package/CI was green. The no-code-blocker conclusion above is not a clean-CI certification.

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

kind/bug Something isn't working kind/test-ci size/XS Denotes a PR that changes [1, 9] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants