Skip to content

[8.4] MOD-10798, MOD-14095: Support K Ratio argument in FT.HYBRID vector query#8400

Merged
nafraf merged 3 commits into
8.4from
nafraf_backport-8227-to-8.4
Feb 23, 2026
Merged

[8.4] MOD-10798, MOD-14095: Support K Ratio argument in FT.HYBRID vector query#8400
nafraf merged 3 commits into
8.4from
nafraf_backport-8227-to-8.4

Conversation

@nafraf

@nafraf nafraf commented Feb 17, 2026

Copy link
Copy Markdown
Collaborator

Description

Manual backport #8227 to 8.4
(cherry picked from commit d7ac7d3)

Which additional issues this PR fixes

  1. MOD-10798
  2. MOD-14095

Main objects this PR modified

  1. ...

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

If a release note is required (bug fix / new feature / enhancement), describe the user impact of this PR in the title.


Note

Medium Risk
Touches hybrid query parsing and distributed coordinator command-building, including cross-thread context plumbing; mistakes could change KNN result counts or break distributed execution, but changes are scoped and covered by new unit/integration tests.

Overview
Adds support for SHARD_K_RATIO in FT.HYBRID KNN vector queries (documented in commands.json/command metadata), including validation and duplicate-argument handling.

On the coordinator, distributed hybrid execution now computes an effective per-shard K from K, SHARD_K_RATIO, and shard count, and rewrites the built MR command’s VSIM K argument accordingly. This required extending concurrent command context to carry numShards from the main thread, factoring SHARD_K_RATIO validation into shared shard_window_ratio helpers, and adding extensive C++ and Python tests to verify parsing, error cases, and per-shard profiling behavior.

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

Comment thread src/coord/hybrid/dist_hybrid.c
@codecov

codecov Bot commented Feb 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.51%. Comparing base (dca18a5) to head (d18fcaa).
⚠️ Report is 1 commits behind head on 8.4.

Additional details and impacted files
@@            Coverage Diff             @@
##              8.4    #8400      +/-   ##
==========================================
- Coverage   85.51%   85.51%   -0.01%     
==========================================
  Files         337      337              
  Lines       53274    53328      +54     
  Branches    11023    11023              
==========================================
+ Hits        45556    45602      +46     
- Misses       7575     7583       +8     
  Partials      143      143              
Flag Coverage Δ
flow 84.48% <97.29%> (-0.43%) ⬇️
unit 51.08% <74.32%> (+0.05%) ⬆️

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.

@nafraf nafraf requested a review from oshadmi February 20, 2026 20:34
Comment thread commands.json Outdated
Comment thread src/module.c

return ConcurrentSearch_HandleRedisCommandEx(DIST_THREADPOOL, dist_callback, ctx, argv, argc,
StrongRef_Demote(spec_ref));
&handlerCtx);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Uninitialized numShards passed to background

Medium Severity

Some ConcurrentSearchHandlerCtx instances passed into ConcurrentSearch_HandleRedisCommandEx omit .numShards, so ConcurrentCmdCtx->numShards becomes 0 for those background executions, which can silently break any logic that depends on an accurate shard count from ConcurrentCmdCtx_GetNumShards.

Additional Locations (1)

Fix in Cursor Fix in Web

Comment thread src/command_info/command_info.c Outdated
{
.name = "shard_k_ratio",
.token = "SHARD_K_RATIO",
.since = "8.6.1",

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.

@nafraf Need to generate this file with "8.4.7"

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.

Fixed d18fcaa

@jit-ci

jit-ci Bot commented Feb 23, 2026

Copy link
Copy Markdown

🛡️ Jit Security Scan Results

CRITICAL HIGH MEDIUM

✅ No security findings were detected in this PR


Security scan by Jit

@cursor cursor 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.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Comment thread src/coord/hybrid/dist_hybrid.c
Comment thread commands.json
@sonarqubecloud

Copy link
Copy Markdown

@nafraf nafraf enabled auto-merge February 23, 2026 15:51
@nafraf nafraf added this pull request to the merge queue Feb 23, 2026
Merged via the queue into 8.4 with commit 6dcc114 Feb 23, 2026
34 checks passed
@nafraf nafraf deleted the nafraf_backport-8227-to-8.4 branch February 23, 2026 17:52
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