mirror of https://github.com/tikv/client-java.git
[close #600] `ScanIterator` missing fetch the region keys because the wrong limit setting
Signed-off-by: Yi Xie <xieyi01@rd.netease.com> Co-authored-by: Yi Xie <xieyi01@rd.netease.com>
This commit is contained in:
parent
660199a2d2
commit
3163793311
|
|
@ -91,15 +91,13 @@ public abstract class ScanIterator implements Iterator<Kvrpcpb.KvPair> {
|
||||||
// Session should be single-threaded itself
|
// Session should be single-threaded itself
|
||||||
// so that we don't worry about conf change in the middle
|
// so that we don't worry about conf change in the middle
|
||||||
// of a transaction. Otherwise, below code might lose data
|
// of a transaction. Otherwise, below code might lose data
|
||||||
if (currentCache.size() < limit) {
|
int scanLimit = Math.min(limit, conf.getScanBatchSize());
|
||||||
|
if (currentCache.size() < scanLimit) {
|
||||||
startKey = curRegionEndKey;
|
startKey = curRegionEndKey;
|
||||||
lastKey = Key.toRawKey(curRegionEndKey);
|
lastKey = Key.toRawKey(curRegionEndKey);
|
||||||
} else if (currentCache.size() > limit) {
|
} else if (currentCache.size() > scanLimit) {
|
||||||
throw new IndexOutOfBoundsException(
|
throw new IndexOutOfBoundsException(
|
||||||
"current cache size = "
|
"current cache size = " + currentCache.size() + ", larger than " + scanLimit);
|
||||||
+ currentCache.size()
|
|
||||||
+ ", larger than "
|
|
||||||
+ conf.getScanBatchSize());
|
|
||||||
} else {
|
} else {
|
||||||
// Start new scan from exact next key in current region
|
// Start new scan from exact next key in current region
|
||||||
lastKey = Key.toRawKey(currentCache.get(currentCache.size() - 1).getKey());
|
lastKey = Key.toRawKey(currentCache.get(currentCache.size() - 1).getKey());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue