Problem
cd cmd/server && go test . -race -count=1 intermittently fails in TestHashMigrate_LogsMaxWriteLockHold_215 with a data race between startBackgroundIndexBuilds (index_ready_1008.go) and PacketStore.Load (store.go). The test reaches it through the hash-migrate test harness.
It was seen during the local review of #294, on master 4f1de049 plus #294, which touches neither file. CI's Go Build & Test was green on the same head, so the race is intermittent.
This is not #267: that was the wall-clock write-hold budget of the backfill test.
Task
- Reproduce:
go test -race -count=50 -run TestHashMigrate_LogsMaxWriteLockHold_215 . in cmd/server, under parallel CPU load if needed. Capture the full race report: both goroutine stacks and the shared variable.
- Find out whether the race is in production code, for example background index builds reading store state that
Load is still writing without the lock, or only in the test harness, for example the harness starting index builds before Load returns.
- Fix the cause:
- Production race: fix it with the correct lock or ordering, with no expensive work held under the lock. Add a regression test that is red under
-race before the fix.
- Harness only: fix the harness and explain why production cannot hit the same path.
- Show 100 consecutive
-race runs of the test green after the fix.
Acceptance
Problem
cd cmd/server && go test . -race -count=1intermittently fails inTestHashMigrate_LogsMaxWriteLockHold_215with a data race betweenstartBackgroundIndexBuilds(index_ready_1008.go) andPacketStore.Load(store.go). The test reaches it through the hash-migrate test harness.It was seen during the local review of #294, on master
4f1de049plus #294, which touches neither file. CI's Go Build & Test was green on the same head, so the race is intermittent.This is not #267: that was the wall-clock write-hold budget of the backfill test.
Task
go test -race -count=50 -run TestHashMigrate_LogsMaxWriteLockHold_215 .incmd/server, under parallel CPU load if needed. Capture the full race report: both goroutine stacks and the shared variable.Loadis still writing without the lock, or only in the test harness, for example the harness starting index builds beforeLoadreturns.-racebefore the fix.-raceruns of the test green after the fix.Acceptance
go test -race -count=100 -run TestHashMigrate_LogsMaxWriteLockHold_215passes.cmd/servergo test -race ./...is green.map[string]interface{}, andcmd/serverstays read-only.