From 004599543a21dbcd5fd13fb61c0b9dc847b2f93c Mon Sep 17 00:00:00 2001 From: bunnie Date: Sun, 29 Jan 2023 04:26:08 +0800 Subject: [PATCH] add the evicted record and remove a debug line i forgot to trim --- services/pddb/src/backend/dictionary.rs | 4 +--- services/pddb/src/backend/key.rs | 4 ++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/services/pddb/src/backend/dictionary.rs b/services/pddb/src/backend/dictionary.rs index 7e3ab7c5d..e3f7b2705 100644 --- a/services/pddb/src/backend/dictionary.rs +++ b/services/pddb/src/backend/dictionary.rs @@ -555,9 +555,7 @@ impl DictCacheEntry { let pool_index = small_storage_index_from_key(&kcache, self.index).expect("pool should be valid"); let ksp = &mut self.small_pool[pool_index]; if !ksp.contents.contains(&name.to_string()) { - log::warn!("illegal state: key_update fill key pool contents: {:?}", ksp.contents); - let tt = ticktimer_server::Ticktimer::new().unwrap(); - tt.sleep_ms(1000).ok(); + log::warn!("illegal state: key_update fill key pool contents: {:?}, missing {}", ksp.contents, name); panic!("Entry to fill isn't in the expected pool"); } let data_vaddr = small_storage_base_vaddr_from_indices(self.index, pool_index); diff --git a/services/pddb/src/backend/key.rs b/services/pddb/src/backend/key.rs index d7951cb5a..bda27519b 100644 --- a/services/pddb/src/backend/key.rs +++ b/services/pddb/src/backend/key.rs @@ -181,7 +181,10 @@ pub(crate) struct KeySmallPool { pub(crate) contents: Vec::, /// keeps track of the available space within the pool, avoiding an expensive lookup every time we want to query the available space pub(crate) avail: u16, + /// if false, contents are modified and need syncing to disk pub(crate) clean: bool, + /// if true, some elements of this pool were evicted to make room in RAM + pub(crate) evicted: bool, } impl KeySmallPool { pub(crate) fn new() -> KeySmallPool { @@ -189,6 +192,7 @@ impl KeySmallPool { contents: Vec::::new(), avail: SMALL_CAPACITY as u16, clean: false, + evicted: false, } } }