Skip to content

Commit

Permalink
fix bug of isn't work in cascade replication scenario, see #277
Browse files Browse the repository at this point in the history
  • Loading branch information
vinllen committed May 6, 2020
1 parent 133ebb1 commit 2d6ac63
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2020-05-06 Alibaba Cloud.
* VERSION: 2.0.2
* BUGFIX: fix bug of `target.db` isn't work in cascade replication
scenario. see #277.
2020-05-02 Alibaba Cloud.
* VERSION: 2.0.1
* IMPROVE: rebase v1.6.28.
Expand Down
14 changes: 12 additions & 2 deletions src/redis-shake/dbSync/syncIncrease.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,19 @@ func (ds *DbSyncer) parseSourceCommand(reader *bufio.Reader) {
// sendMarkId atomic2.Int64 // sendMarkId is also used as mark the sendId in sender routine
)

// if the start db id != 0, send dbid to the target at first
// if enable target.db
if conf.Options.TargetDB != -1 {
ds.startDbId = conf.Options.TargetDB
}

/*
* if the start db id != 0, send dbid to the target at first.
* there're two cases that the statDbId != 0:
* 1. enable target.db. see #277.
* 2. start from resume-from-break-point
*/
if ds.startDbId != 0 {
log.Infof("last dbid[%v] != 0, send 'select' first", ds.startDbId)
log.Infof("start dbid[%v] != 0, send 'select' first", ds.startDbId)
dbS := fmt.Sprintf("%d", ds.startDbId)
ds.sendBuf <- cmdDetail{
Cmd: "select",
Expand Down

0 comments on commit 2d6ac63

Please sign in to comment.