Skip to content

Improve timeout check for FT.AGGREGATE in cluster mode - [MOD-12434]#7359

Merged
GuyAv46 merged 4 commits into2.10from
guyav-coord_push_empty_replies_to_channel
Nov 17, 2025
Merged

Improve timeout check for FT.AGGREGATE in cluster mode - [MOD-12434]#7359
GuyAv46 merged 4 commits into2.10from
guyav-coord_push_empty_replies_to_channel

Conversation

@GuyAv46
Copy link
Copy Markdown
Collaborator

@GuyAv46 GuyAv46 commented Nov 13, 2025

Allow empty replies to be added to the query channel

This change makes empty replies received from some shard to be added to the query channel.
It will cause the (maybe) blocked coordinator thread to wake up, check (and discard) the reply, and perform a rutine before waiting for the next reply.

This improves timeout behavior, as in some cases, when a shard times out, it will reply an empty reply to the coordinator. Allowing the empty reply to wake up the coordinator thread will cause it to check the time before going back to sleep, and handle timeouts if the time is already up, improving the timeout enforcement.

Mark if applicable

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

Note

Empty shard replies are now forwarded (RESP2/RESP3) to wake the coordinator for timeout checks, with protocol-specific emptiness detection and reduced log level.

  • Coordinator reply handling (coord/src/dist_aggregate.c):
    • Forward empty shard replies to the iterator:
      • RESP3: accept map["results"] arrays regardless of length.
      • RESP2: accept results arrays with length >= 1 (was > 1).
    • Add protocol-specific emptiness checks in getNextReply and discard empty replies after waking coordinator:
      • RESP3: empty if map["results"] length == 0.
      • RESP2: empty if rows length == 1.
    • Downgrade log on empty shard reply from warning to verbose.

Written by Cursor Bugbot for commit 031529d. This will update automatically on new commits. Configure here.

@GuyAv46 GuyAv46 changed the title allow empty replies to be pushed to the query channel Improve timeout check for FT.AGGREGATE in cluster mode - [MOD-] Nov 15, 2025
@GuyAv46 GuyAv46 marked this pull request as ready for review November 15, 2025 16:47
@GuyAv46 GuyAv46 requested a review from Copilot November 15, 2025 16:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves timeout handling for FT.AGGREGATE operations in cluster mode. When a shard times out, it may send an empty reply; previously, these empty replies were not added to the query channel. Now, empty replies are allowed to wake up the coordinator thread, which can then check for timeouts before going back to sleep, improving timeout enforcement.

Key Changes:

  • Modified callback conditions to allow empty replies to be added to the query channel (lines 133, 143)
  • Refactored empty reply validation logic with a structured do-while pattern (lines 268-296)
  • Changed log level for empty replies from "warning" to "verbose" (line 302)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread coord/src/dist_aggregate.c Outdated
Comment thread coord/src/dist_aggregate.c
Comment thread coord/src/dist_aggregate.c
Comment thread coord/src/dist_aggregate.c
@codecov
Copy link
Copy Markdown

codecov bot commented Nov 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.26%. Comparing base (adc4e1f) to head (031529d).
⚠️ Report is 3 commits behind head on 2.10.

Additional details and impacted files
@@            Coverage Diff             @@
##             2.10    #7359      +/-   ##
==========================================
- Coverage   89.27%   89.26%   -0.01%     
==========================================
  Files         207      207              
  Lines       35307    35309       +2     
==========================================
- Hits        31520    31519       -1     
- Misses       3787     3790       +3     
Flag Coverage Δ
flow 83.83% <100.00%> (-0.14%) ⬇️
unit 42.47% <0.00%> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 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.

@GuyAv46 GuyAv46 changed the title Improve timeout check for FT.AGGREGATE in cluster mode - [MOD-] Improve timeout check for FT.AGGREGATE in cluster mode - [MOD-12434] Nov 16, 2025
@GuyAv46 GuyAv46 requested review from alonre24 and kei-nan November 17, 2025 08:33
@GuyAv46 GuyAv46 added this pull request to the merge queue Nov 17, 2025
Merged via the queue into 2.10 with commit 78329f6 Nov 17, 2025
13 checks passed
@GuyAv46 GuyAv46 deleted the guyav-coord_push_empty_replies_to_channel branch November 17, 2025 17:52
redisearch-backport-pull-request bot pushed a commit that referenced this pull request Nov 17, 2025
…7359)

* allow empty replies to be pushed to the query channel

* fix empty reply check

* actually fix empty reply check

* address review comment

(cherry picked from commit 78329f6)
@redisearch-backport-pull-request
Copy link
Copy Markdown
Contributor

Successfully created backport PR for 2.8:

github-merge-queue bot pushed a commit that referenced this pull request Nov 17, 2025
…2434] (#7393)

Improve timeout check for FT.AGGREGATE in cluster mode - [MOD-12434] (#7359)

* allow empty replies to be pushed to the query channel

* fix empty reply check

* actually fix empty reply check

* address review comment

(cherry picked from commit 78329f6)

Co-authored-by: GuyAv46 <47632673+GuyAv46@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants