Skip to content

[8.6] Fix edge case in clusterset - [MOD-13562]#8090

Merged
redisearch-backport-pull-request[bot] merged 1 commit into8.6from
backport-8068-to-8.6
Jan 20, 2026
Merged

[8.6] Fix edge case in clusterset - [MOD-13562]#8090
redisearch-backport-pull-request[bot] merged 1 commit into8.6from
backport-8068-to-8.6

Conversation

@redisearch-backport-pull-request
Copy link
Contributor

@redisearch-backport-pull-request redisearch-backport-pull-request bot commented Jan 19, 2026

Description

Backport of #8068 to 8.6.


Note

Backports improvements to cluster topology parsing and handling for SEARCH.CLUSTERSET.

  • Only include shards marked MASTER that have SLOTRANGEs; track isMaster and skip replicas/empty shards
  • Handle UNIXADDR safely (don’t consume MASTER/SHARD as values; detect duplicates) and relax re-appearance rules for shards (SLOTRANGE ≤ 1, append if ordered)
  • Allow MYID to not appear in the final topology (e.g., local shard is replica or has no slots); only error if MYID never listed; compute my_shard_idx accordingly
  • In SetClusterCommand, if local shard is excluded (my_shard_idx == UINT32_MAX), set an empty local slots array when calling MR_UpdateTopology
  • Update tests to reflect new error messages/offsets and add edge cases for empty/replica local shard

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

* collect all shards (including replicas and no slots) and filter only at the end

* Add API description

* Align usage

* add a test

* avoid string arg consuming of standalone flag params

* fix unit tests

* add another test

* align and add flow tests

* add another case

(cherry picked from commit a2279bd)
Copy link

@cursor cursor bot left a comment

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 1 potential issue.

}

// Append new slot range
array_ensure_append_1(existing_shard->slotRanges, sh->slotRanges[0]);
Copy link

Choose a reason for hiding this comment

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

MASTER flag not propagated on shard re-appearance

Medium Severity

When a shard ID re-appears in the clusterset command, the isMaster flag from the re-appearing entry is not propagated to the existing shard stored in the dictionary. The code appends slot ranges from sh to existing_shard but then frees sh without copying sh->isMaster to existing_shard->isMaster. If MASTER is specified only on a re-appearance entry (not the first appearance), the shard will have isMaster=false and be excluded from the topology during the filtering at lines 299-302.

Fix in Cursor Fix in Web

@codecov
Copy link

codecov bot commented Jan 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.02%. Comparing base (b6429aa) to head (c349031).
⚠️ Report is 4 commits behind head on 8.6.

Additional details and impacted files
@@           Coverage Diff           @@
##              8.6    #8090   +/-   ##
=======================================
  Coverage   84.01%   84.02%           
=======================================
  Files         365      365           
  Lines       55097    55098    +1     
  Branches    14296    14296           
=======================================
+ Hits        46291    46295    +4     
+ Misses       8645     8642    -3     
  Partials      161      161           
Flag Coverage Δ
flow 84.97% <75.86%> (+<0.01%) ⬆️
unit 50.81% <79.31%> (-0.01%) ⬇️

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 Jan 20, 2026
Merged via the queue into 8.6 with commit 0deb13f Jan 20, 2026
57 checks passed
@redisearch-backport-pull-request redisearch-backport-pull-request bot deleted the backport-8068-to-8.6 branch January 20, 2026 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant