clientv3/concurrency: fix rev comparison on concurrent key deletion

This commit is contained in:
Derek Chiang 2017-01-18 08:21:07 -08:00 committed by Gyu-Ho Lee
parent 94eec5d41a
commit acec15ebc6

View File

@ -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 {