diff --git a/.github/actions/run-ee-server/action.yml b/.github/actions/run-ee-server/action.yml index b5246245..b014669b 100644 --- a/.github/actions/run-ee-server/action.yml +++ b/.github/actions/run-ee-server/action.yml @@ -42,7 +42,7 @@ runs: - name: Build and push uses: docker/build-push-action@v6 with: - # Don't want to use default Git context or else it will clone the whole Python client repo again + # Don't want to use default Git context or else it will clone the whole client repo again context: .github/workflows/docker-build-context build-args: | server_image=${{ env.IMAGE_NAME }} diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml deleted file mode 100644 index ae5eb48c..00000000 --- a/.github/workflows/dotnet.yml +++ /dev/null @@ -1,85 +0,0 @@ -# This workflow will build a .NET project -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net - -name: .NET - -on: - workflow_dispatch: - inputs: - run_tests: - description: 'Run Aerospike server and run tests?' - type: boolean - required: false - default: false - use-server-rc: - type: boolean - required: true - default: false - description: 'Test against server release candidate?' - server-tag: - required: true - default: 'latest' - description: 'Server docker image tag' - - workflow_call: - inputs: - # See workflow call hack in update-version.yml - is_workflow_call: - type: boolean - default: true - required: false - # Only used in workflow_call event - sha-to-build-and-test: - type: string - required: true - unoptimized: - type: boolean - required: false - default: false - run_tests: - type: boolean - required: false - default: false - use-server-rc: - required: false - type: boolean - default: false - description: 'Test against server release candidate?' - server-tag: - required: false - type: string - default: 'latest' - description: 'Server docker image tag' - secrets: - # Just make all the secrets required to make things simpler... - DOCKER_HUB_BOT_USERNAME: - required: true - DOCKER_HUB_BOT_PW: - required: true - MAC_M1_SELF_HOSTED_RUNNER_PW: - required: true - -env: - COMMIT_SHA_TO_BUILD_AND_TEST: ${{ inputs.is_workflow_call == true && inputs.sha-to-build-and-test || github.sha }} - # Note that environment variables in Github are all strings - # Github mac m1 and windows runners don't support Docker / nested virtualization - # so we need to use self-hosted runners to test wheels for these platforms - RUN_INTEGRATION_TESTS_IN_CIBW: ${{ inputs.run_tests && (startsWith(inputs.platform-tag, 'manylinux') || inputs.platform-tag == 'macosx_x86_64') }} - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 6.0.x - - name: Restore dependencies - run: dotnet restore - - name: Build - run: dotnet build --no-restore - - name: Test - run: dotnet test --no-build --verbosity normal \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 99b7bcf1..03d3209a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -24,32 +24,6 @@ on: required: true jobs: - #build: - # runs-on: ubuntu-latest - # strategy: - # fail-fast: false - # - # steps: - # - uses: actions/checkout@v4 - # - name: Setup .NET - # uses: actions/setup-dotnet@v4 - # with: - # dotnet-version: 6.0.x - # - name: Restore dependencies - # run: dotnet restore /p:EnableWindowsTargeting=true - # #- name: Install dependencies - # # run: dotnet add package NeoLua --version 1.3.14 - # - name: Build - # run: dotnet build --configuration Release --no-restore /p:EnableWindowsTargeting=true - # - # - name: Publish - # run: dotnet publish -c Release -o ../publish - # - # - name: Send files to test jobs - # uses: actions/upload-artifact@v3 - # with: - # name: AerospikeClient.dll - # path: ./AerospikeClient/bin/Debug/*.whl test-ee: runs-on: ubuntu-latest @@ -61,14 +35,15 @@ jobs: use-server-rc: true docker-hub-username: ${{ secrets.DOCKER_HUB_BOT_USERNAME }} docker-hub-password: ${{ secrets.DOCKER_HUB_BOT_PW }} + - name: Setup .NET uses: actions/setup-dotnet@v4 with: dotnet-version: 6.0.x + - name: Restore dependencies run: dotnet restore /p:EnableWindowsTargeting=true - #- name: Install dependencies - # run: dotnet add package NeoLua --version 1.3.14 + - name: Build run: dotnet build --configuration Release --no-restore /p:EnableWindowsTargeting=true diff --git a/AerospikeClient/Admin/Role.cs b/AerospikeClient/Admin/Role.cs index c94616d0..2b8af1aa 100644 --- a/AerospikeClient/Admin/Role.cs +++ b/AerospikeClient/Admin/Role.cs @@ -1,5 +1,5 @@ /* - * Copyright 2012-2022 Aerospike, Inc. + * Copyright 2012-2024 Aerospike, Inc. * * Portions may be licensed to Aerospike, Inc. under one or more contributor * license agreements. diff --git a/AerospikeClient/Async/AsyncClient.cs b/AerospikeClient/Async/AsyncClient.cs index 51eaa9f7..48f3469a 100644 --- a/AerospikeClient/Async/AsyncClient.cs +++ b/AerospikeClient/Async/AsyncClient.cs @@ -134,6 +134,19 @@ public AsyncClient(AsyncClientPolicy policy, params Host[] hosts) // Multi-Record Transactions //------------------------------------------------------- + /// + /// Asynchronously attempt to commit the given multi-record transaction. + /// Create listener, call asynchronous commit and return task monitor. + /// + /// multi-record transaction + /// cancellation token + public Task Commit(Txn txn, CancellationToken token) + { + var listener = new CommitListenerAdapter(token); + Commit(listener, txn); + return listener.Task; + } + /// /// Asynchronously attempt to commit the given multi-record transaction. First, the expected /// record versions are sent to the server nodes for verification. If all nodes return success, @@ -177,22 +190,23 @@ public void Commit(CommitListener listener, Txn txn) } /// - /// Asynchronously attempt to commit the given multi-record transaction. - /// Create listener, call asynchronous put and return task monitor. + /// Asynchronously attempt to abort and rollback the given multi-record transaction. + /// Create listener, call asynchronous commit and return task monitor. /// /// multi-record transaction /// cancellation token - public Task Commit(Txn txn, CancellationToken token) + public Task Abort(Txn txn, CancellationToken token) { - var listener = new CommitListenerAdapter(token); - Commit(listener, txn); + var listener = new AbortListenerAdapter(token); + Abort(listener, txn); return listener.Task; } + /// /// Asynchronously abort and rollback the given multi-record transaction. /// - /// Schedules the commit command with a channel selector and return. + /// Schedules the abort command with a channel selector and return. /// Another thread will process the command and send the results to the listener. /// /// Requires server version 8.0+ @@ -222,13 +236,6 @@ public void Abort(AbortListener listener, Txn txn) } } - public Task Abort(Txn txn, CancellationToken token) - { - var listener = new AbortListenerAdapter(token); - Abort(listener, txn); - return listener.Task; - } - //------------------------------------------------------- // Write Record Operations //------------------------------------------------------- diff --git a/AerospikeClient/Async/AsyncQueryPartitionExecutor.cs b/AerospikeClient/Async/AsyncQueryPartitionExecutor.cs index f308117a..68942fd1 100644 --- a/AerospikeClient/Async/AsyncQueryPartitionExecutor.cs +++ b/AerospikeClient/Async/AsyncQueryPartitionExecutor.cs @@ -14,8 +14,6 @@ * License for the specific language governing permissions and limitations under * the License. */ -using System; -using System.Collections.Generic; namespace Aerospike.Client { diff --git a/AerospikeClient/Async/AsyncScanPartitionExecutor.cs b/AerospikeClient/Async/AsyncScanPartitionExecutor.cs index 20cbc5c0..704e25d8 100644 --- a/AerospikeClient/Async/AsyncScanPartitionExecutor.cs +++ b/AerospikeClient/Async/AsyncScanPartitionExecutor.cs @@ -14,8 +14,6 @@ * License for the specific language governing permissions and limitations under * the License. */ -using System; -using System.Collections.Generic; namespace Aerospike.Client { diff --git a/AerospikeClient/Async/IAsyncClient.cs b/AerospikeClient/Async/IAsyncClient.cs index 47a709d6..ccbbb017 100644 --- a/AerospikeClient/Async/IAsyncClient.cs +++ b/AerospikeClient/Async/IAsyncClient.cs @@ -1,5 +1,5 @@ /* - * Copyright 2012-2022 Aerospike, Inc. + * Copyright 2012-2024 Aerospike, Inc. * * Portions may be licensed to Aerospike, Inc. under one or more contributor * license agreements. @@ -41,14 +41,23 @@ public interface IAsyncClient : IAerospikeClient // Multi-Record Transactions //------------------------------------------------------- + /// + /// Asynchronously attempt to commit the given multi-record transaction. + /// Create listener, call asynchronous commit and return task monitor. + /// + /// multi-record transaction + /// cancellation token + public Task Commit(Txn txn, CancellationToken token); + /// /// Asynchronously attempt to commit the given multi-record transaction. First, the expected - /// record versions are sent to the server nodes for verification.If all nodes return success, + /// record versions are sent to the server nodes for verification. If all nodes return success, /// the transaction is committed. Otherwise, the transaction is aborted. /// - /// This method registers the command with an event loop and returns. - /// The event loop thread will process the command and send the results to the listener. - /// + /// Schedules the commit command with a channel selector and return. + /// Another thread will process the command and send the results to the listener. + /// + /// /// Requires server version 8.0+ /// /// @@ -56,17 +65,25 @@ public interface IAsyncClient : IAerospikeClient /// multi-record transaction void Commit(CommitListener listener, Txn txn); + /// + /// Asynchronously attempt to abort and rollback the given multi-record transaction. + /// Create listener, call asynchronous commit and return task monitor. + /// + /// multi-record transaction + /// cancellation token + public Task Abort(Txn txn, CancellationToken token); + /// /// Asynchronously abort and rollback the given multi-record transaction. /// - /// This method registers the command with an event loop and returns. - /// The event loop thread will process the command and send the results to the listener. + /// Schedules the abort command with a channel selector and return. + /// Another thread will process the command and send the results to the listener. /// /// Requires server version 8.0+ /// /// - /// - /// + /// where to send results + /// multi-record transaction void Abort(AbortListener listener, Txn txn); //------------------------------------------------------- diff --git a/AerospikeClient/Cluster/NodeValidator.cs b/AerospikeClient/Cluster/NodeValidator.cs index cf398ca7..d5599f61 100644 --- a/AerospikeClient/Cluster/NodeValidator.cs +++ b/AerospikeClient/Cluster/NodeValidator.cs @@ -100,6 +100,11 @@ public Node SeedNode(Cluster cluster, Host host, Peers peers) private bool ValidatePeers(Peers peers, Node node) { + if (peers == null) + { + return true; + } + try { peers.refreshCount = 0; diff --git a/AerospikeClient/Command/Batch.cs b/AerospikeClient/Command/Batch.cs index 16a1f68c..ac7d7b0a 100644 --- a/AerospikeClient/Command/Batch.cs +++ b/AerospikeClient/Command/Batch.cs @@ -536,7 +536,7 @@ protected internal override bool ParseRow() BatchRecord record = records[batchIndex]; - if (resultCode == 0) + if (resultCode == ResultCode.OK) { record.resultCode = resultCode; } diff --git a/AerospikeClient/Command/Command.cs b/AerospikeClient/Command/Command.cs index 1604955a..7c38a9e8 100644 --- a/AerospikeClient/Command/Command.cs +++ b/AerospikeClient/Command/Command.cs @@ -316,7 +316,7 @@ public void SetTxnMarkRollForward(Key key) Begin(); int fieldCount = EstimateKeySize(key); EstimateOperationSize(bin); - SizeBuffer(); + //SizeBuffer(); WriteTxnMonitor(key, 0, Command.INFO2_WRITE, fieldCount, 1); WriteOperation(bin, Operation.Type.WRITE); End(); @@ -462,7 +462,7 @@ public void SetTxnClose(Txn txn, Key key) { Begin(); int fieldCount = EstimateKeySize(key); - SizeBuffer(); + //SizeBuffer(); WriteTxnMonitor(key, 0, Command.INFO2_WRITE | Command.INFO2_DELETE | Command.INFO2_DURABLE_DELETE, fieldCount, 0); End(); @@ -470,6 +470,7 @@ public void SetTxnClose(Txn txn, Key key) private void WriteTxnMonitor(Key key, int readAttr, int writeAttr, int fieldCount, int opCount) { + SizeBuffer(); dataOffset += 8; dataBuffer[dataOffset++] = MSG_REMAINING_HEADER_SIZE; dataBuffer[dataOffset++] = (byte)readAttr; diff --git a/AerospikeClient/Command/ExecuteCommand.cs b/AerospikeClient/Command/ExecuteCommand.cs index da0db3ea..6637d24a 100644 --- a/AerospikeClient/Command/ExecuteCommand.cs +++ b/AerospikeClient/Command/ExecuteCommand.cs @@ -24,7 +24,7 @@ public sealed class ExecuteCommand : SyncWriteCommand private readonly string packageName; private readonly string functionName; private readonly Value[] args; - public Record Record { get; private set; } + public Record Record { get; private set; } public ExecuteCommand ( diff --git a/AerospikeClient/Command/OperateArgs.cs b/AerospikeClient/Command/OperateArgs.cs index 8f983036..bdf42800 100644 --- a/AerospikeClient/Command/OperateArgs.cs +++ b/AerospikeClient/Command/OperateArgs.cs @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 Aerospike, Inc. + * Copyright 2012-2024 Aerospike, Inc. * * Portions may be licensed to Aerospike, Inc. under one or more contributor * license agreements. diff --git a/AerospikeClient/Command/ReadCommand.cs b/AerospikeClient/Command/ReadCommand.cs index 891e6d0c..28d40570 100644 --- a/AerospikeClient/Command/ReadCommand.cs +++ b/AerospikeClient/Command/ReadCommand.cs @@ -53,6 +53,7 @@ protected internal override void ParseResult(Connection conn) { ParseHeader(conn); ParseFields(policy.Txn, key, false); + if (resultCode == ResultCode.OK) { this.record = policy.recordParser.ParseRecord(dataBuffer, ref dataOffset, opCount, generation, expiration, isOperation); diff --git a/AerospikeClient/Listener/CommitListener.cs b/AerospikeClient/Listener/CommitListener.cs index fdca6e2b..2629c7de 100644 --- a/AerospikeClient/Listener/CommitListener.cs +++ b/AerospikeClient/Listener/CommitListener.cs @@ -24,7 +24,7 @@ namespace Aerospike.Client public interface CommitListener { /// - /// This method is called when the records are verified and the commit succeeds. + /// This method is called when the records are verified and the commit succeeded or will succeed. /// void OnSuccess(CommitStatusType status); diff --git a/AerospikeClient/Main/AerospikeClient.cs b/AerospikeClient/Main/AerospikeClient.cs index daa5e954..ad09ad8d 100644 --- a/AerospikeClient/Main/AerospikeClient.cs +++ b/AerospikeClient/Main/AerospikeClient.cs @@ -90,7 +90,7 @@ public class AerospikeClient : IDisposable, IAerospikeClient protected BatchDeletePolicy batchDeletePolicyDefault; /// - /// Default user defined function policy used in batch UDF excecute commands. + /// Default user defined function policy used in batch UDF execute commands. /// protected BatchUDFPolicy batchUDFPolicyDefault; @@ -256,6 +256,7 @@ protected internal AerospikeClient(ClientPolicy policy) /// /// Default read policy that is used when read command policy is null. + /// Get returns a copy of the read policy default to avoid problems if this shared instance is later modified. /// public Policy ReadPolicyDefault { @@ -265,6 +266,7 @@ public Policy ReadPolicyDefault /// /// Default write policy that is used when write command policy is null. + /// Get returns a copy of the write policy default to avoid problems if this shared instance is later modified. /// public WritePolicy WritePolicyDefault { @@ -274,6 +276,7 @@ public WritePolicy WritePolicyDefault /// /// Default scan policy that is used when scan command policy is null. + /// Get returns a copy of the scan policy default to avoid problems if this shared instance is later modified. /// public ScanPolicy ScanPolicyDefault { @@ -283,6 +286,7 @@ public ScanPolicy ScanPolicyDefault /// /// Default query policy that is used when query command policy is null. + /// Get returns a copy of the query policy default to avoid problems if this shared instance is later modified. /// public QueryPolicy QueryPolicyDefault { @@ -291,8 +295,9 @@ public QueryPolicy QueryPolicyDefault } /// - /// Default parent policy used in batch read commands.Parent policy fields + /// Default parent policy used in batch read commands. Parent policy fields /// include socketTimeout, totalTimeout, maxRetries, etc... + /// Get returns a copy of the batch header read policy default to avoid problems if this shared instance is later modified. /// public BatchPolicy BatchPolicyDefault { @@ -303,6 +308,7 @@ public BatchPolicy BatchPolicyDefault /// /// Default parent policy used in batch write commands. Parent policy fields /// include socketTimeout, totalTimeout, maxRetries, etc... + /// Get returns a copy of the batch header write policy default to avoid problems if this shared instance is later modified. /// public BatchPolicy BatchParentPolicyWriteDefault { @@ -313,6 +319,7 @@ public BatchPolicy BatchParentPolicyWriteDefault /// /// Default write policy used in batch operate commands. /// Write policy fields include generation, expiration, durableDelete, etc... + /// Get returns a copy of the batch detail write policy default to avoid problems if this shared instance is later modified. /// public BatchWritePolicy BatchWritePolicyDefault { @@ -322,6 +329,7 @@ public BatchWritePolicy BatchWritePolicyDefault /// /// Default delete policy used in batch delete commands. + /// Get returns a copy of the batch detail delete policy default to avoid problems if this shared instance is later modified. /// public BatchDeletePolicy BatchDeletePolicyDefault { @@ -331,6 +339,7 @@ public BatchDeletePolicy BatchDeletePolicyDefault /// /// Default user defined function policy used in batch UDF excecute commands. + /// Get returns a copy of the batch detail UDF policy default to avoid problems if this shared instance is later modified. /// public BatchUDFPolicy BatchUDFPolicyDefault { @@ -338,8 +347,19 @@ public BatchUDFPolicy BatchUDFPolicyDefault set { batchUDFPolicyDefault = value; } } + /// + /// Default info policy that is used when info command policy is null. + /// Get returns a copy of the info command policy default to avoid problems if this shared instance is later modified. + /// + public InfoPolicy InfoPolicyDefault + { + get { return new InfoPolicy(infoPolicyDefault); } + set { infoPolicyDefault = value; } + } + /// /// Default multi-record transactions (MRT) policy when verifying record versions in a batch on a commit. + /// Get returns a copy of the txn verify policy default. /// public TxnVerifyPolicy TxnVerifyPolicyDefault { @@ -350,6 +370,7 @@ public TxnVerifyPolicy TxnVerifyPolicyDefault /// /// Default multi-record transactions (MRT) policy when rolling the transaction records forward (commit) /// or back(abort) in a batch. + /// Get returns a copy of the txn roll policy default. /// public TxnRollPolicy TxnRollPolicyDefault { @@ -357,15 +378,6 @@ public TxnRollPolicy TxnRollPolicyDefault set { txnRollPolicyDefault = value; } } - /// - /// Default info policy that is used when info command policy is null. - /// - public InfoPolicy InfoPolicyDefault - { - get { return infoPolicyDefault; } - set { infoPolicyDefault = value; } - } - //------------------------------------------------------- // Cluster Connection Management //------------------------------------------------------- @@ -467,11 +479,13 @@ public ClusterStats GetClusterStats() /// Attempt to commit the given multi-record 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. - ///

