瀏覽代碼

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

Was checking the rset key mod rev, which does not work.
Anthony Romano 8 年之前
父節點
當前提交
1d195521c7
共有 1 個文件被更改,包括 3 次插入2 次删除
  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