Skip to content

[CLIENT-2479]: bump c client, add tests and docs - #1201

Open
diparthaspike wants to merge 4 commits into
devfrom
CLIENT-2479-tests-docs-cclient
Open

[CLIENT-2479]: bump c client, add tests and docs#1201
diparthaspike wants to merge 4 commits into
devfrom
CLIENT-2479-tests-docs-cclient

Conversation

@diparthaspike

@diparthaspike diparthaspike commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Fixes: https://aerospike.atlassian.net/browse/CLIENT-2479
CLIENT-2479 Disallow use of add_ops() and apply() combined in a background scan/query

Summary

Combining regular write operations (add_ops()) and a UDF (apply()) on the same Scan/Query object before calling execute_background() previously executed silently, applying only one of the two effects instead of raising an error — a data-correctness bug, not just a missing validation message.

Root cause and fix location

The actual bug was in the underlying C client, not this Python extension:

  • Foreground query paths (aerospike_query_foreach, aerospike_query_async, aerospike_query_partitions_async) already rejected this combination.
  • aerospike_query_background had no such check — it only verified that at least one of apply/ops was set.
  • aerospike_scan.c had no such check anywhere, foreground or background.

Rather than patching this independently in the Python extension (which would need to be duplicated in every other language client built on aerospike-client-c, e.g. Node.js), the fix was made upstream in the C client:

  • aerospike_query_background: added the missing query->ops && query->apply.function[0] check, matching the message/style already used in the other query paths.
  • aerospike_scan.c: added the check to the single shared as_scan_validate() hook, which every scan entry point (foreground/background, sync/async, whole-cluster/node/partition-scoped) already routes through — one minimal change covers all 7 scan entry points.

This PR bumps the aerospike-client-c submodule to pick up that fix (commit 8025c2a0), and updates this repo's tests/docs to match.

Changes

  • aerospike-client-c submodule bumped to 8025c2a0 (includes the CLIENT-2479 fix, plus an unrelated CLIENT-5237 async cluster shutdown deadlock fix that landed in between).
  • test/new_tests/test_query_execute_background.py, test/new_tests/test_scan_execute_background.py: added test_add_ops_then_apply/test_apply_then_add_ops for both Query and Scan, asserting execute_background() now raises ParamError ("Cannot combine query operations with aggregation" / "Cannot combine scan operations with a UDF") when both are set, regardless of order.
  • doc/query.rst, doc/scan.rst: documented the restriction at apply(), add_ops(), and execute_background() for both Query and Scan, plus a note in query.rst's "Query Aggregations" overview section.

Test plan

  • New tests pass against the bumped C client: execute_background() raises ParamError with the expected message for both orderings (add_ops -> apply, apply -> add_ops), for both Query and Scan.
  • Full test_query_execute_background.py + test_scan_execute_background.py suites pass (31 passed, 3 skipped, 5 xfailed — all pre-existing/expected).
  • doc8 clean on query.rst/scan.rst; flake8/pre-commit clean on the test files.

diparthaspike and others added 4 commits August 18, 2026 11:33
…n an error if both write operations and a record UDF are added to a background query/scan.
…sive

Query/Scan execute_background() now raises ParamError (via the C client
fix) if both a UDF (apply()) and write operations (add_ops()) have been
set on the same object. Document this at apply(), add_ops(), and
execute_background() for both Query and Scan, plus in query.rst's
Query Aggregations overview section.
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.64%. Comparing base (3a052af) to head (5e55e94).

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #1201   +/-   ##
=======================================
  Coverage   85.64%   85.64%           
=======================================
  Files         102      102           
  Lines       14888    14888           
=======================================
  Hits        12751    12751           
  Misses       2137     2137           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.


with pytest.raises(exception.ParamError) as excinfo:
query.execute_background()
assert excinfo.value.msg == "Cannot combine query operations with aggregation"

@juliannguyen4 juliannguyen4 Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: I think "aggregation" should be replaced with "UDF" since stream UDF's are supposed to be performed using foreground queries. But since this error message is on the C client side, we can address this later

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