Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

etcdserver: allow to update attributes of removed member #2939

Merged
merged 1 commit into from
Jun 10, 2015

Conversation

yichengq
Copy link
Contributor

@yichengq yichengq commented Jun 9, 2015

There exist the possiblity to update attributes of removed member in
reasonable workflow:

  1. start member A
  2. leader receives the proposal to remove member A
  3. member A sends the proposal of update its attribute to the leader
  4. leader commits the two proposals
    So etcdserver should allow to update attributes of removed member.

fixes case 1 and 3 of #2904

I have manually tested that the patch works.
@spacejam Could you double-check that it works?

@@ -319,7 +319,13 @@ func (c *cluster) RemoveMember(id types.ID) {
func (c *cluster) UpdateAttributes(id types.ID, attr Attributes) {
c.Lock()
defer c.Unlock()
c.members[id].Attributes = attr
if m, ok := c.members[id]; ok {
Copy link
Contributor

Choose a reason for hiding this comment

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

if m, ok := c.members[id]; ok {
    m.Attributes = attr
    return
}

_, ok := c.removed[id]
if ok {
    ...
} else {
    ...
}

@xiang90
Copy link
Contributor

xiang90 commented Jun 9, 2015

LGTM

@yichengq yichengq force-pushed the fix-update-attr branch 2 times, most recently from 4ab3cb0 to 46ebcff Compare June 9, 2015 06:04
@xiang90
Copy link
Contributor

xiang90 commented Jun 9, 2015

It would be great if we can add a test case for it in integration test.

@yichengq yichengq force-pushed the fix-update-attr branch 2 times, most recently from 7484df5 to 31494a5 Compare June 10, 2015 06:09
@yichengq
Copy link
Contributor Author

unit test and integration test added.

@@ -270,6 +270,33 @@ func TestIssue2746(t *testing.T) {
clusterMustProgress(t, c.Members)
}

// Ensure etcd can update attribute of removed member
Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure etcd will not panic when removing a just started member.

@yichengq
Copy link
Contributor Author

rebased and improved comment in integration test. :)

ma := client.NewMembersAPI(cc)
ctx, cancel := context.WithTimeout(context.Background(), requestTimeout)
// the proposal is not committed because member 1 is stopped, but the
// proposal is written to leader's raft log.
Copy link
Contributor

Choose a reason for hiding this comment

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

is appended to

@xiang90
Copy link
Contributor

xiang90 commented Jun 10, 2015

LGTM

There exist the possiblity to update attributes of removed member in
reasonable workflow:
1. start member A
2. leader receives the proposal to remove member A
2. member A sends the proposal of update its attribute to the leader
3. leader commits the two proposals
So etcdserver should allow to update attributes of removed member.
yichengq added a commit that referenced this pull request Jun 10, 2015
etcdserver: allow to update attributes of removed member
@yichengq yichengq merged commit cd629c9 into etcd-io:master Jun 10, 2015
@yichengq yichengq deleted the fix-update-attr branch June 10, 2015 23:53
@puneetzaroo
Copy link

I believe I am seeing this issue on 2.0.13. Will this fix be back-ported ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants