Skip to content

Commit

Permalink
avoid clearing fast node cache during pruning (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
p0mvn authored Mar 21, 2022
1 parent d136ed6 commit 8371754
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions nodedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,6 @@ func (ndb *nodeDB) DeleteVersionsRange(fromVersion, toVersion int64) error {
panic(err)
}
ndb.uncacheNode(hash)
ndb.uncacheFastNode(key)
} else {
ndb.saveOrphan(hash, from, predecessor)
}
Expand All @@ -536,14 +535,6 @@ func (ndb *nodeDB) DeleteVersionsRange(fromVersion, toVersion int64) error {
}
}

for key, elem := range ndb.fastNodeCache {
fastNode := elem.Value.(*FastNode)
if fastNode.versionLastUpdatedAt >= fromVersion && fastNode.versionLastUpdatedAt < toVersion {
ndb.fastNodeCacheQueue.Remove(elem)
delete(ndb.fastNodeCache, string(key))
}
}

// Delete the version root entries
err := ndb.traverseRange(rootKeyFormat.Key(fromVersion), rootKeyFormat.Key(toVersion), func(k, v []byte) error {
if err := ndb.batch.Delete(k); err != nil {
Expand Down

0 comments on commit 8371754

Please sign in to comment.