AcctIdx: consolidate next_id calls (#21929)
This commit is contained in:
parent
882f886450
commit
e5be96d8bf
|
@ -1714,13 +1714,14 @@ impl AccountsDb {
|
|||
}
|
||||
}
|
||||
|
||||
fn next_id(&self) -> AppendVecId {
|
||||
let next_id = self.next_id.fetch_add(1, Ordering::AcqRel);
|
||||
assert!(next_id != AppendVecId::MAX, "We've run out of storage ids!");
|
||||
next_id
|
||||
}
|
||||
|
||||
fn new_storage_entry(&self, slot: Slot, path: &Path, size: u64) -> AccountStorageEntry {
|
||||
AccountStorageEntry::new(
|
||||
path,
|
||||
slot,
|
||||
self.next_id.fetch_add(1, Ordering::AcqRel),
|
||||
size,
|
||||
)
|
||||
AccountStorageEntry::new(path, slot, self.next_id(), size)
|
||||
}
|
||||
|
||||
pub fn expected_cluster_type(&self) -> ClusterType {
|
||||
|
@ -3732,7 +3733,7 @@ impl AccountsDb {
|
|||
let ret = recycle_stores.remove_entry(i);
|
||||
drop(recycle_stores);
|
||||
let old_id = ret.append_vec_id();
|
||||
ret.recycle(slot, self.next_id.fetch_add(1, Ordering::AcqRel));
|
||||
ret.recycle(slot, self.next_id());
|
||||
debug!(
|
||||
"recycling store: {} {:?} old_id: {}",
|
||||
ret.append_vec_id(),
|
||||
|
|
Loading…
Reference in New Issue