test(storage): expose syscall probe and record sync contract

This commit is contained in:
pingqiu committed 2026-11-20 01:06:31 -08:00
1 parent 2042e3422b
commit 781e842ef1
2 files changed
+33

No files matched your search

@@ -151,3 +151,30 @@ func TestFdatasyncAcknowledgedWritesSurviveSIGKILL(t *testing.T) {
}
}
}
// Run under strace with the experiment environment unset/set to verify the
// syscall boundary independently of the selected function's Go identity.
func TestDataSyncSyscallProbe(t *testing.T) {
s, e := CreateWALStore(filepath.Join(t.TempDir(), "volume"), 32, 4096)
if e != nil {
t.Fatal(e)
}
defer s.Close()
s.DisableAutoFlushForRecoveryTest()
if _, e = s.Recover(); e != nil {
t.Fatal(e)
}
if _, e = s.Write(7, bytes.Repeat([]byte{0x6d}, 4096)); e != nil {
t.Fatal(e)
}
if _, e = s.Sync(); e != nil {
t.Fatal(e)
}
if e = s.flusher.flushOnce(); e != nil {
t.Fatal(e)
}
b, e := s.Read(7)
if e != nil || !bytes.Equal(b, bytes.Repeat([]byte{0x6d}, 4096)) {
t.Fatalf("readback: %v", e)
}
}
+6
View File
@@ -527,6 +527,12 @@ Notes:
|---|---|---|---|---|---|---|
| `INV-NVME-H2C-RANGE-001` | An H2CData range exceeding the expected transfer size is refused before slicing, including a uint32 offset-plus-length overflow; an exact-bound payload is preserved. | Frontend H2C receive validation; no storage state transition | `core/frontend/nvme/session.go` `recvH2CData` | `TestRecvH2CDataRangeBounds` (`core/frontend/nvme/h2c_bounds_test.go`) | — | ACTIVE |
### Experimental data-file synchronization
| ID | Invariant | Machine / transition | Enforced in | Tests | TLA+ | Status |
|---|---|---|---|---|---|---|
| `INV-WAL-DATA-SYNC-001` | Default WAL/extent sync remains fsync. Linux `SWBLOCK_SYNC=fdatasync` selects data-only sync for WAL/extent data; descriptor/map/create/directory durability still uses fsync. `SWBLOCK_PREZERO=1` writes every byte only at create, fsyncs, then refuses holes/unwritten FIEMAP mappings. Existing files are never prezeroed. | M1 Create / Sync / Checkpoint | `data_sync.go`, `data_sync_linux.go`; `walstore_v3.go` Create; `walstore.go` data sync seams | `TestPrezeroCreatesInitializedVolume`, `TestInitializedFileRejectsSparseAndUnwritten`, `TestFdatasyncAcknowledgedWritesSurviveSIGKILL`, `TestDataSyncSyscallProbe` (`core/storage/data_sync_linux_test.go`) | Same abstract durable sync action; syscall/extent initialization and process-crash versus power-loss limits are outside the model | ACTIVE |
## Part C. Change rules
How a fix or a feature is calibrated against this model: