Skip to content

Add availability-zone field support to CLUSTER SHARDS / CLUSTER SLOTS#3156

Merged
zuiderkwast merged 6 commits into
valkey-io:unstablefrom
bandalgomsu:gh-3110
Mar 10, 2026
Merged

Add availability-zone field support to CLUSTER SHARDS / CLUSTER SLOTS#3156
zuiderkwast merged 6 commits into
valkey-io:unstablefrom
bandalgomsu:gh-3110

Conversation

@bandalgomsu

@bandalgomsu bandalgomsu commented Feb 3, 2026

Copy link
Copy Markdown
Contributor

Implemented a way to propagate az through gossip and obtain az information
through the CLUSTER SHARDS and CLUSTER SLOTS commands. It will only be
displayed if the node is configured with it.

Examples:

CLUSTER SLOTS 
{0 8191 {127.0.0.1 21112 xxx {availability-zone zone-a}}} {8192 16383 {127.0.0.1 21111 xxx {availability-zone zone-b}}}

CLUSTER SHARDS 
{slots {8192 16383} nodes {{id xxx port 21111 ip 127.0.0.1 endpoint 127.0.0.1 role master replication-offset 0 health online availability-zone zone-b}} id xxx} {slots {0 8191} nodes {{id xxx port 21112 ip 127.0.0.1 endpoint 127.0.0.1 role master replication-offset 0 health online availability-zone zone-a}} id xxx}

Closes #3110

@codecov

codecov Bot commented Feb 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (79c8948) to head (a730f2d).
⚠️ Report is 96 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable   #3156       +/-   ##
============================================
- Coverage     74.91%       0   -74.92%     
============================================
  Files           129       0      -129     
  Lines         71209       0    -71209     
============================================
- Hits          53344       0    -53344     
+ Misses        17865       0    -17865     

see 129 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.

Signed-off-by: Su Ko <rhtn1128@gmail.com>

@zuiderkwast zuiderkwast left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks! I haven't looked closely at the tests and implementation of the gossip, but only the API changes so far.

I think we can't include it in NODES and I think we should to it slightly differently for SLOTS, to minimize the risk of breaking clusters or other tools. See comments below.

Comment thread src/cluster_legacy.c
Comment thread src/cluster_legacy.c
Comment thread src/cluster_legacy.c Outdated
Comment thread src/cluster.c
Signed-off-by: Su Ko <rhtn1128@gmail.com>
@zuiderkwast zuiderkwast added the major-decision-pending Major decision pending by TSC team label Feb 11, 2026
@zuiderkwast

Copy link
Copy Markdown
Contributor

@valkey-io/core-team Vote (👍/👎) for adding AZ in CLUSTER SLOTS and SHARDS. With this, client's can find zone-local replicas directly in the topology map.

@ranshid ranshid added the client-changes-needed Client changes may be required for this feature label Feb 11, 2026
Comment thread tests/unit/cluster/availability-zone.tcl Outdated

@enjoy-binbin enjoy-binbin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. It's strange that we didn't add it at the first time, it is same ask from Snap, one said it is enough and one is ask for this.

It is good to know someone is building smart proxy (or clients) around it.

@enjoy-binbin enjoy-binbin changed the title Add availability zone field support to cluster Add availability-zone field support to CLUSTER SHARDS / CLUSTER SLOTS Feb 11, 2026
@enjoy-binbin enjoy-binbin added the release-notes This issue should get a line item in the release notes label Feb 11, 2026
Signed-off-by: Su Ko <rhtn1128@gmail.com>
Comment thread tests/unit/cluster/availability-zone.tcl Outdated
Comment thread tests/unit/cluster/availability-zone.tcl Outdated
Signed-off-by: Su Ko <rhtn1128@gmail.com>
Comment thread tests/unit/cluster/availability-zone.tcl
Comment thread tests/unit/cluster/availability-zone.tcl Outdated
Comment thread tests/unit/cluster/availability-zone.tcl Outdated
@zuiderkwast

Copy link
Copy Markdown
Contributor

The test should check that the az of each node gets persisted in nodes.conf and is restored from the file after a restart.

We have some tests that for the other aux fields. Check for restart_server in tests/unit/cluster/announce-client-ip.tcl and hostnames.tcl.

Signed-off-by: Su Ko <rhtn1128@gmail.com>
Signed-off-by: Su Ko <rhtn1128@gmail.com>

@enjoy-binbin enjoy-binbin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM.

