add the evicted record and remove a debug line i forgot to trim

This commit is contained in:
bunnie 2023-01-29 04:26:08 +08:00 committed by Sean Cross
parent 1a60fe4aad
commit a455f0ae1d
2 changed files with 5 additions and 3 deletions

View file

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

View file

@ -181,7 +181,10 @@ pub(crate) struct KeySmallPool {
pub(crate) contents: Vec::<String>,
/// 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::<String>::new(),
avail: SMALL_CAPACITY as u16,
clean: false,
evicted: false,
}
}
}