Skip to content

Commit 5580d6d

Browse files
committed
set partition id invalid when isDistributedExecuteSupported
1 parent 259b344 commit 5580d6d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
import static com.alipay.oceanbase.rpc.location.model.TableEntry.HBASE_ROW_KEY_ELEMENT;
6363
import static com.alipay.oceanbase.rpc.location.model.partition.ObPartIdCalculator.*;
6464
import static com.alipay.oceanbase.rpc.property.Property.*;
65+
import static com.alipay.oceanbase.rpc.protocol.payload.Constants.INVALID_TABLET_ID;
6566
import static com.alipay.oceanbase.rpc.protocol.payload.impl.execute.ObTableOperationType.*;
6667
import static com.alipay.oceanbase.rpc.util.TableClientLoggerFactory.*;
6768
import static java.lang.String.format;
@@ -3763,15 +3764,17 @@ public ObPayload execute(final ObTableAbstractOperationRequest request) throws E
37633764
}
37643765

37653766
// Check if partIdMapObTable size is greater than 1
3766-
if (partIdMapObTable.size() > 1 && !getServerCapacity().isSupportDistributedExecute()) {
3767+
boolean isDistributedExecuteSupported = getServerCapacity().isSupportDistributedExecute();
3768+
if (partIdMapObTable.size() > 1 && !isDistributedExecuteSupported) {
37673769
throw new ObTablePartitionConsistentException(
37683770
"query and mutate must be a atomic operation");
37693771
}
37703772
// Proceed with the operation
37713773
Map.Entry<Long, ObTableParam> entry = partIdMapObTable.entrySet().iterator().next();
37723774
ObTableParam tableParam = entry.getValue();
37733775
request.setTableId(tableParam.getTableId());
3774-
request.setPartitionId(tableParam.getPartitionId());
3776+
long partitionId = isDistributedExecuteSupported ? INVALID_TABLET_ID : tableParam.getPartitionId();
3777+
request.setPartitionId(partitionId);
37753778
request.setTimeout(tableParam.getObTable().getObTableOperationTimeout());
37763779
ObTable obTable = tableParam.getObTable();
37773780

0 commit comments

Comments
 (0)