Skip to content

[8.4] [MOD-12005] Add slot ranges comparison logic#7175

Merged
redisearch-backport-pull-request[bot] merged 1 commit into8.4from
backport-7130-to-8.4
Oct 28, 2025
Merged

[8.4] [MOD-12005] Add slot ranges comparison logic#7175
redisearch-backport-pull-request[bot] merged 1 commit into8.4from
backport-7130-to-8.4

Conversation

@redisearch-backport-pull-request
Copy link
Copy Markdown
Contributor

@redisearch-backport-pull-request redisearch-backport-pull-request bot commented Oct 28, 2025

Description

Backport of #7130 to 8.4.


Note

Introduce CompareSlotRanges with SlotRangesComparisonResult to compare slot range arrays, plus comprehensive C++ unit tests.

  • Core:
    • Add CompareSlotRanges in src/slot_ranges.c returning SlotRangesComparisonResult (MATCH, SUBSET, DOES_NOT_INCLUDE), with fast-path equality and coverage-based subset logic.
    • Add static helper SlotInRanges.
    • Update src/slot_ranges.h to declare new API, result enum, forward declare RedisModuleSlotRangeArray, and add C linkage guards.
  • Tests:
    • Add tests/cpptests/test_cpp_slot_ranges.cpp with unit tests covering exact match, subset (single/multiple), non-inclusion, partial overlaps, single-slot, overlapping actual ranges, complex multi-range cases, gaps, empty intersection, boundaries, and max slot values.

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

* 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

* 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

* feat: add slot ranges comparition logic

* fix: change implementation

* fix problems merging

* fix problems merging

* fix problems merging

---------

Co-authored-by: GuyAv46 <guy.avimor@gmail.com>
(cherry picked from commit 70486dc)
@codecov
Copy link
Copy Markdown

codecov bot commented Oct 28, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.63%. Comparing base (48ee400) to head (35f1ab6).
⚠️ Report is 15 commits behind head on 8.4.

Additional details and impacted files
@@            Coverage Diff             @@
##              8.4    #7175      +/-   ##
==========================================
- Coverage   85.67%   85.63%   -0.04%     
==========================================
  Files         327      326       -1     
  Lines       51945    50952     -993     
  Branches    10921    10921              
==========================================
- Hits        44503    43632     -871     
+ Misses       7276     7154     -122     
  Partials      166      166              
Flag Coverage Δ
flow 84.18% <0.00%> (-0.13%) ⬇️
unit 51.73% <100.00%> (+0.13%) ⬆️

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.

@redisearch-backport-pull-request redisearch-backport-pull-request bot added this pull request to the merge queue Oct 28, 2025
Merged via the queue into 8.4 with commit a000d93 Oct 28, 2025
37 checks passed
@redisearch-backport-pull-request redisearch-backport-pull-request bot deleted the backport-7130-to-8.4 branch October 28, 2025 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enforce:sanitize Run sanitizer flow even on draft pull request size:M size:XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant