diff --git a/core/rawdb/chain_iterator.go b/core/rawdb/chain_iterator.go index afa1aa7a4c..d725033930 100644 --- a/core/rawdb/chain_iterator.go +++ b/core/rawdb/chain_iterator.go @@ -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("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() } } diff --git a/core/rawdb/database.go b/core/rawdb/database.go index 39e1a64e5a..d63b250536 100644 --- a/core/rawdb/database.go +++ b/core/rawdb/database.go @@ -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 "". + ppDatabaseVersion := func(val *uint64) string { + if val == nil { + return ", database not initialized" + } + 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))}, diff --git a/core/state/pruner/pruner.go b/core/state/pruner/pruner.go index 11f3963a3e..473c053d58 100644 --- a/core/state/pruner/pruner.go +++ b/core/state/pruner/pruner.go @@ -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 {