Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update cluster-slots to explain the deterministic ordering #159

Merged
merged 3 commits into from
Aug 28, 2024

Conversation

roshkhatri
Copy link
Member

Update cluster-slots docs
ref: valkey-io/valkey#265

ref: valkey-io/valkey#265

Signed-off-by: Roshan Khatri <[email protected]>
@@ -34,7 +34,8 @@ Each nested result is:
- ...continues until all replicas for this master are returned.

Each result includes all active replicas of the master instance
for the listed slot range. Failed replicas are not returned.
for the listed slot range. These active replicas are ordered deterministically.
Failed replicas are not returned.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we don't need a newline here.

Copy link
Contributor

Choose a reason for hiding this comment

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

@hpatro FYI, the recommendation is to have one sentence per line. The single linebreak doesn't have a semantic meaning in markdown so it will not be rendered as a linebreak, but if we change the text later, the diff will be per line so it's easier to see the diff if we do this. See the README of this repo: https://github.com/valkey-io/valkey-doc?tab=readme-ov-file#styling-guidelines

@@ -34,7 +34,8 @@ Each nested result is:
- ...continues until all replicas for this master are returned.

Each result includes all active replicas of the master instance
for the listed slot range. Failed replicas are not returned.
for the listed slot range. These active replicas are ordered deterministically.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we could just mention that the command response is deterministic across all nodes in a cluster. WDYT ?

Copy link
Member

@madolson madolson Jul 25, 2024

Choose a reason for hiding this comment

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

Also, should we clarify that they are ordered lexicographically?

Copy link
Member

Choose a reason for hiding this comment

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

I think we should. Because clients could check the result according to their ipaddress (becuase ipaddress as the first item in the result).

Copy link
Member Author

@roshkhatri roshkhatri Jul 25, 2024

Choose a reason for hiding this comment

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

I think we could just mention that the command response is deterministic across all nodes in a cluster

Do you mean at the start of the doc? like this

`CLUSTER SLOTS` returns details about which cluster slots map to which Valkey instances.
The command response is deterministic across all nodes in a cluster and is ordered lexicographically.

Copy link
Contributor

@hpatro hpatro Jul 25, 2024

Choose a reason for hiding this comment

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

I'm fine with placing it at the top.

Signed-off-by: Roshan Khatri <[email protected]>
Copy link
Member

@madolson madolson left a comment

Choose a reason for hiding this comment

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

I'm going to recommend we move it down below.

commands/cluster-slots.md Show resolved Hide resolved
commands/cluster-slots.md Outdated Show resolved Hide resolved
@roshkhatri
Copy link
Member Author

LGTM!

@roshkhatri roshkhatri requested a review from hpatro July 29, 2024 15:30

The command response is deterministic across all nodes in a cluster, which means that if two nodes return the same response they have the same view of the cluster.
Copy link
Contributor

Choose a reason for hiding this comment

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

This sentence is not per slot range, so I don't think it belongs under this section.

I would put this sentence at line 3, almost at the beginning of the page.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see that it was higher up earlier and was moved down by request by others. :) If it's not important enough to be at the top of the page, then maybe move it down further, to just before the example?

Comment on lines +40 to 43
Primaries are ordered by the slots they serve and then replicas are ordered lexicographically by the node-id they were assigned by the cluster.
The third nested reply is guaranteed to be the networking information of the master instance for the slot range.
All networking information after the third nested reply are replicas of the master.

Copy link
Contributor

Choose a reason for hiding this comment

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

Here, we're jumping between describing the primary, the replicas and the slot ranges.

This section is about a slot range, which is each line in the nested reply. Looking at the whole text from "Each result includes all active replicas of the master instance for the listed slot range" until the example below, I would start with describing the ordering of the slot ranges (including the sentence that explains that if a shard has non-contiguous slots, then the networking information is repeated for each range) and then say what the primary for this slot range is and that the replicas for this slot range are ordered lexicographically by node-id.

Rough idea:

Each result includes all active replicas of the primary instance for the listed slot range.
Failing replicas are not returned.

The slot ranges are returned in ascending order.
If a cluster shard serves non-contiguous slots (e.g. 1-400,900,1800-6000) then primary and replica networking information results are duplicated for each slot range.

The third nested reply is the networking information of the primary instance for the slot range.
All networking information after the third nested reply are replicas of the primary.
The replicas of each primary are ordered lexicographically by the node-id they were assigned by the cluster.

Copy link
Contributor

@zuiderkwast zuiderkwast left a comment

Choose a reason for hiding this comment

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

This is a small change that got stalled. Let's merge it. If we want to improve this document, we can do it later.

@zuiderkwast zuiderkwast changed the title Update cluster-slots Update cluster-slots to explain the deterministic ordering Aug 28, 2024
@zuiderkwast zuiderkwast merged commit c9d568d into valkey-io:main Aug 28, 2024
2 checks passed
asafpamzn pushed a commit to asafpamzn/valkey-doc that referenced this pull request Sep 26, 2024
…#159)

Update cluster-slots docs
ref: valkey-io/valkey#265

---------

Signed-off-by: Roshan Khatri <[email protected]>
Signed-off-by: Madelyn Olson <[email protected]>
Co-authored-by: Madelyn Olson <[email protected]>
Signed-off-by: asafpamzn <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants