From d7d8cacd89294752ac554dcabc24ffcc84939634 Mon Sep 17 00:00:00 2001 From: Julian Nguyen <109386615+juliannguyen4@users.noreply.github.com> Date: Fri, 3 Jan 2025 08:24:03 -0800 Subject: [PATCH 1/8] update c client --- .gitmodules | 2 +- aerospike-client-c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 136ba68cb..ff9201f45 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,4 +2,4 @@ path = aerospike-client-c # url = git@github.com:aerospike/aerospike-client-c.git url = https://github.com/aerospike/aerospike-client-c.git - branch = stage + branch = CLIENT-3241 diff --git a/aerospike-client-c b/aerospike-client-c index 5bffa81cc..555204f86 160000 --- a/aerospike-client-c +++ b/aerospike-client-c @@ -1 +1 @@ -Subproject commit 5bffa81ccf98f36951cf3d638bacea463dd27580 +Subproject commit 555204f8645bed09d2e05453860857191e065123 From 7f66730939108e9197e08d97e8287c20297e031d Mon Sep 17 00:00:00 2001 From: Julian Nguyen <109386615+juliannguyen4@users.noreply.github.com> Date: Fri, 3 Jan 2025 08:27:11 -0800 Subject: [PATCH 2/8] Remove constants that were removed in c client --- src/main/aerospike.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/aerospike.c b/src/main/aerospike.c index e8d2fef03..45e83f8f1 100644 --- a/src/main/aerospike.c +++ b/src/main/aerospike.c @@ -504,7 +504,6 @@ static struct module_constant_name_to_value module_constants[] = { {"MRT_COMMIT_OK", .value.integer = AS_COMMIT_OK}, {"MRT_COMMIT_ALREADY_COMMITTED", .value.integer = AS_COMMIT_ALREADY_COMMITTED}, - {"MRT_COMMIT_ALREADY_ABORTED", .value.integer = AS_COMMIT_ALREADY_ABORTED}, {"MRT_COMMIT_VERIFY_FAILED", .value.integer = AS_COMMIT_VERIFY_FAILED}, {"MRT_COMMIT_MARK_ROLL_FORWARD_ABANDONED", .value.integer = AS_COMMIT_MARK_ROLL_FORWARD_ABANDONED}, @@ -513,8 +512,6 @@ static struct module_constant_name_to_value module_constants[] = { {"MRT_COMMIT_CLOSE_ABANDONED", .value.integer = AS_COMMIT_CLOSE_ABANDONED}, {"MRT_ABORT_OK", .value.integer = AS_ABORT_OK}, - {"MRT_ABORT_ALREADY_COMMITTED", - .value.integer = AS_ABORT_ALREADY_COMMITTED}, {"MRT_ABORT_ALREADY_ABORTED", .value.integer = AS_ABORT_ALREADY_ABORTED}, {"MRT_ABORT_ROLL_BACK_ABANDONED", .value.integer = AS_ABORT_ROLL_BACK_ABANDONED}, From 0b879e6775c70be6388b9415ddb688489c8fbf36 Mon Sep 17 00:00:00 2001 From: Julian Nguyen <109386615+juliannguyen4@users.noreply.github.com> Date: Fri, 3 Jan 2025 08:48:03 -0800 Subject: [PATCH 3/8] C client stage already has CLIENT-3241 changes --- .gitmodules | 2 +- aerospike-client-c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index ff9201f45..136ba68cb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,4 +2,4 @@ path = aerospike-client-c # url = git@github.com:aerospike/aerospike-client-c.git url = https://github.com/aerospike/aerospike-client-c.git - branch = CLIENT-3241 + branch = stage diff --git a/aerospike-client-c b/aerospike-client-c index 555204f86..77a0411aa 160000 --- a/aerospike-client-c +++ b/aerospike-client-c @@ -1 +1 @@ -Subproject commit 555204f8645bed09d2e05453860857191e065123 +Subproject commit 77a0411aa3a9a74d066a3ada4e0c91ff36493ef0 From 5d4c6358839b9df75eca7d75cc0546f26d7370a3 Mon Sep 17 00:00:00 2001 From: Julian Nguyen <109386615+juliannguyen4@users.noreply.github.com> Date: Fri, 3 Jan 2025 09:07:55 -0800 Subject: [PATCH 4/8] Expect exception raised when committing or aborting a txn that finished --- src/main/exception.c | 7 ++++++- test/new_tests/test_mrt_functionality.py | 8 ++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main/exception.c b/src/main/exception.c index 4c681131e..738fbfe41 100644 --- a/src/main/exception.c +++ b/src/main/exception.c @@ -111,8 +111,13 @@ struct exception_def exception_defs[] = { AEROSPIKE_ERR_ASYNC_CONNECTION, NULL), EXCEPTION_DEF("ClientAbortError", CLIENT_ERR_EXCEPTION_NAME, AEROSPIKE_ERR_CLIENT_ABORT, NULL), - EXCEPTION_DEF("TranactionFailed", CLIENT_ERR_EXCEPTION_NAME, + EXCEPTION_DEF("TransactionFailed", CLIENT_ERR_EXCEPTION_NAME, AEROSPIKE_TXN_FAILED, NULL), + EXCEPTION_DEF("TransactionAlreadyCommitted", CLIENT_ERR_EXCEPTION_NAME, + AEROSPIKE_TXN_ALREADY_COMMITTED, NULL), + EXCEPTION_DEF("TransactionAlreadyAborted", CLIENT_ERR_EXCEPTION_NAME, + AEROSPIKE_TXN_ALREADY_ABORTED, NULL), + // Server errors EXCEPTION_DEF("InvalidRequest", SERVER_ERR_EXCEPTION_NAME, AEROSPIKE_ERR_REQUEST_INVALID, NULL), diff --git a/test/new_tests/test_mrt_functionality.py b/test/new_tests/test_mrt_functionality.py index d395fe090..985199051 100644 --- a/test/new_tests/test_mrt_functionality.py +++ b/test/new_tests/test_mrt_functionality.py @@ -89,8 +89,8 @@ def test_commit_fail(self): } self.as_connection.put(self.keys[0], {self.bin_name: 1}, policy=policy) self.as_connection.abort(mrt) - status = self.as_connection.commit(mrt) - assert status == aerospike.MRT_COMMIT_ALREADY_ABORTED + with pytest.raises(e.TransactionAlreadyAborted): + self.as_connection.commit(mrt) # Test case 10: Issue abort after issung commit. (P1) def test_abort_fail(self): @@ -100,5 +100,5 @@ def test_abort_fail(self): } self.as_connection.put(self.keys[0], {self.bin_name: 1}, policy=policy) self.as_connection.commit(mrt) - status = self.as_connection.abort(mrt) - assert status == aerospike.MRT_ABORT_ALREADY_COMMITTED + with pytest.raises(e.TransactionAlreadyCommitted): + self.as_connection.abort(mrt) From 82a0c7bfb74c571eda60808af0f776062625d8ca Mon Sep 17 00:00:00 2001 From: Julian Nguyen <109386615+juliannguyen4@users.noreply.github.com> Date: Fri, 3 Jan 2025 09:10:38 -0800 Subject: [PATCH 5/8] fix type stubs. --- aerospike-stubs/aerospike.pyi | 16 +++++++--------- aerospike-stubs/exception.pyi | 9 +++++++++ 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/aerospike-stubs/aerospike.pyi b/aerospike-stubs/aerospike.pyi index 8d4476f65..eef13f1d9 100644 --- a/aerospike-stubs/aerospike.pyi +++ b/aerospike-stubs/aerospike.pyi @@ -295,17 +295,15 @@ QUERY_DURATION_LONG_RELAX_AP: Literal[2] MRT_COMMIT_OK: Literal[0] MRT_COMMIT_ALREADY_COMMITTED: Literal[1] -MRT_COMMIT_ALREADY_ABORTED: Literal[2] -MRT_COMMIT_VERIFY_FAILED: Literal[3] -MRT_COMMIT_MARK_ROLL_FORWARD_ABANDONED: Literal[4] -MRT_COMMIT_ROLL_FORWARD_ABANDONED: Literal[5] -MRT_COMMIT_CLOSE_ABANDONED: Literal[6] +MRT_COMMIT_VERIFY_FAILED: Literal[2] +MRT_COMMIT_MARK_ROLL_FORWARD_ABANDONED: Literal[3] +MRT_COMMIT_ROLL_FORWARD_ABANDONED: Literal[4] +MRT_COMMIT_CLOSE_ABANDONED: Literal[5] MRT_ABORT_OK: Literal[0] -MRT_ABORT_ALREADY_COMMITTED: Literal[1] -MRT_ABORT_ALREADY_ABORTED: Literal[2] -MRT_ABORT_ROLL_BACK_ABANDONED: Literal[3] -MRT_ABORT_CLOSE_ABANDONED: Literal[4] +MRT_ABORT_ALREADY_ABORTED: Literal[1] +MRT_ABORT_ROLL_BACK_ABANDONED: Literal[2] +MRT_ABORT_CLOSE_ABANDONED: Literal[3] MRT_STATE_OPEN: Literal[0] MRT_STATE_VERIFIED: Literal[1] diff --git a/aerospike-stubs/exception.pyi b/aerospike-stubs/exception.pyi index 52006f518..0f40bd11a 100644 --- a/aerospike-stubs/exception.pyi +++ b/aerospike-stubs/exception.pyi @@ -14,6 +14,15 @@ class InvalidHostError(ClientError): class ParamError(ClientError): pass +class TransactionFailed(ClientError): + pass + +class TransactionAlreadyAborted(ClientError): + pass + +class TransactionAlreadyCommitted(ClientError): + pass + class ServerError(AerospikeError): pass From ff1e88d35d536d53a7f61b1cdbb5365490516512 Mon Sep 17 00:00:00 2001 From: Julian Nguyen <109386615+juliannguyen4@users.noreply.github.com> Date: Fri, 3 Jan 2025 09:37:58 -0800 Subject: [PATCH 6/8] update docs --- doc/aerospike.rst | 8 -------- 1 file changed, 8 deletions(-) diff --git a/doc/aerospike.rst b/doc/aerospike.rst index dbbeffc2a..7c45dc689 100644 --- a/doc/aerospike.rst +++ b/doc/aerospike.rst @@ -1589,10 +1589,6 @@ MRT Commit Status Transaction has already been committed. -.. data:: MRT_COMMIT_ALREADY_ABORTED - - Transaction has already been aborted. - .. data:: MRT_COMMIT_VERIFY_FAILED Transaction verify failed. Transaction will be aborted. @@ -1620,10 +1616,6 @@ MRT Abort Status Abort succeeded. -.. data:: MRT_ABORT_ALREADY_COMMITTED - - Transaction has already been committed. - .. data:: MRT_ABORT_ALREADY_ABORTED Transaction has already been aborted. From 33e41e97e3c5aa7c9c73fb0164967c8093c81721 Mon Sep 17 00:00:00 2001 From: Julian Nguyen <109386615+juliannguyen4@users.noreply.github.com> Date: Fri, 3 Jan 2025 12:53:22 -0800 Subject: [PATCH 7/8] add missing docs for exceptions --- doc/exception.rst | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/doc/exception.rst b/doc/exception.rst index 4ad2d547b..9bd6d76b7 100644 --- a/doc/exception.rst +++ b/doc/exception.rst @@ -152,6 +152,30 @@ Client Errors Subclass of :py:exc:`~aerospike.exception.ClientError`. +.. py:exception:: TransactionFailed + + Multi-record transaction failed. + + Error code: ``-17`` + + Subclass of :py:exc:`~aerospike.exception.ClientError`. + +.. py:exception:: TransactionAlreadyCommitted + + Multi-record transaction abort called, but the transaction was already committed. + + Error code: ``-18`` + + Subclass of :py:exc:`~aerospike.exception.ClientError`. + +.. py:exception:: TransactionAlreadyAborted + + Multi-record transaction commit called, but the transaction was already aborted. + + Error code: ``-19`` + + Subclass of :py:exc:`~aerospike.exception.ClientError`. + Server Errors ------------- From 13c86048481fe6d1972263fb718154eca35bb0f1 Mon Sep 17 00:00:00 2001 From: Julian Nguyen <109386615+juliannguyen4@users.noreply.github.com> Date: Fri, 3 Jan 2025 13:49:09 -0800 Subject: [PATCH 8/8] Update again --- aerospike-client-c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aerospike-client-c b/aerospike-client-c index 77a0411aa..e6516f6ee 160000 --- a/aerospike-client-c +++ b/aerospike-client-c @@ -1 +1 @@ -Subproject commit 77a0411aa3a9a74d066a3ada4e0c91ff36493ef0 +Subproject commit e6516f6ee079cc4ac97ea27c0117b21d8431630d