Skip to content

Commit

Permalink
retain() rather than remove()s -- doesnt change anything but nicer
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Nov 30, 2023
1 parent 2eb78ec commit b1cbd1e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion crates/re_arrow_store/benches/gc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ fn plotting_dashboard(c: &mut Criterion) {
enable_batching: false,
};

// NOTE: insert in multiple timelines to more closely match real world scenarios.
let mut timegen = |i| {
[
build_log_time(Time::from_seconds_since_epoch(i as _)),
Expand Down Expand Up @@ -275,7 +276,6 @@ where
(0..NUM_ROWS_PER_ENTITY_PATH).map(move |i| {
DataRow::from_component_batches(
RowId::random(),
// NOTE: insert in multiple timelines to more closely match real world scenarios.
timegen(i),
entity_path.clone(),
datagen(i)
Expand Down
10 changes: 4 additions & 6 deletions crates/re_arrow_store/src/store_gc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ impl IndexedTable {
let mut dropped_num_bytes = 0u64;
let mut dropped_num_rows = 0u64;

let mut dropped_bucket_times = Vec::new();
let mut dropped_bucket_times = HashSet::default();

// TODO(cmc): scaling linearly with the number of buckets could be improved, although this
// is quite fast in practice because of the early check.
Expand All @@ -681,7 +681,7 @@ impl IndexedTable {
..
} = std::mem::take(inner);

dropped_bucket_times.push(*bucket_time);
dropped_bucket_times.insert(*bucket_time);

while let Some(row_id) = col_row_id.pop_front() {
let mut diff = StoreDiff::deletion(row_id, ent_path.clone());
Expand Down Expand Up @@ -713,10 +713,8 @@ impl IndexedTable {
dropped_num_rows += col_time.len() as u64;
}

for bucket_time in dropped_bucket_times {
let previous = self.buckets.remove(&bucket_time);
debug_assert!(previous.is_some());
}
self.buckets
.retain(|bucket_time, _| !dropped_bucket_times.contains(bucket_time));

if self.buckets.is_empty() {
let Self {
Expand Down

0 comments on commit b1cbd1e

Please sign in to comment.