Skip to content

Commit 8d60c55

Browse files
committed
Remove unnecessary comments and format code
1 parent 1d46a86 commit 8d60c55

File tree

5 files changed

+10
-26
lines changed

5 files changed

+10
-26
lines changed

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,7 +1337,7 @@ public TableEntry refreshTableLocationByTabletId(TableEntry tableEntry, String t
13371337

13381338
long lastRefreshTime = tableEntry.getPartitionEntry().getPartitionInfo(tabletId).getLastUpdateTime();
13391339
long currentTime = System.currentTimeMillis();
1340-
if (currentTime - lastRefreshTime < 200) {
1340+
if (currentTime - lastRefreshTime < tableEntryRefreshIntervalBase) {
13411341
return tableEntry;
13421342
}
13431343

@@ -2027,7 +2027,7 @@ public List<ObPair<Long, ObTableParam>> getTables(String tableName, ObTableQuery
20272027
// obTableParams -> List<Pair<logicId, obTableParams>>
20282028
List<ObPair<Long, ObTableParam>> obTableParams = new ArrayList<ObPair<Long, ObTableParam>>();
20292029
for (ObPair<Long, ReplicaLocation> partIdWithReplica : partIdWithReplicaList) {
2030-
long tabletId = partIdWithReplica.getLeft();
2030+
long partId = partIdWithReplica.getLeft();
20312031
ReplicaLocation replica = partIdWithReplica.getRight();
20322032
ObServerAddr addr = replica.getAddr();
20332033
ObTable obTable = tableRoster.get(addr);
@@ -2039,7 +2039,7 @@ public List<ObPair<Long, ObTableParam>> getTables(String tableName, ObTableQuery
20392039
addr, addrExpired);
20402040
syncRefreshMetadata();
20412041
tableEntry = getOrRefreshTableEntry(tableName, true, waitForRefresh, false);
2042-
replica = getPartitionLocation(tableEntry, tabletId, route);
2042+
replica = getPartitionLocation(tableEntry, partId, route);
20432043
addr = replica.getAddr();
20442044
obTable = tableRoster.get(addr);
20452045
}
@@ -2050,9 +2050,14 @@ public List<ObPair<Long, ObTableParam>> getTables(String tableName, ObTableQuery
20502050
}
20512051

20522052
ObTableParam param = new ObTableParam(obTable);
2053+
if (ObGlobal.obVsnMajor() >= 4) {
2054+
long partIdx = tableEntry.getPartIdx(partId);
2055+
partId = tableEntry.isPartitionTable() ? tableEntry.getPartitionInfo()
2056+
.getPartTabletIdMap().get(partIdx) : partId;
2057+
}
20532058
param.setTableId(tableEntry.getTableId());
20542059
// real partition(tablet) id
2055-
param.setPartitionId(tabletId);
2060+
param.setPartitionId(partId);
20562061

20572062
addr.recordAccess();
20582063
obTableParams.add(new ObPair<Long, ObTableParam>(partIdWithReplica.getLeft(), param));

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public ObPayload invokeSync(final ObTableConnection conn, final ObPayload reques
122122
ObRpcResultCode resultCode = new ObRpcResultCode();
123123
resultCode.decode(buf);
124124
// If response indicates the request is routed to wrong server, we should refresh the routing meta.
125-
if (!conn.getObTable().getReRouting() &&response.getHeader().isRoutingWrong()) {
125+
if (!conn.getObTable().getReRouting() && response.getHeader().isRoutingWrong()) {
126126
String errMessage = TraceUtil.formatTraceMessage(conn, request,
127127
"routed to the wrong server: " + response.getMessage());
128128
logger.warn(errMessage);

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

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -55,25 +55,8 @@ public class TableEntry {
5555
private TableEntryKey tableEntryKey = null;
5656
private volatile ObPartitionEntry partitionEntry = null;
5757

58-
// tablet id ==> refresh time
59-
private final ConcurrentHashMap<Long, Long> refreshTimeMap = new ConcurrentHashMap<>();
6058
public ConcurrentHashMap<Long, Lock> refreshLockMap = new ConcurrentHashMap<>();
6159

62-
public long getTabletLocationLastRefreshTimeMills(Long tabletId) {
63-
return refreshTimeMap.getOrDefault(tabletId, 0L);
64-
}
65-
public void setTableLocationLastRefreshTimeMills(Long tabletId, Long lastRefreshTime) {
66-
refreshTimeMap.put(tabletId, lastRefreshTime);
67-
}
68-
69-
public Lock getRefreshLock(Long tabletId) {
70-
return refreshLockMap.get(tabletId);
71-
}
72-
public void setRefreshLock(Long tabletId, Lock refreshLock) {
73-
refreshLockMap.put(tabletId, refreshLock);
74-
}
75-
76-
7760
/*
7861
* Is valid.
7962
*/

src/main/java/com/alipay/oceanbase/rpc/location/model/partition/ObPartitionEntry.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ public class ObPartitionEntry {
3131
private Map<Long, Long> tabletLsIdMap = new HashMap<>();
3232

3333
// tabelt id -> (PartitionLocation, LsId)
34-
// tablet id 作为索引管理PartitionInfo 其中包含了 PartitionLocation 和LSID
35-
// 外部会通过tablet id并发的读写ObPartitionLocationInfo
36-
// 写的场景就是更新,读的场景是正常的请求执行,需要保证读写的安全性,更新的时候一方面是保证线程安全,另一方面还需要保证不能频繁更新
3734
private ConcurrentHashMap<Long, ObPartitionLocationInfo> partitionInfos = new ConcurrentHashMap<>();
3835

3936

src/main/java/com/alipay/oceanbase/rpc/protocol/payload/impl/execute/query/AbstractQueryStreamResult.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ public abstract class AbstractQueryStreamResult extends AbstractPayload implemen
5151
protected volatile boolean closed = false;
5252
protected volatile List<ObObj> row = null;
5353
protected volatile int rowIndex = -1;
54-
// 调整它的startKey
5554
protected ObTableQuery tableQuery;
5655
protected long operationTimeout = -1;
5756
protected String tableName;

0 commit comments

Comments
 (0)