Przeglądaj źródła

Enable Obsolete Accounts by default (#8890)

* Enable Obsolete Accounts by default

* Fix cargo fmt

* Implement Review Feedback

* Fix Args commenting
Rory Harris 2 tygodni temu
rodzic
commit
28f8f5387b

+ 1 - 1
accounts-db/src/accounts_db.rs

@@ -1059,8 +1059,8 @@ struct CleaningInfo {
 /// * Enabled - mark accounts obsolete during write cache flush
 /// * Enabled - mark accounts obsolete during write cache flush
 #[derive(Default, Debug, Clone, Copy, PartialEq, Eq)]
 #[derive(Default, Debug, Clone, Copy, PartialEq, Eq)]
 pub enum MarkObsoleteAccounts {
 pub enum MarkObsoleteAccounts {
-    #[default]
     Disabled,
     Disabled,
+    #[default]
     Enabled,
     Enabled,
 }
 }
 
 

+ 2 - 2
accounts-db/src/accounts_db/accounts_db_config.rs

@@ -69,7 +69,7 @@ pub const ACCOUNTS_DB_CONFIG_FOR_TESTING: AccountsDbConfig = AccountsDbConfig {
     partitioned_epoch_rewards_config: DEFAULT_PARTITIONED_EPOCH_REWARDS_CONFIG,
     partitioned_epoch_rewards_config: DEFAULT_PARTITIONED_EPOCH_REWARDS_CONFIG,
     storage_access: StorageAccess::File,
     storage_access: StorageAccess::File,
     scan_filter_for_shrinking: ScanFilter::OnlyAbnormalTest,
     scan_filter_for_shrinking: ScanFilter::OnlyAbnormalTest,
-    mark_obsolete_accounts: MarkObsoleteAccounts::Disabled,
+    mark_obsolete_accounts: MarkObsoleteAccounts::Enabled,
     num_background_threads: None,
     num_background_threads: None,
     num_foreground_threads: None,
     num_foreground_threads: None,
     memlock_budget_size: MEMLOCK_BUDGET_SIZE_FOR_TESTS,
     memlock_budget_size: MEMLOCK_BUDGET_SIZE_FOR_TESTS,
@@ -92,7 +92,7 @@ pub const ACCOUNTS_DB_CONFIG_FOR_BENCHMARKS: AccountsDbConfig = AccountsDbConfig
     partitioned_epoch_rewards_config: DEFAULT_PARTITIONED_EPOCH_REWARDS_CONFIG,
     partitioned_epoch_rewards_config: DEFAULT_PARTITIONED_EPOCH_REWARDS_CONFIG,
     storage_access: StorageAccess::File,
     storage_access: StorageAccess::File,
     scan_filter_for_shrinking: ScanFilter::OnlyAbnormal,
     scan_filter_for_shrinking: ScanFilter::OnlyAbnormal,
-    mark_obsolete_accounts: MarkObsoleteAccounts::Disabled,
+    mark_obsolete_accounts: MarkObsoleteAccounts::Enabled,
     num_background_threads: None,
     num_background_threads: None,
     num_foreground_threads: None,
     num_foreground_threads: None,
     memlock_budget_size: MEMLOCK_BUDGET_SIZE_FOR_TESTS,
     memlock_budget_size: MEMLOCK_BUDGET_SIZE_FOR_TESTS,

+ 6 - 5
validator/src/commands/run/args.rs

@@ -1119,12 +1119,13 @@ pub fn add_args<'a>(app: App<'a, 'a>, default_args: &'a DefaultArgs) -> App<'a,
     .arg(
     .arg(
         Arg::with_name("accounts_db_mark_obsolete_accounts")
         Arg::with_name("accounts_db_mark_obsolete_accounts")
             .long("accounts-db-mark-obsolete-accounts")
             .long("accounts-db-mark-obsolete-accounts")
-            .help("Enables experimental obsolete account tracking")
+            .help("Controls obsolete account tracking")
+            .takes_value(true)
+            .possible_values(&["enabled", "disabled"])
             .long_help(
             .long_help(
-                "Enables experimental obsolete account tracking. This feature tracks obsolete \
-                 accounts in the account storage entry allowing for earlier cleaning of obsolete \
-                 accounts in the storages and index. At this time this feature is not compatible \
-                 with booting from local snapshot state and must unpack from archives.",
+                "Controls obsolete account tracking. This feature tracks obsolete accounts in the \
+                 account storage entry allowing for earlier cleaning of obsolete accounts in the \
+                 storages and index. This value is currently enabled by default.",
             )
             )
             .hidden(hidden_unless_forced()),
             .hidden(hidden_unless_forced()),
     )
     )

+ 13 - 5
validator/src/commands/run/execute.rs

@@ -430,11 +430,19 @@ pub fn execute(
         })
         })
         .unwrap_or_default();
         .unwrap_or_default();
 
 
-    let mark_obsolete_accounts = if matches.is_present("accounts_db_mark_obsolete_accounts") {
-        MarkObsoleteAccounts::Enabled
-    } else {
-        MarkObsoleteAccounts::Disabled
-    };
+    let mark_obsolete_accounts = matches
+        .value_of("accounts_db_mark_obsolete_accounts")
+        .map(|mark_obsolete_accounts| {
+            match mark_obsolete_accounts {
+                "enabled" => MarkObsoleteAccounts::Enabled,
+                "disabled" => MarkObsoleteAccounts::Disabled,
+                _ => {
+                    // clap will enforce one of the above values is given
+                    unreachable!("invalid value given to accounts_db_mark_obsolete_accounts")
+                }
+            }
+        })
+        .unwrap_or_default();
 
 
     let accounts_db_config = AccountsDbConfig {
     let accounts_db_config = AccountsDbConfig {
         index: Some(accounts_index_config),
         index: Some(accounts_index_config),