Skip to content

Commit

Permalink
No need to print WARNING message while receiving the null reply (#805)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
git-hulk authored May 22, 2024
1 parent b3c3352 commit 2c9b94f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# system
.idea/
__pycache__/
.DS_Store/
.DS_Store

# compiled output or test output
bin/
Expand Down
8 changes: 5 additions & 3 deletions internal/writer/redis_standalone_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package writer

import (
"context"
"errors"
"fmt"
"strconv"
"strings"
Expand Down Expand Up @@ -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())
Expand Down

0 comments on commit 2c9b94f

Please sign in to comment.