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-3106] Refactor aerospike.exception initialization code and check if error indicator is set after calling a C-API method #661

Merged
merged 47 commits into from
Sep 9, 2024

Conversation

juliannguyen4
Copy link
Collaborator

@juliannguyen4 juliannguyen4 commented Aug 29, 2024

Documentation changes:

https://aerospike-python-client--661.org.readthedocs.build/en/661/exception.html#aerospike.exception.QueryAbortedError
https://aerospike-python-client--661.org.readthedocs.build/en/661/exception.html#aerospike.exception.QueryError
https://aerospike-python-client--661.org.readthedocs.build/en/661/exception.html#aerospike.exception.ClusterError
https://aerospike-python-client--661.org.readthedocs.build/en/661/exception.html#aerospike.exception.AdminError

Extra changes:

  • Doc: fix base class for QueryAbortError, ClusterError, AdminError, and QueryError
  • Add regression tests for Aerospike exception classes
  • Renamed test_error_code.py to test_exceptions.py

Notes:
Calling import aerospike or from aerospike import exception multiple times is idempotent. Once a module is loaded, it cannot be loaded again just by calling import on it (verified this through gdb by adding a breakpoint at AerospikeException_New. It is only hit once during the tests)

All artifacts pass testing: https://github.com/aerospike/aerospike-client-python/actions/runs/10776301993

No memory errors: https://github.com/aerospike/aerospike-client-python/actions/runs/10775987465/job/29881798616

Performance regression testing:

Memory

Dev (baseline): https://github.com/aerospike/aerospike-client-python/actions/runs/10708250636/job/29690214082#step:13:20
Feature branch: https://github.com/aerospike/aerospike-client-python/actions/runs/10775988854/job/29881848296#step:13:20

  • There's a slight memory increase by 0.5 MB but I don't think it's a big deal
  • There's a spike around the middle of the tests most likely caused by the test case I added

Time performance:

# 15.0.1rc5.dev2
(.venv) jnguyen@AerospikesMBP4 aerospike-client-python % python3 -m timeit -n 50000 "from aerospike import exception"
50000 loops, best of 5: 120 nsec per loop
# this branch
(.venv) jnguyen@AerospikesMBP4 aerospike-client-python % python3 -m timeit -n 50000 "from aerospike import exception"
50000 loops, best of 5: 121 nsec per loop

Doesn't seem to be much of a difference

@codecov-commenter
Copy link

codecov-commenter commented Aug 29, 2024

Codecov Report

Attention: Patch coverage is 67.92453% with 17 lines in your changes missing coverage. Please review.

Project coverage is 80.96%. Comparing base (1ffc37d) to head (13227ed).
Report is 6 commits behind head on dev.

Files with missing lines Patch % Lines
src/main/exception.c 67.30% 17 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #661      +/-   ##
==========================================
- Coverage   81.33%   80.96%   -0.38%     
==========================================
  Files         100      100              
  Lines       15346    15130     -216     
==========================================
- Hits        12482    12250     -232     
- Misses       2864     2880      +16     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@juliannguyen4 juliannguyen4 changed the title [CLIENT-3106] Refactor Python client C code and check if error indicator is set before calling another C-API method [CLIENT-3106] Refactor aerospike.exception initialization code Sep 4, 2024
@juliannguyen4 juliannguyen4 changed the title [CLIENT-3106] Refactor aerospike.exception initialization code [CLIENT-3106] Refactor aerospike.exception initialization code and check if error indicator is set after calling a C-API method Sep 4, 2024
@juliannguyen4 juliannguyen4 marked this pull request as ready for review September 9, 2024 16:18
Copy link
Contributor

@dwelch-spike dwelch-spike left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! LGTM

@juliannguyen4 juliannguyen4 merged commit d1e7bc2 into dev Sep 9, 2024
191 of 194 checks passed
@juliannguyen4 juliannguyen4 deleted the CLIENT-3106-c-glue-code-refactor branch September 9, 2024 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants