Skip to content

Commit

Permalink
Remove txn instance from copied write policy when adding MRT monitor …
Browse files Browse the repository at this point in the history
…keys
  • Loading branch information
shannonklaus committed Dec 5, 2024
1 parent c6b4ad8 commit 3a09953
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down
8 changes: 6 additions & 2 deletions AerospikeClient/Async/AsyncTxnAddKeys.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,28 @@ 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)
: base(other)
{
this.listener = other.listener;
this.args = other.args;
this.txn = other.txn;
}

protected internal override AsyncCommand CloneCommand()
Expand All @@ -54,7 +58,7 @@ protected internal override void WriteBuffer()
protected internal override bool ParseResult()
{
ParseHeader();
ParseTxnDeadline(policy.Txn);
ParseTxnDeadline(txn);

if (resultCode == ResultCode.OK)
{
Expand Down
3 changes: 2 additions & 1 deletion AerospikeClient/Async/AsyncTxnMonitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,15 @@ 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);

ExecuteRecordListener txnListener = new(this);

// 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();
}

Expand Down
6 changes: 4 additions & 2 deletions AerospikeClient/Command/TxnAddKeys.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)
{
Expand Down
3 changes: 2 additions & 1 deletion AerospikeClient/Command/TxnMonitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,11 @@ private static Operation[] GetTxnOps(Txn txn, List<Value> 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();
}

Expand Down

0 comments on commit 3a09953

Please sign in to comment.