G5-5 round 12: drop H-advance preflight in verify_byte_equal

Engine's Recovery.H is updated by probe events
(RecoveryFactsObserved), not by local writes. At adoption time
engine sets H = walHead = nextLSN (already 1 for empty walstore);
local write at LSN=1 advances nextLSN to 2 internally, but
Recovery.H stays at 1 until a probe re-reads boundaries. Using
H-advance as a 'silent write failure' preflight produces a false
positive — H stays at 1, check fails, but the actual write +
ship + barrier all completed (per primary log evidence).

Round 11+12 m01 evidence shows the full chain flows:
  durable: dp.Open latching identity volume=v1 replica=r1 epoch=1 ev=1
  durable: StorageBackend.SetIdentity latched ...
  iscsi: SCSI WRITE handler lba=0 transferLen=8 dataOut=4096
  durable: StorageBackend.Write entry offset=0 len=4096
  durable: write observer dispatch lba=0 lsn=1
  replication: OnLocalWrite volume=v1 lba=0 lsn=1 peers=1
  transport: ship lazy-dial replica=r2 ok
  replication: ship ok peer=r2 lba=0 lsn=1
  iscsi: SCSI WRITE backend.Write ok lba=0
  iscsi: SCSI SYNCHRONIZE_CACHE handler entry
  replication: barrier wait peer=r2 targetLSN=1 epoch=1
  replication: barrier ack peer=r2 targetLSN=1 achievedLSN=1
  iscsi: SCSI SYNCHRONIZE_CACHE backend.Sync ok

Replication is working end-to-end on m01+M02 hardware.

Fix: replace H-advance check with informational log; let
m01verify byte-equal compare be the actual proof. Same change
unchanged for verify_network_catchup and verify_restart_catchup
(they still use H comparisons but for different semantics —
catch-up convergence, where H is the engine-level boundary and
the comparison is against replica's R, which the engine DOES
update on session completion).

Refs: round 12 self-test on m01 cross-node — chain flows
end-to-end; H-advance was the only false-positive blocking
m01verify from running.
This commit is contained in:
pingqiu committed 2026-04-27 01:34:46 -07:00
1 parent 2e8c3a0469
commit 2c1ee6e3e5
1 file changed
+11 -4
@@ -390,11 +390,18 @@ sync
sudo iscsiadm -m node -T '"${ISCSI_IQN}"' -p 127.0.0.1:'"${M01_ISCSI_PORT}"' --logout >/dev/null
echo "WROTE-LBA-0-PATTERN-AB"
' || die "iscsi write failed"
# NOTE (round-12): H-advance preflight removed. Engine's
# Recovery.H is updated by probe events (RecoveryFactsObserved),
# not by local writes. At adoption time engine sets H=walHead
# (nextLSN, already=1 for empty walstore); after a local write
# at LSN=1 the next-allocated LSN becomes 2 but Recovery.H stays
# 1 until a probe re-reads boundaries. Using H-advance here is a
# false-positive trap. The actual proof of write+ship is the
# m01verify byte-equal compare below; failures upstream of that
# surface via the primary's log (set -euo pipefail in the dd
# block + non-zero exit on iscsi failure).
prim_h_after=$(poll_status_field "$SSH_M01" "${M01_PRIMARY_STATUS_PORT}" H)
[ -n "${prim_h_after}" ] || die "could not read primary.H after write"
[ "${prim_h_after}" -gt "${prim_h_before}" ] \
|| die "primary.H did not advance: before=${prim_h_before} after=${prim_h_after} (silent write failure masked?)"
log " primary.H advanced ${prim_h_before} → ${prim_h_after}"
log " primary.H pre/post: ${prim_h_before} → ${prim_h_after} (informational)"
sleep 1 # let replication fan-out complete
# Logout iscsi (release the device handle so we can stop replica cleanly later)
$SSH_M01 "sudo iscsiadm -m node -T ${ISCSI_IQN} -p 127.0.0.1:${M01_ISCSI_PORT} --logout >/dev/null" || true