From bb96149325f7ce0cf10e4e2cc326a85c3987e080 Mon Sep 17 00:00:00 2001 From: vinllen Date: Wed, 24 Jul 2019 10:16:19 +0800 Subject: [PATCH] add debug log in RDB syncing --- src/redis-shake/common/cluster.go | 8 ++++++++ src/redis-shake/restore.go | 2 ++ src/redis-shake/sync.go | 1 + 3 files changed, 11 insertions(+) diff --git a/src/redis-shake/common/cluster.go b/src/redis-shake/common/cluster.go index a4cbeb7..8bf9df5 100644 --- a/src/redis-shake/common/cluster.go +++ b/src/redis-shake/common/cluster.go @@ -7,6 +7,10 @@ import ( "pkg/libs/log" ) +const( + RecvChanSize = 4096 +) + /* implement redigo.Conn(https://github.com/garyburd/redigo) * Embed redis-go-cluster(https://github.com/chasex/redis-go-cluster) * The reason I create this struct is that redis-go-cluster isn't fulfill redigo.Conn @@ -24,6 +28,10 @@ type reply struct { } func NewClusterConn(clusterClient *redigoCluster.Cluster, recvChanSize int) redigo.Conn { + if recvChanSize == 0 { + recvChanSize = RecvChanSize + } + return &ClusterConn{ client: clusterClient, recvChan: make(chan reply, recvChanSize), diff --git a/src/redis-shake/restore.go b/src/redis-shake/restore.go index ef1fef9..6286a58 100644 --- a/src/redis-shake/restore.go +++ b/src/redis-shake/restore.go @@ -174,6 +174,8 @@ func (dr *dbRestorer) restoreRDBFile(reader *bufio.Reader, target []string, auth continue } utils.RestoreRdbEntry(c, e) + + log.Debugf("routine[%v] restore key[%s] with value length[%v]", dr.id, e.Key, len(e.Value)) } } }() diff --git a/src/redis-shake/sync.go b/src/redis-shake/sync.go index 1545695..a3e126f 100644 --- a/src/redis-shake/sync.go +++ b/src/redis-shake/sync.go @@ -439,6 +439,7 @@ func (ds *dbSyncer) syncRDBFile(reader *bufio.Reader, target []string, auth_type } } utils.RestoreRdbEntry(c, e) + log.Debugf("dbSyncer[%v] restore key[%s] with value length[%v]", ds.id, e.Key, len(e.Value)) } } }()