@@ -346,6 +346,9 @@ typedef struct CassSchemaMetaField_ CassSchemaMetaField;
346
346
typedef struct CassUuidGen_ CassUuidGen ;
347
347
348
348
/**
349
+ * Policies that defined the behavior of a request when a server-side
350
+ * read/write timeout or unavailable error occurs.
351
+ *
349
352
* @struct CassRetryPolicy
350
353
*/
351
354
typedef struct CassRetryPolicy_ CassRetryPolicy ;
@@ -1202,7 +1205,7 @@ cass_cluster_set_tcp_keepalive(CassCluster* cluster,
1202
1205
1203
1206
/**
1204
1207
* Sets the retry policy used for all requests unless overridden by setting
1205
- * a retry policy on a statement.
1208
+ * a retry policy on a statement or a batch .
1206
1209
*
1207
1210
* <b>Default:</b> default retry policy.
1208
1211
*
@@ -1212,6 +1215,7 @@ cass_cluster_set_tcp_keepalive(CassCluster* cluster,
1212
1215
* @param[in] retry_policy
1213
1216
*
1214
1217
* @see cass_statement_set_retry_policy()
1218
+ * @see cass_batch_set_retry_policy()
1215
1219
*/
1216
1220
CASS_EXPORT void
1217
1221
cass_cluster_set_retry_policy (CassCluster * cluster ,
@@ -3001,6 +3005,19 @@ CASS_EXPORT CassError
3001
3005
cass_batch_set_consistency (CassBatch * batch ,
3002
3006
CassConsistency consistency );
3003
3007
3008
+ /**
3009
+ * Sets the batch's retry policy.
3010
+ *
3011
+ * @public @memberof CassBatch
3012
+ *
3013
+ * @param[in] batch
3014
+ * @param[in] retry_policy
3015
+ * @return CASS_OK if successful, otherwise an error occurred.
3016
+ */
3017
+ CASS_EXPORT CassError
3018
+ cass_batch_set_retry_policy (CassBatch * batch ,
3019
+ CassRetryPolicy * retry_policy );
3020
+
3004
3021
/**
3005
3022
* Adds a statement to a batch.
3006
3023
*
@@ -5706,42 +5723,81 @@ cass_uuid_from_string_n(const char* str,
5706
5723
/**
5707
5724
* Creates a new default retry policy.
5708
5725
*
5726
+ * This policy retries queries in the following cases:
5727
+ * <ul>
5728
+ * <li>On a read timeout, if enough replicas replied but data was not received.</li>
5729
+ * <li>On a write timeout, if a timeout occurs while writing the distributed batch log</li>
5730
+ * <li>On unavailble, it will move to the next host</li>
5731
+ * </ul>
5732
+ *
5733
+ * In all other cases the error will be returned.
5734
+ *
5735
+ * This policy always uses the queries original consistency level.
5736
+ *
5709
5737
* @public @memberof CassRetryPolicy
5710
5738
*
5711
5739
* @return Returns a retry policy that must be freed.
5712
5740
*
5713
5741
* @see cass_retry_policy_free()
5714
5742
*/
5715
5743
CASS_EXPORT CassRetryPolicy *
5716
- cass_default_retry_policy_new ();
5744
+ cass_retry_policy_default_new ();
5717
5745
5718
5746
/**
5719
5747
* Creates a new downgrading consistency retry policy.
5720
5748
*
5749
+ * <b>Important:</b> This policy may attempt to retry requests with a lower
5750
+ * consistency level. Using this policy can break consistency guarantees.
5751
+ *
5752
+ * This policy will retry in the same scenarios as the default policy, but
5753
+ * it will also retry in the following cases:
5754
+ * <ul>
5755
+ * <li>On a read timeout, if some replicas responded but is lower than
5756
+ * required by the current consistency level then retry with a lower
5757
+ * consistency level.</li>
5758
+ * <li>On a write timeout, Retry unlogged batches at a lower consistency level
5759
+ * if at least one replica responded. For single queries and batch if any
5760
+ * replicas responded then consider the request successful and swallow the
5761
+ * error.</li>
5762
+ * <li>On unavailable, retry at a lower consistency if at lease one replica
5763
+ * responded.</li>
5764
+ * </ul>
5765
+ *
5766
+ * This goal of this policy is to attempt to save a request if there's any
5767
+ * chance of success. A writes succeeds as long as there's a single copy
5768
+ * persisted and a read will succeed if there's some data available even
5769
+ * if it increases the risk of reading stale data.
5770
+ *
5721
5771
* @public @memberof CassRetryPolicy
5722
5772
*
5723
5773
* @return Returns a retry policy that must be freed.
5724
5774
*
5725
5775
* @see cass_retry_policy_free()
5726
5776
*/
5727
5777
CASS_EXPORT CassRetryPolicy *
5728
- cass_downgrading_consistency_retry_policy_new ();
5778
+ cass_retry_policy_downgrading_consistency_new ();
5729
5779
5730
5780
/**
5731
5781
* Creates a new fallthrough retry policy.
5732
5782
*
5783
+ * This policy never retries or ignores a server-side failure. The error
5784
+ * is always returned.
5785
+ *
5733
5786
* @public @memberof CassRetryPolicy
5734
5787
*
5735
5788
* @return Returns a retry policy that must be freed.
5736
5789
*
5737
5790
* @see cass_retry_policy_free()
5738
5791
*/
5739
5792
CASS_EXPORT CassRetryPolicy *
5740
- cass_fallthrough_retry_policy_new ();
5793
+ cass_retry_policy_fallthrough_new ();
5741
5794
5742
5795
/**
5743
5796
* Creates a new logging retry policy.
5744
5797
*
5798
+ * This policy logs the retry decision of its child policy. Logging is
5799
+ * done using CASS_LOG_INFO.
5800
+ *
5745
5801
* @public @memberof CassRetryPolicy
5746
5802
*
5747
5803
* @param[in] child_retry_policy
@@ -5751,7 +5807,7 @@ cass_fallthrough_retry_policy_new();
5751
5807
* @see cass_retry_policy_free()
5752
5808
*/
5753
5809
CASS_EXPORT CassRetryPolicy *
5754
- cass_logging_retry_policy (CassRetryPolicy * child_retry_policy );
5810
+ cass_retry_policy_logging_new (CassRetryPolicy * child_retry_policy );
5755
5811
5756
5812
/**
5757
5813
* Frees a retry policy instance.
0 commit comments