Skip to content

Commit

Permalink
Divided the operations for restoration from delta snapshot in smaller…
Browse files Browse the repository at this point in the history
… chunks to commit.
  • Loading branch information
abdasgupta committed Nov 5, 2020
1 parent 232a10b commit 1ef87cb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/snapshot/restorer/restorer.go
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,13 @@ func applyEventsToEtcd(client *clientv3.Client, events []event) error {
return fmt.Errorf("Unexpected event type")
}
}
_, err := client.Txn(ctx).Then(ops...).Commit()
fmt.Print("The size of operations is: ", len(ops))
var err error
for len(ops)/100 > 0 {
_, err = client.Txn(ctx).Then(ops...).Commit()
ops = ops[100:]
}
_, err = client.Txn(ctx).Then(ops...).Commit()
return err
}

Expand Down

0 comments on commit 1ef87cb

Please sign in to comment.