Enable the banking trace by default (#33497)

This commit is contained in:
Ryo Onodera 2023-10-04 09:01:28 +09:00 committed by GitHub
parent 9761e6f251
commit eb262aabe3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 14 deletions

View File

@ -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

View File

@ -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")

View File

@ -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() {