From 5ea3a0b67f1bb0a01b88dd85ae80acced561d1bf Mon Sep 17 00:00:00 2001 From: lxc Date: Wed, 18 Dec 2024 13:34:03 +0800 Subject: [PATCH 1/2] Update lsm_storage.rs --- mini-lsm-starter/src/lsm_storage.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mini-lsm-starter/src/lsm_storage.rs b/mini-lsm-starter/src/lsm_storage.rs index e99fec5e..d028b8bc 100644 --- a/mini-lsm-starter/src/lsm_storage.rs +++ b/mini-lsm-starter/src/lsm_storage.rs @@ -3,7 +3,7 @@ use std::collections::HashMap; use std::ops::Bound; use std::path::{Path, PathBuf}; -use std::sync::atomic::AtomicUsize; +use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::Arc; use anyhow::Result; @@ -230,7 +230,7 @@ impl MiniLsm { impl LsmStorageInner { pub(crate) fn next_sst_id(&self) -> usize { self.next_sst_id - .fetch_add(1, std::sync::atomic::Ordering::SeqCst) + .fetch_add(1, Ordering::SeqCst) } /// Start the storage engine by either loading an existing directory or creating a new one if the directory does From 1ae1c85f07a30a45ee4a0f461f5a61f5b78621a9 Mon Sep 17 00:00:00 2001 From: lxc Date: Wed, 18 Dec 2024 13:35:04 +0800 Subject: [PATCH 2/2] Update mem_table.rs --- mini-lsm-starter/src/mem_table.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mini-lsm-starter/src/mem_table.rs b/mini-lsm-starter/src/mem_table.rs index dc4fa5a1..8cba5fea 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; @@ -109,7 +109,7 @@ impl MemTable { pub fn approximate_size(&self) -> usize { self.approximate_size - .load(std::sync::atomic::Ordering::Relaxed) + .load(Ordering::Relaxed) } /// Only use this function when closing the database