kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | 0f1528ccd3519c04014b949f38e98ac5a3193e681be8f56bfcd3f838d4fb7cf9 |
|---|---|
| Author | Sylvain Lebresne <sylvain@datastax.com> · 2014-03-18 17:31 +01:00 |
| Committer | Sylvain Lebresne <sylvain@datastax.com> · 2014-03-18 17:44 +01:00 |
| Parents | 7e733280fc0a |
2 files changed
modified driver-core/src/main/java/com/datastax/driver/core/policies/DCAwareRoundRobinPolicy.java +2 −1
| @@ -24,6 +24,7 @@ | ||
| 24 | 24 | import com.google.common.collect.AbstractIterator; |
| 25 | 25 | |
| 26 | 26 | import com.datastax.driver.core.Cluster; |
| 27 | +import com.datastax.driver.core.ConsistencyLevel; | |
| 27 | 28 | import com.datastax.driver.core.Host; |
| 28 | 29 | import com.datastax.driver.core.HostDistance; |
| 29 | 30 | import com.datastax.driver.core.Query; |
| @@ -235,7 +236,7 @@ | ||
| 235 | 236 | return currentDcHosts.get(c); |
| 236 | 237 | } |
| 237 | 238 | |
| 238 | - if (dontHopForLocalCL && query.getConsistencyLevel().isDCLocal()) | |
| 239 | + if (dontHopForLocalCL && query.getConsistencyLevel() != null && query.getConsistencyLevel().isDCLocal()) | |
| 239 | 240 | return endOfData(); |
| 240 | 241 | |
| 241 | 242 | if (remoteDcs == null) { |
modified driver-core/src/main/java/com/datastax/driver/core/policies/RoundRobinPolicy.java +2 −1
| @@ -27,6 +27,7 @@ | ||
| 27 | 27 | import org.slf4j.LoggerFactory; |
| 28 | 28 | |
| 29 | 29 | import com.datastax.driver.core.Cluster; |
| 30 | +import com.datastax.driver.core.ConsistencyLevel; | |
| 30 | 31 | import com.datastax.driver.core.Host; |
| 31 | 32 | import com.datastax.driver.core.HostDistance; |
| 32 | 33 | import com.datastax.driver.core.Query; |
| @@ -93,7 +94,7 @@ | ||
| 93 | 94 | @Override |
| 94 | 95 | public Iterator<Host> newQueryPlan(Query query) { |
| 95 | 96 | |
| 96 | - if (!hasLoggedLocalCLUse && query.getConsistencyLevel().isDCLocal()) { | |
| 97 | + if (!hasLoggedLocalCLUse && query.getConsistencyLevel() != null && query.getConsistencyLevel().isDCLocal()) { | |
| 97 | 98 | hasLoggedLocalCLUse = true; |
| 98 | 99 | logger.warn("Detected request at Consistency Level {} but the non-DC aware RoundRobinPolicy is in use. " |
| 99 | 100 | + "It is strongly advised to use DCAwareRoundRobinPolicy if you have multiple DCs/use DC-aware consistency levels " |