aptos

aptos-debugger tool seems not to backup transactions


I built the aptos-debugger tool from the 1.12.2 tag version of the aptos-core repository. Then, I ran a local Aptos instance using aptos node run-local-testnet and started a backup of the local Aptos using the backup function of the aptos-debugger tool. The command I used is:

aptos-debugger aptos-db backup continuously --metadata-cache-dir ./.aptos/backup/mc --local-fs-dir ./.aptos/backup/db

After that, I sent 42,000 transactions, and the local Aptos stored around 46,000 versions. The backup also seemed to be working fine, with around 25 MB of backup data being saved.

After stopping the local Aptos, I attempted to restore the DB from the backup data. The command I used is:

aptos-debugger aptos-db restore bootstrap-db --metadata-cache-dir ./.aptos/backup/mc --local-fs-dir ./.aptos/backup/db --target-db-dir .aptos/backup/restored-db

However, after loading the metadata, the message max transaction version: 0 appeared, and eventually, the command failed with Cannot find tree snapshot before target version message.

...
2024-05-30T08:37:33.162260Z [main] INFO storage/backup/backup-cli/src/coordinators/restore.rs:127 User specified target version: 18446744073709551615, max transaction version: 0, Target version is set to 0
2024-05-30T08:37:33.162999Z [main] WARN storage/aptosdb/src/db/include/aptosdb_internal.rs:261 AptosDB API returned error. {"api_name":"get_latest_version","error":"NotFound(\"No OverallCommitProgress in db.\")"}
thread 'main' panicked at /Users/a13340/Workspace/42dot/aptos/code/aptos-core/storage/backup/backup-cli/src/coordinators/restore.rs:193:18:
Cannot find tree snapshot before target version
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2024-05-30T08:37:33.164850Z [state-committer] INFO storage/schemadb/src/lib.rs:357 Dropped RocksDB. {"rocksdb_name":"state_merkle_db"}
2024-05-30T08:37:33.166903Z [main] INFO storage/schemadb/src/lib.rs:357 Dropped RocksDB. {"rocksdb_name":"ledger_db"}

When I queried the backup data with the aptos-debugger tool, it showed the following:

latest_epoch_ending_epoch: 16 latest_state_snapshot_epoch: 16 latest_state_snapshot_version: 46222 latest_transaction_version: 0

Looking at latest_transaction_version: 0, it seems like no transaction data was backed up. Why could this be happening? Am I using the backup tool incorrectly?


Solution

  • The reason transactions were not being backed up was that the transaction batch size was too large (default value is 1,000,000). I resolved this issue by adjusting the --transaction-batch-size option to a smaller value.