Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disk index: add stat: disk_index_failed_resizes #31039

Merged
merged 1 commit into from
Apr 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions bucket_map/src/bucket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,14 +443,15 @@ impl<'b, T: Clone + Copy + 'static> Bucket<T> {
}
let mut m = Measure::start("grow_index");
//debug!("GROW_INDEX: {}", current_capacity_pow2);
let increment = 1;
for i in increment.. {
let mut count = 0;
loop {
count += 1;
let mut index = BucketStorage::new_with_capacity(
Arc::clone(&self.drives),
1,
std::mem::size_of::<IndexEntry<T>>() as u64,
// the subtle `+ i` here causes us to grow from the starting size by a power of 2 on each iteration of the for loop
Capacity::Pow2(starting_size_pow2 + i),
Capacity::Pow2(starting_size_pow2 + count),
self.index.max_search,
Arc::clone(&self.stats.index),
Arc::clone(&self.index.count),
Expand Down Expand Up @@ -487,6 +488,12 @@ impl<'b, T: Clone + Copy + 'static> Bucket<T> {
}
}
m.stop();
if count > 1 {
self.stats
.index
.failed_resizes
.fetch_add(count as u64 - 1, Ordering::Relaxed);
}
self.stats.index.resizes.fetch_add(1, Ordering::Relaxed);
self.stats
.index
Expand Down
1 change: 1 addition & 0 deletions bucket_map/src/bucket_stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use std::sync::{
#[derive(Debug, Default)]
pub struct BucketStats {
pub resizes: AtomicU64,
pub failed_resizes: AtomicU64,
pub max_size: AtomicU64,
pub resize_us: AtomicU64,
pub new_file_us: AtomicU64,
Expand Down
6 changes: 6 additions & 0 deletions runtime/src/bucket_map_holder_stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,12 @@ impl BucketMapHolderStats {
.unwrap_or_default(),
i64
),
(
"disk_index_failed_resizes",
disk.map(|disk| disk.stats.index.failed_resizes.swap(0, Ordering::Relaxed))
.unwrap_or_default(),
i64
),
(
"disk_index_max_size",
disk.map(|disk| { disk.stats.index.max_size.swap(0, Ordering::Relaxed) })
Expand Down