Skip to content

Commit 8ef2267

Browse files
committed
Reduce log printing and optimize log output content;
1 parent af5a620 commit 8ef2267

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

src/main/java/com/alipay/oceanbase/rpc/ObTableClient.java

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,6 @@ private <T> T execute(String tableName, TableExecuteCallback<T> callback, ObServ
646646
resetExecuteContinuousFailureCount(tableName);
647647
return t;
648648
} catch (Exception ex) {
649-
RUNTIME.error("execute while meet exception", ex);
650649
if (odpMode) {
651650
if ((tryTimes - 1) < runtimeRetryTimes) {
652651
if (ex instanceof ObTableException) {
@@ -837,22 +836,23 @@ private <T> T execute(String tableName, OperationExecuteCallback<T> callback,
837836
if (odpMode) {
838837
if ((tryTimes - 1) < runtimeRetryTimes) {
839838
if (ex instanceof ObTableException) {
840-
logger
841-
.warn(
839+
logger.warn(
842840
"execute while meet Exception, errorCode: {} , errorMsg: {}, try times {}",
843841
((ObTableException) ex).getErrorCode(), ex.getMessage(),
844842
tryTimes);
845-
// if the cause is that ODP partition meta have expired, try to fetch new one
843+
// if the cause is that ODP partition meta have expired, try to fetch new one
846844
if (ex instanceof ObTablePartitionChangeException
847-
&& ((ObTablePartitionChangeException) ex).getErrorCode() == OB_ERR_KV_ROUTE_ENTRY_EXPIRE.errorCode) {
845+
&& ((ObTablePartitionChangeException) ex).getErrorCode() == OB_ERR_KV_ROUTE_ENTRY_EXPIRE.errorCode) {
848846
needRenew = true;
849847
} else {
848+
RUNTIME.error("execute while meet exception", ex);
850849
throw ex;
851850
}
852851
} else {
853852
logger.warn(
854-
"execute while meet Exception, exception: {}, try times {}", ex,
855-
tryTimes);
853+
"execute while meet Exception, exception: {}, try times {}", ex,
854+
tryTimes);
855+
RUNTIME.error("execute while meet exception", ex);
856856
throw ex;
857857
}
858858
} else {
@@ -867,40 +867,41 @@ private <T> T execute(String tableName, OperationExecuteCallback<T> callback,
867867
route.addToBlackList(obPair.getRight().getObTable().getIp());
868868
}
869869
} else {
870-
logger.warn("exhaust retry when replica not readable: {}",
871-
ex.getMessage());
870+
logger.warn("exhaust retry when replica not readable: {}", ex.getMessage());
872871
RUNTIME.error("replica not readable", ex);
873872
throw ex;
874873
}
875874
} else if (ex instanceof ObTableException
876-
&& ((ObTableException) ex).isNeedRefreshTableEntry()) {
877-
// if the problem is the lack of row key name, throw directly
875+
&& ((ObTableException) ex).isNeedRefreshTableEntry()) {
876+
// if the problem is the lack of row key name, throw directly
878877
if (tableRowKeyElement.get(tableName) == null) {
878+
logger.warn("tableRowKeyElement not found table name: {}", ex.getMessage());
879+
RUNTIME.error("tableRowKeyElement not found table name", ex);
879880
throw ex;
880881
}
881882
needRefreshTableEntry = true;
882883

883-
logger
884-
.warn(
884+
logger.warn(
885885
"refresh table while meet Exception needing refresh, errorCode: {}, errorMsg: {}",
886886
((ObTableException) ex).getErrorCode(), ex.getMessage());
887887
if (retryOnChangeMasterTimes && (tryTimes - 1) < runtimeRetryTimes) {
888-
logger
889-
.warn(
890-
"retry while meet Exception needing refresh, errorCode: {} , errorMsg: {},retry times {}",
888+
logger.warn(
889+
"retry while meet Exception needing refresh, errorCode: {} , errorMsg: {}, retry times {}",
891890
((ObTableException) ex).getErrorCode(), ex.getMessage(),
892891
tryTimes);
893892
if (ex instanceof ObTableNeedFetchAllException) {
894-
getOrRefreshTableEntry(tableName, needRefreshTableEntry, isTableEntryRefreshIntervalWait(), true);
895-
// reset failure count while fetch all route info
893+
getOrRefreshTableEntry(tableName, true, true, true);
894+
// reset failure count while fetch all route info
896895
this.resetExecuteContinuousFailureCount(tableName);
897896
}
898897
} else {
899898
calculateContinuousFailure(tableName, ex.getMessage());
899+
RUNTIME.error("execute while meet exception", ex);
900900
throw ex;
901901
}
902902
} else {
903903
calculateContinuousFailure(tableName, ex.getMessage());
904+
RUNTIME.error("execute while meet exception", ex);
904905
throw ex;
905906
}
906907
}

src/main/java/com/alipay/oceanbase/rpc/location/LocationUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,10 +746,10 @@ private static TableEntry getTableEntryFromRemote(Connection connection, TableEn
746746
}
747747

748748
if (ObGlobal.obVsnMajor() >= 4) {
749-
// only set empty partitionEntry
750749
if (tableEntry.getPartitionNum() <= TABLE_ENTRY_LOCATION_REFRESH_THRESHOLD) {
751750
getTableEntryLocationFromRemote(connection, key, tableEntry);
752751
} else {
752+
// only set empty partitionEntry
753753
ObPartitionEntry partitionEntry = new ObPartitionEntry();
754754
tableEntry.setPartitionEntry(partitionEntry);
755755
tableEntry.setRefreshTimeMills(System.currentTimeMillis());

0 commit comments

Comments
 (0)