Documentation

ReadPolicy
in package

`ReadPolicy` excapsulates parameters for transaction policy attributes used in all database operation calls.

Table of Contents

Properties

$exit_fast_on_exhausted_connection_pool  : mixed
$filter_expression  : mixed
$max_retries  : mixed
$read_mode_ap  : mixed
$read_mode_sc  : mixed
$send_key  : mixed
$sleep_multiplier  : mixed
$socket_timeout  : mixed
$total_timeout  : mixed
$use_compression  : mixed

Methods

__construct()  : mixed
getExitFastOnExhaustedConnectionPool()  : bool
ExitFastOnExhaustedConnectionPool determines if a command that tries to get a connection from the connection pool will wait and retry in case the pool is exhausted until a connection becomes available (or the TotalTimeout is reached).
getFilterExpression()  : Expression|null
FilterExpression is the optional Filter Expression. Supported on Server v5.2+
getMaxRetries()  : int
MaxRetries determines the maximum number of retries before aborting the current transaction.
getReadModeAp()  : ReadModeAP
ReadModeAP indicates read policy for AP (availability) namespaces.
getReadModeSc()  : ReadModeSC
ReadModeSC indicates read policy for SC (strong consistency) namespaces.
getSendKey()  : bool
SendKey determines to whether send user defined key in addition to hash digest on both reads and writes.
getSleepMultiplier()  : float
SleepMultiplier specifies the multiplying factor to be used for exponential backoff during retries.
getSocketTimeout()  : int
SocketTimeout determines network timeout for each attempt.
getTotalTimeout()  : int
TotalTimeout specifies total transaction timeout.
getUseCompression()  : bool
UseCompression uses zlib compression on command buffers sent to the server and responses received from the server when the buffer size is greater than 128 bytes.
setExitFastOnExhaustedConnectionPool()  : mixed
setFilterExpression()  : mixed
setMaxRetries()  : mixed
setReadModeAp()  : mixed
setReadModeSc()  : mixed
setSendKey()  : mixed
setSleepMultiplier()  : mixed
setSocketTimeout()  : mixed
setTotalTimeout()  : mixed
setUseCompression()  : mixed

Properties

Methods

getExitFastOnExhaustedConnectionPool()

ExitFastOnExhaustedConnectionPool determines if a command that tries to get a connection from the connection pool will wait and retry in case the pool is exhausted until a connection becomes available (or the TotalTimeout is reached).

public getExitFastOnExhaustedConnectionPool() : bool

If set to true, an error will be return immediately. If set to false, getting a connection will be retried. This only applies if LimitConnectionsToQueueSize is set to true and the number of open connections to a node has reached ConnectionQueueSize. The default is false

Return values
bool

getMaxRetries()

MaxRetries determines the maximum number of retries before aborting the current transaction.

public getMaxRetries() : int

The initial attempt is not counted as a retry.

If MaxRetries is exceeded, the transaction will abort with an error.

WARNING: Database writes that are not idempotent (such as AddOp) 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 WritePolicy for non-idempotent writes which sets maxRetries = 0;

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

Default for write: 0 (no retries)

Default for partition scan or query with nil filter: 5 (6 attempts. See ScanPolicy comments.)

Return values
int

getSendKey()

SendKey determines to whether send user defined key in addition to hash digest on both reads and writes.

public getSendKey() : bool

If the key is sent on a write, the key will be stored with the record on the server. The default is to not send the user defined key.

Return values
bool

getSleepMultiplier()

SleepMultiplier specifies the multiplying factor to be used for exponential backoff during retries.

public getSleepMultiplier() : float

Default to (1.0); Only values greater than 1 are valid.

Return values
float

getSocketTimeout()

SocketTimeout determines network timeout for each attempt.

public getSocketTimeout() : int

If SocketTimeout is not zero and SocketTimeout is reached before an attempt completes, the Timeout above is checked. If Timeout is not exceeded, the transaction is retried. If both SocketTimeout and Timeout are non-zero, SocketTimeout must be less than or equal to Timeout, otherwise Timeout will also be used for SocketTimeout.

Default: 30s

Return values
int

getTotalTimeout()

TotalTimeout specifies total transaction timeout.

public getTotalTimeout() : int

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

If TotalTimeout is not zero and TotalTimeout is reached before the transaction completes, the transaction will abort with TotalTimeout error.

If TotalTimeout is zero, there will be no time limit and the transaction will retry on network timeouts/errors until MaxRetries is exceeded. If MaxRetries is exceeded, the transaction also aborts with Timeout error.

Default for scan/query: 0 (no time limit and rely on MaxRetries)

Default for all other commands: 1000ms

Return values
int

getUseCompression()

UseCompression uses zlib compression on command buffers sent to the server and responses received from the server when the buffer size is greater than 128 bytes.

public getUseCompression() : bool

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

Default: false

Return values
bool

setExitFastOnExhaustedConnectionPool()

public setExitFastOnExhaustedConnectionPool(bool $exit_fast_on_exhausted_connection_pool) : mixed
Parameters
$exit_fast_on_exhausted_connection_pool : bool

setFilterExpression()

public setFilterExpression(mixed $filter_expression) : mixed
Parameters
$filter_expression : mixed

        
On this page

Search results