benchmark: support mvcc txn

This commit is contained in:
Anthony Romano 2017-01-05 01:16:15 -08:00
parent 58da8b17ee
commit 0ed3c83e49

View File

@ -109,12 +109,9 @@ func mvccPutFunc(cmd *cobra.Command, args []string) {
for i := 0; i < totalNrKeys; i++ { for i := 0; i < totalNrKeys; i++ {
st := time.Now() st := time.Now()
if txn { if txn {
id := s.TxnBegin() tw := s.Write()
if _, err := s.TxnPut(id, keys[i], vals[i], lease.NoLease); err != nil { tw.Put(keys[i], vals[i], lease.NoLease)
fmt.Fprintln(os.Stderr, "txn put error:", err) tw.End()
os.Exit(1)
}
s.TxnEnd(id)
} else { } else {
s.Put(keys[i], vals[i], lease.NoLease) s.Put(keys[i], vals[i], lease.NoLease)
} }