From c4a8aa322fc11957028709d89b9075bf772433df Mon Sep 17 00:00:00 2001 From: pingqiu Date: Sun, 22 Nov 2026 22:48:56 -0800 Subject: [PATCH] test: power-loss replay keeps master and volume logs in an optional dir Co-Authored-By: Claude Opus 5.5 --- .../blockvolume/iscsi_powerloss_replay_test.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/seaweed-block/cmd/blockvolume/iscsi_powerloss_replay_test.go b/seaweed-block/cmd/blockvolume/iscsi_powerloss_replay_test.go index b67620d274..f32aedc2e3 100644 --- a/seaweed-block/cmd/blockvolume/iscsi_powerloss_replay_test.go +++ b/seaweed-block/cmd/blockvolume/iscsi_powerloss_replay_test.go @@ -22,12 +22,14 @@ import ( // read back every block acknowledged by a sync. // // Environment, set by the external replay harness (root, dm_log_writes): -// SWBLOCK_REPLAY_ROOT mount point of the dm-log-writes filesystem -// SWBLOCK_REPLAY_CUT executable: "mark" marks the log, "replay" -// unmounts, replays to the mark and remounts -// SWBLOCK_REPLAY_BINS optional dir with prebuilt blockmaster/blockvolume -// SWBLOCK_REPLAY_DROP_SYNC "1" = negative control: no SYNCHRONIZE CACHE, so -// the acknowledged writes must be lost +// +// SWBLOCK_REPLAY_ROOT mount point of the dm-log-writes filesystem +// SWBLOCK_REPLAY_CUT executable: "mark" marks the log, "replay" +// unmounts, replays to the mark and remounts +// SWBLOCK_REPLAY_BINS optional dir with prebuilt blockmaster/blockvolume +// SWBLOCK_REPLAY_LOGS optional existing dir for master state and logs +// SWBLOCK_REPLAY_DROP_SYNC "1" = negative control: no SYNCHRONIZE CACHE, so +// the acknowledged writes must be lost func TestPowerLossReplayAckedWritesSurvive(t *testing.T) { root, cut := os.Getenv("SWBLOCK_REPLAY_ROOT"), os.Getenv("SWBLOCK_REPLAY_CUT") if root == "" || cut == "" { @@ -36,6 +38,9 @@ func TestPowerLossReplayAckedWritesSurvive(t *testing.T) { dropSync := os.Getenv("SWBLOCK_REPLAY_DROP_SYNC") == "1" bins := powerLossBins(t) art := t.TempDir() // master state and logs stay off the replayed device + if d := os.Getenv("SWBLOCK_REPLAY_LOGS"); d != "" { + art = d // kept for the receipts + } _, masterAddr := startSingleSlotMaster(t, bins, art) iqn := "iqn.2026-11.example.powerloss:v1"