Skip to content

[8.8-rse] [MOD-18502] Move coordinator AGGREGATE FAIL reply serialization off the main thread - #11589

Merged
redisearch-backport-pull-request[bot] merged 2 commits into
8.8-rsefrom
backport-agent/pr-11552-to-8.8-rse
Sep 29, 2026
Merged

redisearch-backport-pull-request[bot] merged 2 commits into
8.8-rsefrom
backport-agent/pr-11552-to-8.8-rse

Conversation

@redisearch-backport-pull-request

@redisearch-backport-pull-request redisearch-backport-pull-request Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Backport of #11552 to 8.8-rse.
Merge commit: 58e0e440b59500a88aa207a3642f4afa3c8032cb

Adaptations for 8.8-rse

The source changes are a clean cherry-pick. The follow-up commit 7a8eac785 changes tests only:

Validation of the follow-up: debug build with assertions; test_blocked_client_timeout.py 43/43 standalone and 57/57 in a three-shard cluster.

Describe the changes in the pull request

Coordinator AGGREGATE with ON_TIMEOUT FAIL serializes replies on the main thread. Move serialization to workers through the existing direct reply path used by RETURN, preserving full-chunk collection so late errors still replace the entire reply.

Keep the blocked-client deadline active during encoding. Finalize coordinator cursors during free-data cleanup: pause successful nonterminal cursors and free timed-out, disconnected, or exhausted cursors. This includes PROFILE, initial WITHCURSOR requests, and cursor READ. Background error paths skip accounting when they observe that the request has timed out, across coordinator, shard, and standalone paths. This is best-effort suppression; it does not guarantee exactly-once accounting.

Follows #11534 and #11541. Rebase to master is deferred until #11543 merges.

Validation:

  • Debug build with assertions passed.
  • test_blocked_client_timeout: 67 passed / 9 skipped standalone; 100 passed / 13 skipped in a three-shard cluster. No failures.
  • Coverage includes timeout accounting when the worker observes the timeout flag, reply parity, late errors, cursor cleanup, and timeout before/during/after encoding. It does not establish exactly-once accounting for all interleavings.

Known limitations accepted in this PR

  • Error accounting is best effort. A worker can pass the timeout-state check before the blocked-client timeout callback runs. Both paths can then count an error; if the worker also has a timeout error, one command can increment timeout_error twice. Metrics for a background reply may remain counted even when Redis discards that reply. We accept this without adding atomic accounting ownership or additional synchronization. This accounting limitation does not imply a duplicate client reply or a server crash.
  • Standalone/shard cursor cleanup after disconnect remains unchanged. An initial cursor whose reply is discarded after disconnect can remain allocated until MAXIDLE cleanup. A disconnected cursor READ may consume an undelivered chunk; resuming a known cursor ID can therefore skip that chunk. We accept this to avoid expanding shared disconnect handling. Coordinator disconnect cleanup remains in place.
  • Background work can continue after the client timeout. A worker may serialize a reply that Redis subsequently discards. Avoiding all such work is outside this change; no additional timeout checks or synchronization are introduced solely to prevent wasted encoding.

Which additional issues this PR fixes

MOD-18502

Main objects this PR modified

  • Coordinator AGGREGATE and cursor dispatch.
  • Shared AREQ cursor finalization and coordinator request cleanup.
  • Debug encoding sync points and blocked-client timeout tests.

Mark if applicable

  • This PR introduces API changes
  • This PR introduces serialization changes

Release Notes

  • This PR requires release notes
  • This PR does not require release notes

…he main thread (#11552)

* [MOD-18502] Move coordinator AGGREGATE FAIL reply serialization off the main thread

* [MOD-18502] Avoid duplicate timeout accounting for discarded background replies

* [MOD-18502] Discard early worker errors after timeout replies

* test: tolerate background PROFILE timeout warning accounting

* [MOD-18502] Stop collecting shard profiles after FAIL cancellation

* [MOD-18502] Wake coordinator reply waits on FAIL timeout

(cherry picked from commit 58e0e44)
lerman25
lerman25 previously approved these changes Sep 28, 2026
@codecov

codecov Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (8.8-rse@cb861e0). Learn more about missing BASE report.

Additional details and impacted files
@@            Coverage Diff             @@
##             8.8-rse   #11589   +/-   ##
==========================================
  Coverage           ?   81.22%           
==========================================
  Files              ?      562           
  Lines              ?    76567           
  Branches           ?    30619           
==========================================
  Hits               ?    62193           
  Misses             ?    14086           
  Partials           ?      288           
Flag Coverage Δ
flow 82.54% <100.00%> (?)
unit 52.46% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

Define the CoordRequestCtx free-count helper used by the coordinator
cancellation tests. RETURN_STRICT is not a public policy on 8.8-rse, so reply
parity compares FAIL against RETURN, as in the 8.8 backport.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-29T09:07:59.954502Z 7a8eac7 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
3.8% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@redisearch-backport-pull-request
redisearch-backport-pull-request Bot added this pull request to the merge queue Sep 29, 2026
Merged via the queue into 8.8-rse with commit 0dbeca5 Sep 29, 2026
48 of 49 checks passed
@redisearch-backport-pull-request
redisearch-backport-pull-request Bot deleted the backport-agent/pr-11552-to-8.8-rse branch September 29, 2026 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport This PR was automatically backported by an agent size:L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants