volume(rs): an EC sync does not wait for a journal append in flight

CopyFile syncs the EC volume under the store read lock, and the .ecj
sync now took the journal lock, so it waited out a delete's fsync with
the store guard held. Every committed append already syncs its own
record, so skip the journal while one holds its lock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Chris LuandClaude Opus 5.5 committed 2026-11-21 19:00:32 -08:00
1 parent 1fea6544ba
commit fe7a108ce5
1 file changed
+6 -2
@@ -1558,8 +1558,12 @@ impl EcVolume {
/// Sync the EC volume's journal and index files to disk (matching Go's ecv.Sync()).
/// Go flushes both .ecj and .ecx to ensure in-place deletion marks are persisted.
pub fn sync_to_disk(&self) -> io::Result<()> {
if let Some(ref ecj_file) = self.journal().file {
ecj_file.sync_all()?;
// Every append syncs its own record, so one in flight is not waited
// for: callers such as CopyFile hold the store lock here.
if let Ok(journal) = self.ecj.try_lock() {
if let Some(ref ecj_file) = journal.file {
ecj_file.sync_all()?;
}
}
if let Some(ref ecx_file) = self.ecx_file {
ecx_file.sync_all()?;