Skip to content

Commit 8d141db

Browse files
authored
do not retry any other errors and do not impact exception type thrown (#335)
1 parent 61885fa commit 8d141db

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
lines changed

src/main/java/com/alipay/oceanbase/rpc/protocol/payload/impl/execute/query/AbstractQueryStreamResult.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,7 @@ protected ObPayload commonExecute(ObTableClient client, Logger logger,
191191
} else {
192192
logger.warn("meet exception when execute in odp mode." +
193193
"tablename: {}, errMsg: {}", indexTableName, e.getMessage());
194-
// odp mode do not retry any other exceptions
195-
throw new ObTableException(e);
194+
throw e;
196195
}
197196
} else {
198197
needRefreshPartitionLocation = true;
@@ -370,7 +369,7 @@ public boolean next() throws Exception {
370369
break;
371370

372371
} catch (Exception e) {
373-
if (e instanceof ObTableNeedFetchMetaException) {
372+
if (shouldRetry(e)) {
374373
// TODO: need to skip over the partitions that have been scanned
375374
setExpectant(refreshPartition(tableQuery, tableName));
376375
// Reset the iterator to start over
@@ -574,6 +573,10 @@ protected void cacheStreamNext(ObPair<Long, ObTableParam> partIdWithObTable,
574573
}
575574
}
576575

576+
protected boolean shouldRetry(Throwable t) {
577+
return !client.isOdpMode() && t instanceof ObTableNeedFetchMetaException;
578+
}
579+
577580
/**
578581
* Get row.
579582
*/
@@ -612,7 +615,7 @@ public void init() throws Exception {
612615
// try access new partition, async will not remove useless expectant
613616
referToNewPartition(entry.getValue());
614617
} catch (Exception e) {
615-
if (e instanceof ObTableNeedFetchMetaException) {
618+
if (shouldRetry(e)) {
616619
resetCachedResult();
617620
setExpectant(refreshPartition(tableQuery, tableName));
618621
it = expectant.entrySet().iterator();

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public void init() throws Exception {
7676
referToNewPartition(firstEntry.getValue());
7777
break;
7878
} catch (Exception e) {
79-
if (e instanceof ObTableNeedFetchMetaException) {
79+
if (shouldRetry(e)) {
8080
setExpectant(refreshPartition(this.asyncRequest.getObTableQueryRequest()
8181
.getTableQuery(), client.getPhyTableNameFromTableGroup(entityType,
8282
tableName)));
@@ -232,7 +232,7 @@ public boolean next() throws Exception {
232232
// try access new partition, async will not remove useless expectant
233233
referToLastStreamResult(lastEntry.getValue());
234234
} catch (Exception e) {
235-
if (e instanceof ObTableNeedFetchMetaException) {
235+
if (shouldRetry(e)) {
236236
String realTableName = client.getPhyTableNameFromTableGroup(entityType,
237237
tableName);
238238
TableEntry entry = client.getOrRefreshTableEntry(realTableName, false);
@@ -272,7 +272,7 @@ public boolean next() throws Exception {
272272
// try access new partition, async will not remove useless expectant
273273
referToNewPartition(entry.getValue());
274274
} catch (Exception e) {
275-
if (e instanceof ObTableNeedFetchMetaException) {
275+
if (shouldRetry(e)) {
276276
String realTableName = client.getPhyTableNameFromTableGroup(entityType,
277277
tableName);
278278
TableEntry tableEntry = client.getOrRefreshTableEntry(realTableName, false);

src/main/java/com/alipay/oceanbase/rpc/table/ObTableClientBatchOpsImpl.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,7 @@ public void partitionExecute(ObTableOperationResult[] results,
399399
} else {
400400
logger.warn("meet exception when execute normal batch in odp mode."
401401
+ "tablename: {}, errMsg: {}", tableName, ex.getMessage());
402-
// odp mode do not retry any other exceptions
403-
throw new ObTableException(ex);
402+
throw ex;
404403
}
405404
} else if (ex instanceof ObTableReplicaNotReadableException) {
406405
if (System.currentTimeMillis() - startExecute < obTableClient
@@ -544,7 +543,7 @@ public void partitionExecute(ObTableOperationResult[] results,
544543
}
545544

546545
private boolean shouldRetry(Throwable throwable) {
547-
return throwable instanceof ObTableNeedFetchMetaException;
546+
return !obTableClient.isOdpMode() && throwable instanceof ObTableNeedFetchMetaException;
548547
}
549548

550549
private void executeWithRetries(ObTableOperationResult[] results, Map.Entry<Long, ObPair<ObTableParam, List<ObPair<Integer, ObTableOperation>>>> entry) throws Exception {

src/main/java/com/alipay/oceanbase/rpc/table/ObTableClientLSBatchOpsImpl.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -659,8 +659,7 @@ public void partitionExecute(ObTableSingleOpResult[] results,
659659
} else {
660660
logger.warn("meet exception when execute ls batch in odp mode." +
661661
"tablename: {}, errMsg: {}", realTableName, ex.getMessage());
662-
// odp mode do not retry any other exceptions
663-
throw new ObTableException(ex);
662+
throw ex;
664663
}
665664
} else if (ex instanceof ObTableReplicaNotReadableException) {
666665
if (System.currentTimeMillis() - startExecute < obTableClient.getRuntimeMaxWait()) {
@@ -823,7 +822,7 @@ public void partitionExecute(ObTableSingleOpResult[] results,
823822
}
824823

825824
private boolean shouldRetry(Throwable throwable) {
826-
return throwable instanceof ObTableNeedFetchMetaException;
825+
return !obTableClient.isOdpMode() && throwable instanceof ObTableNeedFetchMetaException;
827826
}
828827

829828
private void executeWithRetries(ObTableSingleOpResult[] results,

0 commit comments

Comments
 (0)