This commit is contained in:
Jason-W123 2026-05-21 21:53:56 -07:00 committed by GitHub
commit a5b9c564aa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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 // 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 to from means that the queue gap-evaluation will work correctly
nextNum = from nextNum = from
queue = prque.New[int64, *blockTxHashes](nil) queue = prque.New[int64, *blockTxHashes](nil)
blocks, txs = 0, 0 // for stats reporting blocks, txs = 0, 0 // for stats reporting
loggedFirstBanner = false
) )
// Otherwise spin up the concurrent iterator and unindexer // Otherwise spin up the concurrent iterator and unindexer
for delivery := range hashesCh { 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 we've spent too much time already, notify the user of what we're doing
if time.Since(logged) > 8*time.Second { 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("Removing old transaction ids from transaction lookup index", "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() logged = time.Now()
} }
} }

View file

@ -714,8 +714,18 @@ func ReadChainMetadata(db ethdb.KeyValueStore) [][]string {
return fmt.Sprintf("%d (%#x)", *val, *val) 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 "<nil>, database not initialized"
}
return fmt.Sprintf("%d (%#x)", *val, *val)
}
data := [][]string{ data := [][]string{
{"databaseVersion", pp(ReadDatabaseVersion(db))}, {"databaseVersion", ppDatabaseVersion(ReadDatabaseVersion(db))},
{"headBlockHash", fmt.Sprintf("%v", ReadHeadBlockHash(db))}, {"headBlockHash", fmt.Sprintf("%v", ReadHeadBlockHash(db))},
{"headFastBlockHash", fmt.Sprintf("%v", ReadHeadFastBlockHash(db))}, {"headFastBlockHash", fmt.Sprintf("%v", ReadHeadFastBlockHash(db))},
{"headHeaderHash", fmt.Sprintf("%v", ReadHeadHeaderHash(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 // - iterate the database, delete all other state entries which
// don't belong to the target state and the genesis state // don't belong to the target state and the genesis state
// //
// It can take several hours(around 2 hours for mainnet) to finish // It can take several hours to several days, depending on chain size and
// the whole pruning work. It's recommended to run this offline tool // 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 // periodically in order to release the disk usage and improve the
// disk read performance to some extent. // disk read performance to some extent.
type Pruner struct { type Pruner struct {