diff --git a/mini-lsm-starter/src/mem_table.rs b/mini-lsm-starter/src/mem_table.rs index bf1b241..8d85a82 100644 --- a/mini-lsm-starter/src/mem_table.rs +++ b/mini-lsm-starter/src/mem_table.rs @@ -2,7 +2,7 @@ use std::ops::Bound; use std::path::Path; -use std::sync::atomic::AtomicUsize; +use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::Arc; use anyhow::Result; @@ -12,6 +12,7 @@ use ouroboros::self_referencing; use crate::iterators::StorageIterator; use crate::key::KeySlice; +use crate::table::bloom::BitSlice; use crate::table::SsTableBuilder; use crate::wal::Wal; @@ -84,6 +85,8 @@ impl MemTable { pub fn put(&self, key: &[u8], value: &[u8]) -> Result<()> { self.map .insert(Bytes::copy_from_slice(key), Bytes::copy_from_slice(value)); + self.approximate_size + .fetch_add(key.len() + value.len(), Ordering::Relaxed); Ok(()) }