Constrain memory ordering on AccountsDb::write_version (#21312)
This commit is contained in:
parent
6546c3cbae
commit
c3e5927d16
@ -4391,7 +4391,7 @@ impl AccountsDb {
|
||||
|
||||
fn bulk_assign_write_version(&self, count: usize) -> StoredMetaWriteVersion {
|
||||
self.write_version
|
||||
.fetch_add(count as StoredMetaWriteVersion, Ordering::Relaxed)
|
||||
.fetch_add(count as StoredMetaWriteVersion, Ordering::AcqRel)
|
||||
}
|
||||
|
||||
fn write_accounts_to_storage<F: FnMut(Slot, usize) -> Arc<AccountStorageEntry>>(
|
||||
@ -9193,8 +9193,8 @@ pub mod tests {
|
||||
let daccounts = reconstruct_accounts_db_via_serialization(&accounts, latest_slot);
|
||||
|
||||
assert_eq!(
|
||||
daccounts.write_version.load(Ordering::Relaxed),
|
||||
accounts.write_version.load(Ordering::Relaxed)
|
||||
daccounts.write_version.load(Ordering::Acquire),
|
||||
accounts.write_version.load(Ordering::Acquire)
|
||||
);
|
||||
|
||||
// Get the hash for the latest slot, which should be the only hash in the
|
||||
|
@ -536,7 +536,7 @@ where
|
||||
.store(next_append_vec_id, Ordering::Relaxed);
|
||||
accounts_db
|
||||
.write_version
|
||||
.fetch_add(snapshot_version, Ordering::Relaxed);
|
||||
.fetch_add(snapshot_version, Ordering::Release);
|
||||
|
||||
let mut measure_notify = Measure::start("accounts_notify");
|
||||
|
||||
|
@ -242,7 +242,7 @@ impl<'a> TypeContext<'a> for Context {
|
||||
let version = serializable_db
|
||||
.accounts_db
|
||||
.write_version
|
||||
.load(Ordering::Relaxed);
|
||||
.load(Ordering::Acquire);
|
||||
|
||||
// (1st of 3 elements) write the list of account storage entry lists out as a map
|
||||
let entry_count = RefCell::<usize>::new(0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user