diff --git a/seaweed-block/core/storage/walstore_v3_test.go b/seaweed-block/core/storage/walstore_v3_test.go index 298cd708c3..f28637d12e 100644 --- a/seaweed-block/core/storage/walstore_v3_test.go +++ b/seaweed-block/core/storage/walstore_v3_test.go @@ -7,6 +7,7 @@ import ( "path/filepath" "runtime" "sync" + "syscall" "testing" "time" ) @@ -984,3 +985,20 @@ func TestWALStoreV3FlusherCheckpointIsClampedToTheAcknowledgedW(t *testing.T) { } } } + +// ENOSPC on the WAL append itself (not behind it, in the flusher) is the +// permanent, latched store fault, as the disk-full ruling scopes it (issue +// 484): the error keeps ENOSPC and the latch is a SubstrateIO failure. +func TestWALStoreV3AppendNoSpaceIsTheLatchedPermanentFault(t *testing.T) { + s, _ := newStoreV3(t, WModeLagged) + defer s.Close() + writeSynced(t, s, 1, 1) + s.v3.w.writeAt = func([]byte, int64) (int, error) { return 0, syscall.ENOSPC } + if _, err := s.Write(2, blk(2)); !errors.Is(err, syscall.ENOSPC) { + t.Fatalf("append: err = %v, want ENOSPC", err) + } + var failure *RecoveryFailure + if f := s.stickyIOFault(); !errors.As(f, &failure) || failure.Kind != StorageRecoveryFailureSubstrateIO { + t.Fatalf("ENOSPC on the append latched %v, want a SubstrateIO failure", f) + } +}