Explorar o código

concurrency: retry snapshot serializable stm if writes since first header rev

Was checking the rset key mod rev, which does not work.
Anthony Romano %!s(int64=8) %!d(string=hai) anos
pai
achega
1d195521c7
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  1. 3 2
      clientv3/concurrency/stm.go

+ 3 - 2
clientv3/concurrency/stm.go

@@ -193,11 +193,12 @@ func (rs readSet) add(keys []string, txnresp *v3.TxnResponse) {
 	}
 }
 
+// first returns the store revision from the first fetch
 func (rs readSet) first() int64 {
 	ret := int64(math.MaxInt64 - 1)
 	for _, resp := range rs {
-		if len(resp.Kvs) > 0 && resp.Kvs[0].ModRevision < ret {
-			ret = resp.Kvs[0].ModRevision
+		if rev := resp.Header.Revision; rev < ret {
+			ret = rev
 		}
 	}
 	return ret