|
29 | 29 | import com.alipay.oceanbase.rpc.protocol.payload.ObPayload; |
30 | 30 | import com.alipay.oceanbase.rpc.protocol.payload.Pcodes; |
31 | 31 | import com.alipay.oceanbase.rpc.protocol.payload.impl.ObObj; |
32 | | -import com.alipay.oceanbase.rpc.protocol.payload.impl.ObRowKey; |
33 | 32 | import com.alipay.oceanbase.rpc.protocol.payload.impl.execute.*; |
34 | 33 | import com.alipay.oceanbase.rpc.protocol.payload.impl.execute.aggregation.ObTableAggregation; |
35 | 34 | import com.alipay.oceanbase.rpc.protocol.payload.impl.execute.mutate.ObTableQueryAndMutate; |
36 | 35 | import com.alipay.oceanbase.rpc.protocol.payload.impl.execute.mutate.ObTableQueryAndMutateRequest; |
37 | 36 | import com.alipay.oceanbase.rpc.protocol.payload.impl.execute.mutate.ObTableQueryAndMutateResult; |
38 | | -import com.alipay.oceanbase.rpc.protocol.payload.impl.execute.query.ObBorderFlag; |
39 | 37 | import com.alipay.oceanbase.rpc.protocol.payload.impl.execute.query.ObNewRange; |
40 | 38 | import com.alipay.oceanbase.rpc.protocol.payload.impl.execute.query.ObTableQuery; |
41 | 39 | import com.alipay.oceanbase.rpc.protocol.payload.impl.execute.query.ObTableQueryRequest; |
|
48 | 46 | import com.alipay.remoting.util.StringUtils; |
49 | 47 | import org.slf4j.Logger; |
50 | 48 |
|
51 | | -import java.lang.reflect.Array; |
52 | 49 | import java.util.*; |
53 | 50 | import java.util.concurrent.ConcurrentHashMap; |
54 | 51 | import java.util.concurrent.TimeUnit; |
@@ -710,15 +707,18 @@ private <T> T execute(String tableName, OperationExecuteCallback<T> callback, |
710 | 707 | if (refreshedTableMeta) { |
711 | 708 | refreshedTableMeta = false; |
712 | 709 | boolean isHKV = callback.getQuery().getEntityType() == ObTableEntityType.HKV; |
713 | | - tableRoute.refreshTabletLocationForAtomicQuery(tableName, callback.getQuery().getObTableQuery(), isHKV); |
| 710 | + Map<Long, ObTableParam> partIdMapObTable = tableRoute.refreshTabletLocationAndGetPartIdMap(tableName, callback.getQuery().getObTableQuery(), isHKV); |
| 711 | + tableParam = partIdMapObTable.entrySet().iterator().next().getValue(); |
714 | 712 | } else { |
715 | 713 | tableRoute.refreshPartitionLocation(tableName, routeQueryTabletId, null); |
716 | 714 | } |
717 | 715 | } |
718 | | - ObTableQuery tableQuery = callback.getQuery().getObTableQuery(); |
719 | | - // using scan range |
720 | | - tableParam = tableRoute.getTableParam(tableName, tableQuery.getScanRangeColumns(), |
721 | | - tableQuery.getKeyRanges()); |
| 716 | + if (tableParam == null) { |
| 717 | + ObTableQuery tableQuery = callback.getQuery().getObTableQuery(); |
| 718 | + // using scan range |
| 719 | + tableParam = tableRoute.getTableParam(tableName, tableQuery.getScanRangeColumns(), |
| 720 | + tableQuery.getKeyRanges()); |
| 721 | + } |
722 | 722 | routeQueryTabletId = tableParam.getPartitionId(); |
723 | 723 | } else { |
724 | 724 | throw new ObTableException("RowKey or scan range is null"); |
@@ -2317,21 +2317,24 @@ public ObPayload execute(final ObTableAbstractOperationRequest request) throws E |
2317 | 2317 | request.setTimeout(getOdpTable().getObTableOperationTimeout()); |
2318 | 2318 | return getOdpTable().execute(request); |
2319 | 2319 | } else { |
| 2320 | + Map<Long, ObTableParam> partIdMapObTable = null; |
2320 | 2321 | // Recalculate partIdMapObTable |
2321 | 2322 | if (needRefreshTabletLocation) { |
2322 | 2323 | needRefreshTabletLocation = false; |
2323 | 2324 | if (refreshedTableMeta) { |
2324 | 2325 | refreshedTableMeta = false; |
2325 | 2326 | // need to recalculate routing tablet_id and refresh location |
2326 | 2327 | boolean isHKV = request.getEntityType() == ObTableEntityType.HKV; |
2327 | | - tableRoute.refreshTabletLocationForAtomicQuery(request.getTableName(), tableQuery, isHKV); |
| 2328 | + partIdMapObTable = tableRoute.refreshTabletLocationAndGetPartIdMap(request.getTableName(), tableQuery, isHKV); |
2328 | 2329 | } else { |
2329 | 2330 | tableRoute.refreshPartitionLocation(request.getTableName(), routeTabletId, null); |
2330 | 2331 | } |
2331 | 2332 | } |
2332 | | - Map<Long, ObTableParam> partIdMapObTable = tableRoute.getPartIdParamMapForQuery( |
2333 | | - request.getTableName(), tableQuery.getScanRangeColumns(), |
2334 | | - tableQuery.getKeyRanges()); |
| 2333 | + if (partIdMapObTable == null) { |
| 2334 | + partIdMapObTable = tableRoute.getPartIdParamMapForQuery( |
| 2335 | + request.getTableName(), tableQuery.getScanRangeColumns(), |
| 2336 | + tableQuery.getKeyRanges()); |
| 2337 | + } |
2335 | 2338 |
|
2336 | 2339 | // Check if partIdMapObTable size is greater than 1 |
2337 | 2340 | boolean isDistributedExecuteSupported = getServerCapacity().isSupportDistributedExecute(); |
|
0 commit comments