Skip to content

Commit 56b4bf2

Browse files
committed
Remove unnecessary comments and format code
1 parent 8d81dc7 commit 56b4bf2

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
@@ -1338,7 +1338,7 @@ public TableEntry refreshTableLocationByTabletId(TableEntry tableEntry, String t
13381338

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

@@ -2036,7 +2036,7 @@ public List<ObPair<Long, ObTableParam>> getTables(String tableName, ObTableQuery
20362036
// obTableParams -> List<Pair<logicId, obTableParams>>
20372037
List<ObPair<Long, ObTableParam>> obTableParams = new ArrayList<ObPair<Long, ObTableParam>>();
20382038
for (ObPair<Long, ReplicaLocation> partIdWithReplica : partIdWithReplicaList) {
2039-
long tabletId = partIdWithReplica.getLeft();
2039+
long partId = partIdWithReplica.getLeft();
20402040
ReplicaLocation replica = partIdWithReplica.getRight();
20412041
ObServerAddr addr = replica.getAddr();
20422042
ObTable obTable = tableRoster.get(addr);
@@ -2048,7 +2048,7 @@ public List<ObPair<Long, ObTableParam>> getTables(String tableName, ObTableQuery
20482048
addr, addrExpired);
20492049
syncRefreshMetadata();
20502050
tableEntry = getOrRefreshTableEntry(tableName, true, waitForRefresh, false);
2051-
replica = getPartitionLocation(tableEntry, tabletId, route);
2051+
replica = getPartitionLocation(tableEntry, partId, route);
20522052
addr = replica.getAddr();
20532053
obTable = tableRoster.get(addr);
20542054
}
@@ -2059,9 +2059,14 @@ public List<ObPair<Long, ObTableParam>> getTables(String tableName, ObTableQuery
20592059
}
20602060

20612061
ObTableParam param = new ObTableParam(obTable);
2062+
if (ObGlobal.obVsnMajor() >= 4) {
2063+
long partIdx = tableEntry.getPartIdx(partId);
2064+
partId = tableEntry.isPartitionTable() ? tableEntry.getPartitionInfo()
2065+
.getPartTabletIdMap().get(partIdx) : partId;
2066+
}
20622067
param.setTableId(tableEntry.getTableId());
20632068
// real partition(tablet) id
2064-
param.setPartitionId(tabletId);
2069+
param.setPartitionId(partId);
20652070

20662071
addr.recordAccess();
20672072
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
@@ -52,7 +52,6 @@ public abstract class AbstractQueryStreamResult extends AbstractPayload implemen
5252
protected volatile boolean closed = false;
5353
protected volatile List<ObObj> row = null;
5454
protected volatile int rowIndex = -1;
55-
// 调整它的startKey
5655
protected ObTableQuery tableQuery;
5756
protected long operationTimeout = -1;
5857
protected String tableName;

0 commit comments

Comments
 (0)