Skip to content

Commit

Permalink
fix format
Browse files Browse the repository at this point in the history
Signed-off-by: Little-Wallace <[email protected]>
  • Loading branch information
Little-Wallace committed Jan 11, 2024
1 parent 3bf8a33 commit b38d9e3
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 28 deletions.
63 changes: 37 additions & 26 deletions src/storage/src/hummock/compactor/compactor_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -886,12 +886,10 @@ where
// delete key to represent this.
iter_key.epoch_with_gap =
EpochWithGap::new_from_epoch(earliest_range_delete_which_can_see_iter_key);
if !compaction_filter.should_delete(iter_key) {
sst_builder
.add_full_key(iter_key, HummockValue::Delete, is_new_user_key)
.verbose_instrument_await("add_full_key_delete")
.await?;
}
sst_builder
.add_full_key(iter_key, HummockValue::Delete, is_new_user_key)
.verbose_instrument_await("add_full_key_delete")
.await?;
last_table_stats.total_key_count += 1;
last_table_stats.total_key_size += iter_key.encoded_len() as i64;
last_table_stats.total_value_size += 1;
Expand Down Expand Up @@ -971,6 +969,7 @@ mod tests {
use std::collections::{HashSet, VecDeque};

use risingwave_common::catalog::TableId;
use risingwave_hummock_sdk::key::{TableKey, UserKey};
use risingwave_hummock_sdk::prost_key_range::KeyRangeExt;
use risingwave_pb::hummock::{InputLevel, PbKeyRange};

Expand All @@ -989,41 +988,53 @@ mod tests {
async fn test_delete_range_aggregator_with_filter() {
let sstable_store = mock_sstable_store();
let kv_pairs = vec![];
let range_tombstones = vec![
DeleteRangeTombstone::new_for_test(
TableId::new(1),
b"abc".to_vec(),
b"cde".to_vec(),
1,
),
DeleteRangeTombstone::new_for_test(
TableId::new(2),
b"abc".to_vec(),
b"def".to_vec(),
1,
),
];

let mut sstable_info_1 = gen_test_sstable_impl::<Bytes, Xor16FilterBuilder>(
default_builder_opt_for_test(),
1,
kv_pairs.clone().into_iter(),
range_tombstones.clone(),
vec![
DeleteRangeTombstone::new_for_test(
TableId::new(1),
b"abc".to_vec(),
b"ccc".to_vec(),
2,
),
DeleteRangeTombstone::new_for_test(
TableId::new(1),
b"ddd".to_vec(),
b"eee".to_vec(),
2,
),
],
sstable_store.clone(),
CachePolicy::NotFill,
)
.await;
sstable_info_1.table_ids = vec![1];

let tombstone = DeleteRangeTombstone::new_for_test(
TableId::new(2),
b"abc".to_vec(),
b"def".to_vec(),
1,
);
let mut sstable_info_2 = gen_test_sstable_impl::<Bytes, Xor16FilterBuilder>(
default_builder_opt_for_test(),
2,
kv_pairs.into_iter(),
range_tombstones.clone(),
vec![(
FullKey::from_user_key(
UserKey::new(TableId::new(1), TableKey(Bytes::copy_from_slice(b"bbb"))),
1,
),
HummockValue::put(Bytes::copy_from_slice(b"value")),
)]
.into_iter(),
vec![tombstone.clone()],
sstable_store.clone(),
CachePolicy::NotFill,
)
.await;
sstable_info_2.table_ids = vec![2];
sstable_info_2.table_ids = vec![1, 2];

let compact_task = CompactTask {
input_ssts: vec![InputLevel {
Expand Down Expand Up @@ -1075,7 +1086,7 @@ mod tests {
.unwrap();
ret.append(&mut sst.value().meta.monotonic_tombstone_events.clone());
}
let expected_result = create_monotonic_events(vec![range_tombstones[1].clone()]);
let expected_result = create_monotonic_events(vec![tombstone]);

assert_eq!(
ret, expected_result,
Expand Down
2 changes: 0 additions & 2 deletions src/storage/src/hummock/sstable/multi_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ where

/// Add kv pair to sstable.
pub async fn add_monotonic_delete(&mut self, event: MonotonicDeleteEvent) -> HummockResult<()> {
println!("add event key: {:?}, ", event);
if let Some(builder) = self.current_builder.as_mut()
&& builder.reach_capacity()
&& !is_max_epoch(event.new_epoch)
Expand All @@ -312,7 +311,6 @@ where

if self.current_builder.is_none() {
if is_max_epoch(event.new_epoch) {
println!("skip event key: {:?}, ", event);
return Ok(());
}

Expand Down

0 comments on commit b38d9e3

Please sign in to comment.