[8.4] ASM Slots Protocol Communication - [MOD-11988, MOD-12308]#7292
[8.4] ASM Slots Protocol Communication - [MOD-11988, MOD-12308]#7292redisearch-backport-pull-request[bot] merged 4 commits into8.4from
Conversation
* initial registration implementation * Set up most of the notification events * address review comment and add logs * implement propagation * minor improvements * small fix * review fixes * [TEMP] set CI for new API * dictionary tidy up * add first test * fix helper and test for duplicates * Add missing sub-command * add unit-tests for coverage * change workersThreadPool_OnEvent* behavior to handle overlapping events * rename events after API update * implement managed and thread-safe slot ranges API * drop cached API when needed * rename API and use in the pipeline * move includes to C file * skip current flow test, and introduce a stable one * fix initial reference count * implement mock and add a test * add missing key-space notification subscription * add a test with adding a new node and propagating the schema * review fixes * fix assertion * leak fix * use malloc * leak actual fix * don't drop the cache on failed events * add BG variants to flow tests * joan add comments to place relevant code places * initial registration implementation * Set up most of the notification events * address review comment and add logs * implement propagation * minor improvements * small fix * review fixes * [TEMP] set CI for new API * dictionary tidy up * add first test * fix helper and test for duplicates * Add missing sub-command * add unit-tests for coverage * change workersThreadPool_OnEvent* behavior to handle overlapping events * rename events after API update * implement managed and thread-safe slot ranges API * drop cached API when needed * rename API and use in the pipeline * move includes to C file * skip current flow test, and introduce a stable one * fix initial reference count * implement mock and add a test * add missing key-space notification subscription * add a test with adding a new node and propagating the schema * review fixes * fix assertion * leak fix * use malloc * leak actual fix * don't drop the cache on failed events * add BG variants to flow tests * add more TODO signaling where code needs to change * add serialization and deserialization in binary format and testing * test: add more tests * test: some adaptation to tests * add MRCommand method to add slot ranges info * test: change some tests * improve the testing of Command * add parametrization * test: remove some parts of the command cpp tests * remvoe some comments * fix: protect in case no slotRanges * test: add tests for HumanReadable capacity * some refactoring * fix problems merging * fix problems merging * fix problems merging * fix problems merging * fix problems merging * refactor do not include num_ranges into the binary serialization * add coordSlotRanges struct attribute * code to parse the coordSlotRanges * add the building block to parse in private Hybrid Requests * test: fix test * handle proper parsing * test: add AREQ_Compile tests to see how slot ranges are properly parsed * fix: fix serialize issue * test: fix memory leak in test * fix: change serialization to little endian * fix: remove size sending from MR build command * test: parametrize test to cover more cases * add parsing from CLUSTER SHARDS output * fix: fix issue not initialized coordSlotRanges * handle CLUSTERSET parsing * fix: avoid sending SLOTS for FT CURSOR and fix hybrid parsing * fix: fix double free error * fix: fix issue with DEBUG_COUNT on Debug commands * fix issues with DEBUG command * remove leftover TODO * simplify SlotRangesArray_Serialize and SlotRangesArray_Deserialize * refactor parsing and handling slots info * cleanup * revert unnecessary debug command changes * verify arg is internal and mandatory * align cluster slot parsing and make preparations for local refresh * cleanup cluster topology * add MRCommand_PrepareForSlotInfo and MRCommand_SetSlotInfo * prepare search, aggregate, and hybrid * set slots info for search, aggregate and hybrid * fix warnings * fix tests to new API * fix tests * fix hybrid slot parsing * fix error codes after merging master * improve comments and fix a leak in test * allocation fix * add slots info to tests of internal commands * add asserts * extend tests * fix MRCommand_SetSlotInfo not affecting cached commands * minor test improvements * move SlotRangesArray_Deserialize validation to before any allocation is made * rename _SLOTS to _SLOTS_INFO * add asserts and comments * wrap memmove logic in a macro * test slotRanges on cloning test * rename slotRanges_ to querySlots * minor cleanup --------- Co-authored-by: Joan Fontanals Martinez <[email protected]> (cherry picked from commit e2ea609)
There was a problem hiding this comment.
Bug: Missing Slot Info Breaks Cluster Cursors
The iterCursorMappingCb function creates _FT.CURSOR READ commands but doesn't prepare or set slot information on them, unlike iterStartCb which properly calls MRCommand_PrepareForSlotInfo and MRCommand_SetSlotInfo. Since MRCommand_SetSlotInfo requires slotsInfoArgIndex to be set (asserts cmd->slotsInfoArgIndex > 0), cursor commands need MRCommand_PrepareForSlotInfo called during creation and MRCommand_SetSlotInfo called before sending to shards. Without this, cursor READ commands in cluster mode will lack required slot range information for proper shard routing and validation.
src/coord/rmr/rmr.c#L582-L640
RediSearch/src/coord/rmr/rmr.c
Lines 582 to 640 in 5790b7c
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 8.4 #7292 +/- ##
==========================================
+ Coverage 85.65% 85.74% +0.09%
==========================================
Files 326 329 +3
Lines 50934 52112 +1178
Branches 10921 12001 +1080
==========================================
+ Hits 43628 44686 +1058
- Misses 7140 7259 +119
- Partials 166 167 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Description
Backport of #7253 to
8.4.Note
Implements end-to-end slot-range serialization, embeds per-shard slots into distributed commands, parses/enforces _SLOTS_INFO for internal queries, and wires slot awareness through topology, pipeline, and tests.
MRCommand_PrepareForSlotInfo/MRCommand_SetSlotInfoto embed_SLOTS_INFObinary into commands; maintain index on insert/copy._FT.SEARCH/_FT.AGGREGATE/_FT.HYBRIDfanouts and iterators per target shard._SLOTS_INFOfor internal requests; validate and deserialize in aggregate/hybrid parsers.MRClusterTopology/MRClusterShard; clone/free safely.CLUSTER SHARDS(OSS) and REDISECLUSTERSET; pass local slots toMR_UpdateTopology.querySlots/slotsVersioninAREQand pass toRPQueryIterator; free on cleanup.uint32_tcounters for timeouts/loops; minor type tidy-ups.Written by Cursor Bugbot for commit 2e05cb6. This will update automatically on new commits. Configure here.