diff --git a/.gitignore b/.gitignore index d864178d..e3f9908b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ # system .idea/ __pycache__/ -.DS_Store/ +.DS_Store # compiled output or test output bin/ diff --git a/internal/writer/redis_standalone_writer.go b/internal/writer/redis_standalone_writer.go index 8fc25fe2..bcbc29d4 100644 --- a/internal/writer/redis_standalone_writer.go +++ b/internal/writer/redis_standalone_writer.go @@ -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())