From 7b0495c1a97ed9fe9bc9706b57a74808c33d221e Mon Sep 17 00:00:00 2001 From: Guoteng Rao <3603304+grao1991@users.noreply.github.com> Date: Thu, 8 Sep 2022 15:12:29 -0700 Subject: [PATCH] [Storage] Add back the test for min_readable_version. (#3984) --- .../src/pruner/transaction_store/test.rs | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/storage/aptosdb/src/pruner/transaction_store/test.rs b/storage/aptosdb/src/pruner/transaction_store/test.rs index 7e6eb64e274f5..d416ed59740fa 100644 --- a/storage/aptosdb/src/pruner/transaction_store/test.rs +++ b/storage/aptosdb/src/pruner/transaction_store/test.rs @@ -14,8 +14,8 @@ use aptos_types::{ use accumulator::HashReader; use aptos_config::config::LedgerPrunerConfig; -use aptos_types::proof::position::Position; use aptos_types::{ + proof::position::Position, transaction::{TransactionInfo, Version}, write_set::WriteSet, }; @@ -99,17 +99,6 @@ fn verify_txn_store_pruner( let ledger_store = LedgerStore::new(Arc::clone(&aptos_db.ledger_db)); let num_transaction = txns.len(); - let pruner = LedgerPrunerManager::new( - Arc::clone(&aptos_db.ledger_db), - Arc::clone(&aptos_db.state_store), - LedgerPrunerConfig { - enable: true, - prune_window: 0, - batch_size: 1, - user_pruning_window_offset: 0, - }, - ); - let ledger_version = num_transaction as Version - 1; put_txn_in_store( &aptos_db, @@ -122,6 +111,18 @@ fn verify_txn_store_pruner( // start pruning transactions batches of size step_size and verify transactions have been pruned // from DB for i in (0..=num_transaction).step_by(step_size) { + // Initialize a pruner in every iteration to test the min_readable_version initialization + // logic. + let pruner = LedgerPrunerManager::new( + Arc::clone(&aptos_db.ledger_db), + Arc::clone(&aptos_db.state_store), + LedgerPrunerConfig { + enable: true, + prune_window: 0, + batch_size: 1, + user_pruning_window_offset: 0, + }, + ); pruner .wake_and_wait_pruner(i as u64 /* latest_version */) .unwrap();