From 3b0063bfd697a69cf963d167565a437fcbe51c1d Mon Sep 17 00:00:00 2001 From: Ted Yu Date: Mon, 26 Jul 2021 09:17:59 -0700 Subject: [PATCH] [cassandra driver] Assign consistency level of BatchStatement to first BoundStatement --- .../internal/core/loadbalancing/PartitionAwarePolicy.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/src/main/java/com/yugabyte/oss/driver/internal/core/loadbalancing/PartitionAwarePolicy.java b/core/src/main/java/com/yugabyte/oss/driver/internal/core/loadbalancing/PartitionAwarePolicy.java index d535da646ad..c5108a701e0 100644 --- a/core/src/main/java/com/yugabyte/oss/driver/internal/core/loadbalancing/PartitionAwarePolicy.java +++ b/core/src/main/java/com/yugabyte/oss/driver/internal/core/loadbalancing/PartitionAwarePolicy.java @@ -142,6 +142,9 @@ private Iterator getQueryPlan(Session session, BatchStatement batch) { while (batchIterator.hasNext()) { BatchableStatement nextStatement = batchIterator.next(); if (nextStatement instanceof BoundStatement) { + if (batch.getConsistencyLevel() != null && nextStatement.getConsistencyLevel() == null) { + nextStatement = nextStatement.setConsistencyLevel(batch.getConsistencyLevel()); + } Iterator plan = getQueryPlan(session, (BoundStatement) nextStatement); if (plan != null) return plan; }