Anthony Romano пре 8 година
родитељ
комит
d1dcc828c8
1 измењених фајлова са 4 додато и 5 уклоњено
  1. 4 5
      etcdctl/ctlv3/command/snapshot_command.go

+ 4 - 5
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()
 }