Add purge --no-compaction flag
This commit is contained in:
parent
95490ff56e
commit
bed74d803f
|
@ -9,7 +9,7 @@ use solana_ledger::entry::Entry;
|
||||||
use solana_ledger::{
|
use solana_ledger::{
|
||||||
ancestor_iterator::AncestorIterator,
|
ancestor_iterator::AncestorIterator,
|
||||||
bank_forks_utils,
|
bank_forks_utils,
|
||||||
blockstore::Blockstore,
|
blockstore::{Blockstore, PurgeType},
|
||||||
blockstore_db::{self, AccessType, BlockstoreRecoveryMode, Column, Database},
|
blockstore_db::{self, AccessType, BlockstoreRecoveryMode, Column, Database},
|
||||||
blockstore_processor::ProcessOptions,
|
blockstore_processor::ProcessOptions,
|
||||||
rooted_slot_iterator::RootedSlotIterator,
|
rooted_slot_iterator::RootedSlotIterator,
|
||||||
|
@ -1033,6 +1033,13 @@ fn main() {
|
||||||
.required(true)
|
.required(true)
|
||||||
.help("Ending slot to stop purging (inclusive)"),
|
.help("Ending slot to stop purging (inclusive)"),
|
||||||
)
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("no_compaction")
|
||||||
|
.long("no-compaction")
|
||||||
|
.required(false)
|
||||||
|
.takes_value(false)
|
||||||
|
.help("Skip ledger compaction after purge")
|
||||||
|
)
|
||||||
)
|
)
|
||||||
.subcommand(
|
.subcommand(
|
||||||
SubCommand::with_name("list-roots")
|
SubCommand::with_name("list-roots")
|
||||||
|
@ -1606,9 +1613,14 @@ fn main() {
|
||||||
("purge", Some(arg_matches)) => {
|
("purge", Some(arg_matches)) => {
|
||||||
let start_slot = value_t_or_exit!(arg_matches, "start_slot", Slot);
|
let start_slot = value_t_or_exit!(arg_matches, "start_slot", Slot);
|
||||||
let end_slot = value_t_or_exit!(arg_matches, "end_slot", Slot);
|
let end_slot = value_t_or_exit!(arg_matches, "end_slot", Slot);
|
||||||
|
let no_compaction = arg_matches.is_present("no-compaction");
|
||||||
let blockstore =
|
let blockstore =
|
||||||
open_blockstore(&ledger_path, AccessType::PrimaryOnly, wal_recovery_mode);
|
open_blockstore(&ledger_path, AccessType::PrimaryOnly, wal_recovery_mode);
|
||||||
|
if no_compaction {
|
||||||
blockstore.purge_and_compact_slots(start_slot, end_slot);
|
blockstore.purge_and_compact_slots(start_slot, end_slot);
|
||||||
|
} else {
|
||||||
|
blockstore.purge_slots(start_slot, end_slot, PurgeType::Exact);
|
||||||
|
}
|
||||||
blockstore.purge_from_next_slots(start_slot, end_slot);
|
blockstore.purge_from_next_slots(start_slot, end_slot);
|
||||||
}
|
}
|
||||||
("list-roots", Some(arg_matches)) => {
|
("list-roots", Some(arg_matches)) => {
|
||||||
|
|
Loading…
Reference in New Issue