+ /// /// Requires server version 8.0+ - ///

+ ///
///
/// multi-record transaction + /// status of the commit on success + /// if verify commit fails public CommitStatus.CommitStatusType Commit(Txn txn) { TxnRoll tr = new(cluster, txn); @@ -496,11 +510,12 @@ public CommitStatus.CommitStatusType Commit(Txn txn) /// /// Abort and rollback the given multi-record transaction. - ///

+ /// /// Requires server version 8.0+ - ///

+ /// ///
/// multi-record transaction + /// statis of the abort public AbortStatus.AbortStatusType Abort(Txn txn) { TxnRoll tr = new(cluster, txn); @@ -1028,10 +1043,8 @@ public Record[] Get(BatchPolicy policy, Key[] keys) policy = batchPolicyDefault; } - policy.Txn?.PrepareRead(keys); - Record[] records = new Record[keys.Length]; try @@ -1197,10 +1210,8 @@ public Record[] GetHeader(BatchPolicy policy, Key[] keys) policy = batchPolicyDefault; } - policy.Txn?.PrepareRead(keys); - Record[] records = new Record[keys.Length]; try @@ -1304,11 +1315,10 @@ public Record Join(BatchPolicy policy, Key key, params Join[] joins) public Record Operate(WritePolicy policy, Key key, params Operation[] operations) { OperateArgs args = new OperateArgs(policy, writePolicyDefault, operatePolicyReadDefault, operations); - + policy = args.writePolicy; + if (args.hasWrite) { - policy = args.writePolicy; - if (policy.Txn != null) { TxnMonitor.AddKey(cluster, policy, key); diff --git a/AerospikeClient/Main/AerospikeException.cs b/AerospikeClient/Main/AerospikeException.cs index 27805b63..ed73da91 100644 --- a/AerospikeClient/Main/AerospikeException.cs +++ b/AerospikeClient/Main/AerospikeException.cs @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 Aerospike, Inc. + * Copyright 2012-2024 Aerospike, Inc. * * Portions may be licensed to Aerospike, Inc. under one or more contributor * license agreements. @@ -16,8 +16,6 @@ */ using System.Collections.ObjectModel; using System.Text; -using static Aerospike.Client.AbortStatus; -using static Aerospike.Client.AerospikeException; using static Aerospike.Client.CommitError; namespace Aerospike.Client @@ -498,7 +496,7 @@ public BatchRecordArray(BatchRecord[] records, Exception e) this.records = records; } - public BatchRecordArray(BatchRecord[] records, String message, Exception e) + public BatchRecordArray(BatchRecord[] records, string message, Exception e) : base(ResultCode.BATCH_FAILED, message, e) { this.records = records; @@ -578,7 +576,7 @@ public Backoff(int resultCode) : base(resultCode) } /// - /// Exception thrown when fails. + /// Exception thrown when fails. /// Commit Exception has similar behavior to AggregateException. /// might be populated if mutliple exceptions contribute to the failure. /// diff --git a/AerospikeClient/Main/BatchRecord.cs b/AerospikeClient/Main/BatchRecord.cs index 9196404b..3d8a31d5 100644 --- a/AerospikeClient/Main/BatchRecord.cs +++ b/AerospikeClient/Main/BatchRecord.cs @@ -1,5 +1,5 @@ /* - * Copyright 2012-2022 Aerospike, Inc. + * Copyright 2012-2024 Aerospike, Inc. * * Portions may be licensed to Aerospike, Inc. under one or more contributor * license agreements. diff --git a/AerospikeClient/Main/IAerospikeClient.cs b/AerospikeClient/Main/IAerospikeClient.cs index c9c6ee2f..5a825919 100644 --- a/AerospikeClient/Main/IAerospikeClient.cs +++ b/AerospikeClient/Main/IAerospikeClient.cs @@ -26,68 +26,80 @@ public interface IAerospikeClient /// /// Default read policy that is used when read command policy is null. + /// Get returns a copy of the read policy default to avoid problems if this shared instance is later modified. /// Policy ReadPolicyDefault { get; set; } /// /// Default write policy that is used when write command policy is null. + /// Get returns a copy of the write policy default to avoid problems if this shared instance is later modified. /// WritePolicy WritePolicyDefault { get; set; } /// /// Default scan policy that is used when scan command policy is null. + /// Get returns a copy of the scan policy default to avoid problems if this shared instance is later modified. /// ScanPolicy ScanPolicyDefault { get; set; } /// /// Default query policy that is used when query command policy is null. + /// Get returns a copy of the query policy default to avoid problems if this shared instance is later modified. /// QueryPolicy QueryPolicyDefault { get; set; } /// /// Default parent policy used in batch read commands.Parent policy fields /// include socketTimeout, totalTimeout, maxRetries, etc... + /// Get returns a copy of the batch header read policy default to avoid problems if this shared instance is later modified. /// BatchPolicy BatchPolicyDefault { get; set; } /// /// Default parent policy used in batch write commands. Parent policy fields /// include socketTimeout, totalTimeout, maxRetries, etc... + /// Get returns a copy of the batch header write policy default to avoid problems if this shared instance is later modified. /// BatchPolicy BatchParentPolicyWriteDefault { get; set; } /// /// Default write policy used in batch operate commands. /// Write policy fields include generation, expiration, durableDelete, etc... + /// Get returns a copy of the batch detail write policy default to avoid problems if this shared instance is later modified. /// BatchWritePolicy BatchWritePolicyDefault { get; set; } /// /// Default delete policy used in batch delete commands. + /// Get returns a copy of the batch detail delete policy default to avoid problems if this shared instance is later modified. /// BatchDeletePolicy BatchDeletePolicyDefault { get; set; } /// - /// Default user defined function policy used in batch UDF excecute commands. + /// Default user defined function policy used in batch UDF execute commands. + /// Get returns a copy of the batch detail UDF policy default to avoid problems if this shared instance is later modified. /// BatchUDFPolicy BatchUDFPolicyDefault { get; set; } + /// + /// Default info policy that is used when info command policy is null. + /// Get returns a copy of the info command policy default to avoid problems if this shared instance is later modified. + /// + InfoPolicy InfoPolicyDefault { get; set; } + /// /// Default multi-record transactions (MRT) policy when verifying record versions in a batch on a commit. + /// Get returns a copy of the txn verify policy default. /// TxnVerifyPolicy TxnVerifyPolicyDefault { get; set; } /// /// Default multi-record transactions (MRT) policy when rolling the transaction records forward (commit) - /// or back(abort) in a batch. + /// or back(abort) in a batch. + /// Get returns a copy of the txn roll policy default. /// TxnRollPolicy TxnRollPolicyDefault { get; set; } - /// - /// Default info policy that is used when info command policy is null. - /// - InfoPolicy InfoPolicyDefault { get; set; } - //------------------------------------------------------- // Cluster Connection Management //------------------------------------------------------- @@ -134,22 +146,25 @@ public interface IAerospikeClient /// /// Attempt to commit the given multi-record transaction. First, the expected record versions are - /// sent to the server nodes for verification.If all nodes return success, the command is + /// sent to the server nodes for verification. If all nodes return success, the transaction is /// committed. Otherwise, the transaction is aborted. - ///

