Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

relay: start with the min binlog position in checkpoint #457

Merged
merged 30 commits into from
Feb 4, 2020

Conversation

WangXiangUSTC
Copy link
Contributor

What problem does this PR solve?

relay use the latest binlog position as default, if increment task migrate from dm-worker1 to dm-worker2, sync unit will get binlog from checkpoint's binlog position, and this position <= the latest position, so sync unit can't get the binlog.

What is changed and how it works?

get the min binlog position from all subtasks, and relay start with this min position.

Check List

Tests

  • Integration test

@WangXiangUSTC WangXiangUSTC added priority/important Major change, requires approval from ≥2 primary reviewers status/PTAL This PR is ready for review. Add this label back after committing new changes labels Jan 15, 2020
@@ -418,7 +425,7 @@ func (c *Coordinator) restartMysqlTask(w *Worker, cfg *config.MysqlConfig) bool
Op: pb.WorkerOp_StartWorker,
Config: task,
}
resp, err := w.OperateMysqlWorker(context.Background(), req, time.Second*3)
resp, err := w.OperateMysqlWorker(context.Background(), req, time.Second*5)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just add duration to let test pass, maybe @lichunzhu will fix it

pkg/binlog/position.go Outdated Show resolved Hide resolved
@WangXiangUSTC
Copy link
Contributor Author

this pr contain #451, we can merge 451 at the first, or review this pr directly and close 451 @lichunzhu @csuzhangxc

@lichunzhu
Copy link
Contributor

this pr contain #451, we can merge 451 at the first, or review this pr directly and close 451 @lichunzhu @csuzhangxc

@WangXiangUSTC I have already approved #451. If this PR runs fine in your machine, I think it's OK to merge it directly.

@WangXiangUSTC
Copy link
Contributor Author

/run-all-tests tidb=release-3.0

@WangXiangUSTC
Copy link
Contributor Author

/run-all-tests tidb=release-3.0

Copy link
Member

@csuzhangxc csuzhangxc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rest LGTM

dm/master/coordinator/coordinator.go Outdated Show resolved Hide resolved
dm/master/coordinator/coordinator.go Outdated Show resolved Hide resolved
dm/worker/worker.go Outdated Show resolved Hide resolved
relay/relay.go Outdated Show resolved Hide resolved
dm/worker/server.go Outdated Show resolved Hide resolved
dm/worker/server.go Outdated Show resolved Hide resolved
dm/worker/server.go Outdated Show resolved Hide resolved
dm/worker/server.go Outdated Show resolved Hide resolved
@@ -392,18 +392,26 @@ func (c *Coordinator) tryRestartMysqlTask() {
for hasTaskToSchedule {
select {
case source := <-c.waitingTask:
log.L().Info("try restart mysql task", zap.String("source", source))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually the log try restart mysql task info is not accurate here. The tasks started for the first time are also scheduled in this function. Check c.waitingTask in goland you will find the only read access is here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I update the log 70d6e8e

@WangXiangUSTC
Copy link
Contributor Author

/run-all-tests tidb=release-3.0

@WangXiangUSTC
Copy link
Contributor Author

/run-all-tests tidb=release-3.0

dm/worker/server.go Outdated Show resolved Hide resolved
dm/worker/server.go Outdated Show resolved Hide resolved
@WangXiangUSTC
Copy link
Contributor Author

/run-all-tests tidb=release-3.0

Copy link
Member

@csuzhangxc csuzhangxc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@csuzhangxc csuzhangxc added status/LGT1 One reviewer already commented LGTM and removed status/PTAL This PR is ready for review. Add this label back after committing new changes labels Jan 20, 2020
@csuzhangxc
Copy link
Member

@lichunzhu PTAL again.

lichunzhu
lichunzhu previously approved these changes Jan 21, 2020
Copy link
Contributor

@lichunzhu lichunzhu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lichunzhu lichunzhu dismissed their stale review January 21, 2020 16:42

The unit test didn't pass

@lichunzhu
Copy link
Contributor

The unit test didn't pass. Could you pls check it?

@WangXiangUSTC
Copy link
Contributor Author

/run-all-tests tidb=release-3.0

1 similar comment
@WangXiangUSTC
Copy link
Contributor Author

/run-all-tests tidb=release-3.0

@WangXiangUSTC
Copy link
Contributor Author

@lichunzhu I fix unit test in 7802a15 and 1f82f5a, PTAL again

Copy link
Contributor

@lichunzhu lichunzhu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@WangXiangUSTC WangXiangUSTC merged commit 256723e into ha-dev Feb 4, 2020
@WangXiangUSTC WangXiangUSTC deleted the xiang/relay-pos branch February 4, 2020 01:47
@WangXiangUSTC WangXiangUSTC added status/LGT2 Two reviewers already commented LGTM, ready for merge and removed status/LGT1 One reviewer already commented LGTM labels Feb 6, 2020
lichunzhu pushed a commit to lichunzhu/dm that referenced this pull request Apr 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
priority/important Major change, requires approval from ≥2 primary reviewers status/LGT2 Two reviewers already commented LGTM, ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants