Skip to content

Commit bc5d62c

Browse files
authored
add hasDoneRpc flag for obkv hbase scan (#426)
1 parent 6694741 commit bc5d62c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/main/java/com/alipay/oceanbase/rpc/stream/ObTableClientQueryAsyncStreamResult.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public class ObTableClientQueryAsyncStreamResult extends AbstractQueryStreamResu
4646
private ObTableQueryAsyncRequest asyncRequest = new ObTableQueryAsyncRequest();
4747
private ObTableConnection prevConnection = null;
4848
private boolean allowDistributeScan = true; // false when partition scan
49+
private boolean hasDoneRpc = false; // this flag is for obkv-hbase scan
4950

5051
@Override
5152
public void init() throws Exception {
@@ -74,6 +75,7 @@ public void init() throws Exception {
7475
while (it.hasNext()) {
7576
Map.Entry<Long, ObPair<Long, ObTableParam>> firstEntry = it.next();
7677
try {
78+
hasDoneRpc = true;
7779
// try access new partition, async will not remove useless expectant
7880
referToNewPartition(firstEntry.getValue());
7981
break;
@@ -183,6 +185,7 @@ public boolean queryLastStreamResultInNext() throws Exception {
183185
Iterator<Map.Entry<Long, ObPair<Long, ObTableParam>>> it = expectant.entrySet().iterator();
184186
Map.Entry<Long, ObPair<Long, ObTableParam>> lastEntry = it.next();
185187
try {
188+
hasDoneRpc = true;
186189
// try access new partition, async will not remove useless expectant
187190
referToLastStreamResult(lastEntry.getValue());
188191
} catch (Exception e) {
@@ -223,6 +226,7 @@ public boolean queryNewStreamResultInNext() throws Exception {
223226
int retryTimes = 0;
224227
long startExecute = System.currentTimeMillis();
225228
while (it.hasNext()) {
229+
hasDoneRpc = true;
226230
Map.Entry<Long, ObPair<Long, ObTableParam>> entry = it.next();
227231
try {
228232
// try access new partition, async will not remove useless expectant
@@ -316,6 +320,7 @@ public boolean next() throws Exception {
316320
checkStatus();
317321
lock.lock();
318322
try {
323+
hasDoneRpc = false;
319324
// firstly, refer to the cache
320325
if (!cacheRows.isEmpty()) {
321326
nextRow();
@@ -453,4 +458,8 @@ private boolean needTabletId(ObTableQueryRequest queryRequest) {
453458
public void setAllowDistributeScan(boolean allowDistributeScan) {
454459
this.allowDistributeScan = allowDistributeScan;
455460
}
461+
462+
public boolean hasDoneRpc() {
463+
return hasDoneRpc;
464+
}
456465
}

0 commit comments

Comments
 (0)