No need to print WARNING message while receiving the null reply (#805)
Currently, the writer will print the warning log if received the null reply. And it might confusing users since some write commands like the SET with the NX option will return null reply if the key has already existed.
This commit is contained in:
parent
b3c3352aaf
commit
2c9b94f786
|
@ -1,7 +1,7 @@
|
|||
# system
|
||||
.idea/
|
||||
__pycache__/
|
||||
.DS_Store/
|
||||
.DS_Store
|
||||
|
||||
# compiled output or test output
|
||||
bin/
|
||||
|
|
|
@ -2,6 +2,7 @@ package writer
|
|||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
@ -99,9 +100,10 @@ func (w *redisStandaloneWriter) processReply() {
|
|||
for e := range w.chWaitReply {
|
||||
reply, err := w.client.Receive()
|
||||
log.Debugf("[%s] receive reply. reply=[%v], cmd=[%s]", w.stat.Name, reply, e.String())
|
||||
if err == proto.Nil {
|
||||
log.Warnf("[%s] receive nil reply. cmd=[%s]", w.stat.Name, e.String())
|
||||
} else if err != nil {
|
||||
|
||||
// It's good to skip the nil error since some write commands will return the null reply. For example,
|
||||
// the SET command with NX option will return nil if the key already exists.
|
||||
if err != nil && !errors.Is(err, proto.Nil) {
|
||||
if err.Error() == "BUSYKEY Target key name already exists." {
|
||||
if config.Opt.Advanced.RDBRestoreCommandBehavior == "skip" {
|
||||
log.Debugf("[%s] redisStandaloneWriter received BUSYKEY reply. cmd=[%s]", w.stat.Name, e.String())
|
||||
|
|
Loading…
Reference in New Issue