Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BugFix] fix aynscRequest type error during the exception process #197

Open
wants to merge 11 commits into
base: obkv_params2
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
}
Expand Down Expand Up @@ -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;
Expand Down
Loading