Skip to content

Commit

Permalink
remove read_filter_for_batch
Browse files Browse the repository at this point in the history
  • Loading branch information
hzxa21 committed Mar 5, 2024
1 parent 94487e7 commit 29901b9
Showing 1 changed file with 0 additions and 85 deletions.
85 changes: 0 additions & 85 deletions src/storage/src/hummock/store/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,91 +522,6 @@ impl HummockReadVersion {
}
}

// pub fn read_filter_for_batch(
// epoch: HummockEpoch, // for check
// table_id: TableId,
// mut key_range: TableKeyRange,
// read_version_vec: Vec<HummockReadVersionRef>,
// ) -> StorageResult<(TableKeyRange, ReadVersionTuple)> {
// assert!(!read_version_vec.is_empty());
// let mut staging_vec = Vec::with_capacity(read_version_vec.len());
// let mut max_mce_version: Option<CommittedVersion> = None;
// let mut table_watermarks: Vec<ReadTableWatermark> = Vec::new();
// for read_version in &read_version_vec {
// let read_version_guard = read_version.read();

// let read_watermark = read_version_guard
// .table_watermarks
// .as_ref()
// .and_then(|watermarks| watermarks.rewrite_range_with_table_watermark(epoch, &mut key_range));

// if let Some(read_watermark) = read_watermark {
// table_watermarks.push(read_watermark);
// }

// let (imms, ssts) = {
// let (imm_iter, sst_iter) = read_version_guard
// .staging()
// .prune_overlap(epoch, table_id, &key_range);

// (
// imm_iter.cloned().collect_vec(),
// sst_iter.cloned().collect_vec(),
// )
// };

// staging_vec.push((imms, ssts));
// if let Some(version) = &max_mce_version {
// if read_version_guard.committed().max_committed_epoch() > version.max_committed_epoch()
// {
// max_mce_version = Some(read_version_guard.committed.clone());
// }
// } else {
// max_mce_version = Some(read_version_guard.committed.clone());
// }
// }

// let max_mce_version = max_mce_version.expect("should exist for once");

// let mut imm_vec = Vec::default();
// let mut sst_vec = Vec::default();
// let mut seen_imm_ids = HashSet::new();
// let mut seen_sst_ids = HashSet::new();

// // only filter the staging data that epoch greater than max_mce to avoid data duplication
// let (min_epoch, max_epoch) = (max_mce_version.max_committed_epoch(), epoch);
// // prune imm and sst with max_mce
// for (staging_imms, staging_ssts) in staging_vec {
// imm_vec.extend(staging_imms.into_iter().filter(|imm| {
// // There shouldn't be duplicated IMMs because merge imm only operates on a single shard.
// assert!(seen_imm_ids.insert(imm.batch_id()));
// imm.min_epoch() > min_epoch && imm.min_epoch() <= max_epoch
// }));

// sst_vec.extend(staging_ssts.into_iter().filter(|staging_sst| {
// assert!(
// staging_sst.get_max_epoch() <= min_epoch || staging_sst.get_min_epoch() > min_epoch
// );
// // Dedup staging SSTs in different shard. Duplicates can happen in the following case:
// // - Table 1 Shard 1 produces IMM 1
// // - Table 1 Shard 2 produces IMM 2
// // - IMM 1 and IMM 2 are compacted into SST 1 as a Staging SST
// // - SST 1 is added to both Shard 1's and Shard 2's read version
// staging_sst.min_epoch > min_epoch && seen_sst_ids.insert(staging_sst.object_id)
// }));
// }

// Ok((
// key_range,
// (
// imm_vec,
// sst_vec,
// max_mce_version,
// ReadTableWatermark::merge_multiple(table_watermarks),
// ),
// ))
// }

pub fn read_filter_for_version(
epoch: HummockEpoch,
table_id: TableId,
Expand Down

0 comments on commit 29901b9

Please sign in to comment.