From 09615d9ab3e2863b32c85a5df88fd169bcb4a537 Mon Sep 17 00:00:00 2001 From: Ligh0x74 <66345528+Ligh0x74@users.noreply.github.com> Date: Mon, 5 May 2025 17:40:20 +0800 Subject: [PATCH] sync: synchronize the methods used in the w3d4 test to mini-lsm-starter (#141) Co-authored-by: Alex Chi --- mini-lsm-starter/src/lsm_storage.rs | 4 ++++ mini-lsm-starter/src/mvcc/watermark.rs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/mini-lsm-starter/src/lsm_storage.rs b/mini-lsm-starter/src/lsm_storage.rs index 1f8c2e9..a544796 100644 --- a/mini-lsm-starter/src/lsm_storage.rs +++ b/mini-lsm-starter/src/lsm_storage.rs @@ -248,6 +248,10 @@ impl LsmStorageInner { .fetch_add(1, std::sync::atomic::Ordering::SeqCst) } + pub(crate) fn mvcc(&self) -> &LsmMvccInner { + self.mvcc.as_ref().unwrap() + } + /// Start the storage engine by either loading an existing directory or creating a new one if the directory does /// not exist. pub(crate) fn open(path: impl AsRef, options: LsmStorageOptions) -> Result { diff --git a/mini-lsm-starter/src/mvcc/watermark.rs b/mini-lsm-starter/src/mvcc/watermark.rs index 34b016f..56fb1cd 100644 --- a/mini-lsm-starter/src/mvcc/watermark.rs +++ b/mini-lsm-starter/src/mvcc/watermark.rs @@ -33,7 +33,7 @@ impl Watermark { pub fn remove_reader(&mut self, ts: u64) {} pub fn num_retained_snapshots(&self) -> usize { - 0 + self.readers.len() } pub fn watermark(&self) -> Option {