Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
435b362
feat: remove redundant value_byte_size parameter for bit_set, bit_and…
juliannguyen4 Sep 9, 2026
e8f8222
docs: address doctest error due to api breaking change
juliannguyen4 Sep 9, 2026
31eaa67
test: remove failing deprecation warning tests now that the deprecati…
juliannguyen4 Sep 9, 2026
9f01fdc
Merge remote-tracking branch 'origin/v20' into CLIENT-3947-rm-meta-tt…
juliannguyen4 Sep 9, 2026
778b6cf
feat: raise ParamError instead of DeprecationWarning when invalid map…
juliannguyen4 Sep 10, 2026
8700dcb
fix: address compiler errors by removing old warning handling code
juliannguyen4 Sep 10, 2026
9f9e25d
feat: WIP on removing meta ttl support for commands that can pass the…
juliannguyen4 Sep 10, 2026
09449e7
Merge branch 'CLIENT-4631-raise-exception-if-invalid-map-keys-are-use…
juliannguyen4 Sep 10, 2026
3e909ec
test: expect an exception instead of warning
juliannguyen4 Sep 10, 2026
5d14f14
Merge branch 'CLIENT-4631-raise-exception-if-invalid-map-keys-are-use…
juliannguyen4 Sep 10, 2026
a9628ab
fix: compiler error
juliannguyen4 Sep 10, 2026
8c8edeb
docs: update meta parameter docstrings for all affected methods that …
juliannguyen4 Sep 10, 2026
aee2df5
fix: have validate_keys fail if ttl string is passed to a meta parameter
juliannguyen4 Sep 10, 2026
fef7914
Merge remote-tracking branch 'origin/v20' into CLIENT-3947-rm-meta-tt…
juliannguyen4 Sep 10, 2026
7012db1
docs: address api doc code example runtime error
juliannguyen4 Sep 10, 2026
bfbf94b
chore: update client.remove() stub
juliannguyen4 Sep 10, 2026
5f00076
docs: address SystemError by having example code use single quotes, n…
juliannguyen4 Sep 10, 2026
b1759f1
fix: address SystemError raised in client.remove()
juliannguyen4 Sep 10, 2026
5a7d6e2
feat: remove client.index_cdt_create() in favor of the other index cr…
juliannguyen4 Sep 10, 2026
41f8130
Merge remote-tracking branch 'origin/CLIENT-2468-rm-deprecated-index-…
juliannguyen4 Sep 10, 2026
b8b110e
docs: address bad description for client.touch()'s meta parameter. re…
juliannguyen4 Sep 10, 2026
fdcb27b
test: address a few test regressions. TODO - still need to fix remain…
juliannguyen4 Sep 10, 2026
233510f
Merge remote-tracking branch 'origin/v20' into CLIENT-3947-rm-meta-tt…
juliannguyen4 Sep 11, 2026
df35ec9
fix: client not applying policy ttl by default
juliannguyen4 Sep 11, 2026
a1fba28
Revert "fix: client not applying policy ttl by default"
juliannguyen4 Sep 11, 2026
ee0eb69
fix: use cursor to fix all places where as_operations/as_record.ttl n…
juliannguyen4 Sep 11, 2026
62b69b8
test: uncomment test case where BatchRecord Write's batch_write polic…
juliannguyen4 Sep 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion aerospike-stubs/aerospike.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ class Client:
def put(self, key: tuple, bins: dict, meta: dict = ..., policy: dict = ..., serializer = ...) -> None: ...
def query(self, namespace: str, set: Optional[str] = None) -> Query: ...
def query_apply(self, ns: str, set: str, predicate: tuple, module: str, function: str, args: list = ..., policy: dict = ...) -> int: ...
def remove(self, key: tuple, meta: dict = ..., policy: dict = ...) -> None: ...
def remove(self, key: tuple, policy: dict = ...) -> None: ...
def remove_bin(self, key: tuple, list: list, meta: dict = ..., policy: dict = ...) -> None: ...
def scan(self, namespace: str, set: Optional[str] = None) -> Scan: ...
def scan_apply(self, ns: str, set: str, module: str, function: str, args: list = ..., policy: dict = ..., options: dict = ...) -> int: ...
Expand Down
9 changes: 2 additions & 7 deletions aerospike_helpers/batch/records.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ def __init__(self, key: tuple) -> None:
class Write(BatchRecord):
""" Write is used for executing Batch write commands with batch_write and retrieving batch write results.

.. include:: ./deprecate_meta_ttl.rst

Attributes:
key (:obj:`tuple`): The aerospike key to send the command to.
record (:obj:`tuple`): The record corresponding to the requested key.
Expand All @@ -76,7 +74,7 @@ class Write(BatchRecord):
to the server.
ops (:ref:`aerospike_operation_helpers.operations`): A list of aerospike operation dictionaries to perform
on the record at key.
meta (dict): the metadata to set for this command
meta (dict): the expected generation for this record
policy (:ref:`aerospike_batch_write_policies`, optional): An optional dictionary of batch write policy
flags.
"""
Expand Down Expand Up @@ -120,9 +118,6 @@ def __init__(
class Read(BatchRecord):
""" Read is used for executing Batch read commands with batch_write and retrieving results.

.. deprecated:: 19.1.0 Deprecated the ``"ttl"`` option in the ``meta`` parameter. Use the policy parameter in a
:py:obj:`~aerospike_helpers.batch.records.Write` BatchRecord to set the ``"ttl"`` instead.

Attributes:
key (:obj:`tuple`): The aerospike key to send the command to.
record (:obj:`tuple`): The record corresponding to the requested key.
Expand All @@ -132,7 +127,7 @@ class Read(BatchRecord):
to the server.
ops (:ref:`aerospike_operation_helpers.operations`): list of aerospike operation dictionaries to perform on
the record at key.
meta (dict): the metadata to set for this command
meta (dict): the expected generation for this record
read_all_bins (:obj:`bool`, optional): An optional bool, if True, read all bins in the record.
policy (:ref:`aerospike_batch_read_policies`, optional): An optional dictionary of batch read policy flags.
"""
Expand Down
48 changes: 13 additions & 35 deletions doc/client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,9 @@ Record Commands

Create a new record, or remove / add bins to a record.

.. include:: ./deprecate_meta_ttl.rst

:param tuple key: a :ref:`aerospike_key_tuple` associated with the record.
:param dict bins: contains bin name-value pairs of the record.
:param dict meta: record metadata to be set. see :ref:`metadata_dict`.
:param dict meta: record generation to compare. see :ref:`metadata_dict`.
:param dict policy: see :ref:`aerospike_write_policies`.

:param serializer: override the serialization mode of the client \
Expand Down Expand Up @@ -317,11 +315,9 @@ Record Commands
(In Aerospike server versions prior to 3.6.0, non-existent bins being read will have a \
:py:obj:`None` value. )

.. include:: ./deprecate_meta_ttl.rst

:param tuple key: a :ref:`aerospike_key_tuple` associated with the record.
:param list list: See :ref:`aerospike_operation_helpers.operations`.
:param dict meta: record metadata to be set. See :ref:`metadata_dict`.
:param dict meta: record generation to compare. See :ref:`metadata_dict`.
:param dict policy: optional :ref:`aerospike_operate_policies`.
:return: a :ref:`aerospike_record_tuple`.
:raises: a subclass of :exc:`~aerospike.exception.AerospikeError`.
Expand Down Expand Up @@ -372,11 +368,9 @@ Record Commands

Write operations or read operations that fail will not return a ``(bin-name, result)`` tuple.

.. include:: ./deprecate_meta_ttl.rst

:param tuple key: a :ref:`aerospike_key_tuple` associated with the record.
:param list list: See :ref:`aerospike_operation_helpers.operations`.
:param dict meta: record metadata to be set. See :ref:`metadata_dict`.
:param dict meta: record generation to compare. See :ref:`metadata_dict`.
:param dict policy: optional :ref:`aerospike_operate_policies`.

:return: a :ref:`aerospike_record_tuple`.
Expand Down Expand Up @@ -414,13 +408,9 @@ Record Commands

Touch the given record, setting its time-to-live and incrementing its generation.

.. versionchanged:: 19.1.0

Deprecated the ``meta["ttl"]`` parameter. Use the ``val`` parameter instead.

:param tuple key: a :ref:`aerospike_key_tuple` associated with the record.
:param int val: ttl in seconds, with ``0`` resolving to the default value in the server config.
:param dict meta: record metadata to be set. see :ref:`metadata_dict`
:param dict meta: record generation to compare. see :ref:`metadata_dict`
:param dict policy: see :ref:`aerospike_operate_policies`.

:raises: a subclass of :exc:`~aerospike.exception.AerospikeError`.
Expand All @@ -446,16 +436,11 @@ Record Commands
{'ttl': 2592000, 'gen': 1}
{'ttl': 120, 'gen': 2}

.. method:: remove(key[meta: dict[, policy: dict]])
.. method:: remove(key[, policy: dict])

Remove a record matching the *key* from the cluster.

.. versionchanged:: 19.1.0

Deprecated the ``meta`` parameter. Use the policy parameter to set ``gen`` instead.

:param tuple key: a :ref:`aerospike_key_tuple` associated with the record.
:param dict meta: contains the expected generation of the record in a key called ``"gen"``.
:param dict policy: see :ref:`aerospike_remove_policies`. May be passed as a keyword argument.

:raises: a subclass of :exc:`~aerospike.exception.AerospikeError`.
Expand All @@ -468,7 +453,7 @@ Record Commands

# Try to remove it with the wrong generation
try:
client.remove(keyTuple, meta={'gen': 5}, policy={'gen': aerospike.POLICY_GEN_EQ})
client.remove(keyTuple, policy={'gen': aerospike.POLICY_GEN_EQ, 'generation': 5})
except ex.AerospikeError as e:
print("Error: {0} [{1}]".format(e.msg, e.code))

Expand All @@ -484,11 +469,9 @@ Record Commands
Remove a list of bins from a record with a given *key*. Equivalent to \
setting those bins to :meth:`aerospike.null` with a :meth:`~aerospike.Client.put`.

.. include:: ./deprecate_meta_ttl.rst

:param tuple key: a :ref:`aerospike_key_tuple` associated with the record.
:param list list: the bins names to be removed from the record.
:param dict meta: record metadata to be set. See :ref:`metadata_dict`.
:param dict meta: record generation to compare. See :ref:`metadata_dict`.
:param dict policy: optional :ref:`aerospike_write_policies`.

:raises: a subclass of :exc:`~aerospike.exception.AerospikeError`.
Expand Down Expand Up @@ -817,12 +800,10 @@ String Operations

Append a string to the string value in bin.

.. include:: ./deprecate_meta_ttl.rst

:param tuple key: a :ref:`aerospike_key_tuple` tuple associated with the record.
:param str bin: the name of the bin.
:param str val: the string to append to the bin value.
:param dict meta: record metadata to be set. See :ref:`metadata_dict`.
:param dict meta: record generation to compare. See :ref:`metadata_dict`.
:param dict policy: optional :ref:`aerospike_operate_policies`.

:raises: a subclass of :exc:`~aerospike.exception.AerospikeError`.
Expand All @@ -844,12 +825,10 @@ String Operations

Prepend the string value in *bin* with the string *val*.

.. include:: ./deprecate_meta_ttl.rst

:param tuple key: a :ref:`aerospike_key_tuple` tuple associated with the record.
:param str bin: the name of the bin.
:param str val: the string to prepend to the bin value.
:param dict meta: record metadata to be set. See :ref:`metadata_dict`.
:param dict meta: record generation to compare. See :ref:`metadata_dict`.
:param dict policy: optional :ref:`aerospike_operate_policies`.

:raises: a subclass of :exc:`~aerospike.exception.AerospikeError`.
Expand Down Expand Up @@ -880,13 +859,11 @@ Numeric Operations

Increment the integer value in *bin* by the integer *val*.

.. include:: ./deprecate_meta_ttl.rst

:param tuple key: a :ref:`aerospike_key_tuple` tuple associated with the record.
:param str bin: the name of the bin.
:param int offset: the value by which to increment the value in *bin*.
:type offset: :py:class:`int` or :py:class:`float`
:param dict meta: record metadata to be set. See :ref:`metadata_dict`.
:param dict meta: record generation to compare. See :ref:`metadata_dict`.
:param dict policy: optional :ref:`aerospike_operate_policies`. Note: the ``exists`` policy option may not be: :py:data:`aerospike.POLICY_EXISTS_CREATE_OR_REPLACE` nor :py:data:`aerospike.POLICY_EXISTS_REPLACE`
:raises: a subclass of :exc:`~aerospike.exception.AerospikeError`.

Expand Down Expand Up @@ -2014,8 +1991,9 @@ Metadata Dictionary

The metadata dictionary has the following key-value pairs:

* ``"ttl"`` (:class:`int`): record time to live in seconds. See :ref:`TTL_CONSTANTS` for possible special values.
* ``"gen"`` (:class:`int`): record generation
* ``"ttl"`` (:class:`int`): record time to live in seconds. This field is read only.
* ``"gen"`` (:class:`int`): record generation. If passing as input, this is the expected record generation.
If returned as an output, this is the current record generation.

.. _aerospike_policies:

Expand Down
3 changes: 0 additions & 3 deletions doc/deprecate_meta_ttl.rst

This file was deleted.

2 changes: 1 addition & 1 deletion src/include/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ PyObject *AerospikeClient_Remove(AerospikeClient *self, PyObject *args,
PyObject *kwds);

PyObject *AerospikeClient_Remove_Invoke(AerospikeClient *self, PyObject *py_key,
PyObject *py_meta, PyObject *py_policy);
PyObject *py_policy);

/**
* Remove bin from the database.
Expand Down
9 changes: 4 additions & 5 deletions src/include/conversions.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,10 @@ void initialize_bin_for_strictypes(AerospikeClient *self, as_error *err,
PyObject *py_value, as_binop *binop,
char *bin, as_static_pool *static_pool);

// Both as_operations and as_record have ttl and gen fields,
// so we have ttl and gen as separate parameters instead of accepting either as_operations or as_record
as_status check_and_set_meta(PyObject *py_meta, uint32_t *ttl_ref,
uint16_t *gen_ref, as_error *err,
bool validate_keys);
// Both as_operations and as_record have gen fields,
// so we have gen as a separate parameter instead of accepting either as_operations or as_record
as_status check_and_set_meta(PyObject *py_meta, uint16_t *gen_ref,
as_error *err, bool validate_keys);

as_status string_and_pyuni_from_pystring(PyObject *py_string,
PyObject **pyuni_r, char **c_str_ptr,
Expand Down
2 changes: 1 addition & 1 deletion src/main/aerospike.c
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,7 @@ DEFINE_SET_OF_VALID_KEYS(hll_policy, "flags", NULL)

DEFINE_SET_OF_VALID_KEYS(admin_policy, "timeout", NULL)

DEFINE_SET_OF_VALID_KEYS(record_metadata, "gen", "ttl", NULL)
DEFINE_SET_OF_VALID_KEYS(record_metadata, "gen", NULL)

// Use a struct to create pairs of pyobjects and list of strings defined above
// When we initialize the module, we create sets for the valid keys that the client can use later
Expand Down
4 changes: 3 additions & 1 deletion src/main/client/batch_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,10 @@ static PyObject *AerospikeClient_BatchWriteInvoke(AerospikeClient *self,

ops = as_operations_new(py_ops_size);
garb->ops_to_free = ops;
// as_operations_new defaults ttl to 0 (namespace default). Use the batch write policy ttl instead.
ops->ttl = AS_RECORD_CLIENT_DEFAULT_TTL;

if (check_and_set_meta(py_meta, &ops->ttl, &ops->gen, err,
if (check_and_set_meta(py_meta, &ops->gen, err,
self->validate_keys) != AEROSPIKE_OK) {
goto CLEANUP_ON_ERROR;
}
Expand Down
12 changes: 8 additions & 4 deletions src/main/client/operate.c
Original file line number Diff line number Diff line change
Expand Up @@ -944,6 +944,8 @@ static PyObject *AerospikeClient_Operate_Invoke(AerospikeClient *self,
as_operations ops;
Py_ssize_t size = PyList_Size(py_list);
as_operations_inita(&ops, size);
// as_operations_inita defaults ttl to 0 (namespace default). Use the operate policy ttl instead.
ops.ttl = AS_RECORD_CLIENT_DEFAULT_TTL;

if (py_policy) {
if (pyobject_to_policy_operate(self, err, py_policy, &operate_policy,
Expand All @@ -958,8 +960,8 @@ static PyObject *AerospikeClient_Operate_Invoke(AerospikeClient *self,
memset(&static_pool, 0, sizeof(static_pool));
CHECK_CONNECTED(err);

if (check_and_set_meta(py_meta, &ops.ttl, &ops.gen, err,
self->validate_keys) != AEROSPIKE_OK) {
if (check_and_set_meta(py_meta, &ops.gen, err, self->validate_keys) !=
AEROSPIKE_OK) {
goto CLEANUP;
}

Expand Down Expand Up @@ -1109,6 +1111,8 @@ AerospikeClient_OperateOrdered_Invoke(AerospikeClient *self, as_error *err,
as_operations ops;
Py_ssize_t ops_list_size = PyList_Size(py_list);
as_operations_inita(&ops, ops_list_size);
// as_operations_inita defaults ttl to 0 (namespace default). Use the operate policy ttl instead.
ops.ttl = AS_RECORD_CLIENT_DEFAULT_TTL;

// For expressions conversion.
as_exp *exp_list_p = NULL;
Expand All @@ -1129,8 +1133,8 @@ AerospikeClient_OperateOrdered_Invoke(AerospikeClient *self, as_error *err,
}
}

if (check_and_set_meta(py_meta, &ops.ttl, &ops.gen, err,
self->validate_keys) != AEROSPIKE_OK) {
if (check_and_set_meta(py_meta, &ops.gen, err, self->validate_keys) !=
AEROSPIKE_OK) {
goto CLEANUP;
}

Expand Down
49 changes: 5 additions & 44 deletions src/main/client/remove.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
*******************************************************************************************************
*/
PyObject *AerospikeClient_Remove_Invoke(AerospikeClient *self, PyObject *py_key,
PyObject *py_meta, PyObject *py_policy)
PyObject *py_policy)
{

// Aerospike Client Arguments
Expand Down Expand Up @@ -86,33 +86,6 @@ PyObject *AerospikeClient_Remove_Invoke(AerospikeClient *self, PyObject *py_key,
if (err.code != AEROSPIKE_OK) {
goto CLEANUP;
}
else {
if (py_meta && PyDict_Check(py_meta)) {
PyObject *py_gen = PyDict_GetItemString(py_meta, "gen");

if (py_gen) {
if (PyLong_Check(py_gen)) {
remove_policy_p->generation =
(uint16_t)PyLong_AsLong(py_gen);
}
else if (PyLong_Check(py_gen)) {
remove_policy_p->generation =
(uint16_t)PyLong_AsLongLong(py_gen);
if ((uint16_t)-1 == remove_policy_p->generation &&
PyErr_Occurred()) {
as_error_update(
&err, AEROSPIKE_ERR_PARAM,
"integer value for gen exceeds sys.maxsize");
goto CLEANUP;
}
}
else {
as_error_update(&err, AEROSPIKE_ERR_PARAM,
"Generation should be an int or long");
}
}
}
}
}

// Invoke operation
Expand Down Expand Up @@ -158,28 +131,16 @@ PyObject *AerospikeClient_Remove(AerospikeClient *self, PyObject *args,
// Python Function Arguments
PyObject *py_key = NULL;
PyObject *py_policy = NULL;
PyObject *py_meta = NULL;

// Python Function Keyword Arguments
static char *kwlist[] = {"key", "meta", "policy", NULL};
static char *kwlist[] = {"key", "policy", NULL};

// Python Function Argument Parsing
if (PyArg_ParseTupleAndKeywords(args, kwds, "O|OO:remove", kwlist, &py_key,
&py_meta, &py_policy) == false) {
if (PyArg_ParseTupleAndKeywords(args, kwds, "O|O:remove", kwlist, &py_key,
&py_policy) == false) {
return NULL;
}

if (py_meta) {
int retval = PyErr_WarnEx(
PyExc_DeprecationWarning,
"meta parameter is deprecated and will be removed in the "
"next client major release",
STACK_LEVEL);
if (retval == -1) {
return NULL;
}
}

// Invoke Operation
return AerospikeClient_Remove_Invoke(self, py_key, py_meta, py_policy);
return AerospikeClient_Remove_Invoke(self, py_key, py_policy);
}
4 changes: 3 additions & 1 deletion src/main/client/remove_bin.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ AerospikeClient_RemoveBin_Invoke(AerospikeClient *self, PyObject *py_key,
Py_ssize_t size = PyList_Size(py_binList);
// Initialize record
as_record_inita(&rec, size);
// as_record_inita defaults ttl to 0 (namespace default). Use the write policy ttl instead.
rec.ttl = AS_RECORD_CLIENT_DEFAULT_TTL;

// Convert python key object to as_key
pyobject_to_key(err, py_key, &key);
Expand Down Expand Up @@ -142,7 +144,7 @@ AerospikeClient_RemoveBin_Invoke(AerospikeClient *self, PyObject *py_key,
}
}

check_and_set_meta(py_meta, &rec.ttl, &rec.gen, err, self->validate_keys);
check_and_set_meta(py_meta, &rec.gen, err, self->validate_keys);
if (err->code != AEROSPIKE_OK) {
goto CLEANUP;
}
Expand Down
Loading
Loading