Skip to content

Commit c9076a6

Browse files
committed
add refresh metadata log
1 parent 519f403 commit c9076a6

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ private <T> T execute(String tableName, TableExecuteCallback<T> callback, ObServ
485485
}
486486
tableParam = getTableParamWithRoute(tableName, rowKey, route);
487487
}
488+
logger.warn("[latency monitor] tableParm obTable ip:port is {}:{}", tableParam.getObTable().getIp(), tableParam.getObTable().getPort());
488489
T t = callback.execute(tableParam);
489490
resetExecuteContinuousFailureCount(tableName);
490491
return t;
@@ -700,6 +701,7 @@ private <T> T execute(String tableName, OperationExecuteCallback<T> callback,
700701
throw new ObTableException("RowKey or scan range is null");
701702
}
702703
}
704+
logger.warn("[latency monitor] tableParm obTable ip:port is {}:{}", tableParam.getObTable().getIp(), tableParam.getObTable().getPort());
703705
T t = callback.execute(tableParam);
704706
resetExecuteContinuousFailureCount(tableName);
705707
return t;

src/main/java/com/alipay/oceanbase/rpc/location/model/TableLocations.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,9 @@ public TableEntry refreshMeta(String tableName, ServerRoster serverRoster,
138138
tryTimes++;
139139
try {
140140
logger.warn("[latency monitor] try to acquire refresh table meta lock, tableName: {}", tableName);
141-
acquired = lock.tryLock(tableEntryRefreshLockTimeout, TimeUnit.MILLISECONDS);
141+
if (!acquired) {
142+
acquired = lock.tryLock(tableEntryRefreshLockTimeout, TimeUnit.MILLISECONDS);
143+
}
142144
if (!acquired) {
143145
String errMsg = "try to lock tableEntry refreshing timeout, tableName:" + tableName
144146
+ " , timeout:" + tableEntryRefreshLockTimeout + ".";
@@ -323,7 +325,9 @@ public TableEntry refreshPartitionLocation(TableEntry tableEntry, String tableNa
323325
}
324326
tryTimes++;
325327
try {
326-
acquired = lock.tryLock(tableEntryRefreshLockTimeout, TimeUnit.MILLISECONDS);
328+
if (!acquired) {
329+
acquired = lock.tryLock(tableEntryRefreshLockTimeout, TimeUnit.MILLISECONDS);
330+
}
327331
if (!acquired) {
328332
String errMsg = "try to lock tablet location refreshing timeout " + " ,tableName:"
329333
+ tableName + " , timeout:" + tableEntryRefreshLockTimeout + ".";
@@ -460,7 +464,9 @@ public TableEntry refreshTabletLocationBatch(TableEntry tableEntry, String table
460464
}
461465
tryTimes++;
462466
try {
463-
acquired = lock.tryLock(tableEntryRefreshLockTimeout, TimeUnit.MILLISECONDS);
467+
if (!acquired) {
468+
acquired = lock.tryLock(tableEntryRefreshLockTimeout, TimeUnit.MILLISECONDS);
469+
}
464470
if (!acquired) {
465471
logger.warn("[latency monitor] fail to acquire refresh tablet locations in batch lock, tableName: {}", tableName);
466472
String errMsg = "try to lock locations refreshing in batch timeout " + " ,tableName:"

src/main/java/com/alipay/oceanbase/rpc/location/model/TableRoute.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,13 +391,15 @@ public void refreshRosterByRsList(List<ObServerAddr> newRsList) throws Exception
391391
allDummyKey, newRsList);
392392
throw new ObTableUnexpectedException("all rs servers are not available");
393393
}
394+
logger.warn("[latency monitor] after loadTableEntryRandomly");
394395

395396
// 1. get tenant server address to renew ObTable roster
396397
List<ReplicaLocation> replicaLocations = tableEntry.getTableLocation()
397398
.getReplicaLocations();
398399
// update new ob table and get new server address
399400
List<ObServerAddr> servers = tableRoster.refreshTablesAndGetNewServers(replicaLocations);
400401
serverRoster.reset(servers);
402+
logger.warn("[latency monitor] after refreshTablesAndGetNewServers");
401403

402404
// 2. Get Server LDC info for weak read consistency.
403405
success = false;
@@ -426,6 +428,7 @@ public void refreshRosterByRsList(List<ObServerAddr> newRsList) throws Exception
426428
allDummyKey.getTenantName(), JSON.toJSON(serverRoster));
427429
throw new ObTableUnexpectedException("all tenant servers are not available");
428430
}
431+
logger.warn("[latency monitor] after getServerLdc");
429432

430433
// 3. reset Server LDC location.
431434
String regionFromOcp = configServerInfo.getIdc2Region(tableClient.getCurrentIDC());
@@ -710,6 +713,7 @@ private ObTableParam getTableInternal(String tableName, TableEntry tableEntry, l
710713
ObServerRoute route) throws Exception {
711714
ReplicaLocation replica = null;
712715
long tabletId = getTabletIdByPartId(tableEntry, partId);
716+
logger.warn("[latency monitor] tablet id: {}", tabletId);
713717
ObPartitionLocationInfo obPartitionLocationInfo = null;
714718
obPartitionLocationInfo = getOrRefreshPartitionInfo(tableEntry, tableName, tabletId);
715719
if (obPartitionLocationInfo.getPartitionLocation() == null) {

src/main/java/com/alipay/oceanbase/rpc/table/ObTableClientLSBatchOpsImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ public void partitionExecute(ObTableSingleOpResult[] results,
634634
}
635635
}
636636
}
637-
logger.warn("[latency monitor] ls_id: {}, tryTimes: {}", lsId, tryTimes);
637+
logger.warn("[latency monitor] ls_id: {}, tryTimes: {}, ip:port is: {}:{}", lsId, tryTimes, subObTable.getIp(), subObTable.getPort());
638638
ObPayload result = subObTable.execute(tableLsOpRequest);
639639
if (result != null && result.getPcode() == Pcodes.OB_TABLE_API_MOVE) {
640640
ObTableApiMove moveResponse = (ObTableApiMove) result;

0 commit comments

Comments
 (0)