From 515d49db088e1ec7d9ecad918a7c9cdce9879595 Mon Sep 17 00:00:00 2001 From: bunnie Date: Sun, 27 Mar 2022 02:55:19 +0800 Subject: [PATCH] add a sync operation after every write I did observe some PDDB corruption that happened today that looks ostensibly linked to a record that didn't sync up with the disk, so, let's be safer and sync everything. We can work on optimizing performance after correctness is guaranteed. --- services/pddb/src/main.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/services/pddb/src/main.rs b/services/pddb/src/main.rs index d414fdfbf..b251bb5f7 100644 --- a/services/pddb/src/main.rs +++ b/services/pddb/src/main.rs @@ -1061,6 +1061,9 @@ fn xmain() -> ! { pbuf.retcode = PddbRetcode::BasisLost; } // we don't nede a "replace" operation because all ops happen in-place + + // for now, do an expensive sync operation after every write to ensure data integrity + basis_cache.sync(&mut pddb_os, None).expect("couldn't sync basis"); } Some(Opcode::WriteKeyFlush) => msg_blocking_scalar_unpack!(msg, _, _, _, _, { match basis_cache.sync(&mut pddb_os, None) {