Skip to content

Fix CLUSTER GETSLOTMIGRATIONS reply schema - #5251

Merged
enjoy-binbin merged 6 commits into
valkey-io:unstablefrom
shuvajyotikar13:fix/getslotmigrations-reply-schema
Nov 6, 2026
Merged

enjoy-binbin merged 6 commits into
valkey-io:unstablefrom
shuvajyotikar13:fix/getslotmigrations-reply-schema

Conversation

@shuvajyotikar13

Copy link
Copy Markdown
Contributor

Summary

Correct the CLUSTER GETSLOTMIGRATIONS reply schema to match the fields already returned by the server.

This change fixes two inconsistencies in src/commands/cluster-getslotmigrations.json:

The change is limited to command metadata. It does not modify the command implementation, migration behavior, or wire protocol.

Root Cause

The command's reply schema was not fully synchronized with its runtime implementation in src/cluster_migrateslots.c.

The server emits name and remaining_repl_size, but the schema declares link_name and omits remaining_repl_size.

Because the schema specifies additionalProperties: false, a valid runtime response may fail validation against the published schema.

Changes

  • Correct the migration identifier property from link_name to name.
  • Document remaining_repl_size as a non-negative integer representing outstanding replication data in the source export client's reply buffer.
  • Preserve all existing runtime behavior.

Testing and Validation

Source-level verification

  • Compared the reply schema against clusterCommandGetSlotMigrations() in src/cluster_migrateslots.c.
  • Confirmed that the unmodified schema disagrees with the runtime field names.
  • Verified the correction against a local source fixture using schema validation.

Local checkout validation — mark completed after confirming results

  • Ran the focused Python schema verification script; baseline failed as expected and the corrected schema passed.
  • Validated JSON syntax using python3 -m json.tool.
  • Ran Valkey's official reply-schema linter.
  • Built Valkey successfully using make -j4.
  • Ran ./runtest --single unit/cluster/cluster-migrateslots.
  • Ran git diff --check with no whitespace errors.

The existing cluster migration tests exercise the runtime response fields. The focused schema verification additionally checks the metadata mismatch, which is not detected by runtime tests alone.

Compatibility

No behavioral or protocol changes. The patch only corrects the documented reply schema to reflect the existing server response.

References

This PR does not attempt to implement the remaining enhancements in #2725.

@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0aa790df-3bd3-4c03-ae10-4b9f33dcaca9
Commits

Reviewing files that changed from the base of the PR and between 917f2a8 and 73ffdc9.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The GETSLOTMIGRATIONS reply schema renames link_name to name and adds the nonnegative integer field remaining_repl_size.

Changes: GETSLOTMIGRATIONS reply schema

Layer / File(s) Summary
Reply schema fields
src/commands/cluster-getslotmigrations.json
The schema renames link_name to name and adds remaining_repl_size. Its description specifies that the value is zero for imports or when no export client is attached.

Estimated code review effort: 2 (Simple) | ~8 minutes

Suggested reviewers: murphyjacob4

Merge Risk: Minimal · previous review c6b07

The metadata update aligns the documented reply fields with the reported server output. No actionable merge-blocking risk is identified in the supplied evidence.

Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title names the change: it fixes the CLUSTER GETSLOTMIGRATIONS reply schema. The raw summary confirms the schema file renames link_name to name and adds remaining_repl_size, so the title matches t…
Description check Passed The description states that the reply schema in cluster-getslotmigrations.json is corrected to match the server's fields. It names the renamed link_name to name property and the added remaining_repl_s…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the change: it fixes the CLUSTER GETSLOTMIGRATIONS reply schema. The raw summary confirms the schema file renames link_name to name and adds remaining_repl_size, so the title matches the main change.

Full details: Description check

Explanation

The description states that the reply schema in cluster-getslotmigrations.json is corrected to match the server's fields. It names the renamed link_name to name property and the added remaining_repl_size property, which matches the changeset.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7743e485-7b9c-4373-af39-512f07e37b1f
Commits

Reviewing files that changed from the base of the PR and between b3b5ab9 and c6b07bc.

