good morning!!!!

Skip to content
Snippets Groups Projects
Unverified Commit d7bcb298 authored by Alex Sharov's avatar Alex Sharov Committed by GitHub
Browse files

do commit by don't save partial progress (#1256)

parent 3bec75cd
No related branches found
No related tags found
No related merge requests found
......@@ -136,7 +136,11 @@ func (m *Migrator) Apply(db ethdb.Database, datadir string) error {
log.Info("Apply migration", "name", v.Name)
if err := v.Up(tx, datadir, func(putter ethdb.Putter, key []byte, isDone bool) error {
if !isDone {
return nil // don't save partial progress
// do commit, but don't save partial progress
if err := tx.CommitAndBegin(context.Background()); err != nil {
return err
}
return nil
}
commitFuncCalled = true
......
......@@ -60,11 +60,11 @@ var receiptsCborEncode = Migration{
return fmt.Errorf("clearing the receipt bucket: %w", err)
}
// Commit clearing of the bucket - freelist should now be written to the database
if err := OnLoadCommit(db, nil, true); err != nil {
if err := OnLoadCommit(db, nil, false); err != nil {
return fmt.Errorf("committing the removal of receipt table")
}
// Commit again
if err := OnLoadCommit(db, nil, true); err != nil {
if err := OnLoadCommit(db, nil, false); err != nil {
return fmt.Errorf("committing again to create a stable view the removal of receipt table")
}
// Now transaction would have been re-opened, and we should be re-using the space
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment