Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,13 @@ private BatchOperationResult executeWithLSBatchOp() throws Exception {
batchOps.setServerCanRetry(serverCanRetry);
batchOps.setNeedTabletId(needTabletId);
batchOps.setHbaseOpType(hbaseOpType);
if (readConsistency != null) {
isWeakRead = (readConsistency == ObReadConsistency.WEAK);
} else {
// 如果 BatchOperation 没有设置,使用 TableRoute 上的全局设置
isWeakRead = obTableClient.getTableRoute().getReadConsistency() == ObReadConsistency.WEAK;
}
batchOps.setIsWeakRead(isWeakRead);
for (Object operation : operations) {
if (operation instanceof CheckAndInsUp) {
checkAndInsUpCnt++;
Expand Down Expand Up @@ -383,23 +390,9 @@ private BatchOperationResult executeWithLSBatchOp() throws Exception {
if (get.getRowKey() == null) {
throw new IllegalArgumentException("RowKey is null in Get operation");
}
// BatchOperation 级别的 readConsistency 优先,忽略 Get 上的设置
if (readConsistency != null) {
isWeakRead = (readConsistency == ObReadConsistency.WEAK);
} else {
// 如果 BatchOperation 没有设置,使用 TableRoute 上的全局设置
isWeakRead = obTableClient.getTableRoute().getReadConsistency() == ObReadConsistency.WEAK;
}
batchOps.addOperation(get);
} else if (operation instanceof TableQuery) {
TableQuery query = (TableQuery) operation;
// BatchOperation 级别的 readConsistency 优先,忽略 TableQuery 上的设置
if (readConsistency != null) {
isWeakRead = (readConsistency == ObReadConsistency.WEAK);
} else {
// 如果 BatchOperation 没有设置,使用 TableRoute 上的全局设置
isWeakRead = obTableClient.getTableRoute().getReadConsistency() == ObReadConsistency.WEAK;
}
batchOps.addOperation(query);
} else if (operation instanceof QueryAndMutate) {
QueryAndMutate qm = (QueryAndMutate) operation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,10 @@ public ObTableBatchOperationResult executeInternal() throws Exception {
if (tableName == null || tableName.isEmpty()) {
throw new IllegalArgumentException("table name is null");
}
if (batchOperation.isReadOnly()) {
setIsWeakRead(obTableClient.getTableRoute().getReadConsistency() == ObReadConsistency.WEAK);
}

long start = System.currentTimeMillis();
List<ObTableOperation> operations = batchOperation.getTableOperations();
ObTableOperationResult[] obTableOperationResults = returnOneResult ? new ObTableOperationResult[1]
Expand Down
Loading