Skip to content

Commit

Permalink
CLIENT-3173 Default client MRT timeout to zero. This means use the se…
Browse files Browse the repository at this point in the history
…rver configuration mrt-duration as the MRT timeout. The default mrt-duration is 10 seconds.
  • Loading branch information
BrianNichols committed Nov 20, 2024
1 parent 2503488 commit 1d0cfc9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
23 changes: 19 additions & 4 deletions src/include/aerospike/as_txn.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@ typedef struct {

/**
* Initialize multi-record transaction (MRT), assign random transaction id and initialize
* reads/writes hashmaps with default capacities. The default MRT timeout is 10 seconds.
* reads/writes hashmaps with default capacities.
*
* The default client MRT timeout is zero. This means use the server configuration mrt-duration
* as the MRT timeout. The default mrt-duration is 10 seconds.
*
* Call this function or as_txn_init_capacity(), but not both. Do not use this function for async
* commands (use as_txn_create() instead).
Expand All @@ -126,7 +129,10 @@ as_txn_init(as_txn* txn);

/**
* Initialize multi-record transaction (MRT), assign random transaction id and initialize
* reads/writes hashmaps with given capacities. The default MRT timeout is 10 seconds.
* reads/writes hashmaps with given capacities.
*
* The default client MRT timeout is zero. This means use the server configuration mrt-duration
* as the MRT timeout. The default mrt-duration is 10 seconds.
*
* Call this function or as_txn_init(), but not both. Do not use this function for async commands
* (use as_txn_create_capacity() instead).
Expand All @@ -140,14 +146,20 @@ as_txn_init_capacity(as_txn* txn, uint32_t reads_capacity, uint32_t writes_capac

/**
* Create multi-record transaction (MRT) on heap, assign random transaction id and initialize
* reads/writes hashmaps with default capacities. The default MRT timeout is 10 seconds.
* reads/writes hashmaps with default capacities.
*
* The default client MRT timeout is zero. This means use the server configuration mrt-duration
* as the MRT timeout. The default mrt-duration is 10 seconds.
*/
AS_EXTERN as_txn*
as_txn_create(void);

/**
* Create multi-record transaction (MRT) on heap, assign random transaction id and initialize
* reads/writes hashmaps with given capacities. The default MRT timeout is 10 seconds.
* reads/writes hashmaps with given capacities.
*
* The default client MRT timeout is zero. This means use the server configuration mrt-duration
* as the MRT timeout. The default mrt-duration is 10 seconds.
*
* @param reads_capacity expected number of record reads in the MRT. Minimum value is 16.
* @param writes_capacity expected number of record writes in the MRT. Minimum value is 16.
Expand All @@ -165,6 +177,9 @@ as_txn_destroy(as_txn* txn);
* Set MRT timeout in seconds. The timer starts when the MRT monitor record is created.
* This occurs when the first command in the MRT is executed. If the timeout is reached before
* an aerospike_commit() or aerospike_abort() is called, the server will expire and rollback the MRT.
*
* If the MRT timeout is zero, the server configuration mrt-duration is used.
* The default mrt-duration is 10 seconds.
*/
static inline void
as_txn_set_timeout(as_txn* txn, uint32_t timeout)
Expand Down
2 changes: 1 addition & 1 deletion src/main/aerospike/as_txn.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ as_txn_init_all(as_txn* txn, uint32_t read_buckets, uint32_t write_buckets)

txn->id = id;
txn->ns[0] = 0;
txn->timeout = 10;
txn->timeout = 0; // Zero means use server configuration mrt-duration.
txn->deadline = 0;
txn->state = AS_TXN_STATE_OPEN;
txn->monitor_in_doubt = false;
Expand Down

0 comments on commit 1d0cfc9

Please sign in to comment.