add ux improvement changes

This commit is contained in:
Jason-Wanxt 2026-05-06 19:04:26 +08:00
parent aaa2b66285
commit 1fe1ef3d33
3 changed files with 23 additions and 7 deletions

View file

@ -298,9 +298,10 @@ func unindexTransactions(db ethdb.Database, from uint64, to uint64, interrupt ch
// we expect the first number to come in to be [from]. Therefore, setting
// nextNum to from means that the queue gap-evaluation will work correctly
nextNum = from
queue = prque.New[int64, *blockTxHashes](nil)
blocks, txs = 0, 0 // for stats reporting
nextNum = from
queue = prque.New[int64, *blockTxHashes](nil)
blocks, txs = 0, 0 // for stats reporting
loggedFirstBanner = false
)
// Otherwise spin up the concurrent iterator and unindexer
for delivery := range hashesCh {
@ -338,7 +339,12 @@ func unindexTransactions(db ethdb.Database, from uint64, to uint64, interrupt ch
}
// If we've spent too much time already, notify the user of what we're doing
if time.Since(logged) > 8*time.Second {
log.Info("Unindexing transactions", "blocks", blocks, "txs", txs, "total", to-from, "elapsed", common.PrettyDuration(time.Since(start)))
if !loggedFirstBanner {
log.Info("Unindexing transactions — this is normal maintenance and does not indicate data loss", "blocks", blocks, "txs", txs, "total", to-from, "elapsed", common.PrettyDuration(time.Since(start)))
loggedFirstBanner = true
} else {
log.Debug("Unindexing transactions", "blocks", blocks, "txs", txs, "total", to-from, "elapsed", common.PrettyDuration(time.Since(start)))
}
logged = time.Now()
}
}

View file

@ -714,8 +714,18 @@ func ReadChainMetadata(db ethdb.KeyValueStore) [][]string {
return fmt.Sprintf("%d (%#x)", *val, *val)
}
// databaseVersion is special-cased: when nil, it means the database is
// uninitialized (rather than an optional/empty field), so we surface a
// more actionable message instead of the generic "<nil>".
ppDatabaseVersion := func(val *uint64) string {
if val == nil {
return "not set (new or uninitialized database)"
}
return fmt.Sprintf("%d (%#x)", *val, *val)
}
data := [][]string{
{"databaseVersion", pp(ReadDatabaseVersion(db))},
{"databaseVersion", ppDatabaseVersion(ReadDatabaseVersion(db))},
{"headBlockHash", fmt.Sprintf("%v", ReadHeadBlockHash(db))},
{"headFastBlockHash", fmt.Sprintf("%v", ReadHeadFastBlockHash(db))},
{"headHeaderHash", fmt.Sprintf("%v", ReadHeadHeaderHash(db))},

View file

@ -68,8 +68,8 @@ type Config struct {
// - iterate the database, delete all other state entries which
// don't belong to the target state and the genesis state
//
// It can take several hours(around 2 hours for mainnet) to finish
// the whole pruning work. It's recommended to run this offline tool
// It can take several hours to several days, depending on chain size and
// disk speed, to finish the whole pruning work. It's recommended to run this offline tool
// periodically in order to release the disk usage and improve the
// disk read performance to some extent.
type Pruner struct {