mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 21:26:42 +00:00
triedb/pathdb: fix index proress
This commit is contained in:
parent
176c6fb1a6
commit
8a229c8d48
2 changed files with 15 additions and 1 deletions
|
|
@ -974,6 +974,13 @@ func TestDatabaseIndexRecovery(t *testing.T) {
|
|||
t.Fatalf("Unexpected state history found, %d", i)
|
||||
}
|
||||
}
|
||||
remain, err := env.db.IndexProgress()
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to obtain the progress, %v", err)
|
||||
}
|
||||
if remain == 0 {
|
||||
t.Fatalf("Unexpected progress remain, %d", remain)
|
||||
}
|
||||
|
||||
// Apply new states on top, ensuring state indexing can respond correctly
|
||||
for i := dIndex + 1; i < len(roots); i++ {
|
||||
|
|
@ -981,6 +988,13 @@ func TestDatabaseIndexRecovery(t *testing.T) {
|
|||
panic(fmt.Errorf("failed to update state changes, err: %w", err))
|
||||
}
|
||||
}
|
||||
remain, err = env.db.IndexProgress()
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to obtain the progress, %v", err)
|
||||
}
|
||||
if remain != 0 {
|
||||
t.Fatalf("Unexpected progress remain, %d", remain)
|
||||
}
|
||||
waitIndexing(env.db)
|
||||
|
||||
// Ensure the truncated state histories become accessible
|
||||
|
|
|
|||
|
|
@ -372,7 +372,7 @@ func (i *indexIniter) remain() uint64 {
|
|||
last, indexed := i.last.Load(), i.indexed.Load()
|
||||
if last < indexed {
|
||||
log.Warn("State indexer is in recovery", "indexed", indexed, "last", last)
|
||||
return 0
|
||||
return indexed - last
|
||||
}
|
||||
return last - indexed
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue