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

Support connection schemes valkey:// and valkeys:// #199

Merged
merged 5 commits into from
Apr 23, 2024

Conversation

lipzhu
Copy link
Contributor

@lipzhu lipzhu commented Apr 4, 2024

  1. Support valkey:// and valkeys:// scheme in valkey-cli and valkey-benchmark. Retain the original Redis schemes for compatibility.
  2. Add unit tests for valid URI, all schemes.

Fixes: #198
Fixes: #200

@lipzhu lipzhu changed the title Rename connection scheme from redis:// to valkey://. Support connection schemes: valkey://, valkeys://. Apr 4, 2024
@lipzhu lipzhu changed the title Support connection schemes: valkey://, valkeys://. Support connection schemes: valkey://, valkeys://. Apr 4, 2024
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.

LGTM.

The --help text now only mentions the valkey schemes, although the redis schemes also still work.

@valkey-io/core-team Do we need to document in the help text that the redis schemes are still supported?

@zuiderkwast
Copy link
Contributor

AH!! I didn't review the tests. If there is more coming, better mark the PR as draft. :D

I'll review the tests now.

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.

OK, LGTM, just one typo in one of the test case names. :)

tests/integration/redis-cli.tcl Outdated Show resolved Hide resolved
@enjoy-binbin
Copy link
Member

Please also update the top comment to describe the changes (don't just link issue).
For example, mention we supports valkey://, and also retains the original redis schema for compatibility, and then we adds some tests to cover these cases.

also if you have a PR directly, there is actually no need to create a new issue (there is no discussion or tracking in the issue so it is actually worthless)

const char *scheme = "redis://";
const char *tlsscheme = "rediss://";
const char *scheme = "valkey://";
const char *tlsscheme = "valkeys://";
Copy link
Member

Choose a reason for hiding this comment

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

I have a concerns about this. With Redis, using rediss was clearer to me that it was SSL because there is obviously a second s. With Valkey, I'm concerned valkeys will be confusing since it's not clear. I want us to least thing about it a bit more.

Copy link
Contributor

Choose a reason for hiding this comment

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

@madolson think about it for a while then. :)

Adding "s" is the most common style for URI schemes, so I think valkeys is the right choice. Here are some from IANA's list:

aaa 		Diameter Protocol
aaas 		Diameter Protocol with Secure Transport
http 		Hypertext Transfer Protocol
https 		Hypertext Transfer Protocol Secure
msrp 		Message Session Relay Protocol
msrps 		Message Session Relay Protocol Secure
rtsp 		Real-Time Streaming Protocol (RTSP)
rtsps 		Real-Time Streaming Protocol (RTSP) over TLS
sip 		session initiation protocol
sips 		secure session initiation protocol

Copy link
Member

@madolson madolson Apr 4, 2024

Choose a reason for hiding this comment

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

Ok, I thought about it and will retract my concern :) I still don't really like it, but I guess it's fine.

Copy link
Member

Choose a reason for hiding this comment

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

I guess now would be the time to rethink the URI scheme if we wanted to do that though.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know if this scheme is widely used. It's a client feature anyway.

We can postpone it indefinitely and only support the redis scheme. Do you prefer that?

Copy link
Contributor

Choose a reason for hiding this comment

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

We can consider resp as the scheme. RESP is the protocol after all. :)

Copy link
Member

Choose a reason for hiding this comment

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

I like resp more. In fact, I think "redis" was a minomer to begin with. It should've been a protocol name.

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 the redis scheme contains more than what's specified in RESP.

An example URL redis://user:password@host:port/dbnum contains information for the AUTH command and the SELECT command, to be called after connecting. It doesn't contain the RESP version though (for HELLO). It's a bit ad-hoc all of it.

Copy link
Contributor

Choose a reason for hiding this comment

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

It could have included various more things which are useful to do when connecting, like CLIENT SETNAME, CLIENT SETINFO LIBNAME, CLIENT SETINFO LIBVER, CLIENT NO-EVICT.

For example we could support them in a query string, such as

?name=banana&libname=valkey-py&libver=3.14.159&no-evict=1

The RESP version (HELLO N) very much affects what comes out from each command, so it's basically a different protocol. We could embed that in the scheme as resp2: vs resp3:.

.... or we can just keep the redis schemes just for backward compatibility. I'm not sure we need a scheme anyway, do we?

Copy link
Member

Choose a reason for hiding this comment

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

As long as valkey-cli can accept "redis/rediss", I am fine with other options, "valkey" or "resp2/3".

@zuiderkwast, you have a good point that the scheme implies more than just the wire protocol but also the specific client behavior so this is more of a call on the client side.

@zuiderkwast
Copy link
Contributor

I'm going to merge this. It's the least surprising schemes for any forked clients and for users moving from redis-cli to valkey-cli.

We can change back if there are protests.

@zuiderkwast zuiderkwast merged commit 87a5bfc into valkey-io:unstable Apr 23, 2024
14 checks passed
@zuiderkwast zuiderkwast changed the title Support connection schemes: valkey://, valkeys://. Support connection schemes valkey:// and valkeys:// Apr 23, 2024
@zuiderkwast zuiderkwast added the release-notes This issue should get a line item in the release notes label Apr 23, 2024
@lipzhu lipzhu deleted the scheme branch April 23, 2024 02:59
PatrickJS pushed a commit to PatrickJS/placeholderkv that referenced this pull request Apr 24, 2024
1. Support valkey:// and valkeys:// scheme in valkey-cli and
valkey-benchmark. Retain the original Redis schemes for compatibility.
2. Add unit tests for valid URI, all schemes.

Fixes: valkey-io#198
Fixes: valkey-io#200

---------

Signed-off-by: Lipeng Zhu <[email protected]>
zuiderkwast pushed a commit that referenced this pull request Apr 25, 2024
)

When using a TLS scheme for valkey-cli and benchmark-cli compiled
without TLS, make the error message only mention the scheme used.

Before:

"valkeys:// and rediss:// are only supported when valkey-cli is compiled
with OpenSSL"

After, depending on which scheme the user tried to use:

"valkeys:// is only supported when valkey-cli is compiled with OpenSSL"
"rediss:// is only supported when valkey-cli is compiled with OpenSSL"

Follow up of #199.

---------

Signed-off-by: karthyuom <[email protected]>
Co-authored-by: k00809413 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes This issue should get a line item in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add tests for valkey-cli -u URI Rename connection scheme from redis:// to valkey:// .
6 participants