Skip to content

Commit 4d277c9

Browse files
committed
fix batch in odp mode after merge
1 parent 7134d32 commit 4d277c9

File tree

4 files changed

+279
-124
lines changed

4 files changed

+279
-124
lines changed

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

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,16 @@ public Map<Long, ObPair<ObTableParam, List<ObPair<Integer, ObTableOperation>>>>
231231
for (int j = 0; j < rowKeySize; j++) {
232232
rowKey[j] = rowKeyObject.getObj(j).getValue();
233233
}
234-
ObPair<Long, ObTableParam> tableObPair = obTableClient.getTable(
235-
tableName, rowKey, false, false,
236-
obTableClient.getRoute(batchOperation.isReadOnly()));
234+
ObPair<Long, ObTableParam> tableObPair = null;
235+
if (!obTableClient.isOdpMode()) {
236+
tableObPair = obTableClient.getTable(tableName, rowKey,
237+
false, false, obTableClient.getRoute(batchOperation.isReadOnly()));
238+
} else {
239+
tableObPair = obTableClient.getODPTableWithRowKeyValue(tableName, rowKey, false);
240+
}
241+
if (tableObPair == null) {
242+
throw new ObTableUnexpectedException("fail to get table pair in batch");
243+
}
237244
ObPair<ObTableParam, List<ObPair<Integer, ObTableOperation>>> obTableOperations = partitionOperationsMap
238245
.get(tableObPair.getLeft());
239246
if (obTableOperations == null) {
@@ -344,8 +351,12 @@ public void partitionExecute(ObTableOperationResult[] results,
344351
result = subObTable.execute(subRequest);
345352
if (result instanceof ObTableApiMove) {
346353
ObTableApiMove move = (ObTableApiMove) result;
347-
logger.warn("The server has not yet completed the master switch, and returned an incorrect leader with an IP address of {}. " +
348-
"Rerouting return IP is {}", moveResponse.getReplica().getServer().ipToString(), move .getReplica().getServer().ipToString());
354+
logger
355+
.warn(
356+
"The server has not yet completed the master switch, and returned an incorrect leader with an IP address of {}. "
357+
+ "Rerouting return IP is {}", moveResponse.getReplica()
358+
.getServer().ipToString(), move.getReplica().getServer()
359+
.ipToString());
349360
throw new ObTableRoutingWrongException();
350361
}
351362
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,9 @@ public Map<Long, Map<Long, ObPair<ObTableParam, List<ObPair<Integer, ObTableSing
337337
} else {
338338
tableObPair = obTableClient.getODPTableWithRowKeyValue(tableName, rowKey, false);
339339
}
340+
if (tableObPair == null) {
341+
throw new ObTableUnexpectedException("fail to get table pair in batch");
342+
}
340343
long lsId = tableObPair.getRight().getLsId();
341344

342345
Map<Long, ObPair<ObTableParam, List<ObPair<Integer, ObTableSingleOp>>>> tabletOperations

0 commit comments

Comments
 (0)