diff --git a/seaweed-block/core/frontend/durable/storage_adapter.go b/seaweed-block/core/frontend/durable/storage_adapter.go index 2aa5a1c40c..af5db9c674 100644 --- a/seaweed-block/core/frontend/durable/storage_adapter.go +++ b/seaweed-block/core/frontend/durable/storage_adapter.go @@ -379,7 +379,16 @@ func (b *StorageBackend) writeBytes(ctx context.Context, offset int64, p []byte) b.mu.Lock() obs := b.observer b.mu.Unlock() - if obs != nil { + // G5-5 instrumentation: log every write hit to the observer + // hook so we can disambiguate "WriteObserver never wired" from + // "wired but fan-out fails downstream". obs==nil at write time + // indicates SetWriteObserver wasn't called BEFORE the iSCSI + // initiator started writing — a timing race in main.go. + if obs == nil { + log.Printf("durable: write observer NIL — replication fan-out skipped (lba=%d lsn=%d) — SetWriteObserver not yet wired", + lba, lsn) + } else { + log.Printf("durable: write observer dispatch lba=%d lsn=%d", lba, lsn) if werr := obs.Observe(ctx, lba, lsn, block); werr != nil { log.Printf("durable: replication fan-out failed lba=%d lsn=%d: %v", lba, lsn, werr) diff --git a/seaweed-block/core/replication/peer.go b/seaweed-block/core/replication/peer.go index 72fbd05b8c..34a6abe1a4 100644 --- a/seaweed-block/core/replication/peer.go +++ b/seaweed-block/core/replication/peer.go @@ -187,10 +187,14 @@ func (p *ReplicaPeer) ShipEntry(ctx context.Context, lineage transport.RecoveryL p.mu.Lock() if p.closed { p.mu.Unlock() + log.Printf("replication: ship gate-close peer=%s lba=%d lsn=%d (peer closed)", + p.target.ReplicaID, lba, lsn) return fmt.Errorf("replication: ShipEntry: peer %s closed", p.target.ReplicaID) } if p.state == ReplicaDegraded { p.mu.Unlock() + log.Printf("replication: ship gate-degraded peer=%s lba=%d lsn=%d (peer degraded)", + p.target.ReplicaID, lba, lsn) return fmt.Errorf("replication: ShipEntry: peer %s degraded", p.target.ReplicaID) } peerLineage := p.lineage diff --git a/seaweed-block/core/replication/volume.go b/seaweed-block/core/replication/volume.go index 7658e808bf..424bff732e 100644 --- a/seaweed-block/core/replication/volume.go +++ b/seaweed-block/core/replication/volume.go @@ -336,6 +336,11 @@ func (v *ReplicationVolume) OnLocalWrite(ctx context.Context, w LocalWrite) erro if v.closed { return fmt.Errorf("replication: OnLocalWrite: volume %s closed", v.volumeID) } + // G5-5 instrumentation: log entry with peer count so we can + // disambiguate "OnLocalWrite never called" vs "called but + // peers map is empty" vs "called and fans out". + log.Printf("replication: OnLocalWrite volume=%s lba=%d lsn=%d peers=%d", + v.volumeID, w.LBA, w.LSN, len(v.peers)) // Fan out under the mutex — LSN-order invariant (Condition A). // Lineage is informational; each peer uses its own registered