Skip to content

Commit

Permalink
fix(storage): should use epoch with the maximum offset when get (#14607)
Browse files Browse the repository at this point in the history
  • Loading branch information
wcy-fdu authored and Little-Wallace committed Jan 20, 2024
1 parent d3ec6b9 commit 4581789
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/storage/src/hummock/store/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use bytes::Bytes;
use itertools::Itertools;
use parking_lot::RwLock;
use risingwave_common::catalog::TableId;
use risingwave_common::util::epoch::MAX_SPILL_TIMES;
use risingwave_hummock_sdk::key::{
bound_table_key_range, is_empty_key_range, FullKey, TableKey, TableKeyRange, UserKey,
};
Expand All @@ -31,7 +32,7 @@ use risingwave_hummock_sdk::table_watermark::{
ReadTableWatermark, TableWatermarksIndex, VnodeWatermark, WatermarkDirection,
};
use risingwave_hummock_sdk::version::HummockVersionDelta;
use risingwave_hummock_sdk::{HummockEpoch, LocalSstableInfo};
use risingwave_hummock_sdk::{EpochWithGap, HummockEpoch, LocalSstableInfo};
use risingwave_pb::hummock::{LevelType, SstableInfo};
use sync_point::sync_point;
use tracing::Instrument;
Expand Down Expand Up @@ -684,7 +685,13 @@ impl HummockVersionReader {
Sstable::hash_for_bloom_filter(dist_key.as_ref(), read_options.table_id.table_id())
});

let full_key = FullKey::new(read_options.table_id, TableKey(table_key.clone()), epoch);
// Here epoch passed in is pure epoch, and we will seek the constructed `full_key` later.
// Therefore, it is necessary to construct the `full_key` with `MAX_SPILL_TIMES`, otherwise, the iterator might skip keys with spill offset greater than 0.
let full_key = FullKey::new_with_gap_epoch(
read_options.table_id,
TableKey(table_key.clone()),
EpochWithGap::new(epoch, MAX_SPILL_TIMES),
);
for local_sst in &uncommitted_ssts {
local_stats.staging_sst_get_count += 1;
if let Some((data, data_epoch)) = get_from_sstable_info(
Expand Down

0 comments on commit 4581789

Please sign in to comment.