Elffuss BraidHub

kikocis/java-driver public

Merge pull request #380 from datastax/java737

JAVA-737 : DowngradingConsistencyRetryPolicy ignores write timeouts
Changeset109fb4626797e1f0db1d805b9b3c55d1c0d09d42d5ae1efbc45d906e43e7190e
AuthorAlexandre Dutra <alexdut@gmail.com> · 2015-06-19 17:30 +02:00
CommitterAlexandre Dutra <alexdut@gmail.com> · 2015-06-19 17:30 +02:00
Parentsc414999e47ea, dacbafbfe74b

Browse the files at this changeset

2 files changed

modified driver-core/src/main/java/com/datastax/driver/core/policies/DefaultRetryPolicy.java +1 −1
@@ -83,7 +83,7 @@
8383 * the nodes in that subset were alive but the coordinator hasn't
8484 * detected them as dead. By the time we get the timeout the dead
8585 * nodes will likely have been detected as dead and the retry has thus a
86- * high change of success.
86+ * high chance of success.
8787 *
8888 * @param statement the original query that timed out.
8989 * @param cl the original consistency level of the write that timed out.
modified driver-core/src/main/java/com/datastax/driver/core/policies/DowngradingConsistencyRetryPolicy.java +4 −4
@@ -133,9 +133,9 @@
133133 * and at least one replica acknowledged, the write is retried with a
134134 * lower consistency level (with unlogged batch, a write timeout can
135135 * <b>always</b> mean that part of the batch haven't been persisted at
136- * all, even if {@code receivedAcks > 0}). For other {@code writeType},
137- * if we know the write has been persisted on at least one replica, we
138- * ignore the exception. Otherwise, an exception is thrown.
136+ * all, even if {@code receivedAcks > 0}). For other write types ({@code WriteType.SIMPLE}
137+ * and {@code WriteType.BATCH}), if we know the write has been persisted on at
138+ * least one replica, we ignore the exception. Otherwise, an exception is thrown.
139139 *
140140 * @param statement the original query that timed out.
141141 * @param cl the original consistency level of the write that timed out.
@@ -156,7 +156,7 @@
156156 case SIMPLE:
157157 case BATCH:
158158 // Since we provide atomicity there is no point in retrying
159- return RetryDecision.ignore();
159+ return requiredAcks > 0 ? RetryDecision.ignore() : RetryDecision.rethrow();
160160 case UNLOGGED_BATCH:
161161 // Since only part of the batch could have been persisted,
162162 // retry with whatever consistency should allow to persist all