prysm-pulse/beacon-chain/db/kv/migration.go
Mohamed Zahoor 0d818a5709
Reduce memory overhead during DB migrations (#9298)
* wip

* migration happening

* wip

* fix memory utilization, add the testcases

* migration issues

* the gazel

* remove debug logging

* goimport

* gazel
2021-07-30 08:38:54 -05:00

28 lines
476 B
Go

package kv
import (
"context"
bolt "go.etcd.io/bbolt"
)
var migrationCompleted = []byte("done")
type migration func(context.Context, *bolt.DB) error
var migrations = []migration{
migrateArchivedIndex,
migrateBlockSlotIndex,
migrateStateValidators,
}
// RunMigrations defined in the migrations array.
func (s *Store) RunMigrations(ctx context.Context) error {
for _, m := range migrations {
if err := m(ctx, s.db); err != nil {
return err
}
}
return nil
}