From 0e4d1ba1f45a2b8cbca0e4ca5a7a20118ddef9af Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Tue, 17 Mar 2026 21:40:28 -0700 Subject: [PATCH] Sync .ecx file before close matching Go's EcVolume.Close Go calls ev.ecxFile.Sync() before closing to ensure in-place deletion marks are flushed to disk. Without this, deletion marks written via MarkNeedleDeleted could be lost on crash. --- seaweed-volume/src/storage/erasure_coding/ec_volume.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/seaweed-volume/src/storage/erasure_coding/ec_volume.rs b/seaweed-volume/src/storage/erasure_coding/ec_volume.rs index 019f69cef..a746beca3 100644 --- a/seaweed-volume/src/storage/erasure_coding/ec_volume.rs +++ b/seaweed-volume/src/storage/erasure_coding/ec_volume.rs @@ -749,6 +749,10 @@ impl EcVolume { } *shard = None; } + // Sync .ecx before closing to flush in-place deletion marks (matches Go's ev.ecxFile.Sync()) + if let Some(ref ecx_file) = self.ecx_file { + let _ = ecx_file.sync_all(); + } self.ecx_file = None; self.ecj_file = None; }