fix: CP13-8A — fix malformed replica address in test allocator + add read proof

Investigation result:
- Dual-BlockVol hypothesis: DISPROVEN (one instance per path, correct wiring)
- Root cause: adapter wiring bug in test allocator
  soak_test.go blockVSAllocate returned ReplicaDataAddr = "vs2:9333:14260"
  (server + ":port" where server already has a port → three colons, invalid)
  This caused setupReplicaReceiver to fail silently → no data replicated

Root cause classification: adapter/test-harness bug
- NOT a backend data visibility bug
- NOT a core-rule gap
- The engine read path works correctly (TestSyncAll_FullRoundTrip passes)

Code changes:
- qa_block_soak_test.go: fix allocator to use host:port (not server:port),
  use deterministic FNV-hashed ports matching production ReplicationPorts
- qa_block_cp13_8a_test.go: 2 new integration tests proving replica reads
  work through both ReadLBA and adapter.ReadAt, before and after promotion

Remaining contradiction for CP13-8 scenario on real hardware:
- The production weed cluster uses ReplicationPorts (deterministic) which
  should not have this bug. If CP13-8 still fails on m01/M02, the cause
  is different from this test-harness issue and needs a separate investigation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
pingqiuandClaude Opus 4.6 committed 2026-04-03 11:47:41 -07:00
1 parent 2c305f9e7f
commit 3da4c19046
2 files changed
+217 -3

No files matched your search

+11 -3
View File
@@ -3,6 +3,7 @@ package weed_server
import (
"context"
"fmt"
"hash/fnv"
"os"
"path/filepath"
"strings"
@@ -68,13 +69,20 @@ func newSoakSetup(t *testing.T) *soakSetup {
if idx := strings.LastIndex(server, ":"); idx >= 0 {
host = server[:idx]
}
// Use deterministic ports for replication (matching production ReplicationPorts behavior).
h := fnv.New32a()
h.Write([]byte(volPath))
offset := int(h.Sum32()%500) * 3
dataPort := 14000 + offset
ctrlPort := dataPort + 1
rebuildPort := dataPort + 2
return &blockAllocResult{
Path: volPath,
IQN: fmt.Sprintf("iqn.2024.test:%s", name),
ISCSIAddr: host + ":3260",
ReplicaDataAddr: server + ":14260",
ReplicaCtrlAddr: server + ":14261",
RebuildListenAddr: server + ":15000",
ReplicaDataAddr: fmt.Sprintf("127.0.0.1:%d", dataPort),
ReplicaCtrlAddr: fmt.Sprintf("127.0.0.1:%d", ctrlPort),
RebuildListenAddr: fmt.Sprintf("127.0.0.1:%d", rebuildPort),
}, nil
}
ms.blockVSDelete = func(ctx context.Context, server string, name string) error { return nil }