fix: prune cmd should disable async pruning (#24090)

This commit is contained in:
Tyler
2025-03-27 18:43:27 +00:00
committed by GitHub
parent d2ac39cb46
commit cfda49b436
30 changed files with 303 additions and 236 deletions
+8 -1
View File
@@ -44,6 +44,9 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`,
return err
}
// force sync pruning so that the command will wait for the pruning to finish before returning.
vp.Set(server.FlagIAVLSyncPruning, true)
// use the first argument if present to set the pruning method
if len(args) > 0 {
vp.Set(server.FlagPruning, args[0])
@@ -55,9 +58,10 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`,
return err
}
cmd.Printf("get pruning options from command flags, strategy: %v, keep-recent: %v\n",
cmd.Printf("get pruning options from command flags, strategy: %v, keep-recent: %d, interval: %d\n",
pruningOptions.Strategy,
pruningOptions.KeepRecent,
pruningOptions.Interval,
)
home := vp.GetString(flags.FlagHome)
@@ -70,6 +74,9 @@ Supported app-db-backend types include 'goleveldb', 'rocksdb', 'pebbledb'.`,
return err
}
// in our test, it's important to close db explicitly for pebbledb to write to disk.
defer db.Close()
logger := log.NewLogger(cmd.OutOrStdout())
app := appCreator(logger, db, nil, vp)
cms := app.CommitMultiStore()