Skip to content

Commit

Permalink
refactor: remove OrderedMergeIterator (#14572)
Browse files Browse the repository at this point in the history
  • Loading branch information
hzxa21 authored Jan 16, 2024
1 parent 84c9a08 commit 0a57811
Show file tree
Hide file tree
Showing 15 changed files with 463 additions and 769 deletions.
7 changes: 3 additions & 4 deletions src/storage/benches/bench_compactor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ use risingwave_storage::hummock::compactor::{
ConcatSstableIterator, DummyCompactionFilter, TaskConfig, TaskProgress,
};
use risingwave_storage::hummock::iterator::{
ConcatIterator, Forward, ForwardMergeRangeIterator, HummockIterator,
UnorderedMergeIteratorInner,
ConcatIterator, Forward, ForwardMergeRangeIterator, HummockIterator, MergeIterator,
};
use risingwave_storage::hummock::multi_builder::{
CapacitySplitTableBuilder, LocalTableBuilderFactory,
Expand Down Expand Up @@ -239,7 +238,7 @@ fn bench_merge_iterator_compactor(c: &mut Criterion) {
ConcatIterator::new(level1.clone(), sstable_store.clone(), read_options.clone()),
ConcatIterator::new(level2.clone(), sstable_store.clone(), read_options.clone()),
];
let iter = UnorderedMergeIteratorInner::for_compactor(sub_iters);
let iter = MergeIterator::for_compactor(sub_iters);
async move { compact(iter, sstable_store1).await }
});
});
Expand All @@ -263,7 +262,7 @@ fn bench_merge_iterator_compactor(c: &mut Criterion) {
0,
),
];
let iter = UnorderedMergeIteratorInner::for_compactor(sub_iters);
let iter = MergeIterator::for_compactor(sub_iters);
let sstable_store1 = sstable_store.clone();
async move { compact(iter, sstable_store1).await }
});
Expand Down
41 changes: 6 additions & 35 deletions src/storage/benches/bench_merge_iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
use futures::executor::block_on;
use risingwave_hummock_sdk::key::TableKey;
use risingwave_storage::hummock::iterator::{
Forward, HummockIterator, HummockIteratorUnion, OrderedMergeIteratorInner,
SkipWatermarkIterator, UnorderedMergeIteratorInner,
Forward, HummockIterator, HummockIteratorUnion, MergeIterator, SkipWatermarkIterator,
};
use risingwave_storage::hummock::shared_buffer::shared_buffer_batch::{
SharedBufferBatch, SharedBufferBatchIterator,
Expand Down Expand Up @@ -97,23 +96,9 @@ fn run_iter<I: HummockIterator<Direction = Forward>>(iter_ref: &RefCell<I>, tota
}

fn criterion_benchmark(c: &mut Criterion) {
let ordered_merge_iter = RefCell::new(OrderedMergeIteratorInner::new(
gen_interleave_shared_buffer_batch_iter(10000, 100),
));

c.bench_with_input(
BenchmarkId::new("bench-merge-iter", "ordered"),
&ordered_merge_iter,
|b, iter_ref| {
b.iter(|| {
run_iter(iter_ref, 100 * 10000);
});
},
);

let merge_iter = RefCell::new(UnorderedMergeIteratorInner::new(
gen_interleave_shared_buffer_batch_iter(10000, 100),
));
let merge_iter = RefCell::new(MergeIterator::new(gen_interleave_shared_buffer_batch_iter(
10000, 100,
)));
c.bench_with_input(
BenchmarkId::new("bench-merge-iter", "unordered"),
&merge_iter,
Expand All @@ -125,7 +110,7 @@ fn criterion_benchmark(c: &mut Criterion) {
);

let merge_iter = RefCell::new(SkipWatermarkIterator::new(
UnorderedMergeIteratorInner::new(gen_interleave_shared_buffer_batch_iter(10000, 100)),
MergeIterator::new(gen_interleave_shared_buffer_batch_iter(10000, 100)),
BTreeMap::new(),
));
c.bench_with_input(
Expand All @@ -138,7 +123,7 @@ fn criterion_benchmark(c: &mut Criterion) {
},
);

let merge_iter = RefCell::new(UnorderedMergeIteratorInner::new(
let merge_iter = RefCell::new(MergeIterator::new(
gen_interleave_shared_buffer_batch_enum_iter(10000, 100),
));
c.bench_with_input(
Expand All @@ -150,20 +135,6 @@ fn criterion_benchmark(c: &mut Criterion) {
});
},
);

let ordered_merge_iter = RefCell::new(OrderedMergeIteratorInner::new(
gen_interleave_shared_buffer_batch_enum_iter(10000, 100),
));

c.bench_with_input(
BenchmarkId::new("bench-enum-merge-iter", "ordered"),
&ordered_merge_iter,
|b, iter_ref| {
b.iter(|| {
run_iter(iter_ref, 100 * 10000);
});
},
);
}

criterion_group!(benches, criterion_benchmark);
Expand Down
Loading

0 comments on commit 0a57811

Please sign in to comment.