From 56762268675807d229d31b660421bd3cb8c73465 Mon Sep 17 00:00:00 2001 From: Derek Chiang Date: Wed, 18 Jan 2017 08:21:07 -0800 Subject: [PATCH] clientv3/concurrency: fix rev comparison on concurrent key deletion --- clientv3/concurrency/stm.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/clientv3/concurrency/stm.go b/clientv3/concurrency/stm.go index 056ebfb75..83333b932 100644 --- a/clientv3/concurrency/stm.go +++ b/clientv3/concurrency/stm.go @@ -249,11 +249,10 @@ func (s *stmReadCommitted) commit() *v3.TxnResponse { } func isKeyCurrent(k string, r *v3.GetResponse) v3.Cmp { - rev := r.Header.Revision + 1 if len(r.Kvs) != 0 { - rev = r.Kvs[0].ModRevision + 1 + return v3.Compare(v3.ModRevision(k), "=", r.Kvs[0].ModRevision) } - return v3.Compare(v3.ModRevision(k), "<", rev) + return v3.Compare(v3.ModRevision(k), "=", 0) } func respToValue(resp *v3.GetResponse) string {