From 4eed7803ef1f2aac49649ac68a1928f69eee17fa Mon Sep 17 00:00:00 2001 From: bsbds <69835502+bsbds@users.noreply.github.com> Date: Mon, 6 May 2024 14:19:43 +0800 Subject: [PATCH] fixup!: update size after write is successful Signed-off-by: bsbds <69835502+bsbds@users.noreply.github.com> --- crates/curp/src/server/storage/wal/segment.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/curp/src/server/storage/wal/segment.rs b/crates/curp/src/server/storage/wal/segment.rs index 93a71ae7d..217d1f066 100644 --- a/crates/curp/src/server/storage/wal/segment.rs +++ b/crates/curp/src/server/storage/wal/segment.rs @@ -140,9 +140,9 @@ impl WALSegment { { let encoded_bytes = encoder.encode(item)?; self.file.write_all(&encoded_bytes)?; - self.update_size(encoded_bytes.len().numeric_cast()); self.file.flush()?; self.file.sync_data()?; + self.update_size(encoded_bytes.len().numeric_cast()); Ok(()) }