Skip to content

Commit ea257f8

Browse files
committed
fix dr nullptr
1 parent 8beb8de commit ea257f8

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1664,7 +1664,10 @@ private ObPair<Long, ReplicaLocation> getPartitionReplica(TableEntry tableEntry,
16641664
*/
16651665
private ReplicaLocation getPartitionLocation(TableEntry tableEntry, long partId,
16661666
ObServerRoute route) {
1667-
return tableEntry.getPartitionEntry().getPartitionLocationWithPartId(partId)
1667+
// In all cases for 3.x and for non-partitioned tables in 4.x, partId will not change.
1668+
// If it is 4.x, it will be converted to tablet id.
1669+
partId = getTabletIdByPartId(tableEntry, partId);
1670+
return tableEntry.getPartitionEntry().getPartitionLocationWithTabletId(partId)
16681671
.getReplica(route);
16691672

16701673
}

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,18 @@ public ObPartitionLocation getPartitionLocationWithPartId(long partId) {
6767
}
6868

6969
/*
70-
* Put partition location with part id.
70+
* Get partition location with tablet id.
7171
*/
72-
public ObPartitionLocation putPartitionLocationWithPartId(long partId,
73-
ObPartitionLocation ObpartitionLocation) {
74-
return partitionLocation.put(partId, ObpartitionLocation);
72+
public ObPartitionLocation getPartitionLocationWithTabletId(long tabletId) {
73+
return partitionLocation.get(tabletId);
7574
}
7675

7776
/*
78-
* Get partition location with tablet id.
77+
* Put partition location with part id.
7978
*/
80-
public ObPartitionLocation getPartitionLocationWithTabletId(long tabletId) {
81-
return partitionLocation.get(tabletId);
79+
public ObPartitionLocation putPartitionLocationWithPartId(long partId,
80+
ObPartitionLocation ObpartitionLocation) {
81+
return partitionLocation.put(partId, ObpartitionLocation);
8282
}
8383

8484
/*

0 commit comments

Comments
 (0)