iter)
}
if (br.binNames != null) {
- writeBatchBinNames(key, br.binNames, attr, attr.filterExp);
+ if (br.binNames.length > 0) {
+ writeBatchBinNames(key, br.binNames, attr, attr.filterExp);
+ }
+ else {
+ attr.adjustRead(true);
+ writeBatchRead(key, attr, attr.filterExp, 0);
+ }
}
else if (br.ops != null) {
attr.adjustRead(br.ops);
@@ -851,13 +865,9 @@ else if (br.ops != null) {
case BATCH_WRITE: {
BatchWrite bw = (BatchWrite)record;
+ BatchWritePolicy bwp = (bw.policy != null)? bw.policy : writePolicy;
- if (bw.policy != null) {
- attr.setWrite(bw.policy);
- }
- else {
- attr.setWrite(policy);
- }
+ attr.setWrite(bwp);
attr.adjustWrite(bw.ops);
writeBatchOperations(key, bw.ops, attr, attr.filterExp);
break;
@@ -865,13 +875,9 @@ else if (br.ops != null) {
case BATCH_UDF: {
BatchUDF bu = (BatchUDF)record;
+ BatchUDFPolicy bup = (bu.policy != null)? bu.policy : udfPolicy;
- if (bu.policy != null) {
- attr.setUDF(bu.policy);
- }
- else {
- attr.setUDF(policy);
- }
+ attr.setUDF(bup);
writeBatchWrite(key, attr, attr.filterExp, 3, 0);
writeField(bu.packageName, FieldType.UDF_PACKAGE_NAME);
writeField(bu.functionName, FieldType.UDF_FUNCTION);
@@ -881,13 +887,9 @@ else if (br.ops != null) {
case BATCH_DELETE: {
BatchDelete bd = (BatchDelete)record;
+ BatchDeletePolicy bdp = (bd.policy != null)? bd.policy : deletePolicy;
- if (bd.policy != null) {
- attr.setDelete(bd.policy);
- }
- else {
- attr.setDelete(policy);
- }
+ attr.setDelete(bdp);
writeBatchWrite(key, attr, attr.filterExp, 0, 0);
break;
}
@@ -1327,9 +1329,8 @@ public final void setScan(
}
// Clusters that support partition queries also support not sending partition done messages.
- int infoAttr = cluster.hasPartitionQuery? Command.INFO3_PARTITION_DONE : 0;
int operationCount = (binNames == null)? 0 : binNames.length;
- writeHeaderRead(policy, totalTimeout, readAttr, 0, infoAttr, fieldCount, operationCount);
+ writeHeaderRead(policy, totalTimeout, readAttr, 0, Command.INFO3_PARTITION_DONE, fieldCount, operationCount);
if (namespace != null) {
writeField(namespace, FieldType.NAMESPACE);
@@ -1387,6 +1388,7 @@ public final void setScan(
// Query
//--------------------------------------------------
+ @SuppressWarnings("deprecation")
public final void setQuery(
Cluster cluster,
Policy policy,
@@ -1578,7 +1580,7 @@ else if (qp.expectedDuration == QueryDuration.LONG_RELAX_AP) {
writeAttr |= Command.INFO2_RELAX_AP_LONG_QUERY;
}
- int infoAttr = isNew? Command.INFO3_PARTITION_DONE : 0;
+ int infoAttr = (isNew || filter == null)? Command.INFO3_PARTITION_DONE : 0;
writeHeaderRead(policy, totalTimeout, readAttr, writeAttr, infoAttr, fieldCount, operationCount);
}
diff --git a/client/src/com/aerospike/client/lua/LuaCache.java b/client/src/com/aerospike/client/lua/LuaCache.java
index 51e080f5f..499fcf40c 100644
--- a/client/src/com/aerospike/client/lua/LuaCache.java
+++ b/client/src/com/aerospike/client/lua/LuaCache.java
@@ -63,7 +63,7 @@ public static final Prototype loadPackageFromFile(String packageName) {
Packages.put(packageName, prototype);
}
catch (Throwable e) {
- throw new AerospikeException("Failed to read file: " + source.getAbsolutePath());
+ throw new AerospikeException("Failed to read file: " + source.getAbsolutePath(), e);
}
}
return prototype;
@@ -81,7 +81,7 @@ public static final Prototype loadPackageFromResource(ClassLoader resourceLoader
Packages.put(packageName, prototype);
}
catch (Throwable e) {
- throw new AerospikeException("Failed to read resource: " + resourcePath);
+ throw new AerospikeException("Failed to read resource: " + resourcePath, e);
}
}
return prototype;
@@ -94,7 +94,7 @@ private static Prototype compile(String packageName, InputStream is) {
return LuaC.instance.compile(bis, packageName);
}
catch (Throwable e) {
- throw new AerospikeException("Failed to compile: " + packageName);
+ throw new AerospikeException("Failed to compile: " + packageName, e);
}
}
diff --git a/client/src/com/aerospike/client/metrics/LatencyBuckets.java b/client/src/com/aerospike/client/metrics/LatencyBuckets.java
index db61b2089..ca1b9df3e 100644
--- a/client/src/com/aerospike/client/metrics/LatencyBuckets.java
+++ b/client/src/com/aerospike/client/metrics/LatencyBuckets.java
@@ -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 WHICH ARE COMPATIBLE WITH THE APACHE LICENSE, VERSION 2.0.
@@ -33,7 +33,7 @@ public final class LatencyBuckets {
*
* @param latencyColumns number of latency buckets
* @param latencyShift power of 2 multiple between each range bucket in latency histograms starting at bucket 3.
- * The first 2 buckets are "<=1ms" and ">1ms".
+ * The first 2 buckets are "<=1ms" and ">1ms".
*/
public LatencyBuckets(int latencyColumns, int latencyShift) {
this.latencyShift = latencyShift;
diff --git a/client/src/com/aerospike/client/metrics/LatencyType.java b/client/src/com/aerospike/client/metrics/LatencyType.java
index 01fda6aa2..625a9ef07 100644
--- a/client/src/com/aerospike/client/metrics/LatencyType.java
+++ b/client/src/com/aerospike/client/metrics/LatencyType.java
@@ -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 WHICH ARE COMPATIBLE WITH THE APACHE LICENSE, VERSION 2.0.
@@ -16,6 +16,9 @@
*/
package com.aerospike.client.metrics;
+/**
+ * Latency group type.
+ */
public enum LatencyType {
CONN,
WRITE,
diff --git a/client/src/com/aerospike/client/metrics/MetricsPolicy.java b/client/src/com/aerospike/client/metrics/MetricsPolicy.java
index df6e285a3..b6119027e 100644
--- a/client/src/com/aerospike/client/metrics/MetricsPolicy.java
+++ b/client/src/com/aerospike/client/metrics/MetricsPolicy.java
@@ -69,7 +69,7 @@ public final class MetricsPolicy {
/**
* Power of 2 multiple between each range bucket in latency histograms starting at column 3. The bucket units
- * are in milliseconds. The first 2 buckets are "<=1ms" and ">1ms". Examples:
+ * are in milliseconds. The first 2 buckets are "<=1ms" and ">1ms". Examples:
* {@code
* // latencyColumns=7 latencyShift=1
* <=1ms >1ms >2ms >4ms >8ms >16ms >32ms
diff --git a/client/src/com/aerospike/client/policy/ReadModeSC.java b/client/src/com/aerospike/client/policy/ReadModeSC.java
index ff2c6dbd3..eed429b13 100644
--- a/client/src/com/aerospike/client/policy/ReadModeSC.java
+++ b/client/src/com/aerospike/client/policy/ReadModeSC.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2021 Aerospike, Inc.
+ * Copyright 2012-2024 Aerospike, Inc.
*
* Portions may be licensed to Aerospike, Inc. under one or more contributor
* license agreements WHICH ARE COMPATIBLE WITH THE APACHE LICENSE, VERSION 2.0.
@@ -24,25 +24,25 @@
public enum ReadModeSC {
/**
* Ensures this client will only see an increasing sequence of record versions.
- * Server only reads from master. This is the default.
+ * Client only reads from master. This is the default.
*/
SESSION,
/**
- * Ensures ALL clients will only see an increasing sequence of record versions.
- * Server only reads from master.
+ * Ensures all clients will only see an increasing sequence of record versions.
+ * Client only reads from master.
*/
LINEARIZE,
/**
- * Server may read from master or any full (non-migrating) replica.
+ * Client may read from master or any full (non-migrating) replica.
* Increasing sequence of record versions is not guaranteed.
*/
ALLOW_REPLICA,
/**
- * Server may read from master or any full (non-migrating) replica or from unavailable
- * partitions. Increasing sequence of record versions is not guaranteed.
+ * Client may read from master or any full (non-migrating) replica or from unavailable
+ * partitions. Increasing sequence of record versions is not guaranteed.
*/
ALLOW_UNAVAILABLE
}
diff --git a/client/src/com/aerospike/client/query/RecordSet.java b/client/src/com/aerospike/client/query/RecordSet.java
index ad36a5e65..7796db2b9 100644
--- a/client/src/com/aerospike/client/query/RecordSet.java
+++ b/client/src/com/aerospike/client/query/RecordSet.java
@@ -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 WHICH ARE COMPATIBLE WITH THE APACHE LICENSE, VERSION 2.0.
@@ -131,6 +131,13 @@ public Record getRecord() {
return record.record;
}
+ /**
+ * Get key and record.
+ */
+ public KeyRecord getKeyRecord() {
+ return record;
+ }
+
//-------------------------------------------------------
// Methods for internal use only.
//-------------------------------------------------------
@@ -206,7 +213,7 @@ public boolean hasNext() {
@Override
public KeyRecord next() {
- KeyRecord kr = recordSet.record;
+ KeyRecord kr = recordSet.getKeyRecord();
more = recordSet.next();
return kr;
}
diff --git a/client/src/com/aerospike/client/task/IndexTask.java b/client/src/com/aerospike/client/task/IndexTask.java
index 98852e603..bdc469127 100644
--- a/client/src/com/aerospike/client/task/IndexTask.java
+++ b/client/src/com/aerospike/client/task/IndexTask.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2021 Aerospike, Inc.
+ * Copyright 2012-2024 Aerospike, Inc.
*
* Portions may be licensed to Aerospike, Inc. under one or more contributor
* license agreements WHICH ARE COMPATIBLE WITH THE APACHE LICENSE, VERSION 2.0.
@@ -18,6 +18,7 @@
import com.aerospike.client.AerospikeException;
import com.aerospike.client.Info;
+import com.aerospike.client.ResultCode;
import com.aerospike.client.cluster.Cluster;
import com.aerospike.client.cluster.Node;
import com.aerospike.client.policy.Policy;
@@ -92,13 +93,14 @@ public static int parseStatusResponse(String command, String response, boolean i
int index = response.indexOf(find);
if (index < 0) {
- if (response.indexOf("FAIL:201") >= 0 || response.indexOf("FAIL:203") >= 0) {
- // Index not found or not readable.
+ Info.Error error = new Info.Error(response);
+
+ if (error.code == ResultCode.INDEX_NOTFOUND || error.code == ResultCode.INDEX_NOTREADABLE) {
return Task.NOT_FOUND;
}
else {
// Throw exception immediately.
- throw new AerospikeException(command + " failed: " + response);
+ throw new AerospikeException(error.code, command + " failed: " + error.message);
}
}
@@ -113,7 +115,9 @@ public static int parseStatusResponse(String command, String response, boolean i
}
else {
// Check if index has been dropped.
- if (response.indexOf("FAIL:201") < 0) {
+ Info.Error error = new Info.Error(response);
+
+ if (error.code != ResultCode.INDEX_NOTFOUND) {
// Index still exists.
return Task.IN_PROGRESS;
}
diff --git a/client/src/com/aerospike/client/util/Crypto.java b/client/src/com/aerospike/client/util/Crypto.java
index 22037c7c3..63ca13556 100644
--- a/client/src/com/aerospike/client/util/Crypto.java
+++ b/client/src/com/aerospike/client/util/Crypto.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2021 Aerospike, Inc.
+ * Copyright 2012-2024 Aerospike, Inc.
*
* Portions may be licensed to Aerospike, Inc. under one or more contributor
* license agreements WHICH ARE COMPATIBLE WITH THE APACHE LICENSE, VERSION 2.0.
diff --git a/examples/pom.xml b/examples/pom.xml
index 4d1c03e63..b0ca631da 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -6,7 +6,7 @@
com.aerospike
aerospike-parent
- 8.1.0
+ 8.1.2
aerospike-examples
jar
diff --git a/examples/src/com/aerospike/examples/QueryExp.java b/examples/src/com/aerospike/examples/QueryExp.java
index c0a9d3a54..f0895dfec 100644
--- a/examples/src/com/aerospike/examples/QueryExp.java
+++ b/examples/src/com/aerospike/examples/QueryExp.java
@@ -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 WHICH ARE COMPATIBLE WITH THE APACHE LICENSE, VERSION 2.0.
@@ -132,7 +132,7 @@ private void runQuery1(
// Predicates are applied on query results on server side.
// Predicates can reference any bin.
- QueryPolicy policy = new QueryPolicy(client.getQueryPolicyDefault());
+ QueryPolicy policy = client.copyQueryPolicyDefault();
policy.filterExp = Exp.build(
Exp.or(
Exp.and(
@@ -171,7 +171,7 @@ private void runQuery2(
stmt.setSetName(params.set);
stmt.setFilter(Filter.range(binName, begin, end));
- QueryPolicy policy = new QueryPolicy(client.getQueryPolicyDefault());
+ QueryPolicy policy = client.copyQueryPolicyDefault();
policy.filterExp = Exp.build(
Exp.and(
Exp.ge(Exp.lastUpdate(), Exp.val(beginTime)),
@@ -206,7 +206,7 @@ private void runQuery3(
stmt.setSetName(params.set);
stmt.setFilter(Filter.range(binName, begin, end));
- QueryPolicy policy = new QueryPolicy(client.getQueryPolicyDefault());
+ QueryPolicy policy = client.copyQueryPolicyDefault();
policy.filterExp = Exp.build(
Exp.regexCompare("prefix.*suffix", RegexFlag.ICASE | RegexFlag.NEWLINE, Exp.stringBin("bin3")));
diff --git a/pom.xml b/pom.xml
index b072d70ea..416961f65 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
com.aerospike
aerospike-parent
aerospike-parent
- 8.1.0
+ 8.1.2
pom
https://github.com/aerospike/aerospike-client-java
@@ -39,12 +39,12 @@
2.18.1
3.2.0
- 4.1.107.Final
+ 4.1.110.Final
2.0.62.Final
1.59.0
3.0.1
0.4
- 1.6.0
+ 1.8.0
4.13.1
diff --git a/proxy/pom.xml b/proxy/pom.xml
index 9155a1832..8d980ca2c 100644
--- a/proxy/pom.xml
+++ b/proxy/pom.xml
@@ -6,7 +6,7 @@
com.aerospike
aerospike-parent
- 8.1.0
+ 8.1.2
aerospike-proxy-client
jar
diff --git a/proxy/src/com/aerospike/client/proxy/AerospikeClientProxy.java b/proxy/src/com/aerospike/client/proxy/AerospikeClientProxy.java
index 32305f660..889e1c502 100644
--- a/proxy/src/com/aerospike/client/proxy/AerospikeClientProxy.java
+++ b/proxy/src/com/aerospike/client/proxy/AerospikeClientProxy.java
@@ -334,46 +334,146 @@ private static String getVersion() {
// Default Policies
//-------------------------------------------------------
+ /**
+ * Return read policy default. Use when the policy will not be modified.
+ */
public final Policy getReadPolicyDefault() {
return readPolicyDefault;
}
+ /**
+ * Copy read policy default. Use when the policy will be modified for use in a specific transaction.
+ */
+ public final Policy copyReadPolicyDefault() {
+ return new Policy(readPolicyDefault);
+ }
+
+ /**
+ * Return write policy default. Use when the policy will not be modified.
+ */
public final WritePolicy getWritePolicyDefault() {
return writePolicyDefault;
}
+ /**
+ * Copy write policy default. Use when the policy will be modified for use in a specific transaction.
+ */
+ public final WritePolicy copyWritePolicyDefault() {
+ return new WritePolicy(writePolicyDefault);
+ }
+
+ /**
+ * Return scan policy default. Use when the policy will not be modified.
+ */
public final ScanPolicy getScanPolicyDefault() {
return scanPolicyDefault;
}
+ /**
+ * Copy scan policy default. Use when the policy will be modified for use in a specific transaction.
+ */
+ public final ScanPolicy copyScanPolicyDefault() {
+ return new ScanPolicy(scanPolicyDefault);
+ }
+
+ /**
+ * Return query policy default. Use when the policy will not be modified.
+ */
public final QueryPolicy getQueryPolicyDefault() {
return queryPolicyDefault;
}
+ /**
+ * Copy query policy default. Use when the policy will be modified for use in a specific transaction.
+ */
+ public final QueryPolicy copyQueryPolicyDefault() {
+ return new QueryPolicy(queryPolicyDefault);
+ }
+
+ /**
+ * Return batch header read policy default. Use when the policy will not be modified.
+ */
public final BatchPolicy getBatchPolicyDefault() {
return batchPolicyDefault;
}
+ /**
+ * Copy batch header read policy default. Use when the policy will be modified for use in a specific transaction.
+ */
+ public final BatchPolicy copyBatchPolicyDefault() {
+ return new BatchPolicy(batchPolicyDefault);
+ }
+
+ /**
+ * Return batch header write policy default. Use when the policy will not be modified.
+ */
public final BatchPolicy getBatchParentPolicyWriteDefault() {
return batchParentPolicyWriteDefault;
}
+ /**
+ * Copy batch header write policy default. Use when the policy will be modified for use in a specific transaction.
+ */
+ public final BatchPolicy copyBatchParentPolicyWriteDefault() {
+ return new BatchPolicy(batchParentPolicyWriteDefault);
+ }
+
+ /**
+ * Return batch detail write policy default. Use when the policy will not be modified.
+ */
public final BatchWritePolicy getBatchWritePolicyDefault() {
return batchWritePolicyDefault;
}
+ /**
+ * Copy batch detail write policy default. Use when the policy will be modified for use in a specific transaction.
+ */
+ public final BatchWritePolicy copyBatchWritePolicyDefault() {
+ return new BatchWritePolicy(batchWritePolicyDefault);
+ }
+
+ /**
+ * Return batch detail delete policy default. Use when the policy will not be modified.
+ */
public final BatchDeletePolicy getBatchDeletePolicyDefault() {
return batchDeletePolicyDefault;
}
+ /**
+ * Copy batch detail delete policy default. Use when the policy will be modified for use in a specific transaction.
+ */
+ public final BatchDeletePolicy copyBatchDeletePolicyDefault() {
+ return new BatchDeletePolicy(batchDeletePolicyDefault);
+ }
+
+ /**
+ * Return batch detail UDF policy default. Use when the policy will not be modified.
+ */
public final BatchUDFPolicy getBatchUDFPolicyDefault() {
return batchUDFPolicyDefault;
}
+ /**
+ * Copy batch detail UDF policy default. Use when the policy will be modified for use in a specific transaction.
+ */
+ public final BatchUDFPolicy copyBatchUDFPolicyDefault() {
+ return new BatchUDFPolicy(batchUDFPolicyDefault);
+ }
+
+ /**
+ * Return info command policy default. Use when the policy will not be modified.
+ */
public final InfoPolicy getInfoPolicyDefault() {
return infoPolicyDefault;
}
+ /**
+ * Copy info command policy default. Use when the policy will be modified for use in a specific transaction.
+ */
+ public final InfoPolicy copyInfoPolicyDefault() {
+ return new InfoPolicy(infoPolicyDefault);
+ }
+
//-------------------------------------------------------
// Client Management
//-------------------------------------------------------
@@ -1235,7 +1335,9 @@ public void get(EventLoop eventLoop, RecordArrayListener listener, BatchPolicy p
policy = batchPolicyDefault;
}
- CommandProxy command = new BatchProxy.GetArrayCommand(executor, policy, listener, keys, binNames, null, Command.INFO1_READ, false);
+ int readAttr = (binNames == null || binNames.length == 0)? Command.INFO1_READ | Command.INFO1_GET_ALL : Command.INFO1_READ;
+
+ CommandProxy command = new BatchProxy.GetArrayCommand(executor, policy, listener, keys, binNames, null, readAttr, false);
command.execute();
}
@@ -1263,7 +1365,9 @@ public void get(EventLoop eventLoop, RecordSequenceListener listener, BatchPolic
policy = batchPolicyDefault;
}
- CommandProxy command = new BatchProxy.GetSequenceCommand(executor, policy, listener, keys, binNames, null, Command.INFO1_READ, false);
+ int readAttr = (binNames == null || binNames.length == 0)? Command.INFO1_READ | Command.INFO1_GET_ALL : Command.INFO1_READ;
+
+ CommandProxy command = new BatchProxy.GetSequenceCommand(executor, policy, listener, keys, binNames, null, readAttr, false);
command.execute();
}
@@ -1521,7 +1625,7 @@ public void operate(
policy = batchParentPolicyWriteDefault;
}
- CommandProxy command = new BatchProxy.OperateListCommand(executor, policy, listener, records);
+ CommandProxy command = new BatchProxy.OperateListCommand(this, executor, policy, listener, records);
command.execute();
}
@@ -1556,7 +1660,7 @@ public void operate(
policy = batchParentPolicyWriteDefault;
}
- CommandProxy command = new BatchProxy.OperateSequenceCommand(executor, policy, listener, records);
+ CommandProxy command = new BatchProxy.OperateSequenceCommand(this, executor, policy, listener, records);
command.execute();
}
diff --git a/proxy/src/com/aerospike/client/proxy/BatchProxy.java b/proxy/src/com/aerospike/client/proxy/BatchProxy.java
index cef64b9da..c4ce06f8d 100644
--- a/proxy/src/com/aerospike/client/proxy/BatchProxy.java
+++ b/proxy/src/com/aerospike/client/proxy/BatchProxy.java
@@ -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 WHICH ARE COMPATIBLE WITH THE APACHE LICENSE, VERSION 2.0.
@@ -75,7 +75,7 @@ public ReadListCommandSync(
@Override
void writeCommand(Command command) {
BatchRecordIterProxy iter = new BatchRecordIterProxy(records);
- command.setBatchOperate(batchPolicy, iter);
+ command.setBatchOperate(batchPolicy, null, null, null, iter);
}
@Override
@@ -120,7 +120,7 @@ public ReadListCommand(
@Override
void writeCommand(Command command) {
BatchRecordIterProxy iter = new BatchRecordIterProxy(records);
- command.setBatchOperate(batchPolicy, iter);
+ command.setBatchOperate(batchPolicy, null, null, null, iter);
}
@Override
@@ -164,7 +164,7 @@ public ReadSequenceCommand(
@Override
void writeCommand(Command command) {
BatchRecordIterProxy iter = new BatchRecordIterProxy(records);
- command.setBatchOperate(batchPolicy, iter);
+ command.setBatchOperate(batchPolicy, null, null, null, iter);
}
@Override
@@ -417,17 +417,20 @@ void onFailure(AerospikeException ae) {
//-------------------------------------------------------
public static final class OperateListCommand extends BaseCommand {
+ private final AerospikeClientProxy client;
private final BatchOperateListListener listener;
private final List records;
private boolean status;
public OperateListCommand(
+ AerospikeClientProxy client,
GrpcCallExecutor executor,
BatchPolicy batchPolicy,
BatchOperateListListener listener,
List records
) {
super(executor, batchPolicy, true, records.size());
+ this.client = client;
this.listener = listener;
this.records = records;
this.status = true;
@@ -436,7 +439,8 @@ public OperateListCommand(
@Override
void writeCommand(Command command) {
BatchRecordIterProxy iter = new BatchRecordIterProxy(records);
- command.setBatchOperate(batchPolicy, iter);
+ command.setBatchOperate(batchPolicy, client.batchWritePolicyDefault, client.batchUDFPolicyDefault,
+ client.batchDeletePolicyDefault, iter);
}
@Override
@@ -485,16 +489,19 @@ void onFailure(AerospikeException ae) {
}
public static final class OperateSequenceCommand extends BaseCommand {
+ private final AerospikeClientProxy client;
private final BatchRecordSequenceListener listener;
private final List records;
public OperateSequenceCommand(
+ AerospikeClientProxy client,
GrpcCallExecutor executor,
BatchPolicy batchPolicy,
BatchRecordSequenceListener listener,
List records
) {
super(executor, batchPolicy, true, records.size());
+ this.client = client;
this.listener = listener;
this.records = records;
}
@@ -502,7 +509,8 @@ public OperateSequenceCommand(
@Override
void writeCommand(Command command) {
BatchRecordIterProxy iter = new BatchRecordIterProxy(records);
- command.setBatchOperate(batchPolicy, iter);
+ command.setBatchOperate(batchPolicy, client.batchWritePolicyDefault, client.batchUDFPolicyDefault,
+ client.batchDeletePolicyDefault, iter);
}
@Override
diff --git a/proxy/src/com/aerospike/client/proxy/RecordSequenceRecordSet.java b/proxy/src/com/aerospike/client/proxy/RecordSequenceRecordSet.java
index 0da743a84..b782cb447 100644
--- a/proxy/src/com/aerospike/client/proxy/RecordSequenceRecordSet.java
+++ b/proxy/src/com/aerospike/client/proxy/RecordSequenceRecordSet.java
@@ -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 WHICH ARE COMPATIBLE WITH THE APACHE LICENSE, VERSION 2.0.
@@ -34,7 +34,7 @@ public class RecordSequenceRecordSet extends RecordSet implements RecordSequence
private final long taskId;
private volatile boolean valid = true;
private final BlockingQueue queue;
- private volatile KeyRecord record;
+ protected volatile KeyRecord record;
private volatile AerospikeException exception;
public RecordSequenceRecordSet(long taskId, int capacity) {
@@ -114,6 +114,11 @@ public Key getKey() {
return record.key;
}
+ @Override
+ public KeyRecord getKeyRecord() {
+ return record;
+ }
+
@Override
public void onRecord(Key key, Record record) throws AerospikeException {
if (!valid) {
diff --git a/proxy/src/com/aerospike/client/proxy/grpc/GrpcConversions.java b/proxy/src/com/aerospike/client/proxy/grpc/GrpcConversions.java
index 3e7019139..33c7fa1c3 100644
--- a/proxy/src/com/aerospike/client/proxy/grpc/GrpcConversions.java
+++ b/proxy/src/com/aerospike/client/proxy/grpc/GrpcConversions.java
@@ -106,6 +106,7 @@ public static Kvs.ScanPolicy toGrpc(ScanPolicy scanPolicy) {
return scanPolicyBuilder.build();
}
+ @SuppressWarnings("deprecation")
public static Kvs.QueryPolicy toGrpc(QueryPolicy queryPolicy) {
// Base policy fields.
Kvs.QueryPolicy.Builder queryPolicyBuilder = Kvs.QueryPolicy.newBuilder();
diff --git a/test/pom.xml b/test/pom.xml
index c0c8878b0..48de52c7b 100644
--- a/test/pom.xml
+++ b/test/pom.xml
@@ -6,7 +6,7 @@
com.aerospike
aerospike-parent
- 8.1.0
+ 8.1.2
aerospike-client-test
jar
diff --git a/test/src/com/aerospike/test/sync/basic/TestBatch.java b/test/src/com/aerospike/test/sync/basic/TestBatch.java
index 90afd5765..82b7083ed 100644
--- a/test/src/com/aerospike/test/sync/basic/TestBatch.java
+++ b/test/src/com/aerospike/test/sync/basic/TestBatch.java
@@ -144,6 +144,30 @@ public void batchReads () {
}
}
+ @Test
+ public void batchReadsEmptyBinNames() {
+ Key[] keys = new Key[Size];
+ for (int i = 0; i < Size; i++) {
+ keys[i] = new Key(args.namespace, args.set, KeyPrefix + (i + 1));
+ }
+
+ String[] binNames = new String[] {};
+ Record[] records = client.get(null, keys, binNames);
+ assertEquals(Size, records.length);
+
+ for (int i = 0; i < records.length; i++) {
+ Key key = keys[i];
+ Record record = records[i];
+
+ if (i != 5) {
+ assertBinEqual(key, record, BinName, ValuePrefix + (i + 1));
+ }
+ else {
+ assertBinEqual(key, record, BinName, i + 1);
+ }
+ }
+ }
+
@Test
public void batchReadHeaders () {
Key[] keys = new Key[Size];
@@ -168,7 +192,7 @@ public void batchReadHeaders () {
}
@Test
- public void batchReadComplex () {
+ public void batchReadComplex() {
// Batch allows multiple namespaces in one call, but example test environment may only have one namespace.
// bin * 8
@@ -179,7 +203,7 @@ public void batchReadComplex () {
List records = new ArrayList();
records.add(new BatchRead(new Key(args.namespace, args.set, KeyPrefix + 1), bins));
records.add(new BatchRead(new Key(args.namespace, args.set, KeyPrefix + 2), true));
- records.add(new BatchRead(new Key(args.namespace, args.set, KeyPrefix + 3), true));
+ records.add(new BatchRead(new Key(args.namespace, args.set, KeyPrefix + 3), new String[] {}));
records.add(new BatchRead(new Key(args.namespace, args.set, KeyPrefix + 4), false));
records.add(new BatchRead(new Key(args.namespace, args.set, KeyPrefix + 5), true));
records.add(new BatchRead(new Key(args.namespace, args.set, KeyPrefix + 6), ops));
diff --git a/test/src/com/aerospike/test/sync/basic/TestPutGet.java b/test/src/com/aerospike/test/sync/basic/TestPutGet.java
index e2f99cd42..58830abee 100644
--- a/test/src/com/aerospike/test/sync/basic/TestPutGet.java
+++ b/test/src/com/aerospike/test/sync/basic/TestPutGet.java
@@ -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 WHICH ARE COMPATIBLE WITH THE APACHE LICENSE, VERSION 2.0.
@@ -41,6 +41,11 @@ public void putGet() {
Record record = client.get(null, key);
assertBinEqual(key, record, bin1);
assertBinEqual(key, record, bin2);
+
+ // Test empty binNames array.
+ record = client.get(null, key, new String[] {});
+ assertBinEqual(key, record, bin1);
+ assertBinEqual(key, record, bin2);
}
@Test
diff --git a/test/src/com/aerospike/test/sync/basic/TestScan.java b/test/src/com/aerospike/test/sync/basic/TestScan.java
index d0b3e1762..c6a29289f 100644
--- a/test/src/com/aerospike/test/sync/basic/TestScan.java
+++ b/test/src/com/aerospike/test/sync/basic/TestScan.java
@@ -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 WHICH ARE COMPATIBLE WITH THE APACHE LICENSE, VERSION 2.0.
@@ -35,6 +35,10 @@ public class TestScan extends TestSync implements ScanCallback {
public void scanParallel() {
ScanPolicy policy = new ScanPolicy();
client.scanAll(policy, args.namespace, args.set, this);
+
+ // Test empty binNames.
+ String[] binNames = new String[] {};
+ client.scanAll(policy, args.namespace, args.set, this, binNames);
}
@Test
diff --git a/test/src/com/aerospike/test/sync/basic/TestServerInfo.java b/test/src/com/aerospike/test/sync/basic/TestServerInfo.java
index f3f52424a..2d39bf2bf 100644
--- a/test/src/com/aerospike/test/sync/basic/TestServerInfo.java
+++ b/test/src/com/aerospike/test/sync/basic/TestServerInfo.java
@@ -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 WHICH ARE COMPATIBLE WITH THE APACHE LICENSE, VERSION 2.0.
@@ -17,9 +17,11 @@
package com.aerospike.test.sync.basic;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertEquals;
import java.util.Map;
+import com.aerospike.client.ResultCode;
import org.junit.Test;
import com.aerospike.client.Info;
@@ -76,4 +78,33 @@ private void LogNameValueTokens(String tokens) {
assertNotNull(value);
}
}
+
+ @Test
+ public void errorResponse() {
+ Info.Error error;
+
+ error = new Info.Error("FaIL:201:index not found");
+ assertEquals(error.code, 201);
+ assertEquals(error.message, "index not found");
+
+ error = new Info.Error("ERRor:201:index not found");
+ assertEquals(error.code, 201);
+ assertEquals(error.message, "index not found");
+
+ error = new Info.Error("error::index not found ");
+ assertEquals(error.code, ResultCode.CLIENT_ERROR);
+ assertEquals(error.message, "index not found");
+
+ error = new Info.Error("error: index not found ");
+ assertEquals(error.code, ResultCode.CLIENT_ERROR);
+ assertEquals(error.message, "index not found");
+
+ error = new Info.Error("error:99");
+ assertEquals(error.code, 99);
+ assertEquals(error.message, "error:99");
+
+ error = new Info.Error("generic message");
+ assertEquals(error.code, ResultCode.CLIENT_ERROR);
+ assertEquals(error.message, "generic message");
+ }
}
diff --git a/test/src/com/aerospike/test/sync/query/TestIndex.java b/test/src/com/aerospike/test/sync/query/TestIndex.java
index 404dc484c..ca97c54ba 100644
--- a/test/src/com/aerospike/test/sync/query/TestIndex.java
+++ b/test/src/com/aerospike/test/sync/query/TestIndex.java
@@ -26,7 +26,6 @@
import com.aerospike.client.Value;
import com.aerospike.client.cdt.CTX;
import com.aerospike.client.cluster.Node;
-import com.aerospike.client.policy.Policy;
import com.aerospike.client.query.IndexType;
import com.aerospike.client.task.IndexTask;
import com.aerospike.test.sync.TestSync;
@@ -62,7 +61,9 @@ public void createDrop() {
for (Node node : nodes) {
String response = Info.request(node, cmd);
- assertEquals(response, "FAIL:201:no-index");
+ int code = Info.parseResultCode(response);
+
+ assertEquals(code, 201);
}
}
diff --git a/test/src/com/aerospike/test/sync/query/TestQueryString.java b/test/src/com/aerospike/test/sync/query/TestQueryString.java
index 92a2ea96a..8ef779f0c 100644
--- a/test/src/com/aerospike/test/sync/query/TestQueryString.java
+++ b/test/src/com/aerospike/test/sync/query/TestQueryString.java
@@ -95,4 +95,33 @@ public void queryString() {
rs.close();
}
}
+
+ @Test
+ public void queryStringEmptyBinName() {
+ String filter = valuePrefix + 3;
+
+ Statement stmt = new Statement();
+ stmt.setNamespace(args.namespace);
+ stmt.setSetName(args.set);
+ stmt.setBinNames(new String[] {});
+ stmt.setFilter(Filter.equal(binName, filter));
+
+ RecordSet rs = client.query(null, stmt);
+
+ try {
+ int count = 0;
+
+ while (rs.next()) {
+ Record record = rs.getRecord();
+ String result = record.getString(binName);
+ assertEquals(filter, result);
+ count++;
+ }
+
+ assertNotEquals(0, count);
+ }
+ finally {
+ rs.close();
+ }
+ }
}