python
from aerospike_helpers.expressions import base as expr
client.put(key, {"bin": [{"a": 1}]})
exp = expr.Eq(expr.ListBin("bin"), [{"a": 1}]).compile()
record = client.get(key, {"expressions": exp})
print(record[2])
{'bin': [{'a': 1}]}
This is now unsupported in server 6.3 because comparing unordered maps can potentially lead to inconsistent results. However, it is possible in server 6.3 to compare *key-ordered* maps in expressions.
Course of action:
For those using a server version < 6.3, no action is necessary. But it is recommended not to compare unordered maps in expressions.
For those upgrading to server 6.3, maps stored in the server must be key-ordered in order to be compared against in expressions. If the maps in the server are already key-ordered, and you would like to compare them in expressions, you must wrap any dictionaries in expressions with the KeyOrderedDict class.
For example, the code above must store the map as a key ordered map before comparing it in an expression:
python
from aerospike_helpers.expressions import base as expr
from aerospike import KeyOrderedDict
client.put(key, {"bin": [KeyOrderedDict({"a": 1})]})
exp = expr.Eq(expr.ListBin("bin"), [KeyOrderedDict({"a": 1})]).compile()
record = client.get(key, {"expressions": exp})
print(record[2])
{'bin': [{'a': 1}]}
Return AEROSPIKE_ERR_NAMESPACE_NOT_FOUND instead of AEROSPIKE_ERR_CLIENT when a namespace cannot be found
Course of action:
Change code such as this:
python
from aerospike import exception as exc
key = ("nonexistent_namespace", "demo", 1)
try:
client.get(key)
except exc.ClientError:
print("Incorrect namespace")
...to this instead:
python
from aerospike import exception as exc
key = ("nonexistent_namespace", "demo", 1)
try:
client.get(key)
except exc.NamespaceNotFound:
print("Incorrect namespace")
Return last error code received when scan/query maxRetries is exceeded
When running a query or scan, if max_retries is exceeded, the transaction will return the last suberror that was received instead of a MaxRetriesExceeded error. For example, if you try to run a query on a non-indexed bin, the client will return an IndexNotFound error from the last attempt to query the bin.
This code will no longer work:
python
query = client.query("test", "demo")
query.select("bin_without_index")
query.where(p.equals("bin_without_index", 1))
def callback(input_tuple):
pass
try:
query.foreach(callback)
except exc.MaxRetriesExceeded:
print("Query failed")
Course of action:
When handling a MaxRetriesExceeded exception, change it to the exact error that is expected to get thrown during the last query attempt. In this case, it is an IndexNotFound error:
python
try:
query.foreach(callback)
except exc.IndexNotFound:
print("Query failed")
New Features
* [CLIENT-2176] Map operations: add support for MAP_ORDERED and MAP_UNORDERED return types.
* [CLIENT-2144] Expressions: add support for comparing KeyOrderedDicts.
* [CLIENT-2158] Add base64 API functions to aerospike module.
Improvements
* [CLIENT-701] Batch methods: stop accepting a tuple of keys and bins.
* [CLIENT-2197] Return AEROSPIKE_ERR_NAMESPACE_NOT_FOUND instead of AEROSPIKE_ERR_CLIENT when a namespace cannot be found.
* [CLIENT-2143] Return last error code received when scan/query maxRetries is exceeded.
* [CLIENT-2192] Add support for RHEL 9.
Bug Fixes
* [CLIENT-1749] Documentation: add missing map return type MAP_RETURN_EXISTS.