Skip to content

Commit

Permalink
drainer: make sure to sync binlog in ascending commitTS order (#123)
Browse files Browse the repository at this point in the history
* drainer: make sure to sync binlog in ascending commitTS order
  • Loading branch information
IANTHEREAL authored Feb 27, 2017
1 parent 8cce9ed commit c79d23f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions drainer/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -478,10 +478,15 @@ func (d *Executor) run(b *binlogItem) error {
go d.sync(d.toDBs[i], d.jobCh[i])
}

maxCommitTS := d.initCommitTS
for {
binlog := b.binlog
commitTS := binlog.GetCommitTs()
jobID := binlog.GetDdlJobId()
if commitTS <= maxCommitTS {
continue
}
maxCommitTS = commitTS

if jobID == 0 {
preWriteValue := binlog.GetPrewriteValue()
Expand Down
2 changes: 1 addition & 1 deletion drainer/pump.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func (p *Pump) mustFindCommitBinlog(t *tikv.LockResolver, startTS int64) {
default:
}

b, ok := p.getPrewriteBinlogEntity(startTS)
b, ok := p.getPrewriteBinlogEntity(startTS)
if ok {
time.Sleep(waitTime)
// check again after sleep a moment
Expand Down

0 comments on commit c79d23f

Please sign in to comment.