From cd16a2a90b3cf1cdbfd273486747424232ed4b4d Mon Sep 17 00:00:00 2001 From: pingqiu Date: Mon, 16 Nov 2026 11:55:16 -0800 Subject: [PATCH] docs/spec: add TLA+ models of the volume lifecycle, takeover, WAL recovery, cut pipeline and GC timing docs/spec/ holds 12 TLA+ models of the block protocols with their TLC configurations (cfg/, 199 files: designs, RED configs that remove one guard and must produce a counterexample, and reachability witnesses), run.sh to check one configuration, and a README: how to run TLC, one row per spec (invariants, results, the code it maps to), limits, the findings that led to #152, #156, #158 and #159, and the open model-level items. Docs only; nothing runs in CI. Co-Authored-By: Claude Opus 5.5 --- seaweed-block/docs/spec/ChunkLifecycle.tla | 1399 +++++++++++++++++ .../docs/spec/ChunkLifecycleFixed.tla | 1159 ++++++++++++++ seaweed-block/docs/spec/ControlPlane.tla | 99 ++ seaweed-block/docs/spec/CutCapture.tla | 150 ++ seaweed-block/docs/spec/CutPipeline.tla | 89 ++ seaweed-block/docs/spec/README.md | 218 +++ .../docs/spec/ReplicationFailover.tla | 102 ++ seaweed-block/docs/spec/RetentionGCMulti.tla | 56 + seaweed-block/docs/spec/RetentionGCTiming.tla | 72 + seaweed-block/docs/spec/SmartWALRecovery.tla | 156 ++ seaweed-block/docs/spec/WALRecovery.tla | 256 +++ seaweed-block/docs/spec/WALReplica.tla | 127 ++ seaweed-block/docs/spec/WorkspaceTakeover.tla | 398 +++++ seaweed-block/docs/spec/cfg/Bug_P1_data.cfg | 16 + .../docs/spec/cfg/Bug_P1_giveback.cfg | 16 + seaweed-block/docs/spec/cfg/Bug_P1_mark.cfg | 16 + seaweed-block/docs/spec/cfg/Bug_P2_aba.cfg | 16 + .../docs/spec/cfg/Bug_P2_literal.cfg | 16 + seaweed-block/docs/spec/cfg/Bug_create.cfg | 16 + seaweed-block/docs/spec/cfg/Bug_other.cfg | 17 + .../docs/spec/cfg/Bug_other_dels.cfg | 17 + .../docs/spec/cfg/Bug_other_small.cfg | 17 + .../spec/cfg/Bug_reach_W_NeverDeleted.cfg | 16 + .../spec/cfg/Bug_reach_W_NoAckThenDelete.cfg | 16 + .../spec/cfg/Bug_reach_W_NoForkThenDelete.cfg | 16 + .../docs/spec/cfg/Bug_reach_W_NoGCReclaim.cfg | 16 + .../cfg/Bug_reach_W_NoRefusalThenDelete.cfg | 16 + seaweed-block/docs/spec/cfg/Bug_token.cfg | 16 + seaweed-block/docs/spec/cfg/Fix_P1.cfg | 17 + seaweed-block/docs/spec/cfg/Fix_P2_aba.cfg | 17 + seaweed-block/docs/spec/cfg/Fix_create.cfg | 17 + seaweed-block/docs/spec/cfg/Fix_mix.cfg | 17 + seaweed-block/docs/spec/cfg/Fix_mix_small.cfg | 17 + .../spec/cfg/Fix_reach_W_NeverDeleted.cfg | 16 + .../spec/cfg/Fix_reach_W_NoAckThenDelete.cfg | 16 + .../spec/cfg/Fix_reach_W_NoForkThenDelete.cfg | 16 + .../docs/spec/cfg/Fix_reach_W_NoGCReclaim.cfg | 16 + .../cfg/Fix_reach_W_NoHiddenNameBlock.cfg | 16 + .../cfg/Fix_reach_W_NoRefusalThenDelete.cfg | 16 + seaweed-block/docs/spec/cfg/Fix_token.cfg | 17 + .../docs/spec/cfg/RED_early_assign.cfg | 20 + seaweed-block/docs/spec/cfg/RED_epoch.cfg | 20 + .../docs/spec/cfg/RED_epoch_hostonly.cfg | 20 + .../docs/spec/cfg/RED_epoch_storeonly.cfg | 20 + .../docs/spec/cfg/RED_gc_ageonly.cfg | 20 + seaweed-block/docs/spec/cfg/RED_lsn.cfg | 21 + .../docs/spec/cfg/RED_lsn_storeonly.cfg | 21 + seaweed-block/docs/spec/cfg/S3_rep_c1_I2.cfg | 12 + .../docs/spec/cfg/S3_rep_c1_g1_I2.cfg | 12 + .../docs/spec/cfg/S3_rep_c1_g1_I3.cfg | 12 + .../docs/spec/cfg/S3_rep_c1_g1_I3_inrec.cfg | 12 + .../docs/spec/cfg/S3_rep_c1_g1jump_I2.cfg | 12 + .../docs/spec/cfg/S3_rep_c1_g2_I2.cfg | 12 + .../docs/spec/cfg/S3_rep_c1_g2jump_I2.cfg | 12 + seaweed-block/docs/spec/cfg/S3_rep_c2_I2.cfg | 12 + .../docs/spec/cfg/S3_rep_nogate_I3.cfg | 12 + seaweed-block/docs/spec/cfg/S3_rep_reach.cfg | 12 + .../docs/spec/cfg/S3_sw2_current_I2.cfg | 15 + .../spec/cfg/S3_sw2_current_marker_I2.cfg | 15 + .../docs/spec/cfg/S3_sw2_ordered_I2.cfg | 15 + .../spec/cfg/S3_sw2_ordered_marker_I2.cfg | 15 + .../cfg/S3_sw2_ordered_marker_repair_I1.cfg | 15 + ...3_sw2_ordered_marker_repair_I1Frontier.cfg | 15 + .../S3_sw2_ordered_marker_repair_I1slot.cfg | 15 + .../cfg/S3_sw2_ordered_marker_repair_I2.cfg | 15 + .../spec/cfg/S3_sw2_ordered_repair_I2.cfg | 15 + .../docs/spec/cfg/S3_sw2_pr155_I2.cfg | 15 + .../docs/spec/cfg/S3_sw2_pr155_marker_I2.cfg | 15 + .../docs/spec/cfg/S3_sw2_pr155o_I2.cfg | 15 + seaweed-block/docs/spec/cfg/S3_sw2_reach.cfg | 15 + .../docs/spec/cfg/S3_sw2_watermark_I2.cfg | 15 + .../spec/cfg/S3_sw2_watermark_marker_I2.cfg | 15 + .../cfg/S3_sw2_watermark_marker_repair_I1.cfg | 15 + ...sw2_watermark_marker_repair_I1Frontier.cfg | 15 + .../S3_sw2_watermark_marker_repair_I1slot.cfg | 15 + .../cfg/S3_sw2_watermark_marker_repair_I2.cfg | 15 + .../spec/cfg/S3_sw2_watermark_repair_I2.cfg | 15 + .../docs/spec/cfg/S3_sw_current_I1.cfg | 15 + .../spec/cfg/S3_sw_current_I1frontier.cfg | 15 + .../docs/spec/cfg/S3_sw_current_I2.cfg | 15 + .../docs/spec/cfg/S3_sw_holeFail_I1.cfg | 15 + .../spec/cfg/S3_sw_holeFail_I1frontier.cfg | 15 + .../docs/spec/cfg/S3_sw_holeFail_I2.cfg | 15 + .../docs/spec/cfg/S3_sw_ordered_I1.cfg | 15 + .../spec/cfg/S3_sw_ordered_I1frontier.cfg | 15 + .../docs/spec/cfg/S3_sw_ordered_I2.cfg | 15 + seaweed-block/docs/spec/cfg/S3_sw_reach.cfg | 15 + .../docs/spec/cfg/S3_sw_watermark_I1.cfg | 15 + .../spec/cfg/S3_sw_watermark_I1frontier.cfg | 15 + .../docs/spec/cfg/S3_sw_watermark_I2.cfg | 15 + .../docs/spec/cfg/S3_wal_current_I1.cfg | 15 + .../spec/cfg/S3_wal_current_I1_crashonly.cfg | 15 + .../docs/spec/cfg/S3_wal_current_I2.cfg | 15 + .../docs/spec/cfg/S3_wal_current_prefix.cfg | 15 + .../docs/spec/cfg/S3_wal_current_replay.cfg | 15 + .../docs/spec/cfg/S3_wal_holeFail_I1.cfg | 15 + .../docs/spec/cfg/S3_wal_holeFail_I2.cfg | 15 + .../docs/spec/cfg/S3_wal_holeFail_prefix.cfg | 15 + .../docs/spec/cfg/S3_wal_pr155_I1.cfg | 15 + .../spec/cfg/S3_wal_pr155_I1_crashonly.cfg | 15 + .../docs/spec/cfg/S3_wal_pr155_I2.cfg | 15 + .../docs/spec/cfg/S3_wal_pr155_replay.cfg | 15 + .../docs/spec/cfg/S3_wal_reach_failclosed.cfg | 15 + .../docs/spec/cfg/S3_wal_reach_wrap.cfg | 15 + .../cfg/S3_wal_watermarkFull_I0Prefix.cfg | 15 + .../docs/spec/cfg/S3_wal_watermarkFull_I1.cfg | 15 + .../cfg/S3_wal_watermarkFull_I1_crashonly.cfg | 15 + .../docs/spec/cfg/S3_wal_watermarkFull_I2.cfg | 15 + .../S3_wal_watermarkFull_ReplayLastWriter.cfg | 15 + .../docs/spec/cfg/S3_wal_watermarkSB_I1.cfg | 15 + .../spec/cfg/S3_wal_watermarkSB_I1_big.cfg | 15 + .../cfg/S3_wal_watermarkSB_I1_crashonly.cfg | 15 + .../docs/spec/cfg/S3_wal_watermarkSB_I2.cfg | 15 + .../spec/cfg/S3_wal_watermarkSB_I2_big.cfg | 15 + .../spec/cfg/S3_wal_watermarkSB_prefix.cfg | 15 + .../spec/cfg/S3_wal_watermarkSB_replay.cfg | 15 + .../docs/spec/cfg/S3_wal_watermark_I1.cfg | 15 + .../docs/spec/cfg/S3_wal_watermark_I2.cfg | 15 + .../docs/spec/cfg/S3_wal_watermark_prefix.cfg | 15 + .../docs/spec/cfg/S3f_lwwFull_forged.cfg | 15 + .../docs/spec/cfg/S3f_prefixFullSB_forged.cfg | 15 + .../docs/spec/cfg/S3f_rootLww_forged.cfg | 15 + .../spec/cfg/S3f_watermarkFull_forged.cfg | 15 + .../spec/cfg/S3m_prefixFullSB_I1_cFALSE.cfg | 15 + .../spec/cfg/S3m_prefixFullSB_I1_cTRUE.cfg | 15 + .../spec/cfg/S3m_prefixFullSB_I2_cFALSE.cfg | 15 + ...m_prefixFullSB_ReplayLastWriter_cFALSE.cfg | 15 + .../spec/cfg/S3m_watermarkFull_I1_cFALSE.cfg | 15 + .../spec/cfg/S3m_watermarkFull_I1_cTRUE.cfg | 15 + .../spec/cfg/S3m_watermarkFull_I2_cFALSE.cfg | 15 + ..._watermarkFull_ReplayLastWriter_cFALSE.cfg | 15 + .../cfg/S3r_rebuild_lwwFull_I1_crashonly.cfg | 15 + .../S3r_rebuild_prefixFull_I1_crashonly.cfg | 15 + .../cfg/S3r_rebuild_rootLww_I1_crashonly.cfg | 15 + .../docs/spec/cfg/S3r_rebuild_rootLww_I2.cfg | 15 + .../spec/cfg/S3r_rootLww_I1_crashonly.cfg | 15 + .../docs/spec/cfg/S3r_rootLww_I2.cfg | 15 + .../docs/spec/cfg/S3r_rootLww_replay.cfg | 15 + .../cfg/S3v1_root_current_I1_crashonly.cfg | 15 + .../docs/spec/cfg/S3v1_root_lww_I1.cfg | 15 + .../spec/cfg/S3v1_root_lww_I1_crashonly.cfg | 15 + .../docs/spec/cfg/S3v1_root_lww_replay.cfg | 15 + ...S3v2_code_prefixFull_jump_I1_crashonly.cfg | 15 + .../spec/cfg/S3v2_lww_jump_I1_crashonly.cfg | 15 + ..._prefixFull_jumpNoPersist_I1_crashonly.cfg | 15 + .../cfg/S3v2_prefixFull_jump_I1_crashonly.cfg | 15 + .../docs/spec/cfg/S3v2_reach_jump.cfg | 15 + .../cfg/S3v3_all_I0Prefix_corruptTRUE.cfg | 15 + .../spec/cfg/S3v3_all_I1_corruptFALSE.cfg | 15 + .../docs/spec/cfg/S3v3_all_I1_corruptTRUE.cfg | 15 + .../spec/cfg/S3v3_all_I2_corruptFALSE.cfg | 15 + ...S3v3_all_ReplayLastWriter_corruptFALSE.cfg | 15 + .../cfg/S3v_code_current_I1_crashonly.cfg | 15 + .../spec/cfg/S3v_code_lww_I1_crashonly.cfg | 15 + .../cfg/S3v_code_prefixFull_I1_crashonly.cfg | 15 + .../docs/spec/cfg/S4_reach_rf1_lsnmap.cfg | 13 + .../docs/spec/cfg/S4_reach_rf2_lsnmap.cfg | 13 + seaweed-block/docs/spec/cfg/S4_rf1_bitmap.cfg | 13 + .../docs/spec/cfg/S4_rf1_bitmapHash.cfg | 13 + .../spec/cfg/S4_rf1_bitmap_clearEarly.cfg | 13 + .../docs/spec/cfg/S4_rf1_bitmap_noPersist.cfg | 13 + seaweed-block/docs/spec/cfg/S4_rf1_lsnmap.cfg | 13 + .../docs/spec/cfg/S4_rf1_lsnmap_noPersist.cfg | 13 + seaweed-block/docs/spec/cfg/S4_rf2_bitmap.cfg | 13 + .../docs/spec/cfg/S4_rf2_bitmapHash.cfg | 13 + seaweed-block/docs/spec/cfg/S4_rf2_lsnmap.cfg | 13 + .../docs/spec/cfg/S4_rf2_lsnmap_base.cfg | 13 + .../docs/spec/cfg/S4_rf2_lsnmap_localCut.cfg | 13 + seaweed-block/docs/spec/cfg/S4b_design.cfg | 10 + .../docs/spec/cfg/S4b_design_big.cfg | 10 + seaweed-block/docs/spec/cfg/S4b_reach.cfg | 10 + .../docs/spec/cfg/S4b_red_cutWhileRec.cfg | 10 + seaweed-block/docs/spec/cfg/S4b_red_noGen.cfg | 10 + .../docs/spec/cfg/S4b_red_segReuse.cfg | 10 + seaweed-block/docs/spec/cfg/S5_code.cfg | 9 + seaweed-block/docs/spec/cfg/S5_reach.cfg | 9 + .../docs/spec/cfg/S5_red_noReserve.cfg | 9 + .../docs/spec/cfg/S5_red_noUncertain.cfg | 9 + seaweed-block/docs/spec/cfg/S6_design.cfg | 8 + seaweed-block/docs/spec/cfg/S6_design_big.cfg | 8 + .../docs/spec/cfg/S6_reach_handoff.cfg | 8 + .../docs/spec/cfg/S6_red_localCut.cfg | 8 + .../docs/spec/cfg/S6_red_noEvidence.cfg | 8 + .../docs/spec/cfg/S6_red_noFence.cfg | 8 + seaweed-block/docs/spec/cfg/S9_guard_G3.cfg | 9 + .../docs/spec/cfg/S9_reach_delete.cfg | 9 + .../docs/spec/cfg/S9_reach_publish.cfg | 9 + seaweed-block/docs/spec/cfg/S9_red_G1_D3.cfg | 9 + .../docs/spec/cfg/S9_red_G1_noguard.cfg | 9 + .../docs/spec/cfg/S9_red_G2_noguard.cfg | 9 + .../docs/spec/cfg/S9_red_G3_noguard.cfg | 9 + .../docs/spec/cfg/S9_red_G3_noguard_big.cfg | 9 + seaweed-block/docs/spec/cfg/S9_rule_G4.cfg | 9 + .../docs/spec/cfg/S9_rule_G4_big.cfg | 9 + .../docs/spec/cfg/S9_rule_G4_noguard.cfg | 9 + seaweed-block/docs/spec/cfg/S9b_G1_MD2.cfg | 7 + seaweed-block/docs/spec/cfg/S9b_G2_MD2.cfg | 7 + seaweed-block/docs/spec/cfg/S9b_G2_MD3.cfg | 7 + seaweed-block/docs/spec/cfg/S9b_G3_MD1.cfg | 7 + seaweed-block/docs/spec/cfg/S9b_reach.cfg | 7 + seaweed-block/docs/spec/cfg/W4_both.cfg | 21 + seaweed-block/docs/spec/cfg/W4_clean.cfg | 21 + .../docs/spec/cfg/W4_clean_large.cfg | 21 + seaweed-block/docs/spec/cfg/W4_drift.cfg | 20 + .../docs/spec/cfg/W4_drift_heads.cfg | 21 + seaweed-block/docs/spec/cfg/W4_forced.cfg | 21 + .../docs/spec/cfg/W4_forced_exact.cfg | 20 + .../docs/spec/cfg/W4_forced_large.cfg | 21 + seaweed-block/docs/spec/cfg/W4_reach_bcut.cfg | 20 + .../docs/spec/cfg/W4_reach_clean.cfg | 20 + .../docs/spec/cfg/W4_reach_forced.cfg | 20 + .../docs/spec/cfg/W4_reach_restart.cfg | 20 + seaweed-block/docs/spec/run.sh | 39 + 213 files changed, 7186 insertions(+) create mode 100644 seaweed-block/docs/spec/ChunkLifecycle.tla create mode 100644 seaweed-block/docs/spec/ChunkLifecycleFixed.tla create mode 100644 seaweed-block/docs/spec/ControlPlane.tla create mode 100644 seaweed-block/docs/spec/CutCapture.tla create mode 100644 seaweed-block/docs/spec/CutPipeline.tla create mode 100644 seaweed-block/docs/spec/README.md create mode 100644 seaweed-block/docs/spec/ReplicationFailover.tla create mode 100644 seaweed-block/docs/spec/RetentionGCMulti.tla create mode 100644 seaweed-block/docs/spec/RetentionGCTiming.tla create mode 100644 seaweed-block/docs/spec/SmartWALRecovery.tla create mode 100644 seaweed-block/docs/spec/WALRecovery.tla create mode 100644 seaweed-block/docs/spec/WALReplica.tla create mode 100644 seaweed-block/docs/spec/WorkspaceTakeover.tla create mode 100644 seaweed-block/docs/spec/cfg/Bug_P1_data.cfg create mode 100644 seaweed-block/docs/spec/cfg/Bug_P1_giveback.cfg create mode 100644 seaweed-block/docs/spec/cfg/Bug_P1_mark.cfg create mode 100644 seaweed-block/docs/spec/cfg/Bug_P2_aba.cfg create mode 100644 seaweed-block/docs/spec/cfg/Bug_P2_literal.cfg create mode 100644 seaweed-block/docs/spec/cfg/Bug_create.cfg create mode 100644 seaweed-block/docs/spec/cfg/Bug_other.cfg create mode 100644 seaweed-block/docs/spec/cfg/Bug_other_dels.cfg create mode 100644 seaweed-block/docs/spec/cfg/Bug_other_small.cfg create mode 100644 seaweed-block/docs/spec/cfg/Bug_reach_W_NeverDeleted.cfg create mode 100644 seaweed-block/docs/spec/cfg/Bug_reach_W_NoAckThenDelete.cfg create mode 100644 seaweed-block/docs/spec/cfg/Bug_reach_W_NoForkThenDelete.cfg create mode 100644 seaweed-block/docs/spec/cfg/Bug_reach_W_NoGCReclaim.cfg create mode 100644 seaweed-block/docs/spec/cfg/Bug_reach_W_NoRefusalThenDelete.cfg create mode 100644 seaweed-block/docs/spec/cfg/Bug_token.cfg create mode 100644 seaweed-block/docs/spec/cfg/Fix_P1.cfg create mode 100644 seaweed-block/docs/spec/cfg/Fix_P2_aba.cfg create mode 100644 seaweed-block/docs/spec/cfg/Fix_create.cfg create mode 100644 seaweed-block/docs/spec/cfg/Fix_mix.cfg create mode 100644 seaweed-block/docs/spec/cfg/Fix_mix_small.cfg create mode 100644 seaweed-block/docs/spec/cfg/Fix_reach_W_NeverDeleted.cfg create mode 100644 seaweed-block/docs/spec/cfg/Fix_reach_W_NoAckThenDelete.cfg create mode 100644 seaweed-block/docs/spec/cfg/Fix_reach_W_NoForkThenDelete.cfg create mode 100644 seaweed-block/docs/spec/cfg/Fix_reach_W_NoGCReclaim.cfg create mode 100644 seaweed-block/docs/spec/cfg/Fix_reach_W_NoHiddenNameBlock.cfg create mode 100644 seaweed-block/docs/spec/cfg/Fix_reach_W_NoRefusalThenDelete.cfg create mode 100644 seaweed-block/docs/spec/cfg/Fix_token.cfg create mode 100644 seaweed-block/docs/spec/cfg/RED_early_assign.cfg create mode 100644 seaweed-block/docs/spec/cfg/RED_epoch.cfg create mode 100644 seaweed-block/docs/spec/cfg/RED_epoch_hostonly.cfg create mode 100644 seaweed-block/docs/spec/cfg/RED_epoch_storeonly.cfg create mode 100644 seaweed-block/docs/spec/cfg/RED_gc_ageonly.cfg create mode 100644 seaweed-block/docs/spec/cfg/RED_lsn.cfg create mode 100644 seaweed-block/docs/spec/cfg/RED_lsn_storeonly.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_rep_c1_I2.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_rep_c1_g1_I2.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_rep_c1_g1_I3.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_rep_c1_g1_I3_inrec.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_rep_c1_g1jump_I2.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_rep_c1_g2_I2.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_rep_c1_g2jump_I2.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_rep_c2_I2.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_rep_nogate_I3.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_rep_reach.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_sw2_current_I2.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_sw2_current_marker_I2.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_sw2_ordered_I2.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_sw2_ordered_marker_I2.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_sw2_ordered_marker_repair_I1.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_sw2_ordered_marker_repair_I1Frontier.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_sw2_ordered_marker_repair_I1slot.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_sw2_ordered_marker_repair_I2.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_sw2_ordered_repair_I2.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_sw2_pr155_I2.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_sw2_pr155_marker_I2.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_sw2_pr155o_I2.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_sw2_reach.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_sw2_watermark_I2.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_sw2_watermark_marker_I2.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_sw2_watermark_marker_repair_I1.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_sw2_watermark_marker_repair_I1Frontier.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_sw2_watermark_marker_repair_I1slot.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_sw2_watermark_marker_repair_I2.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_sw2_watermark_repair_I2.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_sw_current_I1.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_sw_current_I1frontier.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_sw_current_I2.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_sw_holeFail_I1.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_sw_holeFail_I1frontier.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_sw_holeFail_I2.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_sw_ordered_I1.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_sw_ordered_I1frontier.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_sw_ordered_I2.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_sw_reach.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_sw_watermark_I1.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_sw_watermark_I1frontier.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_sw_watermark_I2.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_wal_current_I1.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_wal_current_I1_crashonly.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_wal_current_I2.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_wal_current_prefix.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_wal_current_replay.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_wal_holeFail_I1.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_wal_holeFail_I2.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_wal_holeFail_prefix.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_wal_pr155_I1.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_wal_pr155_I1_crashonly.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_wal_pr155_I2.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_wal_pr155_replay.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_wal_reach_failclosed.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_wal_reach_wrap.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_wal_watermarkFull_I0Prefix.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_wal_watermarkFull_I1.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_wal_watermarkFull_I1_crashonly.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_wal_watermarkFull_I2.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_wal_watermarkFull_ReplayLastWriter.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_wal_watermarkSB_I1.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_wal_watermarkSB_I1_big.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_wal_watermarkSB_I1_crashonly.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_wal_watermarkSB_I2.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_wal_watermarkSB_I2_big.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_wal_watermarkSB_prefix.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_wal_watermarkSB_replay.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_wal_watermark_I1.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_wal_watermark_I2.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3_wal_watermark_prefix.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3f_lwwFull_forged.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3f_prefixFullSB_forged.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3f_rootLww_forged.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3f_watermarkFull_forged.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3m_prefixFullSB_I1_cFALSE.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3m_prefixFullSB_I1_cTRUE.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3m_prefixFullSB_I2_cFALSE.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3m_prefixFullSB_ReplayLastWriter_cFALSE.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3m_watermarkFull_I1_cFALSE.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3m_watermarkFull_I1_cTRUE.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3m_watermarkFull_I2_cFALSE.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3m_watermarkFull_ReplayLastWriter_cFALSE.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3r_rebuild_lwwFull_I1_crashonly.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3r_rebuild_prefixFull_I1_crashonly.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3r_rebuild_rootLww_I1_crashonly.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3r_rebuild_rootLww_I2.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3r_rootLww_I1_crashonly.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3r_rootLww_I2.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3r_rootLww_replay.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3v1_root_current_I1_crashonly.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3v1_root_lww_I1.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3v1_root_lww_I1_crashonly.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3v1_root_lww_replay.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3v2_code_prefixFull_jump_I1_crashonly.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3v2_lww_jump_I1_crashonly.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3v2_prefixFull_jumpNoPersist_I1_crashonly.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3v2_prefixFull_jump_I1_crashonly.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3v2_reach_jump.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3v3_all_I0Prefix_corruptTRUE.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3v3_all_I1_corruptFALSE.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3v3_all_I1_corruptTRUE.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3v3_all_I2_corruptFALSE.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3v3_all_ReplayLastWriter_corruptFALSE.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3v_code_current_I1_crashonly.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3v_code_lww_I1_crashonly.cfg create mode 100644 seaweed-block/docs/spec/cfg/S3v_code_prefixFull_I1_crashonly.cfg create mode 100644 seaweed-block/docs/spec/cfg/S4_reach_rf1_lsnmap.cfg create mode 100644 seaweed-block/docs/spec/cfg/S4_reach_rf2_lsnmap.cfg create mode 100644 seaweed-block/docs/spec/cfg/S4_rf1_bitmap.cfg create mode 100644 seaweed-block/docs/spec/cfg/S4_rf1_bitmapHash.cfg create mode 100644 seaweed-block/docs/spec/cfg/S4_rf1_bitmap_clearEarly.cfg create mode 100644 seaweed-block/docs/spec/cfg/S4_rf1_bitmap_noPersist.cfg create mode 100644 seaweed-block/docs/spec/cfg/S4_rf1_lsnmap.cfg create mode 100644 seaweed-block/docs/spec/cfg/S4_rf1_lsnmap_noPersist.cfg create mode 100644 seaweed-block/docs/spec/cfg/S4_rf2_bitmap.cfg create mode 100644 seaweed-block/docs/spec/cfg/S4_rf2_bitmapHash.cfg create mode 100644 seaweed-block/docs/spec/cfg/S4_rf2_lsnmap.cfg create mode 100644 seaweed-block/docs/spec/cfg/S4_rf2_lsnmap_base.cfg create mode 100644 seaweed-block/docs/spec/cfg/S4_rf2_lsnmap_localCut.cfg create mode 100644 seaweed-block/docs/spec/cfg/S4b_design.cfg create mode 100644 seaweed-block/docs/spec/cfg/S4b_design_big.cfg create mode 100644 seaweed-block/docs/spec/cfg/S4b_reach.cfg create mode 100644 seaweed-block/docs/spec/cfg/S4b_red_cutWhileRec.cfg create mode 100644 seaweed-block/docs/spec/cfg/S4b_red_noGen.cfg create mode 100644 seaweed-block/docs/spec/cfg/S4b_red_segReuse.cfg create mode 100644 seaweed-block/docs/spec/cfg/S5_code.cfg create mode 100644 seaweed-block/docs/spec/cfg/S5_reach.cfg create mode 100644 seaweed-block/docs/spec/cfg/S5_red_noReserve.cfg create mode 100644 seaweed-block/docs/spec/cfg/S5_red_noUncertain.cfg create mode 100644 seaweed-block/docs/spec/cfg/S6_design.cfg create mode 100644 seaweed-block/docs/spec/cfg/S6_design_big.cfg create mode 100644 seaweed-block/docs/spec/cfg/S6_reach_handoff.cfg create mode 100644 seaweed-block/docs/spec/cfg/S6_red_localCut.cfg create mode 100644 seaweed-block/docs/spec/cfg/S6_red_noEvidence.cfg create mode 100644 seaweed-block/docs/spec/cfg/S6_red_noFence.cfg create mode 100644 seaweed-block/docs/spec/cfg/S9_guard_G3.cfg create mode 100644 seaweed-block/docs/spec/cfg/S9_reach_delete.cfg create mode 100644 seaweed-block/docs/spec/cfg/S9_reach_publish.cfg create mode 100644 seaweed-block/docs/spec/cfg/S9_red_G1_D3.cfg create mode 100644 seaweed-block/docs/spec/cfg/S9_red_G1_noguard.cfg create mode 100644 seaweed-block/docs/spec/cfg/S9_red_G2_noguard.cfg create mode 100644 seaweed-block/docs/spec/cfg/S9_red_G3_noguard.cfg create mode 100644 seaweed-block/docs/spec/cfg/S9_red_G3_noguard_big.cfg create mode 100644 seaweed-block/docs/spec/cfg/S9_rule_G4.cfg create mode 100644 seaweed-block/docs/spec/cfg/S9_rule_G4_big.cfg create mode 100644 seaweed-block/docs/spec/cfg/S9_rule_G4_noguard.cfg create mode 100644 seaweed-block/docs/spec/cfg/S9b_G1_MD2.cfg create mode 100644 seaweed-block/docs/spec/cfg/S9b_G2_MD2.cfg create mode 100644 seaweed-block/docs/spec/cfg/S9b_G2_MD3.cfg create mode 100644 seaweed-block/docs/spec/cfg/S9b_G3_MD1.cfg create mode 100644 seaweed-block/docs/spec/cfg/S9b_reach.cfg create mode 100644 seaweed-block/docs/spec/cfg/W4_both.cfg create mode 100644 seaweed-block/docs/spec/cfg/W4_clean.cfg create mode 100644 seaweed-block/docs/spec/cfg/W4_clean_large.cfg create mode 100644 seaweed-block/docs/spec/cfg/W4_drift.cfg create mode 100644 seaweed-block/docs/spec/cfg/W4_drift_heads.cfg create mode 100644 seaweed-block/docs/spec/cfg/W4_forced.cfg create mode 100644 seaweed-block/docs/spec/cfg/W4_forced_exact.cfg create mode 100644 seaweed-block/docs/spec/cfg/W4_forced_large.cfg create mode 100644 seaweed-block/docs/spec/cfg/W4_reach_bcut.cfg create mode 100644 seaweed-block/docs/spec/cfg/W4_reach_clean.cfg create mode 100644 seaweed-block/docs/spec/cfg/W4_reach_forced.cfg create mode 100644 seaweed-block/docs/spec/cfg/W4_reach_restart.cfg create mode 100755 seaweed-block/docs/spec/run.sh diff --git a/seaweed-block/docs/spec/ChunkLifecycle.tla b/seaweed-block/docs/spec/ChunkLifecycle.tla new file mode 100644 index 0000000000..c041180259 --- /dev/null +++ b/seaweed-block/docs/spec/ChunkLifecycle.tla @@ -0,0 +1,1399 @@ +--------------------------- MODULE ChunkLifecycle --------------------------- +(***************************************************************************) +(* sw-block chunk-layer lifecycle: HEAD, intents, snapshots (name record + *) +(* attempt path), fork claims, tombstones, GC and volume delete, as PR *) +(* #152 had it at dfbf7273 (volume delete WITH the snapshot cascade, and *) +(* a commit point NOT bound to the deletion incarnation). *) +(* *) +(* One atomic step = one remote call (one filer RPC), unless a comment *) +(* says the step merges a read with the conditional write it guards. *) +(* HISTORICAL: this is the pre-fix design; it is kept because it produces *) +(* the counterexamples. ChunkLifecycleFixed.tla is the current model. *) +(* path:line references in comments are at dfbf7273 (see README.md). *) +(***************************************************************************) +EXTENDS Integers, FiniteSets, Sequences, TLC + +CONSTANTS + SnapCallers, \* same-request snapshot callers of name "N" (model values); each is also its attempt id + Deleters, \* volume-delete callers of "P" (model values) + ForkOn, \* one fork caller: F <- P/M + DelSnapOn, \* explicit DeleteSnapshot callers, one per name + CreateOn, \* one blockmaster CreateVolume("P") caller + MaxHostOps, \* budget of host write / detach / attach steps + MaxRuns, \* runs per delete caller (an operator rerun after outcome_unknown) + LostReply, \* an Admit may land with its reply lost + PendingOn, \* a snapshot publish may time out and land later (CreateEntry cannot be cancelled) + SweepOn \* GC copy sweep: AbortSnapshot / AbortFork tombstones + +NoAtt == "-" +Vols == {"P", "F"} +Names == {"M", "N"} +MP == <<"M", "m0">> \* the pre-existing snapshot P/M (fork parent) +AttPaths == {MP} \cup {<<"N", s>> : s \in SnapCallers} +Chunks == {"c1", "c2", "c3"} +ChunkOf(i) == IF i = 2 THEN "c2" ELSE "c3" +ForkIds == IF ForkOn THEN {"fork"} ELSE {} +DelSnapIds == IF DelSnapOn THEN {"xM", "xN"} ELSE {} \* one explicit DeleteSnapshot caller per name +CreateIds == IF CreateOn THEN {"create"} ELSE {} +ReaderIds == SnapCallers \cup ForkIds +DnCallers == SnapCallers \cup Deleters +GaveBack == {"refused_claimed", "refused_snapshots", "in_use", "givenback_by_other"} +EmptySnap == [st |-> "none", ch |-> {}, claims |-> {}, exp |-> FALSE] + +(* --algorithm ChunkLifecycle +variables + \* HEAD per volume. P starts attached (held) with chunk c1; F does not exist. + head = [v \in Vols |-> IF v = "P" THEN [st |-> "held", gen |-> 1, ch |-> {"c1"}] + ELSE [st |-> "none", gen |-> 0, ch |-> {}]], + volume = [v \in Vols |-> IF v = "P" THEN "live" ELSE "none"], \* VOLUME entry + volCreates = [v \in Vols |-> IF v = "P" THEN 1 ELSE 0], + names = [n \in Names |-> IF n = "M" THEN "m0" ELSE NoAtt], \* snapnames/ -> attempt + snaps = [p \in AttPaths |-> IF p = MP + THEN [st |-> "active", ch |-> {"c1"}, claims |-> {}, exp |-> FALSE] + ELSE EmptySnap], \* snaps// + intents = {}, + pending = {}, \* uncancellable snapshot creates still in flight + stored = {"c1"}, \* chunks physically present + nextChunk = 2, + hostOps = 0, + resv = [st |-> "none", toks |-> {}], \* blockmaster deletion reservation of P + reads = [r \in ReaderIds |-> {}], \* grace abstraction: keys an in-flight op has read + dnErr = [p \in DnCallers |-> FALSE], + \* ---- history / outcome variables (never read by the protocol) ---- + markedBy = [p \in AttPaths |-> "none"], + badMark = FALSE, \* a published snapshot marked deleting while P's delete was not committed + badCommit = FALSE, \* commit to purging while a fork past its gate holds a live claim + badCommitAny = FALSE, \* commit to purging while any live claim exists (literal form) + acked = {}, \* snapshot paths some caller was told succeeded + idReuse = FALSE, \* blockmaster created a reserved id + sres = [s \in SnapCallers |-> "none"], + fres = "none", + dres = [d \in Deleters |-> "none"], + dtoks = [d \in Deleters |-> {}]; + +define + Gone == volume["P"] = "deleted" \/ head["P"].st \in {"deleting", "purging", "deleted"} + Named(p) == names[p[1]] = p[2] + \* retention.go liveClaims: a claim is live while its fork target has no HEAD + LiveClaim(p) == \E c \in snaps[p].claims : head["F"].st = "none" + Committed == head["P"].st \in {"purging", "deleted"} + SnapRoot(p) == snaps[p].st = "active" \/ (snaps[p].st = "deleting" /\ (Named(p) \/ ~snaps[p].exp)) + AllRoots == UNION {head[v].ch : v \in Vols} + \cup UNION {snaps[p].ch : p \in {q \in AttPaths : SnapRoot(q)}} + \cup UNION {i.keys : i \in intents} + \cup UNION {reads[r] : r \in ReaderIds} + \* a fork that has passed its volumeGone gate (catalog.go:1209) and still needs its claim + PastForkGate == {"f_vol", "f_intent", "f_head", "f_dropintent"} + CommitUnsafe == \E f \in ForkIds : pc[f] \in PastForkGate /\ LiveClaim(MP) + CommitAnyClaim == \E p \in AttPaths : LiveClaim(p) +end define; + +\* catalog.go deleteNameForVolume (volume_delete.go:454-492): settle one name for a volume delete. +procedure DeleteName(dn, why) +variables datt = NoAtt, dtries = 0; +begin +dn_resolve: \* resolveSnap + if names[dn] = NoAtt then + return; + else + datt := names[dn]; + if snaps[<>].st = "none" then goto dn_tomb; else goto dn_mark; end if; + end if; +dn_tomb: \* CreateEntry(aborted tombstone), exclusive + if snaps[<>].st = "none" then + snaps[<>] := [EmptySnap EXCEPT !.st = "aborted"]; + end if; + goto dn_resolve; +dn_mark: \* markDeleting (retention.go:448-503) + if snaps[<>].st # "active" then + goto dn_free; \* markSettled + elsif LiveClaim(<>) then \* markClaimed: retry, then claimedErr + if dtries < 2 then dtries := dtries + 1; goto dn_resolve; + else dnErr[self] := TRUE; return; end if; + elsif snaps[<>].claims # {} then + snaps[<>].claims := {}; \* every claim dead: clear, decide again + goto dn_mark; + else + snaps[<>].st := "deleting"; + markedBy[<>] := why; + badMark := badMark \/ ~Committed; + end if; +dn_free: \* freeName: DeleteEntry(snapnames/) iff it names datt + if names[dn] = datt then names[dn] := NoAtt; end if; + return; +end procedure; + +\* ---------------- volume server of P (chunk_layer.go capture/detach, master attach) ---------------- +process Host = "host" +begin +h_loop: + while hostOps < MaxHostOps do + either \* write + capture: upload under an intent, then CASHead {gen} + await head["P"].st = "held" /\ nextChunk <= 3; + stored := stored \cup {ChunkOf(nextChunk)}; + head["P"] := [head["P"] EXCEPT !.ch = {ChunkOf(nextChunk)}, !.gen = @ + 1]; + nextChunk := nextChunk + 1; + or \* clean detach: final cut, HEAD published detached + await head["P"].st = "held"; + head["P"] := [head["P"] EXCEPT !.st = "detached", !.gen = @ + 1]; + or \* attach: needs a master assignment (refused while reserved), CASHead from detached + await head["P"].st = "detached" /\ resv.st = "none"; + head["P"] := [head["P"] EXCEPT !.st = "held", !.gen = @ + 1]; + end either; + hostOps := hostOps + 1; + end while; +end process; + +\* ---------------- GC, copy sweep, and the filer applying late creates ---------------- +process GC = "gc" +begin +g_loop: + while TRUE do + either \* one mark + sweep (gc.go:108-300), atomic + await stored \ AllRoots # {}; + stored := stored \cap AllRoots; + or \* an unnamed deleting attempt passes grace (gc_copy.go:177-183) + with p \in {q \in AttPaths : snaps[q].st = "deleting" /\ ~Named(q) /\ ~snaps[q].exp} do + snaps[p].exp := TRUE; + end with; + or \* a create whose caller gave up lands (or is refused: the path exists) + with x \in pending do + if snaps[x.path].st = "none" then + snaps[x.path] := [st |-> "active", ch |-> x.ch, claims |-> {}, exp |-> FALSE]; + end if; + pending := pending \ {x}; + end with; + or \* SweepCopies -> AbortSnapshot (catalog.go:707): tombstone, then drop the intent + await SweepOn; + with i \in {j \in intents : j.vol = "P"} do + if snaps[<<"N", i.att>>].st = "none" then + snaps[<<"N", i.att>>] := [EmptySnap EXCEPT !.st = "aborted"]; + end if; + intents := intents \ {i}; + end with; + or \* SweepCopies -> AbortFork (catalog.go:1418): HEAD tombstone of the target + await SweepOn; + with i \in {j \in intents : j.vol = "F"} do + if head["F"].st = "none" then + head["F"] := [st |-> "aborted", gen |-> 1, ch |-> {}]; + end if; + intents := intents \ {i}; + end with; + end either; + end while; +end process; + +\* ---------------- snapshot callers of P/N, same request id ---------------- +process Snap \in SnapCallers +variables myCh = {}, myAtt = NoAtt, outc = "none"; +begin +s_cut: \* chunk_control.go:477 CutVolume -> CASHead + if head["P"].st = "held" then + myCh := head["P"].ch; + reads[self] := head["P"].ch; + head["P"].gen := head["P"].gen + 1; + else + sres[self] := "closing"; goto s_done; + end if; +s_replay: \* catalog.go:824 SnapshotReplay (984-998) + if names["N"] # NoAtt /\ snaps[<<"N", names["N"]>>].st \in {"active", "deleting"} then + acked := acked \cup {<<"N", names["N"]>>}; + sres[self] := "replayed"; goto s_done; + elsif names["N"] # NoAtt /\ snaps[<<"N", names["N"]>>].st = "aborted" then + sres[self] := "exists"; goto s_done; + end if; +s_claim: \* catalog.go:846 claimName (937-959) + if names["N"] = NoAtt then + names["N"] := self; myAtt := self; + else + myAtt := names["N"]; + end if; +s_gone: \* catalog.go:853-861 volumeGone, then the back-out + if Gone then + call DeleteName("N", "backout"); + goto s_refused; + end if; +s_intent: \* catalog.go:891 putIntent + intents := intents \cup {[vol |-> "P", own |-> self, att |-> myAtt, keys |-> myCh]}; +s_create: \* catalog.go:903 createResolved: exclusive create at the attempt path + either + if snaps[<<"N", myAtt>>].st = "none" then + snaps[<<"N", myAtt>>] := [st |-> "active", ch |-> myCh, claims |-> {}, exp |-> FALSE]; + outc := "created"; + elsif snaps[<<"N", myAtt>>].st \in {"active", "deleting"} then + outc := "created"; \* extAttempt matches: createdNow (catalog.go:781) + else + outc := "exists"; \* tombstone (catalog.go:920-924) + end if; + or + await PendingOn; \* publish ctx expired, outcome unknown (catalog.go:928-930) + pending := pending \cup {[path |-> <<"N", myAtt>>, ch |-> myCh]}; + outc := "unknown"; + end either; +s_drop: \* catalog.go:911/923/926 dropIntent unless unsettled + if outc # "unknown" then + intents := {i \in intents : i.own # self}; + end if; + if outc = "created" then acked := acked \cup {<<"N", myAtt>>}; end if; + sres[self] := outc; + goto s_done; +s_refused: + sres[self] := "volume_deleted"; +s_done: + reads[self] := {}; +end process; + +\* ---------------- fork F <- P/M ---------------- +process Fork \in ForkIds +variables fch = {}; +begin +f_target: \* catalog.go:1174-1195 + if volume["F"] = "deleted" then fres := "volume_deleted"; goto f_done; end if; +f_claim: \* catalog.go:1201 claimForkParent (1317-1355) + if names["M"] = NoAtt \/ snaps[MP].st \in {"none", "aborted"} then + fres := "not_found"; goto f_done; + elsif snaps[MP].st = "deleting" then + fres := "snapshot_deleting"; goto f_done; + else + snaps[MP].claims := snaps[MP].claims \cup {"F"}; + fch := snaps[MP].ch; + reads[self] := snaps[MP].ch; + end if; +f_gone: \* catalog.go:1209 volumeGone(source) + if Gone then goto f_dropgone; end if; +f_vol: \* catalog.go:1251 exclusive VOLUME create + if volume["F"] = "none" then + volume["F"] := "live"; + volCreates["F"] := volCreates["F"] + 1; + end if; +f_intent: \* catalog.go:1270 putIntent in the target + intents := intents \cup {[vol |-> "F", own |-> self, att |-> NoAtt, keys |-> fch]}; +f_head: \* catalog.go:1285 exclusive HEAD create: gen 1, epoch 0 + if head["F"].st = "none" then + head["F"] := [st |-> "active", gen |-> 1, ch |-> fch]; + fres := "ok"; + else + fres := "lost"; + end if; +f_dropintent: + intents := {i \in intents : i.own # self}; +f_dropclaim: \* catalog.go:1309 dropForkClaim -> removeForkClaim (1367-1408) + snaps[MP].claims := snaps[MP].claims \ {"F"}; + goto f_done; +f_dropgone: \* catalog.go:1212 + snaps[MP].claims := snaps[MP].claims \ {"F"}; + fres := "volume_deleted"; +f_done: + reads[self] := {}; +end process; + +\* ---------------- explicit DeleteSnapshot (catalog.go:1052-1101) ---------------- +process DelSnap \in DelSnapIds +variables xn = "M", xatt = NoAtt; +begin +x_pick: + xn := IF self = "xM" THEN "M" ELSE "N"; +x_resolve: + if names[xn] = NoAtt then + goto x_done; + else + xatt := names[xn]; + if snaps[<>].st = "none" then goto x_tomb; + elsif snaps[<>].st = "active" then goto x_mark; + else goto x_free; + end if; + end if; +x_tomb: \* catalog.go:1075 tombstone the unpublished attempt + if snaps[<>].st = "none" then + snaps[<>] := [EmptySnap EXCEPT !.st = "aborted"]; + end if; + goto x_resolve; +x_mark: \* catalog.go:1082 markDeleting + if snaps[<>].st # "active" then + goto x_free; + elsif LiveClaim(<>) then + goto x_done; \* snapshot_claimed + elsif snaps[<>].claims # {} then + snaps[<>].claims := {}; + goto x_mark; + else + snaps[<>].st := "deleting"; + markedBy[<>] := "explicit"; + end if; +x_free: \* catalog.go:1094 DeleteEntry(snapnames) iff it names xatt + if names[xn] = xatt then names[xn] := NoAtt; end if; +x_done: + skip; +end process; + +\* ---------------- blockmaster CreateVolume("P") (services.go:52-70) ---------------- +process Create \in CreateIds +variables saw = FALSE; +begin +c_check: \* services.go:62-64 Reserved() under workspaceMu, then Unlock + saw := resv.st # "none"; +c_create: \* services.go:69 Volumes.CreateVolume, lock NOT held + if ~saw then idReuse := idReuse \/ resv.st # "none"; end if; +end process; + +\* ---------------- volume delete of P (volume_delete.go:105-238 at dfbf7273) ---------------- +process Del \in Deleters +variables run = 1, tok = <<>>, h0 = ""; +begin +d_read: \* :111-122 ReadVolume, ReadHead; :80-85 a fresh random token per run + h0 := head["P"].st; + tok := <>; + dtoks[self] := dtoks[self] \cup {<>}; +d_admit: \* :126 Admit -> services.go:129 MarkVolumeDeleting + if head["P"].st = "held" then \* live authority line: refused, nothing recorded + dres[self] := "not_admitted"; goto d_end; + else + resv := [st |-> IF resv.st = "committed" THEN "committed" ELSE "admitted", + toks |-> resv.toks \cup {tok}]; + either skip; + or await LostReply; dres[self] := "unknown"; goto d_end; + end either; + end if; +d_branch: \* :146 + if h0 \in {"purging", "deleted"} then goto d_admcommit; end if; +d_mark: \* :147 markHeadDeleting (278-305) + if head["P"].st \in {"deleting", "purging", "deleted"} then + skip; \* joins whatever mark is there + elsif head["P"].st = "held" then + dres[self] := "in_use"; goto d_abort; + else + head["P"] := [head["P"] EXCEPT !.st = "deleting", !.gen = @ + 1]; + end if; +d_claims: \* :158 anyLiveClaim (398-424) + if \E p \in AttPaths : Named(p) /\ snaps[p].st = "active" /\ LiveClaim(p) then + goto d_revert; + else + goto d_commit; + end if; +d_revert: \* :164 revertHeadDeleting (311-338) + if head["P"].st # "deleting" then + if head["P"].st \in {"held", "detached"} then + dres[self] := "refused_claimed"; goto d_abort; + else + dres[self] := "unknown"; goto d_end; \* another delete committed (:169-172) + end if; + else + head["P"] := [head["P"] EXCEPT !.st = "detached", !.gen = @ + 1]; + dres[self] := "refused_claimed"; goto d_abort; + end if; +d_commit: \* :179 commitHeadPurging (343-368): any deleting HEAD + if head["P"].st \in {"purging", "deleted"} then + skip; + elsif head["P"].st = "deleting" then + head["P"] := [head["P"] EXCEPT !.st = "purging", !.gen = @ + 1]; + badCommit := badCommit \/ CommitUnsafe; + badCommitAny := badCommitAny \/ CommitAnyClaim; + else + dres[self] := "givenback_by_other"; goto d_abort; + end if; +d_admcommit: \* :191 Admission.Commit (deletion_reservations.go:122) + resv.st := "committed"; +d_cascade_m: \* :198-213 listNames, deleteNameForVolume per name (name order) + if names["M"] # NoAtt then call DeleteName("M", "cascade"); end if; +d_cascade_n: + if dnErr[self] then dres[self] := "error"; goto d_end; + elsif names["N"] # NoAtt then call DeleteName("N", "cascade"); + end if; +d_finish: \* :228 finishHeadDeleted (371-394) + if dnErr[self] then dres[self] := "error"; goto d_end; + elsif head["P"].st = "purging" then + head["P"] := [st |-> "deleted", gen |-> head["P"].gen + 1, ch |-> {}]; + elsif head["P"].st # "deleted" then + dres[self] := "error"; goto d_end; + end if; +d_volmark: \* :232 markVolumeDeleted + volume["P"] := "deleted"; + dres[self] := "completed"; + goto d_end; +d_abort: \* :137 Admission.Abort (deletion_reservations.go:134-151) + if resv.st = "committed" then + dres[self] := "unknown"; + elsif resv.toks \ {tok} = {} then + resv := [st |-> "none", toks |-> {}]; + else + resv.toks := resv.toks \ {tok}; + end if; +d_end: \* the operator reruns an outcome_unknown + if dres[self] = "unknown" /\ run < MaxRuns then + run := run + 1; + goto d_read; + end if; +end process; + +end algorithm; *) +\* BEGIN TRANSLATION +CONSTANT defaultInitValue +VARIABLES head, volume, volCreates, names, snaps, intents, pending, stored, + nextChunk, hostOps, resv, reads, dnErr, markedBy, badMark, + badCommit, badCommitAny, acked, idReuse, sres, fres, dres, dtoks, + pc, stack + +(* define statement *) +Gone == volume["P"] = "deleted" \/ head["P"].st \in {"deleting", "purging", "deleted"} +Named(p) == names[p[1]] = p[2] + +LiveClaim(p) == \E c \in snaps[p].claims : head["F"].st = "none" +Committed == head["P"].st \in {"purging", "deleted"} +SnapRoot(p) == snaps[p].st = "active" \/ (snaps[p].st = "deleting" /\ (Named(p) \/ ~snaps[p].exp)) +AllRoots == UNION {head[v].ch : v \in Vols} + \cup UNION {snaps[p].ch : p \in {q \in AttPaths : SnapRoot(q)}} + \cup UNION {i.keys : i \in intents} + \cup UNION {reads[r] : r \in ReaderIds} + +PastForkGate == {"f_vol", "f_intent", "f_head", "f_dropintent"} +CommitUnsafe == \E f \in ForkIds : pc[f] \in PastForkGate /\ LiveClaim(MP) +CommitAnyClaim == \E p \in AttPaths : LiveClaim(p) + +VARIABLES dn, why, datt, dtries, myCh, myAtt, outc, fch, xn, xatt, saw, run, + tok, h0 + +vars == << head, volume, volCreates, names, snaps, intents, pending, stored, + nextChunk, hostOps, resv, reads, dnErr, markedBy, badMark, + badCommit, badCommitAny, acked, idReuse, sres, fres, dres, dtoks, + pc, stack, dn, why, datt, dtries, myCh, myAtt, outc, fch, xn, xatt, + saw, run, tok, h0 >> + +ProcSet == {"host"} \cup {"gc"} \cup (SnapCallers) \cup (ForkIds) \cup (DelSnapIds) \cup (CreateIds) \cup (Deleters) + +Init == (* Global variables *) + /\ head = [v \in Vols |-> IF v = "P" THEN [st |-> "held", gen |-> 1, ch |-> {"c1"}] + ELSE [st |-> "none", gen |-> 0, ch |-> {}]] + /\ volume = [v \in Vols |-> IF v = "P" THEN "live" ELSE "none"] + /\ volCreates = [v \in Vols |-> IF v = "P" THEN 1 ELSE 0] + /\ names = [n \in Names |-> IF n = "M" THEN "m0" ELSE NoAtt] + /\ snaps = [p \in AttPaths |-> IF p = MP + THEN [st |-> "active", ch |-> {"c1"}, claims |-> {}, exp |-> FALSE] + ELSE EmptySnap] + /\ intents = {} + /\ pending = {} + /\ stored = {"c1"} + /\ nextChunk = 2 + /\ hostOps = 0 + /\ resv = [st |-> "none", toks |-> {}] + /\ reads = [r \in ReaderIds |-> {}] + /\ dnErr = [p \in DnCallers |-> FALSE] + /\ markedBy = [p \in AttPaths |-> "none"] + /\ badMark = FALSE + /\ badCommit = FALSE + /\ badCommitAny = FALSE + /\ acked = {} + /\ idReuse = FALSE + /\ sres = [s \in SnapCallers |-> "none"] + /\ fres = "none" + /\ dres = [d \in Deleters |-> "none"] + /\ dtoks = [d \in Deleters |-> {}] + (* Procedure DeleteName *) + /\ dn = [ self \in ProcSet |-> defaultInitValue] + /\ why = [ self \in ProcSet |-> defaultInitValue] + /\ datt = [ self \in ProcSet |-> NoAtt] + /\ dtries = [ self \in ProcSet |-> 0] + (* Process Snap *) + /\ myCh = [self \in SnapCallers |-> {}] + /\ myAtt = [self \in SnapCallers |-> NoAtt] + /\ outc = [self \in SnapCallers |-> "none"] + (* Process Fork *) + /\ fch = [self \in ForkIds |-> {}] + (* Process DelSnap *) + /\ xn = [self \in DelSnapIds |-> "M"] + /\ xatt = [self \in DelSnapIds |-> NoAtt] + (* Process Create *) + /\ saw = [self \in CreateIds |-> FALSE] + (* Process Del *) + /\ run = [self \in Deleters |-> 1] + /\ tok = [self \in Deleters |-> <<>>] + /\ h0 = [self \in Deleters |-> ""] + /\ stack = [self \in ProcSet |-> << >>] + /\ pc = [self \in ProcSet |-> CASE self = "host" -> "h_loop" + [] self = "gc" -> "g_loop" + [] self \in SnapCallers -> "s_cut" + [] self \in ForkIds -> "f_target" + [] self \in DelSnapIds -> "x_pick" + [] self \in CreateIds -> "c_check" + [] self \in Deleters -> "d_read"] + +dn_resolve(self) == /\ pc[self] = "dn_resolve" + /\ IF names[dn[self]] = NoAtt + THEN /\ pc' = [pc EXCEPT ![self] = Head(stack[self]).pc] + /\ datt' = [datt EXCEPT ![self] = Head(stack[self]).datt] + /\ dtries' = [dtries EXCEPT ![self] = Head(stack[self]).dtries] + /\ dn' = [dn EXCEPT ![self] = Head(stack[self]).dn] + /\ why' = [why EXCEPT ![self] = Head(stack[self]).why] + /\ stack' = [stack EXCEPT ![self] = Tail(stack[self])] + ELSE /\ datt' = [datt EXCEPT ![self] = names[dn[self]]] + /\ IF snaps[<>].st = "none" + THEN /\ pc' = [pc EXCEPT ![self] = "dn_tomb"] + ELSE /\ pc' = [pc EXCEPT ![self] = "dn_mark"] + /\ UNCHANGED << stack, dn, why, dtries >> + /\ UNCHANGED << head, volume, volCreates, names, snaps, + intents, pending, stored, nextChunk, + hostOps, resv, reads, dnErr, markedBy, + badMark, badCommit, badCommitAny, acked, + idReuse, sres, fres, dres, dtoks, myCh, + myAtt, outc, fch, xn, xatt, saw, run, tok, + h0 >> + +dn_tomb(self) == /\ pc[self] = "dn_tomb" + /\ IF snaps[<>].st = "none" + THEN /\ snaps' = [snaps EXCEPT ![<>] = [EmptySnap EXCEPT !.st = "aborted"]] + ELSE /\ TRUE + /\ snaps' = snaps + /\ pc' = [pc EXCEPT ![self] = "dn_resolve"] + /\ UNCHANGED << head, volume, volCreates, names, intents, + pending, stored, nextChunk, hostOps, resv, + reads, dnErr, markedBy, badMark, badCommit, + badCommitAny, acked, idReuse, sres, fres, + dres, dtoks, stack, dn, why, datt, dtries, + myCh, myAtt, outc, fch, xn, xatt, saw, run, + tok, h0 >> + +dn_mark(self) == /\ pc[self] = "dn_mark" + /\ IF snaps[<>].st # "active" + THEN /\ pc' = [pc EXCEPT ![self] = "dn_free"] + /\ UNCHANGED << snaps, dnErr, markedBy, badMark, + stack, dn, why, datt, dtries >> + ELSE /\ IF LiveClaim(<>) + THEN /\ IF dtries[self] < 2 + THEN /\ dtries' = [dtries EXCEPT ![self] = dtries[self] + 1] + /\ pc' = [pc EXCEPT ![self] = "dn_resolve"] + /\ UNCHANGED << dnErr, stack, + dn, why, + datt >> + ELSE /\ dnErr' = [dnErr EXCEPT ![self] = TRUE] + /\ pc' = [pc EXCEPT ![self] = Head(stack[self]).pc] + /\ datt' = [datt EXCEPT ![self] = Head(stack[self]).datt] + /\ dtries' = [dtries EXCEPT ![self] = Head(stack[self]).dtries] + /\ dn' = [dn EXCEPT ![self] = Head(stack[self]).dn] + /\ why' = [why EXCEPT ![self] = Head(stack[self]).why] + /\ stack' = [stack EXCEPT ![self] = Tail(stack[self])] + /\ UNCHANGED << snaps, markedBy, + badMark >> + ELSE /\ IF snaps[<>].claims # {} + THEN /\ snaps' = [snaps EXCEPT ![<>].claims = {}] + /\ pc' = [pc EXCEPT ![self] = "dn_mark"] + /\ UNCHANGED << markedBy, + badMark >> + ELSE /\ snaps' = [snaps EXCEPT ![<>].st = "deleting"] + /\ markedBy' = [markedBy EXCEPT ![<>] = why[self]] + /\ badMark' = (badMark \/ ~Committed) + /\ pc' = [pc EXCEPT ![self] = "dn_free"] + /\ UNCHANGED << dnErr, stack, dn, why, + datt, dtries >> + /\ UNCHANGED << head, volume, volCreates, names, intents, + pending, stored, nextChunk, hostOps, resv, + reads, badCommit, badCommitAny, acked, + idReuse, sres, fres, dres, dtoks, myCh, myAtt, + outc, fch, xn, xatt, saw, run, tok, h0 >> + +dn_free(self) == /\ pc[self] = "dn_free" + /\ IF names[dn[self]] = datt[self] + THEN /\ names' = [names EXCEPT ![dn[self]] = NoAtt] + ELSE /\ TRUE + /\ names' = names + /\ pc' = [pc EXCEPT ![self] = Head(stack[self]).pc] + /\ datt' = [datt EXCEPT ![self] = Head(stack[self]).datt] + /\ dtries' = [dtries EXCEPT ![self] = Head(stack[self]).dtries] + /\ dn' = [dn EXCEPT ![self] = Head(stack[self]).dn] + /\ why' = [why EXCEPT ![self] = Head(stack[self]).why] + /\ stack' = [stack EXCEPT ![self] = Tail(stack[self])] + /\ UNCHANGED << head, volume, volCreates, snaps, intents, + pending, stored, nextChunk, hostOps, resv, + reads, dnErr, markedBy, badMark, badCommit, + badCommitAny, acked, idReuse, sres, fres, + dres, dtoks, myCh, myAtt, outc, fch, xn, xatt, + saw, run, tok, h0 >> + +DeleteName(self) == dn_resolve(self) \/ dn_tomb(self) \/ dn_mark(self) + \/ dn_free(self) + +h_loop == /\ pc["host"] = "h_loop" + /\ IF hostOps < MaxHostOps + THEN /\ \/ /\ head["P"].st = "held" /\ nextChunk <= 3 + /\ stored' = (stored \cup {ChunkOf(nextChunk)}) + /\ head' = [head EXCEPT !["P"] = [head["P"] EXCEPT !.ch = {ChunkOf(nextChunk)}, !.gen = @ + 1]] + /\ nextChunk' = nextChunk + 1 + \/ /\ head["P"].st = "held" + /\ head' = [head EXCEPT !["P"] = [head["P"] EXCEPT !.st = "detached", !.gen = @ + 1]] + /\ UNCHANGED <> + \/ /\ head["P"].st = "detached" /\ resv.st = "none" + /\ head' = [head EXCEPT !["P"] = [head["P"] EXCEPT !.st = "held", !.gen = @ + 1]] + /\ UNCHANGED <> + /\ hostOps' = hostOps + 1 + /\ pc' = [pc EXCEPT !["host"] = "h_loop"] + ELSE /\ pc' = [pc EXCEPT !["host"] = "Done"] + /\ UNCHANGED << head, stored, nextChunk, hostOps >> + /\ UNCHANGED << volume, volCreates, names, snaps, intents, pending, + resv, reads, dnErr, markedBy, badMark, badCommit, + badCommitAny, acked, idReuse, sres, fres, dres, + dtoks, stack, dn, why, datt, dtries, myCh, myAtt, + outc, fch, xn, xatt, saw, run, tok, h0 >> + +Host == h_loop + +g_loop == /\ pc["gc"] = "g_loop" + /\ \/ /\ stored \ AllRoots # {} + /\ stored' = (stored \cap AllRoots) + /\ UNCHANGED <> + \/ /\ \E p \in {q \in AttPaths : snaps[q].st = "deleting" /\ ~Named(q) /\ ~snaps[q].exp}: + snaps' = [snaps EXCEPT ![p].exp = TRUE] + /\ UNCHANGED <> + \/ /\ \E x \in pending: + /\ IF snaps[x.path].st = "none" + THEN /\ snaps' = [snaps EXCEPT ![x.path] = [st |-> "active", ch |-> x.ch, claims |-> {}, exp |-> FALSE]] + ELSE /\ TRUE + /\ snaps' = snaps + /\ pending' = pending \ {x} + /\ UNCHANGED <> + \/ /\ SweepOn + /\ \E i \in {j \in intents : j.vol = "P"}: + /\ IF snaps[<<"N", i.att>>].st = "none" + THEN /\ snaps' = [snaps EXCEPT ![<<"N", i.att>>] = [EmptySnap EXCEPT !.st = "aborted"]] + ELSE /\ TRUE + /\ snaps' = snaps + /\ intents' = intents \ {i} + /\ UNCHANGED <> + \/ /\ SweepOn + /\ \E i \in {j \in intents : j.vol = "F"}: + /\ IF head["F"].st = "none" + THEN /\ head' = [head EXCEPT !["F"] = [st |-> "aborted", gen |-> 1, ch |-> {}]] + ELSE /\ TRUE + /\ head' = head + /\ intents' = intents \ {i} + /\ UNCHANGED <> + /\ pc' = [pc EXCEPT !["gc"] = "g_loop"] + /\ UNCHANGED << volume, volCreates, names, nextChunk, hostOps, resv, + reads, dnErr, markedBy, badMark, badCommit, + badCommitAny, acked, idReuse, sres, fres, dres, + dtoks, stack, dn, why, datt, dtries, myCh, myAtt, + outc, fch, xn, xatt, saw, run, tok, h0 >> + +GC == g_loop + +s_cut(self) == /\ pc[self] = "s_cut" + /\ IF head["P"].st = "held" + THEN /\ myCh' = [myCh EXCEPT ![self] = head["P"].ch] + /\ reads' = [reads EXCEPT ![self] = head["P"].ch] + /\ head' = [head EXCEPT !["P"].gen = head["P"].gen + 1] + /\ pc' = [pc EXCEPT ![self] = "s_replay"] + /\ sres' = sres + ELSE /\ sres' = [sres EXCEPT ![self] = "closing"] + /\ pc' = [pc EXCEPT ![self] = "s_done"] + /\ UNCHANGED << head, reads, myCh >> + /\ UNCHANGED << volume, volCreates, names, snaps, intents, + pending, stored, nextChunk, hostOps, resv, + dnErr, markedBy, badMark, badCommit, + badCommitAny, acked, idReuse, fres, dres, dtoks, + stack, dn, why, datt, dtries, myAtt, outc, fch, + xn, xatt, saw, run, tok, h0 >> + +s_replay(self) == /\ pc[self] = "s_replay" + /\ IF names["N"] # NoAtt /\ snaps[<<"N", names["N"]>>].st \in {"active", "deleting"} + THEN /\ acked' = (acked \cup {<<"N", names["N"]>>}) + /\ sres' = [sres EXCEPT ![self] = "replayed"] + /\ pc' = [pc EXCEPT ![self] = "s_done"] + ELSE /\ IF names["N"] # NoAtt /\ snaps[<<"N", names["N"]>>].st = "aborted" + THEN /\ sres' = [sres EXCEPT ![self] = "exists"] + /\ pc' = [pc EXCEPT ![self] = "s_done"] + ELSE /\ pc' = [pc EXCEPT ![self] = "s_claim"] + /\ sres' = sres + /\ acked' = acked + /\ UNCHANGED << head, volume, volCreates, names, snaps, + intents, pending, stored, nextChunk, hostOps, + resv, reads, dnErr, markedBy, badMark, + badCommit, badCommitAny, idReuse, fres, dres, + dtoks, stack, dn, why, datt, dtries, myCh, + myAtt, outc, fch, xn, xatt, saw, run, tok, + h0 >> + +s_claim(self) == /\ pc[self] = "s_claim" + /\ IF names["N"] = NoAtt + THEN /\ names' = [names EXCEPT !["N"] = self] + /\ myAtt' = [myAtt EXCEPT ![self] = self] + ELSE /\ myAtt' = [myAtt EXCEPT ![self] = names["N"]] + /\ names' = names + /\ pc' = [pc EXCEPT ![self] = "s_gone"] + /\ UNCHANGED << head, volume, volCreates, snaps, intents, + pending, stored, nextChunk, hostOps, resv, + reads, dnErr, markedBy, badMark, badCommit, + badCommitAny, acked, idReuse, sres, fres, + dres, dtoks, stack, dn, why, datt, dtries, + myCh, outc, fch, xn, xatt, saw, run, tok, h0 >> + +s_gone(self) == /\ pc[self] = "s_gone" + /\ IF Gone + THEN /\ /\ dn' = [dn EXCEPT ![self] = "N"] + /\ stack' = [stack EXCEPT ![self] = << [ procedure |-> "DeleteName", + pc |-> "s_refused", + datt |-> datt[self], + dtries |-> dtries[self], + dn |-> dn[self], + why |-> why[self] ] >> + \o stack[self]] + /\ why' = [why EXCEPT ![self] = "backout"] + /\ datt' = [datt EXCEPT ![self] = NoAtt] + /\ dtries' = [dtries EXCEPT ![self] = 0] + /\ pc' = [pc EXCEPT ![self] = "dn_resolve"] + ELSE /\ pc' = [pc EXCEPT ![self] = "s_intent"] + /\ UNCHANGED << stack, dn, why, datt, dtries >> + /\ UNCHANGED << head, volume, volCreates, names, snaps, + intents, pending, stored, nextChunk, hostOps, + resv, reads, dnErr, markedBy, badMark, + badCommit, badCommitAny, acked, idReuse, sres, + fres, dres, dtoks, myCh, myAtt, outc, fch, xn, + xatt, saw, run, tok, h0 >> + +s_intent(self) == /\ pc[self] = "s_intent" + /\ intents' = (intents \cup {[vol |-> "P", own |-> self, att |-> myAtt[self], keys |-> myCh[self]]}) + /\ pc' = [pc EXCEPT ![self] = "s_create"] + /\ UNCHANGED << head, volume, volCreates, names, snaps, + pending, stored, nextChunk, hostOps, resv, + reads, dnErr, markedBy, badMark, badCommit, + badCommitAny, acked, idReuse, sres, fres, + dres, dtoks, stack, dn, why, datt, dtries, + myCh, myAtt, outc, fch, xn, xatt, saw, run, + tok, h0 >> + +s_create(self) == /\ pc[self] = "s_create" + /\ \/ /\ IF snaps[<<"N", myAtt[self]>>].st = "none" + THEN /\ snaps' = [snaps EXCEPT ![<<"N", myAtt[self]>>] = [st |-> "active", ch |-> myCh[self], claims |-> {}, exp |-> FALSE]] + /\ outc' = [outc EXCEPT ![self] = "created"] + ELSE /\ IF snaps[<<"N", myAtt[self]>>].st \in {"active", "deleting"} + THEN /\ outc' = [outc EXCEPT ![self] = "created"] + ELSE /\ outc' = [outc EXCEPT ![self] = "exists"] + /\ snaps' = snaps + /\ UNCHANGED pending + \/ /\ PendingOn + /\ pending' = (pending \cup {[path |-> <<"N", myAtt[self]>>, ch |-> myCh[self]]}) + /\ outc' = [outc EXCEPT ![self] = "unknown"] + /\ snaps' = snaps + /\ pc' = [pc EXCEPT ![self] = "s_drop"] + /\ UNCHANGED << head, volume, volCreates, names, intents, + stored, nextChunk, hostOps, resv, reads, + dnErr, markedBy, badMark, badCommit, + badCommitAny, acked, idReuse, sres, fres, + dres, dtoks, stack, dn, why, datt, dtries, + myCh, myAtt, fch, xn, xatt, saw, run, tok, + h0 >> + +s_drop(self) == /\ pc[self] = "s_drop" + /\ IF outc[self] # "unknown" + THEN /\ intents' = {i \in intents : i.own # self} + ELSE /\ TRUE + /\ UNCHANGED intents + /\ IF outc[self] = "created" + THEN /\ acked' = (acked \cup {<<"N", myAtt[self]>>}) + ELSE /\ TRUE + /\ acked' = acked + /\ sres' = [sres EXCEPT ![self] = outc[self]] + /\ pc' = [pc EXCEPT ![self] = "s_done"] + /\ UNCHANGED << head, volume, volCreates, names, snaps, + pending, stored, nextChunk, hostOps, resv, + reads, dnErr, markedBy, badMark, badCommit, + badCommitAny, idReuse, fres, dres, dtoks, + stack, dn, why, datt, dtries, myCh, myAtt, + outc, fch, xn, xatt, saw, run, tok, h0 >> + +s_refused(self) == /\ pc[self] = "s_refused" + /\ sres' = [sres EXCEPT ![self] = "volume_deleted"] + /\ pc' = [pc EXCEPT ![self] = "s_done"] + /\ UNCHANGED << head, volume, volCreates, names, snaps, + intents, pending, stored, nextChunk, + hostOps, resv, reads, dnErr, markedBy, + badMark, badCommit, badCommitAny, acked, + idReuse, fres, dres, dtoks, stack, dn, why, + datt, dtries, myCh, myAtt, outc, fch, xn, + xatt, saw, run, tok, h0 >> + +s_done(self) == /\ pc[self] = "s_done" + /\ reads' = [reads EXCEPT ![self] = {}] + /\ pc' = [pc EXCEPT ![self] = "Done"] + /\ UNCHANGED << head, volume, volCreates, names, snaps, + intents, pending, stored, nextChunk, hostOps, + resv, dnErr, markedBy, badMark, badCommit, + badCommitAny, acked, idReuse, sres, fres, dres, + dtoks, stack, dn, why, datt, dtries, myCh, + myAtt, outc, fch, xn, xatt, saw, run, tok, h0 >> + +Snap(self) == s_cut(self) \/ s_replay(self) \/ s_claim(self) + \/ s_gone(self) \/ s_intent(self) \/ s_create(self) + \/ s_drop(self) \/ s_refused(self) \/ s_done(self) + +f_target(self) == /\ pc[self] = "f_target" + /\ IF volume["F"] = "deleted" + THEN /\ fres' = "volume_deleted" + /\ pc' = [pc EXCEPT ![self] = "f_done"] + ELSE /\ pc' = [pc EXCEPT ![self] = "f_claim"] + /\ fres' = fres + /\ UNCHANGED << head, volume, volCreates, names, snaps, + intents, pending, stored, nextChunk, hostOps, + resv, reads, dnErr, markedBy, badMark, + badCommit, badCommitAny, acked, idReuse, + sres, dres, dtoks, stack, dn, why, datt, + dtries, myCh, myAtt, outc, fch, xn, xatt, + saw, run, tok, h0 >> + +f_claim(self) == /\ pc[self] = "f_claim" + /\ IF names["M"] = NoAtt \/ snaps[MP].st \in {"none", "aborted"} + THEN /\ fres' = "not_found" + /\ pc' = [pc EXCEPT ![self] = "f_done"] + /\ UNCHANGED << snaps, reads, fch >> + ELSE /\ IF snaps[MP].st = "deleting" + THEN /\ fres' = "snapshot_deleting" + /\ pc' = [pc EXCEPT ![self] = "f_done"] + /\ UNCHANGED << snaps, reads, fch >> + ELSE /\ snaps' = [snaps EXCEPT ![MP].claims = snaps[MP].claims \cup {"F"}] + /\ fch' = [fch EXCEPT ![self] = snaps'[MP].ch] + /\ reads' = [reads EXCEPT ![self] = snaps'[MP].ch] + /\ pc' = [pc EXCEPT ![self] = "f_gone"] + /\ fres' = fres + /\ UNCHANGED << head, volume, volCreates, names, intents, + pending, stored, nextChunk, hostOps, resv, + dnErr, markedBy, badMark, badCommit, + badCommitAny, acked, idReuse, sres, dres, + dtoks, stack, dn, why, datt, dtries, myCh, + myAtt, outc, xn, xatt, saw, run, tok, h0 >> + +f_gone(self) == /\ pc[self] = "f_gone" + /\ IF Gone + THEN /\ pc' = [pc EXCEPT ![self] = "f_dropgone"] + ELSE /\ pc' = [pc EXCEPT ![self] = "f_vol"] + /\ UNCHANGED << head, volume, volCreates, names, snaps, + intents, pending, stored, nextChunk, hostOps, + resv, reads, dnErr, markedBy, badMark, + badCommit, badCommitAny, acked, idReuse, sres, + fres, dres, dtoks, stack, dn, why, datt, + dtries, myCh, myAtt, outc, fch, xn, xatt, saw, + run, tok, h0 >> + +f_vol(self) == /\ pc[self] = "f_vol" + /\ IF volume["F"] = "none" + THEN /\ volume' = [volume EXCEPT !["F"] = "live"] + /\ volCreates' = [volCreates EXCEPT !["F"] = volCreates["F"] + 1] + ELSE /\ TRUE + /\ UNCHANGED << volume, volCreates >> + /\ pc' = [pc EXCEPT ![self] = "f_intent"] + /\ UNCHANGED << head, names, snaps, intents, pending, stored, + nextChunk, hostOps, resv, reads, dnErr, + markedBy, badMark, badCommit, badCommitAny, + acked, idReuse, sres, fres, dres, dtoks, stack, + dn, why, datt, dtries, myCh, myAtt, outc, fch, + xn, xatt, saw, run, tok, h0 >> + +f_intent(self) == /\ pc[self] = "f_intent" + /\ intents' = (intents \cup {[vol |-> "F", own |-> self, att |-> NoAtt, keys |-> fch[self]]}) + /\ pc' = [pc EXCEPT ![self] = "f_head"] + /\ UNCHANGED << head, volume, volCreates, names, snaps, + pending, stored, nextChunk, hostOps, resv, + reads, dnErr, markedBy, badMark, badCommit, + badCommitAny, acked, idReuse, sres, fres, + dres, dtoks, stack, dn, why, datt, dtries, + myCh, myAtt, outc, fch, xn, xatt, saw, run, + tok, h0 >> + +f_head(self) == /\ pc[self] = "f_head" + /\ IF head["F"].st = "none" + THEN /\ head' = [head EXCEPT !["F"] = [st |-> "active", gen |-> 1, ch |-> fch[self]]] + /\ fres' = "ok" + ELSE /\ fres' = "lost" + /\ head' = head + /\ pc' = [pc EXCEPT ![self] = "f_dropintent"] + /\ UNCHANGED << volume, volCreates, names, snaps, intents, + pending, stored, nextChunk, hostOps, resv, + reads, dnErr, markedBy, badMark, badCommit, + badCommitAny, acked, idReuse, sres, dres, + dtoks, stack, dn, why, datt, dtries, myCh, + myAtt, outc, fch, xn, xatt, saw, run, tok, h0 >> + +f_dropintent(self) == /\ pc[self] = "f_dropintent" + /\ intents' = {i \in intents : i.own # self} + /\ pc' = [pc EXCEPT ![self] = "f_dropclaim"] + /\ UNCHANGED << head, volume, volCreates, names, snaps, + pending, stored, nextChunk, hostOps, + resv, reads, dnErr, markedBy, badMark, + badCommit, badCommitAny, acked, idReuse, + sres, fres, dres, dtoks, stack, dn, why, + datt, dtries, myCh, myAtt, outc, fch, xn, + xatt, saw, run, tok, h0 >> + +f_dropclaim(self) == /\ pc[self] = "f_dropclaim" + /\ snaps' = [snaps EXCEPT ![MP].claims = snaps[MP].claims \ {"F"}] + /\ pc' = [pc EXCEPT ![self] = "f_done"] + /\ UNCHANGED << head, volume, volCreates, names, intents, + pending, stored, nextChunk, hostOps, resv, + reads, dnErr, markedBy, badMark, + badCommit, badCommitAny, acked, idReuse, + sres, fres, dres, dtoks, stack, dn, why, + datt, dtries, myCh, myAtt, outc, fch, xn, + xatt, saw, run, tok, h0 >> + +f_dropgone(self) == /\ pc[self] = "f_dropgone" + /\ snaps' = [snaps EXCEPT ![MP].claims = snaps[MP].claims \ {"F"}] + /\ fres' = "volume_deleted" + /\ pc' = [pc EXCEPT ![self] = "f_done"] + /\ UNCHANGED << head, volume, volCreates, names, intents, + pending, stored, nextChunk, hostOps, resv, + reads, dnErr, markedBy, badMark, badCommit, + badCommitAny, acked, idReuse, sres, dres, + dtoks, stack, dn, why, datt, dtries, myCh, + myAtt, outc, fch, xn, xatt, saw, run, tok, + h0 >> + +f_done(self) == /\ pc[self] = "f_done" + /\ reads' = [reads EXCEPT ![self] = {}] + /\ pc' = [pc EXCEPT ![self] = "Done"] + /\ UNCHANGED << head, volume, volCreates, names, snaps, + intents, pending, stored, nextChunk, hostOps, + resv, dnErr, markedBy, badMark, badCommit, + badCommitAny, acked, idReuse, sres, fres, dres, + dtoks, stack, dn, why, datt, dtries, myCh, + myAtt, outc, fch, xn, xatt, saw, run, tok, h0 >> + +Fork(self) == f_target(self) \/ f_claim(self) \/ f_gone(self) + \/ f_vol(self) \/ f_intent(self) \/ f_head(self) + \/ f_dropintent(self) \/ f_dropclaim(self) + \/ f_dropgone(self) \/ f_done(self) + +x_pick(self) == /\ pc[self] = "x_pick" + /\ xn' = [xn EXCEPT ![self] = IF self = "xM" THEN "M" ELSE "N"] + /\ pc' = [pc EXCEPT ![self] = "x_resolve"] + /\ UNCHANGED << head, volume, volCreates, names, snaps, + intents, pending, stored, nextChunk, hostOps, + resv, reads, dnErr, markedBy, badMark, + badCommit, badCommitAny, acked, idReuse, sres, + fres, dres, dtoks, stack, dn, why, datt, + dtries, myCh, myAtt, outc, fch, xatt, saw, run, + tok, h0 >> + +x_resolve(self) == /\ pc[self] = "x_resolve" + /\ IF names[xn[self]] = NoAtt + THEN /\ pc' = [pc EXCEPT ![self] = "x_done"] + /\ xatt' = xatt + ELSE /\ xatt' = [xatt EXCEPT ![self] = names[xn[self]]] + /\ IF snaps[<>].st = "none" + THEN /\ pc' = [pc EXCEPT ![self] = "x_tomb"] + ELSE /\ IF snaps[<>].st = "active" + THEN /\ pc' = [pc EXCEPT ![self] = "x_mark"] + ELSE /\ pc' = [pc EXCEPT ![self] = "x_free"] + /\ UNCHANGED << head, volume, volCreates, names, snaps, + intents, pending, stored, nextChunk, + hostOps, resv, reads, dnErr, markedBy, + badMark, badCommit, badCommitAny, acked, + idReuse, sres, fres, dres, dtoks, stack, dn, + why, datt, dtries, myCh, myAtt, outc, fch, + xn, saw, run, tok, h0 >> + +x_tomb(self) == /\ pc[self] = "x_tomb" + /\ IF snaps[<>].st = "none" + THEN /\ snaps' = [snaps EXCEPT ![<>] = [EmptySnap EXCEPT !.st = "aborted"]] + ELSE /\ TRUE + /\ snaps' = snaps + /\ pc' = [pc EXCEPT ![self] = "x_resolve"] + /\ UNCHANGED << head, volume, volCreates, names, intents, + pending, stored, nextChunk, hostOps, resv, + reads, dnErr, markedBy, badMark, badCommit, + badCommitAny, acked, idReuse, sres, fres, dres, + dtoks, stack, dn, why, datt, dtries, myCh, + myAtt, outc, fch, xn, xatt, saw, run, tok, h0 >> + +x_mark(self) == /\ pc[self] = "x_mark" + /\ IF snaps[<>].st # "active" + THEN /\ pc' = [pc EXCEPT ![self] = "x_free"] + /\ UNCHANGED << snaps, markedBy >> + ELSE /\ IF LiveClaim(<>) + THEN /\ pc' = [pc EXCEPT ![self] = "x_done"] + /\ UNCHANGED << snaps, markedBy >> + ELSE /\ IF snaps[<>].claims # {} + THEN /\ snaps' = [snaps EXCEPT ![<>].claims = {}] + /\ pc' = [pc EXCEPT ![self] = "x_mark"] + /\ UNCHANGED markedBy + ELSE /\ snaps' = [snaps EXCEPT ![<>].st = "deleting"] + /\ markedBy' = [markedBy EXCEPT ![<>] = "explicit"] + /\ pc' = [pc EXCEPT ![self] = "x_free"] + /\ UNCHANGED << head, volume, volCreates, names, intents, + pending, stored, nextChunk, hostOps, resv, + reads, dnErr, badMark, badCommit, badCommitAny, + acked, idReuse, sres, fres, dres, dtoks, stack, + dn, why, datt, dtries, myCh, myAtt, outc, fch, + xn, xatt, saw, run, tok, h0 >> + +x_free(self) == /\ pc[self] = "x_free" + /\ IF names[xn[self]] = xatt[self] + THEN /\ names' = [names EXCEPT ![xn[self]] = NoAtt] + ELSE /\ TRUE + /\ names' = names + /\ pc' = [pc EXCEPT ![self] = "x_done"] + /\ UNCHANGED << head, volume, volCreates, snaps, intents, + pending, stored, nextChunk, hostOps, resv, + reads, dnErr, markedBy, badMark, badCommit, + badCommitAny, acked, idReuse, sres, fres, dres, + dtoks, stack, dn, why, datt, dtries, myCh, + myAtt, outc, fch, xn, xatt, saw, run, tok, h0 >> + +x_done(self) == /\ pc[self] = "x_done" + /\ TRUE + /\ pc' = [pc EXCEPT ![self] = "Done"] + /\ UNCHANGED << head, volume, volCreates, names, snaps, + intents, pending, stored, nextChunk, hostOps, + resv, reads, dnErr, markedBy, badMark, + badCommit, badCommitAny, acked, idReuse, sres, + fres, dres, dtoks, stack, dn, why, datt, + dtries, myCh, myAtt, outc, fch, xn, xatt, saw, + run, tok, h0 >> + +DelSnap(self) == x_pick(self) \/ x_resolve(self) \/ x_tomb(self) + \/ x_mark(self) \/ x_free(self) \/ x_done(self) + +c_check(self) == /\ pc[self] = "c_check" + /\ saw' = [saw EXCEPT ![self] = resv.st # "none"] + /\ pc' = [pc EXCEPT ![self] = "c_create"] + /\ UNCHANGED << head, volume, volCreates, names, snaps, + intents, pending, stored, nextChunk, hostOps, + resv, reads, dnErr, markedBy, badMark, + badCommit, badCommitAny, acked, idReuse, sres, + fres, dres, dtoks, stack, dn, why, datt, + dtries, myCh, myAtt, outc, fch, xn, xatt, run, + tok, h0 >> + +c_create(self) == /\ pc[self] = "c_create" + /\ IF ~saw[self] + THEN /\ idReuse' = (idReuse \/ resv.st # "none") + ELSE /\ TRUE + /\ UNCHANGED idReuse + /\ pc' = [pc EXCEPT ![self] = "Done"] + /\ UNCHANGED << head, volume, volCreates, names, snaps, + intents, pending, stored, nextChunk, hostOps, + resv, reads, dnErr, markedBy, badMark, + badCommit, badCommitAny, acked, sres, fres, + dres, dtoks, stack, dn, why, datt, dtries, + myCh, myAtt, outc, fch, xn, xatt, saw, run, + tok, h0 >> + +Create(self) == c_check(self) \/ c_create(self) + +d_read(self) == /\ pc[self] = "d_read" + /\ h0' = [h0 EXCEPT ![self] = head["P"].st] + /\ tok' = [tok EXCEPT ![self] = <>] + /\ dtoks' = [dtoks EXCEPT ![self] = dtoks[self] \cup {<>}] + /\ pc' = [pc EXCEPT ![self] = "d_admit"] + /\ UNCHANGED << head, volume, volCreates, names, snaps, + intents, pending, stored, nextChunk, hostOps, + resv, reads, dnErr, markedBy, badMark, + badCommit, badCommitAny, acked, idReuse, sres, + fres, dres, stack, dn, why, datt, dtries, myCh, + myAtt, outc, fch, xn, xatt, saw, run >> + +d_admit(self) == /\ pc[self] = "d_admit" + /\ IF head["P"].st = "held" + THEN /\ dres' = [dres EXCEPT ![self] = "not_admitted"] + /\ pc' = [pc EXCEPT ![self] = "d_end"] + /\ resv' = resv + ELSE /\ resv' = [st |-> IF resv.st = "committed" THEN "committed" ELSE "admitted", + toks |-> resv.toks \cup {tok[self]}] + /\ \/ /\ TRUE + /\ pc' = [pc EXCEPT ![self] = "d_branch"] + /\ dres' = dres + \/ /\ LostReply + /\ dres' = [dres EXCEPT ![self] = "unknown"] + /\ pc' = [pc EXCEPT ![self] = "d_end"] + /\ UNCHANGED << head, volume, volCreates, names, snaps, + intents, pending, stored, nextChunk, hostOps, + reads, dnErr, markedBy, badMark, badCommit, + badCommitAny, acked, idReuse, sres, fres, + dtoks, stack, dn, why, datt, dtries, myCh, + myAtt, outc, fch, xn, xatt, saw, run, tok, h0 >> + +d_branch(self) == /\ pc[self] = "d_branch" + /\ IF h0[self] \in {"purging", "deleted"} + THEN /\ pc' = [pc EXCEPT ![self] = "d_admcommit"] + ELSE /\ pc' = [pc EXCEPT ![self] = "d_mark"] + /\ UNCHANGED << head, volume, volCreates, names, snaps, + intents, pending, stored, nextChunk, hostOps, + resv, reads, dnErr, markedBy, badMark, + badCommit, badCommitAny, acked, idReuse, + sres, fres, dres, dtoks, stack, dn, why, + datt, dtries, myCh, myAtt, outc, fch, xn, + xatt, saw, run, tok, h0 >> + +d_mark(self) == /\ pc[self] = "d_mark" + /\ IF head["P"].st \in {"deleting", "purging", "deleted"} + THEN /\ TRUE + /\ pc' = [pc EXCEPT ![self] = "d_claims"] + /\ UNCHANGED << head, dres >> + ELSE /\ IF head["P"].st = "held" + THEN /\ dres' = [dres EXCEPT ![self] = "in_use"] + /\ pc' = [pc EXCEPT ![self] = "d_abort"] + /\ head' = head + ELSE /\ head' = [head EXCEPT !["P"] = [head["P"] EXCEPT !.st = "deleting", !.gen = @ + 1]] + /\ pc' = [pc EXCEPT ![self] = "d_claims"] + /\ dres' = dres + /\ UNCHANGED << volume, volCreates, names, snaps, intents, + pending, stored, nextChunk, hostOps, resv, + reads, dnErr, markedBy, badMark, badCommit, + badCommitAny, acked, idReuse, sres, fres, + dtoks, stack, dn, why, datt, dtries, myCh, + myAtt, outc, fch, xn, xatt, saw, run, tok, h0 >> + +d_claims(self) == /\ pc[self] = "d_claims" + /\ IF \E p \in AttPaths : Named(p) /\ snaps[p].st = "active" /\ LiveClaim(p) + THEN /\ pc' = [pc EXCEPT ![self] = "d_revert"] + ELSE /\ pc' = [pc EXCEPT ![self] = "d_commit"] + /\ UNCHANGED << head, volume, volCreates, names, snaps, + intents, pending, stored, nextChunk, hostOps, + resv, reads, dnErr, markedBy, badMark, + badCommit, badCommitAny, acked, idReuse, + sres, fres, dres, dtoks, stack, dn, why, + datt, dtries, myCh, myAtt, outc, fch, xn, + xatt, saw, run, tok, h0 >> + +d_revert(self) == /\ pc[self] = "d_revert" + /\ IF head["P"].st # "deleting" + THEN /\ IF head["P"].st \in {"held", "detached"} + THEN /\ dres' = [dres EXCEPT ![self] = "refused_claimed"] + /\ pc' = [pc EXCEPT ![self] = "d_abort"] + ELSE /\ dres' = [dres EXCEPT ![self] = "unknown"] + /\ pc' = [pc EXCEPT ![self] = "d_end"] + /\ head' = head + ELSE /\ head' = [head EXCEPT !["P"] = [head["P"] EXCEPT !.st = "detached", !.gen = @ + 1]] + /\ dres' = [dres EXCEPT ![self] = "refused_claimed"] + /\ pc' = [pc EXCEPT ![self] = "d_abort"] + /\ UNCHANGED << volume, volCreates, names, snaps, intents, + pending, stored, nextChunk, hostOps, resv, + reads, dnErr, markedBy, badMark, badCommit, + badCommitAny, acked, idReuse, sres, fres, + dtoks, stack, dn, why, datt, dtries, myCh, + myAtt, outc, fch, xn, xatt, saw, run, tok, + h0 >> + +d_commit(self) == /\ pc[self] = "d_commit" + /\ IF head["P"].st \in {"purging", "deleted"} + THEN /\ TRUE + /\ pc' = [pc EXCEPT ![self] = "d_admcommit"] + /\ UNCHANGED << head, badCommit, badCommitAny, + dres >> + ELSE /\ IF head["P"].st = "deleting" + THEN /\ head' = [head EXCEPT !["P"] = [head["P"] EXCEPT !.st = "purging", !.gen = @ + 1]] + /\ badCommit' = (badCommit \/ CommitUnsafe) + /\ badCommitAny' = (badCommitAny \/ CommitAnyClaim) + /\ pc' = [pc EXCEPT ![self] = "d_admcommit"] + /\ dres' = dres + ELSE /\ dres' = [dres EXCEPT ![self] = "givenback_by_other"] + /\ pc' = [pc EXCEPT ![self] = "d_abort"] + /\ UNCHANGED << head, badCommit, + badCommitAny >> + /\ UNCHANGED << volume, volCreates, names, snaps, intents, + pending, stored, nextChunk, hostOps, resv, + reads, dnErr, markedBy, badMark, acked, + idReuse, sres, fres, dtoks, stack, dn, why, + datt, dtries, myCh, myAtt, outc, fch, xn, + xatt, saw, run, tok, h0 >> + +d_admcommit(self) == /\ pc[self] = "d_admcommit" + /\ resv' = [resv EXCEPT !.st = "committed"] + /\ pc' = [pc EXCEPT ![self] = "d_cascade_m"] + /\ UNCHANGED << head, volume, volCreates, names, snaps, + intents, pending, stored, nextChunk, + hostOps, reads, dnErr, markedBy, badMark, + badCommit, badCommitAny, acked, idReuse, + sres, fres, dres, dtoks, stack, dn, why, + datt, dtries, myCh, myAtt, outc, fch, xn, + xatt, saw, run, tok, h0 >> + +d_cascade_m(self) == /\ pc[self] = "d_cascade_m" + /\ IF names["M"] # NoAtt + THEN /\ /\ dn' = [dn EXCEPT ![self] = "M"] + /\ stack' = [stack EXCEPT ![self] = << [ procedure |-> "DeleteName", + pc |-> "d_cascade_n", + datt |-> datt[self], + dtries |-> dtries[self], + dn |-> dn[self], + why |-> why[self] ] >> + \o stack[self]] + /\ why' = [why EXCEPT ![self] = "cascade"] + /\ datt' = [datt EXCEPT ![self] = NoAtt] + /\ dtries' = [dtries EXCEPT ![self] = 0] + /\ pc' = [pc EXCEPT ![self] = "dn_resolve"] + ELSE /\ pc' = [pc EXCEPT ![self] = "d_cascade_n"] + /\ UNCHANGED << stack, dn, why, datt, dtries >> + /\ UNCHANGED << head, volume, volCreates, names, snaps, + intents, pending, stored, nextChunk, + hostOps, resv, reads, dnErr, markedBy, + badMark, badCommit, badCommitAny, acked, + idReuse, sres, fres, dres, dtoks, myCh, + myAtt, outc, fch, xn, xatt, saw, run, tok, + h0 >> + +d_cascade_n(self) == /\ pc[self] = "d_cascade_n" + /\ IF dnErr[self] + THEN /\ dres' = [dres EXCEPT ![self] = "error"] + /\ pc' = [pc EXCEPT ![self] = "d_end"] + /\ UNCHANGED << stack, dn, why, datt, dtries >> + ELSE /\ IF names["N"] # NoAtt + THEN /\ /\ dn' = [dn EXCEPT ![self] = "N"] + /\ stack' = [stack EXCEPT ![self] = << [ procedure |-> "DeleteName", + pc |-> "d_finish", + datt |-> datt[self], + dtries |-> dtries[self], + dn |-> dn[self], + why |-> why[self] ] >> + \o stack[self]] + /\ why' = [why EXCEPT ![self] = "cascade"] + /\ datt' = [datt EXCEPT ![self] = NoAtt] + /\ dtries' = [dtries EXCEPT ![self] = 0] + /\ pc' = [pc EXCEPT ![self] = "dn_resolve"] + ELSE /\ pc' = [pc EXCEPT ![self] = "d_finish"] + /\ UNCHANGED << stack, dn, why, + datt, dtries >> + /\ dres' = dres + /\ UNCHANGED << head, volume, volCreates, names, snaps, + intents, pending, stored, nextChunk, + hostOps, resv, reads, dnErr, markedBy, + badMark, badCommit, badCommitAny, acked, + idReuse, sres, fres, dtoks, myCh, myAtt, + outc, fch, xn, xatt, saw, run, tok, h0 >> + +d_finish(self) == /\ pc[self] = "d_finish" + /\ IF dnErr[self] + THEN /\ dres' = [dres EXCEPT ![self] = "error"] + /\ pc' = [pc EXCEPT ![self] = "d_end"] + /\ head' = head + ELSE /\ IF head["P"].st = "purging" + THEN /\ head' = [head EXCEPT !["P"] = [st |-> "deleted", gen |-> head["P"].gen + 1, ch |-> {}]] + /\ pc' = [pc EXCEPT ![self] = "d_volmark"] + /\ dres' = dres + ELSE /\ IF head["P"].st # "deleted" + THEN /\ dres' = [dres EXCEPT ![self] = "error"] + /\ pc' = [pc EXCEPT ![self] = "d_end"] + ELSE /\ pc' = [pc EXCEPT ![self] = "d_volmark"] + /\ dres' = dres + /\ head' = head + /\ UNCHANGED << volume, volCreates, names, snaps, intents, + pending, stored, nextChunk, hostOps, resv, + reads, dnErr, markedBy, badMark, badCommit, + badCommitAny, acked, idReuse, sres, fres, + dtoks, stack, dn, why, datt, dtries, myCh, + myAtt, outc, fch, xn, xatt, saw, run, tok, + h0 >> + +d_volmark(self) == /\ pc[self] = "d_volmark" + /\ volume' = [volume EXCEPT !["P"] = "deleted"] + /\ dres' = [dres EXCEPT ![self] = "completed"] + /\ pc' = [pc EXCEPT ![self] = "d_end"] + /\ UNCHANGED << head, volCreates, names, snaps, intents, + pending, stored, nextChunk, hostOps, resv, + reads, dnErr, markedBy, badMark, badCommit, + badCommitAny, acked, idReuse, sres, fres, + dtoks, stack, dn, why, datt, dtries, myCh, + myAtt, outc, fch, xn, xatt, saw, run, tok, + h0 >> + +d_abort(self) == /\ pc[self] = "d_abort" + /\ IF resv.st = "committed" + THEN /\ dres' = [dres EXCEPT ![self] = "unknown"] + /\ resv' = resv + ELSE /\ IF resv.toks \ {tok[self]} = {} + THEN /\ resv' = [st |-> "none", toks |-> {}] + ELSE /\ resv' = [resv EXCEPT !.toks = resv.toks \ {tok[self]}] + /\ dres' = dres + /\ pc' = [pc EXCEPT ![self] = "d_end"] + /\ UNCHANGED << head, volume, volCreates, names, snaps, + intents, pending, stored, nextChunk, hostOps, + reads, dnErr, markedBy, badMark, badCommit, + badCommitAny, acked, idReuse, sres, fres, + dtoks, stack, dn, why, datt, dtries, myCh, + myAtt, outc, fch, xn, xatt, saw, run, tok, h0 >> + +d_end(self) == /\ pc[self] = "d_end" + /\ IF dres[self] = "unknown" /\ run[self] < MaxRuns + THEN /\ run' = [run EXCEPT ![self] = run[self] + 1] + /\ pc' = [pc EXCEPT ![self] = "d_read"] + ELSE /\ pc' = [pc EXCEPT ![self] = "Done"] + /\ run' = run + /\ UNCHANGED << head, volume, volCreates, names, snaps, intents, + pending, stored, nextChunk, hostOps, resv, + reads, dnErr, markedBy, badMark, badCommit, + badCommitAny, acked, idReuse, sres, fres, dres, + dtoks, stack, dn, why, datt, dtries, myCh, + myAtt, outc, fch, xn, xatt, saw, tok, h0 >> + +Del(self) == d_read(self) \/ d_admit(self) \/ d_branch(self) + \/ d_mark(self) \/ d_claims(self) \/ d_revert(self) + \/ d_commit(self) \/ d_admcommit(self) \/ d_cascade_m(self) + \/ d_cascade_n(self) \/ d_finish(self) \/ d_volmark(self) + \/ d_abort(self) \/ d_end(self) + +Next == Host \/ GC + \/ (\E self \in ProcSet: DeleteName(self)) + \/ (\E self \in SnapCallers: Snap(self)) + \/ (\E self \in ForkIds: Fork(self)) + \/ (\E self \in DelSnapIds: DelSnap(self)) + \/ (\E self \in CreateIds: Create(self)) + \/ (\E self \in Deleters: Del(self)) + +Spec == Init /\ [][Next]_vars + +\* END TRANSLATION + +----------------------------------------------------------------------------- +(* Invariants *) + +TypeOK == + /\ \A v \in Vols : head[v].st \in {"none", "held", "detached", "active", "deleting", "purging", "deleted", "aborted"} + /\ stored \subseteq Chunks + /\ resv.st \in {"none", "admitted", "committed"} + /\ \A p \in AttPaths : snaps[p].st \in {"none", "active", "deleting", "aborted"} + +\* GC never deletes a chunk reachable from a live HEAD, a non-deleted snapshot or an intent. +GCSafe == + (UNION {head[v].ch : v \in Vols} + \cup UNION {snaps[p].ch : p \in {q \in AttPaths : snaps[q].st = "active"}} + \cup UNION {i.keys : i \in intents}) \subseteq stored + +\* (P1, short form) a published snapshot is marked deleting only by an explicit +\* DeleteSnapshot, or by the volume delete once it has committed (dfbf727 cascades). +NoProvisionalSnapMark == ~badMark + +\* (P1, the end state found in review) a snapshot a caller was told succeeded is not lost to +\* the volume delete's cleanup while the volume is usable again (delete given back). +AckedKeptAfterGiveBack == + \A p \in acked : markedBy[p] \in {"backout", "cascade"} => head["P"].st \notin {"held", "detached"} + +\* (P1, data) its chunks survive GC unless explicitly deleted or the volume committed. +AckedChunksSurvive == + \A p \in acked : markedBy[p] = "explicit" \/ Committed \/ snaps[p].ch \subseteq stored + +\* (P2) volume delete never commits purging while a fork that passed its source +\* check (so it will not back out) holds a live claim. +CommitWithoutLiveClaim == ~badCommit +\* literal form: no live claim at all at the commit (a fork that claims after the +\* delete's check and then backs out on the mark violates this; benign) +CommitWithoutAnyClaim == ~badCommitAny + +\* volume ids are never reused (catalog VOLUME, and blockmaster records of a reserved id). +NoIdReuse == (\A v \in Vols : volCreates[v] <= 1) /\ ~idReuse + +\* (P2, CLI token) a delete that reports a give-back holds no reservation token. +GiveBackReleases == + \A d \in Deleters : (pc[d] = "Done" /\ dres[d] \in GaveBack) => dtoks[d] \cap resv.toks = {} + +\* No HEAD moves out of purging or deleted; tombstones and deleted VOLUMEs are permanent. +HeadMonotone == + [][ /\ (head["P"].st \in {"purging", "deleted"} => head'["P"].st \in {"purging", "deleted"}) + /\ (head["P"].st = "deleted" => head'["P"].st = "deleted") + /\ (head["F"].st = "aborted" => head'["F"].st = "aborted") + /\ (volume["P"] = "deleted" => volume'["P"] = "deleted") + /\ \A p \in AttPaths : snaps[p].st = "aborted" => snaps'[p].st = "aborted" ]_vars + +\* ---- reachability witnesses: each is EXPECTED to be violated (proves the +\* model is not vacuous); run with cfg/*_reach*.cfg ---- +W_NeverDeleted == head["P"].st # "deleted" +W_NoForkThenDelete == ~(head["F"].st = "active" /\ head["P"].st = "deleted") +W_NoAckThenDelete == ~(acked # {} /\ head["P"].st = "deleted") +W_NoRefusalThenDelete == ~(head["P"].st = "deleted" /\ \E d \in Deleters : dres[d] \in GaveBack) +W_NoGCReclaim == \A c \in {"c1"} \cup {ChunkOf(i) : i \in 2..(nextChunk - 1)} : c \in stored + +Symm == Permutations(SnapCallers) \cup Permutations(Deleters) +============================================================================= diff --git a/seaweed-block/docs/spec/ChunkLifecycleFixed.tla b/seaweed-block/docs/spec/ChunkLifecycleFixed.tla new file mode 100644 index 0000000000..acfacee78c --- /dev/null +++ b/seaweed-block/docs/spec/ChunkLifecycleFixed.tla @@ -0,0 +1,1159 @@ +------------------------- MODULE ChunkLifecycleFixed ------------------------- +(***************************************************************************) +(* sw-block chunk-layer lifecycle with the FIX for PR #152: *) +(* - volume delete never touches snapshots: it REFUSES with *) +(* volume_has_snapshots while any snapshot name record exists *) +(* (published, being deleted, or an attempt in flight); *) +(* - mark HEAD deleting first (Snapshot/Fork then refuse), check under *) +(* that deletion incarnation (the HEAD gen the mark produced/joined), *) +(* and commit purging only if the incarnation is unchanged; a revert is *) +(* bound the same way; *) +(* - plus the side fixes in the same commit: the delete token is the *) +(* operation's request id, CreateVolume keeps workspaceMu. *) +(* Pinned to 765e7226 (PR #152 branch; merged with main 5c29382 as *) +(* 19e2c531). Same environment as ChunkLifecycle.tla. *) +(***************************************************************************) +EXTENDS Integers, FiniteSets, Sequences, TLC + +CONSTANTS + SnapCallers, Deleters, ForkOn, DelSnapOn, CreateOn, + MaxHostOps, MaxRuns, LostReply, PendingOn, SweepOn + +NoAtt == "-" +Vols == {"P", "F"} +Names == {"M", "N"} +MP == <<"M", "m0">> +AttPaths == {MP} \cup {<<"N", s>> : s \in SnapCallers} +Chunks == {"c1", "c2", "c3"} +ChunkOf(i) == IF i = 2 THEN "c2" ELSE "c3" +ForkIds == IF ForkOn THEN {"fork"} ELSE {} +DelSnapIds == IF DelSnapOn THEN {"xM", "xN"} ELSE {} \* one explicit DeleteSnapshot caller per name +CreateIds == IF CreateOn THEN {"create"} ELSE {} +ReaderIds == SnapCallers \cup ForkIds +GaveBack == {"refused_snapshots", "in_use", "givenback_by_other"} +EmptySnap == [st |-> "none", ch |-> {}, claims |-> {}, exp |-> FALSE] +MaxIncarnations == 5 \* volume_delete.go:149 + +(* --algorithm ChunkLifecycleFixed +variables + head = [v \in Vols |-> IF v = "P" THEN [st |-> "held", gen |-> 1, ch |-> {"c1"}] + ELSE [st |-> "none", gen |-> 0, ch |-> {}]], + volume = [v \in Vols |-> IF v = "P" THEN "live" ELSE "none"], + volCreates = [v \in Vols |-> IF v = "P" THEN 1 ELSE 0], + names = [n \in Names |-> IF n = "M" THEN "m0" ELSE NoAtt], + snaps = [p \in AttPaths |-> IF p = MP + THEN [st |-> "active", ch |-> {"c1"}, claims |-> {}, exp |-> FALSE] + ELSE EmptySnap], + intents = {}, + pending = {}, + stored = {"c1"}, + nextChunk = 2, + hostOps = 0, + resv = [st |-> "none", toks |-> {}], + reads = [r \in ReaderIds |-> {}], + snapAtt = [s \in SnapCallers |-> NoAtt], \* copy of each caller's attempt, for CommitClean + \* ---- history / outcome variables ---- + markedBy = [p \in AttPaths |-> "none"], + badCommit = FALSE, \* commit while a snapshot, an attempt or a fork claim could still matter + badPub = FALSE, \* a snapshot published (attempt path none -> active) after P's delete committed + acked = {}, + idReuse = FALSE, + sres = [s \in SnapCallers |-> "none"], + fres = "none", + dres = [d \in Deleters |-> "none"], + dtoks = [d \in Deleters |-> {}]; + +define + Gone == volume["P"] = "deleted" \/ head["P"].st \in {"deleting", "purging", "deleted"} + Named(p) == names[p[1]] = p[2] + LiveClaim(p) == \E c \in snaps[p].claims : head["F"].st = "none" + Committed == head["P"].st \in {"purging", "deleted"} + SnapRoot(p) == snaps[p].st = "active" \/ (snaps[p].st = "deleting" /\ (Named(p) \/ ~snaps[p].exp)) + AllRoots == UNION {head[v].ch : v \in Vols} + \cup UNION {snaps[p].ch : p \in {q \in AttPaths : SnapRoot(q)}} + \cup UNION {i.keys : i \in intents} + \cup UNION {reads[r] : r \in ReaderIds} + \* a snapshot caller that passed its volumeGone gate and may still publish + PastSnapGate == {"s_intent", "s_create"} + \* the refusal rule: at the commit there must be no fork claim at all, no + \* snapshot that is published or being deleted under its name, no attempt + \* past its gate that can still publish (its path not yet tombstoned), and + \* no uncancellable create that can still land + CommitUnsafe == + \/ \E p \in AttPaths : snaps[p].claims # {} /\ LiveClaim(p) + \/ \E p \in AttPaths : snaps[p].st = "active" + \/ \E p \in AttPaths : Named(p) /\ snaps[p].st = "deleting" + \/ \E s \in SnapCallers : pc[s] \in PastSnapGate /\ snaps[<<"N", snapAtt[s]>>].st = "none" + \/ \E x \in pending : snaps[x.path].st = "none" +end define; + +\* ---------------- volume server of P ---------------- +process Host = "host" +begin +h_loop: + while hostOps < MaxHostOps do + either + await head["P"].st = "held" /\ nextChunk <= 3; + stored := stored \cup {ChunkOf(nextChunk)}; + head["P"] := [head["P"] EXCEPT !.ch = {ChunkOf(nextChunk)}, !.gen = @ + 1]; + nextChunk := nextChunk + 1; + or + await head["P"].st = "held"; + head["P"] := [head["P"] EXCEPT !.st = "detached", !.gen = @ + 1]; + or + await head["P"].st = "detached" /\ resv.st = "none"; + head["P"] := [head["P"] EXCEPT !.st = "held", !.gen = @ + 1]; + end either; + hostOps := hostOps + 1; + end while; +end process; + +\* ---------------- GC, copy sweep, late creates ---------------- +process GC = "gc" +begin +g_loop: + while TRUE do + either + await stored \ AllRoots # {}; + stored := stored \cap AllRoots; + or + with p \in {q \in AttPaths : snaps[q].st = "deleting" /\ ~Named(q) /\ ~snaps[q].exp} do + snaps[p].exp := TRUE; + end with; + or + with x \in pending do + if snaps[x.path].st = "none" then + snaps[x.path] := [st |-> "active", ch |-> x.ch, claims |-> {}, exp |-> FALSE]; + badPub := badPub \/ Committed; + end if; + pending := pending \ {x}; + end with; + or + await SweepOn; + with i \in {j \in intents : j.vol = "P"} do + if snaps[<<"N", i.att>>].st = "none" then + snaps[<<"N", i.att>>] := [EmptySnap EXCEPT !.st = "aborted"]; + end if; + intents := intents \ {i}; + end with; + or + await SweepOn; + with i \in {j \in intents : j.vol = "F"} do + if head["F"].st = "none" then + head["F"] := [st |-> "aborted", gen |-> 1, ch |-> {}]; + end if; + intents := intents \ {i}; + end with; + end either; + end while; +end process; + +\* ---------------- snapshot callers of P/N ---------------- +process Snap \in SnapCallers +variables myCh = {}, myAtt = NoAtt, outc = "none"; +begin +s_cut: + if head["P"].st = "held" then + myCh := head["P"].ch; + reads[self] := head["P"].ch; + head["P"].gen := head["P"].gen + 1; + else + sres[self] := "closing"; goto s_done; + end if; +s_replay: \* catalog.go:824 SnapshotReplay + if names["N"] # NoAtt /\ snaps[<<"N", names["N"]>>].st \in {"active", "deleting"} then + acked := acked \cup {<<"N", names["N"]>>}; + sres[self] := "replayed"; goto s_done; + elsif names["N"] # NoAtt /\ snaps[<<"N", names["N"]>>].st = "aborted" then + sres[self] := "exists"; goto s_done; + end if; +s_claim: \* catalog.go:843 claimName + if names["N"] = NoAtt then + names["N"] := self; myAtt := self; snapAtt[self] := self; + else + myAtt := names["N"]; snapAtt[self] := names["N"]; + end if; +s_gone: \* catalog.go:854-858: refuse, leave the name alone + if Gone then + sres[self] := "volume_deleted"; goto s_done; + end if; +s_intent: \* catalog.go:888 putIntent + intents := intents \cup {[vol |-> "P", own |-> self, att |-> myAtt, keys |-> myCh]}; +s_create: \* catalog.go:900 createResolved + either + if snaps[<<"N", myAtt>>].st = "none" then + snaps[<<"N", myAtt>>] := [st |-> "active", ch |-> myCh, claims |-> {}, exp |-> FALSE]; + badPub := badPub \/ Committed; + outc := "created"; + elsif snaps[<<"N", myAtt>>].st \in {"active", "deleting"} then + outc := "created"; + else + outc := "exists"; + end if; + or + await PendingOn; + pending := pending \cup {[path |-> <<"N", myAtt>>, ch |-> myCh]}; + outc := "unknown"; + end either; +s_drop: + if outc # "unknown" then + intents := {i \in intents : i.own # self}; + end if; + if outc = "created" then + acked := acked \cup {<<"N", myAtt>>}; + end if; + sres[self] := outc; +s_done: + reads[self] := {}; +end process; + +\* ---------------- fork F <- P/M (unchanged by the fix) ---------------- +process Fork \in ForkIds +variables fch = {}; +begin +f_target: + if volume["F"] = "deleted" then fres := "volume_deleted"; goto f_done; end if; +f_claim: \* catalog.go:1314 claimForkParent + if names["M"] = NoAtt \/ snaps[MP].st \in {"none", "aborted"} then + fres := "not_found"; goto f_done; + elsif snaps[MP].st = "deleting" then + fres := "snapshot_deleting"; goto f_done; + else + snaps[MP].claims := snaps[MP].claims \cup {"F"}; + fch := snaps[MP].ch; + reads[self] := snaps[MP].ch; + end if; +f_gone: \* catalog.go:1206 volumeGone(source) + if Gone then goto f_dropgone; end if; +f_vol: + if volume["F"] = "none" then + volume["F"] := "live"; + volCreates["F"] := volCreates["F"] + 1; + end if; +f_intent: + intents := intents \cup {[vol |-> "F", own |-> self, att |-> NoAtt, keys |-> fch]}; +f_head: \* catalog.go:1282 exclusive HEAD create + if head["F"].st = "none" then + head["F"] := [st |-> "active", gen |-> 1, ch |-> fch]; + fres := "ok"; + else + fres := "lost"; + end if; +f_dropintent: + intents := {i \in intents : i.own # self}; +f_dropclaim: \* catalog.go:1364 removeForkClaim + snaps[MP].claims := snaps[MP].claims \ {"F"}; + goto f_done; +f_dropgone: + snaps[MP].claims := snaps[MP].claims \ {"F"}; + fres := "volume_deleted"; +f_done: + reads[self] := {}; +end process; + +\* ---------------- explicit DeleteSnapshot (catalog.go:1049-1098) ---------------- +process DelSnap \in DelSnapIds +variables xn = "M", xatt = NoAtt; +begin +x_pick: + xn := IF self = "xM" THEN "M" ELSE "N"; +x_resolve: + if names[xn] = NoAtt then + goto x_done; + else + xatt := names[xn]; + if snaps[<>].st = "none" then goto x_tomb; + elsif snaps[<>].st = "active" then goto x_mark; + else goto x_free; + end if; + end if; +x_tomb: + if snaps[<>].st = "none" then + snaps[<>] := [EmptySnap EXCEPT !.st = "aborted"]; + end if; + goto x_resolve; +x_mark: \* retention.go markDeleting (unchanged) + if snaps[<>].st # "active" then + goto x_free; + elsif LiveClaim(<>) then + goto x_done; + elsif snaps[<>].claims # {} then + snaps[<>].claims := {}; + goto x_mark; + else + snaps[<>].st := "deleting"; + markedBy[<>] := "explicit"; + end if; +x_free: + if names[xn] = xatt then names[xn] := NoAtt; end if; +x_done: + skip; +end process; + +\* ---------------- blockmaster CreateVolume, workspaceMu held through the create ---------------- +process Create \in CreateIds +begin +c_create: \* services.go:64-73 at 765e7226 + if resv.st = "none" then idReuse := idReuse \/ resv.st # "none"; end if; +end process; + +\* ---------------- volume delete of P (volume_delete.go:104-224 at 765e7226) ---------------- +process Del \in Deleters +variables run = 1, tok = <<>>, hst = "", mygen = 0, inc = 0; +begin +d_read: \* :110-121; chunk_volume_delete.go: token = --request-id + hst := head["P"].st; + inc := 0; + tok := self; + dtoks[self] := {self}; +d_admit: \* :125 Admit + if head["P"].st = "held" then + dres[self] := "not_admitted"; goto d_end; + else + resv := [st |-> IF resv.st = "committed" THEN "committed" ELSE "admitted", + toks |-> resv.toks \cup {tok}]; + either skip; + or await LostReply; dres[self] := "unknown"; goto d_end; + end either; + end if; +d_loop: \* :148 for incarnation ...; h.State not purging/deleted + if hst \in {"purging", "deleted"} then goto d_admcommit; + elsif inc = MaxIncarnations then dres[self] := "error"; goto d_end; + end if; +d_mark: \* :152 markHeadDeleting (265-305): produce or join an incarnation + if head["P"].st \in {"deleting", "purging", "deleted"} then + mygen := head["P"].gen; + elsif head["P"].st = "held" then + dres[self] := "in_use"; goto d_abort; + else + mygen := head["P"].gen + 1; \* the gen this write produces (volume_delete.go:292) + head["P"] := [head["P"] EXCEPT !.st = "deleting", !.gen = @ + 1]; + end if; +d_check: \* :163 snapshotsBlock (396-406): one listing of snapnames + if \E n \in Names : names[n] # NoAtt then goto d_revert; else goto d_commit; end if; +d_revert: \* :169 revertHeadDeleting(gen) (310-339) + if head["P"].st \in {"purging", "deleted"} then + dres[self] := "unknown"; goto d_end; \* incarnationCommitted + elsif head["P"].st # "deleting" then + dres[self] := "refused_snapshots"; goto d_abort; \* incarnationGivenBack + elsif head["P"].gen # mygen then + goto d_reread; \* incarnationMoved + else + head["P"] := [head["P"] EXCEPT !.st = "detached", !.gen = @ + 1]; + dres[self] := "refused_snapshots"; goto d_abort; + end if; +d_commit: \* :189 commitHeadPurging(gen) (343-366) + if head["P"].st \in {"purging", "deleted"} then + goto d_admcommit; \* incarnationDone + elsif head["P"].st # "deleting" then + dres[self] := "givenback_by_other"; goto d_abort; + elsif head["P"].gen # mygen then + goto d_reread; \* moved: validate again + else + head["P"] := [head["P"] EXCEPT !.st = "purging", !.gen = @ + 1]; + badCommit := badCommit \/ CommitUnsafe; + goto d_admcommit; + end if; +d_reread: \* :176-178 / :199-201 ReadHead, next incarnation + hst := head["P"].st; + inc := inc + 1; + goto d_loop; +d_admcommit: \* :207 Admission.Commit + resv.st := "committed"; +d_finish: \* :214 finishHeadDeleted + if head["P"].st = "purging" then + head["P"] := [st |-> "deleted", gen |-> head["P"].gen + 1, ch |-> {}]; + elsif head["P"].st # "deleted" then + dres[self] := "error"; goto d_end; + end if; +d_volmark: \* :218 markVolumeDeleted + volume["P"] := "deleted"; + dres[self] := "completed"; + goto d_end; +d_abort: \* :136 Admission.Abort + if resv.st = "committed" then + dres[self] := "unknown"; + elsif resv.toks \ {tok} = {} then + resv := [st |-> "none", toks |-> {}]; + else + resv.toks := resv.toks \ {tok}; + end if; +d_end: + if dres[self] = "unknown" /\ run < MaxRuns then + run := run + 1; + goto d_read; + end if; +end process; + +end algorithm; *) +\* BEGIN TRANSLATION +VARIABLES head, volume, volCreates, names, snaps, intents, pending, stored, + nextChunk, hostOps, resv, reads, snapAtt, markedBy, badCommit, + badPub, acked, idReuse, sres, fres, dres, dtoks, pc + +(* define statement *) +Gone == volume["P"] = "deleted" \/ head["P"].st \in {"deleting", "purging", "deleted"} +Named(p) == names[p[1]] = p[2] +LiveClaim(p) == \E c \in snaps[p].claims : head["F"].st = "none" +Committed == head["P"].st \in {"purging", "deleted"} +SnapRoot(p) == snaps[p].st = "active" \/ (snaps[p].st = "deleting" /\ (Named(p) \/ ~snaps[p].exp)) +AllRoots == UNION {head[v].ch : v \in Vols} + \cup UNION {snaps[p].ch : p \in {q \in AttPaths : SnapRoot(q)}} + \cup UNION {i.keys : i \in intents} + \cup UNION {reads[r] : r \in ReaderIds} + +PastSnapGate == {"s_intent", "s_create"} + + + + +CommitUnsafe == + \/ \E p \in AttPaths : snaps[p].claims # {} /\ LiveClaim(p) + \/ \E p \in AttPaths : snaps[p].st = "active" + \/ \E p \in AttPaths : Named(p) /\ snaps[p].st = "deleting" + \/ \E s \in SnapCallers : pc[s] \in PastSnapGate /\ snaps[<<"N", snapAtt[s]>>].st = "none" + \/ \E x \in pending : snaps[x.path].st = "none" + +VARIABLES myCh, myAtt, outc, fch, xn, xatt, run, tok, hst, mygen, inc + +vars == << head, volume, volCreates, names, snaps, intents, pending, stored, + nextChunk, hostOps, resv, reads, snapAtt, markedBy, badCommit, + badPub, acked, idReuse, sres, fres, dres, dtoks, pc, myCh, myAtt, + outc, fch, xn, xatt, run, tok, hst, mygen, inc >> + +ProcSet == {"host"} \cup {"gc"} \cup (SnapCallers) \cup (ForkIds) \cup (DelSnapIds) \cup (CreateIds) \cup (Deleters) + +Init == (* Global variables *) + /\ head = [v \in Vols |-> IF v = "P" THEN [st |-> "held", gen |-> 1, ch |-> {"c1"}] + ELSE [st |-> "none", gen |-> 0, ch |-> {}]] + /\ volume = [v \in Vols |-> IF v = "P" THEN "live" ELSE "none"] + /\ volCreates = [v \in Vols |-> IF v = "P" THEN 1 ELSE 0] + /\ names = [n \in Names |-> IF n = "M" THEN "m0" ELSE NoAtt] + /\ snaps = [p \in AttPaths |-> IF p = MP + THEN [st |-> "active", ch |-> {"c1"}, claims |-> {}, exp |-> FALSE] + ELSE EmptySnap] + /\ intents = {} + /\ pending = {} + /\ stored = {"c1"} + /\ nextChunk = 2 + /\ hostOps = 0 + /\ resv = [st |-> "none", toks |-> {}] + /\ reads = [r \in ReaderIds |-> {}] + /\ snapAtt = [s \in SnapCallers |-> NoAtt] + /\ markedBy = [p \in AttPaths |-> "none"] + /\ badCommit = FALSE + /\ badPub = FALSE + /\ acked = {} + /\ idReuse = FALSE + /\ sres = [s \in SnapCallers |-> "none"] + /\ fres = "none" + /\ dres = [d \in Deleters |-> "none"] + /\ dtoks = [d \in Deleters |-> {}] + (* Process Snap *) + /\ myCh = [self \in SnapCallers |-> {}] + /\ myAtt = [self \in SnapCallers |-> NoAtt] + /\ outc = [self \in SnapCallers |-> "none"] + (* Process Fork *) + /\ fch = [self \in ForkIds |-> {}] + (* Process DelSnap *) + /\ xn = [self \in DelSnapIds |-> "M"] + /\ xatt = [self \in DelSnapIds |-> NoAtt] + (* Process Del *) + /\ run = [self \in Deleters |-> 1] + /\ tok = [self \in Deleters |-> <<>>] + /\ hst = [self \in Deleters |-> ""] + /\ mygen = [self \in Deleters |-> 0] + /\ inc = [self \in Deleters |-> 0] + /\ pc = [self \in ProcSet |-> CASE self = "host" -> "h_loop" + [] self = "gc" -> "g_loop" + [] self \in SnapCallers -> "s_cut" + [] self \in ForkIds -> "f_target" + [] self \in DelSnapIds -> "x_pick" + [] self \in CreateIds -> "c_create" + [] self \in Deleters -> "d_read"] + +h_loop == /\ pc["host"] = "h_loop" + /\ IF hostOps < MaxHostOps + THEN /\ \/ /\ head["P"].st = "held" /\ nextChunk <= 3 + /\ stored' = (stored \cup {ChunkOf(nextChunk)}) + /\ head' = [head EXCEPT !["P"] = [head["P"] EXCEPT !.ch = {ChunkOf(nextChunk)}, !.gen = @ + 1]] + /\ nextChunk' = nextChunk + 1 + \/ /\ head["P"].st = "held" + /\ head' = [head EXCEPT !["P"] = [head["P"] EXCEPT !.st = "detached", !.gen = @ + 1]] + /\ UNCHANGED <> + \/ /\ head["P"].st = "detached" /\ resv.st = "none" + /\ head' = [head EXCEPT !["P"] = [head["P"] EXCEPT !.st = "held", !.gen = @ + 1]] + /\ UNCHANGED <> + /\ hostOps' = hostOps + 1 + /\ pc' = [pc EXCEPT !["host"] = "h_loop"] + ELSE /\ pc' = [pc EXCEPT !["host"] = "Done"] + /\ UNCHANGED << head, stored, nextChunk, hostOps >> + /\ UNCHANGED << volume, volCreates, names, snaps, intents, pending, + resv, reads, snapAtt, markedBy, badCommit, badPub, + acked, idReuse, sres, fres, dres, dtoks, myCh, myAtt, + outc, fch, xn, xatt, run, tok, hst, mygen, inc >> + +Host == h_loop + +g_loop == /\ pc["gc"] = "g_loop" + /\ \/ /\ stored \ AllRoots # {} + /\ stored' = (stored \cap AllRoots) + /\ UNCHANGED <> + \/ /\ \E p \in {q \in AttPaths : snaps[q].st = "deleting" /\ ~Named(q) /\ ~snaps[q].exp}: + snaps' = [snaps EXCEPT ![p].exp = TRUE] + /\ UNCHANGED <> + \/ /\ \E x \in pending: + /\ IF snaps[x.path].st = "none" + THEN /\ snaps' = [snaps EXCEPT ![x.path] = [st |-> "active", ch |-> x.ch, claims |-> {}, exp |-> FALSE]] + /\ badPub' = (badPub \/ Committed) + ELSE /\ TRUE + /\ UNCHANGED << snaps, badPub >> + /\ pending' = pending \ {x} + /\ UNCHANGED <> + \/ /\ SweepOn + /\ \E i \in {j \in intents : j.vol = "P"}: + /\ IF snaps[<<"N", i.att>>].st = "none" + THEN /\ snaps' = [snaps EXCEPT ![<<"N", i.att>>] = [EmptySnap EXCEPT !.st = "aborted"]] + ELSE /\ TRUE + /\ snaps' = snaps + /\ intents' = intents \ {i} + /\ UNCHANGED <> + \/ /\ SweepOn + /\ \E i \in {j \in intents : j.vol = "F"}: + /\ IF head["F"].st = "none" + THEN /\ head' = [head EXCEPT !["F"] = [st |-> "aborted", gen |-> 1, ch |-> {}]] + ELSE /\ TRUE + /\ head' = head + /\ intents' = intents \ {i} + /\ UNCHANGED <> + /\ pc' = [pc EXCEPT !["gc"] = "g_loop"] + /\ UNCHANGED << volume, volCreates, names, nextChunk, hostOps, resv, + reads, snapAtt, markedBy, badCommit, acked, idReuse, + sres, fres, dres, dtoks, myCh, myAtt, outc, fch, xn, + xatt, run, tok, hst, mygen, inc >> + +GC == g_loop + +s_cut(self) == /\ pc[self] = "s_cut" + /\ IF head["P"].st = "held" + THEN /\ myCh' = [myCh EXCEPT ![self] = head["P"].ch] + /\ reads' = [reads EXCEPT ![self] = head["P"].ch] + /\ head' = [head EXCEPT !["P"].gen = head["P"].gen + 1] + /\ pc' = [pc EXCEPT ![self] = "s_replay"] + /\ sres' = sres + ELSE /\ sres' = [sres EXCEPT ![self] = "closing"] + /\ pc' = [pc EXCEPT ![self] = "s_done"] + /\ UNCHANGED << head, reads, myCh >> + /\ UNCHANGED << volume, volCreates, names, snaps, intents, + pending, stored, nextChunk, hostOps, resv, + snapAtt, markedBy, badCommit, badPub, acked, + idReuse, fres, dres, dtoks, myAtt, outc, fch, + xn, xatt, run, tok, hst, mygen, inc >> + +s_replay(self) == /\ pc[self] = "s_replay" + /\ IF names["N"] # NoAtt /\ snaps[<<"N", names["N"]>>].st \in {"active", "deleting"} + THEN /\ acked' = (acked \cup {<<"N", names["N"]>>}) + /\ sres' = [sres EXCEPT ![self] = "replayed"] + /\ pc' = [pc EXCEPT ![self] = "s_done"] + ELSE /\ IF names["N"] # NoAtt /\ snaps[<<"N", names["N"]>>].st = "aborted" + THEN /\ sres' = [sres EXCEPT ![self] = "exists"] + /\ pc' = [pc EXCEPT ![self] = "s_done"] + ELSE /\ pc' = [pc EXCEPT ![self] = "s_claim"] + /\ sres' = sres + /\ acked' = acked + /\ UNCHANGED << head, volume, volCreates, names, snaps, + intents, pending, stored, nextChunk, hostOps, + resv, reads, snapAtt, markedBy, badCommit, + badPub, idReuse, fres, dres, dtoks, myCh, + myAtt, outc, fch, xn, xatt, run, tok, hst, + mygen, inc >> + +s_claim(self) == /\ pc[self] = "s_claim" + /\ IF names["N"] = NoAtt + THEN /\ names' = [names EXCEPT !["N"] = self] + /\ myAtt' = [myAtt EXCEPT ![self] = self] + /\ snapAtt' = [snapAtt EXCEPT ![self] = self] + ELSE /\ myAtt' = [myAtt EXCEPT ![self] = names["N"]] + /\ snapAtt' = [snapAtt EXCEPT ![self] = names["N"]] + /\ names' = names + /\ pc' = [pc EXCEPT ![self] = "s_gone"] + /\ UNCHANGED << head, volume, volCreates, snaps, intents, + pending, stored, nextChunk, hostOps, resv, + reads, markedBy, badCommit, badPub, acked, + idReuse, sres, fres, dres, dtoks, myCh, outc, + fch, xn, xatt, run, tok, hst, mygen, inc >> + +s_gone(self) == /\ pc[self] = "s_gone" + /\ IF Gone + THEN /\ sres' = [sres EXCEPT ![self] = "volume_deleted"] + /\ pc' = [pc EXCEPT ![self] = "s_done"] + ELSE /\ pc' = [pc EXCEPT ![self] = "s_intent"] + /\ sres' = sres + /\ UNCHANGED << head, volume, volCreates, names, snaps, + intents, pending, stored, nextChunk, hostOps, + resv, reads, snapAtt, markedBy, badCommit, + badPub, acked, idReuse, fres, dres, dtoks, + myCh, myAtt, outc, fch, xn, xatt, run, tok, + hst, mygen, inc >> + +s_intent(self) == /\ pc[self] = "s_intent" + /\ intents' = (intents \cup {[vol |-> "P", own |-> self, att |-> myAtt[self], keys |-> myCh[self]]}) + /\ pc' = [pc EXCEPT ![self] = "s_create"] + /\ UNCHANGED << head, volume, volCreates, names, snaps, + pending, stored, nextChunk, hostOps, resv, + reads, snapAtt, markedBy, badCommit, badPub, + acked, idReuse, sres, fres, dres, dtoks, + myCh, myAtt, outc, fch, xn, xatt, run, tok, + hst, mygen, inc >> + +s_create(self) == /\ pc[self] = "s_create" + /\ \/ /\ IF snaps[<<"N", myAtt[self]>>].st = "none" + THEN /\ snaps' = [snaps EXCEPT ![<<"N", myAtt[self]>>] = [st |-> "active", ch |-> myCh[self], claims |-> {}, exp |-> FALSE]] + /\ badPub' = (badPub \/ Committed) + /\ outc' = [outc EXCEPT ![self] = "created"] + ELSE /\ IF snaps[<<"N", myAtt[self]>>].st \in {"active", "deleting"} + THEN /\ outc' = [outc EXCEPT ![self] = "created"] + ELSE /\ outc' = [outc EXCEPT ![self] = "exists"] + /\ UNCHANGED << snaps, badPub >> + /\ UNCHANGED pending + \/ /\ PendingOn + /\ pending' = (pending \cup {[path |-> <<"N", myAtt[self]>>, ch |-> myCh[self]]}) + /\ outc' = [outc EXCEPT ![self] = "unknown"] + /\ UNCHANGED <> + /\ pc' = [pc EXCEPT ![self] = "s_drop"] + /\ UNCHANGED << head, volume, volCreates, names, intents, + stored, nextChunk, hostOps, resv, reads, + snapAtt, markedBy, badCommit, acked, idReuse, + sres, fres, dres, dtoks, myCh, myAtt, fch, + xn, xatt, run, tok, hst, mygen, inc >> + +s_drop(self) == /\ pc[self] = "s_drop" + /\ IF outc[self] # "unknown" + THEN /\ intents' = {i \in intents : i.own # self} + ELSE /\ TRUE + /\ UNCHANGED intents + /\ IF outc[self] = "created" + THEN /\ acked' = (acked \cup {<<"N", myAtt[self]>>}) + ELSE /\ TRUE + /\ acked' = acked + /\ sres' = [sres EXCEPT ![self] = outc[self]] + /\ pc' = [pc EXCEPT ![self] = "s_done"] + /\ UNCHANGED << head, volume, volCreates, names, snaps, + pending, stored, nextChunk, hostOps, resv, + reads, snapAtt, markedBy, badCommit, badPub, + idReuse, fres, dres, dtoks, myCh, myAtt, outc, + fch, xn, xatt, run, tok, hst, mygen, inc >> + +s_done(self) == /\ pc[self] = "s_done" + /\ reads' = [reads EXCEPT ![self] = {}] + /\ pc' = [pc EXCEPT ![self] = "Done"] + /\ UNCHANGED << head, volume, volCreates, names, snaps, + intents, pending, stored, nextChunk, hostOps, + resv, snapAtt, markedBy, badCommit, badPub, + acked, idReuse, sres, fres, dres, dtoks, myCh, + myAtt, outc, fch, xn, xatt, run, tok, hst, + mygen, inc >> + +Snap(self) == s_cut(self) \/ s_replay(self) \/ s_claim(self) + \/ s_gone(self) \/ s_intent(self) \/ s_create(self) + \/ s_drop(self) \/ s_done(self) + +f_target(self) == /\ pc[self] = "f_target" + /\ IF volume["F"] = "deleted" + THEN /\ fres' = "volume_deleted" + /\ pc' = [pc EXCEPT ![self] = "f_done"] + ELSE /\ pc' = [pc EXCEPT ![self] = "f_claim"] + /\ fres' = fres + /\ UNCHANGED << head, volume, volCreates, names, snaps, + intents, pending, stored, nextChunk, hostOps, + resv, reads, snapAtt, markedBy, badCommit, + badPub, acked, idReuse, sres, dres, dtoks, + myCh, myAtt, outc, fch, xn, xatt, run, tok, + hst, mygen, inc >> + +f_claim(self) == /\ pc[self] = "f_claim" + /\ IF names["M"] = NoAtt \/ snaps[MP].st \in {"none", "aborted"} + THEN /\ fres' = "not_found" + /\ pc' = [pc EXCEPT ![self] = "f_done"] + /\ UNCHANGED << snaps, reads, fch >> + ELSE /\ IF snaps[MP].st = "deleting" + THEN /\ fres' = "snapshot_deleting" + /\ pc' = [pc EXCEPT ![self] = "f_done"] + /\ UNCHANGED << snaps, reads, fch >> + ELSE /\ snaps' = [snaps EXCEPT ![MP].claims = snaps[MP].claims \cup {"F"}] + /\ fch' = [fch EXCEPT ![self] = snaps'[MP].ch] + /\ reads' = [reads EXCEPT ![self] = snaps'[MP].ch] + /\ pc' = [pc EXCEPT ![self] = "f_gone"] + /\ fres' = fres + /\ UNCHANGED << head, volume, volCreates, names, intents, + pending, stored, nextChunk, hostOps, resv, + snapAtt, markedBy, badCommit, badPub, acked, + idReuse, sres, dres, dtoks, myCh, myAtt, outc, + xn, xatt, run, tok, hst, mygen, inc >> + +f_gone(self) == /\ pc[self] = "f_gone" + /\ IF Gone + THEN /\ pc' = [pc EXCEPT ![self] = "f_dropgone"] + ELSE /\ pc' = [pc EXCEPT ![self] = "f_vol"] + /\ UNCHANGED << head, volume, volCreates, names, snaps, + intents, pending, stored, nextChunk, hostOps, + resv, reads, snapAtt, markedBy, badCommit, + badPub, acked, idReuse, sres, fres, dres, + dtoks, myCh, myAtt, outc, fch, xn, xatt, run, + tok, hst, mygen, inc >> + +f_vol(self) == /\ pc[self] = "f_vol" + /\ IF volume["F"] = "none" + THEN /\ volume' = [volume EXCEPT !["F"] = "live"] + /\ volCreates' = [volCreates EXCEPT !["F"] = volCreates["F"] + 1] + ELSE /\ TRUE + /\ UNCHANGED << volume, volCreates >> + /\ pc' = [pc EXCEPT ![self] = "f_intent"] + /\ UNCHANGED << head, names, snaps, intents, pending, stored, + nextChunk, hostOps, resv, reads, snapAtt, + markedBy, badCommit, badPub, acked, idReuse, + sres, fres, dres, dtoks, myCh, myAtt, outc, fch, + xn, xatt, run, tok, hst, mygen, inc >> + +f_intent(self) == /\ pc[self] = "f_intent" + /\ intents' = (intents \cup {[vol |-> "F", own |-> self, att |-> NoAtt, keys |-> fch[self]]}) + /\ pc' = [pc EXCEPT ![self] = "f_head"] + /\ UNCHANGED << head, volume, volCreates, names, snaps, + pending, stored, nextChunk, hostOps, resv, + reads, snapAtt, markedBy, badCommit, badPub, + acked, idReuse, sres, fres, dres, dtoks, + myCh, myAtt, outc, fch, xn, xatt, run, tok, + hst, mygen, inc >> + +f_head(self) == /\ pc[self] = "f_head" + /\ IF head["F"].st = "none" + THEN /\ head' = [head EXCEPT !["F"] = [st |-> "active", gen |-> 1, ch |-> fch[self]]] + /\ fres' = "ok" + ELSE /\ fres' = "lost" + /\ head' = head + /\ pc' = [pc EXCEPT ![self] = "f_dropintent"] + /\ UNCHANGED << volume, volCreates, names, snaps, intents, + pending, stored, nextChunk, hostOps, resv, + reads, snapAtt, markedBy, badCommit, badPub, + acked, idReuse, sres, dres, dtoks, myCh, myAtt, + outc, fch, xn, xatt, run, tok, hst, mygen, inc >> + +f_dropintent(self) == /\ pc[self] = "f_dropintent" + /\ intents' = {i \in intents : i.own # self} + /\ pc' = [pc EXCEPT ![self] = "f_dropclaim"] + /\ UNCHANGED << head, volume, volCreates, names, snaps, + pending, stored, nextChunk, hostOps, + resv, reads, snapAtt, markedBy, + badCommit, badPub, acked, idReuse, sres, + fres, dres, dtoks, myCh, myAtt, outc, + fch, xn, xatt, run, tok, hst, mygen, inc >> + +f_dropclaim(self) == /\ pc[self] = "f_dropclaim" + /\ snaps' = [snaps EXCEPT ![MP].claims = snaps[MP].claims \ {"F"}] + /\ pc' = [pc EXCEPT ![self] = "f_done"] + /\ UNCHANGED << head, volume, volCreates, names, intents, + pending, stored, nextChunk, hostOps, resv, + reads, snapAtt, markedBy, badCommit, + badPub, acked, idReuse, sres, fres, dres, + dtoks, myCh, myAtt, outc, fch, xn, xatt, + run, tok, hst, mygen, inc >> + +f_dropgone(self) == /\ pc[self] = "f_dropgone" + /\ snaps' = [snaps EXCEPT ![MP].claims = snaps[MP].claims \ {"F"}] + /\ fres' = "volume_deleted" + /\ pc' = [pc EXCEPT ![self] = "f_done"] + /\ UNCHANGED << head, volume, volCreates, names, intents, + pending, stored, nextChunk, hostOps, resv, + reads, snapAtt, markedBy, badCommit, + badPub, acked, idReuse, sres, dres, dtoks, + myCh, myAtt, outc, fch, xn, xatt, run, tok, + hst, mygen, inc >> + +f_done(self) == /\ pc[self] = "f_done" + /\ reads' = [reads EXCEPT ![self] = {}] + /\ pc' = [pc EXCEPT ![self] = "Done"] + /\ UNCHANGED << head, volume, volCreates, names, snaps, + intents, pending, stored, nextChunk, hostOps, + resv, snapAtt, markedBy, badCommit, badPub, + acked, idReuse, sres, fres, dres, dtoks, myCh, + myAtt, outc, fch, xn, xatt, run, tok, hst, + mygen, inc >> + +Fork(self) == f_target(self) \/ f_claim(self) \/ f_gone(self) + \/ f_vol(self) \/ f_intent(self) \/ f_head(self) + \/ f_dropintent(self) \/ f_dropclaim(self) + \/ f_dropgone(self) \/ f_done(self) + +x_pick(self) == /\ pc[self] = "x_pick" + /\ xn' = [xn EXCEPT ![self] = IF self = "xM" THEN "M" ELSE "N"] + /\ pc' = [pc EXCEPT ![self] = "x_resolve"] + /\ UNCHANGED << head, volume, volCreates, names, snaps, + intents, pending, stored, nextChunk, hostOps, + resv, reads, snapAtt, markedBy, badCommit, + badPub, acked, idReuse, sres, fres, dres, + dtoks, myCh, myAtt, outc, fch, xatt, run, tok, + hst, mygen, inc >> + +x_resolve(self) == /\ pc[self] = "x_resolve" + /\ IF names[xn[self]] = NoAtt + THEN /\ pc' = [pc EXCEPT ![self] = "x_done"] + /\ xatt' = xatt + ELSE /\ xatt' = [xatt EXCEPT ![self] = names[xn[self]]] + /\ IF snaps[<>].st = "none" + THEN /\ pc' = [pc EXCEPT ![self] = "x_tomb"] + ELSE /\ IF snaps[<>].st = "active" + THEN /\ pc' = [pc EXCEPT ![self] = "x_mark"] + ELSE /\ pc' = [pc EXCEPT ![self] = "x_free"] + /\ UNCHANGED << head, volume, volCreates, names, snaps, + intents, pending, stored, nextChunk, + hostOps, resv, reads, snapAtt, markedBy, + badCommit, badPub, acked, idReuse, sres, + fres, dres, dtoks, myCh, myAtt, outc, fch, + xn, run, tok, hst, mygen, inc >> + +x_tomb(self) == /\ pc[self] = "x_tomb" + /\ IF snaps[<>].st = "none" + THEN /\ snaps' = [snaps EXCEPT ![<>] = [EmptySnap EXCEPT !.st = "aborted"]] + ELSE /\ TRUE + /\ snaps' = snaps + /\ pc' = [pc EXCEPT ![self] = "x_resolve"] + /\ UNCHANGED << head, volume, volCreates, names, intents, + pending, stored, nextChunk, hostOps, resv, + reads, snapAtt, markedBy, badCommit, badPub, + acked, idReuse, sres, fres, dres, dtoks, myCh, + myAtt, outc, fch, xn, xatt, run, tok, hst, + mygen, inc >> + +x_mark(self) == /\ pc[self] = "x_mark" + /\ IF snaps[<>].st # "active" + THEN /\ pc' = [pc EXCEPT ![self] = "x_free"] + /\ UNCHANGED << snaps, markedBy >> + ELSE /\ IF LiveClaim(<>) + THEN /\ pc' = [pc EXCEPT ![self] = "x_done"] + /\ UNCHANGED << snaps, markedBy >> + ELSE /\ IF snaps[<>].claims # {} + THEN /\ snaps' = [snaps EXCEPT ![<>].claims = {}] + /\ pc' = [pc EXCEPT ![self] = "x_mark"] + /\ UNCHANGED markedBy + ELSE /\ snaps' = [snaps EXCEPT ![<>].st = "deleting"] + /\ markedBy' = [markedBy EXCEPT ![<>] = "explicit"] + /\ pc' = [pc EXCEPT ![self] = "x_free"] + /\ UNCHANGED << head, volume, volCreates, names, intents, + pending, stored, nextChunk, hostOps, resv, + reads, snapAtt, badCommit, badPub, acked, + idReuse, sres, fres, dres, dtoks, myCh, myAtt, + outc, fch, xn, xatt, run, tok, hst, mygen, inc >> + +x_free(self) == /\ pc[self] = "x_free" + /\ IF names[xn[self]] = xatt[self] + THEN /\ names' = [names EXCEPT ![xn[self]] = NoAtt] + ELSE /\ TRUE + /\ names' = names + /\ pc' = [pc EXCEPT ![self] = "x_done"] + /\ UNCHANGED << head, volume, volCreates, snaps, intents, + pending, stored, nextChunk, hostOps, resv, + reads, snapAtt, markedBy, badCommit, badPub, + acked, idReuse, sres, fres, dres, dtoks, myCh, + myAtt, outc, fch, xn, xatt, run, tok, hst, + mygen, inc >> + +x_done(self) == /\ pc[self] = "x_done" + /\ TRUE + /\ pc' = [pc EXCEPT ![self] = "Done"] + /\ UNCHANGED << head, volume, volCreates, names, snaps, + intents, pending, stored, nextChunk, hostOps, + resv, reads, snapAtt, markedBy, badCommit, + badPub, acked, idReuse, sres, fres, dres, + dtoks, myCh, myAtt, outc, fch, xn, xatt, run, + tok, hst, mygen, inc >> + +DelSnap(self) == x_pick(self) \/ x_resolve(self) \/ x_tomb(self) + \/ x_mark(self) \/ x_free(self) \/ x_done(self) + +c_create(self) == /\ pc[self] = "c_create" + /\ IF resv.st = "none" + THEN /\ idReuse' = (idReuse \/ resv.st # "none") + ELSE /\ TRUE + /\ UNCHANGED idReuse + /\ pc' = [pc EXCEPT ![self] = "Done"] + /\ UNCHANGED << head, volume, volCreates, names, snaps, + intents, pending, stored, nextChunk, hostOps, + resv, reads, snapAtt, markedBy, badCommit, + badPub, acked, sres, fres, dres, dtoks, myCh, + myAtt, outc, fch, xn, xatt, run, tok, hst, + mygen, inc >> + +Create(self) == c_create(self) + +d_read(self) == /\ pc[self] = "d_read" + /\ hst' = [hst EXCEPT ![self] = head["P"].st] + /\ inc' = [inc EXCEPT ![self] = 0] + /\ tok' = [tok EXCEPT ![self] = self] + /\ dtoks' = [dtoks EXCEPT ![self] = {self}] + /\ pc' = [pc EXCEPT ![self] = "d_admit"] + /\ UNCHANGED << head, volume, volCreates, names, snaps, + intents, pending, stored, nextChunk, hostOps, + resv, reads, snapAtt, markedBy, badCommit, + badPub, acked, idReuse, sres, fres, dres, myCh, + myAtt, outc, fch, xn, xatt, run, mygen >> + +d_admit(self) == /\ pc[self] = "d_admit" + /\ IF head["P"].st = "held" + THEN /\ dres' = [dres EXCEPT ![self] = "not_admitted"] + /\ pc' = [pc EXCEPT ![self] = "d_end"] + /\ resv' = resv + ELSE /\ resv' = [st |-> IF resv.st = "committed" THEN "committed" ELSE "admitted", + toks |-> resv.toks \cup {tok[self]}] + /\ \/ /\ TRUE + /\ pc' = [pc EXCEPT ![self] = "d_loop"] + /\ dres' = dres + \/ /\ LostReply + /\ dres' = [dres EXCEPT ![self] = "unknown"] + /\ pc' = [pc EXCEPT ![self] = "d_end"] + /\ UNCHANGED << head, volume, volCreates, names, snaps, + intents, pending, stored, nextChunk, hostOps, + reads, snapAtt, markedBy, badCommit, badPub, + acked, idReuse, sres, fres, dtoks, myCh, + myAtt, outc, fch, xn, xatt, run, tok, hst, + mygen, inc >> + +d_loop(self) == /\ pc[self] = "d_loop" + /\ IF hst[self] \in {"purging", "deleted"} + THEN /\ pc' = [pc EXCEPT ![self] = "d_admcommit"] + /\ dres' = dres + ELSE /\ IF inc[self] = MaxIncarnations + THEN /\ dres' = [dres EXCEPT ![self] = "error"] + /\ pc' = [pc EXCEPT ![self] = "d_end"] + ELSE /\ pc' = [pc EXCEPT ![self] = "d_mark"] + /\ dres' = dres + /\ UNCHANGED << head, volume, volCreates, names, snaps, + intents, pending, stored, nextChunk, hostOps, + resv, reads, snapAtt, markedBy, badCommit, + badPub, acked, idReuse, sres, fres, dtoks, + myCh, myAtt, outc, fch, xn, xatt, run, tok, + hst, mygen, inc >> + +d_mark(self) == /\ pc[self] = "d_mark" + /\ IF head["P"].st \in {"deleting", "purging", "deleted"} + THEN /\ mygen' = [mygen EXCEPT ![self] = head["P"].gen] + /\ pc' = [pc EXCEPT ![self] = "d_check"] + /\ UNCHANGED << head, dres >> + ELSE /\ IF head["P"].st = "held" + THEN /\ dres' = [dres EXCEPT ![self] = "in_use"] + /\ pc' = [pc EXCEPT ![self] = "d_abort"] + /\ UNCHANGED << head, mygen >> + ELSE /\ mygen' = [mygen EXCEPT ![self] = head["P"].gen + 1] + /\ head' = [head EXCEPT !["P"] = [head["P"] EXCEPT !.st = "deleting", !.gen = @ + 1]] + /\ pc' = [pc EXCEPT ![self] = "d_check"] + /\ dres' = dres + /\ UNCHANGED << volume, volCreates, names, snaps, intents, + pending, stored, nextChunk, hostOps, resv, + reads, snapAtt, markedBy, badCommit, badPub, + acked, idReuse, sres, fres, dtoks, myCh, myAtt, + outc, fch, xn, xatt, run, tok, hst, inc >> + +d_check(self) == /\ pc[self] = "d_check" + /\ IF \E n \in Names : names[n] # NoAtt + THEN /\ pc' = [pc EXCEPT ![self] = "d_revert"] + ELSE /\ pc' = [pc EXCEPT ![self] = "d_commit"] + /\ UNCHANGED << head, volume, volCreates, names, snaps, + intents, pending, stored, nextChunk, hostOps, + resv, reads, snapAtt, markedBy, badCommit, + badPub, acked, idReuse, sres, fres, dres, + dtoks, myCh, myAtt, outc, fch, xn, xatt, run, + tok, hst, mygen, inc >> + +d_revert(self) == /\ pc[self] = "d_revert" + /\ IF head["P"].st \in {"purging", "deleted"} + THEN /\ dres' = [dres EXCEPT ![self] = "unknown"] + /\ pc' = [pc EXCEPT ![self] = "d_end"] + /\ head' = head + ELSE /\ IF head["P"].st # "deleting" + THEN /\ dres' = [dres EXCEPT ![self] = "refused_snapshots"] + /\ pc' = [pc EXCEPT ![self] = "d_abort"] + /\ head' = head + ELSE /\ IF head["P"].gen # mygen[self] + THEN /\ pc' = [pc EXCEPT ![self] = "d_reread"] + /\ UNCHANGED << head, dres >> + ELSE /\ head' = [head EXCEPT !["P"] = [head["P"] EXCEPT !.st = "detached", !.gen = @ + 1]] + /\ dres' = [dres EXCEPT ![self] = "refused_snapshots"] + /\ pc' = [pc EXCEPT ![self] = "d_abort"] + /\ UNCHANGED << volume, volCreates, names, snaps, intents, + pending, stored, nextChunk, hostOps, resv, + reads, snapAtt, markedBy, badCommit, badPub, + acked, idReuse, sres, fres, dtoks, myCh, + myAtt, outc, fch, xn, xatt, run, tok, hst, + mygen, inc >> + +d_commit(self) == /\ pc[self] = "d_commit" + /\ IF head["P"].st \in {"purging", "deleted"} + THEN /\ pc' = [pc EXCEPT ![self] = "d_admcommit"] + /\ UNCHANGED << head, badCommit, dres >> + ELSE /\ IF head["P"].st # "deleting" + THEN /\ dres' = [dres EXCEPT ![self] = "givenback_by_other"] + /\ pc' = [pc EXCEPT ![self] = "d_abort"] + /\ UNCHANGED << head, badCommit >> + ELSE /\ IF head["P"].gen # mygen[self] + THEN /\ pc' = [pc EXCEPT ![self] = "d_reread"] + /\ UNCHANGED << head, + badCommit >> + ELSE /\ head' = [head EXCEPT !["P"] = [head["P"] EXCEPT !.st = "purging", !.gen = @ + 1]] + /\ badCommit' = (badCommit \/ CommitUnsafe) + /\ pc' = [pc EXCEPT ![self] = "d_admcommit"] + /\ dres' = dres + /\ UNCHANGED << volume, volCreates, names, snaps, intents, + pending, stored, nextChunk, hostOps, resv, + reads, snapAtt, markedBy, badPub, acked, + idReuse, sres, fres, dtoks, myCh, myAtt, + outc, fch, xn, xatt, run, tok, hst, mygen, + inc >> + +d_reread(self) == /\ pc[self] = "d_reread" + /\ hst' = [hst EXCEPT ![self] = head["P"].st] + /\ inc' = [inc EXCEPT ![self] = inc[self] + 1] + /\ pc' = [pc EXCEPT ![self] = "d_loop"] + /\ UNCHANGED << head, volume, volCreates, names, snaps, + intents, pending, stored, nextChunk, hostOps, + resv, reads, snapAtt, markedBy, badCommit, + badPub, acked, idReuse, sres, fres, dres, + dtoks, myCh, myAtt, outc, fch, xn, xatt, run, + tok, mygen >> + +d_admcommit(self) == /\ pc[self] = "d_admcommit" + /\ resv' = [resv EXCEPT !.st = "committed"] + /\ pc' = [pc EXCEPT ![self] = "d_finish"] + /\ UNCHANGED << head, volume, volCreates, names, snaps, + intents, pending, stored, nextChunk, + hostOps, reads, snapAtt, markedBy, + badCommit, badPub, acked, idReuse, sres, + fres, dres, dtoks, myCh, myAtt, outc, fch, + xn, xatt, run, tok, hst, mygen, inc >> + +d_finish(self) == /\ pc[self] = "d_finish" + /\ IF head["P"].st = "purging" + THEN /\ head' = [head EXCEPT !["P"] = [st |-> "deleted", gen |-> head["P"].gen + 1, ch |-> {}]] + /\ pc' = [pc EXCEPT ![self] = "d_volmark"] + /\ dres' = dres + ELSE /\ IF head["P"].st # "deleted" + THEN /\ dres' = [dres EXCEPT ![self] = "error"] + /\ pc' = [pc EXCEPT ![self] = "d_end"] + ELSE /\ pc' = [pc EXCEPT ![self] = "d_volmark"] + /\ dres' = dres + /\ head' = head + /\ UNCHANGED << volume, volCreates, names, snaps, intents, + pending, stored, nextChunk, hostOps, resv, + reads, snapAtt, markedBy, badCommit, badPub, + acked, idReuse, sres, fres, dtoks, myCh, + myAtt, outc, fch, xn, xatt, run, tok, hst, + mygen, inc >> + +d_volmark(self) == /\ pc[self] = "d_volmark" + /\ volume' = [volume EXCEPT !["P"] = "deleted"] + /\ dres' = [dres EXCEPT ![self] = "completed"] + /\ pc' = [pc EXCEPT ![self] = "d_end"] + /\ UNCHANGED << head, volCreates, names, snaps, intents, + pending, stored, nextChunk, hostOps, resv, + reads, snapAtt, markedBy, badCommit, badPub, + acked, idReuse, sres, fres, dtoks, myCh, + myAtt, outc, fch, xn, xatt, run, tok, hst, + mygen, inc >> + +d_abort(self) == /\ pc[self] = "d_abort" + /\ IF resv.st = "committed" + THEN /\ dres' = [dres EXCEPT ![self] = "unknown"] + /\ resv' = resv + ELSE /\ IF resv.toks \ {tok[self]} = {} + THEN /\ resv' = [st |-> "none", toks |-> {}] + ELSE /\ resv' = [resv EXCEPT !.toks = resv.toks \ {tok[self]}] + /\ dres' = dres + /\ pc' = [pc EXCEPT ![self] = "d_end"] + /\ UNCHANGED << head, volume, volCreates, names, snaps, + intents, pending, stored, nextChunk, hostOps, + reads, snapAtt, markedBy, badCommit, badPub, + acked, idReuse, sres, fres, dtoks, myCh, + myAtt, outc, fch, xn, xatt, run, tok, hst, + mygen, inc >> + +d_end(self) == /\ pc[self] = "d_end" + /\ IF dres[self] = "unknown" /\ run[self] < MaxRuns + THEN /\ run' = [run EXCEPT ![self] = run[self] + 1] + /\ pc' = [pc EXCEPT ![self] = "d_read"] + ELSE /\ pc' = [pc EXCEPT ![self] = "Done"] + /\ run' = run + /\ UNCHANGED << head, volume, volCreates, names, snaps, intents, + pending, stored, nextChunk, hostOps, resv, + reads, snapAtt, markedBy, badCommit, badPub, + acked, idReuse, sres, fres, dres, dtoks, myCh, + myAtt, outc, fch, xn, xatt, tok, hst, mygen, + inc >> + +Del(self) == d_read(self) \/ d_admit(self) \/ d_loop(self) \/ d_mark(self) + \/ d_check(self) \/ d_revert(self) \/ d_commit(self) + \/ d_reread(self) \/ d_admcommit(self) \/ d_finish(self) + \/ d_volmark(self) \/ d_abort(self) \/ d_end(self) + +Next == Host \/ GC + \/ (\E self \in SnapCallers: Snap(self)) + \/ (\E self \in ForkIds: Fork(self)) + \/ (\E self \in DelSnapIds: DelSnap(self)) + \/ (\E self \in CreateIds: Create(self)) + \/ (\E self \in Deleters: Del(self)) + +Spec == Init /\ [][Next]_vars + +\* END TRANSLATION + +----------------------------------------------------------------------------- +TypeOK == + /\ \A v \in Vols : head[v].st \in {"none", "held", "detached", "active", "deleting", "purging", "deleted", "aborted"} + /\ stored \subseteq Chunks + /\ resv.st \in {"none", "admitted", "committed"} + /\ \A p \in AttPaths : snaps[p].st \in {"none", "active", "deleting", "aborted"} + +GCSafe == + (UNION {head[v].ch : v \in Vols} + \cup UNION {snaps[p].ch : p \in {q \in AttPaths : snaps[q].st = "active"}} + \cup UNION {i.keys : i \in intents}) \subseteq stored + +\* a published snapshot is marked deleting only by an explicit DeleteSnapshot of it +SnapOnlyExplicitDelete == \A p \in AttPaths : snaps[p].st = "deleting" => markedBy[p] = "explicit" + +\* an acked snapshot keeps its chunks unless it was explicitly deleted +AckedChunksSurvive == \A p \in acked : markedBy[p] = "explicit" \/ snaps[p].ch \subseteq stored + +\* volume delete never commits while a fork claim, snapshot or in-flight attempt exists +CommitClean == ~badCommit +\* and no snapshot of P is published after the commit (a caller may still +\* receive the reply of a publication that happened before it) +NoPublishAfterCommit == ~badPub + +NoIdReuse == (\A v \in Vols : volCreates[v] <= 1) /\ ~idReuse + +GiveBackReleases == + \A d \in Deleters : (pc[d] = "Done" /\ dres[d] \in GaveBack) => dtoks[d] \cap resv.toks = {} + +HeadMonotone == + [][ /\ (head["P"].st \in {"purging", "deleted"} => head'["P"].st \in {"purging", "deleted"}) + /\ (head["P"].st = "deleted" => head'["P"].st = "deleted") + /\ (head["F"].st = "aborted" => head'["F"].st = "aborted") + /\ (volume["P"] = "deleted" => volume'["P"] = "deleted") + /\ \A p \in AttPaths : snaps[p].st = "aborted" => snaps'[p].st = "aborted" ]_vars + +\* ---- reachability witnesses: each is EXPECTED to be violated (proves the +\* model is not vacuous); run with cfg/*_reach*.cfg ---- +W_NeverDeleted == head["P"].st # "deleted" +W_NoForkThenDelete == ~(head["F"].st = "active" /\ head["P"].st = "deleted") +W_NoAckThenDelete == ~(acked # {} /\ head["P"].st = "deleted") +W_NoRefusalThenDelete == ~(head["P"].st = "deleted" /\ \E d \in Deleters : dres[d] \in GaveBack) +W_NoGCReclaim == \A c \in {"c1"} \cup {ChunkOf(i) : i \in 2..(nextChunk - 1)} : c \in stored + +\* N3: a snapshot attempt refused at its gate leaves an unpublished name record that +\* blocks a later delete with volume_has_snapshots (expected to be violated) +W_NoHiddenNameBlock == ~(/\ \E s \in SnapCallers : sres[s] = "volume_deleted" + /\ names["M"] = NoAtt /\ names["N"] # NoAtt + /\ snaps[<<"N", names["N"]>>].st = "none" + /\ \E d \in Deleters : dres[d] = "refused_snapshots" /\ pc[d] = "Done" + /\ head["P"].st \in {"held", "detached"}) + +Symm == Permutations(SnapCallers) \cup Permutations(Deleters) +============================================================================= diff --git a/seaweed-block/docs/spec/ControlPlane.tla b/seaweed-block/docs/spec/ControlPlane.tla new file mode 100644 index 0000000000..c3b75f1fd1 --- /dev/null +++ b/seaweed-block/docs/spec/ControlPlane.tla @@ -0,0 +1,99 @@ +----------------------------- MODULE ControlPlane ----------------------------- +(***************************************************************************) +(* S5 (first slice): the blockmaster authority store and guarded moves. *) +(* One volume, its durable record {epoch, holder, move journal}, two move *) +(* requests (request ids) that clients retry, durable Puts whose outcome *) +(* may be unknown (landed or not), and blockmaster restarts that reload *) +(* the record (core/authority at 1e8b0e9d). *) +(* *) +(* A move (applyWithWorkspaceMove, authority.go:435-575, prepare *) +(* workspace.go:287-335), under Publisher.mu: *) +(* 1. an issued journal entry for the request id -> replay its record; *) +(* 2. a reserved, unissued entry -> resume with the SAME epoch; *) +(* 3. else reserve: epoch = max(published, journal) + 1, persist the *) +(* journal with the OLD assignment (first Put), then *) +(* 4. persist the new assignment with the entry marked issued (2nd Put). *) +(* A failed Put leaves the outcome unknown: the volume is marked uncertain *) +(* and refuses workspace changes until a restart reloads the store *) +(* (workspace.go:254-269, authority.go:563-569). *) +(***************************************************************************) +EXTENDS Integers, FiniteSets, Sequences, TLC + +CONSTANTS Rids, MaxRestarts, MaxTries, + UncertainGuard, \* RED FALSE: a failed Put does not mark the volume uncertain + ReserveFirst \* RED FALSE: mint and issue in one Put, without the reservation step + +Target(r) == r \* each request moves the volume to its own holder (model value) + +VARIABLES store, mem, uncertain, pend, tries, restarts, issued +vars == <> + +Rec0 == [epoch |-> 1, holder |-> "h0", moves |-> {}] + +Init == /\ store = Rec0 /\ mem = Rec0 /\ uncertain = FALSE + /\ pend = [r \in Rids |-> 0] /\ tries = [r \in Rids |-> 0] + /\ restarts = 0 /\ issued = <<>> + +Max(S) == IF S = {} THEN 0 ELSE CHOOSE m \in S : \A s \in S : s <= m +Entry(rec, r) == {m \in rec.moves : m.rid = r} +NextEpoch(rec) == Max({rec.epoch} \cup {m.e : m \in rec.moves}) + 1 +Issue(rec, r, e) == [epoch |-> e, holder |-> Target(r), + moves |-> {m \in rec.moves : m.rid # r} \cup {[rid |-> r, e |-> e, ok |-> TRUE]}] +Logged(new) == IF new.epoch # store.epoch \/ new.holder # store.holder + THEN Append(issued, [e |-> new.epoch, holder |-> new.holder]) ELSE issued + +\* a durable Put: lands and is acknowledged, fails without landing, or lands with its reply lost +Put(new, okNext) == + \/ /\ store' = new /\ mem' = new /\ issued' = Logged(new) /\ okNext /\ uncertain' = uncertain + \/ /\ store' = store /\ mem' = mem /\ issued' = issued /\ uncertain' = (UncertainGuard \/ uncertain) + /\ pend' = pend + \/ /\ store' = new /\ issued' = Logged(new) /\ mem' = mem /\ uncertain' = (UncertainGuard \/ uncertain) + /\ pend' = pend + +\* steps 1-3 (one critical section up to the first Put) +Request(r) == + /\ ~uncertain /\ pend[r] = 0 /\ tries[r] < MaxTries + /\ tries' = [tries EXCEPT ![r] = @ + 1] + /\ restarts' = restarts + /\ LET ent == Entry(mem, r) IN + IF \E m \in ent : m.ok + THEN /\ UNCHANGED <> \* replay + \* prepare refuses unless the current line is the request's expected one (workspace.go:291-295): + \* every request here expects the initial assignment (epoch 1) + ELSE IF mem.epoch # 1 + THEN /\ UNCHANGED <> + ELSE IF ent # {} + THEN LET e == (CHOOSE m \in ent : TRUE).e \* resume the reservation + IN Put(Issue(mem, r, e), pend' = pend) + ELSE LET e == NextEpoch(mem) + IN IF ReserveFirst + THEN Put([mem EXCEPT !.moves = @ \cup {[rid |-> r, e |-> e, ok |-> FALSE]}], pend' = [pend EXCEPT ![r] = e]) + ELSE Put(Issue(mem, r, e), pend' = pend) + +\* step 4, still under the lock (nothing else runs between the two Puts; a restart may) +IssueStep(r) == + /\ pend[r] # 0 /\ ~uncertain + /\ LET e == pend[r] IN + Put(Issue(mem, r, e), pend' = [pend EXCEPT ![r] = 0]) + /\ UNCHANGED <> + +Restart == /\ restarts < MaxRestarts + /\ restarts' = restarts + 1 + /\ mem' = store /\ uncertain' = FALSE /\ pend' = [r \in Rids |-> 0] + /\ UNCHANGED <> + +\* the lock: while a request holds a pending reservation, no other request starts +Next == \/ \E r \in Rids : (\A q \in Rids : pend[q] = 0) /\ Request(r) + \/ \E r \in Rids : IssueStep(r) + \/ Restart +Spec == Init /\ [][Next]_vars + +----------------------------------------------------------------------------- +\* no epoch is ever issued to two holders, and issued epochs strictly increase +UniqueEpoch == \A i, j \in 1..Len(issued) : i < j => issued[i].e < issued[j].e +\* each request id is issued at most one epoch +Idempotent == \A r \in Rids : Cardinality({i \in 1..Len(issued) : issued[i].holder = Target(r)}) <= 1 +\* every issued epoch is journaled with its request (the grant record exists before the epoch is visible) +JournalComplete == store.epoch > 1 => \E m \in store.moves : m.e = store.epoch /\ m.ok +W_Moved == Len(issued) = 0 +============================================================================= diff --git a/seaweed-block/docs/spec/CutCapture.tla b/seaweed-block/docs/spec/CutCapture.tla new file mode 100644 index 0000000000..bb63ce807f --- /dev/null +++ b/seaweed-block/docs/spec/CutCapture.tla @@ -0,0 +1,150 @@ +------------------------------ MODULE CutCapture ------------------------------ +(***************************************************************************) +(* S4 (with the S6 failover slice): which chunks must the next cut upload? *) +(* Compares the dirty BITMAP (core/storage/chunk_layer.go at 1e8b0e9d) *) +(* with a proposed per-chunk LAST-WRITE-LSN map, across RF=1 restart, *) +(* crash mid-cut, and RF=2 failover to a replica. *) +(* *) +(* Writes get LSN = position in `hist` (the current lineage). A cut takes *) +(* a barrier at frontier L, captures the chunks it believes changed since *) +(* HEAD at their value as of L, then CASes HEAD {lsn L, image}. Chunk *) +(* content is abstracted to "the LSN of the write it holds". *) +(* *) +(* Track: *) +(* "bitmap" dirty set in memory; persisted before a WAL checkpoint *) +(* passes its entries (BeforeCheckpointAdvance, :353-361); *) +(* recovery = persisted set + chunks of WAL entries above *) +(* the checkpoint; after a cut, bits stay only for chunks *) +(* written after the barrier (finishCut :1542-1559). Not *) +(* replicated: a promoted replica starts with an empty set. *) +(* "bitmapHash" as bitmap, but a node whose bitmap is not bound to the *) +(* current HEAD starts in hashMode (:95, :186-216): every *) +(* chunk is a candidate for the next cut. *) +(* "lsnmap" lastLSN[c] = LSN of the last write to c; replicas apply *) +(* the same writes with the same LSNs; dirty-since-HEAD = *) +(* {c : lastLSN[c] > HEAD.lsn}; persisted like the bitmap. *) +(* A BASE-rebuilt replica seeds lastLSN = base for all. *) +(***************************************************************************) +EXTENDS Integers, FiniteSets, Sequences, TLC + +CONSTANTS Chunks, MaxLSN, MaxCuts, Track, Mode, + PersistBeforeCkpt, \* RED FALSE: checkpoint passes entries before the dirty state is durable + ClearAtCapture, \* RED TRUE: clear dirty state at the barrier, before the HEAD CAS + ReplDurableOnly, \* TRUE: in rf2 a cut covers only the replicated-durable frontier + BaseLSN \* rf2: R was BASE-rebuilt at this LSN (0: R replicated from the start) + +Nodes == {"P", "R"} +Zero == [c \in Chunks |-> 0] + +VARIABLES hist, prim, alive, applied, synced, ckpt, + dmem, ddisk, mmem, mdisk, \* bitmap (mem/disk) and lsn map (mem/disk) per node + bound, \* the persisted dirty state is bound to the current HEAD (bitmap header) + head, cut, cuts, events +vars == <> + +ValueAt(c, L) == LET ws == {i \in 1..L : i <= Len(hist) /\ hist[i] = c} IN IF ws = {} THEN 0 ELSE CHOOSE m \in ws : \A k \in ws : k <= m +Max(S) == IF S = {} THEN 0 ELSE CHOOSE m \in S : \A s \in S : s <= m +Min2(a, b) == IF a < b THEN a ELSE b + +Init == + /\ hist = [i \in 1..BaseLSN |-> CHOOSE c \in Chunks : TRUE] + /\ prim = "P" /\ alive = [n \in Nodes |-> TRUE] + /\ applied = [n \in Nodes |-> BaseLSN] /\ synced = [n \in Nodes |-> BaseLSN] /\ ckpt = [n \in Nodes |-> BaseLSN] + /\ dmem = [n \in Nodes |-> IF n = "P" /\ BaseLSN > 0 THEN {CHOOSE c \in Chunks : TRUE} ELSE {}] + /\ ddisk = dmem + /\ mmem = [n \in Nodes |-> IF n = "P" /\ BaseLSN > 0 THEN [c \in Chunks |-> ValueAt(c, BaseLSN)] + ELSE IF BaseLSN > 0 THEN [c \in Chunks |-> BaseLSN] ELSE Zero] + /\ mdisk = mmem + /\ bound = [n \in Nodes |-> n = "P"] + /\ head = [lsn |-> 0, img |-> Zero] + /\ cut = [pc |-> "idle", L |-> 0, D |-> {}, cap |-> Zero] + /\ cuts = 0 + /\ events = 0 + +Repl == Mode = "rf2" + +\* a VM write on the primary (WALStore write -> chunk layer OnExtentWrite, :299-310) +Write(c) == /\ Len(hist) < MaxLSN /\ alive[prim] + /\ hist' = Append(hist, c) + /\ applied' = [applied EXCEPT ![prim] = Len(hist) + 1] + /\ dmem' = [dmem EXCEPT ![prim] = @ \cup {c}] + /\ mmem' = [mmem EXCEPT ![prim][c] = Len(hist) + 1] + /\ UNCHANGED <> + +\* the replica applies the next shipped write with the same LSN (ApplyEntry) +ReplApply == /\ Repl /\ alive["R"] /\ prim = "P" /\ applied["R"] < Len(hist) + /\ LET i == applied["R"] + 1 IN + /\ applied' = [applied EXCEPT !["R"] = i] + /\ mmem' = [mmem EXCEPT !["R"][hist[i]] = i] + /\ UNCHANGED <> + +Sync(n) == /\ alive[n] /\ synced[n] < applied[n] + /\ synced' = [synced EXCEPT ![n] = applied[n]] + /\ UNCHANGED <> + +\* the flusher passes WAL entries <= synced; the dirty state is saved first (BeforeCheckpointAdvance) +Checkpoint(n) == /\ alive[n] /\ ckpt[n] < synced[n] + /\ ckpt' = [ckpt EXCEPT ![n] = synced[n]] + /\ ddisk' = IF PersistBeforeCkpt THEN [ddisk EXCEPT ![n] = dmem[n]] ELSE ddisk + /\ mdisk' = IF PersistBeforeCkpt THEN [mdisk EXCEPT ![n] = mmem[n]] ELSE mdisk + /\ UNCHANGED <> + /\ events' = events + +\* the dirty state a node can rebuild after a restart: persisted + WAL entries above the checkpoint +WalChunks(n) == {hist[i] : i \in {j \in (ckpt[n] + 1)..synced[n] : j <= Len(hist)}} +WalMap(n) == [c \in Chunks |-> LET ws == {i \in (ckpt[n] + 1)..synced[n] : i <= Len(hist) /\ hist[i] = c} + IN IF ws = {} THEN mdisk[n][c] ELSE Max(ws)] + +\* RF=1: the primary crashes and restarts; unsynced writes are gone; a cut in flight is lost +Restart == /\ ~Repl /\ events < 1 /\ alive["P"] + /\ hist' = SubSeq(hist, 1, synced["P"]) + /\ applied' = [applied EXCEPT !["P"] = synced["P"]] + /\ dmem' = [dmem EXCEPT !["P"] = IF Track = "bitmapHash" /\ ~bound["P"] THEN Chunks ELSE ddisk["P"] \cup WalChunks("P")] + /\ mmem' = [mmem EXCEPT !["P"] = WalMap("P")] + /\ cut' = [pc |-> "idle", L |-> 0, D |-> {}, cap |-> Zero] + /\ events' = events + 1 + /\ UNCHANGED <> + +\* RF=2: P dies, R is promoted with what it applied (acked writes are replicated-durable) +Failover == /\ Repl /\ events < 1 /\ prim = "P" + /\ prim' = "R" /\ alive' = [alive EXCEPT !["P"] = FALSE] + /\ hist' = SubSeq(hist, 1, applied["R"]) + /\ dmem' = [dmem EXCEPT !["R"] = IF Track = "bitmapHash" THEN Chunks ELSE {}] \* R has no bitmap for HEAD + /\ cut' = [pc |-> "idle", L |-> 0, D |-> {}, cap |-> Zero] + /\ events' = events + 1 + /\ UNCHANGED <> + +Frontier == IF Repl /\ prim = "P" /\ ReplDurableOnly THEN Min2(synced["P"], synced["R"]) ELSE synced[prim] +Dirty(n) == IF Track = "lsnmap" THEN {c \in Chunks : mmem[n][c] > head.lsn} ELSE dmem[n] + +\* the barrier: frontier L, the believed dirty set, the captured values as of L +CutBegin == /\ cut.pc = "idle" /\ cuts < MaxCuts /\ alive[prim] /\ Frontier > head.lsn + /\ LET L == Frontier + D == Dirty(prim) + IN /\ cut' = [pc |-> "cas", L |-> L, D |-> D, cap |-> [c \in Chunks |-> IF c \in D THEN ValueAt(c, L) ELSE head.img[c]]] + /\ dmem' = IF ClearAtCapture THEN [dmem EXCEPT ![prim] = @ \ D] ELSE dmem + /\ UNCHANGED <> + +\* the HEAD CAS (refused below HEAD's remote_lsn: lsn_behind), then finishCut keeps the bits of +\* chunks written after the barrier and persists the set bound to the new HEAD +CutCAS == /\ cut.pc = "cas" /\ alive[prim] + /\ head' = [lsn |-> cut.L, img |-> cut.cap] + /\ LET still == {c \in Chunks : \E i \in (cut.L + 1)..Len(hist) : hist[i] = c} + IN dmem' = [dmem EXCEPT ![prim] = IF ClearAtCapture THEN @ ELSE (@ \ cut.D) \cup still] + /\ bound' = [n \in Nodes |-> n = prim] + /\ cut' = [pc |-> "idle", L |-> 0, D |-> {}, cap |-> Zero] + /\ cuts' = cuts + 1 + /\ UNCHANGED <> + +Next == \/ \E c \in Chunks : Write(c) + \/ ReplApply \/ Restart \/ Failover \/ CutBegin \/ CutCAS + \/ \E n \in Nodes : Sync(n) \/ Checkpoint(n) +Spec == Init /\ [][Next]_vars + +----------------------------------------------------------------------------- +\* HEAD is the exact image of the current lineage at HEAD.lsn: the cut uploaded every chunk changed since HEAD +HeadImage == \A c \in Chunks : head.img[c] = ValueAt(c, head.lsn) +\* HEAD never covers more than the current primary has durably +HeadLeDurable == ~alive[prim] \/ (head.lsn <= Len(hist) /\ head.lsn <= synced[prim]) +W_CutAfterEvent == ~(events > 0 /\ cuts >= 2) +============================================================================= diff --git a/seaweed-block/docs/spec/CutPipeline.tla b/seaweed-block/docs/spec/CutPipeline.tla new file mode 100644 index 0000000000..40367a642d --- /dev/null +++ b/seaweed-block/docs/spec/CutPipeline.tla @@ -0,0 +1,89 @@ +----------------------------- MODULE CutPipeline ----------------------------- +(***************************************************************************) +(* S4 (remainder): the cut pipeline at main 1e8b0e9d. *) +(* - precopy rounds upload chunks before the barrier, tagged with the *) +(* chunk's mutation generation (chunkMut, chunk_layer.go:107-111, 349); *) +(* at the barrier a precopied upload is reused only if the generation *) +(* is unchanged, else the chunk is copied under the barrier; *) +(* - two-level manifest: each segment object lists its chunks; a segment *) +(* is rewritten iff one of its chunks is in the cut's set, else the old *) +(* segment object is reused; the root (HEAD) CAS publishes them *) +(* (#151, docs/chunk-manifests.md); *) +(* - restart without a bound bitmap starts reconciling (hashMode): every *) +(* chunk is compared against HEAD; cuts are refused ("reconciling") *) +(* until the compare finishes (chunk_layer.go:95); *) +(* - a crash before the root CAS leaves only orphan uploads. *) +(* Chunk content = the LSN of the write it holds. *) +(***************************************************************************) +EXTENDS Integers, FiniteSets, Sequences, TLC + +CONSTANTS MaxLSN, MaxCuts, MaxPre, + GenCheck, \* RED FALSE: reuse a precopied upload without comparing generations + SegRewrite, \* RED FALSE: reuse the old segment object even if a chunk in it changed + RefuseReconcile \* RED FALSE: allow a cut while the reconcile compare is incomplete + +Chunks == {"a", "b", "c"} +Segs == {"s1", "s2"} +SegOf == [c \in Chunks |-> IF c = "c" THEN "s2" ELSE "s1"] + +VARIABLES hist, mut, dirty, pre, head, recon, cuts, pres, restarted +vars == <> + +Val(c, L) == LET ws == {i \in 1..L : hist[i] = c} IN IF ws = {} THEN 0 ELSE CHOOSE m \in ws : \A k \in ws : k <= m +Cur(c) == Val(c, Len(hist)) +None == [v |-> -1, g |-> -1] +Init == /\ hist = <<>> /\ mut = [c \in Chunks |-> 0] /\ dirty = {} + /\ pre = [c \in Chunks |-> None] + /\ head = [lsn |-> 0, img |-> [c \in Chunks |-> 0], seg |-> [s \in Segs |-> [c \in Chunks |-> 0]]] + /\ recon = [c \in Chunks |-> TRUE] \* TRUE: this chunk's dirty state is known + /\ cuts = 0 /\ pres = 0 /\ restarted = FALSE + +Write(c) == /\ Len(hist) < MaxLSN + /\ hist' = Append(hist, c) /\ mut' = [mut EXCEPT ![c] = @ + 1] /\ dirty' = dirty \cup {c} + /\ UNCHANGED <> + +\* precopy: upload the chunk's current content outside the barrier, tagged with its generation +Precopy(c) == /\ c \in dirty /\ pres < MaxPre + /\ pre' = [pre EXCEPT ![c] = [v |-> Cur(c), g |-> mut[c]]] + /\ pres' = pres + 1 + /\ UNCHANGED <> + +\* restart with a lost/unbound bitmap: dirty state unknown, reconcile every chunk against HEAD +Restart == /\ ~restarted + /\ recon' = [c \in Chunks |-> FALSE] /\ dirty' = {} /\ pre' = [c \in Chunks |-> None] + /\ restarted' = TRUE + /\ UNCHANGED <> +\* the bounded background compare: one chunk against HEAD +Reconcile(c) == /\ ~recon[c] + /\ recon' = [recon EXCEPT ![c] = TRUE] + /\ dirty' = IF Cur(c) # head.img[c] THEN dirty \cup {c} ELSE dirty + /\ UNCHANGED <> + +\* the barrier + capture + manifest + root CAS, as one step (a crash before it leaves orphans only) +Cut == /\ cuts < MaxCuts /\ Len(hist) > head.lsn + /\ RefuseReconcile => \A c \in Chunks : recon[c] + /\ LET L == Len(hist) + D == dirty + up(c) == IF c \notin D THEN head.img[c] + ELSE IF pre[c] # None /\ (~GenCheck \/ pre[c].g = mut[c]) THEN pre[c].v + ELSE Val(c, L) + img == [c \in Chunks |-> up(c)] + seg == [s \in Segs |-> IF SegRewrite /\ \E c \in D : SegOf[c] = s + THEN [c \in Chunks |-> IF SegOf[c] = s THEN img[c] ELSE 0] + ELSE IF ~SegRewrite /\ head.lsn = 0 + THEN [c \in Chunks |-> IF SegOf[c] = s THEN img[c] ELSE 0] + ELSE head.seg[s]] + IN /\ head' = [lsn |-> L, img |-> img, seg |-> seg] + /\ dirty' = {} \* finishCut: no write lands inside the atomic cut + /\ pre' = [c \in Chunks |-> None] + /\ cuts' = cuts + 1 + /\ UNCHANGED <> + +Next == (\E c \in Chunks : Write(c) \/ Precopy(c) \/ Reconcile(c)) \/ Restart \/ Cut +Spec == Init /\ [][Next]_vars + +\* HEAD (root and every segment) is the exact image of the history at HEAD.lsn +HeadImage == \A c \in Chunks : head.img[c] = Val(c, head.lsn) +SegConsistent == \A c \in Chunks : head.seg[SegOf[c]][c] = head.img[c] +W_TwoCuts == cuts < 2 +============================================================================= diff --git a/seaweed-block/docs/spec/README.md b/seaweed-block/docs/spec/README.md new file mode 100644 index 0000000000..f099fe7432 --- /dev/null +++ b/seaweed-block/docs/spec/README.md @@ -0,0 +1,218 @@ +# Formal specifications (TLA+) + +This directory holds TLA+ models of the sw-block protocols where a bug would +lose or corrupt data: volume and snapshot lifecycle, epoch fencing and +takeover, local WAL crash recovery, the cut (HEAD publish) pipeline, the +control-plane authority store, RF=2 failover, and GC timing. + +The models check **designs**, not the Go code. Each one is small, each +abstracts a lot, and each is mapped to the code by hand (see +[Limits](#limits)). They have already paid for themselves: several of the +counterexamples below were turned into fixes (#152, #156, #158, #159). + +Code references are `path:line` at main **`5c7c1a7f`** unless a row says +otherwise. Comments inside the `.tla` files cite lines at the commit named in +each file's header; this README is the current map. + +## TLA+ and TLC in one paragraph + +[TLA+](https://github.com/tlaplus/tlaplus) describes a system as a +state machine: an initial state (`Init`) and a relation (`Next`) that says +which steps may follow any state. Concurrency is modelled as interleaving, so +every order of remote calls, crashes, lost replies and timeouts that the spec +allows is a possible behaviour. **TLC** is the explicit-state model checker: +for a configuration (`cfg/*.cfg`) that fixes small values for the constants +(2 volumes, 4 writes, ...), it enumerates *every* reachable state and checks +the invariants in each. A pass means "no violation exists within these +bounds"; a violation comes with the shortest trace that reaches it. **SANY** +is the parser and semantic checker that ships in the same jar. + +## Running + +**Tools.** Java 11 or newer (the runs below used Java 17 and 21) and +`tla2tools.jar` **v1.7.4** (TLC2 version 2.19): + +```sh +curl -fLO https://github.com/tlaplus/tlaplus/releases/download/v1.7.4/tla2tools.jar +echo "936a262061c914694dfd669a543be24573c45d5aa0ff20a8b96b23d01e050e88 tla2tools.jar" | sha256sum -c - +``` + +**Parse only** (seconds; useful after an edit): + +```sh +cd docs/spec +java -cp /path/to/tla2tools.jar tla2sany.SANY WorkspaceTakeover.tla +``` + +**Model-check one configuration.** `run.sh` picks the spec from the config +name prefix: + +```sh +cd docs/spec +TLA2TOOLS=/path/to/tla2tools.jar ./run.sh Fix_token +# equivalent raw command: +java -XX:+UseParallelGC -Xmx4g -cp /path/to/tla2tools.jar tlc2.TLC \ + -config cfg/Fix_token.cfg -deadlock -workers auto -metadir states/Fix_token \ + ChunkLifecycleFixed.tla +``` + +- `-deadlock` turns deadlock checking **off**. Several models have a process + that loops forever (GC), and bounded models stop at their bounds. +- `-workers auto` uses every core; 8 workers is a good default on a laptop. +- Memory: most configs fit in `-Xmx4g`. The large ones (`Fix_P1`, + `Fix_P2_aba`, `W4_drift_heads`, anything `_big` or `_large`) want + `-Xmx8g` or more and a fast disk for `states/`. The `_large` configs ran for + tens of minutes on 30 workers. +- `ChunkLifecycle.tla` and `ChunkLifecycleFixed.tla` are PlusCal. After + editing the algorithm, re-translate with + `java -cp tla2tools.jar pcal.trans -nocfg ChunkLifecycleFixed.tla`. +- For a quick random search of a config too large to finish, add + `-simulate -depth 400` (not exhaustive). + +**Reading results.** `Model checking completed. No error has been found.` is +a pass for that config. `Invariant X is violated` prints the trace. +Two kinds of config are **expected to violate**: + +- `*_red_*`, `RED_*`, `Bug_*`: a guard is removed (a constant set to the + "unsafe" value) or the pre-fix design is used. The violation shows that + the guard or fix is load-bearing. +- `*_reach_*`, `W_*` invariants: reachability witnesses ("this good state is + never reached"). Their violation shows that the model can actually do the + thing (delete, take over, publish), so a pass elsewhere is not vacuous. + +## Files + +| Spec | Configs | Kind | +|---|---|---| +| `ChunkLifecycleFixed.tla` | `cfg/Fix_*` | current design (PlusCal) | +| `ChunkLifecycle.tla` | `cfg/Bug_*` | historical: the pre-fix design of #152, kept for its counterexamples | +| `WorkspaceTakeover.tla` | `cfg/W4_*`, `cfg/RED_*` | | +| `WALRecovery.tla` | `cfg/S3_wal_*`, `cfg/S3v*`, `cfg/S3r_*`, `cfg/S3m_*`, `cfg/S3f_*` | | +| `SmartWALRecovery.tla` | `cfg/S3_sw_*`, `cfg/S3_sw2_*` | | +| `WALReplica.tla` | `cfg/S3_rep_*` | | +| `CutCapture.tla` | `cfg/S4_*` | | +| `CutPipeline.tla` | `cfg/S4b_*` | | +| `ControlPlane.tla` | `cfg/S5_*` | | +| `ReplicationFailover.tla` | `cfg/S6_*` | design-level | +| `RetentionGCTiming.tla` | `cfg/S9_*` | | +| `RetentionGCMulti.tla` | `cfg/S9b_*` | | + +Each `.cfg` names its spec on its first line. + +## Specs at a glance + +State counts are distinct states for exhaustive passes. "N-step trace" is the +length of TLC's shortest counterexample. + +| # | Spec | What it models | Key invariants | Results | Code (at `5c7c1a7f`) | +|---|---|---|---|---|---| +| S1 | `ChunkLifecycleFixed` (+ historical `ChunkLifecycle`) | Chunk HEAD, capture intents, snapshots (name record + attempt path), fork claims, tombstones, GC mark+sweep, and volume delete with a blockmaster deletion reservation. Actors: host, 0-2 snapshot callers, a fork, explicit DeleteSnapshot callers, 1-3 volume deleters with reruns, CreateVolume, GC. Filer semantics: conditional write on HEAD gen, exclusive create, conditional update/delete, uncancellable late create. | `GCSafe`, `SnapOnlyExplicitDelete`, `CommitClean`, `NoPublishAfterCommit`, `AckedChunksSurvive`, `NoIdReuse`, `GiveBackReleases`, temporal `HeadMonotone` | **Fixed design, all pass:** `Fix_P1` 51,375,412; `Fix_P2_aba` 46,245,848; `Fix_mix_small` 29,194,420; `Fix_token` 41,256; `Fix_create` 100. `Fix_mix` no violation in 138M states (20-min limit, incomplete). All `Fix_reach_*` reached. **Historical (pre-fix) counterexamples:** `Bug_P1_mark` (18-step), `Bug_P1_giveback` (23), `Bug_P1_data` (25: GC reclaims an acked snapshot's chunk), `Bug_P2_aba` (22), `Bug_token` (16), `Bug_create` (7). | `core/frontend/chunkstore/volume_delete.go:106` DeleteVolume (incarnation loop `:150`), `:269` markHeadDeleting, `:400` snapshotsBlock, `:314` revertHeadDeleting, `:347` commitHeadPurging; `catalog.go:824` CreateSnapshot (gate `:863`), `:943` claimName, `:771` createResolved, `:1058` DeleteSnapshot, `:1157` Fork, `:1337` claimForkParent, `:709` AbortSnapshot, `:1438` AbortFork; `retention.go:448` markDeleting, `:570` liveClaims; `gc.go:108` Collector.run; `chunk_remote.go:404` CASHead refuses delete states; `core/host/master/services.go:53` CreateVolume (holds workspaceMu `:64`), `:132` MarkVolumeDeleting; `core/lifecycle/deletion_reservations.go:111` Admit; `cmd/sw-block/chunk_volume_delete.go:32` `--request-id` | +| S2 | `WorkspaceTakeover` | A workspace volume moving from host A (epoch 1) to host B by a clean move (detach, revoke, ACK, assign) or a forced move (lease expiry). Blockmaster clock, host clock lag up to `Drift`, lossy and reordered messages, master restart, each host's cut as one remote call per step, takeover CAS, GC intent expiry. Code pinned at `5c293821`. | `NoDualServing`, `NoOldCasAfterTakeover`, `NoLateChunkReachable`, `GCSafe`, `NoLiveIntentExpired`, `CleanNoLoss`, `ForcedLossBounded`, `SeedMatchesTakeover`, temporal `HeadMonotone` | **Pass:** `W4_clean` 6,048,496; `W4_forced` 22,619,644; `W4_drift_heads` 56,242,345; `W4_clean_large` 590,137,925 (depth 70). `W4_forced_large`: no violation in 910,907,693 states (time limit, incomplete). **RED:** `RED_early_assign` NoDualServing (12-step); `RED_gc_ageonly` GCSafe (12); `RED_epoch` NoOldCasAfterTakeover (22-24); `RED_lsn` HeadMonotone (24). `RED_epoch_storeonly`/`_hostonly` pass (438,406 / 827,500): either epoch check alone suffices. `RED_lsn_storeonly` passes (28,389,024). **Findings:** `W4_drift` NoDualServing (13-step, fixed by #158, see below); `W4_forced_exact` ForcedLossExact (16-step, benign, open). | `core/frontend/chunkstore/chunk_remote.go:390` CASHead (epoch guard `:391`, gen/epoch/LSN guard `:409`, conditional update `:420`); `core/host/volume/workspace_lease.go:57` permits, `:70` Refresh (anchor `:73`, accept `:117`); `core/authority/workspace.go:95` RenewWorkspaceLease, `:222` BeginWorkspaceRevocation, `:237` AckWorkspaceRevocation, `:309` prepareWorkspaceMoveLocked (forced-move margin `:316-320`); `core/host/master/workspace_service.go:109` MoveWorkspace (HEAD read `:116`); `core/authority/authority.go:251` reloadFromStore (deadline reset `:261`); `core/frontend/durable/provider_chunk.go:289` PrepareRestore, `:309` ClaimChunkHead; `core/storage/chunk_restore.go:14`; `core/storage/chunk_layer.go:680` captureLocked (admit `:695`, lsn_behind `:800`, PutIntent `:853`, re-admit `:911`, supersededBy `:916`, CAS `:926`, settle `:972`); `core/frontend/chunkstore/gc.go:221` intent-expiry epoch rule | +| S3 | `WALRecovery`, `SmartWALRecovery`, `WALReplica` | Local WAL crash recovery. **walstore:** a ring of K pages, 1-2 page records, page cache written back in any order, Sync, flusher checkpoint, crash at any point with optionally one corrupted record page; recovery is a pure function of the durable image, with a selectable `Rule`. **smartwal:** in-place extent write plus a metadata ring slot, written back in any order, torn slots. **Replica:** RF=2 classification and promotion eligibility, BASE jump. | `I1` every synced write is recovered (or superseded) or recovery fails closed; `I2` a crash without corruption never reports corruption; `ReplayLastWriter`; `I0Prefix`; `I1Frontier`; `NoForgedReplay`; `I3` the promoted node has every acked write | **walstore, current main** (rule `rootLww`, reuse bounded by the persisted tail): `S3r_rootLww_I1_crashonly`/`_I2`/`_replay` pass (849,003); with an in-memory rebuild jump `S3r_rebuild_rootLww_*` pass (1,460,772). **Pre-fix code:** `S3_wal_current_I1_crashonly` I1 violated (synced write lost after a plain crash, #156); `S3v_code_lww_I1_crashonly` I1 violated (LWW replay alone is not enough, #159). **Open:** one corrupted synced record `S3v1_root_lww_I1` violated; Sync-persisted watermark `S3m_*` pass (1,320,984 / 3,955,400); `S3f_*` NoForgedReplay violated (confirmed on main, see Open items). **smartwal, current:** `S3_sw_current_I2` violated (false `wal_corrupt`), `_I1`, `_I1frontier` violated; proposal `S3_sw2_ordered_marker_repair_I2` pass (65,401), `_I1slot` pass (345,084). **Replica:** `S3_rep_c1_I2` pass (29,196), `S3_rep_c1_g2_I2` pass (12,712), `S3_rep_c1_g1_I3` pass (74,527); RED `S3_rep_c2_I2`, `S3_rep_c1_g2jump_I2`, `S3_rep_nogate_I3` violated. | `core/storage/recovery.go:43` recoverWAL (head==tail scan from its position `:63-73`, defensive scan `:74-90`, a range stops at its first bad entry `:141`, `:154`, hole warning `:437`), LWW replay `:193` via `core/storage/dirty_map.go:56` putAtIfNewer; `core/storage/wal_writer.go:41` durableTail, `:70` spaceUsed, `:443` tailPersisted; `core/storage/walstore.go:390` checkpoint release, `:933` Sync, `:1065` AdvanceFrontier, `:1167` ApplyEntry; `core/storage/smartwal/store.go:297` writeAt (extent `:304`, then ring `:313`), `:345` Sync; `smartwal/recovery.go:47` runRecoveryCounting (fail closed `:99-100`); `smartwal/ring.go:45` appendAt, `:69` scanSlots; `core/replication/volume.go:680` RebaseShipLSN | +| S4 | `CutCapture`, `CutPipeline` | Which chunks the next cut must upload: the dirty bitmap vs a per-chunk last-write-LSN map, across RF=1 restart, crash mid-cut and RF=2 failover; dirty state persisted before a checkpoint passes WAL entries. Then the pipeline: precopy tagged with a per-chunk mutation generation, two-level manifest segments, root CAS, and `reconciling` after a restart without a bound bitmap. | `HeadImage` (HEAD is the exact image of the lineage at HEAD.lsn), `HeadLeDurable`, `SegConsistent` | **Pass:** `S4_rf1_bitmap` 47,670, `S4_rf1_lsnmap` 46,934, `S4_rf2_bitmapHash` 7,166,376, `S4_rf2_lsnmap` 8,226,004, `S4_rf2_lsnmap_base` 901,390; `S4b_design` 69,645, `S4b_design_big` 1,515,837. **RED:** `S4_rf2_bitmap` (failover without hashMode, 7-step), `S4_rf2_lsnmap_localCut` (6), `S4_rf1_*_noPersist` (7), `S4_rf1_bitmap_clearEarly` (8); `S4b_red_noGen`, `S4b_red_cutWhileRec` HeadImage; `S4b_red_segReuse` SegConsistent. | `core/storage/chunk_layer.go:356` BeforeCheckpointAdvance, `:299` OnExtentWrite, `:95` hashMode (set on attach `:184-230`), `:111` chunkMut, `:324` noteMutation, `:762` and `:1435` staged upload reused only if its generation is unchanged, `:702-704` cut refused while reconciling, `:877-881` PrepareManifest, `:1542` finishCut; `core/frontend/chunkstore/manifest.go:101` segment reused only if its chunk refs are unchanged | +| S5 | `ControlPlane` | Blockmaster authority store: one volume record `{epoch, holder, move journal}`, two retried move requests, durable Puts that succeed, fail, or land with the reply lost, and restarts. | `UniqueEpoch` (issued epochs strictly increase), `Idempotent` (one epoch per request id), `JournalComplete` | `S5_code` pass (298). **RED:** `S5_red_noUncertain` UniqueEpoch violated (5-step: a lost-reply Put, then a reservation from stale memory puts the old assignment back). `S5_red_noReserve` passes (the reservation step is not needed for these invariants). | `core/authority/authority.go:436` applyWithWorkspaceMove (uncertain refusal `:442-444`, Put `:564`, mark uncertain `:568`); `core/authority/workspace.go:309` prepareWorkspaceMoveLocked (expected line `:313`, resume a reserved entry `:324-333`, reserve max+1 `:344-355`), journal replay `:192-219`, persist and mark uncertain `:276-288` | +| S6 | `ReplicationFailover` | RF=2: P ships to R, R acks what is durable, the client is acked when both are durable; promotion of R at a new epoch with an evidence gate; R refuses old-epoch shipping; cuts and snapshots cover only the replicated-durable frontier; an in-flight snapshot create from the old primary may still land after the failover. Design-level. | `AckedSurvive`, `HeadOnLineage`, `SnapOnLineage`, `NoStaleAck` | `S6_design` pass (52,897), `S6_design_big` (598,353). **RED:** `S6_red_localCut` HeadOnLineage; `S6_red_noFence` AckedSurvive. `S6_red_noEvidence` passes: with synchronous RF=2 acks the gate is redundant (it matters for quorum or async shipping, not modelled). | `core/transport/replica.go:362` replica rejects a stale-lineage ship entry; `core/replication/volume.go:680` RebaseShipLSN; takeover CAS as in S2 | +| S9 | `RetentionGCTiming`, `RetentionGCMulti` | GC timing with an explicit clock: a copy operation with deadline D, marks of duration up to MD, deletion only after two marks at least Grace apart; then marks across two volumes with a fork and a snapshot delete. | `NoLiveDelete` | **Single op:** `S9_rule_G4` (G > D + MD) pass (10,798; `_big` 43,780); G = D passes (`S9_red_G2_noguard`, 11,953). **RED:** `S9_red_G1_noguard`, `S9_red_G1_D3` (G < D) NoLiveDelete violated. **Two volumes:** `S9b_G1_MD2`, `_G2_MD2`, `_G2_MD3`, `_G3_MD1` pass (5,743-9,079). | `core/frontend/chunkstore/gc.go:89` grace > operation deadline, `:280` mark-duration margin, `:306-318` two-mark rule, `:214-221` intent expiry; `catalog.go:896-905` intent deadline re-checked before publish; `gc_copy.go:143`, `:177` a deleting attempt stays a root until grace | + +## Limits + +- **Design, not code.** Each action is a hand-written abstraction of one + remote call or one local decision, mapped to code by the table above. A + pass says the *design* is safe under the modelled assumptions; it does not + say the Go code implements that design. Line mappings were re-checked + against `5c7c1a7f`, but they rot as code moves. +- **Small scopes.** 2 volumes, 2-3 chunks, 2 snapshot names, 3-6 writes or + LSNs, a 4-page WAL, 1-2 restarts, clocks up to 7-16 ticks. A pass is + exhaustive *for that config only*. Some large configs stopped at a time + limit; they are marked incomplete above. +- **Abstractions.** Data is "the LSN of the write it holds" (no bytes); a CRC + is data identity; one corrupted record at most; GC mark+sweep is atomic in + S1 and S2 (S9 models its timing); time in S1 is replaced by a "keys read by + an in-flight operation are roots" assumption; S1 has no epoch (S2 covers + it) and no crash (so fsync-durability bugs are out of scope); some reads + are merged with the conditional write they guard, which can only hide + interleavings, never invent them. +- **Not modelled.** RF=3 quorum, catch-up and rebuild, wall-clock jumps, + master HA, an unknown-outcome HEAD CAS (`resolvePending`), the S2 forced + move's skew margin added in #158, liveness under fairness. +- **Model errors happen.** Three early drafts of these specs produced + spurious violations that were traced to the model, not the code. Every + violation listed here was checked against the code. + +## Findings that led to code fixes + +| PR | Finding | Spec / configs | +|---|---|---| +| #152 | Volume delete (as first proposed): (1) the snapshot cascade's back-out could mark *another* caller's published snapshot deleting while the delete was still provisional, so a later GC could reclaim an acknowledged snapshot's only chunk; (2) a claim check and commit not bound to one deletion incarnation allowed an ABA across three concurrent deleters; (3) a rerun with a fresh token left the first reservation held; (4) CreateVolume released its lock between the reservation check and the create. Fixed by refusing while any snapshot name exists, binding check, commit and revert to one incarnation, using `--request-id` as the token, and keeping the lock. | S1 `Bug_P1_*`, `Bug_P2_aba`, `Bug_token`, `Bug_create` (violated); `Fix_*` (pass) | +| #156 | walstore recovery replayed in physical scan order. After a wrap, a newer record could be scanned before an older one for the same LBA and lose to it, so an acknowledged write was lost after a plain crash. Fixed by last-writer-wins replay by LSN. | S3 `S3_wal_current_I1_crashonly` | +| #159 | With LWW replay alone, the writer could reuse WAL space released only in memory; a torn unsynced record written there could stop the scan before a synced record that the on-disk superblock still retained. Fixed by reusing only space the *persisted* tail released, and by scanning an empty-superblock window from its position. | S3 `S3v_code_lww_I1_crashonly` (violated); `S3r_rootLww_*`, `S3r_rebuild_rootLww_*` (pass) | +| #158 | The workspace lease had no clock-skew margin: with a host clock one tick slow, the old and new host could both serve after a forced move (HEAD stayed safe because the old host's CAS fails on the epoch). Fixed by a skew margin: a forced move waits for lease expiry plus the margin (`core/authority/workspace.go:316-320`), and the lease validity reported to the host excludes half of it (`core/host/master/workspace_service.go:46-53`). | S2 `W4_drift` (violated against the pre-fix design; the margin is not yet in the model) | + +The S2 epoch rule for GC intent expiry (`gc.go:221`), the S5 "uncertain +after a failed Put" guard, and the S4 generation and reconciling guards were +already in the code; their RED variants confirm they are load-bearing and +are good candidates for regression tests. + +## Open items + +These are model-level results on the current design. They are not confirmed +bugs in production paths unless stated. + +1. **Corrupted synced WAL records need a format change (walstore).** If a + synced record's bytes are corrupted, the current recovery stops that range + at the bad record and continues; data after it in the range is dropped and + recovery reports success (a hole warning is logged since #155). An + in-record durable watermark alone is not enough (a corrupt *last* synced + record leaves no valid witness). The configs that pass (`S3m_*`) need Sync + to persist the watermark and any frontier jump out of band (for example in + the superblock) before acknowledging, plus recovery that decodes every + record position and replays by LSN. +2. **Forged replay (confirmed, open).** Recovery accepts any well-formed + record. A guest payload can contain bytes that decode as a valid WAL + record (CRC32 is not keyed). If a newer, shorter record overwrites only the + start of an old multi-block record, the scan continues into the old + payload and replays the forged record. Every rule modelled, including the + current one, violates `NoForgedReplay` (`S3f_*`). + - **Reproduced on main.** A 3-block batch write carries an encoded WAL + entry (LSN 999, LBA 7) in its guest data. After a newer 1-block record + wraps over the batch's start, recovery decodes the embedded entry: LBA 7 + reads the forged data, and the frontier jumps to 999. This also happens + after a clean close and reopen. + - **Effect.** It stays inside the guest's own volume: a write at a chosen + LBA, or a bogus LSN that moves the frontier. + - **Planned fix.** An interim fix persists the WAL head on Close and adds + a clean-shutdown flag. The full fix comes with the format change: bind + each record to its WAL incarnation and lap, for example with an epoch or + nonce in the header. +3. **SmartWAL.** + - The extent write and the ring slot have no ordering barrier + (`smartwal/store.go:304`, `:313`), and recovery fails closed on any CRC + mismatch (`smartwal/recovery.go:99`). After a plain crash an *unsynced* + write can therefore make the volume refuse to start with `wal_corrupt` + (`S3_sw_current_I2`): an availability problem, not data loss. + - There is no per-block CRC once a slot has been recycled, so extent + corruption of such an LBA is not detected, and corrupting the only record + of a synced write lowers the recovered frontier silently + (`S3_sw_current_I1`, `_I1frontier`; a documented limitation). + - A proposal passes `I2` and slot-corruption `I1`: make the record durable + before the data write, persist gap markers for frontier jumps, and have + recovery durably settle every torn tail it accepts (`S3_sw2_ordered_marker_repair_*`). + Its frontier still needs an out-of-band durable watermark (item 1). + - The positional torn-slot rule of an earlier revision of #155 (089d2d9) + could report `wal_corrupt` after a plain crash (`S3_sw2_pr155o_I2`); the + merged #155 only counts torn slots, so this does not apply to main. +4. **Design notes (no safety impact).** A forced move's journal records the + HEAD read before the publisher lock (`workspace_service.go:116`), so it can + over-report the loss window (`W4_forced_exact`). A refused snapshot attempt + can leave an unpublished name record that blocks later volume deletes until + `DeleteSnapshot` settles it (`Fix_reach_W_NoHiddenNameBlock`; + `catalog.go:861`). + +## Parse check + +All 12 specs parse and pass SANY's semantic check with `tla2tools.jar` v1.7.4 +(`java -cp tla2tools.jar tla2sany.SANY `), checked on 2026-11-16: +`ChunkLifecycle`, `ChunkLifecycleFixed`, `ControlPlane`, `CutCapture`, +`CutPipeline`, `ReplicationFailover`, `RetentionGCMulti`, `RetentionGCTiming`, +`SmartWALRecovery`, `WALRecovery`, `WALReplica`, `WorkspaceTakeover`. The state counts above come from earlier +TLC runs of these specs; comment-only edits were made since. diff --git a/seaweed-block/docs/spec/ReplicationFailover.tla b/seaweed-block/docs/spec/ReplicationFailover.tla new file mode 100644 index 0000000000..83653ae3bd --- /dev/null +++ b/seaweed-block/docs/spec/ReplicationFailover.tla @@ -0,0 +1,102 @@ +------------------------- MODULE ReplicationFailover ------------------------- +(***************************************************************************) +(* S6 (first slice): RF=2 failover with chunk HEAD and snapshot handoff. *) +(* Primary P ships writes to replica R; R acks what it made durable; the *) +(* client gets an ack once P and R are durable. The master promotes R at *) +(* epoch E+1 only with evidence (R durable >= every acked LSN). R rejects *) +(* shipping from a lower epoch, so a partitioned old primary can no longer *) +(* get acks. Cuts (chunk HEAD) cover only the replicated-durable frontier *) +(* and are epoch-fenced CASes (S2). A snapshot request in flight at the *) +(* failover is retried on the new primary with the same request id: it *) +(* publishes to the same attempt path (exclusive create, cannot be *) +(* cancelled), so whichever create lands first is the snapshot. *) +(* Chunk content is abstracted to "the LSN of the write it holds"; one *) +(* chunk per LBA, LBAs {a, b}. *) +(***************************************************************************) +EXTENDS Integers, FiniteSets, Sequences, TLC + +CONSTANTS MaxLSN, + ReplFrontier, \* RED FALSE: a cut or snapshot covers P's local durable LSN, not the replicated one + EvidenceGate, \* RED FALSE: promote R without checking it has every acked write + EpochFenceShip \* RED FALSE: R accepts shipping from the old epoch after promotion + +LBAs == {"a", "b"} + +VARIABLES hist, pDur, rApp, rDur, acked, prim, epoch, pEpoch, head, snap, pend, rhist +vars == <> + +Val(h, c, L) == LET ws == {i \in 1..L : i <= Len(h) /\ h[i] = c} IN IF ws = {} THEN 0 ELSE CHOOSE m \in ws : \A k \in ws : k <= m +Img(h, L) == [c \in LBAs |-> Val(h, c, L)] + +Init == /\ hist = <<>> /\ rhist = <<>> \* P's log and R's log + /\ pDur = 0 /\ rApp = 0 /\ rDur = 0 /\ acked = 0 + /\ prim = "P" /\ epoch = 1 /\ pEpoch = 1 + /\ head = [lsn |-> 0, img |-> Img(<<>>, 0), epoch |-> 1] + /\ snap = [st |-> "none", lsn |-> 0, img |-> Img(<<>>, 0)] \* the published snapshot (attempt path) + /\ pend = [on |-> FALSE, lsn |-> 0, img |-> Img(<<>>, 0)] \* old primary's uncancellable create in flight + +\* ---- primary P (old epoch) ---- +PWrite(c) == /\ Len(hist) < MaxLSN /\ hist' = Append(hist, c) + /\ UNCHANGED <> +PSync == pDur < Len(hist) /\ pDur' = Len(hist) /\ UNCHANGED <> +\* R applies the next shipped write (refused from the old epoch after promotion) +Ship == /\ rApp < Len(hist) /\ (prim = "P" \/ ~EpochFenceShip) + /\ rApp' = rApp + 1 /\ rhist' = Append(rhist, hist[rApp + 1]) + /\ UNCHANGED <> +RSync == rDur < rApp /\ rDur' = rApp /\ UNCHANGED <> +\* the client ack: durable on P and R (old primary still acks if R accepted its shipping) +Ack == /\ (prim = "P" \/ ~EpochFenceShip) \* after the fence R acks nothing for the old epoch + /\ LET a == IF pDur < rDur THEN pDur ELSE rDur IN a > acked /\ acked' = a + /\ UNCHANGED <> + +Frontier == IF ReplFrontier THEN (IF pDur < rDur THEN pDur ELSE rDur) ELSE pDur +\* P's cut: epoch-fenced CAS (fails once the new primary has taken HEAD over) +PCut == /\ prim = "P" /\ head.epoch = pEpoch /\ Frontier > head.lsn + /\ head' = [lsn |-> Frontier, img |-> Img(hist, Frontier), epoch |-> pEpoch] + /\ UNCHANGED <> +\* P starts the snapshot: its create is sent and may land at any later time +PSnap == /\ prim = "P" /\ snap.st = "none" /\ ~pend.on /\ Frontier > 0 + /\ pend' = [on |-> TRUE, lsn |-> Frontier, img |-> Img(hist, Frontier)] + /\ UNCHANGED <> +Land == /\ pend.on + /\ snap' = IF snap.st = "none" THEN [st |-> "published", lsn |-> pend.lsn, img |-> pend.img] ELSE snap + /\ pend' = [pend EXCEPT !.on = FALSE] + /\ UNCHANGED <> + +\* ---- failover ---- +Promote == /\ prim = "P" /\ (EvidenceGate => rDur >= acked) + /\ prim' = "R" /\ epoch' = epoch + 1 + /\ UNCHANGED <> +\* R's takeover CAS of HEAD at the new epoch (S2), from the HEAD it observed +Takeover == /\ prim = "R" /\ head.epoch < epoch + /\ head' = [head EXCEPT !.epoch = epoch] + /\ UNCHANGED <> +RWrite(c) == /\ prim = "R" /\ head.epoch = epoch /\ Len(rhist) < MaxLSN + /\ rhist' = Append(rhist, c) /\ rApp' = rApp + 1 + /\ UNCHANGED <> +RCut == /\ prim = "R" /\ head.epoch = epoch /\ rDur > head.lsn + /\ head' = [lsn |-> rDur, img |-> Img(rhist, rDur), epoch |-> epoch] + /\ UNCHANGED <> +\* the retried snapshot request on R, same request id: same attempt path, exclusive create +RSnap == /\ prim = "R" /\ head.epoch = epoch /\ snap.st = "none" /\ rDur > 0 + /\ snap' = [st |-> "published", lsn |-> rDur, img |-> Img(rhist, rDur)] + /\ UNCHANGED <> + +Next == \/ \E c \in LBAs : PWrite(c) \/ RWrite(c) + \/ PSync \/ Ship \/ RSync \/ Ack \/ PCut \/ PSnap \/ Land + \/ Promote \/ Takeover \/ RCut \/ RSnap +Spec == Init /\ [][Next]_vars + +----------------------------------------------------------------------------- +Lineage == IF prim = "R" THEN rhist ELSE hist +\* the promoted primary holds every acknowledged write +AckedSurvive == prim = "R" => (\A i \in 1..acked : i <= Len(rhist) /\ rhist[i] = hist[i]) +\* HEAD is a prefix image of the surviving lineage and never ahead of its durable LSN +HeadOnLineage == /\ head.img = Img(Lineage, head.lsn) + /\ (prim = "R" /\ head.epoch = epoch) => head.lsn <= rDur +\* the published snapshot is a prefix image of the surviving lineage +SnapOnLineage == snap.st = "published" => snap.img = Img(Lineage, snap.lsn) +\* the old primary acks nothing after the promotion that the new primary lacks +NoStaleAck == prim = "R" => acked <= Len(rhist) +W_Handoff == ~(prim = "R" /\ snap.st = "published" /\ head.epoch = epoch /\ head.lsn > 0) +============================================================================= diff --git a/seaweed-block/docs/spec/RetentionGCMulti.tla b/seaweed-block/docs/spec/RetentionGCMulti.tla new file mode 100644 index 0000000000..6d0f6580cf --- /dev/null +++ b/seaweed-block/docs/spec/RetentionGCMulti.tla @@ -0,0 +1,56 @@ +--------------------------- MODULE RetentionGCMulti --------------------------- +(***************************************************************************) +(* S9 (remainder): GC marks across two volumes, with a fork and a snapshot *) +(* delete. Chunk k is rooted by P's snapshot M. A fork F <- P/M claims M, *) +(* writes its intent in F, creates F's HEAD (which names k) and drops its *) +(* intent and claim (catalog.go:1151-1311). Then M may be deleted *) +(* (retention or DeleteSnapshot: markDeleting needs no live claim); an *) +(* unnamed deleting attempt stays a root until Grace after its delete mark *) +(* (gc_copy.go:172-181). A GC mark visits the volumes in ListVolumes order *) +(* (F before P), one step per volume, within MD ticks of its start. *) +(***************************************************************************) +EXTENDS Integers, TLC + +CONSTANTS G, MD, MaxT + +VARIABLES t, mst, mdel, fork, gc, cand, deleted +vars == <> + +Init == /\ t = 0 /\ mst = "active" /\ mdel = 0 + /\ fork = "idle" \* idle -> claimed -> intent -> headed -> done + /\ gc = [st |-> "idle", start |-> 0, seenF |-> FALSE] + /\ cand = -1 /\ deleted = FALSE + +Tick == t < MaxT /\ t' = t + 1 /\ UNCHANGED <> +ForkStep == /\ fork # "done" /\ mst = "active" + /\ fork' = CASE fork = "idle" -> "claimed" [] fork = "claimed" -> "intent" + [] fork = "intent" -> "headed" [] OTHER -> "done" + /\ UNCHANGED <> +\* M deleted once no live claim holds it (claim live until F's HEAD exists) +DeleteM == /\ mst = "active" /\ fork \in {"idle", "headed", "done"} + /\ mst' = "deleting" /\ mdel' = t + /\ UNCHANGED <> + +RootF == fork \in {"intent", "headed", "done"} \* F's intent, then F's HEAD +RootP == mst = "active" \/ (mst = "deleting" /\ t - mdel <= G) + +MarkF == gc.st = "idle" /\ gc' = [st |-> "F", start |-> t, seenF |-> RootF] /\ UNCHANGED <> +MarkP == /\ gc.st = "F" /\ t - gc.start <= MD + /\ LET rooted == gc.seenF \/ RootP IN + IF rooted THEN cand' = -1 /\ deleted' = deleted + ELSE IF cand >= 0 /\ gc.start - cand >= G THEN deleted' = TRUE /\ cand' = cand + ELSE cand' = (IF cand >= 0 THEN cand ELSE gc.start) /\ deleted' = deleted + /\ gc' = [st |-> "idle", start |-> 0, seenF |-> FALSE] + /\ UNCHANGED <> +\* a mark that overran MD is discarded (no coverage) +MarkVoid == /\ gc.st = "F" /\ t - gc.start > MD + /\ gc' = [st |-> "idle", start |-> 0, seenF |-> FALSE] /\ cand' = -1 + /\ UNCHANGED <> + +Next == Tick \/ ForkStep \/ DeleteM \/ MarkF \/ MarkP \/ MarkVoid +Spec == Init /\ [][Next]_vars + +\* GC never deletes k while F's HEAD (or intent) or an unexpired M names it +NoLiveDelete == deleted => ~(RootF \/ RootP) +W_Delete == ~deleted +============================================================================= diff --git a/seaweed-block/docs/spec/RetentionGCTiming.tla b/seaweed-block/docs/spec/RetentionGCTiming.tla new file mode 100644 index 0000000000..2ee28842c5 --- /dev/null +++ b/seaweed-block/docs/spec/RetentionGCTiming.tla @@ -0,0 +1,72 @@ +-------------------------- MODULE RetentionGCTiming -------------------------- +(***************************************************************************) +(* S9 (first slice): GC timing with an explicit clock (grace rule). *) +(* One snapshot/fork copy operation reads HEAD at t0 (chunk k is rooted by *) +(* HEAD), may write its copy intent naming k at any time before its *) +(* deadline t0 + D, and publishes before the deadline or refuses *) +(* (catalog.go:891-899). The host may drop k from HEAD at any time. *) +(* GC runs marks that take up to MD ticks: per volume it reads HEAD and *) +(* snapshots first and lists intents last (gc.go:157, 162, 179, 188). A *) +(* chunk *) +(* is deleted only when unrooted at a mark whose start is >= Grace after *) +(* the start of the first mark that saw it unrooted (two-mark rule, *) +(* gc.go:262-300). The code refuses Grace <= deadline (gc.go:89) and a *) +(* mark with duration + deadline >= Grace (gc.go:255). *) +(***************************************************************************) +EXTENDS Integers, TLC + +CONSTANTS D, G, MD, MaxT, + MarkGuard \* TRUE (code): a mark whose duration + D >= G is discarded (gc.go:255) + +VARIABLES t, headHasK, op, gc, cand, deleted, published +vars == <> + +Init == /\ t = 0 /\ headHasK = TRUE + /\ op = [st |-> "idle", t0 |-> 0] + /\ gc = [st |-> "idle", start |-> 0, sawRoot |-> FALSE] + /\ cand = -1 \* start of the first mark that saw k unrooted (-1: none) + /\ deleted = FALSE /\ published = FALSE + +Tick == t < MaxT /\ t' = t + 1 /\ UNCHANGED <> +\* the host's next cut drops k from HEAD +Drop == headHasK /\ headHasK' = FALSE /\ UNCHANGED <> + +\* the copy op reads HEAD (k is a root while it is in HEAD) +OpRead == op.st = "idle" /\ headHasK /\ op' = [st |-> "read", t0 |-> t] /\ UNCHANGED <> +OpIntent == op.st = "read" /\ t < op.t0 + D /\ op' = [op EXCEPT !.st = "intent"] /\ UNCHANGED <> +\* deadline re-checked immediately before the publish; the snapshot then roots k +OpPublish == op.st = "intent" /\ t < op.t0 + D + /\ op' = [op EXCEPT !.st = "done"] /\ published' = TRUE + /\ UNCHANGED <> +OpRefuse == op.st \in {"read", "intent"} /\ t >= op.t0 + D + /\ op' = [op EXCEPT !.st = "refused"] /\ UNCHANGED <> + +IntentRoot == op.st = "intent" +SnapRoot == published + +\* mark: (1) read HEAD and snapshots ... +MarkStart == gc.st = "idle" /\ gc' = [st |-> "listed", start |-> t, sawRoot |-> headHasK \/ SnapRoot] + /\ UNCHANGED <> +\* ... (2) list intents, at most MD ticks later; decide k +MarkEnd == /\ gc.st = "listed" + /\ LET rooted == gc.sawRoot \/ IntentRoot + late == t - gc.start > MD \* the mark took longer than MD + void == late \/ (MarkGuard /\ (t - gc.start) + D >= G) + IN IF void + THEN /\ cand' = -1 /\ deleted' = deleted \* a failed mark discards coverage + ELSE IF rooted + THEN /\ cand' = -1 /\ deleted' = deleted + ELSE IF cand >= 0 /\ gc.start - cand >= G + THEN /\ deleted' = TRUE /\ cand' = cand + ELSE /\ cand' = (IF cand >= 0 THEN cand ELSE gc.start) /\ deleted' = deleted + /\ gc' = [st |-> "idle", start |-> 0, sawRoot |-> FALSE] + /\ UNCHANGED <> + +Next == Tick \/ Drop \/ OpRead \/ OpIntent \/ OpPublish \/ OpRefuse \/ MarkStart \/ MarkEnd +Spec == Init /\ [][Next]_vars + +\* GC never deletes a chunk that a published snapshot, an intent, or HEAD names +NoLiveDelete == deleted => ~(published \/ IntentRoot \/ headHasK) +W_Publish == ~published +W_Delete == ~deleted +============================================================================= diff --git a/seaweed-block/docs/spec/SmartWALRecovery.tla b/seaweed-block/docs/spec/SmartWALRecovery.tla new file mode 100644 index 0000000000..14ea84c1d9 --- /dev/null +++ b/seaweed-block/docs/spec/SmartWALRecovery.tla @@ -0,0 +1,156 @@ +-------------------------- MODULE SmartWALRecovery -------------------------- +(***************************************************************************) +(* S3, smartwal layout (core/storage/smartwal at 5c293821): data is *) +(* written IN PLACE to the extent block of its LBA, then a metadata record *) +(* {lsn, lba, crc of the data, durable_lsn} goes to ring slot lsn mod C *) +(* (store.go:266-288, ring.go:45-55). Sync is one fsync (store.go:314-331).*) +(* Unsynced extent blocks and ring slots are written back in ARBITRARY *) +(* order; a slot may also be written back TORN (magic intact, bad CRC). *) +(* Crash at any point, optionally with ONE durable extent block or ring *) +(* slot corrupted. Recovery may run twice: after the first recovery the *) +(* store continues, may AdvanceFrontier (an in-memory jump that writes no *) +(* slots), writes, syncs and crashes again (a schedule from review of *) +(* PR #155). *) +(* Each write has a unique issue number `ts` that stands for its data/CRC. *) +(* *) +(* Rule: *) +(* "current" runRecovery (recovery.go:39-110): valid slots only (a bad *) +(* CRC is skipped as torn, ring.go:62-82); per LBA the *) +(* highest-LSN record; extent must match its crc else fail *) +(* closed (85d93753); frontier = max verified LSN. *) +(* "holeFail" also fail closed on any missing LSN in the window below Hi.*) +(* "pr155" PR #155 at 089d2d9: a torn slot is a mid-history hole *) +(* (wal_corrupt) unless it is the slot right after the highest*) +(* valid LSN; its LSN is inferred from its position. *) +(* "pr155o" the pr155 torn-slot rule alone (extent mismatches are not *) +(* judged), to isolate the positional inference (a schedule *) +(* from review of PR #155). *) +(* "watermark" W = max durable_lsn over valid records; a missing LSN *) +(* <= W not covered by a gap marker, or an extent mismatch at *) +(* a record <= W, fails closed; above W it is a torn tail. *) +(* "ordered" watermark, and the record is durable before the data write.*) +(* Marker: AdvanceFrontier persists a gap record covering the skipped LSNs.*) +(* Repair: before the store continues, recovery durably replaces every *) +(* slot it treated as a torn tail (torn, or any record above W of *) +(* an LBA whose extent mismatches) with a gap record for that LSN, *) +(* re-attests the last record of such an LBA with the CRC of the *) +(* bytes the extent holds, and the frontier is max(W, verified and *) +(* attested last writers), so a later *) +(* watermark cannot reclassify it as corruption. *) +(***************************************************************************) +EXTENDS Integers, FiniteSets, Sequences, TLC + +CONSTANTS C, MaxLSN, LBAs, Rule, CorruptOn, MaxTs, Jump, Marker, Rounds, Repair, CorruptExtent + +NoRec == [k |-> "zero", lsn |-> 0, lo |-> 0, lba |-> "-", crc |-> 0, dl |-> 0] +Slots == 0..(C - 1) +Pgs == {<<"e", l>> : l \in LBAs} \cup {<<"r", s>> : s \in Slots} +Ordered == Rule = "ordered" + +VARIABLES cache, disk, nxt, ts, synced, pend, lastSynced, phase, corrupt, round, res +vars == <> + +Init == /\ cache = [p \in Pgs |-> IF p[1] = "e" THEN 0 ELSE NoRec] + /\ disk = cache + /\ nxt = 1 /\ ts = 0 /\ synced = 0 + /\ pend = [l \in LBAs |-> 0] /\ lastSynced = [l \in LBAs |-> 0] + /\ phase = "run" /\ corrupt = <<"-", "-">> /\ round = 1 + /\ res = [failed |-> FALSE, state |-> [l \in LBAs |-> 0], frontier |-> 0, everCorrupt |-> FALSE] + +Write(l) == /\ phase = "run" /\ nxt <= MaxLSN /\ ts < MaxTs + /\ LET r == [k |-> "rec", lsn |-> nxt, lo |-> nxt, lba |-> l, crc |-> ts + 1, dl |-> synced] + IN /\ cache' = [cache EXCEPT ![<<"e", l>>] = ts + 1, ![<<"r", nxt % C>>] = r] + /\ disk' = IF Ordered THEN [disk EXCEPT ![<<"r", nxt % C>>] = r] ELSE disk + /\ nxt' = nxt + 1 /\ ts' = ts + 1 + /\ pend' = [pend EXCEPT ![l] = ts + 1] + /\ UNCHANGED <> + +\* in-memory frontier jump (no slots written); with Marker a gap record covering +\* the skipped LSNs goes to the slot of the last skipped LSN +Advance == /\ phase = "run" /\ round > 1 /\ nxt + Jump <= MaxLSN + /\ cache' = IF Marker + THEN [cache EXCEPT ![<<"r", (nxt + Jump - 1) % C>>] = + [k |-> "gap", lsn |-> nxt + Jump - 1, lo |-> nxt, lba |-> "-", crc |-> 0, dl |-> synced]] + ELSE cache + /\ nxt' = nxt + Jump + /\ UNCHANGED <> + +Writeback == /\ phase = "run" + /\ \E p \in Pgs : /\ cache[p] # disk[p] + /\ \/ disk' = [disk EXCEPT ![p] = cache[p]] + \/ p[1] = "r" /\ disk' = [disk EXCEPT ![p] = [NoRec EXCEPT !.k = "torn"]] + /\ UNCHANGED <> + +Sync == /\ phase = "run" /\ (cache # disk \/ synced < nxt - 1) + /\ disk' = cache /\ synced' = nxt - 1 + /\ lastSynced' = pend + /\ UNCHANGED <> + +Crash == /\ phase = "run" /\ phase' = "crashed" + /\ \/ corrupt' = <<"-", "-">> + \/ CorruptOn /\ \E p \in Pgs : (IF p[1] = "e" THEN CorruptExtent ELSE disk[p].k = "rec") /\ corrupt' = p + /\ UNCHANGED <> + +----------------------------------------------------------------------------- +Max(S) == IF S = {} THEN 0 ELSE CHOOSE m \in S : \A s \in S : s <= m +SlotOK(s) == disk[<<"r", s>>].k \in {"rec", "gap"} /\ corrupt # <<"r", s>> +Valid == {disk[<<"r", s>>] : s \in {t \in Slots : SlotOK(t) /\ disk[<<"r", t>>].k = "rec"}} +Gaps == {disk[<<"r", s>>] : s \in {t \in Slots : SlotOK(t) /\ disk[<<"r", t>>].k = "gap"}} +Torn == {s \in Slots : disk[<<"r", s>>].k = "torn" \/ corrupt = <<"r", s>>} +Covered == UNION {g.lo..g.lsn : g \in Gaps} +ExtentVal(l) == IF corrupt = <<"e", l>> THEN -1 ELSE disk[<<"e", l>>] +Last(l) == LET mine == {r \in Valid : r.lba = l} + IN IF mine = {} THEN NoRec ELSE CHOOSE r \in mine : \A q \in mine : q.lsn <= r.lsn +Hi == Max({r.lsn : r \in Valid} \cup {g.lsn : g \in Gaps}) +Window == (IF Hi > C THEN Hi - C + 1 ELSE 1)..Hi +Present == {r.lsn : r \in Valid} \cup Covered +Missing == {n \in Window : n \notin Present} +\* positional LSN of a slot relative to Hi (PR #155 revision 089d2d9, smartwal/recovery.go:122) +Implied(s) == Hi - ((Hi - s) % C) +W == Max({r.dl : r \in Valid} \cup {g.dl : g \in Gaps}) + +Recover == + /\ phase = "crashed" + /\ LET mismatch(l) == Last(l) # NoRec /\ ExtentVal(l) # Last(l).crc + tornMid == \E s \in Torn : (Hi - s) % C # C - 1 /\ Implied(s) >= 1 /\ Implied(s) \notin Covered + failed == CASE Rule = "current" -> \E l \in LBAs : mismatch(l) + [] Rule = "holeFail" -> (\E l \in LBAs : mismatch(l)) \/ Missing # {} + [] Rule \in {"pr155", "pr155o"} -> (\E l \in LBAs : mismatch(l) /\ Rule = "pr155") \/ tornMid + [] OTHER -> \/ \E l \in LBAs : mismatch(l) /\ Last(l).lsn <= W + \/ \E n \in Missing : n <= W + verified == {Last(l).lsn : l \in {m \in LBAs : Last(m) # NoRec /\ ~mismatch(m)}} + \* "current" keeps the code's frontier (max verified last-writer, recovery.go:96); + \* the proposals count every valid record that is not a torn tail, and W + good == {r.lsn : r \in {q \in Valid : ~\E l \in LBAs : mismatch(l) /\ Last(l) = q}} + attested == IF Repair THEN {Last(l).lsn : l \in {m \in LBAs : mismatch(m) /\ Last(m).lsn > W}} ELSE {} + fr == IF Rule \in {"watermark", "ordered"} THEN Max(verified \cup Covered \cup {W} \cup attested) ELSE Max(verified \cup Covered) + IN /\ res' = [failed |-> failed, state |-> [l \in LBAs |-> ExtentVal(l)], frontier |-> fr, + everCorrupt |-> res.everCorrupt \/ corrupt # <<"-", "-">>] + \* the store continues from the recovered image (store.go:179-201): nextLSN = frontier+1 + /\ IF ~failed /\ round < Rounds + THEN /\ phase' = "run" /\ round' = round + 1 + /\ LET settled(q) == Repair /\ q[1] = "r" /\ (q[2] \in Torn \/ (disk[q].k = "rec" /\ disk[q].lsn > W /\ mismatch(disk[q].lba))) + img == [p \in Pgs |-> IF p[1] = "e" THEN ExtentVal(p[2]) + ELSE IF settled(p) /\ disk[p].k = "rec" /\ Last(disk[p].lba) = disk[p] /\ ExtentVal(disk[p].lba) >= 0 + \* re-attest the bytes the extent now holds (the accepted torn tail) + THEN [disk[p] EXCEPT !.crc = ExtentVal(disk[p].lba), !.dl = W] + ELSE IF settled(p) THEN [k |-> "gap", lsn |-> Implied(p[2]), lo |-> Implied(p[2]), lba |-> "-", crc |-> 0, dl |-> W] + ELSE disk[p]] + IN /\ cache' = img /\ disk' = img + /\ nxt' = fr + 1 /\ synced' = fr + /\ pend' = [l \in LBAs |-> ExtentVal(l)] /\ lastSynced' = [l \in LBAs |-> ExtentVal(l)] + /\ corrupt' = <<"-", "-">> + ELSE /\ phase' = "recovered" + /\ UNCHANGED <> + /\ UNCHANGED <> + +Next == (\E l \in LBAs : Write(l)) \/ Advance \/ Writeback \/ Sync \/ Crash \/ Recover +Spec == Init /\ [][Next]_vars + +----------------------------------------------------------------------------- +\* checked after the final recovery (state = what the volume would serve) +I1 == phase = "recovered" => (res.failed \/ \A l \in LBAs : res.state[l] >= lastSynced[l]) +I1Frontier == phase = "recovered" => (res.failed \/ res.frontier >= synced) +I2 == (phase = "recovered" /\ ~res.everCorrupt /\ corrupt = <<"-", "-">>) => ~res.failed +W_NoRecovery == ~(phase = "recovered" /\ ~res.failed /\ round = Rounds /\ synced >= 2) +============================================================================= diff --git a/seaweed-block/docs/spec/WALRecovery.tla b/seaweed-block/docs/spec/WALRecovery.tla new file mode 100644 index 0000000000..4ec471be59 --- /dev/null +++ b/seaweed-block/docs/spec/WALRecovery.tla @@ -0,0 +1,256 @@ +----------------------------- MODULE WALRecovery ----------------------------- +(***************************************************************************) +(* S3, walstore layout: a ring WAL of K pages in front of an extent. *) +(* Records of 1 or 2 pages are appended to the page cache, written back to *) +(* the durable image page by page in ARBITRARY order, and made durable as *) +(* a whole by Sync. The flusher checkpoints the oldest record into the *) +(* extent and persists the superblock {tail, head, checkpoint}. Then the *) +(* host crashes at any point, optionally with ONE durable record page *) +(* corrupted, and recovery runs once. *) +(* *) +(* Rule selects recovery: *) +(* "current" core/storage/recovery.go recoverWAL at 5c293821: scan *) +(* each physical range, stop the RANGE at the first decode *) +(* failure, continue with the next range, replay all. *) +(* "holeFail" fail closed when any LSN in (checkpoint, max] is missing.*) +(* "pr155" PR #155 at 089d2d9 (walstore, warning-only): every range *) +(* that stops on a bad entry cuts replay at its decoded *) +(* predecessor + 1 (default checkpoint + 1); scan-order replay.*) +(* "watermark" each record carries durable_lsn (highest LSN whose Sync *) +(* had completed when it was written). W = max over valid *) +(* records. Contiguous prefix R from checkpoint: R < W -> *) +(* fail closed; else replay only up to R (never past a hole).*) +(* "watermarkSB" as watermark, plus Sync persists W in the superblock *) +(* (second fsync) before it returns. *) +(* "watermarkFull" watermarkSB, and recovery decodes every page position *) +(* instead of stopping a range at its first bad entry. *) +(***************************************************************************) +EXTENDS Integers, FiniteSets, Sequences, TLC + +CONSTANTS K, MaxLSN, LBAs, Rule, CorruptOn, MaxCkpt, + CkptLag, \* TRUE (code): persistCheckpoint writes the PRE-advance tail (walstore.go:402-405, flusher.go:223-227) + ReuseBound, \* "mem" (code): the writer reuses space released by the in-memory tail; "persisted": root fix + JumpOn, \* an AdvanceFrontier / BASE jump (in memory; persisted by the next Sync, walstore.go:866-898) + JumpPersistedBySync, \* TRUE: Sync persists the pending jump before it acknowledges; FALSE: the + \* rebuild path (AdvanceFrontier stays in memory until MarkBaseComplete + Sync) + Forge \* a 2-page record's payload page may carry bytes that decode as a valid record + +Zero == [k |-> "zero", lsn |-> 0, part |-> 0, size |-> 0, lba |-> "-", dl |-> 0, fake |-> FALSE] +Pad == [k |-> "pad", lsn |-> 0, part |-> 0, size |-> 0, lba |-> "-", dl |-> 0, fake |-> FALSE] +Pages == 0..(K - 1) + +VARIABLES + memTail, pendJ, syncing, \* in-memory tail; pending jump LSN; LSNs a Sync made durable but not yet acked + cache, disk, \* page cache and durable image of the WAL pages + recs, \* appended records, in LSN order: [lsn, lba, start (logical), size, dl] + head, \* in-memory logical head (next page) + synced, \* highest LSN whose Sync completed (acknowledged durable) + sb, \* durable superblock [tail, head, ckpt, w] + extent, \* durable extent: lba -> LSN of the write it holds (0 = never) + phase, corrupt, \* "run" | "crashed" | "recovered"; corrupted page or -1 + res \* recovery result [failed, state (lba -> lsn), replayed (set of LSN)] + +vars == <> + +NextLSN == Len(recs) + 1 + +Init == /\ memTail = 0 /\ pendJ = 0 /\ syncing = 0 + /\ cache = [p \in Pages |-> Zero] /\ disk = [p \in Pages |-> Zero] + /\ recs = <<>> /\ head = 0 /\ synced = 0 + /\ sb = [tail |-> 0, head |-> 0, ckpt |-> 0, w |-> 0] + /\ extent = [l \in LBAs |-> 0] + /\ phase = "run" /\ corrupt = -1 + /\ res = [failed |-> FALSE, state |-> [l \in LBAs |-> 0], replayed |-> {}, forged |-> FALSE, lastWriter |-> [l \in LBAs |-> 0]] + +\* WAL append (walstore.go write path -> wal append): a 2-page record never +\* straddles the physical end; the remainder is padded and it starts the next lap. +AppendRec(l, sz) == + /\ phase = "run" /\ NextLSN <= MaxLSN + /\ LET p == head % K + padN == IF p + sz > K THEN K - p ELSE 0 + st == head + padN + rec(i) == [k |-> "rec", lsn |-> NextLSN, part |-> i, size |-> sz, lba |-> l, dl |-> synced, fake |-> FALSE] + IN /\ st + sz - (IF ReuseBound = "persisted" THEN sb.tail ELSE memTail) <= K \* ring space + /\ cache' = [q \in Pages |-> + IF padN > 0 /\ q >= p THEN Pad + ELSE IF q = st % K THEN rec(1) + ELSE IF sz = 2 /\ q = (st + 1) % K THEN (IF Forge THEN [rec(2) EXCEPT !.fake = TRUE] ELSE rec(2)) + ELSE cache[q]] + /\ recs' = Append(recs, [lsn |-> NextLSN, lba |-> l, start |-> st, size |-> sz, dl |-> synced, jump |-> FALSE]) + /\ head' = st + sz + /\ UNCHANGED <> + +\* AdvanceFrontier (walstore.go AdvanceFrontier): skip one LSN without writing it; the jump is +\* recorded in memory and persisted as the checkpoint by the next Sync (when JumpPersistedBySync) +JumpFrontier == /\ JumpOn /\ phase = "run" /\ NextLSN <= MaxLSN /\ pendJ = 0 /\ sb.ckpt = Len(recs) + /\ recs' = Append(recs, [lsn |-> NextLSN, lba |-> "-", start |-> head, size |-> 0, dl |-> synced, jump |-> TRUE]) + /\ pendJ' = NextLSN + /\ UNCHANGED <> + +\* the kernel writes one dirty page back, in any order +Writeback == /\ phase = "run" + /\ \E p \in Pages : /\ cache[p] # disk[p] /\ disk' = [disk EXCEPT ![p] = cache[p]] + /\ UNCHANGED <> + +\* Sync, step 1: fsync of the WAL pages (durable, not yet acknowledged) +Sync == /\ phase = "run" /\ synced < Len(recs) /\ syncing = 0 + /\ disk' = cache /\ syncing' = Len(recs) + /\ UNCHANGED <> +\* Sync, step 2: the second fsync (superblock: pending jump as checkpoint, head; W for the +\* watermark rules), then the acknowledgement (walstore.go:866-905) +SyncAck == /\ phase = "run" /\ syncing > 0 + /\ LET j == JumpPersistedBySync /\ pendJ > sb.ckpt /\ pendJ <= syncing + w == Rule \in {"watermarkSB", "watermarkFull", "prefixFullSB"} + IN /\ sb' = [sb EXCEPT !.ckpt = IF j THEN pendJ ELSE @, !.head = IF j THEN head ELSE @, + !.w = IF w THEN syncing ELSE @] + /\ pendJ' = IF j THEN 0 ELSE pendJ + /\ synced' = syncing /\ syncing' = 0 + /\ UNCHANGED <> + +\* flusher: apply the oldest retained record to the extent, fsync it, then +\* persist the superblock (tail past it, current head, checkpoint LSN) +Checkpoint == /\ phase = "run" /\ sb.ckpt < Len(recs) /\ sb.ckpt < MaxCkpt + /\ LET r == recs[sb.ckpt + 1] + end == IF r.jump THEN memTail ELSE r.start + r.size + IN /\ extent' = IF r.jump THEN extent ELSE [extent EXCEPT ![r.lba] = r.lsn] + \* persistCheckpoint writes {ckpt, live head, tail}; with CkptLag the tail is the + \* PRE-advance one and the in-memory tail advances afterwards + /\ sb' = [sb EXCEPT !.tail = IF CkptLag THEN memTail ELSE end, !.head = head, !.ckpt = r.lsn] + /\ memTail' = end + /\ pendJ' = IF r.jump THEN 0 ELSE pendJ + /\ UNCHANGED <> + +Crash == /\ phase = "run" /\ phase' = "crashed" + /\ \/ corrupt' = -1 + \/ CorruptOn /\ \E p \in Pages : disk[p].k = "rec" /\ corrupt' = p + /\ UNCHANGED <> + +----------------------------------------------------------------------------- +(* recovery *) + +Bad(p) == p = corrupt +\* a valid record whose first page is at physical p, inside [p, e) +Forged(p) == disk[p].k = "rec" /\ disk[p].part = 2 /\ disk[p].fake /\ ~Bad(p) +FakeRec(p) == [k |-> "rec", lsn |-> disk[p].lsn + 1, part |-> 1, size |-> 1, lba |-> "y", dl |-> disk[p].dl, fake |-> TRUE] +View(p) == IF Forged(p) THEN FakeRec(p) ELSE disk[p] +ValidAt0(p, e) == + /\ disk[p].k = "rec" /\ disk[p].part = 1 /\ ~Bad(p) + /\ disk[p].size = 2 => (p + 1 < e /\ disk[p + 1].k = "rec" /\ disk[p + 1].part = 2 + /\ disk[p + 1].lsn = disk[p].lsn /\ ~Bad(p + 1)) +ValidAt(p, e) == Forged(p) \/ ValidAt0(p, e) + +\* scan [pos, e) (recovery.go:96-206): the records decoded in scan order, and +\* whether the range stopped on a BAD entry (torn or corrupt; trailing zeros are +\* not bad) together with the LSN of its decoded predecessor in the range +\* (pred starts at the checkpoint, as #155 does at recovery.go:201 of 089d2d9) +RECURSIVE Scan(_, _, _) +Scan(pos, e, pred) == + IF pos >= e THEN [recs |-> <<>>, bad |-> FALSE, pred |-> pred] + ELSE IF disk[pos].k = "pad" THEN Scan(pos + 1, e, pred) + ELSE IF ValidAt(pos, e) + THEN LET r == Scan(pos + View(pos).size, e, View(pos).lsn) + IN [r EXCEPT !.recs = <> \o @] + ELSE [recs |-> <<>>, bad |-> disk[pos].k # "zero", pred |-> pred] + +\* physical ranges from the superblock (recovery.go:57-93). For head == tail the +\* code walks record footers backward from the physical end to find the start +\* of the high run (findDefensiveHighRunStart, recovery.go:250-283, and +\* previousValidWALRecord); a 1-page footer stands for the size field. +PrevStart(c) == + IF c >= 1 /\ disk[c - 1].k = "pad" THEN c - 1 + ELSE IF c >= 1 /\ disk[c - 1].k = "rec" /\ disk[c - 1].part = 1 /\ disk[c - 1].size = 1 /\ ValidAt(c - 1, K) THEN c - 1 + ELSE IF c >= 2 /\ disk[c - 1].k = "rec" /\ disk[c - 1].part = 2 /\ disk[c - 2].size = 2 /\ disk[c - 2].lsn = disk[c - 1].lsn /\ ValidAt(c - 2, K) THEN c - 2 + ELSE -1 +RECURSIVE Walk(_, _, _) +Walk(c, earliest, data) == LET p == PrevStart(c) + IN IF p < 0 THEN [e |-> earliest, data |-> data] + ELSE Walk(p, p, data \/ disk[p].k = "rec") +HighRun == LET w == Walk(K, K, FALSE) IN IF w.data /\ w.e > 0 /\ w.e < K THEN w.e ELSE 0 +DefStarts == {HighRun} +RangesFrom(ds) == + LET pH == sb.head % K + pT == sb.tail % K + IN IF sb.head = sb.tail /\ Rule = "rootLww" /\ pH # 0 THEN <<<>, <<0, pH>>, <<0, 0>>>> \* #159 + ELSE IF sb.head = sb.tail THEN <<<>, <<0, ds>>, <<0, 0>>>> + ELSE IF pH > pT THEN <<<>, <>, <<0, pT>>>> + ELSE <<<>, <<0, pH>>, <>>> + +Scans(ds) == LET r == RangesFrom(ds) IN [i \in 1..3 |-> Scan(r[i][1], r[i][2], sb.ckpt)] +\* retained records in scan order (LSN above the checkpoint) +\* "watermarkFull": every page position is decoded on its own (records are +\* self-checking), so no range break can hide a durable record +FullSeq == LET ps == {p \in Pages : ValidAt(p, K) /\ disk[p].lsn > sb.ckpt} + RECURSIVE Build(_) + Build(S) == IF S = {} THEN <<>> ELSE LET m == CHOOSE x \in S : \A y \in S : x <= y + IN <> \o Build(S \ {m}) + IN Build(ps) +FoundSeq(ds) == IF Rule \in {"watermarkFull", "lwwFull", "prefixFull", "prefixFullSB"} THEN FullSeq ELSE LET s == Scans(ds) + all == s[1].recs \o s[2].recs \o s[3].recs + IN SelectSeq(all, LAMBDA f : f.lsn > sb.ckpt) + +Max(S) == IF S = {} THEN 0 ELSE CHOOSE m \in S : \A s \in S : s <= m +Min(S) == CHOOSE m \in S : \A s \in S : m <= s +SeqSet(q) == {q[i] : i \in 1..Len(q)} +RECURSIVE PrefixIn(_, _) +PrefixIn(n, L) == IF n + 1 \in L THEN PrefixIn(n + 1, L) ELSE n + +\* replay into the dirty map: scan order, unconditional replace (recovery.go:158-190, +\* dirty_map.go putAt) for "current"/"holeFail"/"pr155"; by LSN for the watermark rules +RECURSIVE FoldScan(_, _, _) +FoldScan(q, i, st) == IF i > Len(q) THEN st ELSE FoldScan(q, i + 1, [st EXCEPT ![q[i].lba] = q[i].lsn]) +ByLSN(F) == [l \in LBAs |-> LET mine == {f.lsn : f \in {g \in F : g.lba = l}} + IN IF mine = {} THEN extent[l] ELSE Max(mine)] + +Recover == + /\ phase = "crashed" + /\ \E ds \in DefStarts : + LET q == FoundSeq(ds) + F == SeqSet(q) + L == {f.lsn : f \in F} + R == PrefixIn(sb.ckpt, L) + W == Max({f.dl : f \in F} \cup {sb.w}) + hole == \E n \in (sb.ckpt + 1)..Max(L) : n \notin L + sc == Scans(ds) + cuts == {sc[i].pred + 1 : i \in {j \in 1..3 : sc[j].bad}} + cutoff == IF cuts = {} THEN Max(L) + 1 ELSE Min(cuts) + keep == CASE Rule = "pr155" -> SelectSeq(q, LAMBDA f : f.lsn < cutoff) + [] Rule \in {"watermark", "watermarkSB", "watermarkFull", "prefixFull", "prefixFullSB"} -> SelectSeq(q, LAMBDA f : f.lsn <= R) + [] OTHER -> q + failed == CASE Rule = "holeFail" -> hole + [] Rule \in {"watermark", "watermarkSB", "watermarkFull", "prefixFullSB"} -> R < W + [] OTHER -> FALSE \* current; pr155 is warning-only for walstore + st == IF Rule \in {"watermark", "watermarkSB", "watermarkFull", "lww", "lwwFull", "prefixFull", "prefixFullSB", "rootLww"} THEN ByLSN(SeqSet(keep)) + ELSE FoldScan(keep, 1, extent) + IN res' = [failed |-> failed, state |-> st, replayed |-> {f.lsn : f \in SeqSet(keep)}, + forged |-> \E f \in SeqSet(keep) : f.fake /\ f.part = 1, + lastWriter |-> ByLSN(SeqSet(keep))] + /\ phase' = "recovered" + /\ UNCHANGED <> + +Next == \/ \E l \in LBAs, sz \in {1, 2} : AppendRec(l, sz) + \/ Writeback \/ Sync \/ SyncAck \/ Checkpoint \/ JumpFrontier \/ Crash \/ Recover + +Spec == Init /\ [][Next]_vars + +----------------------------------------------------------------------------- +(* I1: every synced write is recovered (or superseded by a later write that is), or recovery fails closed *) +I1 == phase = "recovered" => + (res.failed \/ \A i \in 1..synced : recs[i].jump \/ res.state[recs[i].lba] >= recs[i].lsn) +(* I2: crash only, no corruption: recovery never reports corruption *) +I2 == (phase = "recovered" /\ corrupt = -1) => ~res.failed +(* I0Prefix (informational): a successful recovery never replays past a hole *) +I0Prefix == (phase = "recovered" /\ ~res.failed) => + \A n \in res.replayed : \A m \in (sb.ckpt + 1)..n : m \in res.replayed + +(* recovery never replays bytes forged inside a user data payload *) +NoForgedReplay == (phase = "recovered" /\ ~res.failed) => ~res.forged +(* replayed state equals the last writer by LSN among the replayed records (review of #155) *) +ReplayLastWriter == (phase = "recovered" /\ ~res.failed) => res.state = res.lastWriter + +\* witnesses (expected violated): recovery succeeds after a wrap with replayed records +W_NoWrapRecovery == ~(phase = "recovered" /\ ~res.failed /\ head > K /\ res.replayed # {}) +W_NoCorruptFailClosed == ~(phase = "recovered" /\ corrupt # -1 /\ res.failed) +\* a recovery after a persisted jump that replays a synced record above it +W_NoJumpRecovery == ~(phase = "recovered" /\ ~res.failed /\ \E i \in 1..synced : recs[i].jump /\ sb.ckpt >= recs[i].lsn + /\ \E k \in (i + 1)..synced : ~recs[k].jump /\ recs[k].lsn \in res.replayed) +============================================================================= diff --git a/seaweed-block/docs/spec/WALReplica.tla b/seaweed-block/docs/spec/WALReplica.tla new file mode 100644 index 0000000000..262ec286a9 --- /dev/null +++ b/seaweed-block/docs/spec/WALReplica.tla @@ -0,0 +1,127 @@ +------------------------------ MODULE WALReplica ------------------------------ +(***************************************************************************) +(* S3 extension: does the synced watermark break replicated mode (RF=2)? *) +(* Scope: recovery classification and promotion eligibility only (full *) +(* failover is S6). The WAL is abstracted to one slot per LSN (the page *) +(* layout is WALRecovery.tla); unsynced slots reach disk in any order. *) +(* *) +(* Primary P writes locally and ships records in order to replica R; R *) +(* writes them to its own WAL and Syncs on its own schedule, then acks. *) +(* A write is acknowledged to the client once P synced it and R acked it. *) +(* Optionally R joined by BASE rebuild at LSN B (RebaseShipLSN): its WAL *) +(* legitimately lacks 1..B. As in walstore at 5c29382 the jump is durable *) +(* only as the superblock checkpoint written by the next Sync *) +(* (walstore.go:880-935); live-lane records above it may reach disk first. *) +(* *) +(* Constants: *) +(* DlLocal c1 TRUE: R stamps its own completed-Sync LSN; *) +(* c2 FALSE (RED): R stores the primary's watermark verbatim. *) +(* Marker g1 TRUE: the BASE install persists a gap marker covering *) +(* 1..B; g2 FALSE (RED): no marker. *) +(* SBWatermark Sync also persists W out of band (WALRecovery "watermarkSB").*) +(* JumpInStamp the stamp counts the unpersisted BASE jump as synced *) +(* (an in-memory frontier bump before the Sync that persists it).*) +(* PromoteGate promotion only considers nodes that did not fail closed. *) +(***************************************************************************) +EXTENDS Integers, FiniteSets, Sequences, TLC + +CONSTANTS MaxLSN, B, DlLocal, Marker, SBWatermark, CorruptOn, PromoteGate, JumpInStamp + +Nodes == {"P", "R"} +None == [k |-> "none", lo |-> 0, hi |-> 0, dl |-> 0] +Rec(n, d) == [k |-> "rec", lo |-> n, hi |-> n, dl |-> d] +LSNs == 1..MaxLSN + +VARIABLES cache, disk, synced, sbw, ckpt, next, ship, racked, acked, phase, corrupt, res, promoted +vars == <> + +\* P has already written and synced 1..B (acknowledged in degraded RF=1) when +\* R is rebuilt from a durable BASE image at B; R's jump is not yet persisted +Init == + /\ LET pre == [n \in LSNs |-> IF n <= B THEN Rec(n, n - 1) ELSE None] + rwal == [n \in LSNs |-> IF B > 0 /\ Marker /\ n = B THEN [k |-> "gap", lo |-> 1, hi |-> B, dl |-> 0] ELSE None] + IN /\ cache = [x \in Nodes |-> IF x = "P" THEN pre ELSE rwal] + /\ disk = [x \in Nodes |-> IF x = "P" THEN pre ELSE [n \in LSNs |-> None]] + /\ synced = [x \in Nodes |-> IF x = "P" \/ JumpInStamp THEN B ELSE 0] + /\ sbw = [x \in Nodes |-> IF SBWatermark /\ x = "P" THEN B ELSE 0] + /\ ckpt = [x \in Nodes |-> 0] + /\ next = B + 1 /\ ship = <<>> /\ racked = 0 /\ acked = 0 \* acked = by P and R (1..B were RF=1 only) + /\ phase = "run" /\ corrupt = <<"-", 0>> + /\ res = [x \in Nodes |-> [failed |-> FALSE, frontier |-> 0]] + /\ promoted = "-" + +PWrite == /\ phase = "run" /\ next <= MaxLSN + /\ cache' = [cache EXCEPT !["P"][next] = Rec(next, synced["P"])] + /\ ship' = Append(ship, [lsn |-> next, dl |-> synced["P"]]) + /\ next' = next + 1 + /\ UNCHANGED <> + +RRecv == /\ phase = "run" /\ ship # <<>> + /\ LET m == Head(ship) + IN cache' = [cache EXCEPT !["R"][m.lsn] = Rec(m.lsn, IF DlLocal THEN synced["R"] ELSE m.dl)] + /\ ship' = Tail(ship) + /\ UNCHANGED <> + +Writeback(x) == /\ phase = "run" + /\ \E n \in LSNs : cache[x][n] # disk[x][n] /\ disk' = [disk EXCEPT ![x][n] = cache[x][n]] + /\ UNCHANGED <> + +Top(x) == LET have == {n \in LSNs : cache[x][n].k # "none"} IN IF have = {} THEN 0 ELSE CHOOSE m \in have : \A h \in have : h <= m + +Jump(x) == IF x = "R" THEN B ELSE 0 +Sync(x) == /\ phase = "run" /\ (Top(x) > synced[x] \/ ckpt[x] < Jump(x)) + /\ LET s1 == IF Top(x) > Jump(x) THEN Top(x) ELSE Jump(x) + IN /\ disk' = [disk EXCEPT ![x] = cache[x]] + /\ ckpt' = [ckpt EXCEPT ![x] = IF Jump(x) > @ THEN Jump(x) ELSE @] \* WALCheckpointLSN, second fsync + /\ synced' = [synced EXCEPT ![x] = s1] + /\ sbw' = IF SBWatermark THEN [sbw EXCEPT ![x] = s1] ELSE sbw + /\ racked' = IF x = "R" THEN s1 ELSE racked \* R's durable ack + /\ UNCHANGED <> + +Ack == /\ phase = "run" + /\ LET a == IF synced["P"] < racked THEN synced["P"] ELSE racked + IN /\ a > acked /\ acked' = a + /\ UNCHANGED <> + +\* both nodes lose power; at most one durable record on one node is corrupted +Crash == /\ phase = "run" /\ phase' = "crashed" + /\ \/ corrupt' = <<"-", 0>> + \/ CorruptOn /\ \E x \in Nodes, n \in LSNs : disk[x][n].k # "none" /\ corrupt' = <> + /\ UNCHANGED <> + +----------------------------------------------------------------------------- +Max(S) == IF S = {} THEN 0 ELSE CHOOSE m \in S : \A s \in S : s <= m +ValidSlots(x) == {n \in LSNs : disk[x][n].k # "none" /\ corrupt # <>} +Covered(x) == UNION {disk[x][n].lo..disk[x][n].hi : n \in ValidSlots(x)} +RECURSIVE PrefixOf(_, _) +PrefixOf(x, n) == IF n + 1 \in Covered(x) THEN PrefixOf(x, n + 1) ELSE n +Wm(x) == Max({disk[x][n].dl : n \in ValidSlots(x)} \cup {sbw[x]}) + +\* watermark rule (WALRecovery "watermark"/"watermarkSB"); R's extent holds 1..B from BASE +Recover == /\ phase = "crashed" + /\ res' = [x \in Nodes |-> LET R == PrefixOf(x, ckpt[x]) + IN [failed |-> R < Wm(x), frontier |-> R]] + /\ phase' = "recovered" + /\ UNCHANGED <> + +\* promotion picks the highest recovered frontier among the candidates +Promote == /\ phase = "recovered" /\ promoted = "-" + /\ LET cand == IF PromoteGate THEN {x \in Nodes : ~res[x].failed} ELSE Nodes + IN /\ cand # {} + /\ promoted' = CHOOSE x \in cand : \A y \in cand : res[y].frontier <= res[x].frontier + /\ phase' = "promoted" + /\ UNCHANGED <> + +Next == PWrite \/ RRecv \/ Ack \/ Crash \/ Recover \/ Promote + \/ \E x \in Nodes : Writeback(x) \/ Sync(x) +Spec == Init /\ [][Next]_vars + +----------------------------------------------------------------------------- +\* I2 per node: crash only, no corruption -> no node reports wal_corrupt +I2 == (phase \in {"recovered", "promoted"} /\ corrupt = <<"-", 0>>) => \A x \in Nodes : ~res[x].failed +\* I3: a node that recovered as wal_corrupt is never promoted, and every +\* acknowledged write survives on some eligible node +I3 == /\ phase = "promoted" => ~res[promoted].failed + /\ phase \in {"recovered", "promoted"} => \E x \in Nodes : ~res[x].failed /\ res[x].frontier >= acked +W_NoPromotion == ~(phase = "promoted" /\ acked >= 2) +============================================================================= diff --git a/seaweed-block/docs/spec/WorkspaceTakeover.tla b/seaweed-block/docs/spec/WorkspaceTakeover.tla new file mode 100644 index 0000000000..ec08859aca --- /dev/null +++ b/seaweed-block/docs/spec/WorkspaceTakeover.tla @@ -0,0 +1,398 @@ +-------------------------- MODULE WorkspaceTakeover -------------------------- +(***************************************************************************) +(* S2: epoch, fencing and takeover of one sw-block workspace volume moving *) +(* from host A (epoch 1) to host B, by a CLEAN move (detach, revoke, ACK, *) +(* assign) or a FORCED move (lease expired, assign at a higher epoch). *) +(* *) +(* Plain TLA+. One action = one remote call or one local decision. A *) +(* discrete global clock `now` is the blockmaster's (and the real) time; *) +(* each host's clock may lag it by at most Drift ticks (bounded rate *) +(* drift). Messages live in a set: delayed, reordered or lost. *) +(* Code at seaweed-block main 5c293821; mapping in README.md (S2). *) +(***************************************************************************) +EXTENDS Integers, FiniteSets, Sequences, TLC + +CONSTANTS + Kinds, \* move kinds the operator may use: subset of {"clean", "forced"} + MaxT, \* clock bound + TTL, \* workspace lease TTL (ticks) + ITTL, \* GC intent_ttl (ticks) + MaxLSN, \* VM writes per host bound (as LSN) + MaxCuts, \* cuts per host bound + Drift, \* max ticks a host clock may fall behind the master clock + MaxRestarts, \* blockmaster restarts + LeaseOn, \* --workspace-lease guard on the hosts (TRUE for workspace volumes) + \* ---- guards (TRUE = as in the code); RED variants turn one off ---- + LsnGuard, \* CASHead refuses next.remote_lsn < current chunk_remote.go:404 + StoreEpochGuard,\* CASHead refuses next.epoch < expected.epoch chunk_remote.go:391 + HostFence, \* layer fences on a HEAD of a newer epoch (supersededBy) chunk_layer.go:916,972,1032 + LayerLsnCheck, \* layer refuses a cut below HEAD.remote_lsn (lsn_behind) chunk_layer.go:800 + SeedFromObserved,\* B seeds its WAL from the HEAD its takeover CAS protects chunk_restore.go:38-43 + GCEpochRule, \* GC expires an intent only when the remote HEAD epoch > intent epoch gc.go:221 + WaitLeaseExpiry \* forced move waits for the lease to expire authority/workspace.go:314-318 + +Hosts == {"A", "B"} +NoRec == [gen |-> 0, epoch |-> 0, holder |-> "-", st |-> "-", dgen |-> 0, lsn |-> 0, img |-> <<"-", 0>>] +Head0 == [gen |-> 1, epoch |-> 1, holder |-> "A", st |-> "active", dgen |-> 0, lsn |-> 0, img |-> <<"A", 0>>] +Other(h) == IF h = "A" THEN "B" ELSE "A" + +VARIABLES + now, lag, \* clocks + head, stored, intents, \* remote store: HEAD, chunk bodies, intents + msgs, \* in-flight messages + asg, lease, ack, journal, maxEpoch, \* blockmaster durable state (authority store) + deadline, restarts, \* blockmaster in-memory lease deadline (reset on restart) + mv, \* operator's move in progress + host, \* per-host state + cut, \* per-host chunk-layer cut in progress + bpc, bobs, \* B's attach sequence and the HEAD it observed + hist \* history (never read by the protocol) + +vars == <> + +HNow(h) == now - lag[h] + +\* the volume server admits I/O and cuts (WorkspaceLeaseGuard.permits, workspace_lease.go:57-65) +Permits(h) == /\ host[h].epoch > 0 + /\ ~host[h].fenced + /\ (LeaseOn => host[h].until > HNow(h)) +Serving(h) == Permits(h) /\ host[h].ready /\ ~host[h].stopIO /\ ~host[h].detached + +\* chunk_layer.go:1032 supersededBy +SupersededBy(h, cur) == cur.epoch > host[h].epoch \/ (cur.epoch = host[h].epoch /\ cur.holder # h /\ cur.gen # 0) +Fences(h, cur) == HostFence /\ SupersededBy(h, cur) + +\* CASHead (chunk_remote.go:388-425): conditional on {gen, epoch}; refuses lower epoch / lower LSN +CasOK(base, next) == /\ head.gen = base.gen /\ head.epoch = base.epoch + /\ (StoreEpochGuard => next.epoch >= base.epoch) + /\ (LsnGuard => next.lsn >= head.lsn) + +Init == + /\ now = 0 /\ lag = [h \in Hosts |-> 0] + /\ head = Head0 /\ stored = {<<"A", 0>>} /\ intents = {} + /\ msgs = {} + /\ asg = [holder |-> "A", epoch |-> 1] + /\ lease = [holder |-> "A", epoch |-> 1, exp |-> TTL, revoking |-> FALSE, none |-> FALSE] + /\ ack = [gen |-> 0, holder |-> "-", epoch |-> 0] + /\ journal = [kind |-> "-", gen |-> 0, lsn |-> 0, newEpoch |-> 0] + /\ maxEpoch = 1 + /\ deadline = TTL /\ restarts = 0 + /\ mv = [st |-> "none", kind |-> "-", h |-> NoRec] + /\ host = [h \in Hosts |-> IF h = "A" + THEN [epoch |-> 1, until |-> TTL, fenced |-> FALSE, revoked |-> FALSE, stopIO |-> FALSE, + ready |-> TRUE, detached |-> FALSE, lsn |-> 0, lh |-> Head0, renewing |-> FALSE] + ELSE [epoch |-> 0, until |-> 0, fenced |-> FALSE, revoked |-> FALSE, stopIO |-> FALSE, + ready |-> FALSE, detached |-> FALSE, lsn |-> 0, lh |-> NoRec, renewing |-> FALSE]] + /\ cut = [h \in Hosts |-> [pc |-> "idle", n |-> 0, base |-> NoRec, lsn |-> 0, img |-> <<"-", 0>>, detach |-> FALSE]] + /\ bpc = "wait" /\ bobs = NoRec + /\ hist = [takeover |-> FALSE, aCasAfter |-> FALSE, late |-> {}, detHead |-> NoRec, bFirst |-> NoRec, + badExpire |-> FALSE, acked |-> [h \in Hosts |-> 0], bSeed |-> -1, steps |-> <<>>, + aStopT |-> -1, bServeT |-> -1] + +----------------------------------------------------------------------------- +(* clocks and the VM *) + +Tick == /\ now < MaxT /\ now' = now + 1 + /\ UNCHANGED <> +\* the master clock advances, A's does not (bounded drift) +SlowTick == /\ now < MaxT /\ lag["A"] < Drift + /\ now' = now + 1 /\ lag' = [lag EXCEPT !["A"] = @ + 1] + /\ UNCHANGED <> + +\* a VM write accepted by a serving host (WAL LSN + 1) +VMWrite(h) == /\ Serving(h) /\ host[h].lsn < MaxLSN + /\ host' = [host EXCEPT ![h].lsn = @ + 1] + /\ hist' = [hist EXCEPT !.acked[h] = host[h].lsn + 1, + !.bServeT = IF h = "B" /\ hist.bServeT < 0 THEN now ELSE hist.bServeT] + /\ UNCHANGED <> + +LoseMsg == \E m \in msgs : /\ msgs' = msgs \ {m} + /\ host' = IF m.t = "renew" \/ m.t = "lease" THEN [host EXCEPT ![m.h].renewing = FALSE] ELSE host + /\ UNCHANGED <> + +----------------------------------------------------------------------------- +(* workspace lease (core/host/volume/workspace_lease.go, core/authority/workspace.go) *) + +\* Refresh: validity anchored to the request START (workspace_lease.go:68-127) +SendRenew(h) == + /\ LeaseOn /\ host[h].epoch > 0 /\ ~host[h].fenced /\ ~host[h].renewing + /\ IF host[h].until > 0 /\ HNow(h) >= host[h].until + THEN /\ host' = [host EXCEPT ![h].fenced = TRUE] \* expired: self-fence (:73-80) + /\ msgs' = msgs + ELSE /\ host' = [host EXCEPT ![h].renewing = TRUE] + /\ msgs' = msgs \cup {[t |-> "renew", h |-> h, e |-> host[h].epoch, s |-> HNow(h)]} + /\ UNCHANGED <> + +\* Publisher.RenewWorkspaceLease (authority/workspace.go:73-106), reply validFor = exp - now (workspace_service.go:41-52) +MasterRenew == \E m \in msgs : + /\ m.t = "renew" + /\ LET okLine == asg.holder = m.h /\ asg.epoch = m.e + live == lease.none \/ (now < lease.exp /\ now < deadline) + IN IF okLine /\ ~lease.none /\ lease.revoking + THEN /\ msgs' = (msgs \ {m}) \cup {[t |-> "lease", h |-> m.h, s |-> m.s, ok |-> TRUE, valid |-> lease.exp - now, revoking |-> TRUE]} + /\ UNCHANGED <> + ELSE IF okLine /\ live + THEN /\ lease' = [holder |-> m.h, epoch |-> m.e, exp |-> now + TTL, revoking |-> FALSE, none |-> FALSE] + /\ deadline' = now + TTL + /\ msgs' = (msgs \ {m}) \cup {[t |-> "lease", h |-> m.h, s |-> m.s, ok |-> TRUE, valid |-> TTL, revoking |-> FALSE]} + ELSE /\ msgs' = (msgs \ {m}) \cup {[t |-> "lease", h |-> m.h, s |-> m.s, ok |-> FALSE, valid |-> 0, revoking |-> FALSE]} + /\ UNCHANGED <> + /\ UNCHANGED <> + +\* the host applies a reply (workspace_lease.go:88-127): the OLD deadline is checked first +HostLease == \E m \in msgs : + /\ m.t = "lease" + /\ LET h == m.h + t == HNow(h) + expiredOld == host[h].until > 0 /\ t >= host[h].until + fence == expiredOld \/ (m.ok /\ t >= m.s + m.valid) \/ m.revoking + IN host' = [host EXCEPT ![h].renewing = FALSE, + ![h].fenced = @ \/ fence, + ![h].revoked = @ \/ m.revoking, + ![h].until = IF m.ok /\ ~fence /\ ~host[h].fenced THEN m.s + m.valid ELSE @] + /\ msgs' = msgs \ {m} + /\ hist' = [hist EXCEPT !.aStopT = IF m.h = "A" /\ hist.aStopT < 0 /\ m.revoking THEN now ELSE hist.aStopT] + /\ UNCHANGED <> + +\* drain then clean ACK with the last committed HEAD gen, only while the lease is valid (:129-160) +SendAck == + /\ host["A"].revoked /\ cut["A"].pc = "idle" + /\ host["A"].until > HNow("A") /\ host["A"].lh.gen # 0 + /\ ~\E m \in msgs : m.t = "ack" + /\ msgs' = msgs \cup {[t |-> "ack", h |-> "A", e |-> host["A"].epoch, gen |-> host["A"].lh.gen]} + /\ UNCHANGED <> + +\* Publisher.AckWorkspaceRevocation (authority/workspace.go:215-235) +MasterAck == \E m \in msgs : + /\ m.t = "ack" + /\ msgs' = msgs \ {m} + /\ IF asg.holder = m.h /\ asg.epoch = m.e /\ m.gen # 0 /\ ~lease.none /\ lease.revoking + /\ now < lease.exp /\ now < deadline + THEN ack' = [gen |-> m.gen, holder |-> m.h, epoch |-> m.e] + ELSE ack' = ack + /\ UNCHANGED <> + +\* operator: BeginWorkspaceRevocation (authority/workspace.go:200-213) +Revoke == /\ "clean" \in Kinds /\ ~lease.none /\ ~lease.revoking /\ lease.holder = asg.holder /\ asg.holder = "A" + /\ lease' = [lease EXCEPT !.revoking = TRUE] + /\ UNCHANGED <> + +\* operator / orchestrator: stop guest I/O on A before the final cut +StopGuest == /\ "clean" \in Kinds /\ ~host["A"].stopIO + /\ host' = [host EXCEPT !["A"].stopIO = TRUE] + /\ hist' = [hist EXCEPT !.aStopT = IF hist.aStopT < 0 THEN now ELSE hist.aStopT] + /\ UNCHANGED <> + +\* blockmaster restart: durable state kept; the in-memory deadline conservatively +\* covers a full TTL again (authority.go:256-261) +MasterRestart == /\ restarts < MaxRestarts + /\ restarts' = restarts + 1 + /\ deadline' = now + TTL + /\ UNCHANGED <> + +----------------------------------------------------------------------------- +(* the move (workspace_service.go:100-145, authority/workspace.go:157-198, 287-335) *) + +\* the HEAD is read before the publisher lock (workspace_service.go:104-109) +MoveRead == /\ mv.st = "none" /\ asg.holder = "A" + /\ \E k \in Kinds : mv' = [st |-> "read", kind |-> k, h |-> head] + /\ UNCHANGED <> + +MovePrepare == + /\ mv.st = "read" + /\ LET q == mv.h + headOK == q.gen # 0 /\ q.epoch = asg.epoch /\ q.holder = asg.holder + cleanOK == q.st = "detached" /\ ~lease.none /\ lease.revoking /\ ack.gen = q.gen /\ ack.epoch = asg.epoch + forcedOK == ~WaitLeaseExpiry \/ (now >= lease.exp /\ now >= deadline) + ok == headOK /\ ~lease.none /\ IF mv.kind = "clean" THEN cleanOK ELSE forcedOK + IN IF ok + THEN /\ maxEpoch' = maxEpoch + 1 + /\ journal' = [kind |-> mv.kind, gen |-> q.gen, lsn |-> q.lsn, newEpoch |-> maxEpoch + 1] + /\ asg' = [holder |-> "B", epoch |-> maxEpoch + 1] + /\ lease' = [lease EXCEPT !.none = TRUE] + /\ ack' = [gen |-> 0, holder |-> "-", epoch |-> 0] + /\ msgs' = msgs \cup {[t |-> "assign", h |-> "B", e |-> maxEpoch + 1]} + /\ mv' = [mv EXCEPT !.st = "done"] + ELSE /\ mv' = [st |-> "none", kind |-> "-", h |-> NoRec] \* refused; may be retried + /\ UNCHANGED <> + /\ UNCHANGED <> + +----------------------------------------------------------------------------- +(* B: VOLUME hook -> attach -> seed -> takeover CAS -> serve + (provider_chunk.go:229-317, chunk_restore.go:13-80) *) + +Step(s) == hist' = [hist EXCEPT !.steps = Append(hist.steps, s)] + +BAssign == \E m \in msgs : + /\ m.t = "assign" /\ bpc = "wait" + /\ msgs' = msgs \ {m} + /\ host' = [host EXCEPT !["B"].epoch = m.e] + /\ bpc' = "hook" + /\ UNCHANGED <> + +BHook == /\ bpc = "hook" /\ bpc' = "attach" /\ Step("hook") \* EnsureVolume / attach check (provider_chunk.go:240-247) + /\ UNCHANGED <> + +BAttach == /\ bpc = "attach" \* ClaimChunkHead: GetHead (chunk_restore.go:30-36) + /\ IF head.epoch > host["B"].epoch + THEN /\ bpc' = "failed" /\ bobs' = bobs /\ hist' = hist + ELSE /\ bpc' = "seed" /\ bobs' = head /\ Step("attach") + /\ UNCHANGED <> + +BSeed == /\ bpc = "seed" \* PrepareRestore -> SeedChunkFrontier (provider_chunk.go:286-307) + /\ LET L == IF SeedFromObserved THEN bobs.lsn ELSE journal.lsn + IN /\ host' = [host EXCEPT !["B"].lsn = L] + /\ hist' = [hist EXCEPT !.steps = Append(hist.steps, "seed"), !.bSeed = L] + /\ bpc' = "claim" + /\ UNCHANGED <> + +BClaim == /\ bpc = "claim" \* the takeover CAS (chunk_restore.go:55-79) + /\ LET next == [bobs EXCEPT !.gen = bobs.gen + 1, !.epoch = host["B"].epoch, !.holder = "B", + !.st = "active", !.dgen = 0] + IN IF CasOK(bobs, next) + THEN /\ head' = next + /\ host' = [host EXCEPT !["B"].lh = next, !["B"].ready = TRUE] + /\ bpc' = "claimed" + /\ hist' = [hist EXCEPT !.steps = Append(hist.steps, "claim"), !.takeover = TRUE, !.bFirst = next] + ELSE /\ bpc' = "attach" \* not installed: the attach is retried + /\ UNCHANGED <> + /\ UNCHANGED <> + +----------------------------------------------------------------------------- +(* the chunk layer's cut on host h (chunk_layer.go:680-988) *) + +CutStart(h, det) == + /\ cut[h].pc = "idle" /\ cut[h].n < MaxCuts + /\ host[h].ready /\ Permits(h) /\ ~host[h].detached \* admit (:599-619, :695) + /\ ~SupersededBy(h, host[h].lh) \/ ~HostFence + /\ IF det THEN h = "A" /\ host[h].stopIO /\ "clean" \in Kinds + ELSE host[h].lsn > host[h].lh.lsn \/ (~LayerLsnCheck /\ host[h].lsn # host[h].lh.lsn) + /\ LayerLsnCheck => host[h].lsn >= host[h].lh.lsn \* lsn_behind (:800) + /\ cut' = [cut EXCEPT ![h] = [pc |-> "intent", n |-> @.n, base |-> host[h].lh, lsn |-> host[h].lsn, + img |-> <>, detach |-> det]] + /\ UNCHANGED <> + +CutIntent(h) == \* PutIntent before any upload (:853, :1489) + /\ cut[h].pc = "intent" + /\ intents' = intents \cup {[own |-> h, n |-> cut[h].n + 1, epoch |-> host[h].epoch, key |-> cut[h].img, created |-> now]} + /\ cut' = [cut EXCEPT ![h].pc = "upload"] + /\ UNCHANGED <> + +CutUpload(h) == + /\ cut[h].pc = "upload" + /\ stored' = stored \cup {cut[h].img} + /\ hist' = [hist EXCEPT !.late = IF h = "A" /\ hist.takeover THEN @ \cup {cut[h].img} ELSE @] + /\ cut' = [cut EXCEPT ![h].pc = "admit"] + /\ UNCHANGED <> + +DropOwn(h) == {i \in intents : ~(i.own = h /\ i.n = cut[h].n + 1)} + +CutAdmit(h) == \* admission re-checked right before the CAS (:911-923) + /\ cut[h].pc = "admit" + /\ IF Permits(h) /\ (~HostFence \/ ~SupersededBy(h, host[h].lh)) + THEN /\ cut' = [cut EXCEPT ![h].pc = "cas"] /\ intents' = intents + ELSE /\ cut' = [cut EXCEPT ![h].pc = "idle", ![h].n = @ + 1] /\ intents' = DropOwn(h) + /\ UNCHANGED <> + +CutCAS(h) == \* CASHead (:926), then settle by re-read (:957-987) + /\ cut[h].pc = "cas" + /\ LET b == cut[h].base + det == cut[h].detach + next == [gen |-> b.gen + 1, epoch |-> host[h].epoch, holder |-> h, + st |-> IF det THEN "detached" ELSE "active", dgen |-> IF det THEN b.gen + 1 ELSE 0, + lsn |-> cut[h].lsn, img |-> cut[h].img] + IN IF CasOK(b, next) + THEN /\ head' = next + /\ host' = [host EXCEPT ![h].lh = next, ![h].detached = det] + /\ hist' = [hist EXCEPT !.aCasAfter = @ \/ (h = "A" /\ hist.takeover), + !.detHead = IF det THEN next ELSE @] + ELSE /\ head' = head + /\ host' = IF Fences(h, head) THEN [host EXCEPT ![h].fenced = TRUE, ![h].lh = head] + ELSE [host EXCEPT ![h].lh = head] + /\ hist' = hist + /\ cut' = [cut EXCEPT ![h].pc = "drop"] + /\ UNCHANGED <> + +CutDrop(h) == \* DeleteIntent after settling (:1378-1421) + /\ cut[h].pc = "drop" + /\ intents' = DropOwn(h) + /\ cut' = [cut EXCEPT ![h].pc = "idle", ![h].n = @ + 1] + /\ UNCHANGED <> + +----------------------------------------------------------------------------- +(* GC (core/frontend/chunkstore/gc.go:108-300) *) + +\* capture-intent expiry (gc.go:214-222): age > intent_ttl, and +\* issued > intent epoch, HEAD epoch > intent epoch, HEAD epoch <= issued +GCExpire == \E i \in intents : + /\ now - i.created > ITTL + /\ GCEpochRule => (maxEpoch > i.epoch /\ head.epoch > i.epoch /\ head.epoch <= maxEpoch) + /\ intents' = intents \ {i} + /\ hist' = [hist EXCEPT !.badExpire = @ \/ (i.epoch = head.epoch /\ i.own = head.holder)] + /\ UNCHANGED <> + +\* mark + sweep, atomic: roots are HEAD and live intents (grace abstracted, as in ChunkLifecycle) +GCCollect == LET roots == {head.img} \cup {i.key : i \in intents} + IN /\ stored \ roots # {} + /\ stored' = stored \cap roots + /\ UNCHANGED <> + +----------------------------------------------------------------------------- +Next == + \/ Tick \/ SlowTick \/ LoseMsg + \/ \E h \in Hosts : VMWrite(h) \/ SendRenew(h) \/ CutStart(h, FALSE) \/ CutStart(h, TRUE) + \/ CutIntent(h) \/ CutUpload(h) \/ CutAdmit(h) \/ CutCAS(h) \/ CutDrop(h) + \/ MasterRenew \/ HostLease \/ SendAck \/ MasterAck \/ Revoke \/ StopGuest \/ MasterRestart + \/ MoveRead \/ MovePrepare + \/ BAssign \/ BHook \/ BAttach \/ BSeed \/ BClaim + \/ GCExpire \/ GCCollect + +Spec == Init /\ [][Next]_vars + +----------------------------------------------------------------------------- +(* Invariants *) + +\* at most one host accepts VM writes at any instant (real/master time) +NoDualServing == ~(Serving("A") /\ Serving("B")) + +\* after B's takeover CAS no CASHead by A succeeds, and nothing A uploaded after it is reachable +NoOldCasAfterTakeover == ~hist.aCasAfter +NoLateChunkReachable == head.img \notin hist.late + +\* CLEAN move loses nothing: B's first HEAD is A's detached image, and A acked nothing after it +CleanNoLoss == (journal.kind = "clean" /\ hist.bFirst # NoRec) => + /\ hist.bFirst.img = hist.detHead.img /\ hist.bFirst.lsn = hist.detHead.lsn + /\ hist.acked["A"] = hist.detHead.lsn + +\* FORCED move: what is lost is A's journaled window (exact form, and the bound) +ForcedLossExact == (journal.kind = "forced" /\ hist.bFirst # NoRec) => + hist.bFirst.lsn = journal.lsn /\ hist.bFirst.gen = journal.gen + 1 +ForcedLossBounded == (journal.kind = "forced" /\ hist.bFirst # NoRec) => hist.bFirst.lsn >= journal.lsn + +\* GC: HEAD's chunk is stored; no intent of the current HEAD holder is expired +GCSafe == head.img \in stored +NoLiveIntentExpired == ~hist.badExpire + +\* B serves only after VOLUME hook -> attach -> seed -> takeover CAS, in that order, and serves from its seed +AttachOrder == + /\ Len(hist.steps) > 0 => hist.steps[1] = "hook" + /\ \A i \in 2..Len(hist.steps) : + /\ hist.steps[i] # "hook" + /\ hist.steps[i] = "attach" => hist.steps[i - 1] \in {"hook", "seed"} \* a refused claim retries the attach + /\ hist.steps[i] = "seed" => hist.steps[i - 1] = "attach" + /\ hist.steps[i] = "claim" => hist.steps[i - 1] = "seed" + /\ host["B"].ready => hist.takeover +SeedMatchesTakeover == hist.bFirst # NoRec => hist.bSeed = hist.bFirst.lsn + +\* HEAD epoch and remote_lsn never decrease +HeadMonotone == [][head'.epoch >= head.epoch /\ head'.lsn >= head.lsn]_vars + +\* reachability witnesses (each is EXPECTED to be violated) +W_NoCleanServe == ~(journal.kind = "clean" /\ Serving("B") /\ hist.acked["A"] > 0) +W_NoForcedServe == ~(journal.kind = "forced" /\ Serving("B") /\ hist.acked["A"] > 0) +W_NoBCut == ~(head.holder = "B" /\ hist.bFirst # NoRec /\ head.gen > hist.bFirst.gen) +W_NoRestartMove == ~(restarts > 0 /\ hist.takeover) + +TypeOK == /\ now \in 0..MaxT /\ head.gen \in Nat /\ stored \subseteq (Hosts \X (0..MaxCuts)) +============================================================================= diff --git a/seaweed-block/docs/spec/cfg/Bug_P1_data.cfg b/seaweed-block/docs/spec/cfg/Bug_P1_data.cfg new file mode 100644 index 0000000000..6652a3fcaa --- /dev/null +++ b/seaweed-block/docs/spec/cfg/Bug_P1_data.cfg @@ -0,0 +1,16 @@ +\* Bug_P1_data: model-checks ChunkLifecycle.tla (run from docs/spec: ./run.sh Bug_P1_data) +SPECIFICATION Spec +CONSTANTS + SnapCallers = {s1, s2} + Deleters = {d1} + ForkOn = TRUE + DelSnapOn = FALSE + CreateOn = FALSE + MaxHostOps = 4 + MaxRuns = 1 + LostReply = FALSE + PendingOn = FALSE + SweepOn = FALSE + defaultInitValue = defaultInitValue +SYMMETRY Symm +INVARIANT TypeOK AckedChunksSurvive diff --git a/seaweed-block/docs/spec/cfg/Bug_P1_giveback.cfg b/seaweed-block/docs/spec/cfg/Bug_P1_giveback.cfg new file mode 100644 index 0000000000..990492db67 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/Bug_P1_giveback.cfg @@ -0,0 +1,16 @@ +\* Bug_P1_giveback: model-checks ChunkLifecycle.tla (run from docs/spec: ./run.sh Bug_P1_giveback) +SPECIFICATION Spec +CONSTANTS + SnapCallers = {s1, s2} + Deleters = {d1} + ForkOn = TRUE + DelSnapOn = FALSE + CreateOn = FALSE + MaxHostOps = 1 + MaxRuns = 1 + LostReply = FALSE + PendingOn = FALSE + SweepOn = FALSE + defaultInitValue = defaultInitValue +SYMMETRY Symm +INVARIANT TypeOK AckedKeptAfterGiveBack diff --git a/seaweed-block/docs/spec/cfg/Bug_P1_mark.cfg b/seaweed-block/docs/spec/cfg/Bug_P1_mark.cfg new file mode 100644 index 0000000000..5a461c32c6 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/Bug_P1_mark.cfg @@ -0,0 +1,16 @@ +\* Bug_P1_mark: model-checks ChunkLifecycle.tla (run from docs/spec: ./run.sh Bug_P1_mark) +SPECIFICATION Spec +CONSTANTS + SnapCallers = {s1, s2} + Deleters = {d1} + ForkOn = FALSE + DelSnapOn = FALSE + CreateOn = FALSE + MaxHostOps = 1 + MaxRuns = 1 + LostReply = FALSE + PendingOn = FALSE + SweepOn = FALSE + defaultInitValue = defaultInitValue +SYMMETRY Symm +INVARIANT TypeOK NoProvisionalSnapMark diff --git a/seaweed-block/docs/spec/cfg/Bug_P2_aba.cfg b/seaweed-block/docs/spec/cfg/Bug_P2_aba.cfg new file mode 100644 index 0000000000..18923c7b8e --- /dev/null +++ b/seaweed-block/docs/spec/cfg/Bug_P2_aba.cfg @@ -0,0 +1,16 @@ +\* Bug_P2_aba: model-checks ChunkLifecycle.tla (run from docs/spec: ./run.sh Bug_P2_aba) +SPECIFICATION Spec +CONSTANTS + SnapCallers = {} + Deleters = {d1, d2, d3} + ForkOn = TRUE + DelSnapOn = FALSE + CreateOn = FALSE + MaxHostOps = 1 + MaxRuns = 1 + LostReply = FALSE + PendingOn = FALSE + SweepOn = FALSE + defaultInitValue = defaultInitValue +SYMMETRY Symm +INVARIANT TypeOK CommitWithoutLiveClaim diff --git a/seaweed-block/docs/spec/cfg/Bug_P2_literal.cfg b/seaweed-block/docs/spec/cfg/Bug_P2_literal.cfg new file mode 100644 index 0000000000..36470be61f --- /dev/null +++ b/seaweed-block/docs/spec/cfg/Bug_P2_literal.cfg @@ -0,0 +1,16 @@ +\* Bug_P2_literal: model-checks ChunkLifecycle.tla (run from docs/spec: ./run.sh Bug_P2_literal) +SPECIFICATION Spec +CONSTANTS + SnapCallers = {} + Deleters = {d1, d2, d3} + ForkOn = TRUE + DelSnapOn = FALSE + CreateOn = FALSE + MaxHostOps = 1 + MaxRuns = 1 + LostReply = FALSE + PendingOn = FALSE + SweepOn = FALSE + defaultInitValue = defaultInitValue +SYMMETRY Symm +INVARIANT TypeOK CommitWithoutAnyClaim diff --git a/seaweed-block/docs/spec/cfg/Bug_create.cfg b/seaweed-block/docs/spec/cfg/Bug_create.cfg new file mode 100644 index 0000000000..5a5e974586 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/Bug_create.cfg @@ -0,0 +1,16 @@ +\* Bug_create: model-checks ChunkLifecycle.tla (run from docs/spec: ./run.sh Bug_create) +SPECIFICATION Spec +CONSTANTS + SnapCallers = {} + Deleters = {d1} + ForkOn = FALSE + DelSnapOn = FALSE + CreateOn = TRUE + MaxHostOps = 1 + MaxRuns = 1 + LostReply = FALSE + PendingOn = FALSE + SweepOn = FALSE + defaultInitValue = defaultInitValue +SYMMETRY Symm +INVARIANT TypeOK NoIdReuse diff --git a/seaweed-block/docs/spec/cfg/Bug_other.cfg b/seaweed-block/docs/spec/cfg/Bug_other.cfg new file mode 100644 index 0000000000..f6c24080ea --- /dev/null +++ b/seaweed-block/docs/spec/cfg/Bug_other.cfg @@ -0,0 +1,17 @@ +\* Bug_other: model-checks ChunkLifecycle.tla (run from docs/spec: ./run.sh Bug_other) +SPECIFICATION Spec +CONSTANTS + SnapCallers = {s1, s2} + Deleters = {d1} + ForkOn = TRUE + DelSnapOn = TRUE + CreateOn = FALSE + MaxHostOps = 2 + MaxRuns = 1 + LostReply = FALSE + PendingOn = TRUE + SweepOn = TRUE + defaultInitValue = defaultInitValue +SYMMETRY Symm +INVARIANT TypeOK GCSafe NoIdReuse +PROPERTY HeadMonotone diff --git a/seaweed-block/docs/spec/cfg/Bug_other_dels.cfg b/seaweed-block/docs/spec/cfg/Bug_other_dels.cfg new file mode 100644 index 0000000000..be3abef52e --- /dev/null +++ b/seaweed-block/docs/spec/cfg/Bug_other_dels.cfg @@ -0,0 +1,17 @@ +\* Bug_other_dels: model-checks ChunkLifecycle.tla (run from docs/spec: ./run.sh Bug_other_dels) +SPECIFICATION Spec +CONSTANTS + SnapCallers = {} + Deleters = {d1, d2} + ForkOn = TRUE + DelSnapOn = TRUE + CreateOn = FALSE + MaxHostOps = 1 + MaxRuns = 2 + LostReply = TRUE + PendingOn = FALSE + SweepOn = TRUE + defaultInitValue = defaultInitValue +SYMMETRY Symm +INVARIANT TypeOK GCSafe NoIdReuse +PROPERTY HeadMonotone diff --git a/seaweed-block/docs/spec/cfg/Bug_other_small.cfg b/seaweed-block/docs/spec/cfg/Bug_other_small.cfg new file mode 100644 index 0000000000..f9daeb05aa --- /dev/null +++ b/seaweed-block/docs/spec/cfg/Bug_other_small.cfg @@ -0,0 +1,17 @@ +\* Bug_other_small: model-checks ChunkLifecycle.tla (run from docs/spec: ./run.sh Bug_other_small) +SPECIFICATION Spec +CONSTANTS + SnapCallers = {s1, s2} + Deleters = {d1} + ForkOn = TRUE + DelSnapOn = FALSE + CreateOn = FALSE + MaxHostOps = 1 + MaxRuns = 1 + LostReply = FALSE + PendingOn = TRUE + SweepOn = TRUE + defaultInitValue = defaultInitValue +SYMMETRY Symm +INVARIANT TypeOK GCSafe NoIdReuse +PROPERTY HeadMonotone diff --git a/seaweed-block/docs/spec/cfg/Bug_reach_W_NeverDeleted.cfg b/seaweed-block/docs/spec/cfg/Bug_reach_W_NeverDeleted.cfg new file mode 100644 index 0000000000..0a89aadb39 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/Bug_reach_W_NeverDeleted.cfg @@ -0,0 +1,16 @@ +\* Bug_reach_W_NeverDeleted: model-checks ChunkLifecycle.tla (run from docs/spec: ./run.sh Bug_reach_W_NeverDeleted) +SPECIFICATION Spec +CONSTANTS + SnapCallers = {s1} + Deleters = {d1, d2} + ForkOn = TRUE + DelSnapOn = TRUE + CreateOn = FALSE + MaxHostOps = 3 + MaxRuns = 1 + LostReply = FALSE + PendingOn = FALSE + SweepOn = FALSE + defaultInitValue = defaultInitValue +SYMMETRY Symm +INVARIANT TypeOK W_NeverDeleted diff --git a/seaweed-block/docs/spec/cfg/Bug_reach_W_NoAckThenDelete.cfg b/seaweed-block/docs/spec/cfg/Bug_reach_W_NoAckThenDelete.cfg new file mode 100644 index 0000000000..9e6a03b565 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/Bug_reach_W_NoAckThenDelete.cfg @@ -0,0 +1,16 @@ +\* Bug_reach_W_NoAckThenDelete: model-checks ChunkLifecycle.tla (run from docs/spec: ./run.sh Bug_reach_W_NoAckThenDelete) +SPECIFICATION Spec +CONSTANTS + SnapCallers = {s1} + Deleters = {d1, d2} + ForkOn = TRUE + DelSnapOn = TRUE + CreateOn = FALSE + MaxHostOps = 3 + MaxRuns = 1 + LostReply = FALSE + PendingOn = FALSE + SweepOn = FALSE + defaultInitValue = defaultInitValue +SYMMETRY Symm +INVARIANT TypeOK W_NoAckThenDelete diff --git a/seaweed-block/docs/spec/cfg/Bug_reach_W_NoForkThenDelete.cfg b/seaweed-block/docs/spec/cfg/Bug_reach_W_NoForkThenDelete.cfg new file mode 100644 index 0000000000..99d3aff45d --- /dev/null +++ b/seaweed-block/docs/spec/cfg/Bug_reach_W_NoForkThenDelete.cfg @@ -0,0 +1,16 @@ +\* Bug_reach_W_NoForkThenDelete: model-checks ChunkLifecycle.tla (run from docs/spec: ./run.sh Bug_reach_W_NoForkThenDelete) +SPECIFICATION Spec +CONSTANTS + SnapCallers = {s1} + Deleters = {d1, d2} + ForkOn = TRUE + DelSnapOn = TRUE + CreateOn = FALSE + MaxHostOps = 3 + MaxRuns = 1 + LostReply = FALSE + PendingOn = FALSE + SweepOn = FALSE + defaultInitValue = defaultInitValue +SYMMETRY Symm +INVARIANT TypeOK W_NoForkThenDelete diff --git a/seaweed-block/docs/spec/cfg/Bug_reach_W_NoGCReclaim.cfg b/seaweed-block/docs/spec/cfg/Bug_reach_W_NoGCReclaim.cfg new file mode 100644 index 0000000000..884693a12b --- /dev/null +++ b/seaweed-block/docs/spec/cfg/Bug_reach_W_NoGCReclaim.cfg @@ -0,0 +1,16 @@ +\* Bug_reach_W_NoGCReclaim: model-checks ChunkLifecycle.tla (run from docs/spec: ./run.sh Bug_reach_W_NoGCReclaim) +SPECIFICATION Spec +CONSTANTS + SnapCallers = {s1} + Deleters = {d1, d2} + ForkOn = TRUE + DelSnapOn = TRUE + CreateOn = FALSE + MaxHostOps = 3 + MaxRuns = 1 + LostReply = FALSE + PendingOn = FALSE + SweepOn = FALSE + defaultInitValue = defaultInitValue +SYMMETRY Symm +INVARIANT TypeOK W_NoGCReclaim diff --git a/seaweed-block/docs/spec/cfg/Bug_reach_W_NoRefusalThenDelete.cfg b/seaweed-block/docs/spec/cfg/Bug_reach_W_NoRefusalThenDelete.cfg new file mode 100644 index 0000000000..f7df375b2e --- /dev/null +++ b/seaweed-block/docs/spec/cfg/Bug_reach_W_NoRefusalThenDelete.cfg @@ -0,0 +1,16 @@ +\* Bug_reach_W_NoRefusalThenDelete: model-checks ChunkLifecycle.tla (run from docs/spec: ./run.sh Bug_reach_W_NoRefusalThenDelete) +SPECIFICATION Spec +CONSTANTS + SnapCallers = {s1} + Deleters = {d1, d2} + ForkOn = TRUE + DelSnapOn = TRUE + CreateOn = FALSE + MaxHostOps = 3 + MaxRuns = 1 + LostReply = FALSE + PendingOn = FALSE + SweepOn = FALSE + defaultInitValue = defaultInitValue +SYMMETRY Symm +INVARIANT TypeOK W_NoRefusalThenDelete diff --git a/seaweed-block/docs/spec/cfg/Bug_token.cfg b/seaweed-block/docs/spec/cfg/Bug_token.cfg new file mode 100644 index 0000000000..4cbabebb9f --- /dev/null +++ b/seaweed-block/docs/spec/cfg/Bug_token.cfg @@ -0,0 +1,16 @@ +\* Bug_token: model-checks ChunkLifecycle.tla (run from docs/spec: ./run.sh Bug_token) +SPECIFICATION Spec +CONSTANTS + SnapCallers = {} + Deleters = {d1} + ForkOn = TRUE + DelSnapOn = FALSE + CreateOn = FALSE + MaxHostOps = 1 + MaxRuns = 2 + LostReply = TRUE + PendingOn = FALSE + SweepOn = FALSE + defaultInitValue = defaultInitValue +SYMMETRY Symm +INVARIANT TypeOK GiveBackReleases diff --git a/seaweed-block/docs/spec/cfg/Fix_P1.cfg b/seaweed-block/docs/spec/cfg/Fix_P1.cfg new file mode 100644 index 0000000000..504bb07b40 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/Fix_P1.cfg @@ -0,0 +1,17 @@ +\* Fix_P1: model-checks ChunkLifecycleFixed.tla (run from docs/spec: ./run.sh Fix_P1) +SPECIFICATION Spec +CONSTANTS + SnapCallers = {s1, s2} + Deleters = {d1} + ForkOn = TRUE + DelSnapOn = TRUE + CreateOn = FALSE + MaxHostOps = 2 + MaxRuns = 1 + LostReply = FALSE + PendingOn = FALSE + SweepOn = FALSE + defaultInitValue = defaultInitValue +SYMMETRY Symm +INVARIANT TypeOK GCSafe SnapOnlyExplicitDelete AckedChunksSurvive CommitClean NoPublishAfterCommit NoIdReuse GiveBackReleases +PROPERTY HeadMonotone diff --git a/seaweed-block/docs/spec/cfg/Fix_P2_aba.cfg b/seaweed-block/docs/spec/cfg/Fix_P2_aba.cfg new file mode 100644 index 0000000000..88f0344157 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/Fix_P2_aba.cfg @@ -0,0 +1,17 @@ +\* Fix_P2_aba: model-checks ChunkLifecycleFixed.tla (run from docs/spec: ./run.sh Fix_P2_aba) +SPECIFICATION Spec +CONSTANTS + SnapCallers = {} + Deleters = {d1, d2, d3} + ForkOn = TRUE + DelSnapOn = TRUE + CreateOn = FALSE + MaxHostOps = 1 + MaxRuns = 1 + LostReply = FALSE + PendingOn = FALSE + SweepOn = FALSE + defaultInitValue = defaultInitValue +SYMMETRY Symm +INVARIANT TypeOK GCSafe SnapOnlyExplicitDelete AckedChunksSurvive CommitClean NoPublishAfterCommit NoIdReuse GiveBackReleases +PROPERTY HeadMonotone diff --git a/seaweed-block/docs/spec/cfg/Fix_create.cfg b/seaweed-block/docs/spec/cfg/Fix_create.cfg new file mode 100644 index 0000000000..48971c048a --- /dev/null +++ b/seaweed-block/docs/spec/cfg/Fix_create.cfg @@ -0,0 +1,17 @@ +\* Fix_create: model-checks ChunkLifecycleFixed.tla (run from docs/spec: ./run.sh Fix_create) +SPECIFICATION Spec +CONSTANTS + SnapCallers = {} + Deleters = {d1} + ForkOn = FALSE + DelSnapOn = FALSE + CreateOn = TRUE + MaxHostOps = 1 + MaxRuns = 1 + LostReply = FALSE + PendingOn = FALSE + SweepOn = FALSE + defaultInitValue = defaultInitValue +SYMMETRY Symm +INVARIANT TypeOK GCSafe SnapOnlyExplicitDelete AckedChunksSurvive CommitClean NoPublishAfterCommit NoIdReuse GiveBackReleases +PROPERTY HeadMonotone diff --git a/seaweed-block/docs/spec/cfg/Fix_mix.cfg b/seaweed-block/docs/spec/cfg/Fix_mix.cfg new file mode 100644 index 0000000000..baebcd2398 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/Fix_mix.cfg @@ -0,0 +1,17 @@ +\* Fix_mix: model-checks ChunkLifecycleFixed.tla (run from docs/spec: ./run.sh Fix_mix) +SPECIFICATION Spec +CONSTANTS + SnapCallers = {s1} + Deleters = {d1, d2} + ForkOn = TRUE + DelSnapOn = TRUE + CreateOn = TRUE + MaxHostOps = 2 + MaxRuns = 2 + LostReply = TRUE + PendingOn = TRUE + SweepOn = TRUE + defaultInitValue = defaultInitValue +SYMMETRY Symm +INVARIANT TypeOK GCSafe SnapOnlyExplicitDelete AckedChunksSurvive CommitClean NoPublishAfterCommit NoIdReuse GiveBackReleases +PROPERTY HeadMonotone diff --git a/seaweed-block/docs/spec/cfg/Fix_mix_small.cfg b/seaweed-block/docs/spec/cfg/Fix_mix_small.cfg new file mode 100644 index 0000000000..4af1fbceb0 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/Fix_mix_small.cfg @@ -0,0 +1,17 @@ +\* Fix_mix_small: model-checks ChunkLifecycleFixed.tla (run from docs/spec: ./run.sh Fix_mix_small) +SPECIFICATION Spec +CONSTANTS + SnapCallers = {s1} + Deleters = {d1} + ForkOn = TRUE + DelSnapOn = TRUE + CreateOn = TRUE + MaxHostOps = 2 + MaxRuns = 2 + LostReply = TRUE + PendingOn = TRUE + SweepOn = TRUE + defaultInitValue = defaultInitValue +SYMMETRY Symm +INVARIANT TypeOK GCSafe SnapOnlyExplicitDelete AckedChunksSurvive CommitClean NoPublishAfterCommit NoIdReuse GiveBackReleases +PROPERTY HeadMonotone diff --git a/seaweed-block/docs/spec/cfg/Fix_reach_W_NeverDeleted.cfg b/seaweed-block/docs/spec/cfg/Fix_reach_W_NeverDeleted.cfg new file mode 100644 index 0000000000..53af9adeda --- /dev/null +++ b/seaweed-block/docs/spec/cfg/Fix_reach_W_NeverDeleted.cfg @@ -0,0 +1,16 @@ +\* Fix_reach_W_NeverDeleted: model-checks ChunkLifecycleFixed.tla (run from docs/spec: ./run.sh Fix_reach_W_NeverDeleted) +SPECIFICATION Spec +CONSTANTS + SnapCallers = {s1} + Deleters = {d1, d2} + ForkOn = TRUE + DelSnapOn = TRUE + CreateOn = FALSE + MaxHostOps = 3 + MaxRuns = 1 + LostReply = FALSE + PendingOn = FALSE + SweepOn = FALSE + defaultInitValue = defaultInitValue +SYMMETRY Symm +INVARIANT TypeOK W_NeverDeleted diff --git a/seaweed-block/docs/spec/cfg/Fix_reach_W_NoAckThenDelete.cfg b/seaweed-block/docs/spec/cfg/Fix_reach_W_NoAckThenDelete.cfg new file mode 100644 index 0000000000..01b6bba4f8 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/Fix_reach_W_NoAckThenDelete.cfg @@ -0,0 +1,16 @@ +\* Fix_reach_W_NoAckThenDelete: model-checks ChunkLifecycleFixed.tla (run from docs/spec: ./run.sh Fix_reach_W_NoAckThenDelete) +SPECIFICATION Spec +CONSTANTS + SnapCallers = {s1} + Deleters = {d1, d2} + ForkOn = TRUE + DelSnapOn = TRUE + CreateOn = FALSE + MaxHostOps = 3 + MaxRuns = 1 + LostReply = FALSE + PendingOn = FALSE + SweepOn = FALSE + defaultInitValue = defaultInitValue +SYMMETRY Symm +INVARIANT TypeOK W_NoAckThenDelete diff --git a/seaweed-block/docs/spec/cfg/Fix_reach_W_NoForkThenDelete.cfg b/seaweed-block/docs/spec/cfg/Fix_reach_W_NoForkThenDelete.cfg new file mode 100644 index 0000000000..46f51a0ffb --- /dev/null +++ b/seaweed-block/docs/spec/cfg/Fix_reach_W_NoForkThenDelete.cfg @@ -0,0 +1,16 @@ +\* Fix_reach_W_NoForkThenDelete: model-checks ChunkLifecycleFixed.tla (run from docs/spec: ./run.sh Fix_reach_W_NoForkThenDelete) +SPECIFICATION Spec +CONSTANTS + SnapCallers = {s1} + Deleters = {d1, d2} + ForkOn = TRUE + DelSnapOn = TRUE + CreateOn = FALSE + MaxHostOps = 3 + MaxRuns = 1 + LostReply = FALSE + PendingOn = FALSE + SweepOn = FALSE + defaultInitValue = defaultInitValue +SYMMETRY Symm +INVARIANT TypeOK W_NoForkThenDelete diff --git a/seaweed-block/docs/spec/cfg/Fix_reach_W_NoGCReclaim.cfg b/seaweed-block/docs/spec/cfg/Fix_reach_W_NoGCReclaim.cfg new file mode 100644 index 0000000000..c157348787 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/Fix_reach_W_NoGCReclaim.cfg @@ -0,0 +1,16 @@ +\* Fix_reach_W_NoGCReclaim: model-checks ChunkLifecycleFixed.tla (run from docs/spec: ./run.sh Fix_reach_W_NoGCReclaim) +SPECIFICATION Spec +CONSTANTS + SnapCallers = {s1} + Deleters = {d1, d2} + ForkOn = TRUE + DelSnapOn = TRUE + CreateOn = FALSE + MaxHostOps = 3 + MaxRuns = 1 + LostReply = FALSE + PendingOn = FALSE + SweepOn = FALSE + defaultInitValue = defaultInitValue +SYMMETRY Symm +INVARIANT TypeOK W_NoGCReclaim diff --git a/seaweed-block/docs/spec/cfg/Fix_reach_W_NoHiddenNameBlock.cfg b/seaweed-block/docs/spec/cfg/Fix_reach_W_NoHiddenNameBlock.cfg new file mode 100644 index 0000000000..3510921f7f --- /dev/null +++ b/seaweed-block/docs/spec/cfg/Fix_reach_W_NoHiddenNameBlock.cfg @@ -0,0 +1,16 @@ +\* Fix_reach_W_NoHiddenNameBlock: model-checks ChunkLifecycleFixed.tla (run from docs/spec: ./run.sh Fix_reach_W_NoHiddenNameBlock) +SPECIFICATION Spec +CONSTANTS + SnapCallers = {s1} + Deleters = {d1, d2} + ForkOn = FALSE + DelSnapOn = TRUE + CreateOn = FALSE + MaxHostOps = 3 + MaxRuns = 1 + LostReply = FALSE + PendingOn = FALSE + SweepOn = FALSE + defaultInitValue = defaultInitValue +SYMMETRY Symm +INVARIANT TypeOK W_NoHiddenNameBlock diff --git a/seaweed-block/docs/spec/cfg/Fix_reach_W_NoRefusalThenDelete.cfg b/seaweed-block/docs/spec/cfg/Fix_reach_W_NoRefusalThenDelete.cfg new file mode 100644 index 0000000000..9dfd49dd53 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/Fix_reach_W_NoRefusalThenDelete.cfg @@ -0,0 +1,16 @@ +\* Fix_reach_W_NoRefusalThenDelete: model-checks ChunkLifecycleFixed.tla (run from docs/spec: ./run.sh Fix_reach_W_NoRefusalThenDelete) +SPECIFICATION Spec +CONSTANTS + SnapCallers = {s1} + Deleters = {d1, d2} + ForkOn = TRUE + DelSnapOn = TRUE + CreateOn = FALSE + MaxHostOps = 3 + MaxRuns = 1 + LostReply = FALSE + PendingOn = FALSE + SweepOn = FALSE + defaultInitValue = defaultInitValue +SYMMETRY Symm +INVARIANT TypeOK W_NoRefusalThenDelete diff --git a/seaweed-block/docs/spec/cfg/Fix_token.cfg b/seaweed-block/docs/spec/cfg/Fix_token.cfg new file mode 100644 index 0000000000..b4324ab20b --- /dev/null +++ b/seaweed-block/docs/spec/cfg/Fix_token.cfg @@ -0,0 +1,17 @@ +\* Fix_token: model-checks ChunkLifecycleFixed.tla (run from docs/spec: ./run.sh Fix_token) +SPECIFICATION Spec +CONSTANTS + SnapCallers = {} + Deleters = {d1} + ForkOn = TRUE + DelSnapOn = TRUE + CreateOn = FALSE + MaxHostOps = 1 + MaxRuns = 2 + LostReply = TRUE + PendingOn = FALSE + SweepOn = FALSE + defaultInitValue = defaultInitValue +SYMMETRY Symm +INVARIANT TypeOK GCSafe SnapOnlyExplicitDelete AckedChunksSurvive CommitClean NoPublishAfterCommit NoIdReuse GiveBackReleases +PROPERTY HeadMonotone diff --git a/seaweed-block/docs/spec/cfg/RED_early_assign.cfg b/seaweed-block/docs/spec/cfg/RED_early_assign.cfg new file mode 100644 index 0000000000..c2789b527e --- /dev/null +++ b/seaweed-block/docs/spec/cfg/RED_early_assign.cfg @@ -0,0 +1,20 @@ +\* RED_early_assign: model-checks WorkspaceTakeover.tla (run from docs/spec: ./run.sh RED_early_assign) +SPECIFICATION Spec +CONSTANTS + Kinds = {"forced"} + MaxT = 4 + TTL = 2 + ITTL = 1 + MaxLSN = 2 + MaxCuts = 2 + Drift = 0 + MaxRestarts = 1 + LeaseOn = TRUE + LsnGuard = TRUE + StoreEpochGuard = TRUE + HostFence = TRUE + LayerLsnCheck = TRUE + SeedFromObserved = TRUE + GCEpochRule = TRUE + WaitLeaseExpiry = FALSE +INVARIANT TypeOK NoDualServing diff --git a/seaweed-block/docs/spec/cfg/RED_epoch.cfg b/seaweed-block/docs/spec/cfg/RED_epoch.cfg new file mode 100644 index 0000000000..c4947609dd --- /dev/null +++ b/seaweed-block/docs/spec/cfg/RED_epoch.cfg @@ -0,0 +1,20 @@ +\* RED_epoch: model-checks WorkspaceTakeover.tla (run from docs/spec: ./run.sh RED_epoch) +SPECIFICATION Spec +CONSTANTS + Kinds = {"forced"} + MaxT = 4 + TTL = 2 + ITTL = 1 + MaxLSN = 2 + MaxCuts = 2 + Drift = 0 + MaxRestarts = 1 + LeaseOn = FALSE + LsnGuard = TRUE + StoreEpochGuard = FALSE + HostFence = FALSE + LayerLsnCheck = TRUE + SeedFromObserved = TRUE + GCEpochRule = TRUE + WaitLeaseExpiry = TRUE +INVARIANT TypeOK NoOldCasAfterTakeover diff --git a/seaweed-block/docs/spec/cfg/RED_epoch_hostonly.cfg b/seaweed-block/docs/spec/cfg/RED_epoch_hostonly.cfg new file mode 100644 index 0000000000..4884ce7a5f --- /dev/null +++ b/seaweed-block/docs/spec/cfg/RED_epoch_hostonly.cfg @@ -0,0 +1,20 @@ +\* RED_epoch_hostonly: model-checks WorkspaceTakeover.tla (run from docs/spec: ./run.sh RED_epoch_hostonly) +SPECIFICATION Spec +CONSTANTS + Kinds = {"forced"} + MaxT = 4 + TTL = 2 + ITTL = 1 + MaxLSN = 2 + MaxCuts = 2 + Drift = 0 + MaxRestarts = 1 + LeaseOn = FALSE + LsnGuard = TRUE + StoreEpochGuard = TRUE + HostFence = FALSE + LayerLsnCheck = TRUE + SeedFromObserved = TRUE + GCEpochRule = TRUE + WaitLeaseExpiry = TRUE +INVARIANT TypeOK NoOldCasAfterTakeover NoLateChunkReachable diff --git a/seaweed-block/docs/spec/cfg/RED_epoch_storeonly.cfg b/seaweed-block/docs/spec/cfg/RED_epoch_storeonly.cfg new file mode 100644 index 0000000000..163650f5d2 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/RED_epoch_storeonly.cfg @@ -0,0 +1,20 @@ +\* RED_epoch_storeonly: model-checks WorkspaceTakeover.tla (run from docs/spec: ./run.sh RED_epoch_storeonly) +SPECIFICATION Spec +CONSTANTS + Kinds = {"forced"} + MaxT = 4 + TTL = 2 + ITTL = 1 + MaxLSN = 2 + MaxCuts = 2 + Drift = 0 + MaxRestarts = 1 + LeaseOn = FALSE + LsnGuard = TRUE + StoreEpochGuard = FALSE + HostFence = TRUE + LayerLsnCheck = TRUE + SeedFromObserved = TRUE + GCEpochRule = TRUE + WaitLeaseExpiry = TRUE +INVARIANT TypeOK NoOldCasAfterTakeover NoLateChunkReachable diff --git a/seaweed-block/docs/spec/cfg/RED_gc_ageonly.cfg b/seaweed-block/docs/spec/cfg/RED_gc_ageonly.cfg new file mode 100644 index 0000000000..7181fb20b7 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/RED_gc_ageonly.cfg @@ -0,0 +1,20 @@ +\* RED_gc_ageonly: model-checks WorkspaceTakeover.tla (run from docs/spec: ./run.sh RED_gc_ageonly) +SPECIFICATION Spec +CONSTANTS + Kinds = {"forced"} + MaxT = 4 + TTL = 2 + ITTL = 1 + MaxLSN = 2 + MaxCuts = 2 + Drift = 0 + MaxRestarts = 1 + LeaseOn = TRUE + LsnGuard = TRUE + StoreEpochGuard = TRUE + HostFence = TRUE + LayerLsnCheck = TRUE + SeedFromObserved = TRUE + GCEpochRule = FALSE + WaitLeaseExpiry = TRUE +INVARIANT TypeOK GCSafe diff --git a/seaweed-block/docs/spec/cfg/RED_lsn.cfg b/seaweed-block/docs/spec/cfg/RED_lsn.cfg new file mode 100644 index 0000000000..146314a001 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/RED_lsn.cfg @@ -0,0 +1,21 @@ +\* RED_lsn: model-checks WorkspaceTakeover.tla (run from docs/spec: ./run.sh RED_lsn) +SPECIFICATION Spec +CONSTANTS + Kinds = {"forced"} + MaxT = 4 + TTL = 2 + ITTL = 1 + MaxLSN = 2 + MaxCuts = 2 + Drift = 0 + MaxRestarts = 1 + LeaseOn = TRUE + LsnGuard = FALSE + StoreEpochGuard = TRUE + HostFence = TRUE + LayerLsnCheck = FALSE + SeedFromObserved = FALSE + GCEpochRule = TRUE + WaitLeaseExpiry = TRUE +INVARIANT TypeOK TypeOK +PROPERTY HeadMonotone diff --git a/seaweed-block/docs/spec/cfg/RED_lsn_storeonly.cfg b/seaweed-block/docs/spec/cfg/RED_lsn_storeonly.cfg new file mode 100644 index 0000000000..ee6c562e7b --- /dev/null +++ b/seaweed-block/docs/spec/cfg/RED_lsn_storeonly.cfg @@ -0,0 +1,21 @@ +\* RED_lsn_storeonly: model-checks WorkspaceTakeover.tla (run from docs/spec: ./run.sh RED_lsn_storeonly) +SPECIFICATION Spec +CONSTANTS + Kinds = {"forced"} + MaxT = 4 + TTL = 2 + ITTL = 1 + MaxLSN = 2 + MaxCuts = 2 + Drift = 0 + MaxRestarts = 1 + LeaseOn = TRUE + LsnGuard = FALSE + StoreEpochGuard = TRUE + HostFence = TRUE + LayerLsnCheck = TRUE + SeedFromObserved = TRUE + GCEpochRule = TRUE + WaitLeaseExpiry = TRUE +INVARIANT TypeOK NoDualServing NoOldCasAfterTakeover NoLateChunkReachable CleanNoLoss ForcedLossBounded GCSafe NoLiveIntentExpired AttachOrder SeedMatchesTakeover +PROPERTY HeadMonotone diff --git a/seaweed-block/docs/spec/cfg/S3_rep_c1_I2.cfg b/seaweed-block/docs/spec/cfg/S3_rep_c1_I2.cfg new file mode 100644 index 0000000000..5a10f3748d --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_rep_c1_I2.cfg @@ -0,0 +1,12 @@ +\* S3_rep_c1_I2: model-checks WALReplica.tla (run from docs/spec: ./run.sh S3_rep_c1_I2) +SPECIFICATION Spec +CONSTANTS + MaxLSN = 4 + B = 0 + DlLocal = TRUE + Marker = FALSE + SBWatermark = TRUE + CorruptOn = FALSE + PromoteGate = TRUE + JumpInStamp = FALSE +INVARIANT I2 diff --git a/seaweed-block/docs/spec/cfg/S3_rep_c1_g1_I2.cfg b/seaweed-block/docs/spec/cfg/S3_rep_c1_g1_I2.cfg new file mode 100644 index 0000000000..bec0c16a14 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_rep_c1_g1_I2.cfg @@ -0,0 +1,12 @@ +\* S3_rep_c1_g1_I2: model-checks WALReplica.tla (run from docs/spec: ./run.sh S3_rep_c1_g1_I2) +SPECIFICATION Spec +CONSTANTS + MaxLSN = 4 + B = 1 + DlLocal = TRUE + Marker = TRUE + SBWatermark = TRUE + CorruptOn = FALSE + PromoteGate = TRUE + JumpInStamp = FALSE +INVARIANT I2 diff --git a/seaweed-block/docs/spec/cfg/S3_rep_c1_g1_I3.cfg b/seaweed-block/docs/spec/cfg/S3_rep_c1_g1_I3.cfg new file mode 100644 index 0000000000..6a05708814 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_rep_c1_g1_I3.cfg @@ -0,0 +1,12 @@ +\* S3_rep_c1_g1_I3: model-checks WALReplica.tla (run from docs/spec: ./run.sh S3_rep_c1_g1_I3) +SPECIFICATION Spec +CONSTANTS + MaxLSN = 4 + B = 1 + DlLocal = TRUE + Marker = TRUE + SBWatermark = TRUE + CorruptOn = TRUE + PromoteGate = TRUE + JumpInStamp = FALSE +INVARIANT I3 diff --git a/seaweed-block/docs/spec/cfg/S3_rep_c1_g1_I3_inrec.cfg b/seaweed-block/docs/spec/cfg/S3_rep_c1_g1_I3_inrec.cfg new file mode 100644 index 0000000000..f59628afc4 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_rep_c1_g1_I3_inrec.cfg @@ -0,0 +1,12 @@ +\* S3_rep_c1_g1_I3_inrec: model-checks WALReplica.tla (run from docs/spec: ./run.sh S3_rep_c1_g1_I3_inrec) +SPECIFICATION Spec +CONSTANTS + MaxLSN = 4 + B = 1 + DlLocal = TRUE + Marker = TRUE + SBWatermark = FALSE + CorruptOn = TRUE + PromoteGate = TRUE + JumpInStamp = FALSE +INVARIANT I3 diff --git a/seaweed-block/docs/spec/cfg/S3_rep_c1_g1jump_I2.cfg b/seaweed-block/docs/spec/cfg/S3_rep_c1_g1jump_I2.cfg new file mode 100644 index 0000000000..2ab5e04cb0 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_rep_c1_g1jump_I2.cfg @@ -0,0 +1,12 @@ +\* S3_rep_c1_g1jump_I2: model-checks WALReplica.tla (run from docs/spec: ./run.sh S3_rep_c1_g1jump_I2) +SPECIFICATION Spec +CONSTANTS + MaxLSN = 4 + B = 1 + DlLocal = TRUE + Marker = TRUE + SBWatermark = TRUE + CorruptOn = FALSE + PromoteGate = TRUE + JumpInStamp = TRUE +INVARIANT I2 diff --git a/seaweed-block/docs/spec/cfg/S3_rep_c1_g2_I2.cfg b/seaweed-block/docs/spec/cfg/S3_rep_c1_g2_I2.cfg new file mode 100644 index 0000000000..8ffc9aab70 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_rep_c1_g2_I2.cfg @@ -0,0 +1,12 @@ +\* S3_rep_c1_g2_I2: model-checks WALReplica.tla (run from docs/spec: ./run.sh S3_rep_c1_g2_I2) +SPECIFICATION Spec +CONSTANTS + MaxLSN = 4 + B = 1 + DlLocal = TRUE + Marker = FALSE + SBWatermark = TRUE + CorruptOn = FALSE + PromoteGate = TRUE + JumpInStamp = FALSE +INVARIANT I2 diff --git a/seaweed-block/docs/spec/cfg/S3_rep_c1_g2jump_I2.cfg b/seaweed-block/docs/spec/cfg/S3_rep_c1_g2jump_I2.cfg new file mode 100644 index 0000000000..6d87faaf31 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_rep_c1_g2jump_I2.cfg @@ -0,0 +1,12 @@ +\* S3_rep_c1_g2jump_I2: model-checks WALReplica.tla (run from docs/spec: ./run.sh S3_rep_c1_g2jump_I2) +SPECIFICATION Spec +CONSTANTS + MaxLSN = 4 + B = 1 + DlLocal = TRUE + Marker = FALSE + SBWatermark = TRUE + CorruptOn = FALSE + PromoteGate = TRUE + JumpInStamp = TRUE +INVARIANT I2 diff --git a/seaweed-block/docs/spec/cfg/S3_rep_c2_I2.cfg b/seaweed-block/docs/spec/cfg/S3_rep_c2_I2.cfg new file mode 100644 index 0000000000..8962df6b79 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_rep_c2_I2.cfg @@ -0,0 +1,12 @@ +\* S3_rep_c2_I2: model-checks WALReplica.tla (run from docs/spec: ./run.sh S3_rep_c2_I2) +SPECIFICATION Spec +CONSTANTS + MaxLSN = 4 + B = 0 + DlLocal = FALSE + Marker = FALSE + SBWatermark = TRUE + CorruptOn = FALSE + PromoteGate = TRUE + JumpInStamp = FALSE +INVARIANT I2 diff --git a/seaweed-block/docs/spec/cfg/S3_rep_nogate_I3.cfg b/seaweed-block/docs/spec/cfg/S3_rep_nogate_I3.cfg new file mode 100644 index 0000000000..9931fe56e5 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_rep_nogate_I3.cfg @@ -0,0 +1,12 @@ +\* S3_rep_nogate_I3: model-checks WALReplica.tla (run from docs/spec: ./run.sh S3_rep_nogate_I3) +SPECIFICATION Spec +CONSTANTS + MaxLSN = 4 + B = 1 + DlLocal = TRUE + Marker = TRUE + SBWatermark = TRUE + CorruptOn = TRUE + PromoteGate = FALSE + JumpInStamp = FALSE +INVARIANT I3 diff --git a/seaweed-block/docs/spec/cfg/S3_rep_reach.cfg b/seaweed-block/docs/spec/cfg/S3_rep_reach.cfg new file mode 100644 index 0000000000..eefed78bc5 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_rep_reach.cfg @@ -0,0 +1,12 @@ +\* S3_rep_reach: model-checks WALReplica.tla (run from docs/spec: ./run.sh S3_rep_reach) +SPECIFICATION Spec +CONSTANTS + MaxLSN = 4 + B = 1 + DlLocal = TRUE + Marker = TRUE + SBWatermark = TRUE + CorruptOn = FALSE + PromoteGate = TRUE + JumpInStamp = FALSE +INVARIANT W_NoPromotion diff --git a/seaweed-block/docs/spec/cfg/S3_sw2_current_I2.cfg b/seaweed-block/docs/spec/cfg/S3_sw2_current_I2.cfg new file mode 100644 index 0000000000..66155fff65 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_sw2_current_I2.cfg @@ -0,0 +1,15 @@ +\* S3_sw2_current_I2: model-checks SmartWALRecovery.tla (run from docs/spec: ./run.sh S3_sw2_current_I2) +SPECIFICATION Spec +CONSTANTS + C = 5 + MaxLSN = 6 + LBAs = {"x", "y"} + Rule = "current" + CorruptOn = FALSE + MaxTs = 4 + Jump = 2 + Marker = FALSE + Rounds = 2 + Repair = FALSE + CorruptExtent = TRUE +INVARIANT I2 diff --git a/seaweed-block/docs/spec/cfg/S3_sw2_current_marker_I2.cfg b/seaweed-block/docs/spec/cfg/S3_sw2_current_marker_I2.cfg new file mode 100644 index 0000000000..b811199a66 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_sw2_current_marker_I2.cfg @@ -0,0 +1,15 @@ +\* S3_sw2_current_marker_I2: model-checks SmartWALRecovery.tla (run from docs/spec: ./run.sh S3_sw2_current_marker_I2) +SPECIFICATION Spec +CONSTANTS + C = 5 + MaxLSN = 6 + LBAs = {"x", "y"} + Rule = "current" + CorruptOn = FALSE + MaxTs = 4 + Jump = 2 + Marker = TRUE + Rounds = 2 + Repair = FALSE + CorruptExtent = TRUE +INVARIANT I2 diff --git a/seaweed-block/docs/spec/cfg/S3_sw2_ordered_I2.cfg b/seaweed-block/docs/spec/cfg/S3_sw2_ordered_I2.cfg new file mode 100644 index 0000000000..bc87f6d6ca --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_sw2_ordered_I2.cfg @@ -0,0 +1,15 @@ +\* S3_sw2_ordered_I2: model-checks SmartWALRecovery.tla (run from docs/spec: ./run.sh S3_sw2_ordered_I2) +SPECIFICATION Spec +CONSTANTS + C = 5 + MaxLSN = 6 + LBAs = {"x", "y"} + Rule = "ordered" + CorruptOn = FALSE + MaxTs = 4 + Jump = 2 + Marker = FALSE + Rounds = 2 + Repair = FALSE + CorruptExtent = TRUE +INVARIANT I2 diff --git a/seaweed-block/docs/spec/cfg/S3_sw2_ordered_marker_I2.cfg b/seaweed-block/docs/spec/cfg/S3_sw2_ordered_marker_I2.cfg new file mode 100644 index 0000000000..4a5028d83d --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_sw2_ordered_marker_I2.cfg @@ -0,0 +1,15 @@ +\* S3_sw2_ordered_marker_I2: model-checks SmartWALRecovery.tla (run from docs/spec: ./run.sh S3_sw2_ordered_marker_I2) +SPECIFICATION Spec +CONSTANTS + C = 5 + MaxLSN = 6 + LBAs = {"x", "y"} + Rule = "ordered" + CorruptOn = FALSE + MaxTs = 4 + Jump = 2 + Marker = TRUE + Rounds = 2 + Repair = FALSE + CorruptExtent = TRUE +INVARIANT I2 diff --git a/seaweed-block/docs/spec/cfg/S3_sw2_ordered_marker_repair_I1.cfg b/seaweed-block/docs/spec/cfg/S3_sw2_ordered_marker_repair_I1.cfg new file mode 100644 index 0000000000..e64c1231be --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_sw2_ordered_marker_repair_I1.cfg @@ -0,0 +1,15 @@ +\* S3_sw2_ordered_marker_repair_I1: model-checks SmartWALRecovery.tla (run from docs/spec: ./run.sh S3_sw2_ordered_marker_repair_I1) +SPECIFICATION Spec +CONSTANTS + C = 5 + MaxLSN = 6 + LBAs = {"x", "y"} + Rule = "ordered" + CorruptOn = TRUE + MaxTs = 4 + Jump = 2 + Marker = TRUE + Rounds = 2 + Repair = TRUE + CorruptExtent = TRUE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S3_sw2_ordered_marker_repair_I1Frontier.cfg b/seaweed-block/docs/spec/cfg/S3_sw2_ordered_marker_repair_I1Frontier.cfg new file mode 100644 index 0000000000..339d5ec30b --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_sw2_ordered_marker_repair_I1Frontier.cfg @@ -0,0 +1,15 @@ +\* S3_sw2_ordered_marker_repair_I1Frontier: model-checks SmartWALRecovery.tla (run from docs/spec: ./run.sh S3_sw2_ordered_marker_repair_I1Frontier) +SPECIFICATION Spec +CONSTANTS + C = 5 + MaxLSN = 6 + LBAs = {"x", "y"} + Rule = "ordered" + CorruptOn = TRUE + MaxTs = 4 + Jump = 2 + Marker = TRUE + Rounds = 2 + Repair = TRUE + CorruptExtent = FALSE +INVARIANT I1Frontier diff --git a/seaweed-block/docs/spec/cfg/S3_sw2_ordered_marker_repair_I1slot.cfg b/seaweed-block/docs/spec/cfg/S3_sw2_ordered_marker_repair_I1slot.cfg new file mode 100644 index 0000000000..5d010cc630 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_sw2_ordered_marker_repair_I1slot.cfg @@ -0,0 +1,15 @@ +\* S3_sw2_ordered_marker_repair_I1slot: model-checks SmartWALRecovery.tla (run from docs/spec: ./run.sh S3_sw2_ordered_marker_repair_I1slot) +SPECIFICATION Spec +CONSTANTS + C = 5 + MaxLSN = 6 + LBAs = {"x", "y"} + Rule = "ordered" + CorruptOn = TRUE + MaxTs = 4 + Jump = 2 + Marker = TRUE + Rounds = 2 + Repair = TRUE + CorruptExtent = FALSE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S3_sw2_ordered_marker_repair_I2.cfg b/seaweed-block/docs/spec/cfg/S3_sw2_ordered_marker_repair_I2.cfg new file mode 100644 index 0000000000..b654943b04 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_sw2_ordered_marker_repair_I2.cfg @@ -0,0 +1,15 @@ +\* S3_sw2_ordered_marker_repair_I2: model-checks SmartWALRecovery.tla (run from docs/spec: ./run.sh S3_sw2_ordered_marker_repair_I2) +SPECIFICATION Spec +CONSTANTS + C = 5 + MaxLSN = 6 + LBAs = {"x", "y"} + Rule = "ordered" + CorruptOn = FALSE + MaxTs = 4 + Jump = 2 + Marker = TRUE + Rounds = 2 + Repair = TRUE + CorruptExtent = TRUE +INVARIANT I2 diff --git a/seaweed-block/docs/spec/cfg/S3_sw2_ordered_repair_I2.cfg b/seaweed-block/docs/spec/cfg/S3_sw2_ordered_repair_I2.cfg new file mode 100644 index 0000000000..a7c4447383 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_sw2_ordered_repair_I2.cfg @@ -0,0 +1,15 @@ +\* S3_sw2_ordered_repair_I2: model-checks SmartWALRecovery.tla (run from docs/spec: ./run.sh S3_sw2_ordered_repair_I2) +SPECIFICATION Spec +CONSTANTS + C = 5 + MaxLSN = 6 + LBAs = {"x", "y"} + Rule = "ordered" + CorruptOn = FALSE + MaxTs = 4 + Jump = 2 + Marker = FALSE + Rounds = 2 + Repair = TRUE + CorruptExtent = TRUE +INVARIANT I2 diff --git a/seaweed-block/docs/spec/cfg/S3_sw2_pr155_I2.cfg b/seaweed-block/docs/spec/cfg/S3_sw2_pr155_I2.cfg new file mode 100644 index 0000000000..a0ad83a901 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_sw2_pr155_I2.cfg @@ -0,0 +1,15 @@ +\* S3_sw2_pr155_I2: model-checks SmartWALRecovery.tla (run from docs/spec: ./run.sh S3_sw2_pr155_I2) +SPECIFICATION Spec +CONSTANTS + C = 5 + MaxLSN = 6 + LBAs = {"x", "y"} + Rule = "pr155" + CorruptOn = FALSE + MaxTs = 4 + Jump = 2 + Marker = FALSE + Rounds = 2 + Repair = FALSE + CorruptExtent = TRUE +INVARIANT I2 diff --git a/seaweed-block/docs/spec/cfg/S3_sw2_pr155_marker_I2.cfg b/seaweed-block/docs/spec/cfg/S3_sw2_pr155_marker_I2.cfg new file mode 100644 index 0000000000..ab85f49834 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_sw2_pr155_marker_I2.cfg @@ -0,0 +1,15 @@ +\* S3_sw2_pr155_marker_I2: model-checks SmartWALRecovery.tla (run from docs/spec: ./run.sh S3_sw2_pr155_marker_I2) +SPECIFICATION Spec +CONSTANTS + C = 5 + MaxLSN = 6 + LBAs = {"x", "y"} + Rule = "pr155" + CorruptOn = FALSE + MaxTs = 4 + Jump = 2 + Marker = TRUE + Rounds = 2 + Repair = FALSE + CorruptExtent = TRUE +INVARIANT I2 diff --git a/seaweed-block/docs/spec/cfg/S3_sw2_pr155o_I2.cfg b/seaweed-block/docs/spec/cfg/S3_sw2_pr155o_I2.cfg new file mode 100644 index 0000000000..c283adda48 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_sw2_pr155o_I2.cfg @@ -0,0 +1,15 @@ +\* S3_sw2_pr155o_I2: model-checks SmartWALRecovery.tla (run from docs/spec: ./run.sh S3_sw2_pr155o_I2) +SPECIFICATION Spec +CONSTANTS + C = 5 + MaxLSN = 6 + LBAs = {"x", "y"} + Rule = "pr155o" + CorruptOn = FALSE + MaxTs = 4 + Jump = 2 + Marker = FALSE + Rounds = 2 + Repair = FALSE + CorruptExtent = TRUE +INVARIANT I2 diff --git a/seaweed-block/docs/spec/cfg/S3_sw2_reach.cfg b/seaweed-block/docs/spec/cfg/S3_sw2_reach.cfg new file mode 100644 index 0000000000..091874b00a --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_sw2_reach.cfg @@ -0,0 +1,15 @@ +\* S3_sw2_reach: model-checks SmartWALRecovery.tla (run from docs/spec: ./run.sh S3_sw2_reach) +SPECIFICATION Spec +CONSTANTS + C = 5 + MaxLSN = 6 + LBAs = {"x", "y"} + Rule = "ordered" + CorruptOn = FALSE + MaxTs = 4 + Jump = 2 + Marker = TRUE + Rounds = 2 + Repair = FALSE + CorruptExtent = TRUE +INVARIANT W_NoRecovery diff --git a/seaweed-block/docs/spec/cfg/S3_sw2_watermark_I2.cfg b/seaweed-block/docs/spec/cfg/S3_sw2_watermark_I2.cfg new file mode 100644 index 0000000000..c1d906b9e8 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_sw2_watermark_I2.cfg @@ -0,0 +1,15 @@ +\* S3_sw2_watermark_I2: model-checks SmartWALRecovery.tla (run from docs/spec: ./run.sh S3_sw2_watermark_I2) +SPECIFICATION Spec +CONSTANTS + C = 5 + MaxLSN = 6 + LBAs = {"x", "y"} + Rule = "watermark" + CorruptOn = FALSE + MaxTs = 4 + Jump = 2 + Marker = FALSE + Rounds = 2 + Repair = FALSE + CorruptExtent = TRUE +INVARIANT I2 diff --git a/seaweed-block/docs/spec/cfg/S3_sw2_watermark_marker_I2.cfg b/seaweed-block/docs/spec/cfg/S3_sw2_watermark_marker_I2.cfg new file mode 100644 index 0000000000..970c60f120 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_sw2_watermark_marker_I2.cfg @@ -0,0 +1,15 @@ +\* S3_sw2_watermark_marker_I2: model-checks SmartWALRecovery.tla (run from docs/spec: ./run.sh S3_sw2_watermark_marker_I2) +SPECIFICATION Spec +CONSTANTS + C = 5 + MaxLSN = 6 + LBAs = {"x", "y"} + Rule = "watermark" + CorruptOn = FALSE + MaxTs = 4 + Jump = 2 + Marker = TRUE + Rounds = 2 + Repair = FALSE + CorruptExtent = TRUE +INVARIANT I2 diff --git a/seaweed-block/docs/spec/cfg/S3_sw2_watermark_marker_repair_I1.cfg b/seaweed-block/docs/spec/cfg/S3_sw2_watermark_marker_repair_I1.cfg new file mode 100644 index 0000000000..d64e9bf768 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_sw2_watermark_marker_repair_I1.cfg @@ -0,0 +1,15 @@ +\* S3_sw2_watermark_marker_repair_I1: model-checks SmartWALRecovery.tla (run from docs/spec: ./run.sh S3_sw2_watermark_marker_repair_I1) +SPECIFICATION Spec +CONSTANTS + C = 5 + MaxLSN = 6 + LBAs = {"x", "y"} + Rule = "watermark" + CorruptOn = TRUE + MaxTs = 4 + Jump = 2 + Marker = TRUE + Rounds = 2 + Repair = TRUE + CorruptExtent = TRUE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S3_sw2_watermark_marker_repair_I1Frontier.cfg b/seaweed-block/docs/spec/cfg/S3_sw2_watermark_marker_repair_I1Frontier.cfg new file mode 100644 index 0000000000..e7a585ff06 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_sw2_watermark_marker_repair_I1Frontier.cfg @@ -0,0 +1,15 @@ +\* S3_sw2_watermark_marker_repair_I1Frontier: model-checks SmartWALRecovery.tla (run from docs/spec: ./run.sh S3_sw2_watermark_marker_repair_I1Frontier) +SPECIFICATION Spec +CONSTANTS + C = 5 + MaxLSN = 6 + LBAs = {"x", "y"} + Rule = "watermark" + CorruptOn = TRUE + MaxTs = 4 + Jump = 2 + Marker = TRUE + Rounds = 2 + Repair = TRUE + CorruptExtent = FALSE +INVARIANT I1Frontier diff --git a/seaweed-block/docs/spec/cfg/S3_sw2_watermark_marker_repair_I1slot.cfg b/seaweed-block/docs/spec/cfg/S3_sw2_watermark_marker_repair_I1slot.cfg new file mode 100644 index 0000000000..49fc352709 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_sw2_watermark_marker_repair_I1slot.cfg @@ -0,0 +1,15 @@ +\* S3_sw2_watermark_marker_repair_I1slot: model-checks SmartWALRecovery.tla (run from docs/spec: ./run.sh S3_sw2_watermark_marker_repair_I1slot) +SPECIFICATION Spec +CONSTANTS + C = 5 + MaxLSN = 6 + LBAs = {"x", "y"} + Rule = "watermark" + CorruptOn = TRUE + MaxTs = 4 + Jump = 2 + Marker = TRUE + Rounds = 2 + Repair = TRUE + CorruptExtent = FALSE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S3_sw2_watermark_marker_repair_I2.cfg b/seaweed-block/docs/spec/cfg/S3_sw2_watermark_marker_repair_I2.cfg new file mode 100644 index 0000000000..53df4d458b --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_sw2_watermark_marker_repair_I2.cfg @@ -0,0 +1,15 @@ +\* S3_sw2_watermark_marker_repair_I2: model-checks SmartWALRecovery.tla (run from docs/spec: ./run.sh S3_sw2_watermark_marker_repair_I2) +SPECIFICATION Spec +CONSTANTS + C = 5 + MaxLSN = 6 + LBAs = {"x", "y"} + Rule = "watermark" + CorruptOn = FALSE + MaxTs = 4 + Jump = 2 + Marker = TRUE + Rounds = 2 + Repair = TRUE + CorruptExtent = TRUE +INVARIANT I2 diff --git a/seaweed-block/docs/spec/cfg/S3_sw2_watermark_repair_I2.cfg b/seaweed-block/docs/spec/cfg/S3_sw2_watermark_repair_I2.cfg new file mode 100644 index 0000000000..624ae442b1 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_sw2_watermark_repair_I2.cfg @@ -0,0 +1,15 @@ +\* S3_sw2_watermark_repair_I2: model-checks SmartWALRecovery.tla (run from docs/spec: ./run.sh S3_sw2_watermark_repair_I2) +SPECIFICATION Spec +CONSTANTS + C = 5 + MaxLSN = 6 + LBAs = {"x", "y"} + Rule = "watermark" + CorruptOn = FALSE + MaxTs = 4 + Jump = 2 + Marker = FALSE + Rounds = 2 + Repair = TRUE + CorruptExtent = TRUE +INVARIANT I2 diff --git a/seaweed-block/docs/spec/cfg/S3_sw_current_I1.cfg b/seaweed-block/docs/spec/cfg/S3_sw_current_I1.cfg new file mode 100644 index 0000000000..d9ae9ca756 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_sw_current_I1.cfg @@ -0,0 +1,15 @@ +\* S3_sw_current_I1: model-checks SmartWALRecovery.tla (run from docs/spec: ./run.sh S3_sw_current_I1) +SPECIFICATION Spec +CONSTANTS + C = 3 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "current" + CorruptOn = TRUE + MaxTs = 4 + Jump = 2 + Marker = FALSE + Rounds = 1 + Repair = FALSE + CorruptExtent = TRUE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S3_sw_current_I1frontier.cfg b/seaweed-block/docs/spec/cfg/S3_sw_current_I1frontier.cfg new file mode 100644 index 0000000000..bef70e051d --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_sw_current_I1frontier.cfg @@ -0,0 +1,15 @@ +\* S3_sw_current_I1frontier: model-checks SmartWALRecovery.tla (run from docs/spec: ./run.sh S3_sw_current_I1frontier) +SPECIFICATION Spec +CONSTANTS + C = 3 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "current" + CorruptOn = TRUE + MaxTs = 4 + Jump = 2 + Marker = FALSE + Rounds = 1 + Repair = FALSE + CorruptExtent = TRUE +INVARIANT I1Frontier diff --git a/seaweed-block/docs/spec/cfg/S3_sw_current_I2.cfg b/seaweed-block/docs/spec/cfg/S3_sw_current_I2.cfg new file mode 100644 index 0000000000..5c41bb71c5 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_sw_current_I2.cfg @@ -0,0 +1,15 @@ +\* S3_sw_current_I2: model-checks SmartWALRecovery.tla (run from docs/spec: ./run.sh S3_sw_current_I2) +SPECIFICATION Spec +CONSTANTS + C = 3 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "current" + CorruptOn = FALSE + MaxTs = 4 + Jump = 2 + Marker = FALSE + Rounds = 1 + Repair = FALSE + CorruptExtent = TRUE +INVARIANT I2 diff --git a/seaweed-block/docs/spec/cfg/S3_sw_holeFail_I1.cfg b/seaweed-block/docs/spec/cfg/S3_sw_holeFail_I1.cfg new file mode 100644 index 0000000000..760535d800 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_sw_holeFail_I1.cfg @@ -0,0 +1,15 @@ +\* S3_sw_holeFail_I1: model-checks SmartWALRecovery.tla (run from docs/spec: ./run.sh S3_sw_holeFail_I1) +SPECIFICATION Spec +CONSTANTS + C = 3 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "holeFail" + CorruptOn = TRUE + MaxTs = 4 + Jump = 2 + Marker = FALSE + Rounds = 1 + Repair = FALSE + CorruptExtent = TRUE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S3_sw_holeFail_I1frontier.cfg b/seaweed-block/docs/spec/cfg/S3_sw_holeFail_I1frontier.cfg new file mode 100644 index 0000000000..40f537c237 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_sw_holeFail_I1frontier.cfg @@ -0,0 +1,15 @@ +\* S3_sw_holeFail_I1frontier: model-checks SmartWALRecovery.tla (run from docs/spec: ./run.sh S3_sw_holeFail_I1frontier) +SPECIFICATION Spec +CONSTANTS + C = 3 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "holeFail" + CorruptOn = TRUE + MaxTs = 4 + Jump = 2 + Marker = FALSE + Rounds = 1 + Repair = FALSE + CorruptExtent = TRUE +INVARIANT I1Frontier diff --git a/seaweed-block/docs/spec/cfg/S3_sw_holeFail_I2.cfg b/seaweed-block/docs/spec/cfg/S3_sw_holeFail_I2.cfg new file mode 100644 index 0000000000..4fd7f524a5 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_sw_holeFail_I2.cfg @@ -0,0 +1,15 @@ +\* S3_sw_holeFail_I2: model-checks SmartWALRecovery.tla (run from docs/spec: ./run.sh S3_sw_holeFail_I2) +SPECIFICATION Spec +CONSTANTS + C = 3 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "holeFail" + CorruptOn = FALSE + MaxTs = 4 + Jump = 2 + Marker = FALSE + Rounds = 1 + Repair = FALSE + CorruptExtent = TRUE +INVARIANT I2 diff --git a/seaweed-block/docs/spec/cfg/S3_sw_ordered_I1.cfg b/seaweed-block/docs/spec/cfg/S3_sw_ordered_I1.cfg new file mode 100644 index 0000000000..88363fc900 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_sw_ordered_I1.cfg @@ -0,0 +1,15 @@ +\* S3_sw_ordered_I1: model-checks SmartWALRecovery.tla (run from docs/spec: ./run.sh S3_sw_ordered_I1) +SPECIFICATION Spec +CONSTANTS + C = 3 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "ordered" + CorruptOn = TRUE + MaxTs = 4 + Jump = 2 + Marker = FALSE + Rounds = 1 + Repair = FALSE + CorruptExtent = TRUE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S3_sw_ordered_I1frontier.cfg b/seaweed-block/docs/spec/cfg/S3_sw_ordered_I1frontier.cfg new file mode 100644 index 0000000000..ea5d70d565 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_sw_ordered_I1frontier.cfg @@ -0,0 +1,15 @@ +\* S3_sw_ordered_I1frontier: model-checks SmartWALRecovery.tla (run from docs/spec: ./run.sh S3_sw_ordered_I1frontier) +SPECIFICATION Spec +CONSTANTS + C = 3 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "ordered" + CorruptOn = TRUE + MaxTs = 4 + Jump = 2 + Marker = FALSE + Rounds = 1 + Repair = FALSE + CorruptExtent = TRUE +INVARIANT I1Frontier diff --git a/seaweed-block/docs/spec/cfg/S3_sw_ordered_I2.cfg b/seaweed-block/docs/spec/cfg/S3_sw_ordered_I2.cfg new file mode 100644 index 0000000000..d21a3905d0 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_sw_ordered_I2.cfg @@ -0,0 +1,15 @@ +\* S3_sw_ordered_I2: model-checks SmartWALRecovery.tla (run from docs/spec: ./run.sh S3_sw_ordered_I2) +SPECIFICATION Spec +CONSTANTS + C = 3 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "ordered" + CorruptOn = FALSE + MaxTs = 4 + Jump = 2 + Marker = FALSE + Rounds = 1 + Repair = FALSE + CorruptExtent = TRUE +INVARIANT I2 diff --git a/seaweed-block/docs/spec/cfg/S3_sw_reach.cfg b/seaweed-block/docs/spec/cfg/S3_sw_reach.cfg new file mode 100644 index 0000000000..109bf65a70 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_sw_reach.cfg @@ -0,0 +1,15 @@ +\* S3_sw_reach: model-checks SmartWALRecovery.tla (run from docs/spec: ./run.sh S3_sw_reach) +SPECIFICATION Spec +CONSTANTS + C = 3 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "current" + CorruptOn = FALSE + MaxTs = 4 + Jump = 2 + Marker = FALSE + Rounds = 1 + Repair = FALSE + CorruptExtent = TRUE +INVARIANT W_NoRecovery diff --git a/seaweed-block/docs/spec/cfg/S3_sw_watermark_I1.cfg b/seaweed-block/docs/spec/cfg/S3_sw_watermark_I1.cfg new file mode 100644 index 0000000000..602a419d13 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_sw_watermark_I1.cfg @@ -0,0 +1,15 @@ +\* S3_sw_watermark_I1: model-checks SmartWALRecovery.tla (run from docs/spec: ./run.sh S3_sw_watermark_I1) +SPECIFICATION Spec +CONSTANTS + C = 3 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "watermark" + CorruptOn = TRUE + MaxTs = 4 + Jump = 2 + Marker = FALSE + Rounds = 1 + Repair = FALSE + CorruptExtent = TRUE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S3_sw_watermark_I1frontier.cfg b/seaweed-block/docs/spec/cfg/S3_sw_watermark_I1frontier.cfg new file mode 100644 index 0000000000..23d6567594 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_sw_watermark_I1frontier.cfg @@ -0,0 +1,15 @@ +\* S3_sw_watermark_I1frontier: model-checks SmartWALRecovery.tla (run from docs/spec: ./run.sh S3_sw_watermark_I1frontier) +SPECIFICATION Spec +CONSTANTS + C = 3 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "watermark" + CorruptOn = TRUE + MaxTs = 4 + Jump = 2 + Marker = FALSE + Rounds = 1 + Repair = FALSE + CorruptExtent = TRUE +INVARIANT I1Frontier diff --git a/seaweed-block/docs/spec/cfg/S3_sw_watermark_I2.cfg b/seaweed-block/docs/spec/cfg/S3_sw_watermark_I2.cfg new file mode 100644 index 0000000000..f931e956c3 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_sw_watermark_I2.cfg @@ -0,0 +1,15 @@ +\* S3_sw_watermark_I2: model-checks SmartWALRecovery.tla (run from docs/spec: ./run.sh S3_sw_watermark_I2) +SPECIFICATION Spec +CONSTANTS + C = 3 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "watermark" + CorruptOn = FALSE + MaxTs = 4 + Jump = 2 + Marker = FALSE + Rounds = 1 + Repair = FALSE + CorruptExtent = TRUE +INVARIANT I2 diff --git a/seaweed-block/docs/spec/cfg/S3_wal_current_I1.cfg b/seaweed-block/docs/spec/cfg/S3_wal_current_I1.cfg new file mode 100644 index 0000000000..b57a31c808 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_wal_current_I1.cfg @@ -0,0 +1,15 @@ +\* S3_wal_current_I1: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3_wal_current_I1) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "current" + CorruptOn = TRUE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S3_wal_current_I1_crashonly.cfg b/seaweed-block/docs/spec/cfg/S3_wal_current_I1_crashonly.cfg new file mode 100644 index 0000000000..b0c25507a8 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_wal_current_I1_crashonly.cfg @@ -0,0 +1,15 @@ +\* S3_wal_current_I1_crashonly: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3_wal_current_I1_crashonly) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "current" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S3_wal_current_I2.cfg b/seaweed-block/docs/spec/cfg/S3_wal_current_I2.cfg new file mode 100644 index 0000000000..d936aa4691 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_wal_current_I2.cfg @@ -0,0 +1,15 @@ +\* S3_wal_current_I2: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3_wal_current_I2) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "current" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I2 diff --git a/seaweed-block/docs/spec/cfg/S3_wal_current_prefix.cfg b/seaweed-block/docs/spec/cfg/S3_wal_current_prefix.cfg new file mode 100644 index 0000000000..d86a6d0edd --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_wal_current_prefix.cfg @@ -0,0 +1,15 @@ +\* S3_wal_current_prefix: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3_wal_current_prefix) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "current" + CorruptOn = TRUE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I0Prefix diff --git a/seaweed-block/docs/spec/cfg/S3_wal_current_replay.cfg b/seaweed-block/docs/spec/cfg/S3_wal_current_replay.cfg new file mode 100644 index 0000000000..2e9ac6d97a --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_wal_current_replay.cfg @@ -0,0 +1,15 @@ +\* S3_wal_current_replay: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3_wal_current_replay) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "current" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT ReplayLastWriter diff --git a/seaweed-block/docs/spec/cfg/S3_wal_holeFail_I1.cfg b/seaweed-block/docs/spec/cfg/S3_wal_holeFail_I1.cfg new file mode 100644 index 0000000000..58f4386f25 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_wal_holeFail_I1.cfg @@ -0,0 +1,15 @@ +\* S3_wal_holeFail_I1: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3_wal_holeFail_I1) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "holeFail" + CorruptOn = TRUE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S3_wal_holeFail_I2.cfg b/seaweed-block/docs/spec/cfg/S3_wal_holeFail_I2.cfg new file mode 100644 index 0000000000..e7195b5a2f --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_wal_holeFail_I2.cfg @@ -0,0 +1,15 @@ +\* S3_wal_holeFail_I2: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3_wal_holeFail_I2) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "holeFail" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I2 diff --git a/seaweed-block/docs/spec/cfg/S3_wal_holeFail_prefix.cfg b/seaweed-block/docs/spec/cfg/S3_wal_holeFail_prefix.cfg new file mode 100644 index 0000000000..56e358aabb --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_wal_holeFail_prefix.cfg @@ -0,0 +1,15 @@ +\* S3_wal_holeFail_prefix: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3_wal_holeFail_prefix) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "holeFail" + CorruptOn = TRUE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I0Prefix diff --git a/seaweed-block/docs/spec/cfg/S3_wal_pr155_I1.cfg b/seaweed-block/docs/spec/cfg/S3_wal_pr155_I1.cfg new file mode 100644 index 0000000000..fd4a24ac32 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_wal_pr155_I1.cfg @@ -0,0 +1,15 @@ +\* S3_wal_pr155_I1: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3_wal_pr155_I1) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "pr155" + CorruptOn = TRUE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S3_wal_pr155_I1_crashonly.cfg b/seaweed-block/docs/spec/cfg/S3_wal_pr155_I1_crashonly.cfg new file mode 100644 index 0000000000..65514c3173 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_wal_pr155_I1_crashonly.cfg @@ -0,0 +1,15 @@ +\* S3_wal_pr155_I1_crashonly: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3_wal_pr155_I1_crashonly) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "pr155" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S3_wal_pr155_I2.cfg b/seaweed-block/docs/spec/cfg/S3_wal_pr155_I2.cfg new file mode 100644 index 0000000000..fa9360c08c --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_wal_pr155_I2.cfg @@ -0,0 +1,15 @@ +\* S3_wal_pr155_I2: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3_wal_pr155_I2) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "pr155" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I2 diff --git a/seaweed-block/docs/spec/cfg/S3_wal_pr155_replay.cfg b/seaweed-block/docs/spec/cfg/S3_wal_pr155_replay.cfg new file mode 100644 index 0000000000..308a021e0e --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_wal_pr155_replay.cfg @@ -0,0 +1,15 @@ +\* S3_wal_pr155_replay: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3_wal_pr155_replay) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "pr155" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT ReplayLastWriter diff --git a/seaweed-block/docs/spec/cfg/S3_wal_reach_failclosed.cfg b/seaweed-block/docs/spec/cfg/S3_wal_reach_failclosed.cfg new file mode 100644 index 0000000000..526c1392a7 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_wal_reach_failclosed.cfg @@ -0,0 +1,15 @@ +\* S3_wal_reach_failclosed: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3_wal_reach_failclosed) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "watermarkSB" + CorruptOn = TRUE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT W_NoCorruptFailClosed diff --git a/seaweed-block/docs/spec/cfg/S3_wal_reach_wrap.cfg b/seaweed-block/docs/spec/cfg/S3_wal_reach_wrap.cfg new file mode 100644 index 0000000000..2e77ac0ee0 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_wal_reach_wrap.cfg @@ -0,0 +1,15 @@ +\* S3_wal_reach_wrap: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3_wal_reach_wrap) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "watermarkSB" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT W_NoWrapRecovery diff --git a/seaweed-block/docs/spec/cfg/S3_wal_watermarkFull_I0Prefix.cfg b/seaweed-block/docs/spec/cfg/S3_wal_watermarkFull_I0Prefix.cfg new file mode 100644 index 0000000000..03ea25509c --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_wal_watermarkFull_I0Prefix.cfg @@ -0,0 +1,15 @@ +\* S3_wal_watermarkFull_I0Prefix: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3_wal_watermarkFull_I0Prefix) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "watermarkFull" + CorruptOn = TRUE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I0Prefix diff --git a/seaweed-block/docs/spec/cfg/S3_wal_watermarkFull_I1.cfg b/seaweed-block/docs/spec/cfg/S3_wal_watermarkFull_I1.cfg new file mode 100644 index 0000000000..b61f94e15e --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_wal_watermarkFull_I1.cfg @@ -0,0 +1,15 @@ +\* S3_wal_watermarkFull_I1: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3_wal_watermarkFull_I1) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "watermarkFull" + CorruptOn = TRUE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S3_wal_watermarkFull_I1_crashonly.cfg b/seaweed-block/docs/spec/cfg/S3_wal_watermarkFull_I1_crashonly.cfg new file mode 100644 index 0000000000..04dafd309a --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_wal_watermarkFull_I1_crashonly.cfg @@ -0,0 +1,15 @@ +\* S3_wal_watermarkFull_I1_crashonly: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3_wal_watermarkFull_I1_crashonly) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "watermarkFull" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S3_wal_watermarkFull_I2.cfg b/seaweed-block/docs/spec/cfg/S3_wal_watermarkFull_I2.cfg new file mode 100644 index 0000000000..8bd0aeeddf --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_wal_watermarkFull_I2.cfg @@ -0,0 +1,15 @@ +\* S3_wal_watermarkFull_I2: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3_wal_watermarkFull_I2) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "watermarkFull" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I2 diff --git a/seaweed-block/docs/spec/cfg/S3_wal_watermarkFull_ReplayLastWriter.cfg b/seaweed-block/docs/spec/cfg/S3_wal_watermarkFull_ReplayLastWriter.cfg new file mode 100644 index 0000000000..a0397f6d77 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_wal_watermarkFull_ReplayLastWriter.cfg @@ -0,0 +1,15 @@ +\* S3_wal_watermarkFull_ReplayLastWriter: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3_wal_watermarkFull_ReplayLastWriter) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "watermarkFull" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT ReplayLastWriter diff --git a/seaweed-block/docs/spec/cfg/S3_wal_watermarkSB_I1.cfg b/seaweed-block/docs/spec/cfg/S3_wal_watermarkSB_I1.cfg new file mode 100644 index 0000000000..852aa7b67c --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_wal_watermarkSB_I1.cfg @@ -0,0 +1,15 @@ +\* S3_wal_watermarkSB_I1: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3_wal_watermarkSB_I1) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "watermarkSB" + CorruptOn = TRUE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S3_wal_watermarkSB_I1_big.cfg b/seaweed-block/docs/spec/cfg/S3_wal_watermarkSB_I1_big.cfg new file mode 100644 index 0000000000..acdc323911 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_wal_watermarkSB_I1_big.cfg @@ -0,0 +1,15 @@ +\* S3_wal_watermarkSB_I1_big: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3_wal_watermarkSB_I1_big) +SPECIFICATION Spec +CONSTANTS + K = 5 + MaxLSN = 5 + LBAs = {"x", "y"} + Rule = "watermarkSB" + CorruptOn = TRUE + MaxCkpt = 3 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S3_wal_watermarkSB_I1_crashonly.cfg b/seaweed-block/docs/spec/cfg/S3_wal_watermarkSB_I1_crashonly.cfg new file mode 100644 index 0000000000..f1bd8bde22 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_wal_watermarkSB_I1_crashonly.cfg @@ -0,0 +1,15 @@ +\* S3_wal_watermarkSB_I1_crashonly: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3_wal_watermarkSB_I1_crashonly) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "watermarkSB" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S3_wal_watermarkSB_I2.cfg b/seaweed-block/docs/spec/cfg/S3_wal_watermarkSB_I2.cfg new file mode 100644 index 0000000000..d14aeda3f6 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_wal_watermarkSB_I2.cfg @@ -0,0 +1,15 @@ +\* S3_wal_watermarkSB_I2: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3_wal_watermarkSB_I2) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "watermarkSB" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I2 diff --git a/seaweed-block/docs/spec/cfg/S3_wal_watermarkSB_I2_big.cfg b/seaweed-block/docs/spec/cfg/S3_wal_watermarkSB_I2_big.cfg new file mode 100644 index 0000000000..d89074db0d --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_wal_watermarkSB_I2_big.cfg @@ -0,0 +1,15 @@ +\* S3_wal_watermarkSB_I2_big: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3_wal_watermarkSB_I2_big) +SPECIFICATION Spec +CONSTANTS + K = 5 + MaxLSN = 5 + LBAs = {"x", "y"} + Rule = "watermarkSB" + CorruptOn = FALSE + MaxCkpt = 3 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I2 diff --git a/seaweed-block/docs/spec/cfg/S3_wal_watermarkSB_prefix.cfg b/seaweed-block/docs/spec/cfg/S3_wal_watermarkSB_prefix.cfg new file mode 100644 index 0000000000..f9bae7596c --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_wal_watermarkSB_prefix.cfg @@ -0,0 +1,15 @@ +\* S3_wal_watermarkSB_prefix: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3_wal_watermarkSB_prefix) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "watermarkSB" + CorruptOn = TRUE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I0Prefix diff --git a/seaweed-block/docs/spec/cfg/S3_wal_watermarkSB_replay.cfg b/seaweed-block/docs/spec/cfg/S3_wal_watermarkSB_replay.cfg new file mode 100644 index 0000000000..284eca9223 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_wal_watermarkSB_replay.cfg @@ -0,0 +1,15 @@ +\* S3_wal_watermarkSB_replay: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3_wal_watermarkSB_replay) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "watermarkSB" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT ReplayLastWriter diff --git a/seaweed-block/docs/spec/cfg/S3_wal_watermark_I1.cfg b/seaweed-block/docs/spec/cfg/S3_wal_watermark_I1.cfg new file mode 100644 index 0000000000..a16cb689f1 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_wal_watermark_I1.cfg @@ -0,0 +1,15 @@ +\* S3_wal_watermark_I1: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3_wal_watermark_I1) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "watermark" + CorruptOn = TRUE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S3_wal_watermark_I2.cfg b/seaweed-block/docs/spec/cfg/S3_wal_watermark_I2.cfg new file mode 100644 index 0000000000..bc7ea6d3e8 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_wal_watermark_I2.cfg @@ -0,0 +1,15 @@ +\* S3_wal_watermark_I2: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3_wal_watermark_I2) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "watermark" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I2 diff --git a/seaweed-block/docs/spec/cfg/S3_wal_watermark_prefix.cfg b/seaweed-block/docs/spec/cfg/S3_wal_watermark_prefix.cfg new file mode 100644 index 0000000000..c6166a803a --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3_wal_watermark_prefix.cfg @@ -0,0 +1,15 @@ +\* S3_wal_watermark_prefix: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3_wal_watermark_prefix) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "watermark" + CorruptOn = TRUE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I0Prefix diff --git a/seaweed-block/docs/spec/cfg/S3f_lwwFull_forged.cfg b/seaweed-block/docs/spec/cfg/S3f_lwwFull_forged.cfg new file mode 100644 index 0000000000..2e02f094b5 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3f_lwwFull_forged.cfg @@ -0,0 +1,15 @@ +\* S3f_lwwFull_forged: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3f_lwwFull_forged) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "lwwFull" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = TRUE +INVARIANT NoForgedReplay diff --git a/seaweed-block/docs/spec/cfg/S3f_prefixFullSB_forged.cfg b/seaweed-block/docs/spec/cfg/S3f_prefixFullSB_forged.cfg new file mode 100644 index 0000000000..d30cdcc710 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3f_prefixFullSB_forged.cfg @@ -0,0 +1,15 @@ +\* S3f_prefixFullSB_forged: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3f_prefixFullSB_forged) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "prefixFullSB" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = TRUE +INVARIANT NoForgedReplay diff --git a/seaweed-block/docs/spec/cfg/S3f_rootLww_forged.cfg b/seaweed-block/docs/spec/cfg/S3f_rootLww_forged.cfg new file mode 100644 index 0000000000..6dc5adf635 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3f_rootLww_forged.cfg @@ -0,0 +1,15 @@ +\* S3f_rootLww_forged: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3f_rootLww_forged) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "rootLww" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = TRUE +INVARIANT NoForgedReplay diff --git a/seaweed-block/docs/spec/cfg/S3f_watermarkFull_forged.cfg b/seaweed-block/docs/spec/cfg/S3f_watermarkFull_forged.cfg new file mode 100644 index 0000000000..6efa9850e8 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3f_watermarkFull_forged.cfg @@ -0,0 +1,15 @@ +\* S3f_watermarkFull_forged: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3f_watermarkFull_forged) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "watermarkFull" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = TRUE +INVARIANT NoForgedReplay diff --git a/seaweed-block/docs/spec/cfg/S3m_prefixFullSB_I1_cFALSE.cfg b/seaweed-block/docs/spec/cfg/S3m_prefixFullSB_I1_cFALSE.cfg new file mode 100644 index 0000000000..d848c2dfa2 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3m_prefixFullSB_I1_cFALSE.cfg @@ -0,0 +1,15 @@ +\* S3m_prefixFullSB_I1_cFALSE: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3m_prefixFullSB_I1_cFALSE) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "prefixFullSB" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = TRUE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S3m_prefixFullSB_I1_cTRUE.cfg b/seaweed-block/docs/spec/cfg/S3m_prefixFullSB_I1_cTRUE.cfg new file mode 100644 index 0000000000..6cda754737 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3m_prefixFullSB_I1_cTRUE.cfg @@ -0,0 +1,15 @@ +\* S3m_prefixFullSB_I1_cTRUE: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3m_prefixFullSB_I1_cTRUE) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "prefixFullSB" + CorruptOn = TRUE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = TRUE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S3m_prefixFullSB_I2_cFALSE.cfg b/seaweed-block/docs/spec/cfg/S3m_prefixFullSB_I2_cFALSE.cfg new file mode 100644 index 0000000000..3bc3957a03 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3m_prefixFullSB_I2_cFALSE.cfg @@ -0,0 +1,15 @@ +\* S3m_prefixFullSB_I2_cFALSE: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3m_prefixFullSB_I2_cFALSE) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "prefixFullSB" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = TRUE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I2 diff --git a/seaweed-block/docs/spec/cfg/S3m_prefixFullSB_ReplayLastWriter_cFALSE.cfg b/seaweed-block/docs/spec/cfg/S3m_prefixFullSB_ReplayLastWriter_cFALSE.cfg new file mode 100644 index 0000000000..fbbc3c7d1c --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3m_prefixFullSB_ReplayLastWriter_cFALSE.cfg @@ -0,0 +1,15 @@ +\* S3m_prefixFullSB_ReplayLastWriter_cFALSE: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3m_prefixFullSB_ReplayLastWriter_cFALSE) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "prefixFullSB" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = TRUE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT ReplayLastWriter diff --git a/seaweed-block/docs/spec/cfg/S3m_watermarkFull_I1_cFALSE.cfg b/seaweed-block/docs/spec/cfg/S3m_watermarkFull_I1_cFALSE.cfg new file mode 100644 index 0000000000..d78bfc7587 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3m_watermarkFull_I1_cFALSE.cfg @@ -0,0 +1,15 @@ +\* S3m_watermarkFull_I1_cFALSE: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3m_watermarkFull_I1_cFALSE) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "watermarkFull" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = TRUE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S3m_watermarkFull_I1_cTRUE.cfg b/seaweed-block/docs/spec/cfg/S3m_watermarkFull_I1_cTRUE.cfg new file mode 100644 index 0000000000..1c19f72835 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3m_watermarkFull_I1_cTRUE.cfg @@ -0,0 +1,15 @@ +\* S3m_watermarkFull_I1_cTRUE: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3m_watermarkFull_I1_cTRUE) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "watermarkFull" + CorruptOn = TRUE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = TRUE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S3m_watermarkFull_I2_cFALSE.cfg b/seaweed-block/docs/spec/cfg/S3m_watermarkFull_I2_cFALSE.cfg new file mode 100644 index 0000000000..bb6af097c8 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3m_watermarkFull_I2_cFALSE.cfg @@ -0,0 +1,15 @@ +\* S3m_watermarkFull_I2_cFALSE: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3m_watermarkFull_I2_cFALSE) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "watermarkFull" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = TRUE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I2 diff --git a/seaweed-block/docs/spec/cfg/S3m_watermarkFull_ReplayLastWriter_cFALSE.cfg b/seaweed-block/docs/spec/cfg/S3m_watermarkFull_ReplayLastWriter_cFALSE.cfg new file mode 100644 index 0000000000..620c89b0fe --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3m_watermarkFull_ReplayLastWriter_cFALSE.cfg @@ -0,0 +1,15 @@ +\* S3m_watermarkFull_ReplayLastWriter_cFALSE: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3m_watermarkFull_ReplayLastWriter_cFALSE) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "watermarkFull" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = TRUE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT ReplayLastWriter diff --git a/seaweed-block/docs/spec/cfg/S3r_rebuild_lwwFull_I1_crashonly.cfg b/seaweed-block/docs/spec/cfg/S3r_rebuild_lwwFull_I1_crashonly.cfg new file mode 100644 index 0000000000..0410f70076 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3r_rebuild_lwwFull_I1_crashonly.cfg @@ -0,0 +1,15 @@ +\* S3r_rebuild_lwwFull_I1_crashonly: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3r_rebuild_lwwFull_I1_crashonly) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "lwwFull" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = TRUE + JumpPersistedBySync = FALSE + Forge = FALSE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S3r_rebuild_prefixFull_I1_crashonly.cfg b/seaweed-block/docs/spec/cfg/S3r_rebuild_prefixFull_I1_crashonly.cfg new file mode 100644 index 0000000000..3379063bba --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3r_rebuild_prefixFull_I1_crashonly.cfg @@ -0,0 +1,15 @@ +\* S3r_rebuild_prefixFull_I1_crashonly: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3r_rebuild_prefixFull_I1_crashonly) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "prefixFull" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = TRUE + JumpPersistedBySync = FALSE + Forge = FALSE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S3r_rebuild_rootLww_I1_crashonly.cfg b/seaweed-block/docs/spec/cfg/S3r_rebuild_rootLww_I1_crashonly.cfg new file mode 100644 index 0000000000..ebda4bfadb --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3r_rebuild_rootLww_I1_crashonly.cfg @@ -0,0 +1,15 @@ +\* S3r_rebuild_rootLww_I1_crashonly: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3r_rebuild_rootLww_I1_crashonly) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "rootLww" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = TRUE + JumpPersistedBySync = FALSE + Forge = FALSE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S3r_rebuild_rootLww_I2.cfg b/seaweed-block/docs/spec/cfg/S3r_rebuild_rootLww_I2.cfg new file mode 100644 index 0000000000..0471e8f563 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3r_rebuild_rootLww_I2.cfg @@ -0,0 +1,15 @@ +\* S3r_rebuild_rootLww_I2: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3r_rebuild_rootLww_I2) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "rootLww" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = TRUE + JumpPersistedBySync = FALSE + Forge = FALSE +INVARIANT I2 diff --git a/seaweed-block/docs/spec/cfg/S3r_rootLww_I1_crashonly.cfg b/seaweed-block/docs/spec/cfg/S3r_rootLww_I1_crashonly.cfg new file mode 100644 index 0000000000..4b3a4be85d --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3r_rootLww_I1_crashonly.cfg @@ -0,0 +1,15 @@ +\* S3r_rootLww_I1_crashonly: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3r_rootLww_I1_crashonly) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "rootLww" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S3r_rootLww_I2.cfg b/seaweed-block/docs/spec/cfg/S3r_rootLww_I2.cfg new file mode 100644 index 0000000000..7e6e431881 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3r_rootLww_I2.cfg @@ -0,0 +1,15 @@ +\* S3r_rootLww_I2: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3r_rootLww_I2) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "rootLww" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I2 diff --git a/seaweed-block/docs/spec/cfg/S3r_rootLww_replay.cfg b/seaweed-block/docs/spec/cfg/S3r_rootLww_replay.cfg new file mode 100644 index 0000000000..018510953b --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3r_rootLww_replay.cfg @@ -0,0 +1,15 @@ +\* S3r_rootLww_replay: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3r_rootLww_replay) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "rootLww" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = FALSE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT ReplayLastWriter diff --git a/seaweed-block/docs/spec/cfg/S3v1_root_current_I1_crashonly.cfg b/seaweed-block/docs/spec/cfg/S3v1_root_current_I1_crashonly.cfg new file mode 100644 index 0000000000..2c0bb3d851 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3v1_root_current_I1_crashonly.cfg @@ -0,0 +1,15 @@ +\* S3v1_root_current_I1_crashonly: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3v1_root_current_I1_crashonly) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "current" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = TRUE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S3v1_root_lww_I1.cfg b/seaweed-block/docs/spec/cfg/S3v1_root_lww_I1.cfg new file mode 100644 index 0000000000..16fca64194 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3v1_root_lww_I1.cfg @@ -0,0 +1,15 @@ +\* S3v1_root_lww_I1: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3v1_root_lww_I1) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "lww" + CorruptOn = TRUE + MaxCkpt = 2 + CkptLag = TRUE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S3v1_root_lww_I1_crashonly.cfg b/seaweed-block/docs/spec/cfg/S3v1_root_lww_I1_crashonly.cfg new file mode 100644 index 0000000000..ce1ce6e6ec --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3v1_root_lww_I1_crashonly.cfg @@ -0,0 +1,15 @@ +\* S3v1_root_lww_I1_crashonly: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3v1_root_lww_I1_crashonly) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "lww" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = TRUE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S3v1_root_lww_replay.cfg b/seaweed-block/docs/spec/cfg/S3v1_root_lww_replay.cfg new file mode 100644 index 0000000000..4aef6f59b2 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3v1_root_lww_replay.cfg @@ -0,0 +1,15 @@ +\* S3v1_root_lww_replay: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3v1_root_lww_replay) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "lww" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = TRUE + ReuseBound = "persisted" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT ReplayLastWriter diff --git a/seaweed-block/docs/spec/cfg/S3v2_code_prefixFull_jump_I1_crashonly.cfg b/seaweed-block/docs/spec/cfg/S3v2_code_prefixFull_jump_I1_crashonly.cfg new file mode 100644 index 0000000000..8fa0180930 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3v2_code_prefixFull_jump_I1_crashonly.cfg @@ -0,0 +1,15 @@ +\* S3v2_code_prefixFull_jump_I1_crashonly: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3v2_code_prefixFull_jump_I1_crashonly) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "prefixFull" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = TRUE + ReuseBound = "mem" + JumpOn = TRUE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S3v2_lww_jump_I1_crashonly.cfg b/seaweed-block/docs/spec/cfg/S3v2_lww_jump_I1_crashonly.cfg new file mode 100644 index 0000000000..a82661d22b --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3v2_lww_jump_I1_crashonly.cfg @@ -0,0 +1,15 @@ +\* S3v2_lww_jump_I1_crashonly: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3v2_lww_jump_I1_crashonly) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "lww" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = TRUE + ReuseBound = "persisted" + JumpOn = TRUE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S3v2_prefixFull_jumpNoPersist_I1_crashonly.cfg b/seaweed-block/docs/spec/cfg/S3v2_prefixFull_jumpNoPersist_I1_crashonly.cfg new file mode 100644 index 0000000000..5f8ed0a54e --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3v2_prefixFull_jumpNoPersist_I1_crashonly.cfg @@ -0,0 +1,15 @@ +\* S3v2_prefixFull_jumpNoPersist_I1_crashonly: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3v2_prefixFull_jumpNoPersist_I1_crashonly) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "prefixFull" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = TRUE + ReuseBound = "persisted" + JumpOn = TRUE + JumpPersistedBySync = FALSE + Forge = FALSE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S3v2_prefixFull_jump_I1_crashonly.cfg b/seaweed-block/docs/spec/cfg/S3v2_prefixFull_jump_I1_crashonly.cfg new file mode 100644 index 0000000000..fb24f89339 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3v2_prefixFull_jump_I1_crashonly.cfg @@ -0,0 +1,15 @@ +\* S3v2_prefixFull_jump_I1_crashonly: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3v2_prefixFull_jump_I1_crashonly) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "prefixFull" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = TRUE + ReuseBound = "persisted" + JumpOn = TRUE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S3v2_reach_jump.cfg b/seaweed-block/docs/spec/cfg/S3v2_reach_jump.cfg new file mode 100644 index 0000000000..b4df37a78e --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3v2_reach_jump.cfg @@ -0,0 +1,15 @@ +\* S3v2_reach_jump: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3v2_reach_jump) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "prefixFull" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = TRUE + ReuseBound = "persisted" + JumpOn = TRUE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT W_NoJumpRecovery diff --git a/seaweed-block/docs/spec/cfg/S3v3_all_I0Prefix_corruptTRUE.cfg b/seaweed-block/docs/spec/cfg/S3v3_all_I0Prefix_corruptTRUE.cfg new file mode 100644 index 0000000000..52160098dc --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3v3_all_I0Prefix_corruptTRUE.cfg @@ -0,0 +1,15 @@ +\* S3v3_all_I0Prefix_corruptTRUE: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3v3_all_I0Prefix_corruptTRUE) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "prefixFullSB" + CorruptOn = TRUE + MaxCkpt = 2 + CkptLag = TRUE + ReuseBound = "persisted" + JumpOn = TRUE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I0Prefix diff --git a/seaweed-block/docs/spec/cfg/S3v3_all_I1_corruptFALSE.cfg b/seaweed-block/docs/spec/cfg/S3v3_all_I1_corruptFALSE.cfg new file mode 100644 index 0000000000..1cd5d2e226 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3v3_all_I1_corruptFALSE.cfg @@ -0,0 +1,15 @@ +\* S3v3_all_I1_corruptFALSE: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3v3_all_I1_corruptFALSE) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "prefixFullSB" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = TRUE + ReuseBound = "persisted" + JumpOn = TRUE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S3v3_all_I1_corruptTRUE.cfg b/seaweed-block/docs/spec/cfg/S3v3_all_I1_corruptTRUE.cfg new file mode 100644 index 0000000000..50ae97332c --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3v3_all_I1_corruptTRUE.cfg @@ -0,0 +1,15 @@ +\* S3v3_all_I1_corruptTRUE: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3v3_all_I1_corruptTRUE) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "prefixFullSB" + CorruptOn = TRUE + MaxCkpt = 2 + CkptLag = TRUE + ReuseBound = "persisted" + JumpOn = TRUE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S3v3_all_I2_corruptFALSE.cfg b/seaweed-block/docs/spec/cfg/S3v3_all_I2_corruptFALSE.cfg new file mode 100644 index 0000000000..ac7dabe80c --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3v3_all_I2_corruptFALSE.cfg @@ -0,0 +1,15 @@ +\* S3v3_all_I2_corruptFALSE: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3v3_all_I2_corruptFALSE) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "prefixFullSB" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = TRUE + ReuseBound = "persisted" + JumpOn = TRUE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I2 diff --git a/seaweed-block/docs/spec/cfg/S3v3_all_ReplayLastWriter_corruptFALSE.cfg b/seaweed-block/docs/spec/cfg/S3v3_all_ReplayLastWriter_corruptFALSE.cfg new file mode 100644 index 0000000000..4f643dda76 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3v3_all_ReplayLastWriter_corruptFALSE.cfg @@ -0,0 +1,15 @@ +\* S3v3_all_ReplayLastWriter_corruptFALSE: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3v3_all_ReplayLastWriter_corruptFALSE) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "prefixFullSB" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = TRUE + ReuseBound = "persisted" + JumpOn = TRUE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT ReplayLastWriter diff --git a/seaweed-block/docs/spec/cfg/S3v_code_current_I1_crashonly.cfg b/seaweed-block/docs/spec/cfg/S3v_code_current_I1_crashonly.cfg new file mode 100644 index 0000000000..7cedd61b1d --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3v_code_current_I1_crashonly.cfg @@ -0,0 +1,15 @@ +\* S3v_code_current_I1_crashonly: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3v_code_current_I1_crashonly) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "current" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = TRUE + ReuseBound = "mem" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S3v_code_lww_I1_crashonly.cfg b/seaweed-block/docs/spec/cfg/S3v_code_lww_I1_crashonly.cfg new file mode 100644 index 0000000000..37db9085ea --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3v_code_lww_I1_crashonly.cfg @@ -0,0 +1,15 @@ +\* S3v_code_lww_I1_crashonly: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3v_code_lww_I1_crashonly) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "lww" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = TRUE + ReuseBound = "mem" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S3v_code_prefixFull_I1_crashonly.cfg b/seaweed-block/docs/spec/cfg/S3v_code_prefixFull_I1_crashonly.cfg new file mode 100644 index 0000000000..1919254110 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S3v_code_prefixFull_I1_crashonly.cfg @@ -0,0 +1,15 @@ +\* S3v_code_prefixFull_I1_crashonly: model-checks WALRecovery.tla (run from docs/spec: ./run.sh S3v_code_prefixFull_I1_crashonly) +SPECIFICATION Spec +CONSTANTS + K = 4 + MaxLSN = 4 + LBAs = {"x", "y"} + Rule = "prefixFull" + CorruptOn = FALSE + MaxCkpt = 2 + CkptLag = TRUE + ReuseBound = "mem" + JumpOn = FALSE + JumpPersistedBySync = TRUE + Forge = FALSE +INVARIANT I1 diff --git a/seaweed-block/docs/spec/cfg/S4_reach_rf1_lsnmap.cfg b/seaweed-block/docs/spec/cfg/S4_reach_rf1_lsnmap.cfg new file mode 100644 index 0000000000..71a30b95df --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S4_reach_rf1_lsnmap.cfg @@ -0,0 +1,13 @@ +\* S4_reach_rf1_lsnmap: model-checks CutCapture.tla (run from docs/spec: ./run.sh S4_reach_rf1_lsnmap) +SPECIFICATION Spec +CONSTANTS + Chunks = {"a", "b"} + MaxLSN = 4 + MaxCuts = 2 + Track = "lsnmap" + Mode = "rf1" + PersistBeforeCkpt = TRUE + ClearAtCapture = FALSE + ReplDurableOnly = TRUE + BaseLSN = 0 +INVARIANT W_CutAfterEvent diff --git a/seaweed-block/docs/spec/cfg/S4_reach_rf2_lsnmap.cfg b/seaweed-block/docs/spec/cfg/S4_reach_rf2_lsnmap.cfg new file mode 100644 index 0000000000..2926efddc9 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S4_reach_rf2_lsnmap.cfg @@ -0,0 +1,13 @@ +\* S4_reach_rf2_lsnmap: model-checks CutCapture.tla (run from docs/spec: ./run.sh S4_reach_rf2_lsnmap) +SPECIFICATION Spec +CONSTANTS + Chunks = {"a", "b"} + MaxLSN = 4 + MaxCuts = 2 + Track = "lsnmap" + Mode = "rf2" + PersistBeforeCkpt = TRUE + ClearAtCapture = FALSE + ReplDurableOnly = TRUE + BaseLSN = 0 +INVARIANT W_CutAfterEvent diff --git a/seaweed-block/docs/spec/cfg/S4_rf1_bitmap.cfg b/seaweed-block/docs/spec/cfg/S4_rf1_bitmap.cfg new file mode 100644 index 0000000000..ad0dbc4fbd --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S4_rf1_bitmap.cfg @@ -0,0 +1,13 @@ +\* S4_rf1_bitmap: model-checks CutCapture.tla (run from docs/spec: ./run.sh S4_rf1_bitmap) +SPECIFICATION Spec +CONSTANTS + Chunks = {"a", "b"} + MaxLSN = 4 + MaxCuts = 2 + Track = "bitmap" + Mode = "rf1" + PersistBeforeCkpt = TRUE + ClearAtCapture = FALSE + ReplDurableOnly = TRUE + BaseLSN = 0 +INVARIANT HeadImage HeadLeDurable diff --git a/seaweed-block/docs/spec/cfg/S4_rf1_bitmapHash.cfg b/seaweed-block/docs/spec/cfg/S4_rf1_bitmapHash.cfg new file mode 100644 index 0000000000..770a3a2b2a --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S4_rf1_bitmapHash.cfg @@ -0,0 +1,13 @@ +\* S4_rf1_bitmapHash: model-checks CutCapture.tla (run from docs/spec: ./run.sh S4_rf1_bitmapHash) +SPECIFICATION Spec +CONSTANTS + Chunks = {"a", "b"} + MaxLSN = 4 + MaxCuts = 2 + Track = "bitmapHash" + Mode = "rf1" + PersistBeforeCkpt = TRUE + ClearAtCapture = FALSE + ReplDurableOnly = TRUE + BaseLSN = 0 +INVARIANT HeadImage HeadLeDurable diff --git a/seaweed-block/docs/spec/cfg/S4_rf1_bitmap_clearEarly.cfg b/seaweed-block/docs/spec/cfg/S4_rf1_bitmap_clearEarly.cfg new file mode 100644 index 0000000000..cacf6f205e --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S4_rf1_bitmap_clearEarly.cfg @@ -0,0 +1,13 @@ +\* S4_rf1_bitmap_clearEarly: model-checks CutCapture.tla (run from docs/spec: ./run.sh S4_rf1_bitmap_clearEarly) +SPECIFICATION Spec +CONSTANTS + Chunks = {"a", "b"} + MaxLSN = 4 + MaxCuts = 2 + Track = "bitmap" + Mode = "rf1" + PersistBeforeCkpt = TRUE + ClearAtCapture = TRUE + ReplDurableOnly = TRUE + BaseLSN = 0 +INVARIANT HeadImage diff --git a/seaweed-block/docs/spec/cfg/S4_rf1_bitmap_noPersist.cfg b/seaweed-block/docs/spec/cfg/S4_rf1_bitmap_noPersist.cfg new file mode 100644 index 0000000000..4e7353f16b --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S4_rf1_bitmap_noPersist.cfg @@ -0,0 +1,13 @@ +\* S4_rf1_bitmap_noPersist: model-checks CutCapture.tla (run from docs/spec: ./run.sh S4_rf1_bitmap_noPersist) +SPECIFICATION Spec +CONSTANTS + Chunks = {"a", "b"} + MaxLSN = 4 + MaxCuts = 2 + Track = "bitmap" + Mode = "rf1" + PersistBeforeCkpt = FALSE + ClearAtCapture = FALSE + ReplDurableOnly = TRUE + BaseLSN = 0 +INVARIANT HeadImage diff --git a/seaweed-block/docs/spec/cfg/S4_rf1_lsnmap.cfg b/seaweed-block/docs/spec/cfg/S4_rf1_lsnmap.cfg new file mode 100644 index 0000000000..42f71e1bcf --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S4_rf1_lsnmap.cfg @@ -0,0 +1,13 @@ +\* S4_rf1_lsnmap: model-checks CutCapture.tla (run from docs/spec: ./run.sh S4_rf1_lsnmap) +SPECIFICATION Spec +CONSTANTS + Chunks = {"a", "b"} + MaxLSN = 4 + MaxCuts = 2 + Track = "lsnmap" + Mode = "rf1" + PersistBeforeCkpt = TRUE + ClearAtCapture = FALSE + ReplDurableOnly = TRUE + BaseLSN = 0 +INVARIANT HeadImage HeadLeDurable diff --git a/seaweed-block/docs/spec/cfg/S4_rf1_lsnmap_noPersist.cfg b/seaweed-block/docs/spec/cfg/S4_rf1_lsnmap_noPersist.cfg new file mode 100644 index 0000000000..705323529b --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S4_rf1_lsnmap_noPersist.cfg @@ -0,0 +1,13 @@ +\* S4_rf1_lsnmap_noPersist: model-checks CutCapture.tla (run from docs/spec: ./run.sh S4_rf1_lsnmap_noPersist) +SPECIFICATION Spec +CONSTANTS + Chunks = {"a", "b"} + MaxLSN = 4 + MaxCuts = 2 + Track = "lsnmap" + Mode = "rf1" + PersistBeforeCkpt = FALSE + ClearAtCapture = FALSE + ReplDurableOnly = TRUE + BaseLSN = 0 +INVARIANT HeadImage diff --git a/seaweed-block/docs/spec/cfg/S4_rf2_bitmap.cfg b/seaweed-block/docs/spec/cfg/S4_rf2_bitmap.cfg new file mode 100644 index 0000000000..41e79c4b46 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S4_rf2_bitmap.cfg @@ -0,0 +1,13 @@ +\* S4_rf2_bitmap: model-checks CutCapture.tla (run from docs/spec: ./run.sh S4_rf2_bitmap) +SPECIFICATION Spec +CONSTANTS + Chunks = {"a", "b"} + MaxLSN = 4 + MaxCuts = 2 + Track = "bitmap" + Mode = "rf2" + PersistBeforeCkpt = TRUE + ClearAtCapture = FALSE + ReplDurableOnly = TRUE + BaseLSN = 0 +INVARIANT HeadImage HeadLeDurable diff --git a/seaweed-block/docs/spec/cfg/S4_rf2_bitmapHash.cfg b/seaweed-block/docs/spec/cfg/S4_rf2_bitmapHash.cfg new file mode 100644 index 0000000000..2932d53f00 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S4_rf2_bitmapHash.cfg @@ -0,0 +1,13 @@ +\* S4_rf2_bitmapHash: model-checks CutCapture.tla (run from docs/spec: ./run.sh S4_rf2_bitmapHash) +SPECIFICATION Spec +CONSTANTS + Chunks = {"a", "b"} + MaxLSN = 4 + MaxCuts = 2 + Track = "bitmapHash" + Mode = "rf2" + PersistBeforeCkpt = TRUE + ClearAtCapture = FALSE + ReplDurableOnly = TRUE + BaseLSN = 0 +INVARIANT HeadImage HeadLeDurable diff --git a/seaweed-block/docs/spec/cfg/S4_rf2_lsnmap.cfg b/seaweed-block/docs/spec/cfg/S4_rf2_lsnmap.cfg new file mode 100644 index 0000000000..f1164d1815 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S4_rf2_lsnmap.cfg @@ -0,0 +1,13 @@ +\* S4_rf2_lsnmap: model-checks CutCapture.tla (run from docs/spec: ./run.sh S4_rf2_lsnmap) +SPECIFICATION Spec +CONSTANTS + Chunks = {"a", "b"} + MaxLSN = 4 + MaxCuts = 2 + Track = "lsnmap" + Mode = "rf2" + PersistBeforeCkpt = TRUE + ClearAtCapture = FALSE + ReplDurableOnly = TRUE + BaseLSN = 0 +INVARIANT HeadImage HeadLeDurable diff --git a/seaweed-block/docs/spec/cfg/S4_rf2_lsnmap_base.cfg b/seaweed-block/docs/spec/cfg/S4_rf2_lsnmap_base.cfg new file mode 100644 index 0000000000..601dd439a4 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S4_rf2_lsnmap_base.cfg @@ -0,0 +1,13 @@ +\* S4_rf2_lsnmap_base: model-checks CutCapture.tla (run from docs/spec: ./run.sh S4_rf2_lsnmap_base) +SPECIFICATION Spec +CONSTANTS + Chunks = {"a", "b"} + MaxLSN = 4 + MaxCuts = 2 + Track = "lsnmap" + Mode = "rf2" + PersistBeforeCkpt = TRUE + ClearAtCapture = FALSE + ReplDurableOnly = TRUE + BaseLSN = 1 +INVARIANT HeadImage HeadLeDurable diff --git a/seaweed-block/docs/spec/cfg/S4_rf2_lsnmap_localCut.cfg b/seaweed-block/docs/spec/cfg/S4_rf2_lsnmap_localCut.cfg new file mode 100644 index 0000000000..00f60524c6 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S4_rf2_lsnmap_localCut.cfg @@ -0,0 +1,13 @@ +\* S4_rf2_lsnmap_localCut: model-checks CutCapture.tla (run from docs/spec: ./run.sh S4_rf2_lsnmap_localCut) +SPECIFICATION Spec +CONSTANTS + Chunks = {"a", "b"} + MaxLSN = 4 + MaxCuts = 2 + Track = "lsnmap" + Mode = "rf2" + PersistBeforeCkpt = TRUE + ClearAtCapture = FALSE + ReplDurableOnly = FALSE + BaseLSN = 0 +INVARIANT HeadImage HeadLeDurable diff --git a/seaweed-block/docs/spec/cfg/S4b_design.cfg b/seaweed-block/docs/spec/cfg/S4b_design.cfg new file mode 100644 index 0000000000..9bf3049ea7 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S4b_design.cfg @@ -0,0 +1,10 @@ +\* S4b_design: model-checks CutPipeline.tla (run from docs/spec: ./run.sh S4b_design) +SPECIFICATION Spec +CONSTANTS + MaxLSN = 4 + MaxCuts = 2 + MaxPre = 2 + GenCheck = TRUE + SegRewrite = TRUE + RefuseReconcile = TRUE +INVARIANT HeadImage SegConsistent diff --git a/seaweed-block/docs/spec/cfg/S4b_design_big.cfg b/seaweed-block/docs/spec/cfg/S4b_design_big.cfg new file mode 100644 index 0000000000..66f74c1ada --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S4b_design_big.cfg @@ -0,0 +1,10 @@ +\* S4b_design_big: model-checks CutPipeline.tla (run from docs/spec: ./run.sh S4b_design_big) +SPECIFICATION Spec +CONSTANTS + MaxLSN = 6 + MaxCuts = 2 + MaxPre = 2 + GenCheck = TRUE + SegRewrite = TRUE + RefuseReconcile = TRUE +INVARIANT HeadImage SegConsistent diff --git a/seaweed-block/docs/spec/cfg/S4b_reach.cfg b/seaweed-block/docs/spec/cfg/S4b_reach.cfg new file mode 100644 index 0000000000..478ad6239c --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S4b_reach.cfg @@ -0,0 +1,10 @@ +\* S4b_reach: model-checks CutPipeline.tla (run from docs/spec: ./run.sh S4b_reach) +SPECIFICATION Spec +CONSTANTS + MaxLSN = 4 + MaxCuts = 2 + MaxPre = 2 + GenCheck = TRUE + SegRewrite = TRUE + RefuseReconcile = TRUE +INVARIANT W_TwoCuts diff --git a/seaweed-block/docs/spec/cfg/S4b_red_cutWhileRec.cfg b/seaweed-block/docs/spec/cfg/S4b_red_cutWhileRec.cfg new file mode 100644 index 0000000000..8f2d06d848 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S4b_red_cutWhileRec.cfg @@ -0,0 +1,10 @@ +\* S4b_red_cutWhileRec: model-checks CutPipeline.tla (run from docs/spec: ./run.sh S4b_red_cutWhileRec) +SPECIFICATION Spec +CONSTANTS + MaxLSN = 4 + MaxCuts = 2 + MaxPre = 2 + GenCheck = TRUE + SegRewrite = TRUE + RefuseReconcile = FALSE +INVARIANT HeadImage diff --git a/seaweed-block/docs/spec/cfg/S4b_red_noGen.cfg b/seaweed-block/docs/spec/cfg/S4b_red_noGen.cfg new file mode 100644 index 0000000000..6cc4eae519 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S4b_red_noGen.cfg @@ -0,0 +1,10 @@ +\* S4b_red_noGen: model-checks CutPipeline.tla (run from docs/spec: ./run.sh S4b_red_noGen) +SPECIFICATION Spec +CONSTANTS + MaxLSN = 4 + MaxCuts = 2 + MaxPre = 2 + GenCheck = FALSE + SegRewrite = TRUE + RefuseReconcile = TRUE +INVARIANT HeadImage diff --git a/seaweed-block/docs/spec/cfg/S4b_red_segReuse.cfg b/seaweed-block/docs/spec/cfg/S4b_red_segReuse.cfg new file mode 100644 index 0000000000..804844640a --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S4b_red_segReuse.cfg @@ -0,0 +1,10 @@ +\* S4b_red_segReuse: model-checks CutPipeline.tla (run from docs/spec: ./run.sh S4b_red_segReuse) +SPECIFICATION Spec +CONSTANTS + MaxLSN = 4 + MaxCuts = 2 + MaxPre = 2 + GenCheck = TRUE + SegRewrite = FALSE + RefuseReconcile = TRUE +INVARIANT SegConsistent diff --git a/seaweed-block/docs/spec/cfg/S5_code.cfg b/seaweed-block/docs/spec/cfg/S5_code.cfg new file mode 100644 index 0000000000..0afa329c09 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S5_code.cfg @@ -0,0 +1,9 @@ +\* S5_code: model-checks ControlPlane.tla (run from docs/spec: ./run.sh S5_code) +SPECIFICATION Spec +CONSTANTS + Rids = {r1, r2} + MaxRestarts = 2 + MaxTries = 3 + UncertainGuard = TRUE + ReserveFirst = TRUE +INVARIANT UniqueEpoch Idempotent JournalComplete diff --git a/seaweed-block/docs/spec/cfg/S5_reach.cfg b/seaweed-block/docs/spec/cfg/S5_reach.cfg new file mode 100644 index 0000000000..3417c82bc3 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S5_reach.cfg @@ -0,0 +1,9 @@ +\* S5_reach: model-checks ControlPlane.tla (run from docs/spec: ./run.sh S5_reach) +SPECIFICATION Spec +CONSTANTS + Rids = {r1, r2} + MaxRestarts = 2 + MaxTries = 3 + UncertainGuard = TRUE + ReserveFirst = TRUE +INVARIANT W_Moved diff --git a/seaweed-block/docs/spec/cfg/S5_red_noReserve.cfg b/seaweed-block/docs/spec/cfg/S5_red_noReserve.cfg new file mode 100644 index 0000000000..72e31c78fe --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S5_red_noReserve.cfg @@ -0,0 +1,9 @@ +\* S5_red_noReserve: model-checks ControlPlane.tla (run from docs/spec: ./run.sh S5_red_noReserve) +SPECIFICATION Spec +CONSTANTS + Rids = {r1, r2} + MaxRestarts = 2 + MaxTries = 3 + UncertainGuard = TRUE + ReserveFirst = FALSE +INVARIANT UniqueEpoch Idempotent JournalComplete diff --git a/seaweed-block/docs/spec/cfg/S5_red_noUncertain.cfg b/seaweed-block/docs/spec/cfg/S5_red_noUncertain.cfg new file mode 100644 index 0000000000..0c11088914 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S5_red_noUncertain.cfg @@ -0,0 +1,9 @@ +\* S5_red_noUncertain: model-checks ControlPlane.tla (run from docs/spec: ./run.sh S5_red_noUncertain) +SPECIFICATION Spec +CONSTANTS + Rids = {r1, r2} + MaxRestarts = 2 + MaxTries = 3 + UncertainGuard = FALSE + ReserveFirst = TRUE +INVARIANT UniqueEpoch Idempotent JournalComplete diff --git a/seaweed-block/docs/spec/cfg/S6_design.cfg b/seaweed-block/docs/spec/cfg/S6_design.cfg new file mode 100644 index 0000000000..27bad29753 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S6_design.cfg @@ -0,0 +1,8 @@ +\* S6_design: model-checks ReplicationFailover.tla (run from docs/spec: ./run.sh S6_design) +SPECIFICATION Spec +CONSTANTS + MaxLSN = 3 + ReplFrontier = TRUE + EvidenceGate = TRUE + EpochFenceShip = TRUE +INVARIANT AckedSurvive HeadOnLineage SnapOnLineage NoStaleAck diff --git a/seaweed-block/docs/spec/cfg/S6_design_big.cfg b/seaweed-block/docs/spec/cfg/S6_design_big.cfg new file mode 100644 index 0000000000..235fa48253 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S6_design_big.cfg @@ -0,0 +1,8 @@ +\* S6_design_big: model-checks ReplicationFailover.tla (run from docs/spec: ./run.sh S6_design_big) +SPECIFICATION Spec +CONSTANTS + MaxLSN = 4 + ReplFrontier = TRUE + EvidenceGate = TRUE + EpochFenceShip = TRUE +INVARIANT AckedSurvive HeadOnLineage SnapOnLineage NoStaleAck diff --git a/seaweed-block/docs/spec/cfg/S6_reach_handoff.cfg b/seaweed-block/docs/spec/cfg/S6_reach_handoff.cfg new file mode 100644 index 0000000000..c6589a876a --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S6_reach_handoff.cfg @@ -0,0 +1,8 @@ +\* S6_reach_handoff: model-checks ReplicationFailover.tla (run from docs/spec: ./run.sh S6_reach_handoff) +SPECIFICATION Spec +CONSTANTS + MaxLSN = 3 + ReplFrontier = TRUE + EvidenceGate = TRUE + EpochFenceShip = TRUE +INVARIANT W_Handoff diff --git a/seaweed-block/docs/spec/cfg/S6_red_localCut.cfg b/seaweed-block/docs/spec/cfg/S6_red_localCut.cfg new file mode 100644 index 0000000000..ff9f5e0ff6 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S6_red_localCut.cfg @@ -0,0 +1,8 @@ +\* S6_red_localCut: model-checks ReplicationFailover.tla (run from docs/spec: ./run.sh S6_red_localCut) +SPECIFICATION Spec +CONSTANTS + MaxLSN = 3 + ReplFrontier = FALSE + EvidenceGate = TRUE + EpochFenceShip = TRUE +INVARIANT HeadOnLineage SnapOnLineage diff --git a/seaweed-block/docs/spec/cfg/S6_red_noEvidence.cfg b/seaweed-block/docs/spec/cfg/S6_red_noEvidence.cfg new file mode 100644 index 0000000000..ede3b31a4b --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S6_red_noEvidence.cfg @@ -0,0 +1,8 @@ +\* S6_red_noEvidence: model-checks ReplicationFailover.tla (run from docs/spec: ./run.sh S6_red_noEvidence) +SPECIFICATION Spec +CONSTANTS + MaxLSN = 3 + ReplFrontier = TRUE + EvidenceGate = FALSE + EpochFenceShip = TRUE +INVARIANT AckedSurvive diff --git a/seaweed-block/docs/spec/cfg/S6_red_noFence.cfg b/seaweed-block/docs/spec/cfg/S6_red_noFence.cfg new file mode 100644 index 0000000000..e569deaed3 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S6_red_noFence.cfg @@ -0,0 +1,8 @@ +\* S6_red_noFence: model-checks ReplicationFailover.tla (run from docs/spec: ./run.sh S6_red_noFence) +SPECIFICATION Spec +CONSTANTS + MaxLSN = 3 + ReplFrontier = TRUE + EvidenceGate = TRUE + EpochFenceShip = FALSE +INVARIANT AckedSurvive NoStaleAck diff --git a/seaweed-block/docs/spec/cfg/S9_guard_G3.cfg b/seaweed-block/docs/spec/cfg/S9_guard_G3.cfg new file mode 100644 index 0000000000..969a4292b0 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S9_guard_G3.cfg @@ -0,0 +1,9 @@ +\* S9_guard_G3: model-checks RetentionGCTiming.tla (run from docs/spec: ./run.sh S9_guard_G3) +SPECIFICATION Spec +CONSTANTS + D = 2 + G = 3 + MD = 1 + MaxT = 10 + MarkGuard = TRUE +INVARIANT NoLiveDelete diff --git a/seaweed-block/docs/spec/cfg/S9_reach_delete.cfg b/seaweed-block/docs/spec/cfg/S9_reach_delete.cfg new file mode 100644 index 0000000000..ace76d0d50 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S9_reach_delete.cfg @@ -0,0 +1,9 @@ +\* S9_reach_delete: model-checks RetentionGCTiming.tla (run from docs/spec: ./run.sh S9_reach_delete) +SPECIFICATION Spec +CONSTANTS + D = 2 + G = 4 + MD = 1 + MaxT = 10 + MarkGuard = TRUE +INVARIANT W_Delete diff --git a/seaweed-block/docs/spec/cfg/S9_reach_publish.cfg b/seaweed-block/docs/spec/cfg/S9_reach_publish.cfg new file mode 100644 index 0000000000..bd43193439 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S9_reach_publish.cfg @@ -0,0 +1,9 @@ +\* S9_reach_publish: model-checks RetentionGCTiming.tla (run from docs/spec: ./run.sh S9_reach_publish) +SPECIFICATION Spec +CONSTANTS + D = 2 + G = 4 + MD = 1 + MaxT = 10 + MarkGuard = TRUE +INVARIANT W_Publish diff --git a/seaweed-block/docs/spec/cfg/S9_red_G1_D3.cfg b/seaweed-block/docs/spec/cfg/S9_red_G1_D3.cfg new file mode 100644 index 0000000000..d524a6f16b --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S9_red_G1_D3.cfg @@ -0,0 +1,9 @@ +\* S9_red_G1_D3: model-checks RetentionGCTiming.tla (run from docs/spec: ./run.sh S9_red_G1_D3) +SPECIFICATION Spec +CONSTANTS + D = 3 + G = 2 + MD = 1 + MaxT = 10 + MarkGuard = FALSE +INVARIANT NoLiveDelete diff --git a/seaweed-block/docs/spec/cfg/S9_red_G1_noguard.cfg b/seaweed-block/docs/spec/cfg/S9_red_G1_noguard.cfg new file mode 100644 index 0000000000..81b9730e2d --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S9_red_G1_noguard.cfg @@ -0,0 +1,9 @@ +\* S9_red_G1_noguard: model-checks RetentionGCTiming.tla (run from docs/spec: ./run.sh S9_red_G1_noguard) +SPECIFICATION Spec +CONSTANTS + D = 2 + G = 1 + MD = 1 + MaxT = 10 + MarkGuard = FALSE +INVARIANT NoLiveDelete diff --git a/seaweed-block/docs/spec/cfg/S9_red_G2_noguard.cfg b/seaweed-block/docs/spec/cfg/S9_red_G2_noguard.cfg new file mode 100644 index 0000000000..75d35f3622 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S9_red_G2_noguard.cfg @@ -0,0 +1,9 @@ +\* S9_red_G2_noguard: model-checks RetentionGCTiming.tla (run from docs/spec: ./run.sh S9_red_G2_noguard) +SPECIFICATION Spec +CONSTANTS + D = 2 + G = 2 + MD = 1 + MaxT = 10 + MarkGuard = FALSE +INVARIANT NoLiveDelete diff --git a/seaweed-block/docs/spec/cfg/S9_red_G3_noguard.cfg b/seaweed-block/docs/spec/cfg/S9_red_G3_noguard.cfg new file mode 100644 index 0000000000..e6a74b3695 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S9_red_G3_noguard.cfg @@ -0,0 +1,9 @@ +\* S9_red_G3_noguard: model-checks RetentionGCTiming.tla (run from docs/spec: ./run.sh S9_red_G3_noguard) +SPECIFICATION Spec +CONSTANTS + D = 2 + G = 3 + MD = 1 + MaxT = 10 + MarkGuard = FALSE +INVARIANT NoLiveDelete diff --git a/seaweed-block/docs/spec/cfg/S9_red_G3_noguard_big.cfg b/seaweed-block/docs/spec/cfg/S9_red_G3_noguard_big.cfg new file mode 100644 index 0000000000..ad4d760bda --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S9_red_G3_noguard_big.cfg @@ -0,0 +1,9 @@ +\* S9_red_G3_noguard_big: model-checks RetentionGCTiming.tla (run from docs/spec: ./run.sh S9_red_G3_noguard_big) +SPECIFICATION Spec +CONSTANTS + D = 2 + G = 3 + MD = 1 + MaxT = 16 + MarkGuard = FALSE +INVARIANT NoLiveDelete diff --git a/seaweed-block/docs/spec/cfg/S9_rule_G4.cfg b/seaweed-block/docs/spec/cfg/S9_rule_G4.cfg new file mode 100644 index 0000000000..a5070d6eb8 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S9_rule_G4.cfg @@ -0,0 +1,9 @@ +\* S9_rule_G4: model-checks RetentionGCTiming.tla (run from docs/spec: ./run.sh S9_rule_G4) +SPECIFICATION Spec +CONSTANTS + D = 2 + G = 4 + MD = 1 + MaxT = 10 + MarkGuard = TRUE +INVARIANT NoLiveDelete diff --git a/seaweed-block/docs/spec/cfg/S9_rule_G4_big.cfg b/seaweed-block/docs/spec/cfg/S9_rule_G4_big.cfg new file mode 100644 index 0000000000..26f83120ad --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S9_rule_G4_big.cfg @@ -0,0 +1,9 @@ +\* S9_rule_G4_big: model-checks RetentionGCTiming.tla (run from docs/spec: ./run.sh S9_rule_G4_big) +SPECIFICATION Spec +CONSTANTS + D = 2 + G = 4 + MD = 1 + MaxT = 16 + MarkGuard = TRUE +INVARIANT NoLiveDelete diff --git a/seaweed-block/docs/spec/cfg/S9_rule_G4_noguard.cfg b/seaweed-block/docs/spec/cfg/S9_rule_G4_noguard.cfg new file mode 100644 index 0000000000..c6a3f78192 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S9_rule_G4_noguard.cfg @@ -0,0 +1,9 @@ +\* S9_rule_G4_noguard: model-checks RetentionGCTiming.tla (run from docs/spec: ./run.sh S9_rule_G4_noguard) +SPECIFICATION Spec +CONSTANTS + D = 2 + G = 4 + MD = 1 + MaxT = 10 + MarkGuard = FALSE +INVARIANT NoLiveDelete diff --git a/seaweed-block/docs/spec/cfg/S9b_G1_MD2.cfg b/seaweed-block/docs/spec/cfg/S9b_G1_MD2.cfg new file mode 100644 index 0000000000..aa3d92a4ae --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S9b_G1_MD2.cfg @@ -0,0 +1,7 @@ +\* S9b_G1_MD2: model-checks RetentionGCMulti.tla (run from docs/spec: ./run.sh S9b_G1_MD2) +SPECIFICATION Spec +CONSTANTS + G = 1 + MD = 2 + MaxT = 12 +INVARIANT NoLiveDelete diff --git a/seaweed-block/docs/spec/cfg/S9b_G2_MD2.cfg b/seaweed-block/docs/spec/cfg/S9b_G2_MD2.cfg new file mode 100644 index 0000000000..0632186d74 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S9b_G2_MD2.cfg @@ -0,0 +1,7 @@ +\* S9b_G2_MD2: model-checks RetentionGCMulti.tla (run from docs/spec: ./run.sh S9b_G2_MD2) +SPECIFICATION Spec +CONSTANTS + G = 2 + MD = 2 + MaxT = 12 +INVARIANT NoLiveDelete diff --git a/seaweed-block/docs/spec/cfg/S9b_G2_MD3.cfg b/seaweed-block/docs/spec/cfg/S9b_G2_MD3.cfg new file mode 100644 index 0000000000..69cd17e5da --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S9b_G2_MD3.cfg @@ -0,0 +1,7 @@ +\* S9b_G2_MD3: model-checks RetentionGCMulti.tla (run from docs/spec: ./run.sh S9b_G2_MD3) +SPECIFICATION Spec +CONSTANTS + G = 2 + MD = 3 + MaxT = 12 +INVARIANT NoLiveDelete diff --git a/seaweed-block/docs/spec/cfg/S9b_G3_MD1.cfg b/seaweed-block/docs/spec/cfg/S9b_G3_MD1.cfg new file mode 100644 index 0000000000..b58179c8a4 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S9b_G3_MD1.cfg @@ -0,0 +1,7 @@ +\* S9b_G3_MD1: model-checks RetentionGCMulti.tla (run from docs/spec: ./run.sh S9b_G3_MD1) +SPECIFICATION Spec +CONSTANTS + G = 3 + MD = 1 + MaxT = 12 +INVARIANT NoLiveDelete diff --git a/seaweed-block/docs/spec/cfg/S9b_reach.cfg b/seaweed-block/docs/spec/cfg/S9b_reach.cfg new file mode 100644 index 0000000000..30665f59b7 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/S9b_reach.cfg @@ -0,0 +1,7 @@ +\* S9b_reach: model-checks RetentionGCMulti.tla (run from docs/spec: ./run.sh S9b_reach) +SPECIFICATION Spec +CONSTANTS + G = 3 + MD = 1 + MaxT = 12 +INVARIANT W_Delete diff --git a/seaweed-block/docs/spec/cfg/W4_both.cfg b/seaweed-block/docs/spec/cfg/W4_both.cfg new file mode 100644 index 0000000000..defb4bbe28 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/W4_both.cfg @@ -0,0 +1,21 @@ +\* W4_both: model-checks WorkspaceTakeover.tla (run from docs/spec: ./run.sh W4_both) +SPECIFICATION Spec +CONSTANTS + Kinds = {"clean", "forced"} + MaxT = 4 + TTL = 2 + ITTL = 1 + MaxLSN = 2 + MaxCuts = 2 + Drift = 0 + MaxRestarts = 0 + LeaseOn = TRUE + LsnGuard = TRUE + StoreEpochGuard = TRUE + HostFence = TRUE + LayerLsnCheck = TRUE + SeedFromObserved = TRUE + GCEpochRule = TRUE + WaitLeaseExpiry = TRUE +INVARIANT TypeOK NoDualServing NoOldCasAfterTakeover NoLateChunkReachable CleanNoLoss ForcedLossBounded GCSafe NoLiveIntentExpired AttachOrder SeedMatchesTakeover +PROPERTY HeadMonotone diff --git a/seaweed-block/docs/spec/cfg/W4_clean.cfg b/seaweed-block/docs/spec/cfg/W4_clean.cfg new file mode 100644 index 0000000000..a96f132365 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/W4_clean.cfg @@ -0,0 +1,21 @@ +\* W4_clean: model-checks WorkspaceTakeover.tla (run from docs/spec: ./run.sh W4_clean) +SPECIFICATION Spec +CONSTANTS + Kinds = {"clean"} + MaxT = 4 + TTL = 2 + ITTL = 1 + MaxLSN = 2 + MaxCuts = 2 + Drift = 0 + MaxRestarts = 1 + LeaseOn = TRUE + LsnGuard = TRUE + StoreEpochGuard = TRUE + HostFence = TRUE + LayerLsnCheck = TRUE + SeedFromObserved = TRUE + GCEpochRule = TRUE + WaitLeaseExpiry = TRUE +INVARIANT TypeOK NoDualServing NoOldCasAfterTakeover NoLateChunkReachable CleanNoLoss ForcedLossBounded GCSafe NoLiveIntentExpired AttachOrder SeedMatchesTakeover +PROPERTY HeadMonotone diff --git a/seaweed-block/docs/spec/cfg/W4_clean_large.cfg b/seaweed-block/docs/spec/cfg/W4_clean_large.cfg new file mode 100644 index 0000000000..ed97a39b60 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/W4_clean_large.cfg @@ -0,0 +1,21 @@ +\* W4_clean_large: model-checks WorkspaceTakeover.tla (run from docs/spec: ./run.sh W4_clean_large) +SPECIFICATION Spec +CONSTANTS + Kinds = {"clean"} + MaxT = 7 + TTL = 3 + ITTL = 2 + MaxLSN = 3 + MaxCuts = 3 + Drift = 0 + MaxRestarts = 2 + LeaseOn = TRUE + LsnGuard = TRUE + StoreEpochGuard = TRUE + HostFence = TRUE + LayerLsnCheck = TRUE + SeedFromObserved = TRUE + GCEpochRule = TRUE + WaitLeaseExpiry = TRUE +INVARIANT TypeOK NoDualServing NoOldCasAfterTakeover NoLateChunkReachable CleanNoLoss ForcedLossBounded GCSafe NoLiveIntentExpired AttachOrder SeedMatchesTakeover +PROPERTY HeadMonotone diff --git a/seaweed-block/docs/spec/cfg/W4_drift.cfg b/seaweed-block/docs/spec/cfg/W4_drift.cfg new file mode 100644 index 0000000000..5a3f44b966 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/W4_drift.cfg @@ -0,0 +1,20 @@ +\* W4_drift: model-checks WorkspaceTakeover.tla (run from docs/spec: ./run.sh W4_drift) +SPECIFICATION Spec +CONSTANTS + Kinds = {"forced"} + MaxT = 4 + TTL = 2 + ITTL = 1 + MaxLSN = 2 + MaxCuts = 2 + Drift = 1 + MaxRestarts = 1 + LeaseOn = TRUE + LsnGuard = TRUE + StoreEpochGuard = TRUE + HostFence = TRUE + LayerLsnCheck = TRUE + SeedFromObserved = TRUE + GCEpochRule = TRUE + WaitLeaseExpiry = TRUE +INVARIANT TypeOK NoDualServing diff --git a/seaweed-block/docs/spec/cfg/W4_drift_heads.cfg b/seaweed-block/docs/spec/cfg/W4_drift_heads.cfg new file mode 100644 index 0000000000..78d42cea93 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/W4_drift_heads.cfg @@ -0,0 +1,21 @@ +\* W4_drift_heads: model-checks WorkspaceTakeover.tla (run from docs/spec: ./run.sh W4_drift_heads) +SPECIFICATION Spec +CONSTANTS + Kinds = {"forced"} + MaxT = 4 + TTL = 2 + ITTL = 1 + MaxLSN = 2 + MaxCuts = 2 + Drift = 1 + MaxRestarts = 1 + LeaseOn = TRUE + LsnGuard = TRUE + StoreEpochGuard = TRUE + HostFence = TRUE + LayerLsnCheck = TRUE + SeedFromObserved = TRUE + GCEpochRule = TRUE + WaitLeaseExpiry = TRUE +INVARIANT TypeOK NoOldCasAfterTakeover NoLateChunkReachable ForcedLossBounded GCSafe NoLiveIntentExpired AttachOrder SeedMatchesTakeover +PROPERTY HeadMonotone diff --git a/seaweed-block/docs/spec/cfg/W4_forced.cfg b/seaweed-block/docs/spec/cfg/W4_forced.cfg new file mode 100644 index 0000000000..d29d30835b --- /dev/null +++ b/seaweed-block/docs/spec/cfg/W4_forced.cfg @@ -0,0 +1,21 @@ +\* W4_forced: model-checks WorkspaceTakeover.tla (run from docs/spec: ./run.sh W4_forced) +SPECIFICATION Spec +CONSTANTS + Kinds = {"forced"} + MaxT = 4 + TTL = 2 + ITTL = 1 + MaxLSN = 2 + MaxCuts = 2 + Drift = 0 + MaxRestarts = 1 + LeaseOn = TRUE + LsnGuard = TRUE + StoreEpochGuard = TRUE + HostFence = TRUE + LayerLsnCheck = TRUE + SeedFromObserved = TRUE + GCEpochRule = TRUE + WaitLeaseExpiry = TRUE +INVARIANT TypeOK NoDualServing NoOldCasAfterTakeover NoLateChunkReachable CleanNoLoss ForcedLossBounded GCSafe NoLiveIntentExpired AttachOrder SeedMatchesTakeover +PROPERTY HeadMonotone diff --git a/seaweed-block/docs/spec/cfg/W4_forced_exact.cfg b/seaweed-block/docs/spec/cfg/W4_forced_exact.cfg new file mode 100644 index 0000000000..24ff032104 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/W4_forced_exact.cfg @@ -0,0 +1,20 @@ +\* W4_forced_exact: model-checks WorkspaceTakeover.tla (run from docs/spec: ./run.sh W4_forced_exact) +SPECIFICATION Spec +CONSTANTS + Kinds = {"forced"} + MaxT = 4 + TTL = 2 + ITTL = 1 + MaxLSN = 2 + MaxCuts = 2 + Drift = 0 + MaxRestarts = 1 + LeaseOn = TRUE + LsnGuard = TRUE + StoreEpochGuard = TRUE + HostFence = TRUE + LayerLsnCheck = TRUE + SeedFromObserved = TRUE + GCEpochRule = TRUE + WaitLeaseExpiry = TRUE +INVARIANT TypeOK ForcedLossExact diff --git a/seaweed-block/docs/spec/cfg/W4_forced_large.cfg b/seaweed-block/docs/spec/cfg/W4_forced_large.cfg new file mode 100644 index 0000000000..7888ba01b0 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/W4_forced_large.cfg @@ -0,0 +1,21 @@ +\* W4_forced_large: model-checks WorkspaceTakeover.tla (run from docs/spec: ./run.sh W4_forced_large) +SPECIFICATION Spec +CONSTANTS + Kinds = {"forced"} + MaxT = 7 + TTL = 3 + ITTL = 2 + MaxLSN = 3 + MaxCuts = 3 + Drift = 0 + MaxRestarts = 2 + LeaseOn = TRUE + LsnGuard = TRUE + StoreEpochGuard = TRUE + HostFence = TRUE + LayerLsnCheck = TRUE + SeedFromObserved = TRUE + GCEpochRule = TRUE + WaitLeaseExpiry = TRUE +INVARIANT TypeOK NoDualServing NoOldCasAfterTakeover NoLateChunkReachable CleanNoLoss ForcedLossBounded GCSafe NoLiveIntentExpired AttachOrder SeedMatchesTakeover +PROPERTY HeadMonotone diff --git a/seaweed-block/docs/spec/cfg/W4_reach_bcut.cfg b/seaweed-block/docs/spec/cfg/W4_reach_bcut.cfg new file mode 100644 index 0000000000..3201dfe6cf --- /dev/null +++ b/seaweed-block/docs/spec/cfg/W4_reach_bcut.cfg @@ -0,0 +1,20 @@ +\* W4_reach_bcut: model-checks WorkspaceTakeover.tla (run from docs/spec: ./run.sh W4_reach_bcut) +SPECIFICATION Spec +CONSTANTS + Kinds = {"forced"} + MaxT = 4 + TTL = 2 + ITTL = 1 + MaxLSN = 2 + MaxCuts = 2 + Drift = 0 + MaxRestarts = 1 + LeaseOn = TRUE + LsnGuard = TRUE + StoreEpochGuard = TRUE + HostFence = TRUE + LayerLsnCheck = TRUE + SeedFromObserved = TRUE + GCEpochRule = TRUE + WaitLeaseExpiry = TRUE +INVARIANT TypeOK W_NoBCut diff --git a/seaweed-block/docs/spec/cfg/W4_reach_clean.cfg b/seaweed-block/docs/spec/cfg/W4_reach_clean.cfg new file mode 100644 index 0000000000..dcc1ec1e69 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/W4_reach_clean.cfg @@ -0,0 +1,20 @@ +\* W4_reach_clean: model-checks WorkspaceTakeover.tla (run from docs/spec: ./run.sh W4_reach_clean) +SPECIFICATION Spec +CONSTANTS + Kinds = {"clean"} + MaxT = 4 + TTL = 2 + ITTL = 1 + MaxLSN = 2 + MaxCuts = 2 + Drift = 0 + MaxRestarts = 1 + LeaseOn = TRUE + LsnGuard = TRUE + StoreEpochGuard = TRUE + HostFence = TRUE + LayerLsnCheck = TRUE + SeedFromObserved = TRUE + GCEpochRule = TRUE + WaitLeaseExpiry = TRUE +INVARIANT TypeOK W_NoCleanServe diff --git a/seaweed-block/docs/spec/cfg/W4_reach_forced.cfg b/seaweed-block/docs/spec/cfg/W4_reach_forced.cfg new file mode 100644 index 0000000000..58436d68e6 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/W4_reach_forced.cfg @@ -0,0 +1,20 @@ +\* W4_reach_forced: model-checks WorkspaceTakeover.tla (run from docs/spec: ./run.sh W4_reach_forced) +SPECIFICATION Spec +CONSTANTS + Kinds = {"forced"} + MaxT = 4 + TTL = 2 + ITTL = 1 + MaxLSN = 2 + MaxCuts = 2 + Drift = 0 + MaxRestarts = 1 + LeaseOn = TRUE + LsnGuard = TRUE + StoreEpochGuard = TRUE + HostFence = TRUE + LayerLsnCheck = TRUE + SeedFromObserved = TRUE + GCEpochRule = TRUE + WaitLeaseExpiry = TRUE +INVARIANT TypeOK W_NoForcedServe diff --git a/seaweed-block/docs/spec/cfg/W4_reach_restart.cfg b/seaweed-block/docs/spec/cfg/W4_reach_restart.cfg new file mode 100644 index 0000000000..991eb9dca9 --- /dev/null +++ b/seaweed-block/docs/spec/cfg/W4_reach_restart.cfg @@ -0,0 +1,20 @@ +\* W4_reach_restart: model-checks WorkspaceTakeover.tla (run from docs/spec: ./run.sh W4_reach_restart) +SPECIFICATION Spec +CONSTANTS + Kinds = {"clean", "forced"} + MaxT = 4 + TTL = 2 + ITTL = 1 + MaxLSN = 2 + MaxCuts = 2 + Drift = 0 + MaxRestarts = 1 + LeaseOn = TRUE + LsnGuard = TRUE + StoreEpochGuard = TRUE + HostFence = TRUE + LayerLsnCheck = TRUE + SeedFromObserved = TRUE + GCEpochRule = TRUE + WaitLeaseExpiry = TRUE +INVARIANT TypeOK W_NoRestartMove diff --git a/seaweed-block/docs/spec/run.sh b/seaweed-block/docs/spec/run.sh new file mode 100755 index 0000000000..c0c685c1ca --- /dev/null +++ b/seaweed-block/docs/spec/run.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +# Model-check one configuration with TLC. +# +# usage: ./run.sh [extra TLC args] +# e.g. ./run.sh Fix_token +# TLA2TOOLS=/opt/tla/tla2tools.jar WORKERS=8 HEAP=8g ./run.sh S6_design +# +# The spec is chosen from the cfg name prefix (see README.md). Output goes to +# stdout. TLC writes its state files under ./states/ (safe to delete). +set -euo pipefail +cd "$(dirname "$0")" + +cfg=${1:?usage: ./run.sh [extra TLC args]} +shift + +case $cfg in + Bug_*) spec=ChunkLifecycle ;; + Fix_*) spec=ChunkLifecycleFixed ;; + W4_*|RED_*) spec=WorkspaceTakeover ;; + S3_wal_*|S3v*|S3r_*|S3m_*|S3f_*) spec=WALRecovery ;; + S3_sw*) spec=SmartWALRecovery ;; + S3_rep_*) spec=WALReplica ;; + S4b_*) spec=CutPipeline ;; + S4_*) spec=CutCapture ;; + S5_*) spec=ControlPlane ;; + S6_*) spec=ReplicationFailover ;; + S9b_*) spec=RetentionGCMulti ;; + S9_*) spec=RetentionGCTiming ;; + *) echo "run.sh: no spec for config '$cfg'" >&2; exit 2 ;; +esac + +jar=${TLA2TOOLS:-tla2tools.jar} +[ -f "$jar" ] || { echo "run.sh: $jar not found; set TLA2TOOLS (see README.md)" >&2; exit 2; } + +# -deadlock: deadlock checking off. Several specs have a process that loops +# forever (the GC), and bounded models legitimately stop at their bounds. +exec java -XX:+UseParallelGC "-Xmx${HEAP:-4g}" -cp "$jar" tlc2.TLC \ + -config "cfg/$cfg.cfg" -deadlock -workers "${WORKERS:-auto}" \ + -metadir "states/$cfg" "$@" "$spec.tla"