diff --git a/storage/aptosdb/src/db/include/aptosdb_writer.rs b/storage/aptosdb/src/db/include/aptosdb_writer.rs index 5a7452d458beb..e2e9416933bcc 100644 --- a/storage/aptosdb/src/db/include/aptosdb_writer.rs +++ b/storage/aptosdb/src/db/include/aptosdb_writer.rs @@ -352,7 +352,6 @@ impl AptosDB { // Always put in state value index for now. // TODO(grao): remove after APIs migrated off the DB to the indexer. self.state_store.state_kv_db.enabled_sharding(), - skip_index_and_usage, chunk.transaction_infos .iter() .rposition(|t| t.state_checkpoint_hash().is_some()), diff --git a/storage/aptosdb/src/db/test_helper.rs b/storage/aptosdb/src/db/test_helper.rs index 353b19bbf6f00..9128226c2c4e3 100644 --- a/storage/aptosdb/src/db/test_helper.rs +++ b/storage/aptosdb/src/db/test_helper.rs @@ -95,7 +95,6 @@ pub(crate) fn update_store( &ledger_batch, &sharded_state_kv_batches, /*put_state_value_indices=*/ enable_sharding, - /*skip_usage=*/ false, /*last_checkpoint_index=*/ None, ) .unwrap(); diff --git a/storage/aptosdb/src/pruner/state_merkle_pruner/test.rs b/storage/aptosdb/src/pruner/state_merkle_pruner/test.rs index 67e9cca52c185..cc15fc12a7f13 100644 --- a/storage/aptosdb/src/pruner/state_merkle_pruner/test.rs +++ b/storage/aptosdb/src/pruner/state_merkle_pruner/test.rs @@ -70,7 +70,6 @@ fn put_value_set( &ledger_batch, &sharded_state_kv_batches, enable_sharding, - /*skip_usage=*/ false, /*last_checkpoint_index=*/ None, ) .unwrap(); diff --git a/storage/aptosdb/src/state_store/mod.rs b/storage/aptosdb/src/state_store/mod.rs index 3419582601439..38ab16199c188 100644 --- a/storage/aptosdb/src/state_store/mod.rs +++ b/storage/aptosdb/src/state_store/mod.rs @@ -671,7 +671,6 @@ impl StateStore { None, batch, sharded_state_kv_batches, - /*skip_usage=*/ false, None, enable_sharding, )?; @@ -696,7 +695,6 @@ impl StateStore { ledger_batch: &SchemaBatch, sharded_state_kv_batches: &ShardedStateKvSchemaBatch, enable_sharding: bool, - skip_usage: bool, last_checkpoint_index: Option, ) -> Result<()> { let _timer = OTHER_TIMERS_SECONDS @@ -710,7 +708,6 @@ impl StateStore { sharded_state_cache, ledger_batch, sharded_state_kv_batches, - skip_usage, last_checkpoint_index, enable_sharding, )?; @@ -786,7 +783,6 @@ impl StateStore { sharded_state_cache: Option<&ShardedStateCache>, batch: &SchemaBatch, sharded_state_kv_batches: &ShardedStateKvSchemaBatch, - skip_usage: bool, last_checkpoint_index: Option, enable_sharding: bool, ) -> Result<()> { @@ -947,16 +943,10 @@ impl StateStore { (usage.items() as i64 + items_delta) as usize, (usage.bytes() as i64 + bytes_delta) as usize, ); - let should_write_index_for_version = - (i == num_versions - 1) || Some(i) == last_checkpoint_index; - if !skip_usage || should_write_index_for_version { + if (i == num_versions - 1) || Some(i) == last_checkpoint_index { let version = first_version + i as u64; - if should_write_index_for_version { - info!("Write usage at version {version}, {usage:?}, skip_usage: {skip_usage}."); - } - batch - .put::(&version, &usage.into()) - .unwrap(); + info!("Write usage at version {version}, {usage:?}."); + batch.put::(&version, &usage.into())? } } diff --git a/storage/aptosdb/src/state_store/state_store_test.rs b/storage/aptosdb/src/state_store/state_store_test.rs index dfb2abb842c5b..5abad36344546 100644 --- a/storage/aptosdb/src/state_store/state_store_test.rs +++ b/storage/aptosdb/src/state_store/state_store_test.rs @@ -60,7 +60,6 @@ fn put_value_set( &ledger_batch, &sharded_state_kv_batches, /*put_state_value_indices=*/ false, - /*skip_usage=*/ false, /*last_checkpoint_index=*/ None, ) .unwrap();