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

dmctl: support and sync mutiple endpoints #1333

Merged
merged 13 commits into from
Dec 18, 2020

Conversation

GMHDBJD
Copy link
Collaborator

@GMHDBJD GMHDBJD commented Dec 11, 2020

What problem does this PR solve?

close #1278

What is changed and how it works?

sync etcd enpoints, dial dm-master before send request

Check List

Tests

  • Integration test
  • Manual test (add detailed scripts or steps below)
    connect dmctl to master clusters, kill one master, dmctl still can send request to others.

@GMHDBJD GMHDBJD added priority/normal Minor change, requires approval from ≥1 primary reviewer status/PTAL This PR is ready for review. Add this label back after committing new changes labels Dec 11, 2020
@lance6716
Copy link
Collaborator

lance6716 commented Dec 11, 2020

I changed CI in #1331 (no time to address comment yet), maybe you could copy the deletion of others_integration to this PR

@lance6716 lance6716 added this to the v2.0.1 milestone Dec 14, 2020
@csuzhangxc csuzhangxc added the needs-update-docs Should update docs after this PR is merged. Remove this label once the docs are updated label Dec 14, 2020
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/ctl/common/util.go Outdated Show resolved Hide resolved
cmd/dm-ctl/main.go Show resolved Hide resolved
@csuzhangxc csuzhangxc added the needs-cherry-pick-release-2.0 This PR should be cherry-picked to release-2.0. Remove this label after cherry-picked to release-2.0 label Dec 15, 2020
Copy link
Collaborator

@lance6716 lance6716 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/ctl/common/util.go Outdated Show resolved Hide resolved
tests/dmctl_basic/check_list/dmctl.sh Outdated Show resolved Hide resolved
dm/ctl/common/config.go Outdated Show resolved Hide resolved
@GMHDBJD
Copy link
Collaborator Author

GMHDBJD commented Dec 17, 2020

I use reflect to send request so now can reuse the previous conn

lance6716
lance6716 previously approved these changes Dec 18, 2020
Copy link
Collaborator

@lance6716 lance6716 left a comment

Choose a reason for hiding this comment

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

LGTM

defer c.mu.Unlock()

params := []reflect.Value{reflect.ValueOf(ctx), reflect.ValueOf(req)}
results := reflect.ValueOf(ctlClient.masterClient).MethodByName(reqName).Call(params)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
results := reflect.ValueOf(ctlClient.masterClient).MethodByName(reqName).Call(params)
results := reflect.ValueOf(c.masterClient).MethodByName(reqName).Call(params)

OK to not change because we use a "global" CtlClient

}

func (c *CtlClient) sendRequest(ctx context.Context, reqName string, req interface{}, respPointer interface{}) error {
c.mu.Lock()
Copy link
Collaborator

Choose a reason for hiding this comment

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

RLock but OK to not change, because that's a not frequently used command

@GMHDBJD GMHDBJD 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 Dec 18, 2020
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/LGT2 Two reviewers already commented LGTM, ready for merge and removed status/LGT1 One reviewer already commented LGTM labels Dec 18, 2020
@csuzhangxc csuzhangxc merged commit e5c5de8 into pingcap:master Dec 18, 2020
ti-srebot pushed a commit to ti-srebot/dm that referenced this pull request Dec 18, 2020
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link

cherry pick to release-2.0 in PR #1349

@ti-srebot ti-srebot added already-cherry-pick-2.0 The related PR is already cherry-picked to release-2.0. Add this label once the PR is cherry-picked and removed needs-cherry-pick-release-2.0 This PR should be cherry-picked to release-2.0. Remove this label after cherry-picked to release-2.0 labels Dec 18, 2020
csuzhangxc pushed a commit that referenced this pull request Dec 24, 2020
Co-authored-by: GMHDBJD <35025882+GMHDBJD@users.noreply.github.com>
Co-authored-by: lance6716 <lance6716@gmail.com>
Co-authored-by: gmhdbjd <gmhdbjd@gmail.com>
@lance6716 lance6716 added already-update-docs The docs related to this PR already updated. Add this label once the docs are updated and removed needs-update-docs Should update docs after this PR is merged. Remove this label once the docs are updated labels Dec 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
already-cherry-pick-2.0 The related PR is already cherry-picked to release-2.0. Add this label once the PR is cherry-picked already-update-docs The docs related to this PR already updated. Add this label once the docs are updated priority/normal Minor change, requires approval from ≥1 primary reviewer status/LGT2 Two reviewers already commented LGTM, ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set default value for --master-addr or give clear error msg
4 participants