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:
hulk 2024-05-22 16:54:11 +08:00 committed by GitHub
parent b3c3352aaf
commit 2c9b94f786
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 4 deletions

2
.gitignore vendored
View File

@ -1,7 +1,7 @@
# system
.idea/
__pycache__/
.DS_Store/
.DS_Store
# compiled output or test output
bin/

View File

@ -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())