Skip to content

Commit 4331c69

Browse files
committed
remove unused error codes
1 parent 94aeb82 commit 4331c69

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

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

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,8 @@
2929
import com.alipay.remoting.*;
3030
import com.alipay.remoting.exception.RemotingException;
3131
import io.netty.buffer.ByteBuf;
32-
import io.netty.util.internal.ResourcesUtil;
3332
import org.slf4j.Logger;
3433

35-
import javax.xml.transform.Result;
36-
3734
import static com.alipay.oceanbase.rpc.protocol.packet.ObCompressType.INVALID_COMPRESSOR;
3835
import static com.alipay.oceanbase.rpc.protocol.packet.ObCompressType.NONE_COMPRESSOR;
3936

@@ -131,14 +128,14 @@ public ObPayload invokeSync(final ObTableConnection conn, final ObPayload reques
131128
logger.warn(errMessage);
132129
if (needFetchAll(resultCode.getRcode(), resultCode.getPcode())) {
133130
throw new ObTableNeedFetchAllException(errMessage);
134-
} else if (needFetchPartical(resultCode.getRcode())) {
131+
} else if (needFetchPartial(resultCode.getRcode())) {
135132
throw new ObTableRoutingWrongException(errMessage);
136133
} else {
137134
// Encountered an unexpected RoutingWrong error code,
138135
// possibly due to the client error code version being behind the observer's version.
139136
// Attempting a full refresh here
140137
// and delegating to the upper-level call to determine whether to throw the exception to the user based on the retry result.
141-
logger.warn("get unexpected error code: " + response.getMessage());
138+
logger.warn("get unexpected error code: {}", response.getMessage());
142139
throw new ObTableNeedFetchAllException(errMessage);
143140
}
144141
}
@@ -188,15 +185,9 @@ private boolean needFetchAll(int errorCode, int pcode) {
188185
|| errorCode == ResultCodes.OB_TABLE_NOT_EXIST.errorCode
189186
|| errorCode == ResultCodes.OB_TABLET_NOT_EXIST.errorCode
190187
|| errorCode == ResultCodes.OB_LS_NOT_EXIST.errorCode
191-
|| (pcode == Pcodes.OB_TABLE_API_LS_EXECUTE && errorCode == ResultCodes.OB_NOT_MASTER.errorCode)
192-
// Theoretically, this code should not be executed since there is no corresponding handling within the ODP.
193-
// However, the observer has flagged the following three error codes.
194-
// Adding this handling as a precautionary measure.
195-
|| errorCode == ResultCodes.OB_NO_READABLE_REPLICA.errorCode
196-
|| errorCode == ResultCodes.OB_USE_DUP_FOLLOW_AFTER_DML.errorCode
197-
|| errorCode == ResultCodes.OB_TRANS_STMT_NEED_RETRY.errorCode;
188+
|| (pcode == Pcodes.OB_TABLE_API_LS_EXECUTE && errorCode == ResultCodes.OB_NOT_MASTER.errorCode);
198189
}
199-
private boolean needFetchPartical(int errorCode) {
190+
private boolean needFetchPartial(int errorCode) {
200191
return errorCode == ResultCodes.OB_LOCATION_LEADER_NOT_EXIST.errorCode
201192
|| errorCode == ResultCodes.OB_NOT_MASTER.errorCode
202193
|| errorCode == ResultCodes.OB_RS_NOT_MASTER.errorCode
@@ -210,6 +201,7 @@ private boolean needFetchPartical(int errorCode) {
210201
|| errorCode == ResultCodes.OB_SERVER_IS_INIT.errorCode
211202
|| errorCode == ResultCodes.OB_SERVER_IS_STOPPING.errorCode
212203
|| errorCode == ResultCodes.OB_TENANT_NOT_IN_SERVER.errorCode
213-
|| errorCode == ResultCodes.OB_TRANS_RPC_TIMEOUT.errorCode;
204+
|| errorCode == ResultCodes.OB_TRANS_RPC_TIMEOUT.errorCode
205+
|| errorCode == ResultCodes.OB_NO_READABLE_REPLICA.errorCode;
214206
}
215207
}

0 commit comments

Comments
 (0)