Skip to content

Commit

Permalink
Fixes metric for counting number of append vecs open as file io (#2085)
Browse files Browse the repository at this point in the history
  • Loading branch information
brooksprumo authored Jul 10, 2024
1 parent 53e839c commit 41dd942
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 2 additions & 3 deletions accounts-db/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ use {
},
append_vec::{
aligned_stored_size, APPEND_VEC_MMAPPED_FILES_DIRTY, APPEND_VEC_MMAPPED_FILES_OPEN,
APPEND_VEC_REOPEN_AS_FILE_IO, STORE_META_OVERHEAD,
APPEND_VEC_OPEN_AS_FILE_IO, STORE_META_OVERHEAD,
},
cache_hash_data::{CacheHashData, DeletionPolicy as CacheHashDeletionPolicy},
contains::Contains,
Expand Down Expand Up @@ -1113,7 +1113,6 @@ impl AccountStorageEntry {
return None;
}

APPEND_VEC_REOPEN_AS_FILE_IO.fetch_add(1, Ordering::Relaxed);
let count_and_status = self.count_and_status.lock_write();
self.accounts.reopen_as_readonly().map(|accounts| Self {
id: self.id,
Expand Down Expand Up @@ -1913,7 +1912,7 @@ impl LatestAccountsIndexRootsStats {
),
(
"append_vecs_open_as_file_io",
APPEND_VEC_REOPEN_AS_FILE_IO.load(Ordering::Relaxed),
APPEND_VEC_OPEN_AS_FILE_IO.load(Ordering::Relaxed),
i64
)
);
Expand Down
5 changes: 3 additions & 2 deletions accounts-db/src/append_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ const fn page_align(size: u64) -> u64 {
lazy_static! {
pub static ref APPEND_VEC_MMAPPED_FILES_OPEN: AtomicU64 = AtomicU64::default();
pub static ref APPEND_VEC_MMAPPED_FILES_DIRTY: AtomicU64 = AtomicU64::default();
pub static ref APPEND_VEC_REOPEN_AS_FILE_IO: AtomicU64 = AtomicU64::default();
pub static ref APPEND_VEC_OPEN_AS_FILE_IO: AtomicU64 = AtomicU64::default();
}

impl Drop for AppendVec {
Expand All @@ -298,7 +298,7 @@ impl Drop for AppendVec {
}
}
AppendVecFileBacking::File(_) => {
APPEND_VEC_REOPEN_AS_FILE_IO.fetch_sub(1, Ordering::Relaxed);
APPEND_VEC_OPEN_AS_FILE_IO.fetch_sub(1, Ordering::Relaxed);
}
}
if self.remove_file_on_drop.load(Ordering::Acquire) {
Expand Down Expand Up @@ -503,6 +503,7 @@ impl AppendVec {
// we must use mmap on non-linux
if storage_access == StorageAccess::File {
APPEND_VEC_MMAPPED_FILES_OPEN.fetch_add(1, Ordering::Relaxed);
APPEND_VEC_OPEN_AS_FILE_IO.fetch_add(1, Ordering::Relaxed);

return Ok(AppendVec {
path,
Expand Down

0 comments on commit 41dd942

Please sign in to comment.