Files selected for processing: 1

  • src/commands/cluster-getslotmigrations.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@valkey-review-bot

valkey-review-bot Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Review state

Ready for human review.
The new head only adds a merge from unstable. The schema diff is unchanged and still matches the reply built in src/cluster_migrateslots.c:2539-2570: the key is name, and remaining_repl_size is always reply_bytes or 0. No open findings.

Risk: Low. Only the JSON reply schema changes. If it were wrong, the reply-schema validator and generated docs would be affected, not server behavior.

Open findings: none.

Backport: Needed for 9.2, 9.1, 9.0. The schema still declares link_name on upstream/9.2, 9.1 and 9.0. None of them list remaining_repl_size, which the 9.2 and 9.1 replies emit. 9.0 needs only the rename.

Updated for 3d54684 at 2026-11-03 17:10 UTC. The bot rewrites this comment on every review.

@shuvajyotikar13

Copy link
Copy Markdown
Contributor Author

./runtest --single unit/cluster/slot-migration

[ok]: Cross-DB COPY command should not be allow during slot migration (4 ms)
[ok]: Check for memory leaks (pid 91550) (736 ms)
[ok]: Check for memory leaks (pid 91539) (743 ms)
[ok]: Check for memory leaks (pid 91528) (745 ms)
[ok]: Check for memory leaks (pid 91517) (755 ms)
[ok]: Check for memory leaks (pid 91506) (730 ms)
[ok]: Check for memory leaks (pid 91495) (746 ms)
[1/1 done]: unit/cluster/slot-migration (109 seconds)

               The End

Execution time of different units:
109 seconds - unit/cluster/slot-migration

Test Summary: 100 passed, 0 failed

\o/ All tests passed without errors!

Cleanup: may take some time... OK

@codecov

codecov Bot commented Nov 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.30%. Comparing base (9b4dcf6) to head (73ffdc9).
⚠️ Report is 6 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #5251      +/-   ##
============================================
+ Coverage     81.28%   81.30%   +0.02%     
============================================
  Files           199      199              
  Lines        104068   104068              
============================================
+ Hits          84587    84614      +27     
+ Misses        19481    19454      -27     

see 31 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@enjoy-binbin
enjoy-binbin merged commit eda518a into valkey-io:unstable Nov 6, 2026
66 checks passed
@github-project-automation github-project-automation Bot moved this to To be backported in Valkey 9.1 Nov 6, 2026
@github-project-automation github-project-automation Bot moved this to To be backported in Valkey 9.0 Nov 6, 2026
@github-project-automation github-project-automation Bot moved this from Todo to To be backported in Valkey 9.2 Nov 6, 2026
valkeyrie-ops Bot pushed a commit that referenced this pull request Nov 6, 2026
Correct the `CLUSTER GETSLOTMIGRATIONS` reply schema to match the fields
already returned by the server. This change fixes two inconsistencies in
`src/commands/cluster-getslotmigrations.json`:

- Renames `link_name` to `name`, matching the response generated by
`clusterCommandGetSlotMigrations()`.
- Adds the missing `remaining_repl_size` property, which was introduced
in #3135.

Signed-off-by: SHUVA JYOTI KAR <[email protected]>
Backport-Source-PR: 5251
JimB123 pushed a commit that referenced this pull request Nov 9, 2026
Correct the `CLUSTER GETSLOTMIGRATIONS` reply schema to match the fields
already returned by the server. This change fixes two inconsistencies in
`src/commands/cluster-getslotmigrations.json`:

- Renames `link_name` to `name`, matching the response generated by
`clusterCommandGetSlotMigrations()`.
- Adds the missing `remaining_repl_size` property, which was introduced
in #3135.

Signed-off-by: SHUVA JYOTI KAR <[email protected]>
Backport-Source-PR: 5251
@valkeyrie-ops valkeyrie-ops Bot moved this from To be backported to Done in Valkey 9.2 Nov 9, 2026
valkeyrie-ops Bot pushed a commit that referenced this pull request Nov 17, 2026
Correct the `CLUSTER GETSLOTMIGRATIONS` reply schema to match the fields
already returned by the server. This change fixes two inconsistencies in
`src/commands/cluster-getslotmigrations.json`:

