make sure cluster.Nodes[].IsCoordinator values get updated. return old coordinator node in response.

This commit is contained in:
Travis Turner 2018-03-08 14:18:10 -06:00
parent fa4e543e84
commit 2a462d5e42
No known key found for this signature in database
GPG key ID: 7F08008DFD9314C9
7 changed files with 295 additions and 108 deletions

View file

@ -134,6 +134,7 @@ const (
MessageTypeResizeInstruction
MessageTypeResizeInstructionComplete
MessageTypeSetCoordinator
MessageTypeUpdateCoordinator
MessageTypeNodeState
MessageTypeRecalculateCaches
MessageTypeNodeEvent
@ -173,6 +174,8 @@ func MarshalMessage(m proto.Message) ([]byte, error) {
typ = MessageTypeResizeInstructionComplete
case *internal.SetCoordinatorMessage:
typ = MessageTypeSetCoordinator
case *internal.UpdateCoordinatorMessage:
typ = MessageTypeUpdateCoordinator
case *internal.NodeStateMessage:
typ = MessageTypeNodeState
case *internal.RecalculateCaches:
@ -225,6 +228,8 @@ func UnmarshalMessage(buf []byte) (proto.Message, error) {
m = &internal.ResizeInstructionComplete{}
case MessageTypeSetCoordinator:
m = &internal.SetCoordinatorMessage{}
case MessageTypeUpdateCoordinator:
m = &internal.UpdateCoordinatorMessage{}
case MessageTypeNodeState:
m = &internal.NodeStateMessage{}
case MessageTypeRecalculateCaches:

View file

@ -309,20 +309,51 @@ func (c *Cluster) IsCoordinator() bool {
return c.Coordinator == c.Node.ID
}
// SetCoordinator updates the Coordinator to n.
// Returns true if the Coordinator changed.
func (c *Cluster) SetCoordinator(n *Node) bool {
// Get new node.
newNode := c.nodeByID(n.ID)
if newNode == nil {
return false
// SetCoordinator tells the current node to become the
// Coordinator. In response to this, the current node
// will consider itself coordinator and update the other
// nodes with its version of Cluster.Status.
func (c *Cluster) SetCoordinator(n *Node) error {
// Verify that the new Coordinator value matches
// this node.
if c.Node.ID != n.ID {
return fmt.Errorf("coordinator node does not match this node")
}
if c.Coordinator != newNode.ID {
c.Coordinator = newNode.ID
return true
// Update IsCoordinator on all nodes (locally).
_ = c.UpdateCoordinator(n)
// Send the update coordinator message to all nodes.
err := c.Broadcaster.SendSync(
&internal.UpdateCoordinatorMessage{
New: EncodeNode(n),
})
if err != nil {
return fmt.Errorf("problem sending UpdateCoordinator message: %v", err)
}
return false
// Broadcast cluster status.
return c.Broadcaster.SendSync(c.Status())
}
// UpdateCoordinator updates this nodes Coordinator value as well as
// changing the corresponding node's IsCoordinator value
// to true, and sets all other nodes to false. Returns true if the value
// changed.
func (c *Cluster) UpdateCoordinator(n *Node) bool {
var changed bool
if c.Coordinator != n.ID {
c.Coordinator = n.ID
changed = true
}
for _, node := range c.Nodes {
if node.ID == n.ID {
node.IsCoordinator = true
} else {
node.IsCoordinator = false
}
}
return changed
}
// AddNode adds a node to the Cluster and updates and saves the

View file

@ -509,22 +509,22 @@ func TestCluster_ResizeStates(t *testing.T) {
}
// Ensures that coordinator can be changed.
func TestCluster_SetCoordinator(t *testing.T) {
t.Run("SetCoordinator", func(t *testing.T) {
func TestCluster_UpdateCoordinator(t *testing.T) {
t.Run("UpdateCoordinator", func(t *testing.T) {
c := test.NewCluster(2)
oldNode := c.Nodes[0]
newNode := c.Nodes[1]
// Set coordinator to the same value.
if c.SetCoordinator(oldNode) {
// Update coordinator to the same value.
if c.UpdateCoordinator(oldNode) {
t.Errorf("did not expect coordinator to change")
} else if c.Coordinator != oldNode.ID {
t.Errorf("expected coordinator: %s, but got: %s", c.Coordinator, oldNode.URI)
}
// Set coordinator to a new value.
if !c.SetCoordinator(newNode) {
// Update coordinator to a new value.
if !c.UpdateCoordinator(newNode) {
t.Errorf("expected coordinator to change")
} else if c.Coordinator != newNode.ID {
t.Errorf("expected coordinator: %s, but got: %s", c.Coordinator, newNode.URI)

View file

@ -2026,6 +2026,7 @@ func (h *Handler) handlePostClusterResizeSetCoordinator(w http.ResponseWriter, r
return
}
oldNode := h.Cluster.nodeByID(h.Cluster.Coordinator)
newNode := h.Cluster.nodeByID(req.ID)
if newNode == nil {
http.Error(w, "Node with provided ID does not exist", http.StatusBadRequest)
@ -2033,8 +2034,14 @@ func (h *Handler) handlePostClusterResizeSetCoordinator(w http.ResponseWriter, r
}
if err := func() error {
// Send the set-coordinator message to all nodes.
err := h.Broadcaster.SendSync(
// If the new coordinator is this node, do the SetCoordinator directly.
if newNode.ID == h.Node.ID {
return h.Cluster.SetCoordinator(newNode)
}
// Send the set-coordinator message to new node.
err := h.Broadcaster.SendTo(
newNode,
&internal.SetCoordinatorMessage{
New: EncodeNode(newNode),
})
@ -2042,9 +2049,6 @@ func (h *Handler) handlePostClusterResizeSetCoordinator(w http.ResponseWriter, r
return fmt.Errorf("problem sending SetCoordinator message: %s", err)
}
// Set Coordinator on local node.
_ = h.Cluster.SetCoordinator(newNode)
return nil
}(); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
@ -2053,6 +2057,7 @@ func (h *Handler) handlePostClusterResizeSetCoordinator(w http.ResponseWriter, r
// Encode response.
if err := json.NewEncoder(w).Encode(setCoordinatorResponse{
Old: oldNode,
New: newNode,
}); err != nil {
h.logger().Printf("response encoding error: %s", err)

View file

@ -44,6 +44,7 @@
ResizeSource
ResizeInstructionComplete
SetCoordinatorMessage
UpdateCoordinatorMessage
Topology
RecalculateCaches
*/
@ -1144,6 +1145,22 @@ func (m *SetCoordinatorMessage) GetNew() *Node {
return nil
}
type UpdateCoordinatorMessage struct {
New *Node `protobuf:"bytes,1,opt,name=New" json:"New,omitempty"`
}
func (m *UpdateCoordinatorMessage) Reset() { *m = UpdateCoordinatorMessage{} }
func (m *UpdateCoordinatorMessage) String() string { return proto.CompactTextString(m) }
func (*UpdateCoordinatorMessage) ProtoMessage() {}
func (*UpdateCoordinatorMessage) Descriptor() ([]byte, []int) { return fileDescriptorPrivate, []int{35} }
func (m *UpdateCoordinatorMessage) GetNew() *Node {
if m != nil {
return m.New
}
return nil
}
type Topology struct {
ClusterID string `protobuf:"bytes,1,opt,name=ClusterID,proto3" json:"ClusterID,omitempty"`
NodeIDs []string `protobuf:"bytes,2,rep,name=NodeIDs" json:"NodeIDs,omitempty"`
@ -1152,7 +1169,7 @@ type Topology struct {
func (m *Topology) Reset() { *m = Topology{} }
func (m *Topology) String() string { return proto.CompactTextString(m) }
func (*Topology) ProtoMessage() {}
func (*Topology) Descriptor() ([]byte, []int) { return fileDescriptorPrivate, []int{35} }
func (*Topology) Descriptor() ([]byte, []int) { return fileDescriptorPrivate, []int{36} }
func (m *Topology) GetClusterID() string {
if m != nil {
@ -1174,7 +1191,7 @@ type RecalculateCaches struct {
func (m *RecalculateCaches) Reset() { *m = RecalculateCaches{} }
func (m *RecalculateCaches) String() string { return proto.CompactTextString(m) }
func (*RecalculateCaches) ProtoMessage() {}
func (*RecalculateCaches) Descriptor() ([]byte, []int) { return fileDescriptorPrivate, []int{36} }
func (*RecalculateCaches) Descriptor() ([]byte, []int) { return fileDescriptorPrivate, []int{37} }
func init() {
proto.RegisterType((*IndexMeta)(nil), "internal.IndexMeta")
@ -1212,6 +1229,7 @@ func init() {
proto.RegisterType((*ResizeSource)(nil), "internal.ResizeSource")
proto.RegisterType((*ResizeInstructionComplete)(nil), "internal.ResizeInstructionComplete")
proto.RegisterType((*SetCoordinatorMessage)(nil), "internal.SetCoordinatorMessage")
proto.RegisterType((*UpdateCoordinatorMessage)(nil), "internal.UpdateCoordinatorMessage")
proto.RegisterType((*Topology)(nil), "internal.Topology")
proto.RegisterType((*RecalculateCaches)(nil), "internal.RecalculateCaches")
}
@ -2641,6 +2659,34 @@ func (m *SetCoordinatorMessage) MarshalTo(dAtA []byte) (int, error) {
return i, nil
}
func (m *UpdateCoordinatorMessage) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *UpdateCoordinatorMessage) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if m.New != nil {
dAtA[i] = 0xa
i++
i = encodeVarintPrivate(dAtA, i, uint64(m.New.Size()))
n24, err := m.New.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n24
}
return i, nil
}
func (m *Topology) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
@ -3355,6 +3401,16 @@ func (m *SetCoordinatorMessage) Size() (n int) {
return n
}
func (m *UpdateCoordinatorMessage) Size() (n int) {
var l int
_ = l
if m.New != nil {
l = m.New.Size()
n += 1 + l + sovPrivate(uint64(l))
}
return n
}
func (m *Topology) Size() (n int) {
var l int
_ = l
@ -8262,6 +8318,89 @@ func (m *SetCoordinatorMessage) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *UpdateCoordinatorMessage) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowPrivate
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: UpdateCoordinatorMessage: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: UpdateCoordinatorMessage: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field New", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowPrivate
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthPrivate
}
postIndex := iNdEx + msglen
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.New == nil {
m.New = &Node{}
}
if err := m.New.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipPrivate(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthPrivate
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *Topology) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
@ -8528,88 +8667,89 @@ var (
func init() { proto.RegisterFile("private.proto", fileDescriptorPrivate) }
var fileDescriptorPrivate = []byte{
// 1325 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0x4f, 0x6f, 0x1b, 0x45,
0x14, 0x67, 0xbd, 0xb6, 0x13, 0xbf, 0xd4, 0xa9, 0x33, 0x6d, 0x83, 0x5b, 0x45, 0xae, 0x19, 0x15,
0x1a, 0x2a, 0x11, 0x95, 0x54, 0x42, 0xb4, 0xa8, 0x52, 0xa9, 0xed, 0xaa, 0x0b, 0x4d, 0x29, 0xe3,
0xb6, 0x48, 0x48, 0x20, 0x4d, 0xec, 0x21, 0x5d, 0x65, 0xbd, 0x6b, 0x76, 0xc7, 0x49, 0xdc, 0x03,
0x47, 0x84, 0x84, 0xb8, 0x23, 0xae, 0x7c, 0x19, 0x8e, 0x7c, 0x04, 0x54, 0x3e, 0x04, 0x12, 0x17,
0xd0, 0xbc, 0x99, 0xd9, 0x5d, 0xff, 0x4b, 0x9a, 0xc0, 0x6d, 0xdf, 0x6f, 0xde, 0x7b, 0xf3, 0x9b,
0xf7, 0x6f, 0x66, 0xa1, 0x3a, 0x8c, 0xfd, 0x03, 0x2e, 0xc5, 0xd6, 0x30, 0x8e, 0x64, 0x44, 0x96,
0xfd, 0x50, 0x8a, 0x38, 0xe4, 0x01, 0xfd, 0x0c, 0x2a, 0x5e, 0xd8, 0x17, 0x47, 0x3b, 0x42, 0x72,
0xd2, 0x84, 0x95, 0x56, 0x14, 0x8c, 0x06, 0xe1, 0x23, 0xb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7, 0xe2, 0x70, 0xc1, 0xf1,
0xd5, 0x12, 0xbd, 0x0f, 0xcb, 0x4f, 0xa3, 0x61, 0x14, 0x44, 0x7b, 0xe3, 0x13, 0x9a, 0xb6, 0x0e,
0x4b, 0x7a, 0xc2, 0xe9, 0x67, 0x46, 0x85, 0x59, 0x91, 0x5e, 0x50, 0x25, 0xd9, 0xe3, 0x41, 0x6f,
0x14, 0x70, 0x29, 0xf0, 0xef, 0x29, 0xb9, 0x5f, 0xfb, 0xed, 0x55, 0xc3, 0xf9, 0xfd, 0x55, 0xc3,
0xf9, 0xe3, 0x55, 0xc3, 0xf9, 0xf9, 0xcf, 0xc6, 0x1b, 0xbb, 0x65, 0xfc, 0x4f, 0xbf, 0xf5, 0x6f,
0x00, 0x00, 0x00, 0xff, 0xff, 0x30, 0x4b, 0x92, 0xf6, 0xb8, 0x0f, 0x00, 0x00,
// 1334 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0x5d, 0x6f, 0x1b, 0x45,
0x17, 0x7e, 0xd7, 0x6b, 0x3b, 0xf6, 0x71, 0x9c, 0x38, 0xd3, 0x34, 0xaf, 0x13, 0x45, 0xae, 0x19,
0x15, 0x1a, 0x2a, 0x11, 0x95, 0x54, 0x42, 0x34, 0x50, 0xa9, 0xc4, 0x76, 0xd5, 0x85, 0x26, 0x94,
0x71, 0x12, 0x24, 0x24, 0x90, 0x26, 0xf6, 0x90, 0xae, 0xb2, 0xde, 0x35, 0xbb, 0xe3, 0x24, 0xee,
0x05, 0x97, 0x08, 0x09, 0x71, 0x8f, 0xb8, 0xe5, 0xcf, 0x70, 0xc9, 0x4f, 0x40, 0xe1, 0x47, 0x20,
0x71, 0x03, 0x9a, 0xaf, 0xdd, 0xf5, 0x57, 0xd2, 0x04, 0xee, 0xf6, 0x3c, 0x73, 0xce, 0x99, 0x67,
0xce, 0xd7, 0xcc, 0x42, 0xb9, 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 0x9d, 0x48, 0x53, 0x23,
0xe8, 0xf5, 0x45, 0x3d, 0xfc, 0x8b, 0x74, 0x89, 0x91, 0x11, 0x86, 0x3a, 0x51, 0x45, 0xa2, 0x04,
0xfc, 0x08, 0x6e, 0xb7, 0x19, 0x4f, 0x25, 0xc9, 0x54, 0x5b, 0x1d, 0xec, 0x3d, 0x76, 0x36, 0xe3,
0xf8, 0x62, 0x09, 0x7f, 0x08, 0xd5, 0x83, 0x7e, 0x97, 0x72, 0x76, 0x23, 0xeb, 0x1d, 0x28, 0xec,
0x07, 0xfd, 0xc0, 0x0b, 0x8e, 0x87, 0x57, 0xb4, 0x7c, 0x15, 0xe6, 0xd4, 0x7c, 0x54, 0x8f, 0x94,
0x22, 0x31, 0x22, 0xbe, 0x25, 0x0a, 0xba, 0x43, 0xbd, 0xce, 0xc0, 0x13, 0x34, 0xc4, 0xbf, 0x57,
0xb4, 0x53, 0xf9, 0xf5, 0xa2, 0x66, 0xfd, 0x76, 0x51, 0xb3, 0x7e, 0xbf, 0xa8, 0x59, 0x3f, 0xfd,
0x51, 0xfb, 0xdf, 0x51, 0x5e, 0xfe, 0xe5, 0x3f, 0xfc, 0x27, 0x00, 0x00, 0xff, 0xff, 0x66, 0x19,
0x3d, 0xd2, 0xf6, 0x0f, 0x00, 0x00,
}

View file

@ -207,6 +207,10 @@ message SetCoordinatorMessage {
Node New = 1;
}
message UpdateCoordinatorMessage {
Node New = 1;
}
message Topology {
string ClusterID = 1;
repeated string NodeIDs = 2;

View file

@ -456,6 +456,8 @@ func (s *Server) ReceiveMessage(pb proto.Message) error {
}
case *internal.SetCoordinatorMessage:
s.Cluster.SetCoordinator(DecodeNode(obj.New))
case *internal.UpdateCoordinatorMessage:
s.Cluster.UpdateCoordinator(DecodeNode(obj.New))
case *internal.NodeStateMessage:
err := s.Cluster.ReceiveNodeState(obj.NodeID, obj.State)
if err != nil {