Repository navigation
test(logservice): isolate manual HAKeeper bootstrap fixtures - #28554
Conversation
13be1a1 to
4496171
Compare
4496171 to
3023c77
Compare
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.
Force review conclusion: APPROVE. Exact head: 3023c77
No confirmed blocker found. Manual HAKeeper bootstrap now disables the competing ticker before construction, preserves Dragonboat replication, and retains the existing success/failure/recovery/watermark assertions. Cleanup and ownership paths remain coherent.
Non-blocking observations: the migrated tests do not prove automatic ticker scheduling or real admission/port release; construction assertions at store_hakeeper_check_test.go:428 remain nonfatal; shutdown and startup timing were not fault-tested.
CI run 34421377268 was still queued at review time, and the prior run had cancelled checks. I did not independently run local Go UT/race/vet, live cluster tests, fault injection, benchmarks, or compatibility testing.
## 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 #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.
…rigin#28554) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to matrixorigin#28550 ## What this PR does / why we need it: ### Root cause `runHAKeeperStoreTest` started the production HAKeeper ticker while several tests directly drove bootstrap transitions on the same `store`. After the ticker cadence was shortened, the two owners could concurrently allocate IDs and advance the replicated state. This caused the reported `idAllocator.Set`/`Next` race, the test callback race, and nondeterministic initial-cluster watermarks. ### Changes - Split the HAKeeper store fixture into ticker-enabled and manual-bootstrap modes. - Run tests that directly call bootstrap/checker transitions in manual mode (`DisableWorkers=true`), leaving ticker-dependent task fixtures unchanged. - Apply manual mode to initial-cluster, restore, bootstrap-cadence, recovery-bootstrap, and shared bootstrap tests. ### Issue-to-test proof Related to matrixorigin#28550: - `TestSetInitialClusterInfo` asserts that repeated initial-cluster proposals and rejected watermark restore leave the initial ID watermarks unchanged. - `TestBootstrapWaitsForRemoteWALRecovery` drives bootstrap through the remote WAL-recovery gate and verifies it remains deterministic. - Each reported test passed independently under `-race -count=100`; no race was reported. ### Tests - `mo-cgo-test -race -count=100 -run ^TestSetInitialClusterInfo$ ./pkg/logservice` — PASS (19.430s) - `mo-cgo-test -race -count=100 -run ^TestBootstrapWaitsForRemoteWALRecovery$ ./pkg/logservice` — PASS (26.378s) - Focused manual-bootstrap consumer group, normal and `-race` — PASS. - `GOWORK=off go vet -mod=readonly ./pkg/logservice` with repository CGo include/library paths — PASS. - Full `pkg/logservice` normal run was attempted but is not a green result: a user-owned local `minio` process occupies `127.0.0.1:9001`, causing the unrelated fixed-port `TestNotHAKeeperErrorIsHandled` startup failure and subsequent suite contamination. The process was not modified. ### Residual risks This is test-only fixture isolation. Production ticker behavior and ticker-dependent task fixture behavior are unchanged. Linux CI remains the final cross-platform validation.
## 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.
…rigin#28554) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to matrixorigin#28550 ## What this PR does / why we need it: ### Root cause `runHAKeeperStoreTest` started the production HAKeeper ticker while several tests directly drove bootstrap transitions on the same `store`. After the ticker cadence was shortened, the two owners could concurrently allocate IDs and advance the replicated state. This caused the reported `idAllocator.Set`/`Next` race, the test callback race, and nondeterministic initial-cluster watermarks. ### Changes - Split the HAKeeper store fixture into ticker-enabled and manual-bootstrap modes. - Run tests that directly call bootstrap/checker transitions in manual mode (`DisableWorkers=true`), leaving ticker-dependent task fixtures unchanged. - Apply manual mode to initial-cluster, restore, bootstrap-cadence, recovery-bootstrap, and shared bootstrap tests. ### Issue-to-test proof Related to matrixorigin#28550: - `TestSetInitialClusterInfo` asserts that repeated initial-cluster proposals and rejected watermark restore leave the initial ID watermarks unchanged. - `TestBootstrapWaitsForRemoteWALRecovery` drives bootstrap through the remote WAL-recovery gate and verifies it remains deterministic. - Each reported test passed independently under `-race -count=100`; no race was reported. ### Tests - `mo-cgo-test -race -count=100 -run ^TestSetInitialClusterInfo$ ./pkg/logservice` — PASS (19.430s) - `mo-cgo-test -race -count=100 -run ^TestBootstrapWaitsForRemoteWALRecovery$ ./pkg/logservice` — PASS (26.378s) - Focused manual-bootstrap consumer group, normal and `-race` — PASS. - `GOWORK=off go vet -mod=readonly ./pkg/logservice` with repository CGo include/library paths — PASS. - Full `pkg/logservice` normal run was attempted but is not a green result: a user-owned local `minio` process occupies `127.0.0.1:9001`, causing the unrelated fixed-port `TestNotHAKeeperErrorIsHandled` startup failure and subsequent suite contamination. The process was not modified. ### Residual risks This is test-only fixture isolation. Production ticker behavior and ticker-dependent task fixture behavior are unchanged. Linux CI remains the final cross-platform validation.
## 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.
…rigin#28554) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to matrixorigin#28550 ## What this PR does / why we need it: ### Root cause `runHAKeeperStoreTest` started the production HAKeeper ticker while several tests directly drove bootstrap transitions on the same `store`. After the ticker cadence was shortened, the two owners could concurrently allocate IDs and advance the replicated state. This caused the reported `idAllocator.Set`/`Next` race, the test callback race, and nondeterministic initial-cluster watermarks. ### Changes - Split the HAKeeper store fixture into ticker-enabled and manual-bootstrap modes. - Run tests that directly call bootstrap/checker transitions in manual mode (`DisableWorkers=true`), leaving ticker-dependent task fixtures unchanged. - Apply manual mode to initial-cluster, restore, bootstrap-cadence, recovery-bootstrap, and shared bootstrap tests. ### Issue-to-test proof Related to matrixorigin#28550: - `TestSetInitialClusterInfo` asserts that repeated initial-cluster proposals and rejected watermark restore leave the initial ID watermarks unchanged. - `TestBootstrapWaitsForRemoteWALRecovery` drives bootstrap through the remote WAL-recovery gate and verifies it remains deterministic. - Each reported test passed independently under `-race -count=100`; no race was reported. ### Tests - `mo-cgo-test -race -count=100 -run ^TestSetInitialClusterInfo$ ./pkg/logservice` — PASS (19.430s) - `mo-cgo-test -race -count=100 -run ^TestBootstrapWaitsForRemoteWALRecovery$ ./pkg/logservice` — PASS (26.378s) - Focused manual-bootstrap consumer group, normal and `-race` — PASS. - `GOWORK=off go vet -mod=readonly ./pkg/logservice` with repository CGo include/library paths — PASS. - Full `pkg/logservice` normal run was attempted but is not a green result: a user-owned local `minio` process occupies `127.0.0.1:9001`, causing the unrelated fixed-port `TestNotHAKeeperErrorIsHandled` startup failure and subsequent suite contamination. The process was not modified. ### Residual risks This is test-only fixture isolation. Production ticker behavior and ticker-dependent task fixture behavior are unchanged. Linux CI remains the final cross-platform validation.
## 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.
What type of PR is this?
Which issue(s) this PR fixes:
Related to #28550
What this PR does / why we need it:
Root cause
runHAKeeperStoreTeststarted the production HAKeeper ticker while several tests directly drove bootstrap transitions on the samestore. After the ticker cadence was shortened, the two owners could concurrently allocate IDs and advance the replicated state. This caused the reportedidAllocator.Set/Nextrace, the test callback race, and nondeterministic initial-cluster watermarks.Changes
DisableWorkers=true), leaving ticker-dependent task fixtures unchanged.Issue-to-test proof
Related to #28550:
TestSetInitialClusterInfoasserts that repeated initial-cluster proposals and rejected watermark restore leave the initial ID watermarks unchanged.TestBootstrapWaitsForRemoteWALRecoverydrives bootstrap through the remote WAL-recovery gate and verifies it remains deterministic.-race -count=100; no race was reported.Tests
mo-cgo-test -race -count=100 -run ^TestSetInitialClusterInfo$ ./pkg/logservice— PASS (19.430s)mo-cgo-test -race -count=100 -run ^TestBootstrapWaitsForRemoteWALRecovery$ ./pkg/logservice— PASS (26.378s)-race— PASS.GOWORK=off go vet -mod=readonly ./pkg/logservicewith repository CGo include/library paths — PASS.pkg/logservicenormal run was attempted but is not a green result: a user-owned localminioprocess occupies127.0.0.1:9001, causing the unrelated fixed-portTestNotHAKeeperErrorIsHandledstartup failure and subsequent suite contamination. The process was not modified.Residual risks
This is test-only fixture isolation. Production ticker behavior and ticker-dependent task fixture behavior are unchanged. Linux CI remains the final cross-platform validation.