Skip to content

Commit cf4c972

Browse files
committed
correct the exception in HBase mode using asyncQueryRequest
1 parent bdaa09d commit cf4c972

File tree

2 files changed

+26
-10
lines changed

2 files changed

+26
-10
lines changed

src/main/java/com/alipay/oceanbase/rpc/bolt/transport/ObTableRemoting.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public ObPayload invokeSync(final ObTableConnection conn, final ObPayload reques
122122
ObRpcResultCode resultCode = new ObRpcResultCode();
123123
resultCode.decode(buf);
124124
// If response indicates the request is routed to wrong server, we should refresh the routing meta.
125-
if (!conn.getObTable().getReRouting() &&response.getHeader().isRoutingWrong()) {
125+
if (!conn.getObTable().getReRouting() && response.getHeader().isRoutingWrong()) {
126126
String errMessage = TraceUtil.formatTraceMessage(conn, request,
127127
"routed to the wrong server: " + response.getMessage());
128128
logger.warn(errMessage);
@@ -139,7 +139,8 @@ public ObPayload invokeSync(final ObTableConnection conn, final ObPayload reques
139139
throw new ObTableNeedFetchAllException(errMessage);
140140
}
141141
}
142-
if (resultCode.getRcode() != 0 && response.getHeader().getPcode() != Pcodes.OB_TABLE_API_MOVE) {
142+
if (resultCode.getRcode() != 0
143+
&& response.getHeader().getPcode() != Pcodes.OB_TABLE_API_MOVE) {
143144
String errMessage = TraceUtil.formatTraceMessage(conn, request,
144145
"routed to the wrong server: " + response.getMessage());
145146
logger.warn(errMessage);

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

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import com.alipay.oceanbase.rpc.protocol.payload.impl.execute.ObTableEntityType;
3333
import com.alipay.oceanbase.rpc.protocol.payload.impl.execute.ObTableStreamRequest;
3434
import com.alipay.oceanbase.rpc.protocol.payload.impl.execute.QueryStreamResult;
35+
import com.alipay.oceanbase.rpc.protocol.payload.impl.execute.syncquery.ObTableQueryAsyncRequest;
3536
import com.alipay.oceanbase.rpc.protocol.payload.impl.execute.syncquery.ObTableQueryAsyncResult;
3637
import com.alipay.oceanbase.rpc.table.ObTable;
3738
import com.alipay.oceanbase.rpc.table.ObTableParam;
@@ -156,8 +157,12 @@ protected ObPayload commonExecute(ObTableClient client, Logger logger,
156157
result = subObTable.execute(request);
157158
if (result instanceof ObTableApiMove) {
158159
ObTableApiMove move = (ObTableApiMove) result;
159-
logger.warn("The server has not yet completed the master switch, and returned an incorrect leader with an IP address of {}. " +
160-
"Rerouting return IP is {}", moveResponse.getReplica().getServer().ipToString(), move .getReplica().getServer().ipToString());
160+
logger
161+
.warn(
162+
"The server has not yet completed the master switch, and returned an incorrect leader with an IP address of {}. "
163+
+ "Rerouting return IP is {}", moveResponse
164+
.getReplica().getServer().ipToString(), move.getReplica()
165+
.getServer().ipToString());
161166
throw new ObTableRoutingWrongException();
162167
}
163168
}
@@ -222,12 +227,22 @@ protected ObPayload commonExecute(ObTableClient client, Logger logger,
222227
throw e;
223228
}
224229
} else if (e instanceof ObTableException) {
225-
if ((((ObTableException) e).getErrorCode() == ResultCodes.OB_TABLE_NOT_EXIST.errorCode || ((ObTableException) e)
226-
.getErrorCode() == ResultCodes.OB_NOT_SUPPORTED.errorCode)
227-
&& ((ObTableQueryRequest) request).getTableQuery().isHbaseQuery()
228-
&& client.getTableGroupInverted().get(indexTableName) != null) {
229-
// table not exists && hbase mode && table group exists , three condition both
230-
client.eraseTableGroupFromCache(tableName);
230+
if (((ObTableException) e).getErrorCode() == ResultCodes.OB_TABLE_NOT_EXIST.errorCode
231+
|| ((ObTableException) e).getErrorCode() == ResultCodes.OB_NOT_SUPPORTED.errorCode) {
232+
if (request instanceof ObTableQueryRequest) {
233+
if (((ObTableQueryRequest) request).getTableQuery().isHbaseQuery()
234+
&& client.getTableGroupInverted().get(indexTableName) != null) {
235+
// table not exists && hbase mode && table group exists , three condition both
236+
client.eraseTableGroupFromCache(tableName);
237+
}
238+
} else if (request instanceof ObTableQueryAsyncRequest) {
239+
if (((ObTableQueryAsyncRequest) request).getObTableQueryRequest()
240+
.getTableQuery().isHbaseQuery()
241+
&& client.getTableGroupInverted().get(indexTableName) != null) {
242+
// table not exists && hbase mode && table group exists , three condition both
243+
client.eraseTableGroupFromCache(tableName);
244+
}
245+
}
231246
}
232247
if (((ObTableException) e).isNeedRefreshTableEntry()) {
233248
needRefreshTableEntry = true;

0 commit comments

Comments
 (0)