From 103112b5913b33b37e9075e48f764f1044e3f294 Mon Sep 17 00:00:00 2001 From: Armon Dadgar Date: Wed, 10 Dec 2014 23:49:23 -0800 Subject: [PATCH] consul: Fixing accidental commit of transaction --- consul/state_store.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/consul/state_store.go b/consul/state_store.go index e3b43b801a..10883dd33f 100644 --- a/consul/state_store.go +++ b/consul/state_store.go @@ -1212,7 +1212,10 @@ func (s *StateStore) kvsDeleteWithIndex(index uint64, tableIndex string, parts . return err } defer tx.Abort() - return s.kvsDeleteWithIndexTxn(index, tx, tableIndex, parts...) + if err := s.kvsDeleteWithIndexTxn(index, tx, tableIndex, parts...); err != nil { + return err + } + return tx.Commit() } // kvsDeleteWithIndexTxn does a delete within an existing transaction @@ -1259,7 +1262,7 @@ func (s *StateStore) kvsDeleteWithIndexTxn(index uint64, tx *MDBTxn, tableIndex } }) } - return tx.Commit() + return nil } // KVSCheckAndSet is used to perform an atomic check-and-set