Skip to content

Commit

Permalink
Merge pull request #87 from citrusleaf/dev
Browse files Browse the repository at this point in the history
7.0.2 Patch Release
  • Loading branch information
dwelch-spike committed May 31, 2022
2 parents 7861eb1 + bb99bf0 commit f0b3c59
Show file tree
Hide file tree
Showing 11 changed files with 135 additions and 40 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.0.1
7.0.2
6 changes: 5 additions & 1 deletion aerospike_helpers/batch/records.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ class BatchRecords:
non 0 if an error occured. The most common error being -16 (One or more batch sub transactions failed).
"""

def __init__(self, batch_records: TypeBatchRecordList = []) -> None:
def __init__(self, batch_records: TypeBatchRecordList = None) -> None:
"""
Example::
Expand Down Expand Up @@ -424,5 +424,9 @@ def __init__(self, batch_records: TypeBatchRecordList = []) -> None:
# Note this call will mutate brs and set results in it.
client.batch_write(brs)
"""

if batch_records is None:
batch_records = []

self.batch_records = batch_records
self.result = 0
11 changes: 11 additions & 0 deletions doc/client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,14 @@ Batch Operations
config = { 'hosts': [('127.0.0.1', 3000)] }
client = aerospike.client(config).connect()
namespace = "test"
set = "demo"
keys = [(namespace, set, i) for i in range(150)]
records = [{"id": i, "balance": i * 10} for i in range(150)]
for key, rec in zip(keys, records):
client.put(key, rec)
# Batch add 10 to the bin "balance" and read it if it's over
# 1000 NOTE: batch_operate ops must include a write op
# get_batch_ops or get_many can be used for all read ops use cases.
Expand Down Expand Up @@ -899,6 +907,9 @@ Batch Operations
# Some batch sub transaction failed.
print("res result: {result}".format(result=res.result))
for key in keys:
client.remove(key)
client.close()
.. method:: batch_apply(keys: list, module: str, function: str, args: list, [policy_batch: dict], [policy_batch_apply: dict]) -> BatchRecords
Expand Down
2 changes: 1 addition & 1 deletion src/main/aerospike.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ static int Aerospike_Clear(PyObject *aerospike)
MOD_INIT(aerospike)
{

const char version[8] = "7.0.1";
const char version[8] = "7.0.2";
// Makes things "thread-safe"
PyEval_InitThreads();
int i = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/main/client/batch_apply.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,9 @@ static bool batch_apply_cb(const as_batch_result *results, uint32_t n,
}

PyList_Append(data->py_results, py_batch_record);
Py_DECREF(py_batch_record);
}

Py_XDECREF(py_batch_record);

PyGILState_Release(gstate);
return success;
}
Expand Down Expand Up @@ -259,6 +258,7 @@ static PyObject *AerospikeClient_Batch_Apply_Invoke(

PyObject *py_bw_res = PyLong_FromLong((long)batch_apply_err.code);
PyObject_SetAttrString(br_instance, FIELD_NAME_BATCH_RESULT, py_bw_res);
Py_DECREF(py_bw_res);

as_error_reset(err);

Expand Down
4 changes: 2 additions & 2 deletions src/main/client/batch_operate.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,9 @@ static bool batch_operate_cb(const as_batch_result *results, uint32_t n,
}

PyList_Append(data->py_results, py_batch_record);
Py_DECREF(py_batch_record);
}

Py_XDECREF(py_batch_record);

PyGILState_Release(gstate);
return success;
}
Expand Down Expand Up @@ -275,6 +274,7 @@ static PyObject *AerospikeClient_Batch_Operate_Invoke(

PyObject *py_bw_res = PyLong_FromLong((long)batch_apply_err.code);
PyObject_SetAttrString(br_instance, FIELD_NAME_BATCH_RESULT, py_bw_res);
Py_DECREF(py_bw_res);

as_error_reset(err);

Expand Down
4 changes: 2 additions & 2 deletions src/main/client/batch_remove.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,9 @@ static bool batch_remove_cb(const as_batch_result *results, uint32_t n,
}

PyList_Append(data->py_results, py_batch_record);
Py_DECREF(py_batch_record);
}

Py_XDECREF(py_batch_record);

PyGILState_Release(gstate);
return success;
}
Expand Down Expand Up @@ -244,6 +243,7 @@ static PyObject *AerospikeClient_Batch_Remove_Invoke(

PyObject *py_bw_res = PyLong_FromLong((long)batch_apply_err.code);
PyObject_SetAttrString(br_instance, FIELD_NAME_BATCH_RESULT, py_bw_res);
Py_DECREF(py_bw_res);

as_error_reset(err);

Expand Down

0 comments on commit f0b3c59

Please sign in to comment.