From 3af12a5a086aae0c775712e7aed16fdf4a9a6479 Mon Sep 17 00:00:00 2001 From: HaoranYi Date: Thu, 11 Jul 2024 20:19:22 +0000 Subject: [PATCH] don't scan and check when reopening mmap file --- accounts-db/src/append_vec.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/accounts-db/src/append_vec.rs b/accounts-db/src/append_vec.rs index 2b5241aaf5ad59..91bd70c5a9fab4 100644 --- a/accounts-db/src/append_vec.rs +++ b/accounts-db/src/append_vec.rs @@ -437,9 +437,14 @@ impl AppendVec { self.flush().expect("flush must succeed"); // we are re-opening the file, so don't remove the file on disk when the old mmapped one is dropped self.remove_file_on_drop.store(false, Ordering::Release); - AppendVec::new_from_file(self.path.clone(), self.len(), StorageAccess::File) - .ok() - .map(|(av, _size)| av) + + // The file should have already been sanitized. Don't need to check when we open the file again. + AppendVec::new_from_file_unchecked( + self.path.clone(), + self.len(), + StorageAccess::File, + ) + .ok() } } }