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() {
|
for slot in diff.iter() {
|
||||||
if **slot > root {
|
if **slot > root {
|
||||||
let _ = self.add_snapshot(**slot, root);
|
let _ = self.add_snapshot(**slot, root);
|
||||||
} else if **slot > 0 {
|
} else {
|
||||||
BankForks::remove_snapshot(**slot, &self.snapshot_path);
|
BankForks::remove_snapshot(**slot, &self.snapshot_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -410,8 +410,10 @@ while true; do
|
||||||
(
|
(
|
||||||
set -x
|
set -x
|
||||||
$rsync -qvPr "${rsync_entrypoint_url:?}"/config/ledger "$SOLANA_RSYNC_CONFIG_DIR"
|
$rsync -qvPr "${rsync_entrypoint_url:?}"/config/ledger "$SOLANA_RSYNC_CONFIG_DIR"
|
||||||
$rsync -vqPr "${rsync_entrypoint_url:?}"/config/snapshots "$SOLANA_RSYNC_CONFIG_DIR"
|
$rsync -qvPr "${rsync_entrypoint_url:?}"/config/snapshot_dir "$SOLANA_RSYNC_CONFIG_DIR"
|
||||||
$rsync -vqPr "${rsync_entrypoint_url:?}"/config/accounts "$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
|
) || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -470,6 +472,7 @@ while true; do
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $node_type = bootstrap_leader ]]; then
|
if [[ $node_type = bootstrap_leader ]]; then
|
||||||
|
snapshot_dir=0
|
||||||
secs_to_next_sync_poll=30
|
secs_to_next_sync_poll=30
|
||||||
while true; do
|
while true; do
|
||||||
if ! kill -0 "$pid"; then
|
if ! kill -0 "$pid"; then
|
||||||
|
@ -482,11 +485,15 @@ while true; do
|
||||||
((secs_to_next_sync_poll--)) && continue
|
((secs_to_next_sync_poll--)) && continue
|
||||||
(
|
(
|
||||||
if [[ -d $snapshot_config_dir ]]; then
|
if [[ -d $snapshot_config_dir ]]; then
|
||||||
$rsync -qrt --delete-after "$snapshot_config_dir"/ "$SOLANA_RSYNC_CONFIG_DIR"/snapshots
|
current_config_dir="$SOLANA_RSYNC_CONFIG_DIR"/$snapshot_dir
|
||||||
$rsync -qrt --delete-after "$accounts_config_dir"/ "$SOLANA_RSYNC_CONFIG_DIR"/accounts
|
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
|
fi
|
||||||
) || true
|
) || true
|
||||||
secs_to_next_sync_poll=60
|
secs_to_next_sync_poll=60
|
||||||
|
snapshot_dir=$((snapshot_dir+1))
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
secs_to_next_genesis_poll=1
|
secs_to_next_genesis_poll=1
|
||||||
|
|
|
@ -22,7 +22,6 @@ use std::collections::{HashMap, HashSet};
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::fs::remove_dir_all;
|
use std::fs::remove_dir_all;
|
||||||
use std::io::{BufReader, Read};
|
use std::io::{BufReader, Read};
|
||||||
use std::iter::once;
|
|
||||||
use std::ops::Neg;
|
use std::ops::Neg;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||||
|
|
|
@ -39,7 +39,7 @@ use std::sync::atomic::{AtomicUsize, Ordering};
|
||||||
use std::sync::{Arc, RwLock};
|
use std::sync::{Arc, RwLock};
|
||||||
use sys_info;
|
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";
|
const ACCOUNT_DATA_FILE: &str = "data";
|
||||||
pub const NUM_THREADS: u32 = 10;
|
pub const NUM_THREADS: u32 = 10;
|
||||||
|
|
||||||
|
@ -340,8 +340,9 @@ impl AccountsDB {
|
||||||
let union = index.roots.union(&accounts_index.roots);
|
let union = index.roots.union(&accounts_index.roots);
|
||||||
index.roots = union.cloned().collect();
|
index.roots = union.cloned().collect();
|
||||||
index.last_root = accounts_index.last_root;
|
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
|
self.next_id
|
||||||
.store(ids[ids.len() - 1] + 1, Ordering::Relaxed);
|
.store(ids[ids.len() - 1] + 1, Ordering::Relaxed);
|
||||||
self.write_version.store(version, Ordering::Relaxed);
|
self.write_version.store(version, Ordering::Relaxed);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
//! already been signed and verified.
|
//! already been signed and verified.
|
||||||
use crate::accounts::Accounts;
|
use crate::accounts::Accounts;
|
||||||
use crate::accounts_db::{
|
use crate::accounts_db::{
|
||||||
AccountsDB, ErrorCounters, InstructionAccounts, InstructionCredits, InstructionLoaders,
|
ErrorCounters, InstructionAccounts, InstructionCredits, InstructionLoaders,
|
||||||
};
|
};
|
||||||
use crate::accounts_index::Fork;
|
use crate::accounts_index::Fork;
|
||||||
use crate::blockhash_queue::BlockhashQueue;
|
use crate::blockhash_queue::BlockhashQueue;
|
||||||
|
|
Loading…
Reference in New Issue