mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
storage: let range work in the process of txn
range should work in the process of txn to help check the status during the txn.
This commit is contained in:
parent
6d97dcaf3f
commit
9960651c3f
@ -259,14 +259,16 @@ func (a *store) Equal(b *store) bool {
|
|||||||
|
|
||||||
// range is a keyword in Go, add Keys suffix.
|
// range is a keyword in Go, add Keys suffix.
|
||||||
func (s *store) rangeKeys(key, end []byte, limit, rangeRev int64) (kvs []storagepb.KeyValue, rev int64, err error) {
|
func (s *store) rangeKeys(key, end []byte, limit, rangeRev int64) (kvs []storagepb.KeyValue, rev int64, err error) {
|
||||||
if rangeRev > s.currentRev.main {
|
curRev := int64(s.currentRev.main)
|
||||||
|
if s.currentRev.sub > 0 {
|
||||||
|
curRev += 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if rangeRev > curRev {
|
||||||
return nil, s.currentRev.main, ErrFutureRev
|
return nil, s.currentRev.main, ErrFutureRev
|
||||||
}
|
}
|
||||||
if rangeRev <= 0 {
|
if rangeRev <= 0 {
|
||||||
rev = int64(s.currentRev.main)
|
rev = curRev
|
||||||
if s.currentRev.sub > 0 {
|
|
||||||
rev += 1
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
rev = rangeRev
|
rev = rangeRev
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user