Skip to content

MOD-17092 FT.HYBRID: forward PARAMS/TIMEOUT from parsed state, not argv re-scan - #10566

Merged
nafraf merged 5 commits into
masterfrom
nafraf_mod-17092
Aug 13, 2026
Merged

nafraf merged 5 commits into
masterfrom
nafraf_mod-17092

Conversation

@nafraf

@nafraf nafraf commented Jul 23, 2026 •

Copy link
Copy Markdown
Collaborator

Description

  1. Current:

    • When the coordinator builds the per-shard _FT.HYBRID command, it reconstructed the PARAMS, TIMEOUT, and DIALECT clauses by re-scanning the raw argv with RMUtil_ArgIndex("PARAMS"/"TIMEOUT"/"DIALECT", ...). This positional keyword search is fragile: a YIELD_SCORE_AS alias or a PARAMS name/value that happens to be spelled PARAMS, TIMEOUT, or DIALECT is indistinguishable from the real top-level keyword, so the coordinator could misidentify arguments and build a malformed shard command.
    • TIMEOUT was also relayed verbatim from argv
    • DIALECT was forwarded despite FT.HYBRID rejecting it at parse time.
  2. Change:

    • HybridRequest_buildMRCommand now takes the already-parsed state instead of re-scanning argv:
      • PARAMS is reconstructed from the resolved parameter dictionary (searchopts.params) via a new MRCommand_appendParams helper.
      • TIMEOUT is forwarded from timeoutSpecified / clientTimeoutMS
      • DIALECT is no longer forwarded (a valid FT.HYBRID never carries one).
  3. Outcome:

  • The coordinator builds the correct per-shard command regardless of user-chosen YIELD_SCORE_AS aliases or parameter names, the client timeout is forwarded accurately, and DIALECT is no longer needlessly relayed.

Which additional issues this PR fixes

  1. MOD-17092

Main objects this PR modified

  1. HybridRequest_buildMRCommand + new MRCommand_appendParams (src/coord/hybrid/dist_hybrid.c/.h)
  2. parseHybridCommand / ParseHybridCommandCtx (src/hybrid/parse_hybrid.c/.h)

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

Fixes incorrect per-shard command construction for clustered FT.HYBRID when a YIELD_SCORE_AS alias or PARAMS entry collides with a top-level keyword (PARAMS/TIMEOUT/DIALECT), and forwards the exact client-requested query timeout to shards.

