Fix target db select bug (#370)

v4
chenyang8094 3 years ago committed by GitHub
parent 92b0334869
commit cc226f841e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      src/redis-shake/dbSync/syncIncrease.go

@ -149,6 +149,7 @@ func (ds *DbSyncer) receiveTargetReply(c redigo.Conn) {
func (ds *DbSyncer) parseSourceCommand(reader *bufio.Reader) {
var (
lastDb = -1
selectDB = -1
bypass = false
isSelect = false
sCmd string
@ -198,7 +199,7 @@ func (ds *DbSyncer) parseSourceCommand(reader *bufio.Reader) {
}
bypass = filter.FilterDB(n)
isSelect = true
lastDb = n
selectDB = n
} else if filter.FilterCommands(sCmd) {
ignoreCmd = true
} else if strings.EqualFold(sCmd, "publish") && strings.EqualFold(string(argv[0]), "__sentinel__:hello") {
@ -239,7 +240,7 @@ func (ds *DbSyncer) parseSourceCommand(reader *bufio.Reader) {
metric.GetMetric(ds.id).AddBypassCmdCount(ds.id, 1)
}
continue
} else if tdb, ok := conf.Options.TargetDBMap[int(lastDb)]; ok {
} else if tdb, ok := conf.Options.TargetDBMap[int(selectDB)]; ok {
if tdb != lastDb {
lastDb = tdb
/* send select command. */

Loading…
Cancel
Save