Skip to content

Commit 470423c

Browse files
committed
set connectTimeout to 3s, add log, add useSSL=false to jdbc url
1 parent e42e8fc commit 470423c

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,9 @@ public static List<ObServerLdcItem> getServerLdc(ServerRoster serverRoster,
303303
*/
304304
private static String formatObServerUrl(ObServerAddr obServerAddr, long connectTimeout,
305305
long socketTimeout) {
306+
logger.warn("[latency monitor] format jdbc url, connectTimeout: {}, socketTimeout: {}", connectTimeout, socketTimeout);
306307
return format(
307-
"jdbc:mysql://%s/oceanbase?useUnicode=true&characterEncoding=utf-8&connectTimeout=%d&socketTimeout=%d",
308+
"jdbc:mysql://%s/oceanbase?useUnicode=true&characterEncoding=utf-8&useSSL=false&connectTimeout=%d&socketTimeout=%d",
308309
obServerAddr.getIp() + ":" + obServerAddr.getSqlPort(), connectTimeout, socketTimeout);
309310
}
310311

@@ -322,6 +323,7 @@ private static Connection getMetaRefreshConnection(String url, ObUserAuth sysUA)
322323
return DriverManager.getConnection(url, sysUA.getUserName(), sysUA.getPassword());
323324
} catch (Exception e) {
324325
RUNTIME.error(LCD.convert("01-00005"), e.getMessage(), e);
326+
logger.error("[latency monitor] fail to get connection by JDBC");
325327
// Since the JDBC connection fails here, it is likely that the server has crashed or scaling down.
326328
// Therefore, we need to set the Inactive flag of the ObTableEntryRefreshException to true.
327329
// This allows the upper-layer retry mechanism to catch this exception and immediately refresh the metadata.
@@ -419,8 +421,8 @@ private static TableEntry callTableEntryRefresh(ObServerAddr obServerAddr, Table
419421
try {
420422
long start = System.currentTimeMillis();
421423
connection = getMetaRefreshConnection(url, sysUA);
422-
logger.warn("[latency monitor] time to build JDBC connection: {}",
423-
System.currentTimeMillis() - start);
424+
logger.warn("[latency monitor] time to build JDBC connection: {}, url: {}",
425+
System.currentTimeMillis() - start, url);
424426
entry = callback.execute(connection);
425427
} catch (ObTableNotExistException e) {
426428
// avoid to refresh meta for ObTableNotExistException

src/main/java/com/alipay/oceanbase/rpc/property/Property.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public enum Property {
5353
RS_LIST_ACQUIRE_RETRY_INTERNAL("rs.list.acquire.retry.internal", 100L, "每次尝试获取RS列表的时间间隔"),
5454

5555
// [ObTableClient][TABLE_ENTRY]
56-
TABLE_ENTRY_ACQUIRE_CONNECT_TIMEOUT("table.entry.acquire.connect.timeout", 500L,
56+
TABLE_ENTRY_ACQUIRE_CONNECT_TIMEOUT("table.entry.acquire.connect.timeout", 3000L,
5757
"刷新TABLE地址的建连超时时间"),
5858

5959
TABLE_ENTRY_ACQUIRE_SOCKET_TIMEOUT("table.entry.acquire.socket.timeout", 3000L,

0 commit comments

Comments
 (0)