Skip to content

Commit

Permalink
[Storage] Add back the test for min_readable_version. (aptos-labs#3984)
Browse files Browse the repository at this point in the history
  • Loading branch information
grao1991 authored Sep 8, 2022
1 parent dbefab8 commit 7b0495c
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions storage/aptosdb/src/pruner/transaction_store/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -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,
Expand All @@ -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();
Expand Down

0 comments on commit 7b0495c

Please sign in to comment.