Skip to content

[MOD-14086] Coordinator-level FT.AGGREGATE: use blocked-client FAIL timeout mechanism - #8752

Merged
lerman25 merged 17 commits into
masterfrom
omerl-agg-coord-blocked-fail
Apr 13, 2026
Merged

lerman25 merged 17 commits into
masterfrom
omerl-agg-coord-blocked-fail

Conversation

@lerman25

@lerman25 lerman25 commented Mar 18, 2026 •

Copy link
Copy Markdown
Collaborator

Describe the changes in the pull request

Current: Coordinator-level FT.AGGREGATE respects the FAIL timeout policy via clock-based checks during query execution, but does not use the new blocked-client timeout mechanism introduced in #8191.

Change: Wire up reply_callback (DistAggregateReplyCallback), timeout_callback (DistAggregateTimeoutFailClient), and free_privdata (DistCoordReqFreePrivData) for coordinator-level FT.AGGREGATE using the existing CoordRequestCtx coordination pattern. Extract AREQ_ReplyOrStoreError and AREQ_ReplyWithStoredResults as public helpers so both shard and coordinator reply paths can reuse them.

Outcome: Coordinator-level FT.AGGREGATE now uses the blocked-client timeout mechanism for the FAIL policy, consistent with FT.SEARCH and FT.HYBRID.

Previous PRs in this series

  1. [MOD-13616] Use new strict FAIL timeout mechanism in FT.SEARCH coordinator #8191 — Coordinator FT.SEARCH: new blocked-client FAIL timeout
  2. [MOD-13954] Shard Level FT.SEARCH/AGGREGATE - new mechanism for fail #8335 — Shard-level FT.SEARCH/FT.AGGREGATE: new blocked-client FAIL timeout
  3. [MOD-14073] Coordinator-level FAIL timeout for FT.HYBRID #8420 — Coordinator FT.HYBRID: blocked-client FAIL timeout
  4. [MOD-14327] [AGG/SEARCH/HYBRID] Use BlockClient reply_callback to reply #8609 — Use reply_callback pattern for all coordinator commands
  5. [MOD-14074] Shard-level FAIL timeout for FT.HYBRID #8657 — Shard-level FT.HYBRID: blocked-client FAIL timeout

Main objects this PR modified

  1. src/coord/dist_aggregate.c — Added DistAggregateReplyCallback, DistAggregateTimeoutFailClient; updated RSExecDistAggregate to check CoordRequestCtx timed-out flag and register the AREQ; updated DistAggregateCleanups to use AREQ_ReplyOrStoreError.
  2. src/aggregate/aggregate_exec.c — Extracted AREQ_ReplyWithStoredResults from QueryReplyCallback; made AREQ_ReplyOrStoreError public.
  3. src/aggregate/aggregate.h — Exported AREQ_ReplyOrStoreError and AREQ_ReplyWithStoredResults.
  4. src/module.c — Added timeout/reply/free callback setup in DistAggregateCommandImp; shared DistCoordReqFreePrivData with hybrid path.
  5. tests/pytests/test_blocked_client_timeout.py — Added coordinator-level FT.AGGREGATE tests: basic timeout, profile timeout, timeout before pickup, timeout before/after store, and no-timeout verification.

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

Note

Medium Risk
Moves coordinator FT.AGGREGATE timeout/error handling onto blocked-client reply/timeout callbacks and refactors shared reply logic, which can impact query lifecycle, cursor cleanup, and error/metric reporting under timeouts.

Overview
Coordinator-level FT.AGGREGATE now uses the blocked-client timeout mechanism for ON_TIMEOUT FAIL, wiring new DistAggregateReplyCallback/DistAggregateTimeoutFailClient and a shared CoordRequestCtx privdata lifecycle (including locking to avoid request/timeout races).

Shared aggregate reply/error handling is refactored into exported helpers (AREQ_ReplyOrStoreError, AREQ_ReplyWithStoredResults), with additional fixes around stored error ownership, SearchResult cleanup in reply-callback paths, and coordinator timeout-check gating via skipTimeoutChecks/AREQ_ShouldCheckTimeout.

Tests are updated/expanded to cover coordinator FT.AGGREGATE blocked-client timeouts (including profile, before/after store, before pickup) and to assert correct timeout metric increments; debug TIMEOUT_AFTER_N docs/constraints are clarified and some shard-timeout tests adjusted/removed.

Reviewed by Cursor Bugbot for commit 0ee26eb. Bugbot is set up for automated code reviews on this repo. Configure here.

@jit-ci

jit-ci Bot commented Mar 18, 2026 •

Copy link
Copy Markdown

