diff --git a/api/v1/heimdall.pb.go b/api/v1/heimdall.pb.go index aaab2b4..e08dd99 100644 --- a/api/v1/heimdall.pb.go +++ b/api/v1/heimdall.pb.go @@ -13,12 +13,14 @@ import ( codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" math "math" + time "time" ) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf +var _ = time.Kitchen // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. @@ -211,15 +213,16 @@ func (m *KeyPair) GetPublicKey() string { } type Node struct { - ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Addr string `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"` - KeyPair *KeyPair `protobuf:"bytes,3,opt,name=keypair,proto3" json:"keypair,omitempty"` - EndpointIP string `protobuf:"bytes,4,opt,name=endpoint_ip,json=endpointIp,proto3" json:"endpoint_ip,omitempty"` - EndpointPort uint64 `protobuf:"varint,5,opt,name=endpoint_port,json=endpointPort,proto3" json:"endpoint_port,omitempty"` - GatewayIP string `protobuf:"bytes,6,opt,name=gateway_ip,json=gatewayIp,proto3" json:"gateway_ip,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Addr string `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"` + KeyPair *KeyPair `protobuf:"bytes,3,opt,name=keypair,proto3" json:"keypair,omitempty"` + EndpointIP string `protobuf:"bytes,4,opt,name=endpoint_ip,json=endpointIp,proto3" json:"endpoint_ip,omitempty"` + EndpointPort uint64 `protobuf:"varint,5,opt,name=endpoint_port,json=endpointPort,proto3" json:"endpoint_port,omitempty"` + GatewayIP string `protobuf:"bytes,6,opt,name=gateway_ip,json=gatewayIp,proto3" json:"gateway_ip,omitempty"` + Updated time.Time `protobuf:"bytes,7,opt,name=updated,proto3,stdtime" json:"updated"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Node) Reset() { *m = Node{} } @@ -288,6 +291,13 @@ func (m *Node) GetGatewayIP() string { return "" } +func (m *Node) GetUpdated() time.Time { + if m != nil { + return m.Updated + } + return time.Time{} +} + type NodesRequest struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -707,56 +717,59 @@ func init() { } var fileDescriptor_b6184fc395da86b1 = []byte{ - // 784 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcd, 0x6a, 0xeb, 0x46, - 0x18, 0xc5, 0x7f, 0xb2, 0xfd, 0xc9, 0x76, 0x60, 0x28, 0x41, 0xb8, 0x14, 0xb9, 0xca, 0xa2, 0x4e, - 0x09, 0x52, 0xec, 0x52, 0x28, 0x94, 0x42, 0xf3, 0xd7, 0x54, 0xa4, 0x0d, 0xee, 0xb4, 0xd9, 0x94, - 0x82, 0x91, 0xad, 0xa9, 0xa3, 0x44, 0xf6, 0x4c, 0x47, 0x63, 0x07, 0xaf, 0xba, 0xee, 0x4b, 0xf5, - 0x51, 0xbc, 0xf0, 0x8b, 0xb4, 0xcc, 0x68, 0xa4, 0x6b, 0xdf, 0x90, 0x7b, 0x15, 0xee, 0xdd, 0xf9, - 0x3b, 0xfa, 0xce, 0x99, 0x33, 0x67, 0xfe, 0x0c, 0xdf, 0xcc, 0x22, 0x71, 0xbf, 0x9c, 0xb8, 0x53, - 0x3a, 0xf7, 0x12, 0x41, 0xe2, 0x38, 0xe0, 0x8c, 0xd3, 0x07, 0x32, 0x15, 0xde, 0x3d, 0x89, 0xe6, - 0x61, 0x10, 0xc7, 0x5e, 0xc0, 0x22, 0x6f, 0x35, 0xc8, 0x6b, 0x97, 0x71, 0x2a, 0x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 0x0e, 0x46, 0x3a, 0x25, 0x74, 0x5a, 0xd4, 0x7a, 0x16, 0x47, 0x77, 0xf0, 0x0a, 0x86, 0x1e, - 0xee, 0x0f, 0x30, 0x77, 0xd6, 0x15, 0x7d, 0x5d, 0xc4, 0xf1, 0xb3, 0x7d, 0xd0, 0x3d, 0x74, 0xd3, - 0xd7, 0xc7, 0xcd, 0x5e, 0x1f, 0xf7, 0x4a, 0xbe, 0x3e, 0x52, 0x7d, 0x67, 0x81, 0x0b, 0xa9, 0x3f, - 0xdf, 0x10, 0x2f, 0xaa, 0x3f, 0x40, 0x4d, 0x5d, 0x26, 0xc8, 0x2b, 0x78, 0x6b, 0xe4, 0x41, 0x9d, - 0x16, 0x27, 0xe8, 0x9c, 0x1e, 0xa0, 0xa6, 0xce, 0x65, 0xa1, 0xb1, 0x76, 0x4f, 0x74, 0xa1, 0xb1, - 0xf6, 0x8e, 0xfc, 0xb9, 0xfb, 0xfb, 0x49, 0xe1, 0xff, 0x0f, 0xdf, 0xae, 0x06, 0x13, 0x43, 0xe5, - 0xf2, 0xd5, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0x77, 0xf6, 0x3d, 0x3c, 0x76, 0x08, 0x00, 0x00, + // 831 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xdd, 0x8e, 0xe3, 0x34, + 0x14, 0x26, 0x9d, 0x36, 0x6d, 0x4f, 0xe6, 0x47, 0xb2, 0xd0, 0x2a, 0x2a, 0x42, 0x19, 0xb2, 0x17, + 0xcc, 0xa2, 0x55, 0xb2, 0x2d, 0x42, 0x42, 0x42, 0x20, 0xe6, 0x67, 0x59, 0xa2, 0x81, 0x55, 0x31, + 0xbb, 0x37, 0x08, 0xa9, 0x4a, 0x1b, 0xd3, 0xf5, 0x4c, 0x5a, 0x1b, 0xc7, 0xe9, 0xa8, 0x57, 0xbc, + 0x02, 0x4f, 0x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37, 0xda, 0x6b, + 0xe7, 0xca, 0x9f, 0x05, 0x3f, 0x3c, 0x6d, 0xfc, 0x07, 0xe5, 0xb3, 0xd5, 0x70, 0x6a, 0x6b, 0x5f, + 0x3e, 0xfe, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x46, 0x38, 0x83, 0x35, 0xd7, 0x08, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/api/v1/heimdall.proto b/api/v1/heimdall.proto index 2f41631..e7c5353 100644 --- a/api/v1/heimdall.proto +++ b/api/v1/heimdall.proto @@ -4,6 +4,7 @@ package io.stellarproject.heimdall.api.v1; import "gogoproto/gogo.proto"; import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; option go_package = "github.com/stellarproject/heimdall/api/v1;v1"; @@ -43,6 +44,7 @@ message Node { string endpoint_ip = 4 [(gogoproto.customname) = "EndpointIP"]; uint64 endpoint_port = 5; string gateway_ip = 6 [(gogoproto.customname) = "GatewayIP"]; + google.protobuf.Timestamp updated = 7 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; } message NodesRequest {} diff --git a/cmd/hctl/nodes.go b/cmd/hctl/nodes.go index 673651b..90f7989 100644 --- a/cmd/hctl/nodes.go +++ b/cmd/hctl/nodes.go @@ -26,6 +26,7 @@ import ( "os" "text/tabwriter" + humanize "github.com/dustin/go-humanize" "github.com/urfave/cli" ) @@ -53,10 +54,10 @@ var listNodesCommand = cli.Command{ } w := tabwriter.NewWriter(os.Stdout, 20, 1, 3, ' ', 0) - fmt.Fprintf(w, "ID\tADDR\tENDPOINT\tGATEWAY\tPUBLIC KEY\n") + fmt.Fprintf(w, "ID\tADDR\tENDPOINT\tGATEWAY\tUPDATED\tPUBLIC KEY\n") for _, n := range nodes { ep := fmt.Sprintf("%s:%d", n.EndpointIP, n.EndpointPort) - fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\n", n.ID, n.Addr, ep, n.GatewayIP, n.KeyPair.PublicKey) + fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t%s\n", n.ID, n.Addr, ep, n.GatewayIP, humanize.Time(n.Updated), n.KeyPair.PublicKey) } w.Flush() diff --git a/go.mod b/go.mod index 307ae28..8acc446 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,7 @@ require ( github.com/certifi/gocertifi v0.0.0-20190905060710-a5e0173ced67 // indirect github.com/containerd/typeurl v0.0.0-20190911142611-5eb25027c9fd github.com/crosbymichael/guard v0.0.0-20190716141324-5c2daadf8067 // indirect + github.com/dustin/go-humanize v1.0.0 github.com/getsentry/raven-go v0.2.0 // indirect github.com/gogo/googleapis v1.3.0 github.com/gogo/protobuf v1.3.0 diff --git a/go.sum b/go.sum index 9a4f229..89603fb 100644 --- a/go.sum +++ b/go.sum @@ -19,6 +19,8 @@ github.com/crosbymichael/guard v0.0.0-20190716141324-5c2daadf8067/go.mod h1:+l2f github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/ehazlett/ttlcache v0.0.0-20190820213212-4400e3aef9f0/go.mod h1:D7IiYXsX2n2xixWvFTxGeZucCvvNtI14ikLj6L9Kp9E= github.com/getsentry/raven-go v0.2.0 h1:no+xWJRb5ZI7eE8TWgIq1jLulQiIoLG0IfYxv5JYMGs= github.com/getsentry/raven-go v0.2.0/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ= diff --git a/server/connect.go b/server/connect.go index 46489f8..7472e24 100644 --- a/server/connect.go +++ b/server/connect.go @@ -34,6 +34,8 @@ import ( var ( // ErrInvalidAuth is returned when an invalid cluster key is specified upon connect ErrInvalidAuth = errors.New("invalid cluster key specified") + // ErrNoMaster is returned if there is no configured master yet + ErrNoMaster = errors.New("no configured master") ) // Connect is called when a peer wants to connect to the node @@ -48,6 +50,9 @@ func (s *Server) Connect(ctx context.Context, req *v1.ConnectRequest) (*v1.Conne } data, err := redis.Bytes(s.local(ctx, "GET", masterKey)) if err != nil { + if err == redis.ErrNil { + return nil, ErrNoMaster + } return nil, err } var master v1.Master diff --git a/server/node.go b/server/node.go index 6f2745c..546f882 100644 --- a/server/node.go +++ b/server/node.go @@ -24,6 +24,7 @@ package server import ( "context" "net/url" + "sort" "strings" "time" @@ -121,6 +122,8 @@ func (s *Server) configureNode() error { continue } + go s.replicaMonitor() + return nil } } @@ -178,6 +181,16 @@ func (s *Server) replicaMonitor() { for range t.C { if _, err := redis.Bytes(s.local(context.Background(), "GET", masterKey)); err != nil { if err == redis.ErrNil { + // skip configure until new leader election + n, err := s.getNextMaster(context.Background()) + if err != nil { + logrus.Error(err) + continue + } + if n.ID != s.cfg.ID { + logrus.Debugf("waiting for new master to initialize: %s", n.ID) + continue + } if err := s.configureNode(); err != nil { logrus.Error(err) continue @@ -194,6 +207,18 @@ func (s *Server) replicaMonitor() { t.Stop() } +func (s *Server) getNextMaster(ctx context.Context) (*v1.Node, error) { + nodes, err := s.getNodes(ctx) + if err != nil { + return nil, err + } + if len(nodes) == 0 { + return nil, nil + } + sort.SliceStable(nodes, func(i, j int) bool { return nodes[i].Updated.Before(nodes[j].Updated) }) + return nodes[len(nodes)-1], nil +} + func (s *Server) masterHeartbeat() { logrus.Debugf("starting master heartbeat: ttl=%s", masterHeartbeatInterval) // initial update @@ -286,6 +311,7 @@ func (s *Server) nodeHeartbeat(ctx context.Context) { continue } node := &v1.Node{ + Updated: time.Now(), ID: s.cfg.ID, Addr: s.cfg.GRPCAddress, KeyPair: keyPair, diff --git a/server/server.go b/server/server.go index 7636045..6f586af 100644 --- a/server/server.go +++ b/server/server.go @@ -58,7 +58,7 @@ const ( var ( empty = &ptypes.Empty{} masterHeartbeatInterval = time.Second * 5 - nodeHeartbeatInterval = time.Second * 60 + nodeHeartbeatInterval = time.Second * 15 nodeHeartbeatExpiry = 86400 peerConfigUpdateInterval = time.Second * 10 @@ -130,7 +130,6 @@ func (s *Server) Run() error { go s.replicaMonitor() } else { - // starting as master; remove existing key if err := s.configureNode(); err != nil { return err }