Skip to content

Commit

Permalink
rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
Liang Zhao committed Mar 14, 2023
1 parent 8f0e610 commit 79d3d1c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions src/storage/src/hummock/compactor/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl SstableStreamIterator {
if self
.sstable_info
.get_table_ids()
.binary_search(&FullKey::decode(block_iter.key()).user_key.table_id.table_id)
.binary_search(&block_iter.key().user_key.table_id.table_id)
.is_ok()
{
return Ok(());
Expand Down Expand Up @@ -246,7 +246,8 @@ impl ConcatSstableIterator {
seek_key: Option<FullKey<&[u8]>>,
) -> HummockResult<()> {
self.sstable_iter.take();
let seek_key: Option<FullKey<&[u8]>> = match (seek_key, self.key_range.left.is_empty()) {
let mut seek_key: Option<FullKey<&[u8]>> = match (seek_key, self.key_range.left.is_empty())
{
(Some(seek_key), false) => match seek_key.cmp(&FullKey::decode(&self.key_range.left)) {
Ordering::Less | Ordering::Equal => Some(FullKey::decode(&self.key_range.left)),
Ordering::Greater => Some(seek_key),
Expand Down Expand Up @@ -559,7 +560,9 @@ mod tests {
let block_1_second_key = iter.key().to_vec();
// Use a big enough seek key and result in invalid iterator.
let seek_key = test_key_of(30001);
iter.seek_idx(table_infos.len() - 1, Some(seek_key.to_ref())).await.unwrap();
iter.seek_idx(table_infos.len() - 1, Some(seek_key.to_ref()))
.await
.unwrap();
assert!(!iter.is_valid());

// Test seek_idx. Result is dominated by key range rather than given seek key.
Expand Down
4 changes: 2 additions & 2 deletions src/storage/src/hummock/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,13 +252,13 @@ pub async fn gen_test_sstable<B: AsRef<[u8]>>(
/// Generate a test table from the given `kv_iter` and put the kv value to `sstable_store`
pub async fn gen_test_sstable_and_info<B: AsRef<[u8]>>(
opts: SstableBuilderOptions,
sst_id: HummockSstableId,
object_id: HummockSstableObjectId,
kv_iter: impl Iterator<Item = (FullKey<B>, HummockValue<B>)>,
sstable_store: SstableStoreRef,
) -> (Sstable, SstableInfo) {
gen_test_sstable_inner(
opts,
sst_id,
object_id,
kv_iter,
vec![],
sstable_store,
Expand Down

0 comments on commit 79d3d1c

Please sign in to comment.