Skip to content

[CLIENT-5298] Address {Query,Scan}.results() and Scan.foreach() potentially missing records during a paginated query disruption - #1208

Open
juliannguyen4 wants to merge 129 commits into
stagefrom
CLIENT-5298-address-query-and-scan-foreach-and-results-possibly-missing-records-during-paginated-query-disruption
Open

juliannguyen4 wants to merge 129 commits into
stagefrom
CLIENT-5298-address-query-and-scan-foreach-and-results-possibly-missing-records-during-paginated-query-disruption

Conversation

@juliannguyen4

@juliannguyen4 juliannguyen4 commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Extra changes

fix: bug where an empty partitions status dictionary returned by {Query,Scan}.get_partitions_status() causes a ClientError exception.

TODO

  • Ensured that all four foreground scan/query methods have no regression either in the implementation or callback code
  • Requires QE testing

query.results()

  • There's some additional overhead because udata parameter passed to the query callback function now has "partition_query" attribute which is not used by query.results(). It is only one byte since it is a boolean type.
  • fix: if a record or element fails to be appended to the results list, fail out instead of silently ignoring it

scan.results()

See note in query.results().

  • If the policy argument's partition filter fails to be parsed, fail out instead of silently ignoring it.

scan.foreach()

  • Fail out if this is unable to convert and pass the returned Python object for each record to the callback. This makes sure that the customer does not assume that the scan returned all the records and that if there's an invalid object being found during the scan, the client informs the customer

Implementation details

Deliberately kept the scan/query foreground implementations separate instead of merging them together, because scan foreground queries exclusively accept a nodename parameter

Notes (out of scope)

  • FG scan's are missing some cleanup code for apply_each. Not sure if it needs this or not

…d-error-verbosity-level-for-expression-tracing

# Conflicts:
#	aerospike-client-c
…d-error-verbosity-level-for-expression-tracing
…d-error-verbosity-level-for-expression-tracing
@juliannguyen4
juliannguyen4 changed the base branch from stage to CLIENT-5338-string-list-join-op-and-expr August 28, 2026 21:49
Base automatically changed from CLIENT-5338-string-list-join-op-and-expr to stage September 1, 2026 18:34
…query-and-scan-foreach-and-results-possibly-missing-records-during-paginated-query-disruption
@juliannguyen4

Copy link
Copy Markdown
Collaborator Author

QE reported that this issue still happens for Scan and Query results()

…forming the query. If it fails, then ensure it fails atomically by restoring the partitions status before the C client query API is called. This makes sure that no records collected during a failed query are dropped silently
…query-and-scan-foreach-and-results-possibly-missing-records-during-paginated-query-disruption
…query-and-scan-foreach-and-results-possibly-missing-records-during-paginated-query-disruption
…query-and-scan-foreach-and-results-possibly-missing-records-during-paginated-query-disruption
…query-and-scan-foreach-and-results-possibly-missing-records-during-paginated-query-disruption
…query-and-scan-foreach-and-results-possibly-missing-records-during-paginated-query-disruption
…partitions status and that partitions status is an empty dictionary and passed again to the query policy
… status arg fails and restores the original status of NULL instead of the partitions status arg
…tions status is made and the latter is accidentally reset..
…l especially during a paginated query. reuse a one-time heap allocated buffer that belongs to the query instance.
…_status_backup_buffer_capacity belong to the query instance as private members
…tatus_backup_buffer. We never change the number of partitions so this condition might be confusing
…sn't render the indentation so it's harder to review
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.

2 participants