Elffuss BraidHub

kikocis/java-driver public

JAVA-737 : DowngradingConsistencyRetryPolicy ignores write timeouts
Changeset6ad6548d975cddfd606cf0442b24d2e4f323152d9dc35b92a099c12ab6e0a7fb
AuthorKevin Gallardo <kevin.gallardo@datastax.com> · 2015-06-05 12:13 +01:00
Committerolim7t <omichallat+github@gmail.com> · 2015-06-22 15:55 +02:00
Parentsb6818eac6aa3

Browse the files at this changeset

3 files changed

modified changelog/README.md +1 −0
@@ -6,6 +6,7 @@
66 - [improvement] Suppress unnecessary warning at shutdown (JAVA-710)
77 - [improvement] Allow DNS name with multiple A-records as contact point (#340)
88 - [bug] Allow tracing across multiple result pages (JAVA-794)
9+- [bug] DowngradingConsistencyRetryPolicy ignores write timeouts (JAVA-737)
910
1011 Merged from 2.0.10_fixes branch:
1112
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