master

package
v0.0.0-...-fd5963e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 13, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	Addr:                     "localhost:55501",
	RejectReqThreshold:       1000,
	ConsistencyCheckInterval: 1 * time.Minute,
}

DefaultConfig includes default values for master server.

Functions

This section is empty.

Types

type Config

type Config struct {
	Addr               string // Address for answering requests / receiving heartbeats.
	UseFailure         bool   // Whether to enable the failure service.
	RejectReqThreshold int    // Pending incoming requests on 'SrvAddr' are rejected after this threshold.

	ConsistencyCheckInterval time.Duration // How often to do a consistency check

	RaftACSpec string // Spec for raft autoconfig.
}

Config encapsulates parameters for the server.

type CuratorInfo

type CuratorInfo struct {
	// What curator ID is this?
	ID core.CuratorID

	// Address for RPCs and http status.
	// These addrs are for the latest (and possibly stale) primary.
	Addr string

	// System clock time of when we received the last heartbeat from the host representing
	// this curator ID.
	//
	// We can't really take action when a curator dies.  Another member of the curator's
	// replication group has to take over, or we perhaps page an SRE.
	LastHeartbeat time.Time

	// How many additional partitions the curator can ask for. When this
	// quota drops to 0, 'newPartition' will fail. The quota will be
	// refreshed regularly.
	NewPartitionQuota uint32
}

CuratorInfo describes a curator. This is not persisted in the durable state, but rather being kept in memory.

Since we don't persist the address and last heartbeat time, when a master failover happens, the new leader cannot service requests until it hears heartbeat from the curators. See PL-1102.

Since we don't persist the new partition quota in durable state, when a master failover happens, the new leader will reset the quota for each curator and thus it's possible that a curator can have be allocated more partitions in such a case. However, we made this decision because this this quota is kind of "soft" limit in the sense that we just want to prevent a buggy client/curator from grabbing too many partitions, but not necessarily enforce that each curator cannot get more than the limit. Assuming master failure is rare, the chance of exceeding the quota should not appear too frequently.

type Master

type Master struct {
	// contains filtered or unexported fields
}

The Master assigns partitions of the BlobID space to curators, and forwards clients to the correct curator for their requests.

func NewMaster

func NewMaster(cfg Config, stateCfg durable.StateConfig, r *raft.Raft) *Master

NewMaster creates and returns a new Master.

type MasterCtlHandler

type MasterCtlHandler struct {
	// contains filtered or unexported fields
}

MasterCtlHandler defines control-oriented methods that conform to the Go's RPC requirement.

func (*MasterCtlHandler) CuratorHeartbeat

func (h *MasterCtlHandler) CuratorHeartbeat(req core.CuratorHeartbeatReq, reply *core.CuratorHeartbeatReply) error

CuratorHeartbeat is used to notify the Master that a Curator is still alive.

func (*MasterCtlHandler) MasterTractserverHeartbeat

MasterTractserverHeartbeat handles heartbeats from tractservers. These are sent occasionally to learn about new curators and changes in curator locations.

func (*MasterCtlHandler) NewPartition

func (h *MasterCtlHandler) NewPartition(req core.NewPartitionReq, reply *core.NewPartitionReply) error

NewPartition is used to allocate a new partition to the provided curator.

func (*MasterCtlHandler) RegisterCurator

func (h *MasterCtlHandler) RegisterCurator(req core.RegisterCuratorReq, reply *core.RegisterCuratorReply) error

RegisterCurator is called when a new Curator is added to the system. It is assigned a persistent ID by the Master that it must use in all future communications.

func (*MasterCtlHandler) RegisterTractserver

func (h *MasterCtlHandler) RegisterTractserver(req core.RegisterTractserverReq, reply *core.RegisterTractserverReply) error

RegisterTractserver is called when a new Tractserver is added to the system. It is assigned a persistent ID by the Master that it must use in all future communications.

type MasterSrvHandler

type MasterSrvHandler struct {
	// contains filtered or unexported fields
}

MasterSrvHandler defines client-oriented methods that conform to the Go's RPC requirement. Different from MasterCtlHandler, MasterSrvHandler is rate-limited.

func (*MasterSrvHandler) GetTractserverInfo

func (h *MasterSrvHandler) GetTractserverInfo(req core.GetTractserverInfoReq, reply *core.GetTractserverInfoReply) error

GetTractserverInfo returns a summary of tractservers.

func (*MasterSrvHandler) ListPartitions

func (h *MasterSrvHandler) ListPartitions(req core.ListPartitionsReq, reply *core.ListPartitionsReply) error

ListPartitions returns all known partitions.

func (*MasterSrvHandler) LookupCurator

func (h *MasterSrvHandler) LookupCurator(req core.LookupCuratorReq, reply *core.LookupCuratorReply) error

LookupCurator is used to locate the Curator for a blob that already exists.

func (*MasterSrvHandler) LookupPartition

func (h *MasterSrvHandler) LookupPartition(req core.LookupPartitionReq, reply *core.LookupPartitionReply) error

LookupPartition is used to locate the Curator for a partition.

func (*MasterSrvHandler) MasterCreateBlob

func (h *MasterSrvHandler) MasterCreateBlob(req core.MasterCreateBlobReq, reply *core.LookupCuratorReply) error

MasterCreateBlob is used to choose a curator to create a blob.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is the RPC server implementation for the Master.

func NewServer

func NewServer(master *Master, cfg Config, raft *raft.Raft, storage *raft.Storage) *Server

NewServer creates a new Master Server.

func (*Server) Start

func (s *Server) Start() (err error)

Start starts the RPC server.

type StatusData

type StatusData struct {
	JobName      string
	Cfg          Config
	LeaderAddr   string
	Members      []string
	RaftTerm     uint64
	FreeMem      uint64
	TotalMem     uint64
	Curators     []CuratorInfo
	Tractservers []TractserverInfo

	Reboot time.Time
	CtlRPC map[string]string
	SrvRPC map[string]string
	Now    time.Time
}

StatusData includes master status info.

type TractserverInfo

type TractserverInfo struct {
	core.TractserverInfo
}

TractserverInfo contains information about the last heartbeat received from a TS.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL