Browse Source

clientv3/concurrency: fix rev comparison on concurrent key deletion

Derek Chiang 9 years ago
parent
commit
acec15ebc6
1 changed files with 2 additions and 3 deletions
  1. 2 3
      clientv3/concurrency/stm.go

+ 2 - 3
clientv3/concurrency/stm.go

@@ -249,11 +249,10 @@ func (s *stmReadCommitted) commit() *v3.TxnResponse {
 }
 }
 
 
 func isKeyCurrent(k string, r *v3.GetResponse) v3.Cmp {
 func isKeyCurrent(k string, r *v3.GetResponse) v3.Cmp {
-	rev := r.Header.Revision + 1
 	if len(r.Kvs) != 0 {
 	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 {
 func respToValue(resp *v3.GetResponse) string {