diff --git a/core/src/bank_forks.rs b/core/src/bank_forks.rs index 36506dbf1..489d70709 100644 --- a/core/src/bank_forks.rs +++ b/core/src/bank_forks.rs @@ -166,7 +166,7 @@ impl BankForks { for slot in diff.iter() { if **slot > root { let _ = self.add_snapshot(**slot, root); - } else if **slot > 0 { + } else { BankForks::remove_snapshot(**slot, &self.snapshot_path); } } diff --git a/multinode-demo/fullnode.sh b/multinode-demo/fullnode.sh index 68f212970..9ab96f4e6 100755 --- a/multinode-demo/fullnode.sh +++ b/multinode-demo/fullnode.sh @@ -410,8 +410,10 @@ while true; do ( set -x $rsync -qvPr "${rsync_entrypoint_url:?}"/config/ledger "$SOLANA_RSYNC_CONFIG_DIR" - $rsync -vqPr "${rsync_entrypoint_url:?}"/config/snapshots "$SOLANA_RSYNC_CONFIG_DIR" - $rsync -vqPr "${rsync_entrypoint_url:?}"/config/accounts "$SOLANA_RSYNC_CONFIG_DIR" + $rsync -qvPr "${rsync_entrypoint_url:?}"/config/snapshot_dir "$SOLANA_RSYNC_CONFIG_DIR" + current_snapshot_dir=$(cat "$SOLANA_RSYNC_CONFIG_DIR"/snapshot_dir) + $rsync -vqPr "${rsync_entrypoint_url:?}"/config/"$current_snapshot_dir"/snapshots "$SOLANA_RSYNC_CONFIG_DIR" + $rsync -vqPr "${rsync_entrypoint_url:?}"/config/"$current_snapshot_dir"/accounts "$SOLANA_RSYNC_CONFIG_DIR" ) || true fi @@ -470,6 +472,7 @@ while true; do fi if [[ $node_type = bootstrap_leader ]]; then + snapshot_dir=0 secs_to_next_sync_poll=30 while true; do if ! kill -0 "$pid"; then @@ -482,11 +485,15 @@ while true; do ((secs_to_next_sync_poll--)) && continue ( if [[ -d $snapshot_config_dir ]]; then - $rsync -qrt --delete-after "$snapshot_config_dir"/ "$SOLANA_RSYNC_CONFIG_DIR"/snapshots - $rsync -qrt --delete-after "$accounts_config_dir"/ "$SOLANA_RSYNC_CONFIG_DIR"/accounts + current_config_dir="$SOLANA_RSYNC_CONFIG_DIR"/$snapshot_dir + mkdir -p "$current_config_dir" + cp -a "$snapshot_config_dir"/ "$current_config_dir"/snapshots + cp -a "$accounts_config_dir"/ "$current_config_dir"/accounts + echo $snapshot_dir > "$SOLANA_RSYNC_CONFIG_DIR"/snapshot_dir fi ) || true secs_to_next_sync_poll=60 + snapshot_dir=$((snapshot_dir+1)) done else secs_to_next_genesis_poll=1 diff --git a/runtime/src/accounts.rs b/runtime/src/accounts.rs index 93fe57535..e9121723f 100644 --- a/runtime/src/accounts.rs +++ b/runtime/src/accounts.rs @@ -22,7 +22,6 @@ use std::collections::{HashMap, HashSet}; use std::env; use std::fs::remove_dir_all; use std::io::{BufReader, Read}; -use std::iter::once; use std::ops::Neg; use std::path::Path; use std::sync::atomic::{AtomicUsize, Ordering}; diff --git a/runtime/src/accounts_db.rs b/runtime/src/accounts_db.rs index 689e6f611..d22b626dd 100644 --- a/runtime/src/accounts_db.rs +++ b/runtime/src/accounts_db.rs @@ -39,7 +39,7 @@ use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::{Arc, RwLock}; use sys_info; -const ACCOUNT_DATA_FILE_SIZE: u64 = 64 * 1024 * 1024; +const ACCOUNT_DATA_FILE_SIZE: u64 = 16 * 1024 * 1024; const ACCOUNT_DATA_FILE: &str = "data"; pub const NUM_THREADS: u32 = 10; @@ -340,8 +340,9 @@ impl AccountsDB { let union = index.roots.union(&accounts_index.roots); index.roots = union.cloned().collect(); index.last_root = accounts_index.last_root; + let mut stores = self.storage.write().unwrap(); + stores.0.extend(storage.0); } - *self.storage.write().unwrap() = storage; self.next_id .store(ids[ids.len() - 1] + 1, Ordering::Relaxed); self.write_version.store(version, Ordering::Relaxed); diff --git a/runtime/src/bank.rs b/runtime/src/bank.rs index ece3eda0d..facfb1f04 100644 --- a/runtime/src/bank.rs +++ b/runtime/src/bank.rs @@ -4,7 +4,7 @@ //! already been signed and verified. use crate::accounts::Accounts; use crate::accounts_db::{ - AccountsDB, ErrorCounters, InstructionAccounts, InstructionCredits, InstructionLoaders, + ErrorCounters, InstructionAccounts, InstructionCredits, InstructionLoaders, }; use crate::accounts_index::Fork; use crate::blockhash_queue::BlockhashQueue;