Elffuss BraidHub

kikocis/java-driver public

Fix DC local tests in LBP

Conflicts:

	driver-core/src/main/java/com/datastax/driver/core/policies/DCAwareRoundRobinPolicy.java
	driver-core/src/main/java/com/datastax/driver/core/policies/RoundRobinPolicy.java
Changeset0f1528ccd3519c04014b949f38e98ac5a3193e681be8f56bfcd3f838d4fb7cf9
AuthorSylvain Lebresne <sylvain@datastax.com> · 2014-03-18 17:31 +01:00
CommitterSylvain Lebresne <sylvain@datastax.com> · 2014-03-18 17:44 +01:00
Parents7e733280fc0a

Browse the files at this changeset

2 files changed

modified driver-core/src/main/java/com/datastax/driver/core/policies/DCAwareRoundRobinPolicy.java +2 −1
@@ -24,6 +24,7 @@
2424 import com.google.common.collect.AbstractIterator;
2525
2626 import com.datastax.driver.core.Cluster;
27+import com.datastax.driver.core.ConsistencyLevel;
2728 import com.datastax.driver.core.Host;
2829 import com.datastax.driver.core.HostDistance;
2930 import com.datastax.driver.core.Query;
@@ -235,7 +236,7 @@
235236 return currentDcHosts.get(c);
236237 }
237238
238- if (dontHopForLocalCL && query.getConsistencyLevel().isDCLocal())
239+ if (dontHopForLocalCL && query.getConsistencyLevel() != null && query.getConsistencyLevel().isDCLocal())
239240 return endOfData();
240241
241242 if (remoteDcs == null) {
modified driver-core/src/main/java/com/datastax/driver/core/policies/RoundRobinPolicy.java +2 −1
@@ -27,6 +27,7 @@
2727 import org.slf4j.LoggerFactory;
2828
2929 import com.datastax.driver.core.Cluster;
30+import com.datastax.driver.core.ConsistencyLevel;
3031 import com.datastax.driver.core.Host;
3132 import com.datastax.driver.core.HostDistance;
3233 import com.datastax.driver.core.Query;
@@ -93,7 +94,7 @@
9394 @Override
9495 public Iterator<Host> newQueryPlan(Query query) {
9596
96- if (!hasLoggedLocalCLUse && query.getConsistencyLevel().isDCLocal()) {
97+ if (!hasLoggedLocalCLUse && query.getConsistencyLevel() != null && query.getConsistencyLevel().isDCLocal()) {
9798 hasLoggedLocalCLUse = true;
9899 logger.warn("Detected request at Consistency Level {} but the non-DC aware RoundRobinPolicy is in use. "
99100 + "It is strongly advised to use DCAwareRoundRobinPolicy if you have multiple DCs/use DC-aware consistency levels "