Repository navigation
Description
Problem
GetWALTruncate, a read-only call used by the single-TN WAL replayer and truncate recovery, waits for a blackholed established connection to fail and returns an error even while the Log shard has a healthy three-voter quorum and the client knows working addresses. The TN driver retries after that error, so this adds an avoidable delay to replay/truncation recovery. In the controlled test the first call waited 8 or 16 seconds; this is not a claim that all deployments see the same latency.
Reproduction
TestAuditThreeVoterGetWALTruncateStallsOnBlackholedPeer starts a real three-voter Log shard with one TN ID:
- Connect a LogService client through a TCP proxy to the current leader and complete
GetWALTruncateonce. - Make the proxy keep forwarding requests but drop responses on this established connection. Configure that same managed client with the three real service addresses for reconnection.
- Start
GetWALTruncateon the affected client. While it waits, a separate client reads the same waterline through a direct, healthy address in under 2 seconds. - The affected call returns an I/O timeout after 8 or 16 seconds, rather than succeeding via another address. Its next call reconnects and succeeds.
Two ordinary three-voter runs waited 8.002 and 8.001 seconds. Two race runs waited 8.003 and 16.002 seconds. A single-service control reproduced the same behavior at 8.002 and 16.001 seconds. No real network packet loss or TN process was used; the proxy fixes the response-loss timing while all Raft voters remain alive.
Code path
pkg/logservice/client.go: managedClient.GetWALTruncate makes one c.client.getWALTruncate(ctx) attempt, resets the connection on error, and returns immediately. The backend read timeout is 8 seconds; depending on the connection's idle/read phase, the call can consume two such windows. Read and GetTruncatedLsn in the same client already use bounded per-address attempts and retry safe reads after timeouts. pkg/vm/engine/tae/logstore/driver/logservicedriver/truncate.go:getWALTruncateFromBackend retries this operation, but only after the stalled attempt returns. The replayer calls this method during replay startup (replayer.go) and when reconciling a missing WAL position.
Expected behavior
Treat this read-only waterline query like the other safe LogService reads: bound one established-address attempt, reset it, and try another known replica while the caller's context is live. Preserve the returned PSN/DSN pair and the caller's overall deadline.
Related work
#32148 tracked the old 60-second Read long tail and is closed after Read gained a bounded retry. This issue concerns the still-unbounded-by-read-attempt GetWALTruncate path on current main. It does not claim WAL loss or incorrect truncation.
Activity