Loading...
Searching...
No Matches
Data Fields
as_policy_base Struct Reference

Detailed Description

Generic policy fields shared among all policies.

Definition at line 432 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
 

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.

Default: false

Definition at line 541 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 transaction 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 transaction 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 529 of file as_policy.h.

◆ max_retries

uint32_t as_policy_base::max_retries

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

If max_retries is exceeded, the transaction 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 transaction 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 485 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 505 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 transaction is retried.

Default: 30000ms

Definition at line 448 of file as_policy.h.

◆ total_timeout

uint32_t as_policy_base::total_timeout

Total transaction timeout in milliseconds.

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

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

Default: 1000

Definition at line 463 of file as_policy.h.


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