Merge pull request #1898 from Roasbeef/fix-migration
channeldb: don't use KeyN in latest migration
This commit is contained in:
commit
9e99f13f8d
@ -473,12 +473,9 @@ func migratePruneEdgeUpdateIndex(tx *bolt.Tx) error {
|
||||
if edges == nil {
|
||||
return nil
|
||||
}
|
||||
edgeUpdateIndex, err := edges.CreateBucketIfNotExists(
|
||||
edgeUpdateIndexBucket,
|
||||
)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to create/fetch edge update " +
|
||||
"index bucket")
|
||||
edgeUpdateIndex := edges.Bucket(edgeUpdateIndexBucket)
|
||||
if edgeUpdateIndex == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Retrieve some buckets that will be needed later on. These should
|
||||
@ -518,7 +515,6 @@ func migratePruneEdgeUpdateIndex(tx *bolt.Tx) error {
|
||||
|
||||
// With the existing edge policies gathered, we'll recreate the index
|
||||
// and populate it with the correct entries.
|
||||
oldNumEntries := edgeUpdateIndex.Stats().KeyN
|
||||
if err := edges.DeleteBucket(edgeUpdateIndexBucket); err != nil {
|
||||
return fmt.Errorf("unable to remove existing edge update "+
|
||||
"index: %v", err)
|
||||
@ -558,10 +554,6 @@ func migratePruneEdgeUpdateIndex(tx *bolt.Tx) error {
|
||||
}
|
||||
}
|
||||
|
||||
newNumEntries := edgeUpdateIndex.Stats().KeyN
|
||||
log.Infof("Pruned %d stale entries from the edge update index",
|
||||
oldNumEntries-newNumEntries)
|
||||
|
||||
log.Info("Migration to properly prune edge update index complete!")
|
||||
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user