AcctIdx: consolidate next_id calls (#21929)
This commit is contained in:
committed by
GitHub
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 {
|
fn new_storage_entry(&self, slot: Slot, path: &Path, size: u64) -> AccountStorageEntry {
|
||||||
AccountStorageEntry::new(
|
AccountStorageEntry::new(path, slot, self.next_id(), size)
|
||||||
path,
|
|
||||||
slot,
|
|
||||||
self.next_id.fetch_add(1, Ordering::AcqRel),
|
|
||||||
size,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn expected_cluster_type(&self) -> ClusterType {
|
pub fn expected_cluster_type(&self) -> ClusterType {
|
||||||
@ -3732,7 +3733,7 @@ impl AccountsDb {
|
|||||||
let ret = recycle_stores.remove_entry(i);
|
let ret = recycle_stores.remove_entry(i);
|
||||||
drop(recycle_stores);
|
drop(recycle_stores);
|
||||||
let old_id = ret.append_vec_id();
|
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!(
|
debug!(
|
||||||
"recycling store: {} {:?} old_id: {}",
|
"recycling store: {} {:?} old_id: {}",
|
||||||
ret.append_vec_id(),
|
ret.append_vec_id(),
|
||||||
|
Reference in New Issue
Block a user