From 393cac6bd4c37a735583226a4bddf913b3f16b3d Mon Sep 17 00:00:00 2001 From: Abner Zheng Date: Tue, 14 May 2024 13:56:25 +0800 Subject: [PATCH] temp --- mini-lsm-starter/src/mem_table.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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(()) }