@zuiderkwast zuiderkwast added major-decision-pending-auto-approve and removed major-decision-pending Major decision pending by TSC team labels Feb 16, 2026
@madolson madolson added major-decision-pending Major decision pending by TSC team and removed major-decision-pending-auto-approve labels Feb 16, 2026
@madolson

madolson commented Feb 16, 2026

Copy link
Copy Markdown
Member

I guess I'm OK with this, but I do want to vent that we put this information in INFO and HELLO when this was probably the right place all along. We previously discussed that this would increase the output of CLUSTER SLOTS unnecessarily since clients would need to start using it.

@madolson madolson added major-decision-pending-auto-approve and removed major-decision-pending Major decision pending by TSC team labels Feb 16, 2026
@zuiderkwast zuiderkwast added major-decision-approved Major decision approved by TSC team and removed major-decision-pending-auto-approve labels Mar 10, 2026
@zuiderkwast zuiderkwast merged commit 3741503 into valkey-io:unstable Mar 10, 2026
159 checks passed
@zuiderkwast

Copy link
Copy Markdown
Contributor

Thank you @bandalgomsu!

Would you like to create a documentation PR for these new fields?

@zuiderkwast zuiderkwast added the needs-doc-pr This change needs to update a documentation page. Remove label once doc PR is open. label Mar 10, 2026
enjoy-binbin added a commit to enjoy-binbin/valkey that referenced this pull request Mar 11, 2026
…t commands

`availability_zone` was added to the HELLO command in valkey-io#1487, and
it was missing the reply schema and the test was wrongly marked
with `logreqres:skip`.

`availability-zone` was added to CLUSTER SHARDS and CLUSTER SLOTS
commands in valkey-io#3156, and it was missing the reply schema.

Signed-off-by: Binbin <binloveplay1314@qq.com>
@bandalgomsu

Copy link
Copy Markdown
Contributor Author

sure ! i'll open PR 😄

zuiderkwast added a commit to valkey-io/valkey-doc that referenced this pull request Mar 11, 2026
Add documentation for availability-zone field in CLUSTER SHARDS and
CLUSTER SLOTS.

Introduced in valkey-io/valkey#3156.

---------

Signed-off-by: Su Ko <rhtn1128@gmail.com>
Signed-off-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
Co-authored-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
zuiderkwast pushed a commit that referenced this pull request Mar 11, 2026
…3352)

`availability_zone` was added to the HELLO command in #1487, and
it was missing the reply schema and the test was wrongly marked
with `logreqres:skip`.

`availability-zone` was added to CLUSTER SHARDS and CLUSTER SLOTS
commands in #3156, and it was missing the reply schema.

---------

Signed-off-by: Binbin <binloveplay1314@qq.com>
madolson added a commit to madolson/valkey that referenced this pull request Mar 15, 2026
- Fix release date to Mon Mar 18 2026
- Fix typos: duplicate 'load', 'keyes' -> 'keys', duplicate 'INFO'
- Remove reverted contributor (arshidkv12, valkey-io#3137)
- Add 7 new release-notes entries from upstream/unstable merge:
  CLUSTERSCAN (valkey-io#2934), MSETEX (valkey-io#3121), availability-zone (valkey-io#3156),
  stream range optimization (valkey-io#3002), RDB as AOF preamble (valkey-io#1901),
  unsigned 64-bit module config (valkey-io#1546), fast_float -> ffc (valkey-io#3329)

Signed-off-by: Madelyn Olson <madelyneolson@gmail.com>
JimB123 pushed a commit that referenced this pull request Mar 19, 2026
…#3156)

Implemented a way to propagate az through gossip and obtain az
information
through the CLUSTER SHARDS and CLUSTER SLOTS commands. It will only be
displayed if the node is configured with it.

Closes #3110

---------

Signed-off-by: Su Ko <rhtn1128@gmail.com>
JimB123 pushed a commit that referenced this pull request Mar 19, 2026
…3352)

`availability_zone` was added to the HELLO command in #1487, and
it was missing the reply schema and the test was wrongly marked
with `logreqres:skip`.

`availability-zone` was added to CLUSTER SHARDS and CLUSTER SLOTS
commands in #3156, and it was missing the reply schema.

---------

Signed-off-by: Binbin <binloveplay1314@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client-changes-needed Client changes may be required for this feature major-decision-approved Major decision approved by TSC team needs-doc-pr This change needs to update a documentation page. Remove label once doc PR is open. release-notes This issue should get a line item in the release notes

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[NEW] Topology information CLUSTER SLOTS/NODES/SHARDS and zonal affinity support

5 participants