You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: logservice HAKeeper bootstrap tests race on ID allocation and initial cluster state #28550
Command: make ut UT_CONFIGURED=1 UT_PARALLEL=6 UT_TIMEOUT=40 UT_SHARD=all
Package: github.com/matrixorigin/matrixone/pkg/logservice under -race
Observed
TestBootstrapWaitsForRemoteWALRecovery reports a data race: the HAKeeper ticker calls (*idAllocator).Set through (*store).updateIDAlloc, while bootstrap calls (*idAllocator).Next through bootstrap.Manager.bootstrapLogService. A second race is reported in the test bootstrap callback at store_hakeeper_check_test.go:1173.
TestSetInitialClusterInfo expects 0x4000a but receives 0x4280a at store_hakeeper_check_test.go:955 and :967, while the service logs that initial cluster info is already set.
Expected
HAKeeper bootstrap/ticker state and ID allocation are synchronized so race-enabled logservice tests have deterministic bootstrap state.
Scope
This is unrelated to matrixone#28291: that PR changes only four pkg/fileservice test files and does not touch logservice, HAKeeper, or bootstrap code.
Assertion: store_test.go:456 expected HAKeeperBootstrapCommandsReceived (0x4000a) but observed the already-advanced state 0x4280a.
The test starts tickerForTaskSchedule before proceedHAKeeperToRunning; the ticker can therefore advance the state before the helper checks its intermediate bootstrap state. The service continued into HAKeeper running and allocated the task, but the transient-state assertion had already failed.
This is the same root-cause class and exact state-value mismatch recorded in this issue. #28554 gave manual bootstrap fixtures exclusive worker ownership, but this test intentionally starts its own ticker before the helper and remains exposed.
This recurrence is unrelated to PR #28272: pkg/logservice, pkg/hakeeper, and pkg/taskservice are unchanged across its exact base/head. The two failing test-source blobs are identical:
CI command: make ut UT_CONFIGURED=1 UT_PARALLEL=6 UT_TIMEOUT=40 UT_SHARD=all
The failed case is pkg/logservice.TestTickerForTaskSchedule under the race-enabled UT path. The complete log reports WARNING: DATA RACE: idAllocator.Capacity() at store_hakeeper_check.go:78 reads while bootstrap calls idAllocator.Next() at line 61 and the ticker/update path calls idAllocator.Set() at line 74. The test terminates with testing.go:1712: race detected during execution of test.
Independent validation used the repository's mo-cgo-test wrapper with the CI race/tags/mode (-race -tags matrixone_test -vet=off -short -count=1 -timeout=40m -p 1) and the exact test. The PR head passed 3/3 runs. Clean detached up/main at e7d46d6dfb27696211ca828c55e245d3bd1b634d ran the same test 3 times; runs 1 and 2 passed, and run 3 reproduced the same idAllocator.Capacity versus Next/Set race. The PR diff is limited to four frontend/Arrow LOAD files; its dependency closure does not touch pkg/logservice, HAKeeper/bootstrap, idAllocator, or this test.
This is a recurrence of the HAKeeper bootstrap/ticker ID-allocation race covered by this issue, now with the race detector exposing the unsynchronized Capacity access directly. Run 34490540322 had already consumed its single permitted failed-job rerun (attempt 1 to attempt 2); no second rerun is requested.
The race detector reports concurrent unsynchronized access to the allocator's nextID/range state. This is outside PR #28459: the PR changes INSERT IGNORE warning propagation and does not modify pkg/logservice or pkg/hakeeper.
This occurrence broadens the required fix beyond the two previously observed tests: all allocator readers and writers need one consistent synchronization/atomicity strategy, and the affected logservice tests should pass repeatedly under -race without sleeps or retries masking the race.
The CodeQL failure on PR #28459 is separate: its annotation is the existing SHA-256/password alert at pkg/sql/compile/scheduler.go:553, also outside that PR's changed files.
This PR closes the confirmed TestTickerForTaskSchedule occurrence by giving manual bootstrap exclusive HAKeeper ownership while retaining the task-scheduling ticker under test, and by joining that ticker before fixture teardown.
It intentionally does not claim to close the entire issue: TestTaskSchedulerCanReScheduleExpiredTasks still needs a separate single-driver redesign because it relies on background HAKeeper ticks for expiration.
Activity
gouhongshen commentedon Sep 9, 2026
PR #28554 is trying to fix this issue.
test(logservice): isolate manual HAKeeper bootstrap fixtures (#28554)
gouhongshen commentedon Sep 10, 2026
PR #28554 has merged and is awaiting manual validation. The issue remains open.
gouhongshen commentedon Sep 10, 2026
Recurrence after #28554 merged:
e97333b63b1aa67838f437e10c46d7656b60a5f6pkg/logservice.TestTickerForTaskSchedulestore_test.go:456expectedHAKeeperBootstrapCommandsReceived(0x4000a) but observed the already-advanced state0x4280a.The test starts
tickerForTaskSchedulebeforeproceedHAKeeperToRunning; the ticker can therefore advance the state before the helper checks its intermediate bootstrap state. The service continued into HAKeeper running and allocated the task, but the transient-state assertion had already failed.This is the same root-cause class and exact state-value mismatch recorded in this issue. #28554 gave manual bootstrap fixtures exclusive worker ownership, but this test intentionally starts its own ticker before the helper and remains exposed.
This recurrence is unrelated to PR #28272:
pkg/logservice,pkg/hakeeper, andpkg/taskserviceare unchanged across its exact base/head. The two failing test-source blobs are identical:store_test.go:55110833858d0313b28782d072f08db734481ceestore_hakeeper_check_test.go:dec77f429a93115b416ac4285941661c683029faRun attempt 1 will receive the single permitted failed-job rerun after the workflow reaches a terminal state.
iamlinjunhong commentedon Sep 11, 2026
Recurrence from PR #28633 at exact head
d0d1b70daa982c8a8da53e4199629f91bd7f3edd.make ut UT_CONFIGURED=1 UT_PARALLEL=6 UT_TIMEOUT=40 UT_SHARD=allThe failed case is
pkg/logservice.TestTickerForTaskScheduleunder the race-enabled UT path. The complete log reportsWARNING: DATA RACE:idAllocator.Capacity()atstore_hakeeper_check.go:78reads while bootstrap callsidAllocator.Next()at line 61 and the ticker/update path callsidAllocator.Set()at line 74. The test terminates withtesting.go:1712: race detected during execution of test.Independent validation used the repository's
mo-cgo-testwrapper with the CI race/tags/mode (-race -tags matrixone_test -vet=off -short -count=1 -timeout=40m -p 1) and the exact test. The PR head passed 3/3 runs. Clean detachedup/mainate7d46d6dfb27696211ca828c55e245d3bd1b634dran the same test 3 times; runs 1 and 2 passed, and run 3 reproduced the sameidAllocator.CapacityversusNext/Setrace. The PR diff is limited to four frontend/Arrow LOAD files; its dependency closure does not touchpkg/logservice, HAKeeper/bootstrap,idAllocator, or this test.This is a recurrence of the HAKeeper bootstrap/ticker ID-allocation race covered by this issue, now with the race detector exposing the unsynchronized
Capacityaccess directly. Run 34490540322 had already consumed its single permitted failed-job rerun (attempt 1 to attempt 2); no second rerun is requested.XuPeng-SH commentedon Sep 11, 2026
Additional occurrence from PR #28459
The Ubuntu/x86 race suite reproduced the same unsynchronized HAKeeper ID-allocation access in
TestTickerForTaskSchedule:pkg/logservice.TestTickerForTaskScheduleidAllocator.Capacity()->store.getScheduleCommand()-> HAKeeper tickeridAllocator.Next()->hakeeper/bootstrap.Manager.bootstrapLogService()idAllocator.Set()->store.updateIDAlloc()The race detector reports concurrent unsynchronized access to the allocator's
nextID/range state. This is outside PR #28459: the PR changes INSERT IGNORE warning propagation and does not modifypkg/logserviceorpkg/hakeeper.This occurrence broadens the required fix beyond the two previously observed tests: all allocator readers and writers need one consistent synchronization/atomicity strategy, and the affected logservice tests should pass repeatedly under
-racewithout sleeps or retries masking the race.The CodeQL failure on PR #28459 is separate: its annotation is the existing SHA-256/password alert at
pkg/sql/compile/scheduler.go:553, also outside that PR's changed files.XuPeng-SH commentedon Sep 11, 2026
Follow-up PR: #28668
#28668
This PR closes the confirmed
TestTickerForTaskScheduleoccurrence by giving manual bootstrap exclusive HAKeeper ownership while retaining the task-scheduling ticker under test, and by joining that ticker before fixture teardown.It intentionally does not claim to close the entire issue:
TestTaskSchedulerCanReScheduleExpiredTasksstill needs a separate single-driver redesign because it relies on background HAKeeper ticks for expiration.test(logservice): avoid HAKeeper double-driver race in task scheduler…
fix(logservice): start one HAKeeper ticker per store (#28696)
test(logservice): isolate manual HAKeeper bootstrap fixtures (matrixo…
test(logservice): avoid HAKeeper double-driver race in task scheduler…
fix(logservice): start one HAKeeper ticker per store (matrixorigin#28696
test(logservice): isolate manual HAKeeper bootstrap fixtures (matrixo…
test(logservice): avoid HAKeeper double-driver race in task scheduler…
fix(logservice): start one HAKeeper ticker per store (matrixorigin#28696
test(logservice): isolate manual HAKeeper bootstrap fixtures (matrixo…
test(logservice): avoid HAKeeper double-driver race in task scheduler…
fix(logservice): start one HAKeeper ticker per store (matrixorigin#28696