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: record removed member to check incoming message #1343

Merged
merged 5 commits into from
Oct 22, 2014

Conversation

yichengq
Copy link
Contributor

I put removed member in a new directory other than members because 1. removed members has no need to record raftAttributes and attributes anymore 2. removed members have different use case from active members, and they don't need to be fetched at the same time

@@ -116,10 +117,26 @@ func nodeToMember(n *store.NodeExtern) (Member, error) {
// Remove removes a member from the store.
// The given id MUST exist.
func (s *clusterStore) Remove(id uint64) {
p := s.Get().FindID(id).storeKey()
if _, err := s.Store.Delete(p, true, true); err != nil {
if _, err := s.Store.Delete(Member{ID: id}.storeKey(), true, true); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

memberStoreKey(id uint64)? so it is consistent with removedMemberStoreKey

Copy link
Contributor Author

Choose a reason for hiding this comment

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

more than glad to do that.

@yichengq yichengq force-pushed the 175 branch 2 times, most recently from c3f5564 to 386b619 Compare October 22, 2014 01:02
@yichengq
Copy link
Contributor Author

have addressed all comments.

if err := h.server.Process(context.TODO(), m); err != nil {
log.Println("etcdhttp: error processing raft message:", err)
writeError(w, err)
switch err {
case etcdserver.ErrRemoved:
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry for not being clear previously. here is what i want:

// Validate validates the incoming messages.
if err := h.server.Validate(m); err != nil {
    ...
}
// stats logic
// process logic

@xiang90
Copy link
Contributor

xiang90 commented Oct 22, 2014

lgtm. actually i do not have a strong opinion on fixing the validation stuff right now. I do hope we can consolidate the validation logic: clusterID checking, removed node checking, and nodeID checking in the future.

@@ -43,6 +43,7 @@ type ClusterStore interface {
Add(m Member)
Get() Cluster
Remove(id uint64)
IsRemoved(id uint64) bool
Copy link
Contributor

Choose a reason for hiding this comment

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

The naming in the interface is getting messy:
probably this is cleaner

GetCluster() Cluster
GetMember() Member
AddMember(m Member)
RemoveMember(id uint64)
IsRemovedMember(id uint64) bool

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is kind of confused now..
let us settle this down after clusterstore becomes stable.

@yichengq
Copy link
Contributor Author

let us do validation stuff in the follow ups.
I wanna put the validation in one function or file/place for easy management too.
/cc @jonboulle

log.Panicf("delete peer should never fail: %v", err)
}
if _, err := s.Store.Create(removedMemberStoreKey(id), false, "", false, store.Permanent); err != nil {
log.Panicf("unexpected creating removed member error: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

this is awkward, how about just "creating RemovedMember should never fail: %v"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

kk

@jonboulle
Copy link
Contributor

lgtm

@jonboulle jonboulle added this to the v0.5.0-alpha milestone Oct 22, 2014
yichengq added a commit that referenced this pull request Oct 22, 2014
etcdserver: record removed member to check incoming message
@yichengq yichengq merged commit 6b32395 into etcd-io:master Oct 22, 2014
@yichengq yichengq deleted the 175 branch October 22, 2014 18:16
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