Open
Description
Before all, please see this issue
The path to reproduce this issue:
- First, we create a new redis cluster in
cluster-preferred-endpoint-type unknown-endpoint
mode:
cd /path/to/redis/repo
make
cd src
mkdir 7001
mkdir 7002
mkdir 7003
echo "port 7001\ncluster-enabled yes\ncluster-config-file nodes.conf\ncluster-node-timeout 5000\nappendonly yes\ncluster-preferred-endpoint-type unknown-endpoint" > 7001/redis.conf
echo "port 7002\ncluster-enabled yes\ncluster-config-file nodes.conf\ncluster-node-timeout 5000\nappendonly yes\ncluster-preferred-endpoint-type unknown-endpoint" > 7002/redis.conf
echo "port 7003\ncluster-enabled yes\ncluster-config-file nodes.conf\ncluster-node-timeout 5000\nappendonly yes\ncluster-preferred-endpoint-type unknown-endpoint" > 7003/redis.conf
cd 7001
nohup ../redis-server redis.conf &
cd ..
cd 7002
nohup ../redis-server redis.conf &
cd ..
cd 7003
nohup ../redis-server redis.conf &
cd ..
sleep 5 # wait for redis starts
./redis-cli --cluster-yes --cluster create 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003
- Then, try to update the key
foo
:
package main
import (
"context"
"fmt"
"github.com/redis/go-redis/v9"
)
func main() {
ctx := context.Background()
cluster := redis.NewClusterClient(&redis.ClusterOptions{
Addrs: []string{":7001"},
})
foo, err := cluster.Set(ctx, "foo", "barr", 0).Result()
fmt.Println(foo, err) // Output: <space>redis: nil
bar, err := cluster.Get(ctx, "foo").Result()
fmt.Println(foo, err, bar) // Output: <space>redis: nil
}
It returns redis: Nil
in this line, node, err = c.cmdNode(ctx, cmdInfo, slot)
, which makes it confusing that the Set
command seems to be processed correctly.