🛡️ Jit Security Scan Results

CRITICAL HIGH MEDIUM

✅ No security findings were detected in this PR


Security scan by Jit

@lerman25 lerman25 changed the title Omerl agg coord blocked fail Support ON_TIMEOUT FAIL policy for coordinator-level FT.AGGREGATE Mar 18, 2026
@lerman25 lerman25 changed the title Support ON_TIMEOUT FAIL policy for coordinator-level FT.AGGREGATE Coordinator-level FT.AGGREGATE: use blocked-client FAIL timeout mechanism Mar 18, 2026
@lerman25
lerman25 force-pushed the omerl-agg-coord-blocked-fail branch from 04a923b to ba3730b Compare March 18, 2026 20:51
Base automatically changed from omerl-hybrid-shard-fail to master March 25, 2026 19:16
@lerman25
lerman25 force-pushed the omerl-agg-coord-blocked-fail branch from ba3730b to 325f52e Compare March 31, 2026 12:06
@lerman25
lerman25 marked this pull request as ready for review March 31, 2026 12:08
Comment thread src/coord/dist_aggregate.c Resolved
@codecov

codecov Bot commented Mar 31, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 73.42657% with 38 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.46%. Comparing base (54e85fc) to head (0ee26eb).
⚠️ Report is 26 commits behind head on master.

Files with missing lines Patch % Lines
src/coord/dist_aggregate.c 67.60% 23 Missing ⚠️
src/coord/coord_request_ctx.c 54.54% 10 Missing ⚠️
src/aggregate/aggregate_exec.c 80.95% 4 Missing ⚠️
src/hybrid/hybrid_exec.c 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8752      +/-   ##
==========================================
- Coverage   81.69%   81.46%   -0.23%     
==========================================
  Files         471      472       +1     
  Lines       64697    65082     +385     
  Branches    21743    22307     +564     
==========================================
+ Hits        52853    53019     +166     
- Misses      11601    11818     +217     
- Partials      243      245       +2     
Flag Coverage Δ
flow 83.21% <73.42%> (-0.08%) ⬇️
unit 50.71% <0.00%> (-0.22%) ⬇️

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.

@github-actions github-actions Bot added size:M and removed size:M labels Mar 31, 2026
@github-actions github-actions Bot added size:M and removed size:M labels Mar 31, 2026
Comment thread src/coord/dist_aggregate.c Resolved
@github-actions github-actions Bot added size:M and removed size:M labels Apr 7, 2026
Comment thread src/coord/dist_aggregate.c Resolved
Comment thread src/coord/dist_aggregate.c Resolved
@github-actions github-actions Bot added size:M and removed size:M labels Apr 7, 2026
Comment thread src/coord/dist_aggregate.c Resolved
@github-actions github-actions Bot removed the size:M label Apr 7, 2026
@github-actions github-actions Bot added size:M and removed size:M labels Apr 8, 2026
@github-actions github-actions Bot added size:L and removed size:M labels Apr 8, 2026
@github-actions github-actions Bot added size:L and removed size:L labels Apr 8, 2026
@github-actions github-actions Bot added size:L and removed size:L labels Apr 8, 2026

@meiravgri meiravgri left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

im (almost) speachless
Well done

Comment thread src/coord/coord_request_ctx.c Resolved
Comment thread src/module.c Resolved
Comment thread src/hybrid/hybrid_exec.c Resolved
Comment thread tests/pytests/test_aggregate_barrier.py Resolved
@github-actions github-actions Bot added size:L and removed size:L labels Apr 12, 2026
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

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

See analysis details on SonarQube Cloud

@lerman25
lerman25 added this pull request to the merge queue Apr 13, 2026
Merged via the queue into master with commit 8353afb Apr 13, 2026
48 of 50 checks passed
@lerman25
lerman25 deleted the omerl-agg-coord-blocked-fail branch April 13, 2026 09:48
@lerman25 lerman25 changed the title Coordinator-level FT.AGGREGATE: use blocked-client FAIL timeout mechanism [MOD-14086] Coordinator-level FT.AGGREGATE: use blocked-client FAIL timeout mechanism Apr 13, 2026
pierrelambert pushed a commit to pierrelambert/RediSearch that referenced this pull request May 13, 2026
…nism (RediSearch#8752)

* Initial

* initial tests

* fix debug

* fix failing test

* refix

* fix barrier test

* fix debug condition

* draft - metric refactor

* Revert "draft - metric refactor"

This reverts commit 9cf2a8f.

* fix tests

* test metric properly

* fix internal

* fix leak

* ASSERT CoordRequestCtx hybrid or agg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants