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

Add support for resp3 protocol #1739

Merged
merged 6 commits into from
Apr 27, 2021
Merged

Add support for resp3 protocol #1739

merged 6 commits into from
Apr 27, 2021

Conversation

monkey92t
Copy link
Collaborator

@monkey92t monkey92t commented Apr 26, 2021

  1. Support redis RESP3 protocol, can work under RESP2 and RESP3.
  2. If redis-server version >=6.0, RESP3 protocol is enabled by default. Otherwise use RESP2 protocol (redis < 6.0).
  3. Remove test Subscribe __redis__:invalidate, it only works in RESP2 mode(redis6.0+).
  4. $EOF:<40 bytes marker><CR><LF> and *?<CR><LF> that have not been enabled by redis-server have not been implemented for the time being, they will be followed up in the future.

Signed-off-by: monkey <golang@88.com>
redis#1715 (comment)

Signed-off-by: monkey <golang@88.com>
Signed-off-by: monkey <golang@88.com>
Signed-off-by: monkey <golang@88.com>
Signed-off-by: monkey <golang@88.com>
commands.go Outdated Show resolved Hide resolved
@vmihailenco
Copy link
Collaborator

If redis-server version >=6.0, RESP3 protocol is enabled by default. Otherwise use RESP2 protocol (redis < 6.0).

It looks like the code always uses https://redis.io/commands/hello to switch to RESP3. And HELLO is only available since v6.0.0. So I guess v9 branch

  • does not support Redis < 6.0
  • always uses RESP3

Which is fine - I just want to confirm my understanding.

Signed-off-by: monkey <golang@88.com>
@monkey92t
Copy link
Collaborator Author

monkey92t commented Apr 27, 2021

If redis-server version >=6.0, RESP3 protocol is enabled by default. Otherwise use RESP2 protocol (redis < 6.0).

It looks like the code always uses https://redis.io/commands/hello to switch to RESP3. And HELLO is only available since v6.0.0. So I guess v9 branch

  • does not support Redis < 6.0
  • always uses RESP3

Which is fine - I just want to confirm my understanding.

If conn.HELLO(ctx, 3) fails to execute (redis<6.0), there will be no error, and it will continue to use RESP2 to execute commands.
If redis-server >= 6.0, HELLO is executed successfully and RESP3 is used.

In redis5 or lower version, it can work normally.

@vmihailenco vmihailenco merged commit 8ad0124 into redis:v9 Apr 27, 2021
@vmihailenco
Copy link
Collaborator

Awesome, thanks.

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