Permalink
Browse files

Disable retries by default for writes.

Set query idle socket_timeout to 10 seconds.
  • Loading branch information...
BrianNichols committed Nov 19, 2017
1 parent cd13380 commit 5056530587cd7bbc9daf3803d526220ee7e559cd
@@ -236,13 +236,5 @@ public ClientPolicy(ClientPolicy other) {
* Default constructor.
*/
public ClientPolicy() {
// Writes need to wait for the cluster to reform when a node goes down.
// Immediate write retries have been shown to result in the same error.
//
// Reads do not have to sleep because the cluster does not shut out reads
// during cluster reformation.
//
// This is just a default which can be overridden.
writePolicyDefault.sleepBetweenRetries = 500;
}
}
@@ -113,27 +113,33 @@
* It's important to use a distinct WritePolicy for non-idempotent
* writes which sets maxRetries = 0;
* <p>
* Default: 2 (initial attempt + 2 retries = 3 attempts)
* Default for read: 2 (initial attempt + 2 retries = 3 attempts)
* <p>
* Default for write/query/scan: 0 (no retries)
*/
public int maxRetries = 2;
/**
* Milliseconds to sleep between retries. Enter zero to skip sleep.
* This field is ignored when maxRetries is zero.
* This field is also ignored in async mode.
* <p>
* The sleep only occurs on connection errors and server timeouts
* which suggest a node is down and the cluster is reforming.
* The sleep does not occur when the client's socketTimeout expires.
* <p>
* This field is ignored in async mode.
* <p>
* Reads do not have to sleep when a node goes down because the cluster
* does not shut out reads during cluster reformation. The default for
* does not shut out reads during cluster reformation. The default for
* reads is zero.
* <p>
* The default for writes is also zero because writes are not retried by default.
* Writes need to wait for the cluster to reform when a node goes down.
* Immediate write retries on node failure have been shown to consistently
* result in errors. The default for writes is 500ms. This default is
* implemented in {@link com.aerospike.client.policy.ClientPolicy#ClientPolicy()})
* result in errors. If maxRetries is greater than zero on a write, then
* sleepBetweenRetries should be set high enough to allow the cluster to
* reform (>= 500ms).
* <p>
* Default: 0 (do not sleep between retries).
*/
public int sleepBetweenRetries;
@@ -59,5 +59,6 @@ public QueryPolicy(QueryPolicy other) {
public QueryPolicy() {
// Queries should not retry.
super.maxRetries = 0;
super.socketTimeout = 10000;
}
}
@@ -109,5 +109,7 @@ public WritePolicy(Policy other) {
* Default constructor.
*/
public WritePolicy() {
// Writes are not retried by default.
super.maxRetries = 0;
}
}

0 comments on commit 5056530

Please sign in to comment.