+ /// /// Requires server version 8.0+ - ///

+ /// ///
/// multi-record transaction + /// status of the commit on success + /// if verify commit fails CommitStatus.CommitStatusType Commit(Txn txn); /// /// Abort and rollback the given multi-record transaction. - ///

+ /// /// Requires server version 8.0+ - ///

+ /// ///
/// multi-record transaction + /// statis of the abort AbortStatus.AbortStatusType Abort(Txn txn); //------------------------------------------------------- diff --git a/AerospikeClient/Main/ResultCode.cs b/AerospikeClient/Main/ResultCode.cs index bf060407..d66ab3cf 100644 --- a/AerospikeClient/Main/ResultCode.cs +++ b/AerospikeClient/Main/ResultCode.cs @@ -319,6 +319,12 @@ public sealed class ResultCode ///
public const int MRT_ABORTED = 34; + /// + /// MRT write command limit (4096) exceeded. + /// Value: 35 + /// + public const int MRT_TOO_MANY_WRITES = 35; + /// /// There are no more records left for query. /// Value: 50 @@ -732,6 +738,9 @@ public static string GetResultString(int resultCode) case MRT_ABORTED: return "MRT already aborted"; + case MRT_TOO_MANY_WRITES: + return "MRT write command limit exceeded"; + case QUERY_END: return "Query end"; diff --git a/AerospikeClient/Main/Txn.cs b/AerospikeClient/Main/Txn.cs index e40990c5..e01d0b76 100644 --- a/AerospikeClient/Main/Txn.cs +++ b/AerospikeClient/Main/Txn.cs @@ -51,11 +51,15 @@ public enum TxnState /// is used to avoid client/server clock skew issues. For internal use only. /// internal int Deadline { get; 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 /// a commit or 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. + /// /// public int Timeout { get; set; } @@ -65,21 +69,27 @@ public enum TxnState /// /// Create MRT, assign random transaction id and initialize reads/writes hashmaps with - /// default capacities. The default MRT timeout is 10 seconds. + /// 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. + /// /// public Txn() { Id = CreateId(); Reads = new ConcurrentHashMap(); Writes = new ConcurrentHashSet(); - Deadline = 0; State = TxnState.OPEN; - Timeout = 10; // seconds } /// /// Create MRT, assign random transaction id and initialize reads/writes hashmaps with - /// given capacities. The default MRT timeout is 10 seconds. + /// 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. + /// /// /// expected number of record reads in the MRT. Minimum value is 16. /// expected number of record writes in the MRT. Minimum value is 16. @@ -98,9 +108,7 @@ public Txn(int readsCapacity, int writesCapacity) Id = CreateId(); Reads = new ConcurrentHashMap(readsCapacity); Writes = new ConcurrentHashSet(writesCapacity); - Deadline = 0; State = TxnState.OPEN; - Timeout = 10; // seconds } [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] @@ -199,7 +207,7 @@ internal void OnRead(Key key, long? version) /// /// /// - public void OnWrite(Key key, long? version, int resultCode) + internal void OnWrite(Key key, long? version, int resultCode) { // Write commands set namespace prior to sending the command, so there is // no need to call it here when receiving the response. @@ -220,7 +228,7 @@ public void OnWrite(Key key, long? version, int resultCode) /// /// Add key to write hash when write command is in doubt (usually caused by timeout). /// - public void OnWriteInDoubt(Key key) + internal void OnWriteInDoubt(Key key) { Reads.Remove(key); Writes.Add(key); diff --git a/AerospikeClient/Policy/BatchDeletePolicy.cs b/AerospikeClient/Policy/BatchDeletePolicy.cs index 9d99775a..d8d28978 100644 --- a/AerospikeClient/Policy/BatchDeletePolicy.cs +++ b/AerospikeClient/Policy/BatchDeletePolicy.cs @@ -1,5 +1,5 @@ /* - * Copyright 2012-2022 Aerospike, Inc. + * Copyright 2012-2024 Aerospike, Inc. * * Portions may be licensed to Aerospike, Inc. under one or more contributor * license agreements. diff --git a/AerospikeClient/Policy/BatchPolicy.cs b/AerospikeClient/Policy/BatchPolicy.cs index 79a039f9..31860cdd 100644 --- a/AerospikeClient/Policy/BatchPolicy.cs +++ b/AerospikeClient/Policy/BatchPolicy.cs @@ -1,5 +1,5 @@ /* - * Copyright 2012-2022 Aerospike, Inc. + * Copyright 2012-2024 Aerospike, Inc. * * Portions may be licensed to Aerospike, Inc. under one or more contributor * license agreements. diff --git a/AerospikeClient/Policy/BatchWritePolicy.cs b/AerospikeClient/Policy/BatchWritePolicy.cs index 7618cc04..78932fc5 100644 --- a/AerospikeClient/Policy/BatchWritePolicy.cs +++ b/AerospikeClient/Policy/BatchWritePolicy.cs @@ -1,5 +1,5 @@ /* - * Copyright 2012-2022 Aerospike, Inc. + * Copyright 2012-2024 Aerospike, Inc. * * Portions may be licensed to Aerospike, Inc. under one or more contributor * license agreements. diff --git a/AerospikeClient/Policy/CommitLevel.cs b/AerospikeClient/Policy/CommitLevel.cs index aa4f5240..9cbbb11d 100644 --- a/AerospikeClient/Policy/CommitLevel.cs +++ b/AerospikeClient/Policy/CommitLevel.cs @@ -1,5 +1,5 @@ /* - * Copyright 2012-2018 Aerospike, Inc. + * Copyright 2012-2024 Aerospike, Inc. * * Portions may be licensed to Aerospike, Inc. under one or more contributor * license agreements. diff --git a/AerospikeClient/Query/RecordSet.cs b/AerospikeClient/Query/RecordSet.cs index 26a172ae..03e69a78 100644 --- a/AerospikeClient/Query/RecordSet.cs +++ b/AerospikeClient/Query/RecordSet.cs @@ -1,5 +1,5 @@ /* - * Copyright 2012-2023 Aerospike, Inc. + * Copyright 2012-2024 Aerospike, Inc. * * Portions may be licensed to Aerospike, Inc. under one or more contributor * license agreements. diff --git a/AerospikeClient/Query/ResultSet.cs b/AerospikeClient/Query/ResultSet.cs index a80481db..37ee4450 100644 --- a/AerospikeClient/Query/ResultSet.cs +++ b/AerospikeClient/Query/ResultSet.cs @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 Aerospike, Inc. + * Copyright 2012-2024 Aerospike, Inc. * * Portions may be licensed to Aerospike, Inc. under one or more contributor * license agreements.