From 7a3996d2b0589421b66a6ee6bf707c6656068e1f Mon Sep 17 00:00:00 2001 From: pingqiu Date: Mon, 27 Apr 2026 00:54:50 -0700 Subject: [PATCH] G5-5 ship/dial/barrier instrumentation (suspect B disambig) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QA round 7 confirmed peers=1 — master delivers peer set correctly, including routable address (r2@192.168.1.184:9221). The fsync I/O error is on the SHIP side. Sub-suspects: (a) lazy-dial never triggered (e.g., peer state == Degraded before first ship; ShipEntry returns early) (b) lazy-dial triggered but TCP dial failed (c) dial succeeded but frame write failed (handshake/framing) (d) ship ok, but barrier wait never gets ack (timeout silently) Add 6 INFO log lines at the suspect surfaces so the next re-run disambiguates which sub-case is firing: core/replication/peer.go (ShipEntry): - on ship FAILED: peer + addr + lba + lsn + err - on ship ok: peer + lba + lsn core/replication/peer.go (Barrier): - on barrier wait: peer + addr + targetLSN + epoch - on barrier FAILED: peer + addr + targetLSN + err - on barrier ack: peer + targetLSN + achievedLSN core/transport/ship_sender.go (Ship lazy-dial): - on lazy-dial entry: replica + addr + sessionID + lsn - on lazy-dial FAILED: replica + addr + err - on lazy-dial ok: replica + addr Replica-side already logs replica_apply on receive (existing). With both sides logged, QA's next run should clearly show the failing hop. No behavior change; small log footprint. Tests still green: core/replication, core/transport, cmd/blockvolume (incl. G5-4 integration test). Refs: QA round 7 disambiguation (peers=1 confirmed; ship-side instrumentation needed). --- seaweed-block/core/replication/peer.go | 10 ++++++++++ seaweed-block/core/transport/ship_sender.go | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/seaweed-block/core/replication/peer.go b/seaweed-block/core/replication/peer.go index 5d99ee3244..72fbd05b8c 100644 --- a/seaweed-block/core/replication/peer.go +++ b/seaweed-block/core/replication/peer.go @@ -197,9 +197,13 @@ func (p *ReplicaPeer) ShipEntry(ctx context.Context, lineage transport.RecoveryL p.mu.Unlock() if err := p.executor.Ship(p.target.ReplicaID, peerLineage, lba, lsn, data); err != nil { + log.Printf("replication: ship FAILED peer=%s addr=%s lba=%d lsn=%d: %v", + p.target.ReplicaID, p.target.DataAddr, lba, lsn, err) p.Invalidate(fmt.Sprintf("ship error: %v", err)) return err } + log.Printf("replication: ship ok peer=%s lba=%d lsn=%d", + p.target.ReplicaID, lba, lsn) return nil } @@ -245,11 +249,17 @@ func (p *ReplicaPeer) Barrier(ctx context.Context, targetLSN uint64) (transport. lineage := p.lineage p.mu.Unlock() + log.Printf("replication: barrier wait peer=%s addr=%s targetLSN=%d epoch=%d", + p.target.ReplicaID, p.target.DataAddr, targetLSN, lineage.Epoch) ack, err := p.executor.Barrier(p.target.ReplicaID, lineage, targetLSN) if err != nil { + log.Printf("replication: barrier FAILED peer=%s addr=%s targetLSN=%d: %v", + p.target.ReplicaID, p.target.DataAddr, targetLSN, err) p.Invalidate(fmt.Sprintf("barrier error: %v", err)) return transport.BarrierAck{}, err } + log.Printf("replication: barrier ack peer=%s targetLSN=%d achievedLSN=%d", + p.target.ReplicaID, targetLSN, ack.AchievedLSN) return ack, nil } diff --git a/seaweed-block/core/transport/ship_sender.go b/seaweed-block/core/transport/ship_sender.go index a573b316e6..34f77020de 100644 --- a/seaweed-block/core/transport/ship_sender.go +++ b/seaweed-block/core/transport/ship_sender.go @@ -80,11 +80,17 @@ func (e *BlockExecutor) Ship(replicaID string, lineage RecoveryLineage, lba uint // Lazy dial if the registered session has no conn attached yet. // Done outside e.mu so a slow dial doesn't wedge other sessions. if conn == nil { + log.Printf("transport: ship lazy-dial replica=%s addr=%s sessionID=%d lsn=%d", + replicaID, e.replicaAddr, lineage.SessionID, lsn) dialed, err := net.DialTimeout("tcp", e.replicaAddr, shipDialTimeout) if err != nil { + log.Printf("transport: ship lazy-dial FAILED replica=%s addr=%s: %v", + replicaID, e.replicaAddr, err) return fmt.Errorf("transport: ship: dial replica=%s sessionID=%d: %w", replicaID, lineage.SessionID, err) } + log.Printf("transport: ship lazy-dial ok replica=%s addr=%s", + replicaID, e.replicaAddr) // Re-acquire lock to attach. Handle three races: // 1. Session invalidated between release+reacquire → drop our conn. // 2. Another Ship already dialed and attached → use theirs, drop ours.