removes redundant Arcs from Blockstore (#23735)

This commit is contained in:
behzad nouri 2022-03-17 19:43:57 +00:00 committed by GitHub
parent 342f1ab1cb
commit 6b0d34d70d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 10 deletions

View File

@ -171,13 +171,13 @@ pub struct Blockstore {
block_height_cf: LedgerColumn<cf::BlockHeight>,
program_costs_cf: LedgerColumn<cf::ProgramCosts>,
bank_hash_cf: LedgerColumn<cf::BankHash>,
last_root: Arc<RwLock<Slot>>,
insert_shreds_lock: Arc<Mutex<()>>,
last_root: RwLock<Slot>,
insert_shreds_lock: Mutex<()>,
pub new_shreds_signals: Vec<Sender<bool>>,
pub completed_slots_senders: Vec<CompletedSlotsSender>,
pub lowest_cleanup_slot: Arc<RwLock<Slot>>,
pub lowest_cleanup_slot: RwLock<Slot>,
no_compaction: bool,
slots_stats: Arc<Mutex<SlotsStats>>,
slots_stats: Mutex<SlotsStats>,
advanced_options: BlockstoreAdvancedOptions,
}
@ -615,7 +615,7 @@ impl Blockstore {
.next()
.map(|(slot, _)| slot)
.unwrap_or(0);
let last_root = Arc::new(RwLock::new(max_root));
let last_root = RwLock::new(max_root);
// Get active transaction-status index or 0
let active_transaction_status_index = db
@ -659,11 +659,11 @@ impl Blockstore {
bank_hash_cf,
new_shreds_signals: vec![],
completed_slots_senders: vec![],
insert_shreds_lock: Arc::new(Mutex::new(())),
insert_shreds_lock: Mutex::<()>::default(),
last_root,
lowest_cleanup_slot: Arc::new(RwLock::new(0)),
lowest_cleanup_slot: RwLock::<Slot>::default(),
no_compaction: false,
slots_stats: Arc::new(Mutex::new(SlotsStats::default())),
slots_stats: Mutex::<SlotsStats>::default(),
advanced_options,
};
if initialize_transaction_status_index {
@ -2109,7 +2109,7 @@ impl Blockstore {
ticks_per_slot: u64,
parent: Option<u64>,
is_full_slot: bool,
keypair: &Arc<Keypair>,
keypair: &Keypair,
entries: Vec<Entry>,
version: u16,
) -> Result<usize /*num of data shreds*/> {
@ -3574,7 +3574,7 @@ impl Blockstore {
self.db.is_primary_access()
}
pub fn scan_and_fix_roots(&self, exit: &Arc<AtomicBool>) -> Result<()> {
pub fn scan_and_fix_roots(&self, exit: &AtomicBool) -> Result<()> {
let ancestor_iterator = AncestorIterator::new(self.last_root(), self)
.take_while(|&slot| slot >= self.lowest_cleanup_slot());