AcctIdx: misc cleanup (#20398)
This commit is contained in:
parent
8da2eb980a
commit
cbf427228c
|
@ -201,7 +201,6 @@ impl<T: Clone + Copy> Bucket<T> {
|
||||||
let best_fit_bucket = IndexEntry::data_bucket_from_num_slots(data.len() as u64);
|
let best_fit_bucket = IndexEntry::data_bucket_from_num_slots(data.len() as u64);
|
||||||
if self.data.get(best_fit_bucket as usize).is_none() {
|
if self.data.get(best_fit_bucket as usize).is_none() {
|
||||||
// fail early if the data bucket we need doesn't exist - we don't want the index entry partially allocated
|
// fail early if the data bucket we need doesn't exist - we don't want the index entry partially allocated
|
||||||
//error!("resizing because missing bucket");
|
|
||||||
return Err(BucketMapError::DataNoSpace((best_fit_bucket, 0)));
|
return Err(BucketMapError::DataNoSpace((best_fit_bucket, 0)));
|
||||||
}
|
}
|
||||||
let index_entry = self.find_entry_mut(key);
|
let index_entry = self.find_entry_mut(key);
|
||||||
|
@ -276,7 +275,7 @@ impl<T: Clone + Copy> Bucket<T> {
|
||||||
|
|
||||||
pub fn grow_index(&mut self, sz: u8) {
|
pub fn grow_index(&mut self, sz: u8) {
|
||||||
if self.index.capacity_pow2 == sz {
|
if self.index.capacity_pow2 == sz {
|
||||||
let mut m = Measure::start("");
|
let mut m = Measure::start("grow_index");
|
||||||
//debug!("GROW_INDEX: {}", sz);
|
//debug!("GROW_INDEX: {}", sz);
|
||||||
let increment = 1;
|
let increment = 1;
|
||||||
for i in increment.. {
|
for i in increment.. {
|
||||||
|
|
|
@ -85,10 +85,10 @@ impl BucketStorage {
|
||||||
elem_size: u64,
|
elem_size: u64,
|
||||||
capacity_pow2: u8,
|
capacity_pow2: u8,
|
||||||
max_search: MaxSearch,
|
max_search: MaxSearch,
|
||||||
mut stats: Arc<BucketStats>,
|
stats: Arc<BucketStats>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let cell_size = elem_size * num_elems + std::mem::size_of::<Header>() as u64;
|
let cell_size = elem_size * num_elems + std::mem::size_of::<Header>() as u64;
|
||||||
let (mmap, path) = Self::new_map(&drives, cell_size as usize, capacity_pow2, &mut stats);
|
let (mmap, path) = Self::new_map(&drives, cell_size as usize, capacity_pow2, &stats);
|
||||||
Self {
|
Self {
|
||||||
path,
|
path,
|
||||||
mmap,
|
mmap,
|
||||||
|
@ -249,7 +249,7 @@ impl BucketStorage {
|
||||||
drives: &[PathBuf],
|
drives: &[PathBuf],
|
||||||
cell_size: usize,
|
cell_size: usize,
|
||||||
capacity_pow2: u8,
|
capacity_pow2: u8,
|
||||||
stats: &mut Arc<BucketStats>,
|
stats: &BucketStats,
|
||||||
) -> (MmapMut, PathBuf) {
|
) -> (MmapMut, PathBuf) {
|
||||||
let mut measure_new_file = Measure::start("measure_new_file");
|
let mut measure_new_file = Measure::start("measure_new_file");
|
||||||
let capacity = 1u64 << capacity_pow2;
|
let capacity = 1u64 << capacity_pow2;
|
||||||
|
@ -311,7 +311,7 @@ impl BucketStorage {
|
||||||
&self.drives,
|
&self.drives,
|
||||||
self.cell_size as usize,
|
self.cell_size as usize,
|
||||||
self.capacity_pow2 + increment,
|
self.capacity_pow2 + increment,
|
||||||
&mut self.stats,
|
&self.stats,
|
||||||
);
|
);
|
||||||
(0..old_cap as usize).into_iter().for_each(|i| {
|
(0..old_cap as usize).into_iter().for_each(|i| {
|
||||||
let old_ix = i * self.cell_size as usize;
|
let old_ix = i * self.cell_size as usize;
|
||||||
|
|
Loading…
Reference in New Issue