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

*: last bound source is prior to other source when pick for bound (#1373) #1397

Merged
merged 1 commit into from
Jan 23, 2021

Conversation

ti-srebot
Copy link

@ti-srebot ti-srebot commented Jan 23, 2021

cherry-pick #1373 to release-2.0
You can switch your code base to this Pull Request by using git-extras:

# In dm repo:
git pr https://github.com/pingcap/dm/pull/1397

After apply modifications, you can push your change to this PR via:

git push git@github.com:ti-srebot/dm.git pr/1397:release-2.0-673fb1b7069b

What problem does this PR solve?

similar to #1044

when DM cluster restarts, worker is not likely keepalive when master goes to below logic, because etcd is in masters

// set the stage as Free if it's keep alive.
if _, ok := kam[name]; ok {
w.ToFree()
// set the stage as Bound and record the bound relationship if exists.
if bound, ok := sbm[name]; ok {
boundsToTrigger = append(boundsToTrigger, bound)
err2 = s.updateStatusForBound(w, bound)
if err2 != nil {
return 0, err2
}
delete(sbm, name)
}
}

so worker is likely bounded to another source rather than its last source.

What is changed and how it works?

we always save a lastBound when do bounding, and not delete it. so when tryBoundForWorker, we could prefer selecting the last bound source for worker.

Also, if user didn't deploy more workers than sources, the bound relationship will not change (I hope)

Check List

Tests

  • Unit test
  • Integration test

Code changes

  • Has persistent data change

Side effects

Related changes

  • Need to cherry-pick to the release branch

Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot ti-srebot added needs-update-docs Should update docs after this PR is merged. Remove this label once the docs are updated needs-update-release-note This PR should be added into release notes. Remove this label once the release notes are updated type/cherry-pick This PR is just a cherry-pick (backport) labels Jan 23, 2021
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

@lance6716 lance6716 merged commit bb5f6f0 into pingcap:release-2.0 Jan 23, 2021
@lance6716 lance6716 removed the needs-update-docs Should update docs after this PR is merged. Remove this label once the docs are updated label Feb 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs-update-release-note This PR should be added into release notes. Remove this label once the release notes are updated type/cherry-pick This PR is just a cherry-pick (backport)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants