Skip to content

Commit 6660335

Browse files
authored
Merge pull request #304 from WeiXinChan/tmp_313
set partition id invalid when isDistributedExecuteSupported
2 parents 689c56d + 5580d6d commit 6660335

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

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;
@@ -3771,15 +3772,17 @@ public ObPayload execute(final ObTableAbstractOperationRequest request) throws E
37713772
}
37723773

37733774
// Check if partIdMapObTable size is greater than 1
3774-
if (partIdMapObTable.size() > 1 && !getServerCapacity().isSupportDistributedExecute()) {
3775+
boolean isDistributedExecuteSupported = getServerCapacity().isSupportDistributedExecute();
3776+
if (partIdMapObTable.size() > 1 && !isDistributedExecuteSupported) {
37753777
throw new ObTablePartitionConsistentException(
37763778
"query and mutate must be a atomic operation");
37773779
}
37783780
// Proceed with the operation
37793781
Map.Entry<Long, ObTableParam> entry = partIdMapObTable.entrySet().iterator().next();
37803782
ObTableParam tableParam = entry.getValue();
37813783
request.setTableId(tableParam.getTableId());
3782-
request.setPartitionId(tableParam.getPartitionId());
3784+
long partitionId = isDistributedExecuteSupported ? INVALID_TABLET_ID : tableParam.getPartitionId();
3785+
request.setPartitionId(partitionId);
37833786
request.setTimeout(tableParam.getObTable().getObTableOperationTimeout());
37843787
ObTable obTable = tableParam.getObTable();
37853788

0 commit comments

Comments
 (0)