Skip to content

Commit

Permalink
etcdctl: support mvcc txn
Browse files Browse the repository at this point in the history
  • Loading branch information
Anthony Romano committed Jan 7, 2017
1 parent 6c28136 commit ce1b298
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions etcdctl/ctlv3/command/snapshot_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,19 +372,19 @@ func makeDB(snapdir, dbfile string, commit int) {
// having a new raft instance
be := backend.NewDefaultBackend(dbpath)
s := mvcc.NewStore(be, nil, (*initIndex)(&commit))
id := s.TxnBegin()
txn := s.Write()
btx := be.BatchTx()
del := func(k, v []byte) error {
_, _, err := s.TxnDeleteRange(id, k, nil)
return err
txn.DeleteRange(k, nil)
return nil
}

// delete stored members from old cluster since using new members
btx.UnsafeForEach([]byte("members"), del)
// todo: add back new members when we start to deprecate old snap file.
btx.UnsafeForEach([]byte("members_removed"), del)
// trigger write-out of new consistent index
s.TxnEnd(id)
txn.End()
s.Commit()
s.Close()
}
Expand Down

0 comments on commit ce1b298

Please sign in to comment.