-
Notifications
You must be signed in to change notification settings - Fork 188
dm-master: join a new member into an existing cluster #350
Conversation
…-master-join # Conflicts: # dm/master/config.go # dm/master/etcd.go
# Conflicts: # _utils/terror_gen/errors_release.txt # dm/master/config.go # dm/master/etcd.go # pkg/terror/error_list.go
return terror.ErrMasterJoinEmbedEtcdFail.Delegate(err, "read persistent join data") | ||
} | ||
} else { | ||
cfg.InitialCluster = strings.TrimSpace(string(s)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please adding a log here shows that we use data of dir/join
as cfg. InitialCluster
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added in c9a413f.
|
||
// join with persistent data | ||
c.Assert(ioutil.WriteFile(joinFP, []byte(joinCluster), privateDirMode), check.IsNil) | ||
cfgAfter = t.cloneConfig(cfgBefore) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems we don't verify logic at L170 of etcd.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 Did you mean
cfg.InitialCluster = strings.Join(ms, ",")
if so, it's verified by // join with existing cluster
from L122 to L129 of etcd_test.go
Rest LGTM |
/run-all-tests |
LGTM |
@WangXiangUSTC PTAL again |
/run-all-tests tidb=release-3.0 |
/run-all-tests tidb=release-3.0 |
Codecov Report
@@ Coverage Diff @@
## master #350 +/- ##
================================================
- Coverage 58.6717% 57.6815% -0.9902%
================================================
Files 160 160
Lines 17436 16149 -1287
================================================
- Hits 10230 9315 -915
+ Misses 6250 5926 -324
+ Partials 956 908 -48 |
There was a problem hiding this 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/config.go
Outdated
@@ -65,6 +66,7 @@ func NewConfig() *Config { | |||
fs.StringVar(&cfg.InitialCluster, "initial-cluster", "", fmt.Sprintf("initial cluster configuration for bootstrapping, e,g. dm-master=%s", defaultPeerUrls)) | |||
fs.StringVar(&cfg.PeerUrls, "peer-urls", defaultPeerUrls, "URLs for peer traffic") | |||
fs.StringVar(&cfg.AdvertisePeerUrls, "advertise-peer-urls", "", `advertise URLs for peer traffic (default "${peer-urls}")`) | |||
fs.StringVar(&cfg.Join, "join", "", `join to an existing cluster (usage: cluster's "${advertise-client-urls}"`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems don't have config named advertise-client-urls
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a but, join
should be the address of clients (endpoints), but use peer address before, fixed in b0f5332.
dm/master/etcd.go
Outdated
// check members | ||
for _, m := range listResp.Members { | ||
if m.Name == "" { | ||
return terror.ErrMasterJoinEmbedEtcdFail.Generate("there is a member that has not joined successfully") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this means other member joined failed, but why prevent this member join? And how to fix this error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add some comments to explain it, and update the error message in b0f5332.
later maybe we can embed etcd client in dmctl?
for _, m := range addResp.Members { | ||
name := m.Name | ||
if m.ID == addResp.Member.ID { | ||
name = cfg.Name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if name is empty, will it generate err at L142?
@WangXiangUSTC we should check |
/run-all-test tidb=release-3.0 |
/run-all-tests tidb=release-3.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/run-all-tests tidb=release-3.0 |
1 similar comment
/run-all-tests tidb=release-3.0 |
What problem does this PR solve?
join a new member into an existing DM-master cluster.
What is changed and how it works?
prepare config for embed etcd to join an existing cluster
Check List
Tests
Code changes
Side effects
Related changes
dm/dm-ansible