Closed
Description
I setup a redis cluster with 2 nodes(1 master and 1 slave) and tried to test go-redis client side behaviour using the code below
func ConnectRedisTarget() *ClusterClient {
return NewClusterClient(&ClusterOptions{
Addrs: []string{
"127.0.0.1:6666",
},
ReadOnly: true,
})
}
func TestOne(t *testing.T) {
c := ConnectRedisTarget()
ctx := context.Background()
for i := 0; i < 100; i++ {
p := c.Pipeline()
p.Get(ctx, "c")
cs, err := p.Exec(ctx)
if err != nil {
fmt.Println("err from c " + fmt.Sprint(err))
} else {
for _, cmder := range cs {
fmt.Println(cmder.String())
}
}
p.Get(ctx, "a")
cs, err = p.Exec(ctx)
if err != nil {
fmt.Println("err from a " + fmt.Sprint(err))
fmt.Println(err)
} else {
for _, cmder := range cs {
fmt.Println(cmder.String())
}
}
time.Sleep(time.Second * 5)
}
}
The key 'a' is in redis and 'c' is not in redis.
Expected Behavior
It always prints
err from c redis: nil
get a: 1
Current Behavior
It prints
err from c dial tcp 127.0.0.1:6666: connect: connection refused
err from a dial tcp 127.0.0.1:6666: connect: connection refused
dial tcp 127.0.0.1:6666: connect: connection refused
after I shutdown the master node
Possible Solution
Don't mark node as failing when error Nil happens.
Steps to Reproduce
- Setup a redis cluster with one master and one slave and run 'set a=1' to set value for key 'a'
- Run the testing code and it will print the expected messages
- Shutdown the master node
- You can see the error message now
Context (Environment)
Detailed Description
Possible Implementation
Metadata
Metadata
Assignees
Labels
No labels