This is an automated email from the ASF dual-hosted git repository.

twice pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/kvrocks.git


The following commit(s) were added to refs/heads/unstable by this push:
     new a320c9020 chore(info): change redis compatibility version to 7.0.0 
(#3286)
a320c9020 is described below

commit a320c90205bbe7a289e197470cd380a41e81f357
Author: i18n.site <[email protected]>
AuthorDate: Tue Dec 23 22:19:10 2025 +0800

    chore(info): change redis compatibility version to 7.0.0 (#3286)
    
    Close https://github.com/apache/kvrocks/issues/3285.
    
    
    ## Root Cause Analysis
    
    The issue occurs because Kvrocks reports its Redis version as `4.0.0`
    (defined in `src/server/server.h:61`), while RESP3 protocol was
    introduced in Redis 6.0.
    
    **Most Redis client libraries perform version checking before attempting
    to use RESP3.** When clients see a server version below 6.0, they skip
    the `HELLO 3` command entirely and default to RESP2, even if the server
    actually supports RESP3.
    
    ### How Redis Clients Check Version
    
    1. Client connects to Redis/Kvrocks
    2. Client checks server version (via `INFO` or `HELLO` response)
    3. **If version < 6.0**: Client assumes RESP3 is not supported and uses
    RESP2
    4. **If version >= 6.0**: Client sends `HELLO 3` to negotiate RESP3
    
    ### Why This Affects Sentinel Connections
    
    When connecting through Redis Sentinel:
    - Sentinel provides the master address to the client
    - Client connects to the master and checks its version
    - If Kvrocks reports version `4.0.0`, the client library won't attempt
    RESP3
    - This happens regardless of the `resp3-enabled` configuration
    
    ## Solution
    
    **Update `REDIS_VERSION` from `"4.0.0"` to `"7.0.0"`** in
    `src/server/server.h`.
    
    ### Why 7.0.0 Instead of 6.0.0?
    
    While RESP3 was introduced in Redis 6.0, **Redis 7.0 is the first
    version with full, production-ready RESP3 support**. Some client
    libraries may have additional checks or optimizations specifically for
    Redis 7.0+. Using version `7.0.0` ensures maximum compatibility with all
    modern Redis clients.
    
    ### Code Change Required
    
    ```cpp
    // src/server/server.h:61
    -constexpr const char *REDIS_VERSION = "4.0.0";
    +constexpr const char *REDIS_VERSION = "7.0.0";
    ```
    
    ### Test Updates
    
    Also update the test expectations in:
    - `tests/gocase/unit/hello/hello_test.go` (lines 48, 57)
    
    ```go
    -require.EqualValues(t, "4.0.0", rList[3])
    +require.EqualValues(t, "7.0.0", rList[3])
    ```
    
    Co-authored-by: Aleks Lozovyuk <[email protected]>
    Co-authored-by: hulk <[email protected]>
---
 src/server/server.h                         | 2 +-
 tests/gocase/unit/hello/hello_test.go       | 4 ++--
 tests/gocase/unit/protocol/protocol_test.go | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/server/server.h b/src/server/server.h
index 597ea00ae..845930150 100644
--- a/src/server/server.h
+++ b/src/server/server.h
@@ -58,7 +58,7 @@
 #include "tls_util.h"
 #include "worker.h"
 
-constexpr const char *REDIS_VERSION = "4.0.0";
+constexpr const char *REDIS_VERSION = "7.0.0";
 
 struct DBScanInfo {
   // Last scan system clock in seconds
diff --git a/tests/gocase/unit/hello/hello_test.go 
b/tests/gocase/unit/hello/hello_test.go
index c3ab91349..23dc87bb2 100644
--- a/tests/gocase/unit/hello/hello_test.go
+++ b/tests/gocase/unit/hello/hello_test.go
@@ -45,7 +45,7 @@ func TestHello(t *testing.T) {
                r := rdb.Do(ctx, "HELLO", "2")
                rList := r.Val().([]interface{})
                require.EqualValues(t, "version", rList[2])
-               require.EqualValues(t, "4.0.0", rList[3])
+               require.EqualValues(t, "7.0.0", rList[3])
                require.EqualValues(t, "proto", rList[4])
                require.EqualValues(t, 2, rList[5])
        })
@@ -54,7 +54,7 @@ func TestHello(t *testing.T) {
                r := rdb.Do(ctx, "HELLO", "3")
                rList := r.Val().([]interface{})
                require.EqualValues(t, "version", rList[2])
-               require.EqualValues(t, "4.0.0", rList[3])
+               require.EqualValues(t, "7.0.0", rList[3])
                require.EqualValues(t, "proto", rList[4])
                require.EqualValues(t, 2, rList[5])
        })
diff --git a/tests/gocase/unit/protocol/protocol_test.go 
b/tests/gocase/unit/protocol/protocol_test.go
index a533bfde9..fbf9f42c5 100644
--- a/tests/gocase/unit/protocol/protocol_test.go
+++ b/tests/gocase/unit/protocol/protocol_test.go
@@ -248,7 +248,7 @@ func handshakeWithRESP3(t *testing.T, c *util.TCPClient) {
        require.NoError(t, c.WriteArgs("HELLO", "3"))
        values := []string{"%6",
                "$6", "server", "$5", "redis",
-               "$7", "version", "$5", "4.0.0",
+               "$7", "version", "$5", "7.0.0",
                "$5", "proto", ":3",
                "$4", "mode", "$10", "standalone",
                "$4", "role", "$6", "master",

Reply via email to