- Renames `link_name` to `name`, matching the response generated by
`clusterCommandGetSlotMigrations()`.
- Adds the missing `remaining_repl_size` property, which was introduced
in #3135.

Signed-off-by: SHUVA JYOTI KAR <[email protected]>
Backport-Source-PR: 5251
sarthakaggarwal97 added a commit to sarthakaggarwal97/valkey that referenced this pull request Nov 17, 2026
Keep the schema correction from link_name to name. Remove the optional
remaining_repl_size field imported by the sweep: 9.0's
clusterCommandGetSlotMigrations() returns 9 or 11 fields and never emits
that field. This metadata-only adaptation preserves all runtime replies.

Backport-Source-PR: 5251
Backport-Source-Commit: eda518a
Backport-Adaptation: Describe only fields emitted by the native 9.0 command.
valkeyrie-ops Bot pushed a commit that referenced this pull request Nov 17, 2026
Correct the `CLUSTER GETSLOTMIGRATIONS` reply schema to match the fields
already returned by the server. This change fixes two inconsistencies in
`src/commands/cluster-getslotmigrations.json`:

- Renames `link_name` to `name`, matching the response generated by
`clusterCommandGetSlotMigrations()`.
- Adds the missing `remaining_repl_size` property, which was introduced
in #3135.

Signed-off-by: SHUVA JYOTI KAR <[email protected]>
Backport-Source-PR: 5251
sarthakaggarwal97 pushed a commit that referenced this pull request Nov 18, 2026
Correct the `CLUSTER GETSLOTMIGRATIONS` reply schema to match the fields
already returned by the server. This change fixes two inconsistencies in
`src/commands/cluster-getslotmigrations.json`:

- Renames `link_name` to `name`, matching the response generated by
`clusterCommandGetSlotMigrations()`.
- Adds the missing `remaining_repl_size` property, which was introduced
in #3135.

Signed-off-by: SHUVA JYOTI KAR <[email protected]>
Backport-Source-PR: 5251
sarthakaggarwal97 pushed a commit that referenced this pull request Nov 18, 2026
Rename link_name to name in the CLUSTER GETSLOTMIGRATIONS reply
schema to match clusterCommandGetSlotMigrations(). The native 9.0
command does not emit remaining_repl_size, so that newer field is
excluded from this backport.

Release-branch adaptations contributed by Sarthak Aggarwal <[email protected]>.

Signed-off-by: SHUVA JYOTI KAR <[email protected]>
Backport-Source-PR: 5251
Backport-Source-Commit: eda518a
Backport-Adaptation: Describe only fields emitted by the native 9.0 command.
sarthakaggarwal97 pushed a commit that referenced this pull request Nov 18, 2026
Correct the `CLUSTER GETSLOTMIGRATIONS` reply schema to match the fields
already returned by the server. This change fixes two inconsistencies in
`src/commands/cluster-getslotmigrations.json`:

- Renames `link_name` to `name`, matching the response generated by
`clusterCommandGetSlotMigrations()`.
- Adds the missing `remaining_repl_size` property, which was introduced
in #3135.

Signed-off-by: SHUVA JYOTI KAR <[email protected]>
Backport-Source-PR: 5251
@valkeyrie-ops valkeyrie-ops Bot moved this from To be backported to Done in Valkey 9.1 Nov 18, 2026
sarthakaggarwal97 pushed a commit that referenced this pull request Nov 18, 2026
Rename link_name to name in the CLUSTER GETSLOTMIGRATIONS reply
schema to match clusterCommandGetSlotMigrations(). The native 9.0
command does not emit remaining_repl_size, so that newer field is
excluded from this backport.

Release-branch adaptations contributed by Sarthak Aggarwal <[email protected]>.

Signed-off-by: SHUVA JYOTI KAR <[email protected]>
Backport-Source-PR: 5251
Backport-Source-Commit: eda518a
Backport-Adaptation: Describe only fields emitted by the native 9.0 command.
@valkeyrie-ops valkeyrie-ops Bot moved this from To be backported to Done in Valkey 9.0 Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done
Status: Done
Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants