Files
seaweedfs/seaweed-block/core/frontend/nvme
pingqiuandClaude Opus 4.7 1be5da483d nvme test fixture: atomic.Pointer for lastWrite (race under TestT2A_ConcurrentQueueStress)
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>
2026-04-26 00:13:53 -07:00
..