Add option to disable rocks compaction (#9011)
This commit is contained in:
parent
87096f13d2
commit
4d2b83d01f
|
@ -79,6 +79,7 @@ pub struct ValidatorConfig {
|
||||||
pub halt_on_trusted_validators_accounts_hash_mismatch: bool,
|
pub halt_on_trusted_validators_accounts_hash_mismatch: bool,
|
||||||
pub accounts_hash_fault_injection_slots: u64, // 0 = no fault injection
|
pub accounts_hash_fault_injection_slots: u64, // 0 = no fault injection
|
||||||
pub frozen_accounts: Vec<Pubkey>,
|
pub frozen_accounts: Vec<Pubkey>,
|
||||||
|
pub no_rocksdb_compaction: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for ValidatorConfig {
|
impl Default for ValidatorConfig {
|
||||||
|
@ -104,6 +105,7 @@ impl Default for ValidatorConfig {
|
||||||
halt_on_trusted_validators_accounts_hash_mismatch: false,
|
halt_on_trusted_validators_accounts_hash_mismatch: false,
|
||||||
accounts_hash_fault_injection_slots: 0,
|
accounts_hash_fault_injection_slots: 0,
|
||||||
frozen_accounts: vec![],
|
frozen_accounts: vec![],
|
||||||
|
no_rocksdb_compaction: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -589,8 +591,9 @@ fn new_banks_from_blockstore(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let (blockstore, ledger_signal_receiver, completed_slots_receiver) =
|
let (mut blockstore, ledger_signal_receiver, completed_slots_receiver) =
|
||||||
Blockstore::open_with_signal(blockstore_path).expect("Failed to open ledger database");
|
Blockstore::open_with_signal(blockstore_path).expect("Failed to open ledger database");
|
||||||
|
blockstore.set_no_compaction(config.no_rocksdb_compaction);
|
||||||
|
|
||||||
let process_options = blockstore_processor::ProcessOptions {
|
let process_options = blockstore_processor::ProcessOptions {
|
||||||
poh_verify,
|
poh_verify,
|
||||||
|
|
|
@ -93,6 +93,7 @@ pub struct Blockstore {
|
||||||
pub new_shreds_signals: Vec<SyncSender<bool>>,
|
pub new_shreds_signals: Vec<SyncSender<bool>>,
|
||||||
pub completed_slots_senders: Vec<SyncSender<Vec<Slot>>>,
|
pub completed_slots_senders: Vec<SyncSender<Vec<Slot>>>,
|
||||||
pub lowest_cleanup_slot: Arc<RwLock<u64>>,
|
pub lowest_cleanup_slot: Arc<RwLock<u64>>,
|
||||||
|
no_compaction: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct IndexMetaWorkingSetEntry {
|
pub struct IndexMetaWorkingSetEntry {
|
||||||
|
@ -228,6 +229,7 @@ impl Blockstore {
|
||||||
insert_shreds_lock: Arc::new(Mutex::new(())),
|
insert_shreds_lock: Arc::new(Mutex::new(())),
|
||||||
last_root,
|
last_root,
|
||||||
lowest_cleanup_slot: Arc::new(RwLock::new(0)),
|
lowest_cleanup_slot: Arc::new(RwLock::new(0)),
|
||||||
|
no_compaction: false,
|
||||||
};
|
};
|
||||||
Ok(blockstore)
|
Ok(blockstore)
|
||||||
}
|
}
|
||||||
|
@ -245,6 +247,10 @@ impl Blockstore {
|
||||||
Ok((blockstore, signal_receiver, completed_slots_receiver))
|
Ok((blockstore, signal_receiver, completed_slots_receiver))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn set_no_compaction(&mut self, no_compaction: bool) {
|
||||||
|
self.no_compaction = no_compaction;
|
||||||
|
}
|
||||||
|
|
||||||
pub fn destroy(ledger_path: &Path) -> Result<()> {
|
pub fn destroy(ledger_path: &Path) -> Result<()> {
|
||||||
// Database::destroy() fails if the path doesn't exist
|
// Database::destroy() fails if the path doesn't exist
|
||||||
fs::create_dir_all(ledger_path)?;
|
fs::create_dir_all(ledger_path)?;
|
||||||
|
@ -276,6 +282,7 @@ impl Blockstore {
|
||||||
while from_slot < batch_end {
|
while from_slot < batch_end {
|
||||||
match self.run_purge(from_slot, batch_end) {
|
match self.run_purge(from_slot, batch_end) {
|
||||||
Ok(end) => {
|
Ok(end) => {
|
||||||
|
if !self.no_compaction {
|
||||||
if let Err(e) = self.compact_storage(from_slot, batch_end) {
|
if let Err(e) = self.compact_storage(from_slot, batch_end) {
|
||||||
// This error is not fatal and indicates an internal error
|
// This error is not fatal and indicates an internal error
|
||||||
error!(
|
error!(
|
||||||
|
@ -283,6 +290,7 @@ impl Blockstore {
|
||||||
e, from_slot, batch_end
|
e, from_slot, batch_end
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if end {
|
if end {
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -37,6 +37,9 @@ while [[ -n $1 ]]; do
|
||||||
args+=("$1" "$2")
|
args+=("$1" "$2")
|
||||||
shift 2
|
shift 2
|
||||||
elif [[ $1 = --limit-ledger-size ]]; then
|
elif [[ $1 = --limit-ledger-size ]]; then
|
||||||
|
args+=("$1" "$2")
|
||||||
|
shift 2
|
||||||
|
elif [[ $1 = --no-rocksdb-compaction ]]; then
|
||||||
args+=("$1")
|
args+=("$1")
|
||||||
shift
|
shift
|
||||||
elif [[ $1 = --enable-rpc-get-confirmed-block ]]; then
|
elif [[ $1 = --enable-rpc-get-confirmed-block ]]; then
|
||||||
|
|
|
@ -127,6 +127,9 @@ while [[ -n $1 ]]; do
|
||||||
args+=("$1" "$2")
|
args+=("$1" "$2")
|
||||||
shift 2
|
shift 2
|
||||||
elif [[ $1 = --limit-ledger-size ]]; then
|
elif [[ $1 = --limit-ledger-size ]]; then
|
||||||
|
args+=("$1" "$2")
|
||||||
|
shift 2
|
||||||
|
elif [[ $1 = --no-rocksdb-compaction ]]; then
|
||||||
args+=("$1")
|
args+=("$1")
|
||||||
shift
|
shift
|
||||||
elif [[ $1 = --enable-rpc-get-confirmed-block ]]; then
|
elif [[ $1 = --enable-rpc-get-confirmed-block ]]; then
|
||||||
|
|
|
@ -641,6 +641,12 @@ pub fn main() {
|
||||||
.takes_value(false)
|
.takes_value(false)
|
||||||
.help("Use the RPC service of trusted validators only")
|
.help("Use the RPC service of trusted validators only")
|
||||||
)
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("no_rocksdb_compaction")
|
||||||
|
.long("no-rocksdb-compaction")
|
||||||
|
.takes_value(false)
|
||||||
|
.help("Disable manual compaction of the ledger database. May increase storage requirements.")
|
||||||
|
)
|
||||||
.arg(
|
.arg(
|
||||||
clap::Arg::with_name("bind_address")
|
clap::Arg::with_name("bind_address")
|
||||||
.long("bind-address")
|
.long("bind-address")
|
||||||
|
@ -698,6 +704,7 @@ pub fn main() {
|
||||||
let no_snapshot_fetch = matches.is_present("no_snapshot_fetch");
|
let no_snapshot_fetch = matches.is_present("no_snapshot_fetch");
|
||||||
let no_check_vote_account = matches.is_present("no_check_vote_account");
|
let no_check_vote_account = matches.is_present("no_check_vote_account");
|
||||||
let private_rpc = matches.is_present("private_rpc");
|
let private_rpc = matches.is_present("private_rpc");
|
||||||
|
let no_rocksdb_compaction = matches.is_present("no_rocksdb_compaction");
|
||||||
|
|
||||||
// Canonicalize ledger path to avoid issues with symlink creation
|
// Canonicalize ledger path to avoid issues with symlink creation
|
||||||
let _ = fs::create_dir_all(&ledger_path);
|
let _ = fs::create_dir_all(&ledger_path);
|
||||||
|
@ -748,6 +755,7 @@ pub fn main() {
|
||||||
wait_for_supermajority: value_t!(matches, "wait_for_supermajority", Slot).ok(),
|
wait_for_supermajority: value_t!(matches, "wait_for_supermajority", Slot).ok(),
|
||||||
trusted_validators,
|
trusted_validators,
|
||||||
frozen_accounts: values_t!(matches, "frozen_accounts", Pubkey).unwrap_or_default(),
|
frozen_accounts: values_t!(matches, "frozen_accounts", Pubkey).unwrap_or_default(),
|
||||||
|
no_rocksdb_compaction,
|
||||||
..ValidatorConfig::default()
|
..ValidatorConfig::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue