mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 10:37:23 +01:00
1be5da483dad375774fc3a4107b2b2885166f3af
writeCountingBackend.lastWrite was a plain []byte field. The
chunked-R2T integrity tests drive Writes serially (assumption
documented in the original code), but TestT2A_ConcurrentQueueStress
shares one writeCountingBackend across 8 IO queues, violating that
assumption — m01 -race reported a write-write race on the field.
Race report (m01, T4d-4 verification):
WARNING: DATA RACE on writeCountingBackend.lastWrite
Both goroutines: nvme_test.(*writeCountingBackend).Write
Stack: dispatchIO → handleWrite → IOHandler.Handle → ...
Fix: replace plain field with atomic.Pointer[[]byte]. Each Write
Stores a fresh copied slice (never mutated after store); readers
Load() to observe a stable snapshot. Semantics preserved for the
chunked-R2T integrity check sites.
Production code untouched. Production session model already
correctly synchronized (per QA's race triage during T4d closure).
Refs §8B.4 Discovery Bridge: QA-owned NVMe test fixture lastWrite
race. Architect-approved 2026-04-26 (pingqiu). Verify on m01:
go test -race -count=10 -run TestT2A_ConcurrentQueueStress \
./core/frontend/nvme/
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Languages
Go
84.7%
Rust
7.7%
Shell
2.7%
templ
1.5%
Java
1%
Other
2.1%