From d69233ada91eb28b25cae7503479e8f865ce5e61 Mon Sep 17 00:00:00 2001 From: Anthony Romano Date: Mon, 13 Feb 2017 09:38:54 -0800 Subject: [PATCH] etcdctl: support mvcc txn --- etcdctl/ctlv3/command/snapshot_command.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/etcdctl/ctlv3/command/snapshot_command.go b/etcdctl/ctlv3/command/snapshot_command.go index 28f2d8bc6388..bcfd8145fde9 100644 --- a/etcdctl/ctlv3/command/snapshot_command.go +++ b/etcdctl/ctlv3/command/snapshot_command.go @@ -375,13 +375,12 @@ func makeDB(snapdir, dbfile string, commit int) { be := backend.NewDefaultBackend(dbpath) // a lessor never timeouts leases lessor := lease.NewLessor(be, math.MaxInt64) - s := mvcc.NewStore(be, lessor, (*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 @@ -389,7 +388,7 @@ func makeDB(snapdir, dbfile string, commit int) { // 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() }