Skip to content

Support empty endpoints in redirects#160

Merged
bjosv merged 8 commits intovalkey-io:mainfrom
bjosv:empty-ip-in-redirects
Apr 25, 2025
Merged

Support empty endpoints in redirects#160
bjosv merged 8 commits intovalkey-io:mainfrom
bjosv:empty-ip-in-redirects

Conversation

@bjosv
Copy link
Copy Markdown
Collaborator

@bjosv bjosv commented Jan 23, 2025

"An empty endpoint indicates that the server node has an unknown endpoint, and the client should send the next request to the same endpoint as the current request but with the provided port."

https://valkey.io/topics/cluster-spec/

bjosv added 7 commits January 23, 2025 21:51
"An empty endpoint indicates that the server node has an unknown endpoint,
and the client should send the next request to the same endpoint as the
current request but with the provided port."

https://valkey.io/topics/cluster-spec/

Signed-off-by: Björn Svensson <bjorn.a.svensson@est.tech>
Signed-off-by: Björn Svensson <bjorn.a.svensson@est.tech>
Signed-off-by: Björn Svensson <bjorn.a.svensson@est.tech>
Copy link
Copy Markdown
Collaborator

@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.

The test case looks good. I didn't read all the details but it seems to work.

Comment thread src/cluster.c Outdated
Comment on lines +1817 to +1824
if ((p = strchr(str, ' ')) != NULL)
*p = '\0';
switch (field++) {
// Skip field 0, i.e. ASK/MOVED
case 1: slot = str; break;
case 2: addr = str; break;
}
if (p == NULL) break; /* No more fields. */
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Here we check if p is NULL twice. Can we move the switch up and then just do one if-else for p == NULL?

Signed-off-by: Björn Svensson <bjorn.a.svensson@est.tech>
@bjosv bjosv merged commit 5e212e6 into valkey-io:main Apr 25, 2025
47 checks passed
@bjosv bjosv deleted the empty-ip-in-redirects branch April 25, 2025 13:30
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.

2 participants