Skip to content

Commit 8c67631

Browse files
committed
address comments
1 parent bc43426 commit 8c67631

File tree

2 files changed

+23
-10
lines changed

2 files changed

+23
-10
lines changed

src/storage/src/hummock/store/version.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -845,17 +845,15 @@ impl HummockVersionReader {
845845
match level.level_type() {
846846
LevelType::Overlapping | LevelType::Unspecified => {
847847
if prune_overlapping_ssts(&level.table_infos, table_id, &table_key_range)
848-
.peekable()
849-
.peek()
848+
.next()
850849
.is_some()
851850
{
852851
return Ok(false);
853852
}
854853
}
855854
LevelType::Nonoverlapping => {
856855
if prune_nonoverlapping_ssts(&level.table_infos, &encoded_user_key_range)
857-
.peekable()
858-
.peek()
856+
.next()
859857
.is_some()
860858
{
861859
return Ok(false);

src/storage/src/store_impl.rs

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,9 @@ pub mod verify {
395395
impl<A: LocalStateStore, E: LocalStateStore> LocalStateStore for VerifyStateStore<A, E> {
396396
define_local_state_store_associated_type!();
397397

398+
// We don't verify `surely_not_have` across different state stores because
399+
// the return value of `surely_not_have` is implementation specific and may not
400+
// be consistent across different state store backends.
398401
fn surely_not_have(
399402
&self,
400403
_key_range: (Bound<Vec<u8>>, Bound<Vec<u8>>),
@@ -799,14 +802,26 @@ pub mod boxed_state_store {
799802

800803
// For LocalStateStore
801804

805+
#[async_trait::async_trait]
802806
pub trait DynamicDispatchedLocalStateStore:
803807
DynamicDispatchedStateStoreRead + DynamicDispatchedStateStoreWrite
804808
{
809+
async fn surely_not_have(
810+
&self,
811+
key_range: (Bound<Vec<u8>>, Bound<Vec<u8>>),
812+
read_options: ReadOptions,
813+
) -> StorageResult<bool>;
805814
}
806815

807-
impl<S: DynamicDispatchedStateStoreRead + DynamicDispatchedStateStoreWrite>
808-
DynamicDispatchedLocalStateStore for S
809-
{
816+
#[async_trait::async_trait]
817+
impl<S: LocalStateStore> DynamicDispatchedLocalStateStore for S {
818+
async fn surely_not_have(
819+
&self,
820+
key_range: (Bound<Vec<u8>>, Bound<Vec<u8>>),
821+
read_options: ReadOptions,
822+
) -> StorageResult<bool> {
823+
self.surely_not_have(key_range, read_options).await
824+
}
810825
}
811826

812827
pub type BoxDynamicDispatchedLocalStateStore = Box<dyn DynamicDispatchedLocalStateStore>;
@@ -819,10 +834,10 @@ pub mod boxed_state_store {
819834

820835
fn surely_not_have(
821836
&self,
822-
_key_range: (Bound<Vec<u8>>, Bound<Vec<u8>>),
823-
_read_options: ReadOptions,
837+
key_range: (Bound<Vec<u8>>, Bound<Vec<u8>>),
838+
read_options: ReadOptions,
824839
) -> Self::SurelyNotHaveFuture<'_> {
825-
async move { Ok(false) }
840+
self.deref().surely_not_have(key_range, read_options)
826841
}
827842
}
828843

0 commit comments

Comments
 (0)