@@ -355,6 +355,13 @@ private BatchOperationResult executeWithLSBatchOp() throws Exception {
355355 batchOps .setServerCanRetry (serverCanRetry );
356356 batchOps .setNeedTabletId (needTabletId );
357357 batchOps .setHbaseOpType (hbaseOpType );
358+ if (readConsistency != null ) {
359+ isWeakRead = (readConsistency == ObReadConsistency .WEAK );
360+ } else {
361+ // 如果 BatchOperation 没有设置,使用 TableRoute 上的全局设置
362+ isWeakRead = obTableClient .getTableRoute ().getReadConsistency () == ObReadConsistency .WEAK ;
363+ }
364+ batchOps .setIsWeakRead (isWeakRead );
358365 for (Object operation : operations ) {
359366 if (operation instanceof CheckAndInsUp ) {
360367 checkAndInsUpCnt ++;
@@ -383,23 +390,9 @@ private BatchOperationResult executeWithLSBatchOp() throws Exception {
383390 if (get .getRowKey () == null ) {
384391 throw new IllegalArgumentException ("RowKey is null in Get operation" );
385392 }
386- // BatchOperation 级别的 readConsistency 优先,忽略 Get 上的设置
387- if (readConsistency != null ) {
388- isWeakRead = (readConsistency == ObReadConsistency .WEAK );
389- } else {
390- // 如果 BatchOperation 没有设置,使用 TableRoute 上的全局设置
391- isWeakRead = obTableClient .getTableRoute ().getReadConsistency () == ObReadConsistency .WEAK ;
392- }
393393 batchOps .addOperation (get );
394394 } else if (operation instanceof TableQuery ) {
395395 TableQuery query = (TableQuery ) operation ;
396- // BatchOperation 级别的 readConsistency 优先,忽略 TableQuery 上的设置
397- if (readConsistency != null ) {
398- isWeakRead = (readConsistency == ObReadConsistency .WEAK );
399- } else {
400- // 如果 BatchOperation 没有设置,使用 TableRoute 上的全局设置
401- isWeakRead = obTableClient .getTableRoute ().getReadConsistency () == ObReadConsistency .WEAK ;
402- }
403396 batchOps .addOperation (query );
404397 } else if (operation instanceof QueryAndMutate ) {
405398 QueryAndMutate qm = (QueryAndMutate ) operation ;
0 commit comments