All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
as_policy_base Struct Reference

Detailed Description

Generic policy fields shared among all policies.

Definition at line 433 of file as_policy.h.

#include "as_policy.h"

+ Collaboration diagram for as_policy_base:

Data Fields

bool compress
 
struct as_expfilter_exp
 
uint32_t max_retries
 
uint32_t sleep_between_retries
 
uint32_t socket_timeout
 
uint32_t total_timeout
 
struct as_txntxn
 

Field Documentation

◆ compress

bool as_policy_base::compress

Use zlib compression on write or batch read commands when the command buffer size is greater than 128 bytes. In addition, tell the server to compress it's response on read commands. The server response compression threshold is also 128 bytes.

This option will increase cpu and memory usage (for extra compressed buffers), but decrease the size of data sent over the network.

This compression feature requires the Enterprise Edition Server.

Default: false

Definition at line 552 of file as_policy.h.

◆ filter_exp

struct as_exp* as_policy_base::filter_exp

Optional expression filter. If filter_exp exists and evaluates to false, the command is ignored. This can be used to eliminate a client/server roundtrip in some cases.

aerospike_destroy() automatically calls as_exp_destroy() on all global default policy filter expression instances. The user is responsible for calling as_exp_destroy() on filter expressions when setting temporary command policies.

as_exp_build(filter,
as_exp_cmp_eq(as_exp_bin_int("a"), as_exp_int(10)));
as_policy_read_init(&p);
p.filter_exp = filter;
...
as_exp_destroy(filter);
#define as_exp_bin_int(__bin_name)
Definition as_exp.h:479
#define as_exp_int(__val)
Definition as_exp.h:304

Default: NULL

Definition at line 530 of file as_policy.h.

◆ max_retries

uint32_t as_policy_base::max_retries

Maximum number of retries before aborting the current command. The initial attempt is not counted as a retry.

If max_retries is exceeded, the command will return error AEROSPIKE_ERR_TIMEOUT.

WARNING: Database writes that are not idempotent (such as "add") should not be retried because the write operation may be performed multiple times if the client timed out previous command attempts. It's important to use a distinct write policy for non-idempotent writes which sets max_retries = 0;

Default for read: 2 (initial attempt + 2 retries = 3 attempts)

Default for write: 0 (no retries)

Default for partition scan or query with null filter: 5

No default for legacy scan/query. No retries are allowed for these commands.

Definition at line 486 of file as_policy.h.

◆ sleep_between_retries

uint32_t as_policy_base::sleep_between_retries

Milliseconds to sleep between retries. Enter zero to skip sleep. This field is ignored when max_retries is zero.
This field is also ignored in async mode.

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 reads is zero.

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. If max_retries is greater than zero on a write, then sleep_between_retries should be set high enough to allow the cluster to reform (>= 3000ms).

Default: 0 (do not sleep between retries).

Definition at line 506 of file as_policy.h.

◆ socket_timeout

uint32_t as_policy_base::socket_timeout

Socket idle timeout in milliseconds when processing a database command.

If socket_timeout is zero and total_timeout is non-zero, then socket_timeout will be set to total_timeout. If both socket_timeout and total_timeout are non-zero and socket_timeout > total_timeout, then socket_timeout will be set to total_timeout. If both socket_timeout and total_timeout are zero, then there will be no socket idle limit.

If socket_timeout is non-zero and the socket has been idle for at least socket_timeout, both max_retries and total_timeout are checked. If max_retries and total_timeout are not exceeded, the command is retried.

Default: 30000ms

Definition at line 449 of file as_policy.h.

◆ total_timeout

uint32_t as_policy_base::total_timeout

Total command timeout in milliseconds.

The total_timeout is tracked on the client and sent to the server along with the command in the wire protocol. The client will most likely timeout first, but the server also has the capability to timeout the command.

If total_timeout is not zero and total_timeout is reached before the command completes, the command will return error AEROSPIKE_ERR_TIMEOUT. If totalTimeout is zero, there will be no total time limit.

Default: 1000

Definition at line 464 of file as_policy.h.

◆ txn

struct as_txn* as_policy_base::txn

Transaction identifier. If set for an async command, the source txn instance must be allocated on the heap using as_txn_create() or as_txn_create_capacity().

Default: NULL

Definition at line 538 of file as_policy.h.


The documentation for this struct was generated from the following file: