Elffuss BraidHub

kikocis/java-driver public

JAVA-737 : DowngradingConsistencyRetryPolicy ignores write timeouts
Changeset8733a10fc8d2faef3fa05eb34251e16a007762b180b0633ddff315d182ead285
AuthorKevin Gallardo <kevin.gallardo@datastax.com> · 2015-06-05 12:13 +01:00
CommitterKevin Gallardo <kevin.gallardo@datastax.com> · 2015-06-11 18:15 +01:00
Parents83fd1d67c7b9

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 {@code WriteType.SIMPLE}
137+ * and {@code WriteType.BATCH} types, 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