Skip to content

Commit

Permalink
remove code that suppress c client errors
Browse files Browse the repository at this point in the history
  • Loading branch information
juliannguyen4 committed Aug 28, 2023
1 parent d2034ce commit df69144
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 57 deletions.
27 changes: 0 additions & 27 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 @@ -237,7 +233,6 @@ PyObject *AerospikeClient_Admin_Drop_User(AerospikeClient *self, PyObject *args,
alias_to_search = NULL;

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

Expand Down Expand Up @@ -331,10 +326,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 +430,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 +530,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 @@ -658,7 +640,6 @@ PyObject *AerospikeClient_Admin_Revoke_Roles(AerospikeClient *self,
(const char **)roles, roles_size);
Py_END_ALLOW_THREADS
if (err.code != AEROSPIKE_OK) {
as_error_update(&err, err.code, NULL);
goto CLEANUP;
}

Expand Down Expand Up @@ -751,7 +732,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 +831,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,16 +919,11 @@ 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;
}

// Convert returned array of as_user structs into python object;
as_user_array_to_pyobject(&err, users, &py_users, users_size);
if (err.code != AEROSPIKE_OK) {
as_error_update(&err, err.code, NULL);
goto CLEANUP;
}

CLEANUP:
if (users) {
Expand Down Expand Up @@ -1029,7 +1003,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/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
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
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

0 comments on commit df69144

Please sign in to comment.