diff --git a/src/main/java/com/alipay/oceanbase/rpc/bolt/transport/ObTableRemoting.java b/src/main/java/com/alipay/oceanbase/rpc/bolt/transport/ObTableRemoting.java index e3d26f0d..8a6914a9 100644 --- a/src/main/java/com/alipay/oceanbase/rpc/bolt/transport/ObTableRemoting.java +++ b/src/main/java/com/alipay/oceanbase/rpc/bolt/transport/ObTableRemoting.java @@ -122,7 +122,7 @@ public ObPayload invokeSync(final ObTableConnection conn, final ObPayload reques ObRpcResultCode resultCode = new ObRpcResultCode(); resultCode.decode(buf); // If response indicates the request is routed to wrong server, we should refresh the routing meta. - if (!conn.getObTable().getReRouting() &&response.getHeader().isRoutingWrong()) { + if (!conn.getObTable().getReRouting() && response.getHeader().isRoutingWrong()) { String errMessage = TraceUtil.formatTraceMessage(conn, request, "routed to the wrong server: " + response.getMessage()); logger.warn(errMessage); @@ -139,7 +139,8 @@ public ObPayload invokeSync(final ObTableConnection conn, final ObPayload reques throw new ObTableNeedFetchAllException(errMessage); } } - if (resultCode.getRcode() != 0 && response.getHeader().getPcode() != Pcodes.OB_TABLE_API_MOVE) { + if (resultCode.getRcode() != 0 + && response.getHeader().getPcode() != Pcodes.OB_TABLE_API_MOVE) { String errMessage = TraceUtil.formatTraceMessage(conn, request, "routed to the wrong server: " + response.getMessage()); logger.warn(errMessage); diff --git a/src/main/java/com/alipay/oceanbase/rpc/protocol/payload/impl/execute/query/AbstractQueryStreamResult.java b/src/main/java/com/alipay/oceanbase/rpc/protocol/payload/impl/execute/query/AbstractQueryStreamResult.java index 7cd75788..e8efd240 100644 --- a/src/main/java/com/alipay/oceanbase/rpc/protocol/payload/impl/execute/query/AbstractQueryStreamResult.java +++ b/src/main/java/com/alipay/oceanbase/rpc/protocol/payload/impl/execute/query/AbstractQueryStreamResult.java @@ -32,6 +32,7 @@ import com.alipay.oceanbase.rpc.protocol.payload.impl.execute.ObTableEntityType; import com.alipay.oceanbase.rpc.protocol.payload.impl.execute.ObTableStreamRequest; import com.alipay.oceanbase.rpc.protocol.payload.impl.execute.QueryStreamResult; +import com.alipay.oceanbase.rpc.protocol.payload.impl.execute.syncquery.ObTableQueryAsyncRequest; import com.alipay.oceanbase.rpc.protocol.payload.impl.execute.syncquery.ObTableQueryAsyncResult; import com.alipay.oceanbase.rpc.table.ObTable; import com.alipay.oceanbase.rpc.table.ObTableParam; @@ -156,8 +157,12 @@ protected ObPayload commonExecute(ObTableClient client, Logger logger, result = subObTable.execute(request); if (result instanceof ObTableApiMove) { ObTableApiMove move = (ObTableApiMove) result; - logger.warn("The server has not yet completed the master switch, and returned an incorrect leader with an IP address of {}. " + - "Rerouting return IP is {}", moveResponse.getReplica().getServer().ipToString(), move .getReplica().getServer().ipToString()); + logger + .warn( + "The server has not yet completed the master switch, and returned an incorrect leader with an IP address of {}. " + + "Rerouting return IP is {}", moveResponse + .getReplica().getServer().ipToString(), move.getReplica() + .getServer().ipToString()); throw new ObTableRoutingWrongException(); } } @@ -222,12 +227,22 @@ protected ObPayload commonExecute(ObTableClient client, Logger logger, throw e; } } else if (e instanceof ObTableException) { - if ((((ObTableException) e).getErrorCode() == ResultCodes.OB_TABLE_NOT_EXIST.errorCode || ((ObTableException) e) - .getErrorCode() == ResultCodes.OB_NOT_SUPPORTED.errorCode) - && ((ObTableQueryRequest) request).getTableQuery().isHbaseQuery() - && client.getTableGroupInverted().get(indexTableName) != null) { - // table not exists && hbase mode && table group exists , three condition both - client.eraseTableGroupFromCache(tableName); + if (((ObTableException) e).getErrorCode() == ResultCodes.OB_TABLE_NOT_EXIST.errorCode + || ((ObTableException) e).getErrorCode() == ResultCodes.OB_NOT_SUPPORTED.errorCode) { + if (request instanceof ObTableQueryRequest) { + if (((ObTableQueryRequest) request).getTableQuery().isHbaseQuery() + && client.getTableGroupInverted().get(indexTableName) != null) { + // table not exists && hbase mode && table group exists , three condition both + client.eraseTableGroupFromCache(tableName); + } + } else if (request instanceof ObTableQueryAsyncRequest) { + if (((ObTableQueryAsyncRequest) request).getObTableQueryRequest() + .getTableQuery().isHbaseQuery() + && client.getTableGroupInverted().get(indexTableName) != null) { + // table not exists && hbase mode && table group exists , three condition both + client.eraseTableGroupFromCache(tableName); + } + } } if (((ObTableException) e).isNeedRefreshTableEntry()) { needRefreshTableEntry = true;