From 426992bc59658e142dc0b7970dd1c387504931f5 Mon Sep 17 00:00:00 2001 From: Travis Turner Date: Wed, 15 Nov 2017 09:06:07 -0600 Subject: [PATCH] add set-coordinator endpoint --- broadcast.go | 5 + cluster.go | 10 ++ cluster_test.go | 31 +++- handler.go | 64 +++++++- handler_test.go | 1 + internal/private.pb.go | 342 ++++++++++++++++++++++++++++++++--------- internal/private.proto | 5 + server.go | 2 + 8 files changed, 384 insertions(+), 76 deletions(-) diff --git a/broadcast.go b/broadcast.go index e0da4756b..4a5b8e8f7 100644 --- a/broadcast.go +++ b/broadcast.go @@ -125,6 +125,7 @@ const ( MessageTypeClusterStatus = 9 MessageTypeResizeInstruction = 10 MessageTypeResizeInstructionComplete = 11 + MessageTypeSetCoordinator = 12 ) // MarshalMessage encodes the protobuf message into a byte slice. @@ -153,6 +154,8 @@ func MarshalMessage(m proto.Message) ([]byte, error) { typ = MessageTypeResizeInstruction case *internal.ResizeInstructionComplete: typ = MessageTypeResizeInstructionComplete + case *internal.SetCoordinatorMessage: + typ = MessageTypeSetCoordinator default: return nil, fmt.Errorf("message type not implemented for marshalling: %s", reflect.TypeOf(obj)) } @@ -191,6 +194,8 @@ func UnmarshalMessage(buf []byte) (proto.Message, error) { m = &internal.ResizeInstruction{} case MessageTypeResizeInstructionComplete: m = &internal.ResizeInstructionComplete{} + case MessageTypeSetCoordinator: + m = &internal.SetCoordinatorMessage{} default: return nil, fmt.Errorf("invalid message type: %d", typ) } diff --git a/cluster.go b/cluster.go index 204e39c26..fa6651eab 100644 --- a/cluster.go +++ b/cluster.go @@ -200,6 +200,16 @@ func (c *Cluster) IsCoordinator() bool { return c.Coordinator == c.URI } +// SetCoordinator updates the Coordinator to new if it is +// currently old. Returns true if the Coordinator changed. +func (c *Cluster) SetCoordinator(oldURI, newURI URI) bool { + if c.Coordinator == oldURI && oldURI != newURI { + c.Coordinator = newURI + return true + } + return false +} + // AddNode adds a node to the Cluster and updates and saves the // new topology. func (c *Cluster) AddNode(uri URI) error { diff --git a/cluster_test.go b/cluster_test.go index 1e5427df0..0c26b96f2 100644 --- a/cluster_test.go +++ b/cluster_test.go @@ -305,7 +305,7 @@ func TestCluster_Resize(t *testing.T) { }) } -// TestTestCluster ensures that general cluster functionality works as expected. +// Ensure that general cluster functionality works as expected. func TestCluster_ResizeStates(t *testing.T) { t.Run("Single node, no data", func(t *testing.T) { @@ -538,3 +538,32 @@ 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) { + c := test.NewCluster(1) + oldURI, err := pilosa.NewURIFromAddress("localhost:8888") + if err != nil { + t.Fatal(err) + } + c.Coordinator = *oldURI + + newURI, err := pilosa.NewURIFromAddress("localhost:9999") + if err != nil { + t.Fatal(err) + } + + // Set coordinator to the same value. + c.SetCoordinator(c.Coordinator, *oldURI) + if c.Coordinator != *oldURI { + t.Errorf("expected coordinator: %s, but got: %s", c.Coordinator, *oldURI) + } + + // Set coordinator to a new value. + c.SetCoordinator(c.Coordinator, *newURI) + if c.Coordinator != *newURI { + t.Errorf("expected coordinator: %s, but got: %s", c.Coordinator, *newURI) + } + }) +} diff --git a/handler.go b/handler.go index 91d128e7c..e0177ba35 100644 --- a/handler.go +++ b/handler.go @@ -123,6 +123,7 @@ func (h *Handler) SetRestricted() { } func loadCommon(router *mux.Router, handler *Handler) { + router.HandleFunc("/cluster/resize/set-coordinator", handler.handlePostClusterResizeSetCoordinator).Methods("POST") router.HandleFunc("/schema", handler.handleGetSchema).Methods("GET") router.HandleFunc("/status", handler.handleGetStatus).Methods("GET") router.HandleFunc("/version", handler.handleGetVersion).Methods("GET") @@ -140,7 +141,6 @@ func loadRestricted(router *mux.Router, handler *Handler) { func loadNormal(router *mux.Router, handler *Handler) { router.HandleFunc("/assets/{file}", handler.handleWebUI).Methods("GET") - router.HandleFunc("/cluster/resize/abort", handler.handlePostClusterResizeAbort).Methods("POST") router.PathPrefix("/debug/pprof/").Handler(http.DefaultServeMux).Methods("GET") router.HandleFunc("/debug/vars", handler.handleExpvar).Methods("GET") router.HandleFunc("/export", handler.handleGetExport).Methods("GET") @@ -1927,7 +1927,67 @@ func (h *Handler) handlePostInput(w http.ResponseWriter, r *http.Request) { } } -//handlePostClusterResizeAbort handles POST /cluster/resize/abort request. +// handlePostClusterResizeSetCoordinator handles POST /cluster/resize/set-coordinator request. +func (h *Handler) handlePostClusterResizeSetCoordinator(w http.ResponseWriter, r *http.Request) { + // Decode request. + var req setCoordinatorRequest + err := json.NewDecoder(r.Body).Decode(&req) + if err != nil { + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + + oldURI := h.Cluster.Coordinator + + var newURI *URI + if err := func() error { + newURI, err = NewURIFromAddress(req.Address) + if err != nil { + return fmt.Errorf("problem with set-coordinator address: %s", err) + } + + //if !Nodes(h.Cluster.Nodes).ContainsURI(*newURI) { + // return fmt.Errorf("set-coordinator node does not exist: %s", newURI) + //} + + // Send the set-coordinator message to all nodes. + err := h.Broadcaster.SendSync( + &internal.SetCoordinatorMessage{ + Old: (&h.Cluster.Coordinator).Encode(), + New: newURI.Encode(), + }) + if err != nil { + return fmt.Errorf("problem sending SetCoordinator message: %s", err) + } + + // Set Coordinator on local node. + h.Cluster.SetCoordinator(oldURI, *newURI) + + return nil + }(); err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + + // Encode response. + if err := json.NewEncoder(w).Encode(setCoordinatorResponse{ + Old: &oldURI, + New: newURI, + }); err != nil { + h.logger().Printf("response encoding error: %s", err) + } +} + +type setCoordinatorRequest struct { + Address string `json:"address"` +} + +type setCoordinatorResponse struct { + Old *URI `json:"old"` + New *URI `json:"new"` +} + +// handlePostClusterResizeAbort handles POST /cluster/resize/abort request. func (h *Handler) handlePostClusterResizeAbort(w http.ResponseWriter, r *http.Request) { var msg string diff --git a/handler_test.go b/handler_test.go index d6a5e7a3f..05116ef8c 100644 --- a/handler_test.go +++ b/handler_test.go @@ -158,6 +158,7 @@ func TestHandler_ClusterResizeAbort(t *testing.T) { t.Run("No resize job", func(t *testing.T) { h := test.NewHandler() h.Cluster = test.NewCluster(1) + h.SetRestricted() w := httptest.NewRecorder() h.ServeHTTP(w, test.MustNewHTTPRequest("POST", "/cluster/resize/abort", nil)) diff --git a/internal/private.pb.go b/internal/private.pb.go index 2c5355f69..172bc0be2 100644 --- a/internal/private.pb.go +++ b/internal/private.pb.go @@ -36,6 +36,7 @@ ResizeInstruction ResizeSource ResizeInstructionComplete + SetCoordinatorMessage Topology */ package internal @@ -927,6 +928,30 @@ func (m *ResizeInstructionComplete) GetError() string { return "" } +type SetCoordinatorMessage struct { + Old *URI `protobuf:"bytes,1,opt,name=Old" json:"Old,omitempty"` + New *URI `protobuf:"bytes,2,opt,name=New" json:"New,omitempty"` +} + +func (m *SetCoordinatorMessage) Reset() { *m = SetCoordinatorMessage{} } +func (m *SetCoordinatorMessage) String() string { return proto.CompactTextString(m) } +func (*SetCoordinatorMessage) ProtoMessage() {} +func (*SetCoordinatorMessage) Descriptor() ([]byte, []int) { return fileDescriptorPrivate, []int{28} } + +func (m *SetCoordinatorMessage) GetOld() *URI { + if m != nil { + return m.Old + } + return nil +} + +func (m *SetCoordinatorMessage) GetNew() *URI { + if m != nil { + return m.New + } + return nil +} + type Topology struct { NodeSet []*URI `protobuf:"bytes,1,rep,name=NodeSet" json:"NodeSet,omitempty"` } @@ -934,7 +959,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{28} } +func (*Topology) Descriptor() ([]byte, []int) { return fileDescriptorPrivate, []int{29} } func (m *Topology) GetNodeSet() []*URI { if m != nil { @@ -972,6 +997,7 @@ func init() { proto.RegisterType((*ResizeInstruction)(nil), "internal.ResizeInstruction") proto.RegisterType((*ResizeSource)(nil), "internal.ResizeSource") proto.RegisterType((*ResizeInstructionComplete)(nil), "internal.ResizeInstructionComplete") + proto.RegisterType((*SetCoordinatorMessage)(nil), "internal.SetCoordinatorMessage") proto.RegisterType((*Topology)(nil), "internal.Topology") } func (m *IndexMeta) Marshal() (dAtA []byte, err error) { @@ -2137,6 +2163,44 @@ func (m *ResizeInstructionComplete) MarshalTo(dAtA []byte) (int, error) { return i, nil } +func (m *SetCoordinatorMessage) 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 *SetCoordinatorMessage) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.Old != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintPrivate(dAtA, i, uint64(m.Old.Size())) + n19, err := m.Old.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n19 + } + if m.New != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintPrivate(dAtA, i, uint64(m.New.Size())) + n20, err := m.New.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n20 + } + return i, nil +} + func (m *Topology) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2690,6 +2754,20 @@ func (m *ResizeInstructionComplete) Size() (n int) { return n } +func (m *SetCoordinatorMessage) Size() (n int) { + var l int + _ = l + if m.Old != nil { + l = m.Old.Size() + n += 1 + l + sovPrivate(uint64(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 @@ -6688,6 +6766,122 @@ func (m *ResizeInstructionComplete) Unmarshal(dAtA []byte) error { } return nil } +func (m *SetCoordinatorMessage) 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: SetCoordinatorMessage: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SetCoordinatorMessage: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Old", 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.Old == nil { + m.Old = &URI{} + } + if err := m.Old.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + 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 = &URI{} + } + 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 @@ -6877,77 +7071,79 @@ var ( func init() { proto.RegisterFile("private.proto", fileDescriptorPrivate) } var fileDescriptorPrivate = []byte{ - // 1149 bytes of a gzipped FileDescriptorProto + // 1179 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0x4f, 0x6f, 0xe3, 0x44, - 0x14, 0xc7, 0x71, 0x92, 0x26, 0x2f, 0xcd, 0x36, 0x1d, 0x4a, 0x95, 0x56, 0x55, 0x36, 0xcc, 0x81, - 0x96, 0x95, 0x28, 0xd0, 0x4a, 0x08, 0x8a, 0x90, 0x60, 0x9b, 0xac, 0xd6, 0x40, 0xcb, 0x32, 0xe9, - 0x2e, 0x12, 0x07, 0xa4, 0x69, 0x32, 0xb4, 0x56, 0x1d, 0x3b, 0xd8, 0x93, 0xb6, 0xd9, 0x03, 0x37, - 0x38, 0xc0, 0x17, 0xe0, 0xce, 0x97, 0xe1, 0xc8, 0x8d, 0x2b, 0x2a, 0x1f, 0x02, 0x89, 0x0b, 0xab, - 0x79, 0x9e, 0xb1, 0x9d, 0x7f, 0x8d, 0xda, 0x9b, 0xdf, 0x9b, 0xf7, 0xde, 0xfc, 0xe6, 0xf7, 0xfe, - 0xcc, 0x18, 0xaa, 0x83, 0xd0, 0xbd, 0xe4, 0x52, 0xec, 0x0e, 0xc2, 0x40, 0x06, 0xa4, 0xe4, 0xfa, - 0x52, 0x84, 0x3e, 0xf7, 0xe8, 0x57, 0x50, 0x76, 0xfc, 0x9e, 0xb8, 0x3e, 0x12, 0x92, 0x93, 0x26, - 0x54, 0x0e, 0x03, 0x6f, 0xd8, 0xf7, 0xbf, 0xe4, 0xa7, 0xc2, 0xab, 0x5b, 0x4d, 0x6b, 0xa7, 0xcc, - 0xb2, 0x2a, 0x65,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, 0x90, 0x92, 0xeb, + 0x4b, 0x11, 0xfa, 0xdc, 0xa3, 0x47, 0x50, 0x76, 0xfc, 0x9e, 0xb8, 0x3a, 0x10, 0x92, 0x93, 0x26, + 0x54, 0xf6, 0x03, 0x6f, 0xd8, 0xf7, 0xbf, 0xe0, 0x27, 0xc2, 0xab, 0x5b, 0x4d, 0x6b, 0xab, 0xcc, + 0xb2, 0x2a, 0x65, 0x71, 0xec, 0xf6, 0xc5, 0x97, 0x43, 0xee, 0xcb, 0x61, 0xbf, 0x9e, 0x8b, 0x2d, + 0x32, 0x2a, 0xfa, 0xaf, 0x05, 0xe5, 0xa7, 0x21, 0xef, 0x0b, 0x8c, 0xb8, 0x06, 0x25, 0x16, 0x5c, + 0x66, 0xc3, 0x25, 0x32, 0x79, 0x13, 0xee, 0x3b, 0xfe, 0x85, 0x08, 0x23, 0xd1, 0xf6, 0xf9, 0x89, + 0x27, 0x7a, 0x18, 0xae, 0xc4, 0x26, 0xb4, 0x64, 0x1d, 0xca, 0xfb, 0xbc, 0x7b, 0x26, 0x8e, 0x47, + 0x03, 0x51, 0xb7, 0x31, 0x48, 0xaa, 0x48, 0x56, 0x3b, 0xee, 0x2b, 0x51, 0xcf, 0x37, 0xad, 0xad, + 0x2a, 0x4b, 0x15, 0x93, 0x78, 0x0b, 0x53, 0x78, 0x09, 0x85, 0x7b, 0x8c, 0xfb, 0xa7, 0x09, 0x86, + 0x22, 0x62, 0x18, 0xd3, 0x91, 0x4d, 0x28, 0x3e, 0x75, 0x85, 0xd7, 0x8b, 0xea, 0x4b, 0x4d, 0x7b, + 0xab, 0xb2, 0xf3, 0x60, 0xdb, 0xf0, 0xb7, 0x8d, 0x7a, 0xa6, 0x97, 0x29, 0x85, 0xfb, 0x4e, 0x7f, + 0x10, 0x84, 0x92, 0x89, 0x68, 0x10, 0xf8, 0x91, 0x20, 0x35, 0xb0, 0xdb, 0x61, 0xa8, 0xcf, 0xae, + 0x3e, 0xe9, 0x0f, 0x50, 0x7b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f, 0x30, 0xcc, 0x5a, 0x90, + 0x77, 0x61, 0xa9, 0x13, 0x0c, 0xc3, 0x6e, 0x32, 0xa0, 0x57, 0x52, 0xe3, 0x18, 0x55, 0xbc, 0xcc, + 0x8c, 0x59, 0x26, 0xa7, 0x85, 0x05, 0x39, 0xfd, 0xd1, 0x82, 0x7b, 0xd9, 0x18, 0x8b, 0x4b, 0x2c, + 0xe1, 0x32, 0x37, 0x93, 0x4b, 0x7b, 0x16, 0x97, 0xf9, 0x94, 0xcb, 0xf4, 0xf9, 0x51, 0xc8, 0x3c, + 0x3f, 0xe8, 0x19, 0xac, 0x4e, 0x11, 0xbc, 0x1f, 0xf4, 0x07, 0x2a, 0x93, 0x77, 0x25, 0x7a, 0x19, + 0x0a, 0xed, 0x30, 0xd4, 0x14, 0x97, 0x59, 0x2c, 0xd0, 0xaf, 0xe1, 0x51, 0x47, 0xc8, 0x0c, 0xbf, + 0xa6, 0x48, 0x36, 0xc0, 0x3e, 0xf2, 0x7a, 0x73, 0x4e, 0x7e, 0xe4, 0xf5, 0x94, 0xc1, 0xa1, 0xb8, + 0x9c, 0xb3, 0xe1, 0xa1, 0xb8, 0xa4, 0xbb, 0x50, 0x3a, 0x0e, 0x06, 0x81, 0x17, 0x9c, 0x8e, 0xb2, + 0x5d, 0x60, 0xdd, 0xd4, 0x05, 0x4f, 0x6a, 0xbf, 0x5f, 0x37, 0xac, 0x3f, 0xae, 0x1b, 0xd6, 0x5f, + 0xd7, 0x0d, 0xeb, 0xd7, 0xbf, 0x1b, 0xaf, 0x9d, 0x14, 0xf1, 0xbf, 0x69, 0xf7, 0xff, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x80, 0x0a, 0xbc, 0x80, 0x48, 0x0d, 0x00, 0x00, } diff --git a/internal/private.proto b/internal/private.proto index 56c402eca..a97ac0e2d 100644 --- a/internal/private.proto +++ b/internal/private.proto @@ -167,6 +167,11 @@ message ResizeInstructionComplete { string Error = 3; } +message SetCoordinatorMessage { + URI Old = 1; + URI New = 2; +} + message Topology { repeated URI NodeSet = 1; } diff --git a/server.go b/server.go index da6cc8a1a..55fd62249 100644 --- a/server.go +++ b/server.go @@ -356,6 +356,8 @@ func (s *Server) ReceiveMessage(pb proto.Message) error { if err != nil { return err } + case *internal.SetCoordinatorMessage: + s.Cluster.SetCoordinator(DecodeURI(obj.Old), DecodeURI(obj.New)) } return nil