mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 06:36:43 +00:00
core: update index tail in repair
This commit is contained in:
parent
ec1616d6e0
commit
8777ba0b6a
1 changed files with 3 additions and 0 deletions
|
|
@ -163,6 +163,7 @@ func (indexer *txIndexer) repair(head uint64) {
|
||||||
// A crash may occur between the two delete operations,
|
// A crash may occur between the two delete operations,
|
||||||
// potentially leaving dangling indexes in the database.
|
// potentially leaving dangling indexes in the database.
|
||||||
// However, this is considered acceptable.
|
// However, this is considered acceptable.
|
||||||
|
indexer.tail.Store(nil)
|
||||||
rawdb.DeleteTxIndexTail(indexer.db)
|
rawdb.DeleteTxIndexTail(indexer.db)
|
||||||
rawdb.DeleteAllTxLookupEntries(indexer.db, nil)
|
rawdb.DeleteAllTxLookupEntries(indexer.db, nil)
|
||||||
log.Warn("Purge transaction indexes", "head", head, "tail", *tail)
|
log.Warn("Purge transaction indexes", "head", head, "tail", *tail)
|
||||||
|
|
@ -183,6 +184,7 @@ func (indexer *txIndexer) repair(head uint64) {
|
||||||
// Traversing the database directly within the transaction
|
// Traversing the database directly within the transaction
|
||||||
// index namespace might be slow and expensive, but we
|
// index namespace might be slow and expensive, but we
|
||||||
// have no choice.
|
// have no choice.
|
||||||
|
indexer.tail.Store(nil)
|
||||||
rawdb.DeleteTxIndexTail(indexer.db)
|
rawdb.DeleteTxIndexTail(indexer.db)
|
||||||
rawdb.DeleteAllTxLookupEntries(indexer.db, nil)
|
rawdb.DeleteAllTxLookupEntries(indexer.db, nil)
|
||||||
log.Warn("Purge transaction indexes", "head", head, "cutoff", indexer.cutoff)
|
log.Warn("Purge transaction indexes", "head", head, "cutoff", indexer.cutoff)
|
||||||
|
|
@ -196,6 +198,7 @@ func (indexer *txIndexer) repair(head uint64) {
|
||||||
// A crash may occur between the two delete operations,
|
// A crash may occur between the two delete operations,
|
||||||
// potentially leaving dangling indexes in the database.
|
// potentially leaving dangling indexes in the database.
|
||||||
// However, this is considered acceptable.
|
// However, this is considered acceptable.
|
||||||
|
indexer.tail.Store(&indexer.cutoff)
|
||||||
rawdb.WriteTxIndexTail(indexer.db, indexer.cutoff)
|
rawdb.WriteTxIndexTail(indexer.db, indexer.cutoff)
|
||||||
rawdb.DeleteAllTxLookupEntries(indexer.db, func(txhash common.Hash, blob []byte) bool {
|
rawdb.DeleteAllTxLookupEntries(indexer.db, func(txhash common.Hash, blob []byte) bool {
|
||||||
n := rawdb.DecodeTxLookupEntry(blob, indexer.db)
|
n := rawdb.DecodeTxLookupEntry(blob, indexer.db)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue