Skip to content

Commit

Permalink
fix(storage): assert no read version in reset
Browse files Browse the repository at this point in the history
  • Loading branch information
wenym1 committed Jan 30, 2024
1 parent 63e5485 commit 93caf5a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
11 changes: 8 additions & 3 deletions src/storage/src/hummock/event_handler/hummock_event_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use std::sync::Arc;

use arc_swap::ArcSwap;
use await_tree::InstrumentAwait;
use itertools::Itertools;
use parking_lot::RwLock;
use prometheus::core::{AtomicU64, GenericGauge};
use risingwave_hummock_sdk::{HummockEpoch, LocalSstableInfo};
Expand Down Expand Up @@ -401,6 +402,7 @@ impl HummockEventHandler {
self.uploader.max_synced_epoch(),
self.uploader.max_sealed_epoch(),
);

self.uploader.clear();

for (epoch, result_sender) in self.pending_sync_requests.extract_if(|_, _| true) {
Expand All @@ -414,9 +416,12 @@ impl HummockEventHandler {
}

{
Self::for_each_read_version(&self.read_version_mapping, |read_version| {
read_version.clear_uncommitted()
});
let mapping = self.read_version_mapping.read();
assert!(
mapping.is_empty(),
"read version mapping not empty when clear. remaining tables: {:?}",
mapping.keys().collect_vec()
);
}

if let Some(sstable_object_id_manager) = &self.sstable_object_id_manager {
Expand Down
10 changes: 0 additions & 10 deletions src/storage/src/hummock/store/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,16 +405,6 @@ impl HummockReadVersion {
}
}

pub fn clear_uncommitted(&mut self) {
self.staging.imm.clear();
self.staging.sst.clear();
self.table_watermarks = self
.committed
.table_watermark_index()
.get(&self.table_id)
.cloned()
}

pub fn add_merged_imm(&mut self, merged_imm: ImmutableMemtable) {
assert!(merged_imm.get_imm_ids().iter().rev().is_sorted());
let min_imm_id = *merged_imm.get_imm_ids().last().expect("non-empty");
Expand Down

0 comments on commit 93caf5a

Please sign in to comment.