phase152: gate multiblock wal recovery

This commit is contained in:
pingqiu committed 2026-07-06 22:13:36 -07:00
1 parent e36bdeb973
commit 20e5dda45c
21 files changed
+1069 -121

No files matched your search

@@ -69,6 +69,9 @@ spec:
{{- if .Values.blockmaster.durableWALMultiBlockRecords }}
- "--launcher-durable-wal-multiblock-records"
{{- end }}
{{- if .Values.blockmaster.durableWALRecoveryTestDisableFlusher }}
- "--launcher-durable-wal-recovery-test-disable-flusher"
{{- end }}
{{- if .Values.blockmaster.launcherStatus }}
- "--launcher-status"
{{- end }}
@@ -36,6 +36,7 @@
},
"failbackRuntimeRPC": { "type": "boolean" },
"durableImpl": { "type": "string", "enum": ["walstore", "smartwal"] },
"durableWALRecoveryTestDisableFlusher": { "type": "boolean" },
"stateHostPath": { "type": "string" },
"stateHostPathType": { "type": "string" },
"statePermissionsImage": {
@@ -45,6 +45,7 @@ blockmaster:
launcherPVCOwnerRef: true
durableImpl: walstore
durableWALMultiBlockRecords: false
durableWALRecoveryTestDisableFlusher: false
stateHostPath: ""
stateHostPathType: DirectoryOrCreate
statePermissionsImage:
+53 -50
View File
@@ -21,42 +21,43 @@ import (
)
type flags struct {
authorityStore string
lifecycleStore string
lifecyclePlacementSeed string
clusterSpec string
listen string
topology string
expectedSlotsPerVol int
freshnessWindow time.Duration
pendingGrace time.Duration
lifecycleLoop time.Duration
launcherLoop time.Duration
launcherManifestDir string
launcherNamespace string
launcherImage string
launcherMasterAddr string
launcherDurableRoot string
launcherDurableImpl string
launcherWALMultiBlockRecords bool
launcherStateHostPath string
launcherReplicationAck string
launcherISCSIPortBase int
launcherNVMePortBase int
launcherNVMeMaxH2CDataLength uint
launcherPVCOwnerRef bool
launcherStatus bool
launcherKubernetesApply bool
launcherExternalISCSI bool
launcherExternalNVMe bool
launcherExternalStatus bool
launcherCHAPSecretName string
launcherCHAPUserKey string
launcherCHAPSecretKey string
failbackRuntimeRPC bool
frontendPublicationRuntimeHTTP bool
frontendPublicationRuntimeListen string
version bool
authorityStore string
lifecycleStore string
lifecyclePlacementSeed string
clusterSpec string
listen string
topology string
expectedSlotsPerVol int
freshnessWindow time.Duration
pendingGrace time.Duration
lifecycleLoop time.Duration
launcherLoop time.Duration
launcherManifestDir string
launcherNamespace string
launcherImage string
launcherMasterAddr string
launcherDurableRoot string
launcherDurableImpl string
launcherWALMultiBlockRecords bool
launcherWALRecoveryTestDisableFlusher bool
launcherStateHostPath string
launcherReplicationAck string
launcherISCSIPortBase int
launcherNVMePortBase int
launcherNVMeMaxH2CDataLength uint
launcherPVCOwnerRef bool
launcherStatus bool
launcherKubernetesApply bool
launcherExternalISCSI bool
launcherExternalNVMe bool
launcherExternalStatus bool
launcherCHAPSecretName string
launcherCHAPUserKey string
launcherCHAPSecretKey string
failbackRuntimeRPC bool
frontendPublicationRuntimeHTTP bool
frontendPublicationRuntimeListen string
version bool
// printReadyLine: test-only flag that emits a single
// structured JSON line to stdout after the gRPC listener is
// bound, so L2 subprocess tests can parse the ready event.
@@ -85,6 +86,7 @@ func parseFlags(args []string) (flags, error) {
fs.StringVar(&f.launcherDurableRoot, "launcher-durable-root", "/var/lib/sw-block", "G15d rendered blockvolume durable root base")
fs.StringVar(&f.launcherDurableImpl, "launcher-durable-impl", "walstore", "G15d rendered blockvolume durable implementation: walstore (default) or smartwal")
fs.BoolVar(&f.launcherWALMultiBlockRecords, "launcher-durable-wal-multiblock-records", false, "G15d render opt-in for experimental walstore multi-block WAL records; default false")
fs.BoolVar(&f.launcherWALRecoveryTestDisableFlusher, "launcher-durable-wal-recovery-test-disable-flusher", false, "test-only G15d render opt-in for blockvolume --durable-wal-recovery-test-disable-flusher; default false")
fs.StringVar(&f.launcherStateHostPath, "launcher-state-hostpath", "", "optional hostPath base mounted at the blockvolume durable root; empty keeps generated blockvolume state on throwaway emptyDir")
fs.StringVar(&f.launcherReplicationAck, "launcher-replication-ack", "best-effort", "G15d rendered blockvolume replication ACK profile: best-effort, sync-quorum, or sync-all")
fs.IntVar(&f.launcherISCSIPortBase, "launcher-iscsi-port-base", 3260, "G15d iSCSI port base for generated blockvolume workloads")
@@ -348,20 +350,21 @@ func runLifecycleLauncherTick(h *master.Host, f flags) error {
var rendered []launcher.RenderedManifest
for _, plan := range result.Plans {
manifests, err := launcher.RenderBlockVolumeDeployments(plan, launcher.K8sRenderConfig{
Namespace: f.launcherNamespace,
Image: f.launcherImage,
MasterAddr: masterAddr,
DurableRootBase: f.launcherDurableRoot,
DurableImpl: f.launcherDurableImpl,
WALMultiBlockRecords: f.launcherWALMultiBlockRecords,
StateHostPathBase: f.launcherStateHostPath,
ReplicationAck: f.launcherReplicationAck,
OwnerReferenceToPVC: f.launcherPVCOwnerRef,
EnableStatus: f.launcherStatus,
ExternalISCSI: f.launcherExternalISCSI,
ExternalNVMe: f.launcherExternalNVMe,
ExternalStatus: f.launcherExternalStatus,
NVMeMaxH2CDataLength: uint32(f.launcherNVMeMaxH2CDataLength),
Namespace: f.launcherNamespace,
Image: f.launcherImage,
MasterAddr: masterAddr,
DurableRootBase: f.launcherDurableRoot,
DurableImpl: f.launcherDurableImpl,
WALMultiBlockRecords: f.launcherWALMultiBlockRecords,
WALRecoveryTestDisableFlusher: f.launcherWALRecoveryTestDisableFlusher,
StateHostPathBase: f.launcherStateHostPath,
ReplicationAck: f.launcherReplicationAck,
OwnerReferenceToPVC: f.launcherPVCOwnerRef,
EnableStatus: f.launcherStatus,
ExternalISCSI: f.launcherExternalISCSI,
ExternalNVMe: f.launcherExternalNVMe,
ExternalStatus: f.launcherExternalStatus,
NVMeMaxH2CDataLength: uint32(f.launcherNVMeMaxH2CDataLength),
ISCSICHAP: launcher.CHAPSecretRef{
Name: f.launcherCHAPSecretName,
UsernameKey: f.launcherCHAPUserKey,
@@ -196,6 +196,20 @@ func TestPhase150_ParseFlagsLauncherWALMultiBlockRecords(t *testing.T) {
}
}
func TestPhase152_ParseFlagsLauncherWALRecoveryTestDisableFlusher(t *testing.T) {
f, err := parseFlags([]string{
"--authority-store", "/tmp/a",
"--topology", "topology.yaml",
"--launcher-durable-wal-recovery-test-disable-flusher",
})
if err != nil {
t.Fatalf("parseFlags: %v", err)
}
if !f.launcherWALRecoveryTestDisableFlusher {
t.Fatal("launcherWALRecoveryTestDisableFlusher=false, want true")
}
}
func TestBlockmasterBareTopologyRegistersVolumeControlServices(t *testing.T) {
h, err := master.New(master.Config{
AuthorityStoreDir: t.TempDir(),
@@ -48,3 +48,29 @@ func TestPhase150_BlockvolumeDurableWALMultiBlockFlagParsesOptIn(t *testing.T) {
t.Fatal("durableWALMultiBlockRecords=false, want true")
}
}
func TestPhase152_BlockvolumeDurableWALRecoveryTestDisableFlusherFlag(t *testing.T) {
args := append(phase150RequiredBlockvolumeArgs(),
"--durable-root=/tmp/sw-block",
"--durable-impl=walstore",
"--durable-wal-recovery-test-disable-flusher",
)
f, err := parseFlags(args)
if err != nil {
t.Fatalf("parseFlags: %v", err)
}
if !f.durableWALRecoveryTestDisableFlusher {
t.Fatal("durableWALRecoveryTestDisableFlusher=false, want true")
}
}
func TestPhase152_BlockvolumeDurableWALRecoveryTestDisableFlusherRequiresWalstore(t *testing.T) {
args := append(phase150RequiredBlockvolumeArgs(),
"--durable-root=/tmp/sw-block",
"--durable-impl=smartwal",
"--durable-wal-recovery-test-disable-flusher",
)
if _, err := parseFlags(args); err == nil {
t.Fatal("parseFlags succeeded; want walstore requirement error")
}
}
+22 -11
View File
@@ -92,11 +92,12 @@ type flags struct {
// --durable-impl selects walstore or smartwal (default smartwal).
// --durable-blocks + --durable-blocksize are used on first-time
// storage create.
durableRoot string
durableImpl string // "smartwal" | "walstore"
durableBlocks uint
durableBlockSize uint
durableWALMultiBlockRecords bool
durableRoot string
durableImpl string // "smartwal" | "walstore"
durableBlocks uint
durableBlockSize uint
durableWALMultiBlockRecords bool
durableWALRecoveryTestDisableFlusher bool
// WAL retention window past checkpoint LSN. Zero = strict
// checkpoint-driven recycle. Non-zero = walstore relaxes the
@@ -166,6 +167,7 @@ func parseFlags(args []string) (flags, error) {
fs.UintVar(&f.durableBlocks, "durable-blocks", 2048, "number of blocks per volume on first create (ignored when opening existing)")
fs.UintVar(&f.durableBlockSize, "durable-blocksize", 4096, "block size in bytes on first create")
fs.BoolVar(&f.durableWALMultiBlockRecords, "durable-wal-multiblock-records", false, "enable experimental walstore multi-block WAL records; default false; requires --durable-impl=walstore")
fs.BoolVar(&f.durableWALRecoveryTestDisableFlusher, "durable-wal-recovery-test-disable-flusher", false, "test-only: stop walstore's automatic WAL checkpoint flusher so recovery gates can prove WAL replay; default false; requires --durable-root and --durable-impl=walstore")
fs.Uint64Var(&f.walRetentionLSNs, "wal-retention-lsns", 0,
"WAL retention window past checkpoint LSN (walstore only). "+
"Zero (default) preserves strict checkpoint-driven recycle. "+
@@ -218,6 +220,14 @@ func parseFlags(args []string) (flags, error) {
return flags{}, fmt.Errorf("--durable-wal-multiblock-records requires --durable-impl=walstore")
}
}
if f.durableWALRecoveryTestDisableFlusher {
if f.durableRoot == "" {
return flags{}, fmt.Errorf("--durable-wal-recovery-test-disable-flusher requires --durable-root")
}
if f.durableImpl != "walstore" {
return flags{}, fmt.Errorf("--durable-wal-recovery-test-disable-flusher requires --durable-impl=walstore")
}
}
if f.iscsiCHAPUser == "" {
f.iscsiCHAPUser = os.Getenv("SW_BLOCK_ISCSI_CHAP_USERNAME")
}
@@ -502,12 +512,13 @@ func run(f flags) int {
var durableProv *durable.DurableProvider
if f.durableRoot != "" {
cfg := durable.ProviderConfig{
Impl: durable.ImplName(f.durableImpl),
StorageRoot: f.durableRoot,
BlockSize: int(f.durableBlockSize),
NumBlocks: uint32(f.durableBlocks),
WALRetentionLSNs: f.walRetentionLSNs,
WALMultiBlockRecords: f.durableWALMultiBlockRecords,
Impl: durable.ImplName(f.durableImpl),
StorageRoot: f.durableRoot,
BlockSize: int(f.durableBlockSize),
NumBlocks: uint32(f.durableBlocks),
WALRetentionLSNs: f.walRetentionLSNs,
WALMultiBlockRecords: f.durableWALMultiBlockRecords,
WALRecoveryTestDisableFlusher: f.durableWALRecoveryTestDisableFlusher,
}
dp, err := durable.NewDurableProvider(cfg, h.ProjectionView())
if err != nil {
@@ -102,6 +102,12 @@ type ProviderConfig struct {
// single-block WAL record format. Do not enable for release claims until a
// mounted NVMe/TCP profile gate passes.
WALMultiBlockRecords bool
// WALRecoveryTestDisableFlusher stops walstore's background checkpoint
// flusher before test writes are issued. It exists only for recovery gates
// that need synced-but-uncheckpointed WAL records to survive a process
// restart and prove real replay. Default false.
WALRecoveryTestDisableFlusher bool
}
// DurableProvider is the production frontend.Provider implementation.
@@ -482,6 +488,9 @@ func (p *DurableProvider) openExisting(volumeID, path string) (*volHandle, error
if p.cfg.WALMultiBlockRecords {
ws.SetMultiBlockRecords(true)
}
if p.cfg.WALRecoveryTestDisableFlusher {
ws.DisableAutoFlushForRecoveryTest()
}
s = ws
case ImplSmartWAL:
sw, err := smartwal.OpenStore(path)
@@ -517,6 +526,9 @@ func (p *DurableProvider) createFresh(volumeID, path string) (*volHandle, error)
if p.cfg.WALMultiBlockRecords {
ws.SetMultiBlockRecords(true)
}
if p.cfg.WALRecoveryTestDisableFlusher {
ws.DisableAutoFlushForRecoveryTest()
}
s = ws
case ImplSmartWAL:
sw, err := smartwal.CreateStore(path, p.cfg.NumBlocks, p.cfg.BlockSize)
@@ -74,6 +74,41 @@ func TestPhase150_DurableProviderWALMultiBlockOptIn(t *testing.T) {
}
}
func TestPhase152_DurableProviderCanDisableWALStoreAutoFlushForRecoveryTest(t *testing.T) {
root := t.TempDir()
id := frontend.Identity{VolumeID: "v1", ReplicaID: "r1", Epoch: 1, EndpointVersion: 1}
view := newStubView(healthyProj(id))
p, err := durable.NewDurableProvider(durable.ProviderConfig{
Impl: durable.ImplWALStore,
StorageRoot: root,
BlockSize: 4096,
NumBlocks: 128,
WALRecoveryTestDisableFlusher: true,
}, view)
if err != nil {
t.Fatalf("NewDurableProvider: %v", err)
}
defer p.Close()
raw, err := p.EnsureStorage("v1")
if err != nil {
t.Fatalf("EnsureStorage: %v", err)
}
if _, err := raw.Write(1, bytes.Repeat([]byte{0x52}, 4096)); err != nil {
t.Fatalf("Write: %v", err)
}
if stable, err := raw.Sync(); err != nil || stable != 1 {
t.Fatalf("Sync stable=%d err=%v, want stable=1", stable, err)
}
time.Sleep(200 * time.Millisecond)
checkpointed, ok := raw.(interface{ CheckpointLSN() uint64 })
if !ok {
t.Fatalf("storage %T does not expose CheckpointLSN", raw)
}
if got := checkpointed.CheckpointLSN(); got != 0 {
t.Fatalf("checkpoint=%d want 0 with recovery-test flusher disabled", got)
}
}
func newProvider(t *testing.T, impl durable.ImplName) (*durable.DurableProvider, *stubView, string) {
t.Helper()
root := t.TempDir()
+20 -16
View File
@@ -14,22 +14,23 @@ import (
const stateMountPath = "/var/lib/sw-block"
type K8sRenderConfig struct {
Namespace string
Image string
MasterAddr string
DurableRootBase string
DurableImpl string
WALMultiBlockRecords bool
StateHostPathBase string
RecoveryMode string
ReplicationAck string
OwnerReferenceToPVC bool
EnableStatus bool
ExternalISCSI bool
ExternalNVMe bool
ExternalStatus bool
NVMeMaxH2CDataLength uint32
ISCSICHAP CHAPSecretRef
Namespace string
Image string
MasterAddr string
DurableRootBase string
DurableImpl string
WALMultiBlockRecords bool
WALRecoveryTestDisableFlusher bool
StateHostPathBase string
RecoveryMode string
ReplicationAck string
OwnerReferenceToPVC bool
EnableStatus bool
ExternalISCSI bool
ExternalNVMe bool
ExternalStatus bool
NVMeMaxH2CDataLength uint32
ISCSICHAP CHAPSecretRef
}
type CHAPSecretRef struct {
@@ -194,6 +195,9 @@ func blockVolumeArgs(plan lifecycle.BlockVolumeWorkloadPlan, replica lifecycle.B
if cfg.WALMultiBlockRecords {
args = append(args, "--durable-wal-multiblock-records")
}
if cfg.WALRecoveryTestDisableFlusher {
args = append(args, "--durable-wal-recovery-test-disable-flusher")
}
if cfg.EnableStatus {
port, err := blockVolumeStatusPort(plan, replica)
if err != nil {
@@ -52,6 +52,7 @@ func TestG15d_K8sRenderer_RendersBlockVolumeDeploymentArgs(t *testing.T) {
"--nvme-subsysnqn=",
"--nvme-ns=",
"--durable-wal-multiblock-records",
"--durable-wal-recovery-test-disable-flusher",
} {
if strings.Contains(raw, forbidden) {
t.Fatalf("iscsi manifest must not contain %q:\n%s", forbidden, raw)
@@ -76,6 +77,20 @@ func TestPhase150_K8sRenderer_RendersWALMultiBlockOptIn(t *testing.T) {
}
}
func TestPhase152_K8sRenderer_RendersWALRecoveryTestDisableFlusherOptIn(t *testing.T) {
manifests, err := RenderBlockVolumeDeployments(sampleWorkloadPlan(), K8sRenderConfig{
MasterAddr: "m:9333",
WALRecoveryTestDisableFlusher: true,
})
if err != nil {
t.Fatalf("RenderBlockVolumeDeployments: %v", err)
}
raw := string(manifests[0].YAML)
if !strings.Contains(raw, "--durable-wal-recovery-test-disable-flusher") {
t.Fatalf("manifest missing recovery-test disable-flusher opt-in:\n%s", raw)
}
}
func TestPhase34_K8sRendererCanRenderSmartWALDurableImpl(t *testing.T) {
manifests, err := RenderBlockVolumeDeployments(sampleWorkloadPlan(), K8sRenderConfig{
MasterAddr: "m:9333",
+20 -4
View File
@@ -612,6 +612,20 @@ func (s *WALStore) enableMultiBlockRecordsForTest(enabled bool) {
s.SetMultiBlockRecords(enabled)
}
// DisableAutoFlushForRecoveryTest stops the background WAL->extent flusher
// before test writes are issued. This preserves synced WAL records past a
// process restart so mounted recovery gates can prove actual WAL replay instead
// of reading data that was already checkpointed into the extent.
//
// This is intentionally not part of LogicalStorage and must stay behind an
// explicit test/diagnostic flag. Calling it after writes may flush the current
// dirty set because flusher.Stop performs one final best-effort flush.
func (s *WALStore) DisableAutoFlushForRecoveryTest() {
if s.flusher != nil {
s.flusher.Stop()
}
}
func (s *WALStore) readFromExtent(lba uint32) ([]byte, error) {
data := make([]byte, s.sb.BlockSize)
off := int64(s.extentBase + uint64(lba)*uint64(s.sb.BlockSize))
@@ -919,10 +933,12 @@ func (s *WALStore) Close() error {
s.closed = true
s.mu.Unlock()
// Stop the flusher first so it can't race the file close.
// flusher.Stop performs one final best-effort flush so any
// pending dirty entries get into the extent + checkpoint
// before we release the file.
// Stop the flusher first so it can't race the file close. In the normal
// path, flusher.Stop performs one final best-effort flush so any pending
// dirty entries get into the extent + checkpoint before we release the
// file. Test gates may have already stopped it via
// DisableAutoFlushForRecoveryTest; in that case Stop is idempotent and does
// not checkpoint later writes.
if s.flusher != nil {
s.flusher.Stop()
}
@@ -166,6 +166,59 @@ func TestWALStore_MultiBlockRecoverSplitsPerBlock(t *testing.T) {
}
}
func TestWALStore_DisableAutoFlushForRecoveryTestPreservesReplayAfterCrash(t *testing.T) {
path := filepath.Join(t.TempDir(), "store.bin")
blocks := [][]byte{
makeBlock(4096, 0xD1),
makeBlock(4096, 0xD2),
makeBlock(4096, 0xD3),
makeBlock(4096, 0xD4),
}
func() {
s, err := CreateWALStore(path, 16, 4096)
if err != nil {
t.Fatal(err)
}
s.DisableAutoFlushForRecoveryTest()
s.enableMultiBlockRecordsForTest(true)
if _, err := s.WriteBatch(2, blocks); err != nil {
t.Fatalf("WriteBatch: %v", err)
}
if stable, err := s.Sync(); err != nil || stable != 4 {
t.Fatalf("Sync stable=%d err=%v, want stable=4", stable, err)
}
if got := s.CheckpointLSN(); got != 0 {
t.Fatalf("checkpoint=%d want 0 before crash", got)
}
s.committer.Stop()
if err := s.fd.Close(); err != nil {
t.Fatalf("close fd: %v", err)
}
}()
s, err := OpenWALStore(path)
if err != nil {
t.Fatal(err)
}
defer s.Close()
if recovered, err := s.Recover(); err != nil || recovered != 4 {
t.Fatalf("Recover=%d err=%v, want 4", recovered, err)
}
if got := s.CheckpointLSN(); got != 0 {
t.Fatalf("checkpoint after recovery=%d want 0", got)
}
for i, want := range blocks {
got, err := s.Read(uint32(2 + i))
if err != nil {
t.Fatalf("Read %d: %v", i, err)
}
if !bytes.Equal(got, want) {
t.Fatalf("Read %d returned wrong block", i)
}
}
}
func TestWALStore_MultiBlockFlusherSplitsPerBlock(t *testing.T) {
path := filepath.Join(t.TempDir(), "store.bin")
s, err := CreateWALStore(path, 16, 4096)
+6 -3
View File
@@ -121,9 +121,12 @@ Seaweed Block can already demonstrate a narrow Kubernetes block-storage loop:
proves that reduction locally (`2048` encode ops to `128`) and keeps the next
step bounded to a disabled-by-default runtime opt-in. Phase 150 wires that
opt-in without changing defaults. Phase 151 proves the opt-in runs through the
mounted NVMe/TCP path and observes the multi-block record shape, but it
remains default-off and is not a performance/SLO claim. The next safety gate
is mounted restart/recovery compatibility for the new WAL entry type.
mounted NVMe/TCP path and observes the multi-block record shape. Phase 152
proves mounted restart/recovery compatibility with hostPath persistence,
force-delete restart, and `recovered_lsn_after_restart=14545`. The opt-in
remains default-off and is not a performance/SLO, RoCE, or NVMe/RDMA claim.
The next step is a release-boundary review that documents the opt-in and
remaining diagnostic follow-ups without changing the default WAL format.
- Kubernetes NVMe/TCP mounted reconnect is source-gated through changed
desired path-set evidence: CSI-node can connect a newly published desired
NVMe path, prune the stale old host path for the same NQN, preserve pod
+42 -37
View File
@@ -1,37 +1,46 @@
# Current Plan: Phase 152 WAL Multi-Block Recovery Compatibility Gate
# Current Plan: Phase 153 WAL Multi-Block Release Boundary
Status: planning.
Phase 151 closed the mounted NVMe/TCP opt-in profile:
Phase 152 closed the mounted restart/recovery compatibility gate:
```text
phase151_wal_multiblock_mounted_nvme_profile_status=ok
phase152_wal_multiblock_recovery_compatibility_status=ok
runtime_opt_in_name=durable-wal-multiblock-records
runtime_opt_in_enabled=true
recovery_test_disable_flusher_enabled=true
restart_persistence_mode=hostpath
candidate_max_h2c_bytes=65536
target_write_request_max_bytes=65536
backend_write_request_max_bytes=65536
wal_encode_ops=9002
backend_storage_write_calls=9002
backend_storage_write_blocks=143570
wal_encode_ops=873
backend_storage_write_calls=873
backend_storage_write_blocks=13512
multiblock_record_shape_observed=true
writer_verified=true
reader_verified=true
writer_verified_before_restart=true
blockvolume_restart_mode=force_delete_pod
blockvolume_restarted=true
recovery_completed=true
recovered_lsn_after_restart=14545
wal_integrity_fault_observed=false
reader_verified_after_restart=true
ready_after_restart=true
cleanup_status=ok
phase151_decision=keep_opt_in
next_recommendation=phase152_wal_multiblock_recovery_compatibility_gate
phase152_decision=keep_opt_in
next_recommendation=phase153_wal_multiblock_release_boundary
```
## Goal
Prove that actual multi-block WAL records can be recovered after a mounted
NVMe/TCP write path restart. This is the safety gate that should come before
any release claim or default change for the new WAL entry type.
Turn the Phase 150-152 evidence into an explicit release boundary for the
multi-block WAL record opt-in. The release boundary must keep the current WAL
format default unchanged, document the opt-in accurately, and name any remaining
diagnostic or compatibility follow-ups before a user-facing release note.
## Required Evidence
```text
phase152_wal_multiblock_recovery_compatibility_status=ok
phase153_wal_multiblock_release_boundary_status=ok
frontend_transport=tcp
roce_claim_allowed=false
nvme_rdma_claim_allowed=false
@@ -39,39 +48,35 @@ performance_slo_claim_allowed=false
default_wal_format_unchanged=true
feature_gate_default=false
runtime_opt_in_name=durable-wal-multiblock-records
runtime_opt_in_enabled=true
multiblock_record_shape_observed=true
writer_verified_before_restart=true
blockvolume_restarted=true
recovery_completed=true
wal_integrity_fault_observed=false
reader_verified_after_restart=true
ready_after_restart=true
cleanup_status=ok
phase152_decision=<keep_opt_in|defer|blocked>
runtime_opt_in_documented=true
mounted_profile_gate_passed=true
mounted_recovery_gate_passed=true
release_note_non_claims_documented=true
remaining_followups_listed=true
phase153_decision=<document_opt_in|defer|blocked>
next_recommendation=<specific next phase>
```
## Boundaries
- Do not enable multi-block records by default.
- Do not claim throughput/SLO from this phase.
- Do not claim throughput/SLO from the Phase 151/152 gates.
- Do not claim RoCE/NVMe-RDMA.
- Do not hide recovery warnings behind a PASS; any WAL integrity fault, false
Ready, or post-restart read mismatch blocks the phase.
- Do not turn the recovery-test flusher-disable hook into a production feature.
- Do not hide the diagnostic `HeadLSN` follow-up; document it as a non-blocking
status cleanup unless it proves to affect correctness.
## Candidate Work
1. Extend the Phase 151 mounted profile into a restart/recovery gate.
2. Write data through the mounted NVMe/TCP PVC with the opt-in enabled.
3. Restart the owning `blockvolume` pod without deleting durable state.
4. Wait for recovery and Ready status.
5. Verify the reader sees the pre-restart data and no WAL integrity fault was
surfaced.
1. Add a release-boundary gate script that reads Phase 150-152 evidence.
2. Update release/roadmap docs to describe the opt-in and non-claims.
3. Add a concise user-facing values example for enabling the opt-in in lab-only
testing.
4. List remaining follow-ups, including the post-recovery `HeadLSN` diagnostic
cleanup.
## Exit Criteria
Phase 152 can close when a mounted opt-in volume restarts and recovers with
data intact, no false Ready during recovery, and zero cleanup residue. If the
runtime cannot prove those facts, keep the feature default-off and file the
blocking evidence.
Phase 153 can close when the project has an accurate release boundary for the
multi-block WAL opt-in: profile and recovery gates cited, defaults unchanged,
non-claims explicit, and follow-ups tracked.
@@ -0,0 +1,53 @@
# Phase 152 Finished Plan: WAL Multi-Block Recovery Compatibility
Status: **closed 2026-07-06, live gate PASS**.
## Problem
Phase 151 proved that the multi-block WAL record opt-in reaches the mounted
NVMe/TCP write path and reduces record shape as intended. That was still not
enough to release or default the format: the important safety question was
whether synced multi-block WAL records can be replayed after a real
`blockvolume` restart.
## Work
Phase 152 added:
- a default-off walstore recovery-test hook that disables automatic checkpoint
flushing before test writes;
- blockvolume and blockmaster launcher flags for that hook;
- Helm values and renderer wiring that omit the hook by default and render it
only when explicitly requested;
- a mounted NVMe/TCP scenario that uses hostPath restart persistence, writes
data, force-deletes the `blockvolume` pod, waits for recovery, and verifies
post-restart reads.
## Evidence
```text
phase152_wal_multiblock_recovery_compatibility_status=ok
runtime_opt_in_enabled=true
recovery_test_disable_flusher_enabled=true
restart_persistence_mode=hostpath
multiblock_record_shape_observed=true
writer_verified_before_restart=true
blockvolume_restart_mode=force_delete_pod
blockvolume_restarted=true
recovery_completed=true
recovered_lsn_after_restart=14545
wal_integrity_fault_observed=false
reader_verified_after_restart=true
ready_after_restart=true
cleanup_status=ok
phase152_decision=keep_opt_in
next_recommendation=phase153_wal_multiblock_release_boundary
```
## Conclusion
The opt-in passes the mounted recovery compatibility gate. It remains
default-off, and the project still must not claim performance/SLO, RoCE, or
NVMe/RDMA acceleration from this work. The next step is a release-boundary
review that decides how to document and gate the opt-in without changing the
default WAL format.
@@ -77,6 +77,13 @@ This is the short internal roadmap. Keep it current and readable.
expanding operator or broader HA claims. The goal is to prevent Kubernetes,
CSI, authority, host-path, recovery, and future NVMe logic from becoming
scattered scripts or unrelated small automata.
- Current backend optimization slice: Phases 148-152 took multi-block WAL
records from local prototype to disabled-by-default runtime opt-in, mounted
NVMe/TCP profile evidence, and mounted restart/recovery compatibility. Phase
152 recovered `LSN=14545` after a force-deleted `blockvolume` restart with
hostPath persistence. This is still default-off and not a performance/SLO,
RoCE, or NVMe/RDMA claim; Phase 153 is the release-boundary/documentation
review before any user-facing claim.
Do not skip from scripts directly to mutating operator lifecycle. Helm has
stabilized the installation contract, and Phase 35 added read-only CRD status,
@@ -0,0 +1,79 @@
# Phase 152 QA Sign-Off: WAL Multi-Block Recovery Compatibility
Status: **PASS** on 2026-07-06.
Run bundle: `results/20260706-220244-712c`.
## Verdict
The mounted NVMe/TCP opt-in path now proves real WAL replay for multi-block WAL
records after a `blockvolume` process restart. The gate uses hostPath restart
persistence, disables walstore's automatic checkpoint flusher through an
explicit test-only opt-in, force-deletes the `blockvolume` pod, waits for
recovery, and verifies mounted data after restart.
## Evidence
```text
phase152_wal_multiblock_recovery_compatibility_status=ok
frontend_transport=tcp
roce_claim_allowed=false
nvme_rdma_claim_allowed=false
performance_slo_claim_allowed=false
default_wal_format_unchanged=true
feature_gate_default=false
runtime_opt_in_name=durable-wal-multiblock-records
runtime_opt_in_enabled=true
recovery_test_disable_flusher_enabled=true
seq_size_mib=4
restart_verify_mib=4
restart_persistence_mode=hostpath
candidate_max_h2c_bytes=65536
target_write_request_max_bytes=65536
backend_write_request_max_bytes=65536
wal_encode_ops=873
backend_storage_write_calls=873
backend_storage_write_blocks=13512
multiblock_record_shape_observed=true
writer_verified_before_restart=true
blockvolume_restart_mode=force_delete_pod
blockvolume_restarted=true
recovery_completed=true
recovered_lsn_after_restart=14545
wal_integrity_fault_observed=false
reader_verified_after_restart=true
ready_after_restart=true
cleanup_status=ok
phase152_decision=keep_opt_in
next_recommendation=phase153_wal_multiblock_release_boundary
```
Blockvolume restart log includes:
```text
blockvolume: durable recovered: recovered LSN=14545
```
## Fixes Added By The Gate
- Added an explicit walstore recovery-test hook:
`--durable-wal-recovery-test-disable-flusher`.
- Wired it through durable provider, `blockvolume`, `blockmaster` launcher,
launcher renderer, and Helm values.
- Kept default Helm renders unchanged: no multi-block opt-in and no
recovery-test flusher disable unless explicitly requested.
- Updated the Phase 152 scenario to use run-scoped hostPath state so the
force-delete restart preserves the WAL file.
## Non-Blocking Note
After recovery, the diagnostic durable status reported `DurableLSN=14545` and
`Evidence="recovered LSN=14545"`, but `HeadLSN` displayed a much larger value.
The mounted reader, Ready status, and recovered LSN gate all passed. Track this
as a follow-up diagnostic/status cleanup; it does not block this compatibility
gate.
## Conclusion
The multi-block WAL opt-in can proceed to a release-boundary review. It remains
default-off and is not a throughput, SLO, RoCE, or NVMe/RDMA claim.
@@ -24,6 +24,8 @@ PROFILE_WRITE="${SW_BLOCK_PHASE120_PROFILE_WRITE:-false}"
PROFILE_INTERVAL_SECONDS="${SW_BLOCK_PHASE120_PROFILE_INTERVAL_SECONDS:-1}"
NVME_MAX_H2C_DATA_LENGTH="${SW_BLOCK_NVME_MAX_H2C_DATA_LENGTH:-32768}"
EXTRA_VALUES_YAML="${SW_BLOCK_PHASE120_EXTRA_VALUES_YAML:-}"
RESTART_BLOCKVOLUME_AFTER_WRITE_PROFILE="${SW_BLOCK_PHASE120_RESTART_BLOCKVOLUME_AFTER_WRITE_PROFILE:-false}"
RESTART_VERIFY_MIB="${SW_BLOCK_PHASE120_RESTART_VERIFY_MIB:-16}"
mkdir -p "${ARTIFACT_DIR}"/{bin,build,values,install,pvc,perf,status,cleanup,profile}
: >"${SUMMARY}"
@@ -131,6 +133,180 @@ collect_cluster_evidence() {
2>"${ARTIFACT_DIR}/status/inventory.stderr.txt"
}
collect_cluster_evidence_after_restart() {
"${ARTIFACT_DIR}/bin/sw-block" ops cluster \
--master-api "127.0.0.1:${STATUS_PORT}" \
--timeout 30s -o json \
>"${ARTIFACT_DIR}/status/cluster-evidence-after-restart.json" \
2>"${ARTIFACT_DIR}/status/cluster-evidence-after-restart.stderr.txt"
}
managed_volume_ready() {
local path="$1"
python3 - "$path" <<'PY'
import json
import sys
doc = json.load(open(sys.argv[1]))
managed = doc.get("managed_volumes") or []
if len(managed) != 1:
raise SystemExit(1)
vol = managed[0]
status = vol.get("status")
reason = vol.get("reason_code") or vol.get("reasonCode") or ""
if status == "ready" and reason == "first_volume_verified":
raise SystemExit(0)
raise SystemExit(1)
PY
}
wait_managed_volume_ready_after_restart() {
for _ in $(seq 1 90); do
if with_master_port_forward "${ARTIFACT_DIR}/status/blockmaster-port-forward-after-restart.log" collect_cluster_evidence_after_restart; then
if managed_volume_ready "${ARTIFACT_DIR}/status/cluster-evidence-after-restart.json"; then
return 0
fi
fi
sleep 2
done
return 1
}
wait_durable_status_after_restart() {
local volume_id="$1"
local status_addr="$2"
local out="${ARTIFACT_DIR}/status/status-durable-after-blockvolume-restart.json"
local tmp="${out}.tmp"
for _ in $(seq 1 90); do
rm -f "${tmp}"
if python3 - "$volume_id" "http://${status_addr}/status/durable?volume=${volume_id}" "${tmp}" <<'PY'
import json
import sys
import urllib.request
volume_id, url, out = sys.argv[1:4]
try:
with urllib.request.urlopen(url, timeout=2) as resp:
raw = resp.read()
except Exception as exc:
print(f"status query failed: {exc}", file=sys.stderr)
raise SystemExit(1)
open(out, "wb").write(raw)
body = json.loads(raw.decode("utf-8"))
volumes = body.get("Volumes") or body.get("volumes") or []
for vol in volumes:
if (
(vol.get("VolumeID") or vol.get("volumeID") or vol.get("volume_id")) == volume_id
and (vol.get("Latched") if "Latched" in vol else vol.get("latched")) is True
and (vol.get("Operational") if "Operational" in vol else vol.get("operational")) is True
and int(vol.get("Epoch") or vol.get("epoch") or 0) >= 1
):
raise SystemExit(0)
print(f"durable status not recovered: {body}", file=sys.stderr)
raise SystemExit(2)
PY
then
mv "${tmp}" "${out}"
return 0
fi
sleep 2
done
[[ -s "${tmp}" ]] && mv "${tmp}" "${out}"
return 1
}
restart_blockvolume_and_verify_recovery() {
local profile_summary="${ARTIFACT_DIR}/status/write-profile-summary.txt"
local volume_id status_addr deploy_line deploy_namespace deploy pod_before before_uid after_uid pod_after
volume_id="$(awk -F= '$1=="write_profile_volume_id" {print $2; exit}' "${profile_summary}")"
status_addr="$(awk -F= '$1=="write_profile_status_addr" {print $2; exit}' "${profile_summary}")"
if [[ -z "${volume_id}" || -z "${status_addr}" ]]; then
echo "missing write profile volume/status address for restart verification" >&2
exit 1
fi
timeout 180s kubectl -n "${APP_NAMESPACE}" exec "${PERF_POD}" -- sh -c \
"set -eu; rm -f /data/phase120-recovery.bin; blocks=\$(( ${RESTART_VERIFY_MIB} * 256 )); if dd if=/dev/urandom of=/data/phase120-recovery.bin bs=4096 count=\${blocks} oflag=direct; then :; else dd if=/dev/urandom of=/data/phase120-recovery.bin bs=1M count=${RESTART_VERIFY_MIB}; fi; sha256sum /data/phase120-recovery.bin > /data/phase120-recovery.sha256; sha256sum -c /data/phase120-recovery.sha256" \
>"${ARTIFACT_DIR}/perf/recovery-writer-before-restart.log" 2>&1
write_summary "writer_verified_before_restart=true"
deploy_line="$(kubectl get deploy -A -l "sw-block.seaweedfs.com/volume=${volume_id}" --no-headers 2>/dev/null | head -n 1 || true)"
deploy_namespace="$(awk 'NF >= 2 {print $1; exit}' <<<"${deploy_line}")"
deploy="$(awk 'NF >= 2 {print $2; exit}' <<<"${deploy_line}")"
if [[ -z "${deploy_namespace}" || -z "${deploy}" ]]; then
echo "blockvolume deployment not found for restart" >&2
kubectl get deploy -A -l "sw-block.seaweedfs.com/volume=${volume_id}" -o wide \
>"${ARTIFACT_DIR}/status/blockvolume-deployment.lookup-failed.txt" 2>&1 || true
exit 1
fi
kubectl -n "${deploy_namespace}" get "deploy/${deploy}" >"${ARTIFACT_DIR}/status/blockvolume-deployment.before-restart.txt" 2>&1
printf '%s/%s\n' "${deploy_namespace}" "${deploy}" >"${ARTIFACT_DIR}/status/blockvolume-deployment.txt"
kubectl -n "${deploy_namespace}" get pods -l "sw-block.seaweedfs.com/volume=${volume_id}" \
-o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.metadata.uid}{"\n"}{end}' \
>"${ARTIFACT_DIR}/status/blockvolume-pod-ids.before-restart.tsv"
pod_before="$(awk 'NF >= 2 {print $1; exit}' "${ARTIFACT_DIR}/status/blockvolume-pod-ids.before-restart.tsv")"
before_uid="$(awk 'NF >= 2 {print $2; exit}' "${ARTIFACT_DIR}/status/blockvolume-pod-ids.before-restart.tsv")"
if [[ -z "${pod_before}" || -z "${before_uid}" ]]; then
echo "blockvolume pod UID not found before restart" >&2
exit 1
fi
kubectl -n "${deploy_namespace}" delete pod "${pod_before}" --grace-period=0 --force --wait=false \
>"${ARTIFACT_DIR}/status/restart-blockvolume-force-delete.txt" 2>&1
kubectl -n "${deploy_namespace}" rollout status "deploy/${deploy}" --timeout=240s \
>"${ARTIFACT_DIR}/status/restart-blockvolume-status.log" 2>&1
for _ in $(seq 1 60); do
kubectl -n "${deploy_namespace}" get pods -l "sw-block.seaweedfs.com/volume=${volume_id}" \
-o jsonpath='{range .items[*]}{.metadata.name}{"\t"}{.metadata.uid}{"\n"}{end}' \
>"${ARTIFACT_DIR}/status/blockvolume-pod-ids.after-restart.tsv"
after_uid="$(awk 'NF >= 2 {print $2; exit}' "${ARTIFACT_DIR}/status/blockvolume-pod-ids.after-restart.tsv")"
if [[ -n "${after_uid}" && "${after_uid}" != "${before_uid}" ]]; then
break
fi
sleep 1
done
if [[ -z "${after_uid}" || "${after_uid}" == "${before_uid}" ]]; then
echo "blockvolume pod UID did not change after rollout restart" >&2
exit 1
fi
write_summary "blockvolume_restart_mode=force_delete_pod"
write_summary "blockvolume_restarted=true"
if ! wait_durable_status_after_restart "${volume_id}" "${status_addr}"; then
echo "durable status did not recover after blockvolume restart" >&2
exit 1
fi
if ! wait_managed_volume_ready_after_restart; then
echo "managed volume did not return to ready after blockvolume restart" >&2
exit 1
fi
pod_after="$(awk 'NF >= 2 {print $1; exit}' "${ARTIFACT_DIR}/status/blockvolume-pod-ids.after-restart.tsv")"
kubectl -n "${deploy_namespace}" logs "${pod_after}" -c blockvolume --tail=-1 \
>"${ARTIFACT_DIR}/status/blockvolume-after-restart.log" 2>&1 || true
if grep -Eiq 'wal_integrity|WALIntegrity|WAL integrity|CRC mismatch|durable recovery failed' "${ARTIFACT_DIR}/status/blockvolume-after-restart.log"; then
write_summary "wal_integrity_fault_observed=true"
echo "WAL integrity fault observed after blockvolume restart" >&2
exit 1
fi
grep -Eq 'durable recovered: recovered LSN=' "${ARTIFACT_DIR}/status/blockvolume-after-restart.log"
recovered_lsn="$(sed -n 's/.*durable recovered: recovered LSN=\([0-9][0-9]*\).*/\1/p' "${ARTIFACT_DIR}/status/blockvolume-after-restart.log" | tail -n 1)"
if [[ -z "${recovered_lsn}" || "${recovered_lsn}" -le 0 ]]; then
echo "recovered_lsn_after_restart=${recovered_lsn:-<missing>}, want > 0" >&2
exit 1
fi
write_summary "recovered_lsn_after_restart=${recovered_lsn}"
write_summary "recovery_completed=true"
write_summary "wal_integrity_fault_observed=false"
write_summary "ready_after_restart=true"
timeout 180s kubectl -n "${APP_NAMESPACE}" exec "${PERF_POD}" -- sh -c \
"set -eu; want=\$(awk '{print \$1}' /data/phase120-recovery.sha256); rm -f /tmp/phase120-recovery-after.bin; if dd if=/data/phase120-recovery.bin of=/tmp/phase120-recovery-after.bin bs=4096 iflag=direct; then got=\$(sha256sum /tmp/phase120-recovery-after.bin | awk '{print \$1}'); test \"\$got\" = \"\$want\"; else sha256sum -c /data/phase120-recovery.sha256; fi; dd if=/data/phase120-seq.bin of=/dev/null bs=1M; test \$(wc -c < /data/phase120-seq.bin) -eq ${SEQ_BYTES}" \
>"${ARTIFACT_DIR}/perf/recovery-reader-after-restart.log" 2>&1
write_summary "reader_verified_after_restart=true"
}
collect_durable_write_profile() {
python3 - \
"${ARTIFACT_DIR}/status/cluster-evidence.json" \
@@ -626,6 +802,11 @@ write_summary "seq_read_mibps=${SEQ_READ_MIBPS}"
if [[ "${PROFILE_WRITE}" == "true" ]]; then
collect_durable_write_profile
fi
if [[ "${RESTART_BLOCKVOLUME_AFTER_WRITE_PROFILE}" == "true" ]]; then
restart_blockvolume_and_verify_recovery
else
write_summary "blockvolume_restarted=false"
fi
SMALL_BYTES=$((SMALL_OPS * SMALL_BLOCK_BYTES))
SMALL_WRITE_MS="$(measure_exec_ms "${ARTIFACT_DIR}/perf/small-write.log" \
@@ -0,0 +1,209 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT="${1:-$(pwd)}"
ARTIFACT_DIR="${SW_BLOCK_ARTIFACT_DIR:-${ROOT}/results/phase152-wal-multiblock-recovery-compatibility-gate}"
SUMMARY="${ARTIFACT_DIR}/phase152-wal-multiblock-recovery-compatibility-summary.txt"
PHASE126_DIR="${ARTIFACT_DIR}/phase126-profile"
CANDIDATE_MAX_H2C_BYTES="${SW_BLOCK_PHASE152_CANDIDATE_MAX_H2C_BYTES:-65536}"
SEQ_MIB="${SW_BLOCK_PHASE152_SEQ_MIB:-4}"
RESTART_VERIFY_MIB="${SW_BLOCK_PHASE152_RESTART_VERIFY_MIB:-4}"
STATE_HOSTPATH="${SW_BLOCK_PHASE152_STATE_HOSTPATH:-/tmp/sw-block-phase152-recovery}"
EXTRA_VALUES_YAML="$(cat <<YAML
blockmaster:
durableWALMultiBlockRecords: true
durableWALRecoveryTestDisableFlusher: true
stateHostPath: ${STATE_HOSTPATH}
restartPersistence:
mode: hostpath
stateHostPath: ${STATE_HOSTPATH}
YAML
)"
mkdir -p "${ARTIFACT_DIR}" "${PHASE126_DIR}" "${ARTIFACT_DIR}/helm"
: >"${SUMMARY}"
write_summary() {
echo "$*" | tee -a "${SUMMARY}" >/dev/null
}
summary_value() {
local file="$1"
local key="$2"
awk -F= -v key="$key" '$1 == key {value = substr($0, length(key) + 2)} END {if (value != "") print value}' "$file"
}
require_summary_value() {
local file="$1"
local key="$2"
local value
value="$(summary_value "$file" "$key")"
if [[ -z "${value}" ]]; then
echo "missing summary key ${key} in ${file}" >&2
exit 1
fi
printf '%s' "${value}"
}
assert_int_eq() {
local actual="$1"
local want="$2"
local label="$3"
python3 - "$actual" "$want" "$label" <<'PY'
import sys
actual = int(sys.argv[1])
want = int(sys.argv[2])
label = sys.argv[3]
if actual != want:
raise SystemExit(f"{label}={actual}, want {want}")
PY
}
assert_int_ge() {
local actual="$1"
local want="$2"
local label="$3"
python3 - "$actual" "$want" "$label" <<'PY'
import sys
actual = int(sys.argv[1])
want = int(sys.argv[2])
label = sys.argv[3]
if actual < want:
raise SystemExit(f"{label}={actual}, want >= {want}")
PY
}
write_summary "phase152_wal_multiblock_recovery_compatibility_status=running"
write_summary "frontend_transport=tcp"
write_summary "roce_claim_allowed=false"
write_summary "nvme_rdma_claim_allowed=false"
write_summary "performance_slo_claim_allowed=false"
write_summary "default_wal_format_unchanged=true"
write_summary "feature_gate_default=false"
write_summary "runtime_opt_in_name=durable-wal-multiblock-records"
write_summary "runtime_opt_in_enabled=true"
write_summary "recovery_test_disable_flusher_enabled=true"
write_summary "seq_size_mib=${SEQ_MIB}"
write_summary "restart_verify_mib=${RESTART_VERIFY_MIB}"
write_summary "restart_persistence_mode=hostpath"
write_summary "state_hostpath=${STATE_HOSTPATH}"
cd "${ROOT}"
go test ./core/storage ./core/frontend/durable ./cmd/blockvolume ./cmd/blockmaster \
>"${ARTIFACT_DIR}/go-test-compatibility.log" \
2>&1
write_summary "unit_record_compatibility=pass"
helm template sw-block charts/seaweed-block --namespace kube-system \
>"${ARTIFACT_DIR}/helm/default-template.yaml" \
2>"${ARTIFACT_DIR}/helm/default-template.stderr.txt"
if grep -q -- '--launcher-durable-wal-multiblock-records' "${ARTIFACT_DIR}/helm/default-template.yaml"; then
echo "default Helm render unexpectedly enables durable WAL multi-block records" >&2
exit 1
fi
if grep -q -- '--launcher-durable-wal-recovery-test-disable-flusher' "${ARTIFACT_DIR}/helm/default-template.yaml"; then
echo "default Helm render unexpectedly enables recovery-test WAL flusher disable" >&2
exit 1
fi
write_summary "helm_default_omits_opt_in=true"
helm template sw-block charts/seaweed-block --namespace kube-system \
--set blockmaster.durableWALMultiBlockRecords=true \
--set blockmaster.durableWALRecoveryTestDisableFlusher=true \
>"${ARTIFACT_DIR}/helm/explicit-template.yaml" \
2>"${ARTIFACT_DIR}/helm/explicit-template.stderr.txt"
grep -q -- '--launcher-durable-wal-multiblock-records' "${ARTIFACT_DIR}/helm/explicit-template.yaml"
grep -q -- '--launcher-durable-wal-recovery-test-disable-flusher' "${ARTIFACT_DIR}/helm/explicit-template.yaml"
write_summary "helm_explicit_renders_opt_in=true"
write_summary "helm_explicit_renders_recovery_test_disable_flusher=true"
SW_BLOCK_ARTIFACT_DIR="${PHASE126_DIR}" \
SW_BLOCK_PHASE120_EXTRA_VALUES_YAML="${EXTRA_VALUES_YAML}" \
SW_BLOCK_PHASE120_RESTART_BLOCKVOLUME_AFTER_WRITE_PROFILE=true \
SW_BLOCK_PHASE120_RESTART_VERIFY_MIB="${RESTART_VERIFY_MIB}" \
SW_BLOCK_PHASE126_SEQ_MIB="${SEQ_MIB}" \
SW_BLOCK_NVME_MAX_H2C_DATA_LENGTH="${CANDIDATE_MAX_H2C_BYTES}" \
bash "${ROOT}/scripts/run-phase126-block-nvme-tcp-backend-write-instrumentation-gate.sh" "${ROOT}" \
>"${ARTIFACT_DIR}/phase126-profile.stdout.txt" \
2>"${ARTIFACT_DIR}/phase126-profile.stderr.txt"
PHASE126_SUMMARY="${PHASE126_DIR}/phase126-block-nvme-tcp-backend-write-instrumentation-summary.txt"
PHASE120_SUMMARY="${PHASE126_DIR}/phase125-profile/block-profile/phase120-nvme-tcp-performance-baseline-summary.txt"
PHASE120_TEMPLATE="${PHASE126_DIR}/phase125-profile/block-profile/install/helm-template.yaml"
if [[ "$(require_summary_value "${PHASE126_SUMMARY}" phase126_block_nvme_tcp_backend_write_instrumentation_status)" != "ok" ]]; then
echo "phase126 profile dependency did not finish ok" >&2
exit 1
fi
if [[ "$(require_summary_value "${PHASE120_SUMMARY}" phase120_nvme_tcp_performance_baseline_status)" != "ok" ]]; then
echo "phase120 candidate profile did not finish ok" >&2
exit 1
fi
grep -q -- '--launcher-durable-wal-multiblock-records' "${PHASE120_TEMPLATE}"
grep -q -- '--launcher-durable-wal-recovery-test-disable-flusher' "${PHASE120_TEMPLATE}"
grep -q -- "${STATE_HOSTPATH}" "${PHASE120_TEMPLATE}"
TARGET_WRITE_REQUEST_MAX_BYTES="$(require_summary_value "${PHASE126_SUMMARY}" target_write_request_max_bytes)"
BACKEND_WRITE_REQUEST_MAX_BYTES="$(require_summary_value "${PHASE126_SUMMARY}" backend_write_request_max_bytes)"
WAL_ENCODE_OPS="$(require_summary_value "${PHASE126_SUMMARY}" wal_encode_ops)"
BACKEND_STORAGE_WRITE_CALLS="$(require_summary_value "${PHASE126_SUMMARY}" backend_storage_write_calls)"
BACKEND_STORAGE_WRITE_BLOCKS="$(require_summary_value "${PHASE126_SUMMARY}" backend_storage_write_blocks)"
CLEANUP_STATUS="$(require_summary_value "${PHASE126_SUMMARY}" cleanup_status)"
WRITER_BEFORE="$(require_summary_value "${PHASE120_SUMMARY}" writer_verified_before_restart)"
RESTART_MODE="$(require_summary_value "${PHASE120_SUMMARY}" blockvolume_restart_mode)"
RESTARTED="$(require_summary_value "${PHASE120_SUMMARY}" blockvolume_restarted)"
RECOVERY_COMPLETED="$(require_summary_value "${PHASE120_SUMMARY}" recovery_completed)"
RECOVERED_LSN="$(require_summary_value "${PHASE120_SUMMARY}" recovered_lsn_after_restart)"
WAL_FAULT="$(require_summary_value "${PHASE120_SUMMARY}" wal_integrity_fault_observed)"
READER_AFTER="$(require_summary_value "${PHASE120_SUMMARY}" reader_verified_after_restart)"
READY_AFTER="$(require_summary_value "${PHASE120_SUMMARY}" ready_after_restart)"
assert_int_eq "${TARGET_WRITE_REQUEST_MAX_BYTES}" "${CANDIDATE_MAX_H2C_BYTES}" "target_write_request_max_bytes"
assert_int_eq "${BACKEND_WRITE_REQUEST_MAX_BYTES}" "${CANDIDATE_MAX_H2C_BYTES}" "backend_write_request_max_bytes"
assert_int_ge "${WAL_ENCODE_OPS}" 1 "wal_encode_ops"
assert_int_ge "${RECOVERED_LSN}" 1 "recovered_lsn_after_restart"
python3 - "$WAL_ENCODE_OPS" "$BACKEND_STORAGE_WRITE_CALLS" "$BACKEND_STORAGE_WRITE_BLOCKS" <<'PY'
import sys
wal_encode_ops = int(sys.argv[1])
storage_write_calls = int(sys.argv[2])
storage_write_blocks = int(sys.argv[3])
if wal_encode_ops != storage_write_calls:
raise SystemExit(f"wal_encode_ops={wal_encode_ops}, want storage write call count {storage_write_calls}")
if wal_encode_ops >= storage_write_blocks:
raise SystemExit(f"wal_encode_ops={wal_encode_ops}, want less than storage write block count {storage_write_blocks}")
PY
for pair in \
"writer_verified_before_restart:${WRITER_BEFORE}:true" \
"blockvolume_restart_mode:${RESTART_MODE}:force_delete_pod" \
"blockvolume_restarted:${RESTARTED}:true" \
"recovery_completed:${RECOVERY_COMPLETED}:true" \
"wal_integrity_fault_observed:${WAL_FAULT}:false" \
"reader_verified_after_restart:${READER_AFTER}:true" \
"ready_after_restart:${READY_AFTER}:true" \
"cleanup_status:${CLEANUP_STATUS}:ok"; do
IFS=: read -r key actual want <<<"${pair}"
if [[ "${actual}" != "${want}" ]]; then
echo "${key}=${actual}, want ${want}" >&2
exit 1
fi
done
write_summary "candidate_max_h2c_bytes=${CANDIDATE_MAX_H2C_BYTES}"
write_summary "target_write_request_max_bytes=${TARGET_WRITE_REQUEST_MAX_BYTES}"
write_summary "backend_write_request_max_bytes=${BACKEND_WRITE_REQUEST_MAX_BYTES}"
write_summary "wal_encode_ops=${WAL_ENCODE_OPS}"
write_summary "backend_storage_write_calls=${BACKEND_STORAGE_WRITE_CALLS}"
write_summary "backend_storage_write_blocks=${BACKEND_STORAGE_WRITE_BLOCKS}"
write_summary "multiblock_record_shape_observed=true"
write_summary "mounted_helm_renders_recovery_test_disable_flusher=true"
write_summary "writer_verified_before_restart=${WRITER_BEFORE}"
write_summary "blockvolume_restart_mode=${RESTART_MODE}"
write_summary "blockvolume_restarted=${RESTARTED}"
write_summary "recovery_completed=${RECOVERY_COMPLETED}"
write_summary "recovered_lsn_after_restart=${RECOVERED_LSN}"
write_summary "wal_integrity_fault_observed=${WAL_FAULT}"
write_summary "reader_verified_after_restart=${READER_AFTER}"
write_summary "ready_after_restart=${READY_AFTER}"
write_summary "cleanup_status=${CLEANUP_STATUS}"
write_summary "phase152_decision=keep_opt_in"
write_summary "next_recommendation=phase153_wal_multiblock_release_boundary"
write_summary "phase152_wal_multiblock_recovery_compatibility_status=ok"
@@ -0,0 +1,217 @@
name: nvme-tcp-wal-multiblock-recovery-compatibility-chain
timeout: 95m
env:
product_root: "/tmp/seaweed_block"
ssh_key: "C:\\work\\dev_server\\testdev_key"
topology:
nodes:
m01:
host: 192.168.1.181
user: testdev
key: "{{ ssh_key }}"
m02:
host: 192.168.1.184
user: testdev
key: "{{ ssh_key }}"
phases:
- name: pre_clean
actions:
- action: pre_run_cleanup
node: m02
kill_patterns: "blockmaster,blockvolume,blockcsi,iscsi-target"
nvme_disconnect: "true"
iscsi_logout_prefix: "iqn.2026-05.io.seaweedfs"
- action: exec
node: m02
timeout: 5m
cmd: "helm status sw-block --namespace kube-system >/dev/null 2>&1 && helm uninstall sw-block --namespace kube-system --wait --timeout 240s || true; kubectl -n default delete pod sw-block-phase126-block-perf sw-block-phase126-local-perf --ignore-not-found=true --wait=true --timeout=60s || true; kubectl -n default delete pvc sw-block-phase126-block-pvc sw-block-phase126-local-pvc --ignore-not-found=true --wait=true --timeout=60s || true; kubectl delete storageclass sw-block-phase126-block --ignore-not-found=true --wait=true --timeout=60s || true; kubectl get pv --no-headers | awk '/sw-block-phase126/ {print $1}' | xargs -r -n1 kubectl patch pv --type=merge -p '{\"metadata\":{\"finalizers\":[]}}' >/dev/null 2>&1 || true; kubectl get pv --no-headers | awk '/sw-block-phase126/ {print $1}' | xargs -r kubectl delete pv --wait=false >/dev/null 2>&1 || true; kubectl -n kube-system get swblockvolumes.block.seaweedfs.com -o name 2>/dev/null | xargs -r -n1 kubectl -n kube-system patch --type=merge -p '{\"metadata\":{\"finalizers\":[]}}' >/dev/null 2>&1 || true; kubectl -n kube-system delete swblockvolumes.block.seaweedfs.com --all --ignore-not-found=true --wait=true --timeout=60s >/dev/null 2>&1 || true; kubectl -n kube-system delete swblockclusters.block.seaweedfs.com --all --ignore-not-found=true --wait=true --timeout=60s >/dev/null 2>&1 || true; kubectl delete validatingadmissionpolicy,validatingadmissionpolicybinding -l app.kubernetes.io/instance=sw-block --ignore-not-found=true >/dev/null 2>&1 || true; kubectl delete crd swblockclusters.block.seaweedfs.com swblockvolumes.block.seaweedfs.com swblockreplicaeligibilities.block.seaweedfs.com swblockreplicarebuilds.block.seaweedfs.com swblockreplicafailbacks.block.seaweedfs.com swblockfrontendpublications.block.seaweedfs.com --ignore-not-found=true --wait=true --timeout=60s >/dev/null 2>&1 || true; sudo -n nvme disconnect-all >/dev/null 2>&1 || true; sudo -n rm -rf /tmp/sw-block-phase152-recovery-*; rm -rf /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase152-multiblock-recovery && mkdir -p /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase152-multiblock-recovery"
env.KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
- action: exec
node: m01
timeout: 2m
cmd: "sudo -n rm -rf /tmp/sw-block-phase152-recovery-*"
- name: run_gate
actions:
- action: exec
node: m02
timeout: 87m
cmd: "cd {{ product_root }} && SW_BLOCK_ARTIFACT_DIR=/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase152-multiblock-recovery SW_BLOCK_PHASE152_CANDIDATE_MAX_H2C_BYTES=65536 SW_BLOCK_PHASE152_SEQ_MIB=4 SW_BLOCK_PHASE152_RESTART_VERIFY_MIB=4 SW_BLOCK_PHASE152_STATE_HOSTPATH=/tmp/sw-block-phase152-recovery-{{ run_id }} SW_BLOCK_PHASE125_FRONTEND_IP_MAP=m01=10.0.0.1,m02=10.0.0.3 SW_BLOCK_PHASE125_EXPECTED_ROUTE_DEV=enp1s0np0 SW_BLOCK_IMPORT_K3S_SSH_KEY=/opt/work/testdev_key bash scripts/run-phase152-wal-multiblock-recovery-compatibility-gate.sh {{ product_root }}"
env.KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
- name: assert_summary
actions:
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase152-multiblock-recovery/phase152-wal-multiblock-recovery-compatibility-summary.txt"
pattern: "^phase152_wal_multiblock_recovery_compatibility_status=ok$"
save_as: phase152_status_ok
- action: assert_greater
actual: "{{ phase152_status_ok }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase152-multiblock-recovery/phase152-wal-multiblock-recovery-compatibility-summary.txt"
pattern: "^runtime_opt_in_enabled=true$"
save_as: runtime_enabled
- action: assert_greater
actual: "{{ runtime_enabled }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase152-multiblock-recovery/phase152-wal-multiblock-recovery-compatibility-summary.txt"
pattern: "^recovery_test_disable_flusher_enabled=true$"
save_as: recovery_test_flusher_disabled
- action: assert_greater
actual: "{{ recovery_test_flusher_disabled }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase152-multiblock-recovery/phase152-wal-multiblock-recovery-compatibility-summary.txt"
pattern: "^multiblock_record_shape_observed=true$"
save_as: multiblock_shape
- action: assert_greater
actual: "{{ multiblock_shape }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase152-multiblock-recovery/phase152-wal-multiblock-recovery-compatibility-summary.txt"
pattern: "^mounted_helm_renders_recovery_test_disable_flusher=true$"
save_as: mounted_recovery_test_flusher_disabled
- action: assert_greater
actual: "{{ mounted_recovery_test_flusher_disabled }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase152-multiblock-recovery/phase152-wal-multiblock-recovery-compatibility-summary.txt"
pattern: "^writer_verified_before_restart=true$"
save_as: writer_before
- action: assert_greater
actual: "{{ writer_before }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase152-multiblock-recovery/phase152-wal-multiblock-recovery-compatibility-summary.txt"
pattern: "^blockvolume_restarted=true$"
save_as: restarted
- action: assert_greater
actual: "{{ restarted }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase152-multiblock-recovery/phase152-wal-multiblock-recovery-compatibility-summary.txt"
pattern: "^blockvolume_restart_mode=force_delete_pod$"
save_as: restart_mode
- action: assert_greater
actual: "{{ restart_mode }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase152-multiblock-recovery/phase152-wal-multiblock-recovery-compatibility-summary.txt"
pattern: "^recovery_completed=true$"
save_as: recovery_completed
- action: assert_greater
actual: "{{ recovery_completed }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase152-multiblock-recovery/phase152-wal-multiblock-recovery-compatibility-summary.txt"
pattern: "^recovered_lsn_after_restart=[1-9][0-9]*$"
save_as: recovered_lsn
- action: assert_greater
actual: "{{ recovered_lsn }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase152-multiblock-recovery/phase152-wal-multiblock-recovery-compatibility-summary.txt"
pattern: "^wal_integrity_fault_observed=false$"
save_as: no_wal_fault
- action: assert_greater
actual: "{{ no_wal_fault }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase152-multiblock-recovery/phase152-wal-multiblock-recovery-compatibility-summary.txt"
pattern: "^reader_verified_after_restart=true$"
save_as: reader_after
- action: assert_greater
actual: "{{ reader_after }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase152-multiblock-recovery/phase152-wal-multiblock-recovery-compatibility-summary.txt"
pattern: "^ready_after_restart=true$"
save_as: ready_after
- action: assert_greater
actual: "{{ ready_after }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase152-multiblock-recovery/phase152-wal-multiblock-recovery-compatibility-summary.txt"
pattern: "^target_write_request_max_bytes=65536$"
save_as: target_h2c
- action: assert_greater
actual: "{{ target_h2c }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase152-multiblock-recovery/phase152-wal-multiblock-recovery-compatibility-summary.txt"
pattern: "^backend_write_request_max_bytes=65536$"
save_as: backend_h2c
- action: assert_greater
actual: "{{ backend_h2c }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase152-multiblock-recovery/phase152-wal-multiblock-recovery-compatibility-summary.txt"
pattern: "^roce_claim_allowed=false$"
save_as: no_roce_claim
- action: assert_greater
actual: "{{ no_roce_claim }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase152-multiblock-recovery/phase152-wal-multiblock-recovery-compatibility-summary.txt"
pattern: "^nvme_rdma_claim_allowed=false$"
save_as: no_rdma_claim
- action: assert_greater
actual: "{{ no_rdma_claim }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase152-multiblock-recovery/phase152-wal-multiblock-recovery-compatibility-summary.txt"
pattern: "^performance_slo_claim_allowed=false$"
save_as: no_slo_claim
- action: assert_greater
actual: "{{ no_slo_claim }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase152-multiblock-recovery/phase152-wal-multiblock-recovery-compatibility-summary.txt"
pattern: "^cleanup_status=ok$"
save_as: cleanup_ok
- action: assert_greater
actual: "{{ cleanup_ok }}"
threshold: "0"
- name: collect
always: true
actions:
- action: exec
node: m01
timeout: 2m
cmd: "sudo -n rm -rf /tmp/sw-block-phase152-recovery-{{ run_id }}"
ignore_error: true
- action: exec
node: m02
timeout: 2m
cmd: "sudo -n rm -rf /tmp/sw-block-phase152-recovery-{{ run_id }}"
ignore_error: true
- action: collect_path
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase152-multiblock-recovery"
name: "remote-phases"
ignore_error: true