Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CLIENT-1337] Unmask C client errors #470

Merged
merged 8 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.0.0-rc.7
14.0.0-rc.8
2 changes: 1 addition & 1 deletion src/main/aerospike.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ static int Aerospike_Clear(PyObject *aerospike)
PyMODINIT_FUNC PyInit_aerospike(void)
{

const char version[] = "14.0.0-rc.7";
const char version[] = "14.0.0-rc.8";
// Makes things "thread-safe"
Py_Initialize();
int i = 0;
Expand Down
30 changes: 0 additions & 30 deletions src/main/client/admin.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,6 @@ PyObject *AerospikeClient_Admin_Create_User(AerospikeClient *self,
aerospike_create_user(self->as, &err, admin_policy_p, user, password,
(const char **)roles, roles_size);
Py_END_ALLOW_THREADS
if (err.code != AEROSPIKE_OK) {
as_error_update(&err, err.code, NULL);
goto CLEANUP;
}

CLEANUP:
for (int i = 0; i < roles_size; i++) {
Expand Down Expand Up @@ -236,11 +232,6 @@ PyObject *AerospikeClient_Admin_Drop_User(AerospikeClient *self, PyObject *args,
PyMem_Free(alias_to_search);
alias_to_search = NULL;

if (err.code != AEROSPIKE_OK) {
as_error_update(&err, err.code, NULL);
goto CLEANUP;
}

CLEANUP:

if (err.code != AEROSPIKE_OK) {
Expand Down Expand Up @@ -331,10 +322,6 @@ PyObject *AerospikeClient_Admin_Set_Password(AerospikeClient *self,
Py_BEGIN_ALLOW_THREADS
aerospike_set_password(self->as, &err, admin_policy_p, user, password);
Py_END_ALLOW_THREADS
if (err.code != AEROSPIKE_OK) {
as_error_update(&err, err.code, NULL);
goto CLEANUP;
}

CLEANUP:

Expand Down Expand Up @@ -439,11 +426,6 @@ PyObject *AerospikeClient_Admin_Change_Password(AerospikeClient *self,
PyMem_Free(alias_to_search);
alias_to_search = NULL;

if (err.code != AEROSPIKE_OK) {
as_error_update(&err, err.code, NULL);
goto CLEANUP;
}

CLEANUP:

if (err.code != AEROSPIKE_OK) {
Expand Down Expand Up @@ -544,10 +526,6 @@ PyObject *AerospikeClient_Admin_Grant_Roles(AerospikeClient *self,
aerospike_grant_roles(self->as, &err, admin_policy_p, user,
(const char **)roles, roles_size);
Py_END_ALLOW_THREADS
if (err.code != AEROSPIKE_OK) {
as_error_update(&err, err.code, NULL);
goto CLEANUP;
}

CLEANUP:
for (int i = 0; i < roles_size; i++) {
Expand Down Expand Up @@ -657,10 +635,6 @@ PyObject *AerospikeClient_Admin_Revoke_Roles(AerospikeClient *self,
aerospike_revoke_roles(self->as, &err, admin_policy_p, user,
(const char **)roles, roles_size);
Py_END_ALLOW_THREADS
if (err.code != AEROSPIKE_OK) {
as_error_update(&err, err.code, NULL);
goto CLEANUP;
}

CLEANUP:
for (int i = 0; i < roles_size; i++) {
Expand Down Expand Up @@ -751,7 +725,6 @@ PyObject *AerospikeClient_Admin_Query_User(AerospikeClient *self,
aerospike_query_user(self->as, &err, admin_policy_p, user_name, &user);
Py_END_ALLOW_THREADS
if (err.code != AEROSPIKE_OK) {
as_error_update(&err, err.code, NULL);
goto CLEANUP;
}

Expand Down Expand Up @@ -851,7 +824,6 @@ PyObject *AerospikeClient_Admin_Query_User_Info(AerospikeClient *self,
aerospike_query_user(self->as, &err, admin_policy_p, user_name, &user);
Py_END_ALLOW_THREADS
if (err.code != AEROSPIKE_OK) {
as_error_update(&err, err.code, NULL);
goto CLEANUP;
}

Expand Down Expand Up @@ -940,7 +912,6 @@ PyObject *AerospikeClient_Admin_Query_Users(AerospikeClient *self,
aerospike_query_users(self->as, &err, admin_policy_p, &users, &users_size);
Py_END_ALLOW_THREADS
if (err.code != AEROSPIKE_OK) {
as_error_update(&err, err.code, NULL);
goto CLEANUP;
}

Expand Down Expand Up @@ -1029,7 +1000,6 @@ PyObject *AerospikeClient_Admin_Query_Users_Info(AerospikeClient *self,
aerospike_query_users(self->as, &err, admin_policy_p, &users, &users_size);
Py_END_ALLOW_THREADS
if (err.code != AEROSPIKE_OK) {
as_error_update(&err, err.code, NULL);
goto CLEANUP;
}

Expand Down
3 changes: 0 additions & 3 deletions src/main/client/apply.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,6 @@ PyObject *AerospikeClient_Apply_Invoke(AerospikeClient *self, PyObject *py_key,
if (err.code == AEROSPIKE_OK) {
val_to_pyobject(self, &err, result, &py_result);
}
else {
as_error_update(&err, err.code, NULL);
}

CLEANUP:
if (exp_list_p) {
Expand Down
3 changes: 0 additions & 3 deletions src/main/client/exists.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,6 @@ extern PyObject *AerospikeClient_Exists_Invoke(AerospikeClient *self,

Py_INCREF(py_result_meta);
}
else {
as_error_update(&err, err.code, NULL);
}

CLEANUP:

Expand Down
3 changes: 0 additions & 3 deletions src/main/client/get.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,6 @@ PyObject *AerospikeClient_Get_Invoke(AerospikeClient *self, PyObject *py_key,
PyTuple_SetItem(p_key, 2, Py_None);
}
}
else {
as_error_update(&err, err.code, NULL);
}

CLEANUP:

Expand Down
18 changes: 7 additions & 11 deletions src/main/client/operate.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,13 @@ static inline bool isExprOp(int op);
if (py_list) { \
Py_DECREF(py_list); \
} \
if (err.code != AEROSPIKE_OK) { \
as_error_update(&err, err.code, NULL); \
goto CLEANUP; \
} \
else if (!py_result) { \
return NULL; \
} \
else { \
Py_DECREF(py_result); \
if (err.code == AEROSPIKE_OK) { \
if (!py_result) { \
return NULL; \
} \
else { \
Py_DECREF(py_result); \
} \
}

#define CONVERT_VAL_TO_AS_VAL() \
Expand Down Expand Up @@ -880,7 +878,6 @@ static PyObject *AerospikeClient_Operate_Invoke(AerospikeClient *self,
Py_END_ALLOW_THREADS

if (err->code != AEROSPIKE_OK) {
as_error_update(err, err->code, NULL);
goto CLEANUP;
}
/* The op succeeded; it's now safe to free the record */
Expand Down Expand Up @@ -1062,7 +1059,6 @@ AerospikeClient_OperateOrdered_Invoke(AerospikeClient *self, as_error *err,
Py_END_ALLOW_THREADS

if (err->code != AEROSPIKE_OK) {
as_error_update(err, err->code, NULL);
goto CLEANUP;
}

Expand Down
3 changes: 0 additions & 3 deletions src/main/client/put.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,6 @@ PyObject *AerospikeClient_Put_Invoke(AerospikeClient *self, PyObject *py_key,
Py_BEGIN_ALLOW_THREADS
aerospike_key_put(self->as, &err, write_policy_p, &key, &rec);
Py_END_ALLOW_THREADS
if (err.code != AEROSPIKE_OK) {
as_error_update(&err, err.code, NULL);
}

CLEANUP:
POOL_DESTROY(&static_pool);
Expand Down
4 changes: 0 additions & 4 deletions src/main/client/query.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,10 +433,6 @@ static PyObject *AerospikeClient_QueryApply_Invoke(
aerospike_query_wait(self->as, &err, info_policy_p, &query,
query_id, 0);
Py_END_ALLOW_THREADS
if (err.code != AEROSPIKE_OK) {
as_error_update(&err, AEROSPIKE_ERR_PARAM,
"Unable to perform query_wait on the query");
}
}
}
else {
Expand Down
3 changes: 0 additions & 3 deletions src/main/client/remove.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,6 @@ PyObject *AerospikeClient_Remove_Invoke(AerospikeClient *self, PyObject *py_key,
Py_BEGIN_ALLOW_THREADS
aerospike_key_remove(self->as, &err, remove_policy_p, &key);
Py_END_ALLOW_THREADS
if (err.code != AEROSPIKE_OK) {
as_error_update(&err, err.code, NULL);
}

CLEANUP:

Expand Down
4 changes: 0 additions & 4 deletions src/main/client/remove_bin.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,6 @@ AerospikeClient_RemoveBin_Invoke(AerospikeClient *self, PyObject *py_key,
Py_BEGIN_ALLOW_THREADS
aerospike_key_put(self->as, err, write_policy_p, &key, &rec);
Py_END_ALLOW_THREADS
if (err->code != AEROSPIKE_OK) {
as_error_update(err, err->code, NULL);
goto CLEANUP;
}

CLEANUP:

Expand Down
10 changes: 1 addition & 9 deletions src/main/client/sec_index.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,6 @@ PyObject *AerospikeClient_Index_Remove(AerospikeClient *self, PyObject *args,
Py_BEGIN_ALLOW_THREADS
aerospike_index_remove(self->as, &err, info_policy_p, namespace, name);
Py_END_ALLOW_THREADS
if (err.code != AEROSPIKE_OK) {
as_error_update(&err, err.code, NULL);
goto CLEANUP;
}

CLEANUP:

Expand Down Expand Up @@ -597,11 +593,7 @@ static PyObject *createIndexWithDataAndCollectionType(
set_ptr, bin_ptr, name, index_type, data_type,
ctx);
Py_END_ALLOW_THREADS
if (err.code != AEROSPIKE_OK) {
as_error_update(&err, err.code, NULL);
goto CLEANUP;
}
else {
if (err.code == AEROSPIKE_OK) {
Py_BEGIN_ALLOW_THREADS
aerospike_index_create_wait(&err, &task, 2000);
Py_END_ALLOW_THREADS
Expand Down
3 changes: 0 additions & 3 deletions src/main/client/select.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,6 @@ PyObject *AerospikeClient_Select_Invoke(AerospikeClient *self, PyObject *py_key,
select_succeeded = true;
record_to_pyobject(self, &err, rec, &key, &py_rec);
}
else {
as_error_update(&err, err.code, NULL);
}

CLEANUP:
if (exp_list_p) {
Expand Down
11 changes: 0 additions & 11 deletions src/main/client/udf.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,6 @@ PyObject *AerospikeClient_UDF_Remove(AerospikeClient *self, PyObject *args,
Py_BEGIN_ALLOW_THREADS
aerospike_udf_remove(self->as, &err, info_policy_p, filename);
Py_END_ALLOW_THREADS
if (err.code != AEROSPIKE_OK) {
as_error_update(&err, err.code, NULL);
goto CLEANUP;
}

CLEANUP:

Expand Down Expand Up @@ -442,19 +438,13 @@ PyObject *AerospikeClient_UDF_List(AerospikeClient *self, PyObject *args,
aerospike_udf_list(self->as, &err, info_policy_p, &files);
Py_END_ALLOW_THREADS
if (err.code != AEROSPIKE_OK) {
as_error_update(&err, err.code, NULL);
goto CLEANUP;
}

// Convert as_udf_files struct into python object
PyObject *py_files;
as_udf_files_to_pyobject(&err, &files, &py_files);

if (err.code != AEROSPIKE_OK) {
as_error_update(&err, err.code, NULL);
goto CLEANUP;
}

CLEANUP:

if (init_udf_files) {
Expand Down Expand Up @@ -564,7 +554,6 @@ PyObject *AerospikeClient_UDF_Get_UDF(AerospikeClient *self, PyObject *args,
(language - AS_UDF_TYPE_LUA), &file);
Py_END_ALLOW_THREADS
if (err.code != AEROSPIKE_OK) {
as_error_update(&err, err.code, NULL);
goto CLEANUP;
}
udf_content = Py_BuildValue("s#", file.content.bytes, file.content.size);
Expand Down