@nafraf
nafraf marked this pull request as ready for review July 23, 2026 05:45
@nafraf nafraf changed the title FT.HYBRID: forward PARAMS/TIMEOUT from parsed state, not argv re-scan MOD-17092 FT.HYBRID: forward PARAMS/TIMEOUT from parsed state, not argv re-scan Jul 23, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 19fa0fec12

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/module.c Outdated
Comment on lines +3852 to +3853
if (len == strlen("YIELD_SCORE_AS") && !strncasecmp(arg, "YIELD_SCORE_AS", len)) {
i++; // the following token is a user alias, never a keyword

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Do not skip TIMEOUT after filter terms

In multi-shard FT.HYBRID, this scanner runs before parsing and treats every YIELD_SCORE_AS token as an alias marker, but a counted VSIM filter can legally consume YIELD_SCORE_AS as its filter expression, e.g. ... VSIM @v $BLOB FILTER 1 YIELD_SCORE_AS TIMEOUT 5 PARAMS .... In that case the top-level TIMEOUT immediately after the filter is skipped here, so the blocked-client timeout uses the global default instead of the user's value under FAIL/RETURN_STRICT policies, while the later parsed command still forwards TIMEOUT 5 to shards. Please restrict this skip to positions where YIELD_SCORE_AS <alias> is actually valid, or reuse parsed state for the coordinator timeout too.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

module.c is not modified. The TIMEOUT parsing error is a different issue which affects FT.SEARCH, FT.AGGREGATE, FT.HYBRID, new ticket created: MOD-17165

@codecov

codecov Bot commented Jul 23, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.43590% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 82.23%. Comparing base (4f2b28a) to head (95914a1).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/coord/hybrid/dist_hybrid.c 97.29% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10566      +/-   ##
==========================================
- Coverage   83.21%   82.23%   -0.98%     
==========================================
  Files         606      630      +24     
  Lines       80993    82115    +1122     
  Branches    36254    37363    +1109     
==========================================
+ Hits        67399    67531     +132     
- Misses      13247    14237     +990     
  Partials      347      347              
Flag Coverage Δ
flow 84.36% <94.87%> (-0.05%) ⬇️
unit 55.73% <74.35%> (-0.60%) ⬇️

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.

@nafraf
nafraf requested a review from oshadmi July 24, 2026 22:16
Comment thread src/coord/hybrid/dist_hybrid.c Resolved
Comment thread src/coord/hybrid/dist_hybrid.c Resolved

@Itzikvaknin Itzikvaknin left a comment

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.

Left some minor comments

@nafraf
nafraf force-pushed the nafraf_mod-17092 branch 2 times, most recently from 2418913 to fd63aa9 Compare August 7, 2026 14:54
@nafraf
nafraf requested a review from Itzikvaknin August 7, 2026 16:57
Itzikvaknin
Itzikvaknin previously approved these changes Aug 11, 2026

@Itzikvaknin Itzikvaknin left a comment

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.

Looks good,
2 nitpicks

Comment thread src/coord/hybrid/dist_hybrid.c Resolved
Comment thread src/coord/hybrid/dist_hybrid.c Resolved
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

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

See analysis details on SonarQube Cloud

@nafraf
nafraf added this pull request to the merge queue Aug 13, 2026
Merged via the queue into master with commit e049d94 Aug 13, 2026
58 of 59 checks passed
@nafraf
nafraf deleted the nafraf_mod-17092 branch August 13, 2026 14:02
@redisearch-backport-pull-request

Copy link
Copy Markdown
Contributor

🤖 Auto-backport summary

Target Status Backport PR
8.8 skipped Non-mechanical conflicts in hybrid MR-command interfaces and tests — manual backport required

(Summary generated by .github/codex/prompts/pr-backport-auto.md.)

@nafraf

nafraf commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator Author

/backport-agent 8.10

@redisearch-backport-pull-request

Copy link
Copy Markdown
Contributor

🤖 Auto-backport summary

Target Status Backport PR
8.10 conflicts(6) #10914 — see Conflict Log in the PR body

(Summary generated by .github/codex/prompts/pr-backport-auto.md.)

@nafraf

nafraf commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator Author

/backport-agent 8.6

@redisearch-backport-pull-request

Copy link
Copy Markdown
Contributor

🤖 Auto-backport summary

Target Status Backport PR
8.6 skipped Non-mechanical coordinator API/test conflicts across SHARD_K_RATIO, EXPLAINSCORE, and binary-argument changes — manual backport required

(Summary generated by .github/codex/prompts/pr-backport-auto.md.)

nafraf added a commit that referenced this pull request Aug 14, 2026
…te, not argv re-scan (#10566)

* FT.HYBRID: forward PARAMS/TIMEOUT from parsed state, not argv re-scan

* Revert initQueryTimeout() changes

* Add HYBRID_NUM_BUF_SIZE constant, address SonarQube comments int test_cpp_hybrid_build_mr_cmd.cpp

* Refactor HybridRequest_buildMRCommand to use HybridShardWireParams

* Assert HybridCombineWireParams is not NULL in MRCommand_appendCombine

(cherry picked from commit e049d94)
github-merge-queue Bot pushed a commit that referenced this pull request Aug 24, 2026
…te, not argv re-scan (#10928)

MOD-17092 FT.HYBRID: forward PARAMS/TIMEOUT from parsed state, not argv re-scan (#10566)

* FT.HYBRID: forward PARAMS/TIMEOUT from parsed state, not argv re-scan

* Revert initQueryTimeout() changes

* Add HYBRID_NUM_BUF_SIZE constant, address SonarQube comments int test_cpp_hybrid_build_mr_cmd.cpp

* Refactor HybridRequest_buildMRCommand to use HybridShardWireParams

* Assert HybridCombineWireParams is not NULL in MRCommand_appendCombine

(cherry picked from commit e049d94)

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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.

3 participants