periodically save config in separate folders
This commit is contained in:
parent
07c183bb84
commit
8b41a5d725
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue