Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
0cc611b
Fix command-level write, operate, batch_write, and scan policies not …
juliannguyen4 Aug 27, 2025
7eaaa1f
Deprecate meta parameter in client.put()
juliannguyen4 Aug 27, 2025
521e215
fix?
juliannguyen4 Aug 27, 2025
915678e
fix?
juliannguyen4 Aug 27, 2025
48453a9
fix?
juliannguyen4 Aug 27, 2025
0e2032c
fix client.remove_bin() not applying policy's ttl if meta.ttl is set …
juliannguyen4 Aug 27, 2025
138358f
dont init as_record twice
juliannguyen4 Aug 27, 2025
1b0c36f
put() is also initializing as_record twice
juliannguyen4 Aug 27, 2025
5062f5c
hard to deprecate function params. just add a note in function
juliannguyen4 Aug 27, 2025
1ca626e
fix mem leak if bins dictionary is invalid
juliannguyen4 Aug 27, 2025
35ca640
Merge remote-tracking branch 'origin/dev' into CLIENT-3664-fix-write-…
juliannguyen4 Aug 28, 2025
33907e1
revert
juliannguyen4 Aug 28, 2025
a291e1a
Merge remote-tracking branch 'origin/dev' into CLIENT-3664-fix-write-…
juliannguyen4 Sep 3, 2025
5c05df4
Merge remote-tracking branch 'origin/dev' into CLIENT-3664-fix-write-…
juliannguyen4 Oct 7, 2025
cb7a07e
Merge remote-tracking branch 'origin/dev' into CLIENT-3664-fix-write-…
juliannguyen4 Nov 3, 2025
9422ad2
Replace deprecation docstring with multiline var
juliannguyen4 Nov 4, 2025
add81e6
fix
juliannguyen4 Nov 4, 2025
fd3db45
Merge remote-tracking branch 'origin/dev' into CLIENT-3664-fix-write-…
juliannguyen4 Nov 11, 2025
92325bf
Merge remote-tracking branch 'origin/dev' into CLIENT-3664-fix-write-…
juliannguyen4 Dec 2, 2025
177c19c
Merge remote-tracking branch 'origin/dev' into CLIENT-3664-fix-write-…
juliannguyen4 Dec 5, 2025
826a914
WIP
juliannguyen4 Dec 5, 2025
b4809d7
Revert
juliannguyen4 Dec 5, 2025
e02c60c
Doc
juliannguyen4 Dec 5, 2025
fa973ae
test and see if deprecation shows up properly for aerospike_helpers.
juliannguyen4 Dec 5, 2025
4f649fe
Make more accurate for other commands that don't take in a write policy
juliannguyen4 Dec 5, 2025
d34d940
Finish updating aerospike_helpers
juliannguyen4 Dec 5, 2025
e52682d
Use macro
juliannguyen4 Dec 5, 2025
a88f237
This test will not fail if an invalid key is passed
juliannguyen4 Dec 5, 2025
142ad28
Rename to something better.
juliannguyen4 Dec 5, 2025
e33a7eb
socket_timeout isn't in docs
juliannguyen4 Dec 6, 2025
04b6584
Add more test cases for checking that warning is raised for using met…
juliannguyen4 Dec 6, 2025
08b3d90
Just undo to be consistent
juliannguyen4 Dec 8, 2025
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
4 changes: 4 additions & 0 deletions aerospike_helpers/batch/records.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ 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.rst

Attributes:
key (:obj:`tuple`): The aerospike key to send the command to.
record (:obj:`tuple`): The record corresponding to the requested key.
Expand Down Expand Up @@ -111,6 +113,8 @@ def __init__(
class Read(BatchRecord):
""" Read is used for executing Batch read commands with batch_write and retrieving results.

.. include:: ./deprecate_meta.rst

Attributes:
key (:obj:`tuple`): The aerospike key to send the command to.
record (:obj:`tuple`): The record corresponding to the requested key.
Expand Down
6 changes: 3 additions & 3 deletions aerospike_helpers/operations/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,18 +119,18 @@ def increment(bin_name, amount):
def touch(ttl: Optional[int] = None):
"""Create a touch operation dictionary.

Using ttl here is deprecated. It should be set in the record metadata for the operate method.
Using ttl here is deprecated. It should be set in the policy parameter for the operate method.

Args:
ttl (int): Deprecated. The ttl that should be set for the record.
This should be set in the metadata passed to the operate or
This should be set in the policy parameter passed to the operate or
operate_ordered methods.
Returns:
A dictionary to be passed to operate or operate_ordered.
"""
op_dict = {"op": aerospike.OPERATOR_TOUCH}
if ttl:
warnings.warn("TTL should be specified in the meta dictionary for operate", DeprecationWarning)
warnings.warn("TTL should be specified in the policy parameter for operate", DeprecationWarning)
op_dict["val"] = ttl
return op_dict

Expand Down
18 changes: 18 additions & 0 deletions doc/client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ Record Commands

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

.. include:: ./deprecate_meta.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`.
Expand Down Expand Up @@ -181,6 +183,8 @@ 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.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`.
Expand All @@ -207,6 +211,8 @@ Record Commands

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

.. include:: ./deprecate_meta.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`.
Expand All @@ -224,6 +230,8 @@ Record Commands

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

.. include:: ./deprecate_meta.rst

: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`
Expand All @@ -238,6 +246,8 @@ Record Commands

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

.. include:: ./deprecate_meta.rst

: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.
Expand All @@ -252,6 +262,8 @@ 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.put`.

.. include:: ./deprecate_meta.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`.
Expand Down Expand Up @@ -408,6 +420,8 @@ String Operations

Append a string to the string value in bin.

.. include:: ./deprecate_meta.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.
Expand All @@ -427,6 +441,8 @@ String Operations

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

.. include:: ./deprecate_meta.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.
Expand Down Expand Up @@ -456,6 +472,8 @@ Numeric Operations

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

.. include:: ./deprecate_meta.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*.
Expand Down
3 changes: 3 additions & 0 deletions doc/deprecate_meta.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.. versionchanged:: 18.1.0

Deprecated the ``meta`` parameter. Use the policy parameter to set ``ttl`` and ``gen`` instead.
4 changes: 4 additions & 0 deletions src/include/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@

#define CLUSTER_NPARTITIONS (4096)

#define DEPRECATE_META_PARAMETER_WARNING_MESSAGE \
"meta parameter is deprecated and will be removed in the " \
"next client major release"

/*******************************************************************************
* Macros for UDF operations.
******************************************************************************/
Expand Down
10 changes: 10 additions & 0 deletions src/main/client/operate.c
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,11 @@ static PyObject *AerospikeClient_Operate_Invoke(AerospikeClient *self,
as_exp exp_list;
as_exp *exp_list_p = NULL;

if (py_meta) {
PyErr_WarnEx(PyExc_DeprecationWarning,
DEPRECATE_META_PARAMETER_WARNING_MESSAGE, 2);
}

as_vector *unicodeStrVector = as_vector_create(sizeof(char *), 128);

as_operations ops;
Expand Down Expand Up @@ -1264,6 +1269,11 @@ PyObject *AerospikeClient_OperateOrdered(AerospikeClient *self, PyObject *args,
return NULL;
}

if (py_meta) {
PyErr_WarnEx(PyExc_DeprecationWarning,
DEPRECATE_META_PARAMETER_WARNING_MESSAGE, 2);
}

CHECK_CONNECTED(&err);

if (pyobject_to_key(&err, py_key, &key) != AEROSPIKE_OK) {
Expand Down
5 changes: 5 additions & 0 deletions src/main/client/put.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@ PyObject *AerospikeClient_Put(AerospikeClient *self, PyObject *args,
return NULL;
}

if (py_meta) {
PyErr_WarnEx(PyExc_DeprecationWarning,
DEPRECATE_META_PARAMETER_WARNING_MESSAGE, 2);
}

if (py_serializer_option) {
if (PyLong_Check(py_serializer_option)) {
self->is_client_put_serializer = true;
Expand Down
5 changes: 5 additions & 0 deletions src/main/client/remove.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@ PyObject *AerospikeClient_Remove(AerospikeClient *self, PyObject *args,
return NULL;
}

if (py_meta) {
PyErr_WarnEx(PyExc_DeprecationWarning,
DEPRECATE_META_PARAMETER_WARNING_MESSAGE, 2);
}

// Invoke Operation
return AerospikeClient_Remove_Invoke(self, py_key, py_meta, py_policy);
}
5 changes: 5 additions & 0 deletions src/main/client/remove_bin.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@ PyObject *AerospikeClient_RemoveBin(AerospikeClient *self, PyObject *args,
return NULL;
}

if (py_meta) {
PyErr_WarnEx(PyExc_DeprecationWarning,
DEPRECATE_META_PARAMETER_WARNING_MESSAGE, 2);
}

if (!self || !self->as) {
as_error_update(&err, AEROSPIKE_ERR_PARAM, "Invalid aerospike object");
goto CLEANUP;
Expand Down
7 changes: 6 additions & 1 deletion test/new_tests/test_append.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from aerospike import exception as e

import aerospike
import warnings

# @pytest.mark.usefixtures("as_connection")

Expand Down Expand Up @@ -116,7 +117,11 @@ def test_pos_append_with_policy_key_gen_EQ_ignore(self):
}

meta = {"gen": 10, "ttl": 1200}
self.as_connection.append(key, "name", "str", meta, policy)
with warnings.catch_warnings(record=True) as warning_list:
self.as_connection.append(key, "name", "str", meta, policy)

assert len(warning_list) == 1
assert warning_list[0].category == DeprecationWarning

(key, meta, bins) = self.as_connection.get(key)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ def test_query_invalid_expected_duration():
# Some of these options may not be documented, but they are allowed in the code and customers may be using them
def test_config_level_misc_options():
config = copy.deepcopy(gconfig)
config["policies"]["socket_timeout"] = 1
config["policies"]["total_timeout"] = 1
config["policies"]["max_retries"] = 1
config["policies"]["exists"] = aerospike.POLICY_EXISTS_CREATE
Expand Down Expand Up @@ -322,6 +321,8 @@ def test_config_level_misc_options():
# We just make sure that the above options are allowed as dict keys
try:
aerospike.client(config)
except e.ParamError as exc:
raise exc
except:
pass

Expand Down
7 changes: 6 additions & 1 deletion test/new_tests/test_get_put.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import aerospike
from aerospike import exception as e
import warnings


@contextmanager
Expand Down Expand Up @@ -262,7 +263,11 @@ def test_pos_put_with_policy_exists_create_or_replace(self):
"gen": aerospike.POLICY_GEN_IGNORE,
"key": aerospike.POLICY_KEY_SEND,
}
assert 0 == self.as_connection.put(key, rec, meta, policy)

with warnings.catch_warnings(record=True) as warning_list:
assert 0 == self.as_connection.put(key, rec, meta, policy)
assert len(warning_list) == 1
assert warning_list[0].category == DeprecationWarning

(key, meta, bins) = self.as_connection.get(key)
assert rec == bins
Expand Down
7 changes: 6 additions & 1 deletion test/new_tests/test_increment.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from aerospike import exception as e

import aerospike
import warnings


class TestIncrement(object):
Expand Down Expand Up @@ -127,7 +128,11 @@ def test_increment_with_policy_key_gen_EQ_ignore(self):
}

meta = {"gen": 10, "ttl": 1200}
self.as_connection.increment(key, "age", 5, meta, policy)
with warnings.catch_warnings(record=True) as warning_list:
self.as_connection.increment(key, "age", 5, meta, policy)

assert len(warning_list) == 1
assert warning_list[0].category == DeprecationWarning

(key, meta, bins) = self.as_connection.get(key)

Expand Down
6 changes: 5 additions & 1 deletion test/new_tests/test_operate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import aerospike
from aerospike import exception as e
import warnings

# OPERATIONS
# aerospike.OPERATOR_WRITE
Expand Down Expand Up @@ -297,7 +298,10 @@ def test_pos_operate_with_policy_gen_ignore(self, key, policy, meta, llist):
Invoke operate() with gen ignore.
"""

key, meta, bins = self.as_connection.operate(key, llist, meta, policy)
with warnings.catch_warnings(record=True) as warning_list:
key, meta, bins = self.as_connection.operate(key, llist, meta, policy)
assert len(warning_list) == 1
assert warning_list[0].category == DeprecationWarning

assert bins == {"name": "name1aa"}
assert key == (
Expand Down
6 changes: 5 additions & 1 deletion test/new_tests/test_operate_ordered.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import aerospike
from aerospike import exception as e
from aerospike_helpers.operations import operations
import warnings


class TestOperateOrdered(object):
Expand Down Expand Up @@ -222,7 +223,10 @@ def test_pos_operate_ordered_policy_gen_ignore(self, key, policy, meta, llist):
"""
Invoke operate_ordered() with gen ignore.
"""
key, meta, bins = self.as_connection.operate_ordered(key, llist, meta, policy)
with warnings.catch_warnings(record=True) as warning_list:
key, meta, bins = self.as_connection.operate_ordered(key, llist, meta, policy)
assert len(warning_list) == 1
assert warning_list[0].category == DeprecationWarning

assert bins == [("name", "name1aa")]

Expand Down
6 changes: 5 additions & 1 deletion test/new_tests/test_prepend.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from .test_base_class import TestBaseClass
import aerospike
from aerospike import exception as e
import warnings


class TestPrepend:
Expand Down Expand Up @@ -101,7 +102,10 @@ def test_pos_prepend_with_policy_key_gen_EQ_ignore(self):
}

meta = {"gen": 10, "ttl": 1200}
self.as_connection.prepend(key, "name", "str", meta, policy)
with warnings.catch_warnings(record=True) as warning_list:
self.as_connection.prepend(key, "name", "str", meta, policy)
assert len(warning_list) == 1
assert warning_list[0].category == DeprecationWarning

(key, meta, bins) = self.as_connection.get(key)

Expand Down
1 change: 1 addition & 0 deletions test/new_tests/test_remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from .test_base_class import TestBaseClass
import aerospike
from aerospike import exception as e
import warnings


@pytest.mark.usefixtures("as_connection")
Expand Down
Loading