From 0d9a39a349d070dfbcdaca8461f89b4016c05f45 Mon Sep 17 00:00:00 2001 From: bunnie Date: Fri, 4 Nov 2022 17:05:32 +0800 Subject: [PATCH] print debug information when a key goes missing in bulk read this helps debug problems down the road --- services/pddb/src/main.rs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/services/pddb/src/main.rs b/services/pddb/src/main.rs index 4e4944e70..0ae493cd4 100644 --- a/services/pddb/src/main.rs +++ b/services/pddb/src/main.rs @@ -1515,11 +1515,24 @@ fn wrapped_main() -> ! { pddb_os.perf_entry(FILE_ID_SERVICES_PDDB_SRC_MAIN, perflib::PERFMETA_STARTBLOCK, 6, std::line!()); let ser_result: SerializeResult = if let Some(key_name) = state.key_list.pop() { - let attr = basis_cache.key_attributes(&mut pddb_os, + let attr = match basis_cache.key_attributes(&mut pddb_os, &state.dict, &key_name, if state.is_basis_specified{Some(&state.basis)} else {None} - ).expect("Key went missing during bulk read"); // could be a concurrent process mutating. We don't handle this; flag with a panic. + ) { + Ok(attr) => attr, + Err(e) => { + modals.show_notification( + &format!("Error: key not found during bulk read:\n{:?}\n{:?}:{}:{}", + e, + if state.is_basis_specified{Some(&state.basis)} else {None}, + &state.dict, + &key_name, + ), + None).ok(); + continue; + } + }; if attr.len < state.read_limit - state.read_total { let mut d = vec![0u8; attr.len]; match basis_cache.key_read(