Browse Source

etcdserver: skip bootstrap addNode entry

This is a hack to make etcd work normally.
Yicheng Qin 11 years ago
parent
commit
cdea98d434
1 changed files with 8 additions and 0 deletions
  1. 8 0
      etcdserver/server.go

+ 8 - 0
etcdserver/server.go

@@ -526,6 +526,14 @@ func (s *EtcdServer) applyConfChange(cc raftpb.ConfChange) {
 	s.node.ApplyConfChange(cc)
 	switch cc.Type {
 	case raftpb.ConfChangeAddNode:
+		// TODO(yichengq): this is the hack and should be removed SOON.
+		// Bootstrap write addNode entries into log, which don't set Context
+		// value. They don't need to be applied because now we do it explicitly
+		// before server starts. This hack makes etcd work, and will be removed
+		// in the following PR.
+		if cc.Context == nil {
+			break
+		}
 		var m Member
 		if err := json.Unmarshal(cc.Context, &m); err != nil {
 			panic("unexpected unmarshal error")