Skip to content

Commit

Permalink
Enable the banking trace by default (#33497)
Browse files Browse the repository at this point in the history
(cherry picked from commit eb262aa)
  • Loading branch information
ryoqun authored and mergify[bot] committed Oct 4, 2023
1 parent b90f08f commit 0edc0f9
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 14 deletions.
4 changes: 2 additions & 2 deletions core/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1134,11 +1134,11 @@ impl Validator {
.map_err(|err| format!("{} [{:?}]", &err, &err))?;
if banking_tracer.is_enabled() {
info!(
"Enabled banking tracer (dir_byte_limit: {})",
"Enabled banking trace (dir_byte_limit: {})",
config.banking_trace_dir_byte_limit
);
} else {
info!("Disabled banking tracer");
info!("Disabled banking trace");
}

let entry_notification_sender = entry_notifier_service
Expand Down
14 changes: 11 additions & 3 deletions validator/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1351,9 +1351,17 @@ pub fn app<'a>(version: &'a str, default_args: &'a DefaultArgs) -> App<'a, 'a> {
// explicitly given, similar to --limit-ledger-size.
// see configure_banking_trace_dir_byte_limit() for this.
.default_value(&default_args.banking_trace_dir_byte_limit)
.help("Write trace files for simulate-leader-blocks, retaining \
up to the default or specified total bytes in the \
ledger")
.help("Enables the banking trace explicitly, which is enabled by default and \
writes trace files for simulate-leader-blocks, retaining up to the default \
or specified total bytes in the ledger. This flag can be used to override \
its byte limit.")
)
.arg(
Arg::with_name("disable_banking_trace")
.long("disable-banking-trace")
.conflicts_with("banking_trace_dir_byte_limit")
.takes_value(false)
.help("Disables the banking trace")
)
.arg(
Arg::with_name("block_verification_method")
Expand Down
19 changes: 10 additions & 9 deletions validator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,15 +448,16 @@ fn configure_banking_trace_dir_byte_limit(
validator_config: &mut ValidatorConfig,
matches: &ArgMatches,
) {
validator_config.banking_trace_dir_byte_limit =
if matches.occurrences_of("banking_trace_dir_byte_limit") == 0 {
// disable with no explicit flag; then, this effectively becomes `opt-in` even if we're
// specifying a default value in clap configuration.
DISABLED_BAKING_TRACE_DIR
} else {
// BANKING_TRACE_DIR_DEFAULT_BYTE_LIMIT or user-supplied override value
value_t_or_exit!(matches, "banking_trace_dir_byte_limit", u64)
};
validator_config.banking_trace_dir_byte_limit = if matches.is_present("disable_banking_trace") {
// disable with an explicit flag; This effectively becomes `opt-out` by reseting to
// DISABLED_BAKING_TRACE_DIR, while allowing us to specify a default sensible limit in clap
// configuration for cli help.
DISABLED_BAKING_TRACE_DIR
} else {
// a default value in clap configuration (BANKING_TRACE_DIR_DEFAULT_BYTE_LIMIT) or
// explicit user-supplied override value
value_t_or_exit!(matches, "banking_trace_dir_byte_limit", u64)
};
}

pub fn main() {
Expand Down

0 comments on commit 0edc0f9

Please sign in to comment.