-
Notifications
You must be signed in to change notification settings - Fork 611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(storage): do not fetch all sst meta when create iterator #9517
fix(storage): do not fetch all sst meta when create iterator #9517
Conversation
Signed-off-by: Little-Wallace <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect.
src/storage/src/hummock/iterator/concat_delete_range_iterator.rs
Outdated
Show resolved
Hide resolved
Signed-off-by: Little-Wallace <[email protected]>
src/storage/src/hummock/iterator/concat_delete_range_iterator.rs
Outdated
Show resolved
Hide resolved
Signed-off-by: Little-Wallace <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems unnecessary
Signed-off-by: Little-Wallace <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
incorrect
src/storage/src/hummock/iterator/concat_delete_range_iterator.rs
Outdated
Show resolved
Hide resolved
Signed-off-by: Little-Wallace <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we can improve.
self.current.as_ref().unwrap().current_epoch() | ||
} | ||
|
||
fn next(&mut self) -> Self::NextFuture<'_> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In current implementation, after a next
call, next_extended_user_key
may stay invariant. Is this bad-taste?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But everywhere we call next_extended_user_key
would always collect all keys whose user-key equals
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But everywhere we call
next_extended_user_key
would always collect all keys whose user-key equals
In MergeIterator
, everywhere we call next_extended_user_key
would always collect all keys IN OTHER ITERATORS whose user-key equals, but except the iterator itself
Signed-off-by: Little-Wallace <[email protected]>
Signed-off-by: Little-Wallace <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm ok if self.current.take()
is in seek
, but it should then be in rewind
as well.
src/storage/src/hummock/iterator/concat_delete_range_iterator.rs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect.
src/storage/src/hummock/iterator/concat_delete_range_iterator.rs
Outdated
Show resolved
Hide resolved
Signed-off-by: Little-Wallace <[email protected]>
4e52aa1
to
a238b97
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
duplicate seek
Signed-off-by: Little-Wallace <[email protected]>
Signed-off-by: Little-Wallace <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as in comment
src/storage/src/hummock/iterator/concat_delete_range_iterator.rs
Outdated
Show resolved
Hide resolved
Signed-off-by: Little-Wallace <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because we have checked self.sstables[self.idx + 1].range_tombstone_count > 0
before
src/storage/src/hummock/iterator/concat_delete_range_iterator.rs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
incorrect
Signed-off-by: Little-Wallace <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the semantic of next_range_epoch()
does not match
src/storage/src/hummock/iterator/concat_delete_range_iterator.rs
Outdated
Show resolved
Hide resolved
Signed-off-by: Little-Wallace <[email protected]>
Signed-off-by: Little-Wallace <[email protected]>
Signed-off-by: Little-Wallace <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
incorrect
|
||
ord == Less || ord == Equal | ||
} | ||
DirectionEnum::Backward => { | ||
let ord = FullKey::decode(table.largest_key()).cmp(&key); | ||
|
||
let ord = FullKey::decode(largest_key(table)).cmp(&key); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If right key range is excluded, we will skip the key itself unexpectedly.
Signed-off-by: Little-Wallace <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the effort
// We would fill block to high priority cache for level-0 | ||
self.sstable_store | ||
.sstable_syncable(sstable_info, &local_stats) | ||
if sstables.len() > 1 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, we need some doc to explain that we remove hit_sstable_bloom_filter
when non_overlapping sstable.size() > 1. It may result in better code readability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, we need some doc to explain that we remove
hit_sstable_bloom_filter
when non_overlapping sstable.size() > 1. It may result in better code readability
+1
ord == Greater || ord == Equal | ||
let ord = FullKey::decode(largest_key(table)).cmp(&key); | ||
ord == Greater | ||
|| (ord == Equal && !table.key_range.as_ref().unwrap().right_exclusive) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic is easy to use wrongly, encapsulate it into a function or add more comments to explain it?
// We would fill block to high priority cache for level-0 | ||
self.sstable_store | ||
.sstable_syncable(sstable_info, &local_stats) | ||
if sstables.len() > 1 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, we need some doc to explain that we remove
hit_sstable_bloom_filter
when non_overlapping sstable.size() > 1. It may result in better code readability
+1
.prefetch(&self.sstable_store, &mut self.stats) | ||
let table = self | ||
.sstable_store | ||
.sstable(&self.tables[idx], &mut self.stats) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
random thought: we can prefetch the next sstable meta similar to the block prefetch in sstable iterator. not sure how much improvement we can get though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
random thought: we can prefetch the next sstable meta similar to the block prefetch in sstable iterator. not sure how much improvement we can get though
We can get more memory :rolling_on_the_floor_laughing:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
random thought: we can prefetch the next sstable meta similar to the block prefetch in sstable iterator. not sure how much improvement we can get though
We can get more memory :rolling_on_the_floor_laughing:
True. But it looks acceptable because the memory usage is proportional to number of levels, not number of SSTs, and we have very few levels.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But after we support meta-cache refill after compaction, the meta-cache miss rate is very low.
So it is not necessary to prefetch the next TableHolder for delete-range (
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
Checklist For Contributors
./risedev check
(or alias,./risedev c
)Checklist For Reviewers
Documentation
Click here for Documentation
Types of user-facing changes
Please keep the types that apply to your changes, and remove the others.
Release note