From 3a09953c41ce048349f5b7cfe084cd51c078a859 Mon Sep 17 00:00:00 2001 From: Shannon Klaus Date: Thu, 5 Dec 2024 13:29:13 -0700 Subject: [PATCH] Remove txn instance from copied write policy when adding MRT monitor keys --- .github/workflows/tests.yml | 2 +- AerospikeClient/Async/AsyncTxnAddKeys.cs | 8 ++++++-- AerospikeClient/Async/AsyncTxnMonitor.cs | 3 ++- AerospikeClient/Command/TxnAddKeys.cs | 6 ++++-- AerospikeClient/Command/TxnMonitor.cs | 3 ++- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 03d3209a..6a762fad 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -32,7 +32,7 @@ jobs: - uses: ./.github/actions/run-ee-server with: - use-server-rc: true + use-server-rc: false docker-hub-username: ${{ secrets.DOCKER_HUB_BOT_USERNAME }} docker-hub-password: ${{ secrets.DOCKER_HUB_BOT_PW }} diff --git a/AerospikeClient/Async/AsyncTxnAddKeys.cs b/AerospikeClient/Async/AsyncTxnAddKeys.cs index d797db74..1f61021e 100644 --- a/AerospikeClient/Async/AsyncTxnAddKeys.cs +++ b/AerospikeClient/Async/AsyncTxnAddKeys.cs @@ -21,17 +21,20 @@ public sealed class AsyncTxnAddKeys : AsyncWriteBase { private readonly RecordListener listener; private readonly OperateArgs args; + private readonly Txn txn; public AsyncTxnAddKeys ( AsyncCluster cluster, RecordListener listener, Key key, - OperateArgs args + OperateArgs args, + Txn txn ) : base(cluster, args.writePolicy, key) { this.listener = listener; this.args = args; + this.txn = txn; } public AsyncTxnAddKeys(AsyncTxnAddKeys other) @@ -39,6 +42,7 @@ public AsyncTxnAddKeys(AsyncTxnAddKeys other) { this.listener = other.listener; this.args = other.args; + this.txn = other.txn; } protected internal override AsyncCommand CloneCommand() @@ -54,7 +58,7 @@ protected internal override void WriteBuffer() protected internal override bool ParseResult() { ParseHeader(); - ParseTxnDeadline(policy.Txn); + ParseTxnDeadline(txn); if (resultCode == ResultCode.OK) { diff --git a/AerospikeClient/Async/AsyncTxnMonitor.cs b/AerospikeClient/Async/AsyncTxnMonitor.cs index 566e9800..e5901cac 100644 --- a/AerospikeClient/Async/AsyncTxnMonitor.cs +++ b/AerospikeClient/Async/AsyncTxnMonitor.cs @@ -139,6 +139,7 @@ private AsyncTxnMonitor(AsyncCommand command, AsyncCluster cluster) void Execute(AsyncCluster cluster, Policy policy, Operation[] ops) { + Txn txn = policy.Txn; Key txnKey = TxnMonitor.GetTxnMonitorKey(policy.Txn); WritePolicy wp = TxnMonitor.CopyTimeoutPolicy(policy); @@ -146,7 +147,7 @@ void Execute(AsyncCluster cluster, Policy policy, Operation[] ops) // Add write key(s) to MRT monitor. OperateArgs args = new(wp, null, null, ops); - AsyncTxnAddKeys txnCommand = new(cluster, txnListener, txnKey, args); + AsyncTxnAddKeys txnCommand = new(cluster, txnListener, txnKey, args, txn); txnCommand.Execute(); } diff --git a/AerospikeClient/Command/TxnAddKeys.cs b/AerospikeClient/Command/TxnAddKeys.cs index fafe93d4..51d55c3f 100644 --- a/AerospikeClient/Command/TxnAddKeys.cs +++ b/AerospikeClient/Command/TxnAddKeys.cs @@ -20,11 +20,13 @@ namespace Aerospike.Client public sealed class TxnAddKeys : SyncWriteCommand { private readonly OperateArgs args; + private readonly Txn txn; - public TxnAddKeys (Cluster cluster, Key key, OperateArgs args) + public TxnAddKeys (Cluster cluster, Key key, OperateArgs args, Txn txn) : base(cluster, args.writePolicy, key) { this.args = args; + this.txn = txn; } protected internal override void WriteBuffer() @@ -35,7 +37,7 @@ protected internal override void WriteBuffer() protected internal override void ParseResult(Connection conn) { ParseHeader(conn); - ParseTxnDeadline(policy.Txn); + ParseTxnDeadline(txn); if (resultCode == ResultCode.OK) { diff --git a/AerospikeClient/Command/TxnMonitor.cs b/AerospikeClient/Command/TxnMonitor.cs index ed6d164e..b0826e3b 100644 --- a/AerospikeClient/Command/TxnMonitor.cs +++ b/AerospikeClient/Command/TxnMonitor.cs @@ -133,10 +133,11 @@ private static Operation[] GetTxnOps(Txn txn, List list) private static void AddWriteKeys(Cluster cluster, Policy policy, Operation[] ops) { + Txn txn = policy.Txn; Key txnKey = GetTxnMonitorKey(policy.Txn); WritePolicy wp = CopyTimeoutPolicy(policy); OperateArgs args = new(wp, null, null, ops); - TxnAddKeys cmd = new(cluster, txnKey, args); + TxnAddKeys cmd = new(cluster, txnKey, args, txn); cmd.Execute(); }