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.
This commit is contained in:
bunnie 2022-03-27 02:55:19 +08:00
parent a103536b58
commit 515d49db08

View file

@ -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) {