diff --git a/examples/async_examples/async_transaction/src/main/example.c b/examples/async_examples/async_transaction/src/main/example.c index 89bb4488a..f2e9ac4b6 100644 --- a/examples/async_examples/async_transaction/src/main/example.c +++ b/examples/async_examples/async_transaction/src/main/example.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright 2008-2024 by Aerospike. + * Copyright 2008-2025 by Aerospike. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -78,7 +78,7 @@ main(int argc, char* argv[]) // Connect to the aerospike database cluster. example_connect_to_aerospike(&as); - // Create multi-record transaction. + // Create transaction. as_txn* txn = as_txn_create(); LOG("Initialize transaction: %" PRId64, (int64_t)txn->id); @@ -86,7 +86,7 @@ main(int argc, char* argv[]) data->event_loop = as_event_loop_get(); data->txn = txn; - // Run multi-record transaction. + // Run transaction. run_transaction(data); // Wait till commands have completed before shutting down. diff --git a/src/include/aerospike/aerospike_batch.h b/src/include/aerospike/aerospike_batch.h index 141412f9c..1c3ab5e7e 100644 --- a/src/include/aerospike/aerospike_batch.h +++ b/src/include/aerospike/aerospike_batch.h @@ -1,5 +1,5 @@ /* - * Copyright 2008-2024 Aerospike, Inc. + * Copyright 2008-2025 Aerospike, Inc. * * Portions may be licensed to Aerospike, Inc. under one or more contributor * license agreements. @@ -149,9 +149,9 @@ typedef struct as_batch_read_record_s { * Batch key and read/write operations with write policy. * * All fields must be allocated on the heap (or global) when an async batch write is run under a - * multi-record transaction. The reason is multi-record transactions require an extra async call - * to add write keys to the transaction monitor record and this extra call causes stack variables - * to fall out of scope before the async batch is executed. + * transaction. The reason is transactions require an extra async call to add write keys to the + * transaction monitor record and this extra call causes stack variables to fall out of scope before + * the async batch is executed. * * @relates as_batch_base_record * @ingroup batch_operations @@ -180,9 +180,9 @@ typedef struct as_batch_write_record_s { * Batch UDF (user defined function) apply. * * All fields must be allocated on the heap (or global) when an async batch UDF is run under a - * multi-record transaction. The reason is multi-record transactions require an extra async call - * to add write keys to the transaction monitor record and this extra call causes stack variables - * to fall out of scope before the async batch is executed. + * transaction. The reason is transactions require an extra async call to add write keys to the + * transaction monitor record and this extra call causes stack variables to fall out of scope before + * the async batch is executed. * * @relates as_batch_base_record * @ingroup batch_operations @@ -223,9 +223,9 @@ typedef struct as_batch_apply_record_s { * Batch delete operation. * * All fields must be allocated on the heap (or global) when an async batch remove is run under a - * multi-record transaction. The reason is multi-record transactions require an extra async call - * to add write keys to the transaction monitor record and this extra call causes stack variables - * to fall out of scope before the async batch is executed. + * transaction. The reason is transactions require an extra async call to add write keys to the + * transaction monitor record and this extra call causes stack variables to fall out of scope before + * the async batch is executed. * * @relates as_batch_base_record * @ingroup batch_operations @@ -668,9 +668,9 @@ typedef struct { * The returned records are located in the same list. * * All as_batch_record pointer fields must be allocated on the heap (or global) when an async batch - * write is run under a multi-record transaction. The reason is multi-record transactions require an - * extra async call to add write keys to the transaction monitor record and this extra call causes - * stack variables to fall out of scope before the async batch is executed. + * write is run under a transaction. The reason is transactions require an extra async call to add + * write keys to the transaction monitor record and this extra call causes stack variables to fall out + * of scope before the async batch is executed. * * Requires server version 6.0+ * diff --git a/src/include/aerospike/aerospike_txn.h b/src/include/aerospike/aerospike_txn.h index 58a8f80a0..436c1c3b2 100644 --- a/src/include/aerospike/aerospike_txn.h +++ b/src/include/aerospike/aerospike_txn.h @@ -30,7 +30,7 @@ extern "C" { struct as_event_loop; /** - * Multi-record transaction commit status code. + * Transaction commit status code. */ typedef enum { /** @@ -83,7 +83,7 @@ typedef void (*as_commit_listener)( ); /** - * Multi-record transaction abort status code. + * Transaction abort status code. */ typedef enum { /** @@ -129,7 +129,7 @@ typedef void (*as_abort_listener)( //--------------------------------- /** - * Attempt to commit the given multi-record transaction. First, the expected record versions are + * Attempt to commit the given transaction. First, the expected record versions are * sent to the server nodes for verification. If all nodes return success, the transaction is * committed. Otherwise, the transaction is aborted. * @@ -137,7 +137,7 @@ typedef void (*as_abort_listener)( * * @param as Aerospike instance. * @param err Error detail structure that is populated if an error occurs. - * @param txn Multi-record transaction. + * @param txn Transaction. * @param commit_status Indicates success or the step in the commit process that failed. * Pass in NULL to ignore. * @@ -148,13 +148,13 @@ AS_EXTERN as_status aerospike_commit(aerospike* as, as_error* err, as_txn* txn, as_commit_status* commit_status); /** - * Abort and rollback the given multi-record transaction. + * Abort and rollback the given transaction. * * Requires server version 8.0+ * * @param as Aerospike instance. * @param err Error detail structure that is populated if an error occurs. - * @param txn Multi-record transaction. + * @param txn Transaction. * @param abort_status Indicates success or the step in the abort process that failed. * Pass in NULL to ignore. * @@ -165,7 +165,7 @@ AS_EXTERN as_status aerospike_abort(aerospike* as, as_error* err, as_txn* txn, as_abort_status* abort_status); /** - * Asynchronously attempt to commit the given multi-record transaction. First, the expected record + * Asynchronously attempt to commit the given transaction. First, the expected record * versions are sent to the server nodes for verification. If all nodes return success, the transaction * is committed. Otherwise, the transaction is aborted. * @@ -173,7 +173,7 @@ aerospike_abort(aerospike* as, as_error* err, as_txn* txn, as_abort_status* abor * * @param as Aerospike instance. * @param err Error detail structure that is populated if an error occurs. - * @param txn Multi-record transaction. + * @param txn Transaction. * @param listener User function to be called with command results. * @param udata User data that is forwarded from asynchronous command function. * @param event_loop Event loop that this command was executed on. Use this event loop when @@ -190,13 +190,13 @@ aerospike_commit_async( ); /** - * Asynchronously abort and rollback the given multi-record transaction. + * Asynchronously abort and rollback the given transaction. * * Requires server version 8.0+ * * @param as Aerospike instance. * @param err Error detail structure that is populated if an error occurs. - * @param txn Multi-record transaction. + * @param txn Transaction. * @param listener User function to be called with command results. * @param udata User data that is forwarded from asynchronous command function. * @param event_loop Event loop that this command was executed on. Use this event loop when diff --git a/src/include/aerospike/as_async.h b/src/include/aerospike/as_async.h index 4bcce32df..86059f945 100644 --- a/src/include/aerospike/as_async.h +++ b/src/include/aerospike/as_async.h @@ -1,5 +1,5 @@ /* - * Copyright 2008-2024 Aerospike, Inc. + * Copyright 2008-2025 Aerospike, Inc. * * Portions may be licensed to Aerospike, Inc. under one or more contributor * license agreements. @@ -41,7 +41,7 @@ extern "C" { #define AS_ASYNC_TYPE_SCAN_PARTITION 7 #define AS_ASYNC_TYPE_QUERY_PARTITION 8 #define AS_ASYNC_TYPE_CONNECTOR 9 -#define AS_ASYNC_TYPE_MRT_MONITOR 10 +#define AS_ASYNC_TYPE_TXN_MONITOR 10 #define AS_AUTHENTICATION_MAX_SIZE 158 diff --git a/src/include/aerospike/as_command.h b/src/include/aerospike/as_command.h index 5590438b4..0fe9b365c 100644 --- a/src/include/aerospike/as_command.h +++ b/src/include/aerospike/as_command.h @@ -39,7 +39,7 @@ extern "C" { #define AS_COMMAND_FLAGS_BATCH 2 #define AS_COMMAND_FLAGS_LINEARIZE 4 #define AS_COMMAND_FLAGS_SPLIT_RETRY 8 -#define AS_COMMAND_FLAGS_MRT_MONITOR 16 +#define AS_COMMAND_FLAGS_TXN_MONITOR 16 // Field IDs #define AS_FIELD_NAMESPACE 0 @@ -47,8 +47,8 @@ extern "C" { #define AS_FIELD_KEY 2 #define AS_FIELD_RECORD_VERSION 3 #define AS_FIELD_DIGEST 4 -#define AS_FIELD_MRT_ID 5 -#define AS_FIELD_MRT_DEADLINE 6 +#define AS_FIELD_TXN_ID 5 +#define AS_FIELD_TXN_DEADLINE 6 #define AS_FIELD_TASK_ID 7 #define AS_FIELD_SOCKET_TIMEOUT 9 #define AS_FIELD_RPS 10 @@ -111,11 +111,11 @@ extern "C" { // 1 0 allow prole // 1 1 allow unavailable -// MRT -#define AS_MSG_INFO4_MRT_VERIFY_READ (1 << 0) // Send MRT version to the server to be verified. -#define AS_MSG_INFO4_MRT_ROLL_FORWARD (1 << 1) // Roll forward MRT. -#define AS_MSG_INFO4_MRT_ROLL_BACK (1 << 2) // Roll back MRT. -#define AS_MSG_INFO4_MRT_ON_LOCKING_ONLY (1 << 4) // Must be able to lock record in transaction. +// Transaction +#define AS_MSG_INFO4_TXN_VERIFY_READ (1 << 0) // Send transaction version to the server to be verified. +#define AS_MSG_INFO4_TXN_ROLL_FORWARD (1 << 1) // Roll forward transaction. +#define AS_MSG_INFO4_TXN_ROLL_BACK (1 << 2) // Roll back transaction. +#define AS_MSG_INFO4_TXN_ON_LOCKING_ONLY (1 << 4) // Must be able to lock record in transaction. // Misc #define AS_HEADER_SIZE 30 @@ -786,7 +786,7 @@ as_command_write_replica(as_policy_replica replica) /** * @private - * Parse response with deadline field when adding keys to the MRT monitor record. + * Parse response with deadline field when adding keys to the transaction monitor record. */ as_status as_command_parse_deadline(as_error* err, as_command* cmd, as_node* node, uint8_t* buf, size_t size); diff --git a/src/include/aerospike/as_policy.h b/src/include/aerospike/as_policy.h index 4394e544d..a08a542bd 100644 --- a/src/include/aerospike/as_policy.h +++ b/src/include/aerospike/as_policy.h @@ -530,7 +530,7 @@ typedef struct as_policy_base_s { struct as_exp* filter_exp; /** - * Multi-record command identifier. If set for an async command, the source txn instance must + * 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 @@ -1512,13 +1512,13 @@ typedef struct as_policy_admin_s { } as_policy_admin; /** - * Multi-record transaction (MRT) policy fields used to batch verify record versions on commit. + * Transaction policy fields used to batch verify record versions on commit. * Used a placeholder for now as there are no additional fields beyond as_policy_batch. */ typedef as_policy_batch as_policy_txn_verify; /** - * Multi-record transaction (MRT) policy fields used to batch roll forward/backward records on + * Transaction policy fields used to batch roll forward/backward records on * commit or abort. Used a placeholder for now as there are no additional fields beyond as_policy_batch. */ typedef as_policy_batch as_policy_txn_roll; @@ -1603,12 +1603,12 @@ typedef struct as_policies_s { as_policy_admin admin; /** - * Default multi-record transaction (MRT) policy when verifying record versions in a batch. + * Default transaction policy when verifying record versions in a batch. */ as_policy_txn_verify txn_verify; /** - * Default multi-record transaction (MRT) policy when rolling the transaction records forward (commit) + * Default transaction policy when rolling the transaction records forward (commit) * or back (abort) in a batch. */ as_policy_txn_roll txn_roll; diff --git a/src/include/aerospike/as_status.h b/src/include/aerospike/as_status.h index 28a55fc47..ce0bb032a 100644 --- a/src/include/aerospike/as_status.h +++ b/src/include/aerospike/as_status.h @@ -33,17 +33,17 @@ typedef enum as_status_e { //--------------------------------- /** - * Multi-record transaction commit called, but the transaction was already aborted. + * Transaction commit called, but the transaction was already aborted. */ AEROSPIKE_TXN_ALREADY_ABORTED = -19, /** - * Multi-record transaction abort called, but the transaction was already committed. + * Transaction abort called, but the transaction was already committed. */ AEROSPIKE_TXN_ALREADY_COMMITTED = -18, /** - * Multi-record transaction failed. + * Transaction failed. */ AEROSPIKE_TXN_FAILED = -17, @@ -426,33 +426,33 @@ typedef enum as_status_e { AEROSPIKE_ERR_UDF = 100, /** - * MRT record blocked by a different transaction. + * Transaction record blocked by a different transaction. */ AEROSPIKE_MRT_BLOCKED = 120, /** - * MRT read version mismatch identified during commit. + * Transaction read version mismatch identified during commit. * Some other command changed the record outside of the transaction. */ AEROSPIKE_MRT_VERSION_MISMATCH = 121, /** - * MRT deadline reached without a successful commit or abort. + * Transaction deadline reached without a successful commit or abort. */ AEROSPIKE_MRT_EXPIRED = 122, /** - * MRT write command limit (4096) exceeded. + * Transaction write command limit (4096) exceeded. */ AEROSPIKE_MRT_TOO_MANY_WRITES = 123, /** - * MRT was already committed. + * Transaction was already committed. */ AEROSPIKE_MRT_COMMITTED = 124, /** - * MRT was already aborted. + * Transaction was already aborted. */ AEROSPIKE_MRT_ABORTED = 125, diff --git a/src/include/aerospike/as_txn.h b/src/include/aerospike/as_txn.h index aa6464e5c..dae307667 100644 --- a/src/include/aerospike/as_txn.h +++ b/src/include/aerospike/as_txn.h @@ -1,5 +1,5 @@ /* - * Copyright 2008-2024 Aerospike, Inc. + * Copyright 2008-2025 Aerospike, Inc. * * Portions may be licensed to Aerospike, Inc. under one or more contributor * license agreements. @@ -83,7 +83,7 @@ typedef struct { } as_txn_hash; /** - * Multi-record transaction (MRT). Each command in the MRT must use the same namespace. + * Transaction. Each command in the transaction must use the same namespace. */ typedef struct as_txn { uint64_t id; @@ -113,72 +113,72 @@ typedef struct { //--------------------------------- /** - * Initialize multi-record transaction (MRT), assign random transaction id and initialize + * Initialize transaction, assign random transaction id and initialize * 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. + * The default client transaction timeout is zero. This means use the server configuration mrt-duration + * as the transaction 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). * - * @param txn Multi-record transaction. + * @param txn Transaction. */ AS_EXTERN void as_txn_init(as_txn* txn); /** - * Initialize multi-record transaction (MRT), assign random transaction id and initialize + * Initialize transaction, assign random transaction id and initialize * 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. + * The default client transaction timeout is zero. This means use the server configuration mrt-duration + * as the transaction 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). * - * @param txn Multi-record transaction. - * @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. + * @param txn Transaction. + * @param reads_capacity expected number of record reads in the transaction. Minimum value is 16. + * @param writes_capacity expected number of record writes in the transaction. Minimum value is 16. */ AS_EXTERN void as_txn_init_capacity(as_txn* txn, uint32_t reads_capacity, uint32_t writes_capacity); /** - * Create multi-record transaction (MRT) on heap, assign random transaction id and initialize + * Create transaction on heap, assign random transaction id and initialize * 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. + * The default client transaction timeout is zero. This means use the server configuration mrt-duration + * as the transaction 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 + * Create transaction on heap, assign random transaction id and initialize * 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. + * The default client transaction timeout is zero. This means use the server configuration mrt-duration + * as the transaction 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. + * @param reads_capacity expected number of record reads in the transaction. Minimum value is 16. + * @param writes_capacity expected number of record writes in the transaction. Minimum value is 16. */ AS_EXTERN as_txn* as_txn_create_capacity(uint32_t reads_capacity, uint32_t writes_capacity); /** - * Destroy MRT. + * Destroy transaction. */ AS_EXTERN void 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. + * Set transaction timeout in seconds. The timer starts when the transaction monitor record is created. + * This occurs when the first command in the transaction is executed. If the timeout is reached before + * an aerospike_commit() or aerospike_abort() is called, the server will expire and rollback the transaction. * - * If the MRT timeout is zero, the server configuration mrt-duration is used. + * If the transaction timeout is zero, the server configuration mrt-duration is used. * The default mrt-duration is 10 seconds. */ static inline void @@ -236,13 +236,13 @@ AS_EXTERN bool as_txn_writes_contain(as_txn* txn, const as_key* key); /** - * Verify that the MRT state allows future commands. + * Verify that the transaction state allows future commands. */ AS_EXTERN as_status as_txn_verify_command(as_txn* txn, as_error* err); /** - * Set MRT namespace only if doesn't already exist. + * Set transaction namespace only if doesn't already exist. * If namespace already exists, verify new namespace is the same. * For internal use only. */ @@ -250,7 +250,7 @@ AS_EXTERN as_status as_txn_set_ns(as_txn* txn, const char* ns, as_error* err); /** - * Return if the MRT monitor record should be closed/deleted. For internal use only. + * Return if the transaction monitor record should be closed/deleted. For internal use only. */ static inline bool as_txn_close_monitor(as_txn* txn) @@ -259,7 +259,7 @@ as_txn_close_monitor(as_txn* txn) } /** - * Does MRT monitor record exist. + * Does transaction monitor record exist. */ static inline bool as_txn_monitor_exists(as_txn* txn) @@ -268,7 +268,7 @@ as_txn_monitor_exists(as_txn* txn) } /** - * Clear MRT. Remove all tracked keys. For internal use only. + * Clear transaction. Remove all tracked keys. For internal use only. */ AS_EXTERN void as_txn_clear(as_txn* txn); diff --git a/src/main/aerospike/aerospike_batch.c b/src/main/aerospike/aerospike_batch.c index d1ea83f83..adb1cc810 100644 --- a/src/main/aerospike/aerospike_batch.c +++ b/src/main/aerospike/aerospike_batch.c @@ -1360,7 +1360,7 @@ as_batch_attr_write(as_batch_attr* attr, const as_policy_batch_write* p, as_oper attr->info_attr |= AS_MSG_INFO3_COMMIT_MASTER; } - attr->txn_attr = p->on_locking_only ? AS_MSG_INFO4_MRT_ON_LOCKING_ONLY : 0; + attr->txn_attr = p->on_locking_only ? AS_MSG_INFO4_TXN_ON_LOCKING_ONLY : 0; } static void @@ -1383,7 +1383,7 @@ as_batch_attr_apply(as_batch_attr* attr, const as_policy_batch_apply* p) attr->info_attr |= AS_MSG_INFO3_COMMIT_MASTER; } - attr->txn_attr = p->on_locking_only ? AS_MSG_INFO4_MRT_ON_LOCKING_ONLY : 0; + attr->txn_attr = p->on_locking_only ? AS_MSG_INFO4_TXN_ON_LOCKING_ONLY : 0; } static void @@ -1452,14 +1452,14 @@ as_batch_write_fields_all( p = as_batch_write_fields(p, key, n_fields, n_ops); if (txn) { - p = as_command_write_field_uint64_le(p, AS_FIELD_MRT_ID, txn->id); + p = as_command_write_field_uint64_le(p, AS_FIELD_TXN_ID, txn->id); if (ver) { p = as_command_write_field_version(p, ver); } if (attr->has_write && txn->deadline != 0) { - p = as_command_write_field_uint32_le(p, AS_FIELD_MRT_DEADLINE, txn->deadline); + p = as_command_write_field_uint32_le(p, AS_FIELD_TXN_DEADLINE, txn->deadline); } } @@ -1515,7 +1515,7 @@ as_batch_write_txn_verify(uint8_t* p, as_key* key, uint64_t ver) *p++ = (AS_MSG_INFO1_READ | AS_MSG_INFO1_GET_NOBINDATA); *p++ = 0; *p++ = AS_MSG_INFO3_SC_READ_TYPE; - *p++ = AS_MSG_INFO4_MRT_VERIFY_READ; + *p++ = AS_MSG_INFO4_TXN_VERIFY_READ; if (ver) { p = as_batch_write_fields(p, key, 1, 0); @@ -1553,14 +1553,14 @@ as_batch_write_txn_roll(uint8_t* p, as_key* key, as_txn* txn, uint64_t ver, uint p = as_batch_write_fields(p, key, n_fields, 0); if (txn) { - p = as_command_write_field_uint64_le(p, AS_FIELD_MRT_ID, txn->id); + p = as_command_write_field_uint64_le(p, AS_FIELD_TXN_ID, txn->id); if (ver) { p = as_command_write_field_version(p, ver); } if (txn->deadline) { - p = as_command_write_field_uint32_le(p, AS_FIELD_MRT_DEADLINE, txn->deadline); + p = as_command_write_field_uint32_le(p, AS_FIELD_TXN_DEADLINE, txn->deadline); } } return p; @@ -4266,7 +4266,7 @@ as_async_batch_error(as_event_command* cmd, as_error* err) } //--------------------------------- -// Private MRT Functions +// Private Transaction Functions //--------------------------------- static void @@ -4555,7 +4555,7 @@ aerospike_batch_write_async( return status; } - // Add keys to MRT monitor record. Original batch write will be performed when this completes. + // Add keys to transaction monitor record. Original batch write will be performed when this completes. as_batch_txn* bt = cf_malloc(sizeof(as_batch_txn)); bt->as = as; // Assume "as" is either global or was allocated on the heap. bt->records = records; // Already required to be allocated on the heap. diff --git a/src/main/aerospike/aerospike_key.c b/src/main/aerospike/aerospike_key.c index 176b0810e..d331cd4a4 100644 --- a/src/main/aerospike/aerospike_key.c +++ b/src/main/aerospike/aerospike_key.c @@ -1422,7 +1422,7 @@ aerospike_key_operate_async( cmd->write_len = (uint32_t)comp_size; } - // Call normal execute since readonly commands do not add keys to the MRT monitor. + // Call normal execute since readonly commands do not add keys to the transaction monitor. return as_event_command_execute(cmd, err); } } @@ -1752,7 +1752,7 @@ as_txn_monitor_operate( as_command cmd; as_command_init_write(&cmd, as->cluster, &policy->base, policy->replica, key, oper.size, &pi, as_command_parse_deadline, txn); - cmd.flags |= AS_COMMAND_FLAGS_MRT_MONITOR; + cmd.flags |= AS_COMMAND_FLAGS_TXN_MONITOR; uint32_t compression_threshold = policy->base.compress ? AS_COMPRESS_THRESHOLD : 0; @@ -1797,7 +1797,7 @@ as_txn_monitor_operate_async( cmd = as_async_record_command_create( as->cluster, &policy->base, &pi, policy->replica, 0, policy->deserialize, policy->async_heap_rec, 0, listener, udata, event_loop, NULL, oper.size, - as_event_command_parse_deadline, AS_ASYNC_TYPE_MRT_MONITOR, AS_LATENCY_TYPE_WRITE, + as_event_command_parse_deadline, AS_ASYNC_TYPE_TXN_MONITOR, AS_LATENCY_TYPE_WRITE, NULL, 0); cmd->txn = txn; @@ -1817,7 +1817,7 @@ as_txn_monitor_operate_async( cmd = as_async_record_command_create( as->cluster, &policy->base, &pi, policy->replica, 0, policy->deserialize, policy->async_heap_rec, 0, listener, udata, event_loop, NULL, comp_size, - as_event_command_parse_deadline, AS_ASYNC_TYPE_MRT_MONITOR, AS_LATENCY_TYPE_WRITE, + as_event_command_parse_deadline, AS_ASYNC_TYPE_TXN_MONITOR, AS_LATENCY_TYPE_WRITE, ubuf, (uint32_t)size); // Compress buffer and execute. @@ -1878,7 +1878,7 @@ as_txn_verify_single( buf[9] = AS_MSG_INFO1_READ | AS_MSG_INFO1_GET_NOBINDATA; buf[10] = 0; buf[11] = AS_MSG_INFO3_SC_READ_TYPE; - buf[12] = AS_MSG_INFO4_MRT_VERIFY_READ; + buf[12] = AS_MSG_INFO4_TXN_VERIFY_READ; buf[13] = 0; *(uint32_t*)&buf[14] = 0; *(int*)&buf[18] = 0; @@ -1955,7 +1955,7 @@ as_txn_verify_single_async( buf[9] = AS_MSG_INFO1_READ | AS_MSG_INFO1_GET_NOBINDATA; buf[10] = 0; buf[11] = AS_MSG_INFO3_SC_READ_TYPE; - buf[12] = AS_MSG_INFO4_MRT_VERIFY_READ; + buf[12] = AS_MSG_INFO4_TXN_VERIFY_READ; buf[13] = 0; *(uint32_t*)&buf[14] = 0; *(int*)&buf[18] = 0; @@ -1995,10 +1995,10 @@ as_txn_roll_single( uint16_t n_fields = 4; size_t size = strlen(key->ns) + strlen(key->set) + sizeof(cf_digest) + 45; - // MRT ID + // Transaction ID size += AS_FIELD_HEADER_SIZE + sizeof(uint64_t); - // MRT version + // Transaction version if (ver) { size += 7 + AS_FIELD_HEADER_SIZE; n_fields++; @@ -2023,7 +2023,7 @@ as_txn_roll_single( p = as_command_write_field_string(p, AS_FIELD_NAMESPACE, key->ns); p = as_command_write_field_string(p, AS_FIELD_SETNAME, key->set); p = as_command_write_field_digest(p, &key->digest); - p = as_command_write_field_uint64_le(p, AS_FIELD_MRT_ID, txn->id); + p = as_command_write_field_uint64_le(p, AS_FIELD_TXN_ID, txn->id); if (ver) { p = as_command_write_field_version(p, ver); @@ -2081,10 +2081,10 @@ as_txn_roll_single_async( uint16_t n_fields = 4; size_t size = strlen(key->ns) + strlen(key->set) + sizeof(cf_digest) + 45; - // MRT ID + // Transaction ID size += AS_FIELD_HEADER_SIZE + sizeof(uint64_t); - // MRT version + // Transaction version if (ver) { size += 7 + AS_FIELD_HEADER_SIZE; n_fields++; @@ -2114,7 +2114,7 @@ as_txn_roll_single_async( p = as_command_write_field_string(p, AS_FIELD_NAMESPACE, key->ns); p = as_command_write_field_string(p, AS_FIELD_SETNAME, key->set); p = as_command_write_field_digest(p, &key->digest); - p = as_command_write_field_uint64_le(p, AS_FIELD_MRT_ID, txn->id); + p = as_command_write_field_uint64_le(p, AS_FIELD_TXN_ID, txn->id); if (ver) { p = as_command_write_field_version(p, ver); diff --git a/src/main/aerospike/aerospike_txn.c b/src/main/aerospike/aerospike_txn.c index 7d6bcd7a4..e19efb7fd 100644 --- a/src/main/aerospike/aerospike_txn.c +++ b/src/main/aerospike/aerospike_txn.c @@ -121,7 +121,7 @@ as_commit(aerospike* as, as_error* err, as_txn* txn, as_commit_status* commit_st txn->state = AS_TXN_STATE_COMMITTED; txn->in_doubt = false; - status = as_txn_roll(as, err, roll_policy, txn, AS_MSG_INFO4_MRT_ROLL_FORWARD); + status = as_txn_roll(as, err, roll_policy, txn, AS_MSG_INFO4_TXN_ROLL_FORWARD); if (status != AEROSPIKE_OK) { // The client roll has error. The server will eventually roll forward the transaction @@ -176,7 +176,7 @@ as_verify_and_commit(aerospike* as, as_error* err, as_txn* txn, as_commit_status as_policy_txn_roll* roll_policy = &as->config.policies.txn_roll; as_error roll_err; - as_status roll_status = as_txn_roll(as, &roll_err, roll_policy, txn, AS_MSG_INFO4_MRT_ROLL_BACK); + as_status roll_status = as_txn_roll(as, &roll_err, roll_policy, txn, AS_MSG_INFO4_TXN_ROLL_BACK); if (roll_status != AEROSPIKE_OK) { as_error_update(err, verify_status, "Txn aborted:\nVerify failed: %s\nRollback abandoned: %s", @@ -222,7 +222,7 @@ aerospike_commit(aerospike* as, as_error* err, as_txn* txn, as_commit_status* co return AEROSPIKE_OK; case AS_TXN_STATE_ABORTED: - return as_error_set_message(err, AEROSPIKE_TXN_ALREADY_ABORTED, "Multi-record transaction already aborted"); + return as_error_set_message(err, AEROSPIKE_TXN_ALREADY_ABORTED, "Transaction already aborted"); } } @@ -245,7 +245,7 @@ as_abort(aerospike* as, as_error* err, as_txn* txn, as_abort_status* abort_statu as_policy_txn_roll* roll_policy = &as->config.policies.txn_roll; - as_status status = as_txn_roll(as, err, roll_policy, txn, AS_MSG_INFO4_MRT_ROLL_BACK); + as_status status = as_txn_roll(as, err, roll_policy, txn, AS_MSG_INFO4_TXN_ROLL_BACK); if (status != AEROSPIKE_OK) { // The client roll has error. The server will eventually abort the transaction. @@ -285,7 +285,7 @@ aerospike_abort(aerospike* as, as_error* err, as_txn* txn, as_abort_status* abor return as_abort(as, err, txn, abort_status); case AS_TXN_STATE_COMMITTED: - return as_error_set_message(err, AEROSPIKE_TXN_ALREADY_COMMITTED, "Multi-record transaction already committed"); + return as_error_set_message(err, AEROSPIKE_TXN_ALREADY_COMMITTED, "Transaction already committed"); case AS_TXN_STATE_ABORTED: as_set_abort_status(abort_status, AS_ABORT_ALREADY_ABORTED); @@ -497,7 +497,7 @@ as_commit_mark_listener(as_error* err, void* udata, as_event_loop* event_loop) as_error roll_err; as_status status = as_txn_roll_async(data->as, &roll_err, data->roll_policy, data->txn, - AS_MSG_INFO4_MRT_ROLL_FORWARD, as_commit_roll_listener, data, event_loop); + AS_MSG_INFO4_TXN_ROLL_FORWARD, as_commit_roll_listener, data, event_loop); if (status != AEROSPIKE_OK) { // The client roll has error. The server will eventually roll forward the transaction @@ -550,7 +550,7 @@ as_commit_verify_listener( as_error roll_err; as_status status = as_txn_roll_async(data->as, &roll_err, data->roll_policy, data->txn, - AS_MSG_INFO4_MRT_ROLL_BACK, as_commit_roll_listener, data, event_loop); + AS_MSG_INFO4_TXN_ROLL_BACK, as_commit_roll_listener, data, event_loop); if (status != AEROSPIKE_OK) { as_commit_notify_error_verify_rollback(&roll_err, data, event_loop); @@ -611,7 +611,7 @@ aerospike_commit_async( return AEROSPIKE_OK; case AS_TXN_STATE_ABORTED: - return as_error_set_message(err, AEROSPIKE_TXN_ALREADY_ABORTED, "Multi-record transaction already aborted"); + return as_error_set_message(err, AEROSPIKE_TXN_ALREADY_ABORTED, "Transaction already aborted"); } } @@ -703,7 +703,7 @@ as_abort_async( txn->state = AS_TXN_STATE_ABORTED; as_status status = as_txn_roll_async(data->as, err, data->roll_policy, data->txn, - AS_MSG_INFO4_MRT_ROLL_BACK, as_abort_roll_listener, data, event_loop); + AS_MSG_INFO4_TXN_ROLL_BACK, as_abort_roll_listener, data, event_loop); if (status != AEROSPIKE_OK) { as_abort_data_destroy(data); @@ -727,7 +727,7 @@ aerospike_abort_async( return as_abort_async(as, err, txn, listener, udata, event_loop); case AS_TXN_STATE_COMMITTED: - return as_error_set_message(err, AEROSPIKE_TXN_ALREADY_COMMITTED, "Multi-record transaction already committed"); + return as_error_set_message(err, AEROSPIKE_TXN_ALREADY_COMMITTED, "Transaction already committed"); case AS_TXN_STATE_ABORTED: listener(NULL, AS_ABORT_ALREADY_ABORTED, udata, event_loop); diff --git a/src/main/aerospike/as_command.c b/src/main/aerospike/as_command.c index bfff614d9..6feaddc27 100644 --- a/src/main/aerospike/as_command.c +++ b/src/main/aerospike/as_command.c @@ -266,7 +266,7 @@ as_command_write_header_write( write_attr |= AS_MSG_INFO2_DURABLE_DELETE; } - uint8_t txn_attr = on_locking_only ? AS_MSG_INFO4_MRT_ON_LOCKING_ONLY : 0; + uint8_t txn_attr = on_locking_only ? AS_MSG_INFO4_TXN_ON_LOCKING_ONLY : 0; #if defined USE_XDR read_attr |= AS_MSG_INFO1_XDR; @@ -401,14 +401,14 @@ as_command_write_key( if (policy->txn) { as_txn* txn = policy->txn; - p = as_command_write_field_uint64_le(p, AS_FIELD_MRT_ID, txn->id); + p = as_command_write_field_uint64_le(p, AS_FIELD_TXN_ID, txn->id); if (tdata->version != 0) { p = as_command_write_field_version(p, tdata->version); } if (tdata->send_deadline) { - p = as_command_write_field_uint32_le(p, AS_FIELD_MRT_DEADLINE, txn->deadline); + p = as_command_write_field_uint32_le(p, AS_FIELD_TXN_DEADLINE, txn->deadline); } } @@ -640,10 +640,10 @@ as_command_prepare_error(as_command* cmd, as_error* err) { as_error_set_in_doubt(err, cmd->flags & AS_COMMAND_FLAGS_READ, cmd->sent); - // It's important that as_txn_on_write_in_doubt() is only executed for commands in a MRT, - // but not MRT operations (add MRT key, commit, abort). Add MRT key sets - // AS_COMMAND_FLAGS_MRT_MONITOR and commit/abort do not set cmd->policy->txn. - if (err->in_doubt && cmd->policy->txn && (cmd->flags & AS_COMMAND_FLAGS_MRT_MONITOR) == 0) { + // It's important that as_txn_on_write_in_doubt() is only executed for commands in a transaction, + // but not transaction operations (add transaction key, commit, abort). Add transaction key sets + // AS_COMMAND_FLAGS_TXN_MONITOR and commit/abort do not set cmd->policy->txn. + if (err->in_doubt && cmd->policy->txn && (cmd->flags & AS_COMMAND_FLAGS_TXN_MONITOR) == 0) { as_txn_on_write_in_doubt(cmd->policy->txn, cmd->key->digest.value, cmd->key->set); } } @@ -1762,12 +1762,12 @@ as_command_parse_fields_deadline(uint8_t** pp, as_error* err, as_msg* msg, as_tx p += 4; type = *p++; - if (type == AS_FIELD_MRT_DEADLINE) { + if (type == AS_FIELD_TXN_DEADLINE) { if (len == 4) { txn->deadline = cf_swap_from_le32(*(uint32_t*)p); } else { - return as_error_update(err, AEROSPIKE_ERR_CLIENT, "MRT deadline field has invalid size: %u", len); + return as_error_update(err, AEROSPIKE_ERR_CLIENT, "Transaction deadline field has invalid size: %u", len); } } p += len; diff --git a/src/main/aerospike/as_event.c b/src/main/aerospike/as_event.c index 0fa896da3..7acaf17fa 100644 --- a/src/main/aerospike/as_event.c +++ b/src/main/aerospike/as_event.c @@ -1,5 +1,5 @@ /* - * Copyright 2008-2024 Aerospike, Inc. + * Copyright 2008-2025 Aerospike, Inc. * * Portions may be licensed to Aerospike, Inc. under one or more contributor * license agreements. @@ -1265,9 +1265,9 @@ as_event_command_parse_set_digest(as_event_command* cmd, as_error* err, char* se static void as_event_check_in_doubt(as_event_command* cmd, as_error* err) { if (err->in_doubt && cmd->txn) { - // It's important that this logic is only executed for commands in a MRT, - // but not MRT operations (add MRT key, commit, abort). Add MRT key does not - // call this function and commit/abort do not set cmd->txn. + // It's important that this logic is only executed for commands in a transaction, + // but not transaction operations (add transaction key, commit, abort). Add transaction key + // does not call this function and commit/abort do not set cmd->txn. as_set set; as_digest_value digest; @@ -1303,7 +1303,7 @@ as_event_notify_error(as_event_command* cmd, as_error* err) as_event_check_in_doubt(cmd, err); ((as_async_value_command*)cmd)->listener(err, 0, cmd->udata, cmd->event_loop); break; - case AS_ASYNC_TYPE_MRT_MONITOR: + case AS_ASYNC_TYPE_TXN_MONITOR: ((as_async_record_command*)cmd)->listener(err, 0, cmd->udata, cmd->event_loop); break; case AS_ASYNC_TYPE_INFO: diff --git a/src/main/aerospike/as_txn.c b/src/main/aerospike/as_txn.c index 49b22696e..e8ee6d698 100644 --- a/src/main/aerospike/as_txn.c +++ b/src/main/aerospike/as_txn.c @@ -1,5 +1,5 @@ /* - * Copyright 2008-2024 Aerospike, Inc. + * Copyright 2008-2025 Aerospike, Inc. * * Portions may be licensed to Aerospike, Inc. under one or more contributor * license agreements. @@ -358,7 +358,7 @@ as_txn_verify_command(as_txn* txn, as_error* err) { if (txn->state != AS_TXN_STATE_OPEN) { return as_error_update(err, AEROSPIKE_ERR_PARAM, - "Command not allowed in current MRT state: %d", txn->state); + "Command not allowed in current transaction state: %d", txn->state); } return AEROSPIKE_OK; } @@ -373,7 +373,7 @@ as_txn_set_ns(as_txn* txn, const char* ns, as_error* err) if (strncmp(txn->ns, ns, sizeof(txn->ns)) != 0) { return as_error_update(err, AEROSPIKE_ERR_PARAM, - "Namespace must be the same for all commands in the MRT. orig: %s new: %s", + "Namespace must be the same for all commands in the transaction. orig: %s new: %s", txn->ns, ns); } return AEROSPIKE_OK; diff --git a/src/main/aerospike/as_txn_monitor.c b/src/main/aerospike/as_txn_monitor.c index ce77b6f33..e0e1b8427 100644 --- a/src/main/aerospike/as_txn_monitor.c +++ b/src/main/aerospike/as_txn_monitor.c @@ -1,5 +1,5 @@ /* - * Copyright 2008-2024 Aerospike, Inc. + * Copyright 2008-2025 Aerospike, Inc. * * Portions may be licensed to Aerospike, Inc. under one or more contributor * license agreements. @@ -172,8 +172,8 @@ as_txn_monitor_add_keys( as_policy_operate txn_policy; as_txn_policy_copy(cmd_policy, &txn_policy); - // Set MRT timeout via ttl when creating the MRT monitor record. The server ignores - // the MRT timeout field on successive MRT monitor record updates. + // Set transaction timeout via ttl when creating the transaction monitor record. The server + // ignores the transaction timeout field on successive transaction monitor record updates. ops->ttl = txn->timeout; return as_txn_monitor_operate(as, err, txn, &txn_policy, &key, ops); @@ -279,8 +279,8 @@ as_txn_monitor_add_keys_async( as_policy_operate txn_policy; as_txn_policy_copy(cmd_policy, &txn_policy); - // Set MRT timeout via ttl when creating the MRT monitor record. The server ignores - // the MRT timeout field on successive MRT monitor record updates. + // Set transaction timeout via ttl when creating the transaction monitor record. The server + // ignores the transaction timeout field on successive transaction monitor record updates. ops->ttl = txn->timeout; return as_txn_monitor_operate_async(as, err, txn, &txn_policy, &key, ops, listener, udata, event_loop); @@ -292,7 +292,7 @@ as_txn_monitor_add_key_async( as_async_record_listener listener, void* udata, as_event_loop* event_loop ) { - // Add key to MRT monitor. + // Add key to transaction monitor. as_txn* txn = cmd_policy->txn; as_operations ops; @@ -312,7 +312,7 @@ as_txn_monitor_add_keys_records_async( as_event_loop* event_loop ) { - // Add keys to MRT monitor. + // Add keys to transaction monitor. as_operations ops; as_operations_inita(&ops, 2); diff --git a/src/test/transaction.c b/src/test/transaction.c index 364a8081c..bbad466af 100644 --- a/src/test/transaction.c +++ b/src/test/transaction.c @@ -1,5 +1,5 @@ /* - * Copyright 2008-2024 Aerospike, Inc. + * Copyright 2008-2025 Aerospike, Inc. * * Portions may be licensed to Aerospike, Inc. under one or more contributor * license agreements. @@ -896,7 +896,7 @@ TEST(txn_batch_abort, "transaction batch abort") SUITE(transaction, "Transaction tests") { - // Multi-record transactions require strong consistency namespaces. + // Transactions require strong consistency namespaces. if (!g_has_sc) { return; } diff --git a/src/test/transaction_async.c b/src/test/transaction_async.c index b058af04a..2cf0475fd 100644 --- a/src/test/transaction_async.c +++ b/src/test/transaction_async.c @@ -1,5 +1,5 @@ /* - * Copyright 2008-2024 Aerospike, Inc. + * Copyright 2008-2025 Aerospike, Inc. * * Portions may be licensed to Aerospike, Inc. under one or more contributor * license agreements. @@ -1130,7 +1130,7 @@ TEST(txn_async_batch_abort, "transaction async batch abort") SUITE(transaction_async, "Async transaction tests") { - // Multi-record transactions require strong consistency namespaces. + // Transactions require strong consistency namespaces. if (!g_has_sc) { return; }