Documentation ¶
Index ¶
- Constants
- Variables
- func CheckPDVersion(opt *config.PersistOptions)
- func NewTestMultiConfig(c *assertutil.Checker, count int) []*config.Config
- func NewTestSingleConfig(c *assertutil.Checker) *config.Config
- type GrpcServer
- func (s *GrpcServer) AllocID(ctx context.Context, request *pdpb.AllocIDRequest) (*pdpb.AllocIDResponse, error)
- func (s *GrpcServer) AskBatchSplit(ctx context.Context, request *pdpb.AskBatchSplitRequest) (*pdpb.AskBatchSplitResponse, error)
- func (s *GrpcServer) AskSplit(ctx context.Context, request *pdpb.AskSplitRequest) (*pdpb.AskSplitResponse, error)
- func (s *GrpcServer) Bootstrap(ctx context.Context, request *pdpb.BootstrapRequest) (*pdpb.BootstrapResponse, error)
- func (s *GrpcServer) GetAllStores(ctx context.Context, request *pdpb.GetAllStoresRequest) (*pdpb.GetAllStoresResponse, error)
- func (s *GrpcServer) GetClusterConfig(ctx context.Context, request *pdpb.GetClusterConfigRequest) (*pdpb.GetClusterConfigResponse, error)
- func (s *GrpcServer) GetClusterInfo(ctx context.Context, _ *pdpb.GetClusterInfoRequest) (*pdpb.GetClusterInfoResponse, error)
- func (s *GrpcServer) GetDCLocationInfo(ctx context.Context, request *pdpb.GetDCLocationInfoRequest) (*pdpb.GetDCLocationInfoResponse, error)
- func (s *GrpcServer) GetExternalTimestamp(ctx context.Context, request *pdpb.GetExternalTimestampRequest) (*pdpb.GetExternalTimestampResponse, error)
- func (s *GrpcServer) GetGCSafePoint(ctx context.Context, request *pdpb.GetGCSafePointRequest) (*pdpb.GetGCSafePointResponse, error)
- func (s *GrpcServer) GetMembers(context.Context, *pdpb.GetMembersRequest) (*pdpb.GetMembersResponse, error)
- func (s *GrpcServer) GetOperator(ctx context.Context, request *pdpb.GetOperatorRequest) (*pdpb.GetOperatorResponse, error)
- func (s *GrpcServer) GetPrevRegion(ctx context.Context, request *pdpb.GetRegionRequest) (*pdpb.GetRegionResponse, error)
- func (s *GrpcServer) GetRegion(ctx context.Context, request *pdpb.GetRegionRequest) (*pdpb.GetRegionResponse, error)
- func (s *GrpcServer) GetRegionByID(ctx context.Context, request *pdpb.GetRegionByIDRequest) (*pdpb.GetRegionResponse, error)
- func (s *GrpcServer) GetStore(ctx context.Context, request *pdpb.GetStoreRequest) (*pdpb.GetStoreResponse, error)
- func (s *GrpcServer) IsBootstrapped(ctx context.Context, request *pdpb.IsBootstrappedRequest) (*pdpb.IsBootstrappedResponse, error)
- func (s *GrpcServer) IsSnapshotRecovering(ctx context.Context, request *pdpb.IsSnapshotRecoveringRequest) (*pdpb.IsSnapshotRecoveringResponse, error)
- func (s *GrpcServer) LoadGlobalConfig(ctx context.Context, request *pdpb.LoadGlobalConfigRequest) (*pdpb.LoadGlobalConfigResponse, error)
- func (s *GrpcServer) PutClusterConfig(ctx context.Context, request *pdpb.PutClusterConfigRequest) (*pdpb.PutClusterConfigResponse, error)
- func (s *GrpcServer) PutStore(ctx context.Context, request *pdpb.PutStoreRequest) (*pdpb.PutStoreResponse, error)
- func (s *GrpcServer) RegionHeartbeat(stream pdpb.PD_RegionHeartbeatServer) error
- func (s *GrpcServer) ReportBatchSplit(ctx context.Context, request *pdpb.ReportBatchSplitRequest) (*pdpb.ReportBatchSplitResponse, error)
- func (s *GrpcServer) ReportBuckets(stream pdpb.PD_ReportBucketsServer) error
- func (s *GrpcServer) ReportMinResolvedTS(ctx context.Context, request *pdpb.ReportMinResolvedTsRequest) (*pdpb.ReportMinResolvedTsResponse, error)
- func (s *GrpcServer) ReportSplit(ctx context.Context, request *pdpb.ReportSplitRequest) (*pdpb.ReportSplitResponse, error)
- func (s *GrpcServer) ScanRegions(ctx context.Context, request *pdpb.ScanRegionsRequest) (*pdpb.ScanRegionsResponse, error)
- func (s *GrpcServer) ScatterRegion(ctx context.Context, request *pdpb.ScatterRegionRequest) (*pdpb.ScatterRegionResponse, error)
- func (s *GrpcServer) SetExternalTimestamp(ctx context.Context, request *pdpb.SetExternalTimestampRequest) (*pdpb.SetExternalTimestampResponse, error)
- func (s *GrpcServer) SplitAndScatterRegions(ctx context.Context, request *pdpb.SplitAndScatterRegionsRequest) (*pdpb.SplitAndScatterRegionsResponse, error)
- func (s *GrpcServer) SplitRegions(ctx context.Context, request *pdpb.SplitRegionsRequest) (*pdpb.SplitRegionsResponse, error)
- func (s *GrpcServer) StoreGlobalConfig(_ context.Context, request *pdpb.StoreGlobalConfigRequest) (*pdpb.StoreGlobalConfigResponse, error)
- func (s *GrpcServer) StoreHeartbeat(ctx context.Context, request *pdpb.StoreHeartbeatRequest) (*pdpb.StoreHeartbeatResponse, error)
- func (s *GrpcServer) SyncMaxTS(_ context.Context, request *pdpb.SyncMaxTSRequest) (*pdpb.SyncMaxTSResponse, error)
- func (s *GrpcServer) SyncRegions(stream pdpb.PD_SyncRegionsServer) error
- func (s *GrpcServer) Tso(stream pdpb.PD_TsoServer) error
- func (s *GrpcServer) UpdateGCSafePoint(ctx context.Context, request *pdpb.UpdateGCSafePointRequest) (*pdpb.UpdateGCSafePointResponse, error)
- func (s *GrpcServer) UpdateServiceGCSafePoint(ctx context.Context, request *pdpb.UpdateServiceGCSafePointRequest) (*pdpb.UpdateServiceGCSafePointResponse, error)
- func (s *GrpcServer) WatchGlobalConfig(req *pdpb.WatchGlobalConfigRequest, server pdpb.PD_WatchGlobalConfigServer) error
- type Handler
- func (h *Handler) AddAddLearnerOperator(regionID uint64, toStoreID uint64) error
- func (h *Handler) AddAddPeerOperator(regionID uint64, toStoreID uint64) error
- func (h *Handler) AddBalanceHotRegionScheduler() error
- func (h *Handler) AddBalanceLeaderScheduler() error
- func (h *Handler) AddBalanceRegionScheduler() error
- func (h *Handler) AddBalanceWitnessScheduler() error
- func (h *Handler) AddEvictLeaderScheduler(storeID uint64) error
- func (h *Handler) AddEvictOrGrant(storeID float64, name string) error
- func (h *Handler) AddEvictSlowStoreScheduler() error
- func (h *Handler) AddEvictSlowTrendScheduler() error
- func (h *Handler) AddGrantHotRegionScheduler(leaderID, peers string) error
- func (h *Handler) AddGrantLeaderScheduler(storeID uint64) error
- func (h *Handler) AddLabelScheduler() error
- func (h *Handler) AddMergeRegionOperator(regionID uint64, targetID uint64) error
- func (h *Handler) AddRandomMergeScheduler() error
- func (h *Handler) AddRemovePeerOperator(regionID uint64, fromStoreID uint64) error
- func (h *Handler) AddScatterRangeScheduler(args ...string) error
- func (h *Handler) AddScatterRegionOperator(regionID uint64, group string) error
- func (h *Handler) AddScatterRegionsOperators(regionIDs []uint64, startRawKey, endRawKey, group string, retryLimit int) (int, error)
- func (h *Handler) AddScheduler(name string, args ...string) error
- func (h *Handler) AddShuffleHotRegionScheduler(limit uint64) error
- func (h *Handler) AddShuffleLeaderScheduler() error
- func (h *Handler) AddShuffleRegionScheduler() error
- func (h *Handler) AddSplitBucketScheduler() error
- func (h *Handler) AddSplitRegionOperator(regionID uint64, policyStr string, keys []string) error
- func (h *Handler) AddTransferLeaderOperator(regionID uint64, storeID uint64) error
- func (h *Handler) AddTransferPeerOperator(regionID uint64, fromStoreID, toStoreID uint64) error
- func (h *Handler) AddTransferRegionOperator(regionID uint64, storeIDs map[uint64]placement.PeerRoleType) error
- func (h *Handler) AddTransferWitnessLeaderScheduler() error
- func (h *Handler) GetAddr() string
- func (h *Handler) GetAdminOperators() ([]*operator.Operator, error)
- func (h *Handler) GetAllStoresLimit(limitType storelimit.Type) (map[uint64]config.StoreLimitConfig, error)
- func (h *Handler) GetHistory(start time.Time) ([]operator.OpHistory, error)
- func (h *Handler) GetHistoryHotRegionIter(hotRegionTypes []string, startTime, endTime int64) storage.HotRegionStorageIterator
- func (h *Handler) GetHotReadRegions() *statistics.StoreHotPeersInfos
- func (h *Handler) GetHotRegionsReservedDays() uint64
- func (h *Handler) GetHotRegionsWriteInterval() time.Duration
- func (h *Handler) GetHotWriteRegions() *statistics.StoreHotPeersInfos
- func (h *Handler) GetLeaderOperators() ([]*operator.Operator, error)
- func (h *Handler) GetOfflinePeer(typ statistics.RegionStatisticType) ([]*core.RegionInfo, error)
- func (h *Handler) GetOperator(regionID uint64) (*operator.Operator, error)
- func (h *Handler) GetOperatorController() (*schedule.OperatorController, error)
- func (h *Handler) GetOperatorStatus(regionID uint64) (*schedule.OperatorWithStatus, error)
- func (h *Handler) GetOperators() ([]*operator.Operator, error)
- func (h *Handler) GetOperatorsOfKind(mask operator.OpKind) ([]*operator.Operator, error)
- func (h *Handler) GetPausedSchedulerDelayAt(name string) (int64, error)
- func (h *Handler) GetPausedSchedulerDelayUntil(name string) (int64, error)
- func (h *Handler) GetProgressByAction(action string) (p, ls, cs float64, err error)
- func (h *Handler) GetProgressByID(storeID string) (action string, p, ls, cs float64, err error)
- func (h *Handler) GetRaftCluster() (*cluster.RaftCluster, error)
- func (h *Handler) GetRecords(from time.Time) ([]*operator.OpRecord, error)
- func (h *Handler) GetRegionOperators() ([]*operator.Operator, error)
- func (h *Handler) GetRegionsByType(typ statistics.RegionStatisticType) ([]*core.RegionInfo, error)
- func (h *Handler) GetScheduleConfig() *config.ScheduleConfig
- func (h *Handler) GetSchedulerConfigHandler() (http.Handler, error)
- func (h *Handler) GetSchedulers() ([]string, error)
- func (h *Handler) GetStoreLimitScene(limitType storelimit.Type) *storelimit.Scene
- func (h *Handler) GetStores() ([]*core.StoreInfo, error)
- func (h *Handler) GetStoresLoads() map[uint64][]float64
- func (h *Handler) GetWaitingOperators() ([]*operator.Operator, error)
- func (h *Handler) IsCheckerPaused(name string) (bool, error)
- func (h *Handler) IsLeader() bool
- func (h *Handler) IsSchedulerDisabled(name string) (bool, error)
- func (h *Handler) IsSchedulerExisted(name string) (bool, error)
- func (h *Handler) IsSchedulerPaused(name string) (bool, error)
- func (h *Handler) PackHistoryHotReadRegions() ([]storage.HistoryHotRegion, error)
- func (h *Handler) PackHistoryHotWriteRegions() ([]storage.HistoryHotRegion, error)
- func (h *Handler) PauseOrResumeChecker(name string, t int64) error
- func (h *Handler) PauseOrResumeScheduler(name string, t int64) error
- func (h *Handler) PluginLoad(pluginPath string) error
- func (h *Handler) PluginUnload(pluginPath string) error
- func (h *Handler) RemoveOperator(regionID uint64) error
- func (h *Handler) RemoveScheduler(name string) error
- func (h *Handler) ResetTS(ts uint64, ignoreSmaller, skipUpperBoundCheck bool, _ uint32) error
- func (h *Handler) SetAllStoresLimit(ratePerMin float64, limitType storelimit.Type) error
- func (h *Handler) SetAllStoresLimitTTL(ratePerMin float64, limitType storelimit.Type, ttl time.Duration) error
- func (h *Handler) SetLabelStoresLimit(ratePerMin float64, limitType storelimit.Type, labels []*metapb.StoreLabel) error
- func (h *Handler) SetStoreLimit(storeID uint64, ratePerMin float64, limitType storelimit.Type) error
- func (h *Handler) SetStoreLimitScene(scene *storelimit.Scene, limitType storelimit.Type)
- func (h *Handler) SetStoreLimitTTL(data string, value float64, ttl time.Duration) error
- type HandlerBuilder
- type KeyspaceServer
- func (s *KeyspaceServer) LoadKeyspace(_ context.Context, request *keyspacepb.LoadKeyspaceRequest) (*keyspacepb.LoadKeyspaceResponse, error)
- func (s *KeyspaceServer) UpdateKeyspaceState(_ context.Context, request *keyspacepb.UpdateKeyspaceStateRequest) (*keyspacepb.UpdateKeyspaceStateResponse, error)
- func (s *KeyspaceServer) WatchKeyspaces(request *keyspacepb.WatchKeyspacesRequest, ...) error
- type Server
- func (s *Server) AddCloseCallback(callbacks ...func())
- func (s *Server) AddServiceLabel(serviceLabel string, accessPath apiutil.AccessPath)
- func (s *Server) AddServiceReadyCallback(callbacks ...func(context.Context))
- func (s *Server) AddStartCallback(callbacks ...func())
- func (s *Server) Close()
- func (s *Server) ClusterID() uint64
- func (s *Server) Context() context.Context
- func (s *Server) DeleteLabelProperty(typ, labelKey, labelValue string) error
- func (s *Server) GetAPIAccessServiceLabel(accessPath apiutil.AccessPath) string
- func (s *Server) GetAddr() string
- func (s *Server) GetAllocator() id.Allocator
- func (s *Server) GetAuditBackend() []audit.Backend
- func (s *Server) GetAuditConfig() *config.AuditConfig
- func (s *Server) GetBasicCluster() *core.BasicCluster
- func (s *Server) GetClient() *clientv3.Client
- func (s *Server) GetClientScheme() string
- func (s *Server) GetCluster() *metapb.Cluster
- func (s *Server) GetClusterStatus() (*cluster.Status, error)
- func (s *Server) GetClusterVersion() semver.Version
- func (s *Server) GetConfig() *config.Config
- func (s *Server) GetControllerConfig() *rm_server.ControllerConfig
- func (s *Server) GetEndpoints() []string
- func (s *Server) GetExternalTS() uint64
- func (s *Server) GetHBStreams() *hbstream.HeartbeatStreams
- func (s *Server) GetHTTPClient() *http.Client
- func (s *Server) GetHandler() *Handler
- func (s *Server) GetHistoryHotRegionStorage() *storage.HotRegionStorage
- func (s *Server) GetKeyspaceGroupManager() *keyspace.GroupManager
- func (s *Server) GetKeyspaceManager() *keyspace.Manager
- func (s *Server) GetLabelProperty() config.LabelPropertyConfig
- func (s *Server) GetLeader() *pdpb.Member
- func (s *Server) GetLeaderLease() int64
- func (s *Server) GetLeaderListenUrls() []string
- func (s *Server) GetMaxResetTSGap() time.Duration
- func (s *Server) GetMember() *member.EmbeddedEtcdMember
- func (s *Server) GetMemberInfo() *pdpb.Member
- func (s *Server) GetMembers() ([]*pdpb.Member, error)
- func (s *Server) GetMetaRegions() []*metapb.Region
- func (s *Server) GetPDServerConfig() *config.PDServerConfig
- func (s *Server) GetPersistOptions() *config.PersistOptions
- func (s *Server) GetRaftCluster() *cluster.RaftCluster
- func (s *Server) GetRateLimitConfig() *config.RateLimitConfig
- func (s *Server) GetRegions() []*core.RegionInfo
- func (s *Server) GetReplicationConfig() *config.ReplicationConfig
- func (s *Server) GetReplicationModeConfig() *config.ReplicationModeConfig
- func (s *Server) GetScheduleConfig() *config.ScheduleConfig
- func (s *Server) GetServerOption() *config.PersistOptions
- func (s *Server) GetServiceAuditBackendLabels(serviceLabel string) *audit.BackendLabels
- func (s *Server) GetServiceLabels(serviceLabel string) []apiutil.AccessPath
- func (s *Server) GetServiceMiddlewareConfig() *config.ServiceMiddlewareConfig
- func (s *Server) GetServiceMiddlewarePersistOptions() *config.ServiceMiddlewarePersistOptions
- func (s *Server) GetServicePrimaryAddr(ctx context.Context, serviceName string) (string, bool)
- func (s *Server) GetServiceRateLimiter() *ratelimit.Limiter
- func (s *Server) GetStorage() storage.Storage
- func (s *Server) GetTLSConfig() *grpcutil.TLSConfig
- func (s *Server) GetTSOAllocatorManager() *tso.AllocatorManager
- func (s *Server) GetTSOSaveInterval() time.Duration
- func (s *Server) GetTSOUpdatePhysicalInterval() time.Duration
- func (s *Server) IsAPIServiceMode() bool
- func (s *Server) IsClosed() bool
- func (s *Server) IsInRateLimitAllowList(serviceLabel string) bool
- func (s *Server) IsLocalTSOEnabled() bool
- func (s *Server) IsServing() bool
- func (s *Server) IsSnapshotRecovering(ctx context.Context) (bool, error)
- func (s *Server) IsTTLConfigExist(key string) bool
- func (s *Server) LoopContext() context.Context
- func (s *Server) MarkSnapshotRecovering() error
- func (s *Server) Name() string
- func (s *Server) PersistFile(name string, data []byte) error
- func (s *Server) RecoverAllocID(ctx context.Context, id uint64) error
- func (s *Server) ReplicateFileToMember(ctx context.Context, member *pdpb.Member, name string, data []byte) error
- func (s *Server) Run() error
- func (s *Server) SaveTTLConfig(data map[string]interface{}, ttl time.Duration) error
- func (s *Server) SetAuditConfig(cfg config.AuditConfig) error
- func (s *Server) SetClusterVersion(v string) error
- func (s *Server) SetEnableLocalTSO(enableLocalTSO bool)
- func (s *Server) SetExternalTS(externalTS, globalTS uint64) error
- func (s *Server) SetLabelProperty(typ, labelKey, labelValue string) error
- func (s *Server) SetLabelPropertyConfig(cfg config.LabelPropertyConfig) error
- func (s *Server) SetLogLevel(level string) error
- func (s *Server) SetPDServerConfig(cfg config.PDServerConfig) error
- func (s *Server) SetRateLimitConfig(cfg config.RateLimitConfig) error
- func (s *Server) SetReplicationConfig(cfg config.ReplicationConfig) error
- func (s *Server) SetReplicationModeConfig(cfg config.ReplicationModeConfig) error
- func (s *Server) SetScheduleConfig(cfg config.ScheduleConfig) error
- func (s *Server) SetServiceAuditBackendForHTTP(route *mux.Route, labels ...string)
- func (s *Server) SetServiceAuditBackendLabels(serviceLabel string, labels []string)
- func (s *Server) SetStorage(storage storage.Storage)
- func (s *Server) StartTimestamp() int64
- func (s *Server) UnmarkSnapshotRecovering(ctx context.Context) error
- func (s *Server) UpdateRateLimit(cfg *config.RateLimitConfig, key string, value interface{}) error
- func (s *Server) UpdateRateLimitConfig(key, label string, value ratelimit.DimensionConfig) error
- func (s *Server) UpdateServiceRateLimiter(serviceLabel string, opts ...ratelimit.Option) ratelimit.UpdateStatus
Constants ¶
const ( // PDMode represents that server is in PD mode. PDMode = "PD" // APIServiceMode represents that server is in API service mode. APIServiceMode = "API service" )
Variables ¶
var ( // ErrNotLeader is returned when current server is not the leader and not possible to process request. // TODO: work as proxy. ErrNotLeader = status.Errorf(codes.Unavailable, "not leader") ErrNotStarted = status.Errorf(codes.Unavailable, "server not started") ErrSendHeartbeatTimeout = status.Errorf(codes.DeadlineExceeded, "send heartbeat timeout") ErrNotFoundTSOAddr = status.Errorf(codes.NotFound, "not found tso address") )
gRPC errors
var ( // SchedulerConfigHandlerPath is the api router path of the schedule config handler. SchedulerConfigHandlerPath = "/api/v1/scheduler-config" // ErrOperatorNotFound is error info for operator not found. ErrOperatorNotFound = errors.New("operator not found") // ErrAddOperator is error info for already have an operator when adding operator. ErrAddOperator = errors.New("failed to add operator, maybe already have one") // ErrRegionNotAdjacent is error info for region not adjacent. ErrRegionNotAdjacent = errors.New("two regions are not adjacent") // ErrRegionNotFound is error info for region not found. ErrRegionNotFound = func(regionID uint64) error { return errors.Errorf("region %v not found", regionID) } // ErrRegionAbnormalPeer is error info for region has abnormal peer. ErrRegionAbnormalPeer = func(regionID uint64) error { return errors.Errorf("region %v has abnormal peer", regionID) } // ErrStoreNotFound is error info for store not found. ErrStoreNotFound = func(storeID uint64) error { return errors.Errorf("store %v not found", storeID) } // ErrPluginNotFound is error info for plugin not found. ErrPluginNotFound = func(pluginPath string) error { return errors.Errorf("plugin is not found: %s", pluginPath) } )
var EtcdStartTimeout = time.Minute * 5
EtcdStartTimeout the timeout of the startup etcd.
Functions ¶
func CheckPDVersion ¶
func CheckPDVersion(opt *config.PersistOptions)
CheckPDVersion checks if PD needs to be upgraded.
func NewTestMultiConfig ¶
func NewTestMultiConfig(c *assertutil.Checker, count int) []*config.Config
NewTestMultiConfig is only for test to create multiple pd configurations. Because PD client also needs this, so export here.
func NewTestSingleConfig ¶
func NewTestSingleConfig(c *assertutil.Checker) *config.Config
NewTestSingleConfig is only for test to create one pd. Because PD client also needs this, so export here.
Types ¶
type GrpcServer ¶
type GrpcServer struct {
*Server
}
GrpcServer wraps Server to provide grpc service.
func (*GrpcServer) AllocID ¶
func (s *GrpcServer) AllocID(ctx context.Context, request *pdpb.AllocIDRequest) (*pdpb.AllocIDResponse, error)
AllocID implements gRPC PDServer.
func (*GrpcServer) AskBatchSplit ¶
func (s *GrpcServer) AskBatchSplit(ctx context.Context, request *pdpb.AskBatchSplitRequest) (*pdpb.AskBatchSplitResponse, error)
AskBatchSplit implements gRPC PDServer.
func (*GrpcServer) AskSplit ¶
func (s *GrpcServer) AskSplit(ctx context.Context, request *pdpb.AskSplitRequest) (*pdpb.AskSplitResponse, error)
AskSplit implements gRPC PDServer.
func (*GrpcServer) Bootstrap ¶
func (s *GrpcServer) Bootstrap(ctx context.Context, request *pdpb.BootstrapRequest) (*pdpb.BootstrapResponse, error)
Bootstrap implements gRPC PDServer.
func (*GrpcServer) GetAllStores ¶
func (s *GrpcServer) GetAllStores(ctx context.Context, request *pdpb.GetAllStoresRequest) (*pdpb.GetAllStoresResponse, error)
GetAllStores implements gRPC PDServer.
func (*GrpcServer) GetClusterConfig ¶
func (s *GrpcServer) GetClusterConfig(ctx context.Context, request *pdpb.GetClusterConfigRequest) (*pdpb.GetClusterConfigResponse, error)
GetClusterConfig implements gRPC PDServer.
func (*GrpcServer) GetClusterInfo ¶
func (s *GrpcServer) GetClusterInfo(ctx context.Context, _ *pdpb.GetClusterInfoRequest) (*pdpb.GetClusterInfoResponse, error)
GetClusterInfo implements gRPC PDServer.
func (*GrpcServer) GetDCLocationInfo ¶
func (s *GrpcServer) GetDCLocationInfo(ctx context.Context, request *pdpb.GetDCLocationInfoRequest) (*pdpb.GetDCLocationInfoResponse, error)
GetDCLocationInfo gets the dc-location info of the given dc-location from PD leader's TSO allocator manager.
func (*GrpcServer) GetExternalTimestamp ¶
func (s *GrpcServer) GetExternalTimestamp(ctx context.Context, request *pdpb.GetExternalTimestampRequest) (*pdpb.GetExternalTimestampResponse, error)
GetExternalTimestamp implements gRPC PDServer.
func (*GrpcServer) GetGCSafePoint ¶
func (s *GrpcServer) GetGCSafePoint(ctx context.Context, request *pdpb.GetGCSafePointRequest) (*pdpb.GetGCSafePointResponse, error)
GetGCSafePoint implements gRPC PDServer.
func (*GrpcServer) GetMembers ¶
func (s *GrpcServer) GetMembers(context.Context, *pdpb.GetMembersRequest) (*pdpb.GetMembersResponse, error)
GetMembers implements gRPC PDServer.
func (*GrpcServer) GetOperator ¶
func (s *GrpcServer) GetOperator(ctx context.Context, request *pdpb.GetOperatorRequest) (*pdpb.GetOperatorResponse, error)
GetOperator gets information about the operator belonging to the specify region.
func (*GrpcServer) GetPrevRegion ¶
func (s *GrpcServer) GetPrevRegion(ctx context.Context, request *pdpb.GetRegionRequest) (*pdpb.GetRegionResponse, error)
GetPrevRegion implements gRPC PDServer
func (*GrpcServer) GetRegion ¶
func (s *GrpcServer) GetRegion(ctx context.Context, request *pdpb.GetRegionRequest) (*pdpb.GetRegionResponse, error)
GetRegion implements gRPC PDServer.
func (*GrpcServer) GetRegionByID ¶
func (s *GrpcServer) GetRegionByID(ctx context.Context, request *pdpb.GetRegionByIDRequest) (*pdpb.GetRegionResponse, error)
GetRegionByID implements gRPC PDServer.
func (*GrpcServer) GetStore ¶
func (s *GrpcServer) GetStore(ctx context.Context, request *pdpb.GetStoreRequest) (*pdpb.GetStoreResponse, error)
GetStore implements gRPC PDServer.
func (*GrpcServer) IsBootstrapped ¶
func (s *GrpcServer) IsBootstrapped(ctx context.Context, request *pdpb.IsBootstrappedRequest) (*pdpb.IsBootstrappedResponse, error)
IsBootstrapped implements gRPC PDServer.
func (*GrpcServer) IsSnapshotRecovering ¶
func (s *GrpcServer) IsSnapshotRecovering(ctx context.Context, request *pdpb.IsSnapshotRecoveringRequest) (*pdpb.IsSnapshotRecoveringResponse, error)
IsSnapshotRecovering implements gRPC PDServer.
func (*GrpcServer) LoadGlobalConfig ¶
func (s *GrpcServer) LoadGlobalConfig(ctx context.Context, request *pdpb.LoadGlobalConfigRequest) (*pdpb.LoadGlobalConfigResponse, error)
LoadGlobalConfig support 2 ways to load global config from etcd - `Names` iteratively get value from `ConfigPath/Name` but not care about revision - `ConfigPath` if `Names` is nil can get all values and revision of current path
func (*GrpcServer) PutClusterConfig ¶
func (s *GrpcServer) PutClusterConfig(ctx context.Context, request *pdpb.PutClusterConfigRequest) (*pdpb.PutClusterConfigResponse, error)
PutClusterConfig implements gRPC PDServer.
func (*GrpcServer) PutStore ¶
func (s *GrpcServer) PutStore(ctx context.Context, request *pdpb.PutStoreRequest) (*pdpb.PutStoreResponse, error)
PutStore implements gRPC PDServer.
func (*GrpcServer) RegionHeartbeat ¶
func (s *GrpcServer) RegionHeartbeat(stream pdpb.PD_RegionHeartbeatServer) error
RegionHeartbeat implements gRPC PDServer.
func (*GrpcServer) ReportBatchSplit ¶
func (s *GrpcServer) ReportBatchSplit(ctx context.Context, request *pdpb.ReportBatchSplitRequest) (*pdpb.ReportBatchSplitResponse, error)
ReportBatchSplit implements gRPC PDServer.
func (*GrpcServer) ReportBuckets ¶
func (s *GrpcServer) ReportBuckets(stream pdpb.PD_ReportBucketsServer) error
ReportBuckets implements gRPC PDServer
func (*GrpcServer) ReportMinResolvedTS ¶
func (s *GrpcServer) ReportMinResolvedTS(ctx context.Context, request *pdpb.ReportMinResolvedTsRequest) (*pdpb.ReportMinResolvedTsResponse, error)
ReportMinResolvedTS implements gRPC PDServer.
func (*GrpcServer) ReportSplit ¶
func (s *GrpcServer) ReportSplit(ctx context.Context, request *pdpb.ReportSplitRequest) (*pdpb.ReportSplitResponse, error)
ReportSplit implements gRPC PDServer.
func (*GrpcServer) ScanRegions ¶
func (s *GrpcServer) ScanRegions(ctx context.Context, request *pdpb.ScanRegionsRequest) (*pdpb.ScanRegionsResponse, error)
ScanRegions implements gRPC PDServer.
func (*GrpcServer) ScatterRegion ¶
func (s *GrpcServer) ScatterRegion(ctx context.Context, request *pdpb.ScatterRegionRequest) (*pdpb.ScatterRegionResponse, error)
ScatterRegion implements gRPC PDServer.
func (*GrpcServer) SetExternalTimestamp ¶
func (s *GrpcServer) SetExternalTimestamp(ctx context.Context, request *pdpb.SetExternalTimestampRequest) (*pdpb.SetExternalTimestampResponse, error)
SetExternalTimestamp implements gRPC PDServer.
func (*GrpcServer) SplitAndScatterRegions ¶
func (s *GrpcServer) SplitAndScatterRegions(ctx context.Context, request *pdpb.SplitAndScatterRegionsRequest) (*pdpb.SplitAndScatterRegionsResponse, error)
SplitAndScatterRegions split regions by the given split keys, and scatter regions. Only regions which splited successfully will be scattered. scatterFinishedPercentage indicates the percentage of successfully splited regions that are scattered.
func (*GrpcServer) SplitRegions ¶
func (s *GrpcServer) SplitRegions(ctx context.Context, request *pdpb.SplitRegionsRequest) (*pdpb.SplitRegionsResponse, error)
SplitRegions split regions by the given split keys
func (*GrpcServer) StoreGlobalConfig ¶
func (s *GrpcServer) StoreGlobalConfig(_ context.Context, request *pdpb.StoreGlobalConfigRequest) (*pdpb.StoreGlobalConfigResponse, error)
StoreGlobalConfig store global config into etcd by transaction Since item value needs to support marshal of different struct types, it should be set to `Payload bytes` instead of `Value string`
func (*GrpcServer) StoreHeartbeat ¶
func (s *GrpcServer) StoreHeartbeat(ctx context.Context, request *pdpb.StoreHeartbeatRequest) (*pdpb.StoreHeartbeatResponse, error)
StoreHeartbeat implements gRPC PDServer.
func (*GrpcServer) SyncMaxTS ¶
func (s *GrpcServer) SyncMaxTS(_ context.Context, request *pdpb.SyncMaxTSRequest) (*pdpb.SyncMaxTSResponse, error)
SyncMaxTS will check whether MaxTS is the biggest one among all Local TSOs this PD is holding when skipCheck is set, and write it into all Local TSO Allocators then if it's indeed the biggest one.
func (*GrpcServer) SyncRegions ¶
func (s *GrpcServer) SyncRegions(stream pdpb.PD_SyncRegionsServer) error
SyncRegions syncs the regions.
func (*GrpcServer) Tso ¶
func (s *GrpcServer) Tso(stream pdpb.PD_TsoServer) error
Tso implements gRPC PDServer.
func (*GrpcServer) UpdateGCSafePoint ¶
func (s *GrpcServer) UpdateGCSafePoint(ctx context.Context, request *pdpb.UpdateGCSafePointRequest) (*pdpb.UpdateGCSafePointResponse, error)
UpdateGCSafePoint implements gRPC PDServer.
func (*GrpcServer) UpdateServiceGCSafePoint ¶
func (s *GrpcServer) UpdateServiceGCSafePoint(ctx context.Context, request *pdpb.UpdateServiceGCSafePointRequest) (*pdpb.UpdateServiceGCSafePointResponse, error)
UpdateServiceGCSafePoint update the safepoint for specific service
func (*GrpcServer) WatchGlobalConfig ¶
func (s *GrpcServer) WatchGlobalConfig(req *pdpb.WatchGlobalConfigRequest, server pdpb.PD_WatchGlobalConfigServer) error
WatchGlobalConfig will retry on recoverable errors forever until reconnected by Etcd.Watch() as long as the context has not been canceled or timed out. Watch on revision which greater than or equal to the required revision.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler is a helper to export methods to handle API/RPC requests.
func (*Handler) AddAddLearnerOperator ¶
AddAddLearnerOperator adds an operator to add learner.
func (*Handler) AddAddPeerOperator ¶
AddAddPeerOperator adds an operator to add peer.
func (*Handler) AddBalanceHotRegionScheduler ¶
AddBalanceHotRegionScheduler adds a balance-hot-region-scheduler.
func (*Handler) AddBalanceLeaderScheduler ¶
AddBalanceLeaderScheduler adds a balance-leader-scheduler.
func (*Handler) AddBalanceRegionScheduler ¶
AddBalanceRegionScheduler adds a balance-region-scheduler.
func (*Handler) AddBalanceWitnessScheduler ¶
AddBalanceWitnessScheduler adds a balance-witness-scheduler.
func (*Handler) AddEvictLeaderScheduler ¶
AddEvictLeaderScheduler adds an evict-leader-scheduler.
func (*Handler) AddEvictOrGrant ¶
AddEvictOrGrant add evict leader scheduler or grant leader scheduler.
func (*Handler) AddEvictSlowStoreScheduler ¶
AddEvictSlowStoreScheduler adds a evict-slow-store-scheduler.
func (*Handler) AddEvictSlowTrendScheduler ¶
AddEvictSlowTrendScheduler adds a evict-slow-trend-scheduler.
func (*Handler) AddGrantHotRegionScheduler ¶
AddGrantHotRegionScheduler adds a grant-hot-region-scheduler
func (*Handler) AddGrantLeaderScheduler ¶
AddGrantLeaderScheduler adds a grant-leader-scheduler.
func (*Handler) AddLabelScheduler ¶
AddLabelScheduler adds a label-scheduler.
func (*Handler) AddMergeRegionOperator ¶
AddMergeRegionOperator adds an operator to merge region.
func (*Handler) AddRandomMergeScheduler ¶
AddRandomMergeScheduler adds a random-merge-scheduler.
func (*Handler) AddRemovePeerOperator ¶
AddRemovePeerOperator adds an operator to remove peer.
func (*Handler) AddScatterRangeScheduler ¶
AddScatterRangeScheduler adds a balance-range-leader-scheduler
func (*Handler) AddScatterRegionOperator ¶
AddScatterRegionOperator adds an operator to scatter a region.
func (*Handler) AddScatterRegionsOperators ¶
func (h *Handler) AddScatterRegionsOperators(regionIDs []uint64, startRawKey, endRawKey, group string, retryLimit int) (int, error)
AddScatterRegionsOperators add operators to scatter regions and return the processed percentage and error
func (*Handler) AddScheduler ¶
AddScheduler adds a scheduler.
func (*Handler) AddShuffleHotRegionScheduler ¶
AddShuffleHotRegionScheduler adds a shuffle-hot-region-scheduler.
func (*Handler) AddShuffleLeaderScheduler ¶
AddShuffleLeaderScheduler adds a shuffle-leader-scheduler.
func (*Handler) AddShuffleRegionScheduler ¶
AddShuffleRegionScheduler adds a shuffle-region-scheduler.
func (*Handler) AddSplitBucketScheduler ¶
AddSplitBucketScheduler adds a split-bucket-scheduler.
func (*Handler) AddSplitRegionOperator ¶
AddSplitRegionOperator adds an operator to split a region.
func (*Handler) AddTransferLeaderOperator ¶
AddTransferLeaderOperator adds an operator to transfer leader to the store.
func (*Handler) AddTransferPeerOperator ¶
AddTransferPeerOperator adds an operator to transfer peer.
func (*Handler) AddTransferRegionOperator ¶
func (h *Handler) AddTransferRegionOperator(regionID uint64, storeIDs map[uint64]placement.PeerRoleType) error
AddTransferRegionOperator adds an operator to transfer region to the stores.
func (*Handler) AddTransferWitnessLeaderScheduler ¶
AddTransferWitnessLeaderScheduler adds a transfer-witness-leader-scheduler.
func (*Handler) GetAdminOperators ¶
GetAdminOperators returns the running admin operators.
func (*Handler) GetAllStoresLimit ¶
func (h *Handler) GetAllStoresLimit(limitType storelimit.Type) (map[uint64]config.StoreLimitConfig, error)
GetAllStoresLimit is used to get limit of all stores.
func (*Handler) GetHistory ¶
GetHistory returns finished operators' history since start.
func (*Handler) GetHistoryHotRegionIter ¶
func (h *Handler) GetHistoryHotRegionIter( hotRegionTypes []string, startTime, endTime int64, ) storage.HotRegionStorageIterator
GetHistoryHotRegionIter return a iter which iter all qualified item .
func (*Handler) GetHotReadRegions ¶
func (h *Handler) GetHotReadRegions() *statistics.StoreHotPeersInfos
GetHotReadRegions gets all hot read regions stats.
func (*Handler) GetHotRegionsReservedDays ¶
GetHotRegionsReservedDays gets days hot region information is kept.
func (*Handler) GetHotRegionsWriteInterval ¶
GetHotRegionsWriteInterval gets interval for PD to store Hot Region information..
func (*Handler) GetHotWriteRegions ¶
func (h *Handler) GetHotWriteRegions() *statistics.StoreHotPeersInfos
GetHotWriteRegions gets all hot write regions stats.
func (*Handler) GetLeaderOperators ¶
GetLeaderOperators returns the running leader operators.
func (*Handler) GetOfflinePeer ¶
func (h *Handler) GetOfflinePeer(typ statistics.RegionStatisticType) ([]*core.RegionInfo, error)
GetOfflinePeer gets the region with offline peer.
func (*Handler) GetOperator ¶
GetOperator returns the region operator.
func (*Handler) GetOperatorController ¶
func (h *Handler) GetOperatorController() (*schedule.OperatorController, error)
GetOperatorController returns OperatorController.
func (*Handler) GetOperatorStatus ¶
func (h *Handler) GetOperatorStatus(regionID uint64) (*schedule.OperatorWithStatus, error)
GetOperatorStatus returns the status of the region operator.
func (*Handler) GetOperators ¶
GetOperators returns the running operators.
func (*Handler) GetOperatorsOfKind ¶
GetOperatorsOfKind returns the running operators of the kind.
func (*Handler) GetPausedSchedulerDelayAt ¶
GetPausedSchedulerDelayAt returns paused unix timestamp when a scheduler is paused
func (*Handler) GetPausedSchedulerDelayUntil ¶
GetPausedSchedulerDelayUntil returns resume unix timestamp when a scheduler is paused
func (*Handler) GetProgressByAction ¶
GetProgressByAction returns the progress details for a given action.
func (*Handler) GetProgressByID ¶
GetProgressByID returns the progress details for a given store ID.
func (*Handler) GetRaftCluster ¶
func (h *Handler) GetRaftCluster() (*cluster.RaftCluster, error)
GetRaftCluster returns RaftCluster.
func (*Handler) GetRecords ¶
GetRecords returns finished operators since start.
func (*Handler) GetRegionOperators ¶
GetRegionOperators returns the running region operators.
func (*Handler) GetRegionsByType ¶
func (h *Handler) GetRegionsByType(typ statistics.RegionStatisticType) ([]*core.RegionInfo, error)
GetRegionsByType gets the region with specified type.
func (*Handler) GetScheduleConfig ¶
func (h *Handler) GetScheduleConfig() *config.ScheduleConfig
GetScheduleConfig returns ScheduleConfig.
func (*Handler) GetSchedulerConfigHandler ¶
GetSchedulerConfigHandler gets the handler of schedulers.
func (*Handler) GetSchedulers ¶
GetSchedulers returns all names of schedulers.
func (*Handler) GetStoreLimitScene ¶
func (h *Handler) GetStoreLimitScene(limitType storelimit.Type) *storelimit.Scene
GetStoreLimitScene returns the limit values for different scenes
func (*Handler) GetStoresLoads ¶
GetStoresLoads gets all hot write stores stats.
func (*Handler) GetWaitingOperators ¶
GetWaitingOperators returns the waiting operators.
func (*Handler) IsCheckerPaused ¶
IsCheckerPaused returns if checker is paused
func (*Handler) IsSchedulerDisabled ¶
IsSchedulerDisabled returns whether scheduler is disabled.
func (*Handler) IsSchedulerExisted ¶
IsSchedulerExisted returns whether scheduler is existed.
func (*Handler) IsSchedulerPaused ¶
IsSchedulerPaused returns whether scheduler is paused.
func (*Handler) PackHistoryHotReadRegions ¶
func (h *Handler) PackHistoryHotReadRegions() ([]storage.HistoryHotRegion, error)
PackHistoryHotReadRegions get read hot region info in HistoryHotRegion form.
func (*Handler) PackHistoryHotWriteRegions ¶
func (h *Handler) PackHistoryHotWriteRegions() ([]storage.HistoryHotRegion, error)
PackHistoryHotWriteRegions get write hot region info in HistoryHotRegion from
func (*Handler) PauseOrResumeChecker ¶
PauseOrResumeChecker pauses checker for delay seconds or resume checker t == 0 : resume checker. t > 0 : checker delays t seconds.
func (*Handler) PauseOrResumeScheduler ¶
PauseOrResumeScheduler pauses a scheduler for delay seconds or resume a paused scheduler. t == 0 : resume scheduler. t > 0 : scheduler delays t seconds.
func (*Handler) PluginLoad ¶
PluginLoad loads the plugin referenced by the pluginPath
func (*Handler) PluginUnload ¶
PluginUnload unloads the plugin referenced by the pluginPath
func (*Handler) RemoveOperator ¶
RemoveOperator removes the region operator.
func (*Handler) RemoveScheduler ¶
RemoveScheduler removes a scheduler by name.
func (*Handler) SetAllStoresLimit ¶
func (h *Handler) SetAllStoresLimit(ratePerMin float64, limitType storelimit.Type) error
SetAllStoresLimit is used to set limit of all stores.
func (*Handler) SetAllStoresLimitTTL ¶
func (h *Handler) SetAllStoresLimitTTL(ratePerMin float64, limitType storelimit.Type, ttl time.Duration) error
SetAllStoresLimitTTL is used to set limit of all stores with ttl
func (*Handler) SetLabelStoresLimit ¶
func (h *Handler) SetLabelStoresLimit(ratePerMin float64, limitType storelimit.Type, labels []*metapb.StoreLabel) error
SetLabelStoresLimit is used to set limit of label stores.
func (*Handler) SetStoreLimit ¶
func (h *Handler) SetStoreLimit(storeID uint64, ratePerMin float64, limitType storelimit.Type) error
SetStoreLimit is used to set the limit of a store.
func (*Handler) SetStoreLimitScene ¶
func (h *Handler) SetStoreLimitScene(scene *storelimit.Scene, limitType storelimit.Type)
SetStoreLimitScene sets the limit values for different scenes
type HandlerBuilder ¶
HandlerBuilder builds a server HTTP handler.
func CreateMockHandler ¶
func CreateMockHandler(re *require.Assertions, ip string) HandlerBuilder
CreateMockHandler creates a mock handler for test.
type KeyspaceServer ¶
type KeyspaceServer struct {
*GrpcServer
}
KeyspaceServer wraps GrpcServer to provide keyspace service.
func (*KeyspaceServer) LoadKeyspace ¶
func (s *KeyspaceServer) LoadKeyspace(_ context.Context, request *keyspacepb.LoadKeyspaceRequest) (*keyspacepb.LoadKeyspaceResponse, error)
LoadKeyspace load and return target keyspace metadata. Request must specify keyspace name. On Error, keyspaceMeta in response will be nil, error information will be encoded in response header with corresponding error type.
func (*KeyspaceServer) UpdateKeyspaceState ¶
func (s *KeyspaceServer) UpdateKeyspaceState(_ context.Context, request *keyspacepb.UpdateKeyspaceStateRequest) (*keyspacepb.UpdateKeyspaceStateResponse, error)
UpdateKeyspaceState updates the state of keyspace specified in the request.
func (*KeyspaceServer) WatchKeyspaces ¶
func (s *KeyspaceServer) WatchKeyspaces(request *keyspacepb.WatchKeyspacesRequest, stream keyspacepb.Keyspace_WatchKeyspacesServer) error
WatchKeyspaces captures and sends keyspace metadata changes to the client via gRPC stream. Note: It sends all existing keyspaces as it's first package to the client.
type Server ¶
type Server struct { diagnosticspb.DiagnosticsServer // contains filtered or unexported fields }
Server is the pd server. It implements bs.Server nolint
func CreateServer ¶
func CreateServer(ctx context.Context, cfg *config.Config, services []string, legacyServiceBuilders ...HandlerBuilder) (*Server, error)
CreateServer creates the UNINITIALIZED pd server with given configuration.
func MustWaitLeader ¶
func MustWaitLeader(re *require.Assertions, svrs []*Server) *Server
MustWaitLeader return the leader until timeout.
func NewTestServer ¶
func NewTestServer(re *require.Assertions, c *assertutil.Checker) (*Server, testutil.CleanupFunc, error)
NewTestServer creates a pd server for testing.
func (*Server) AddCloseCallback ¶
func (s *Server) AddCloseCallback(callbacks ...func())
AddCloseCallback adds a callback in the Close phase.
func (*Server) AddServiceLabel ¶
func (s *Server) AddServiceLabel(serviceLabel string, accessPath apiutil.AccessPath)
AddServiceLabel is used to add the relationship between service label and api access path TODO: this function will be used for updating api rate limit config
func (*Server) AddServiceReadyCallback ¶
AddServiceReadyCallback adds callbacks when the server becomes the leader if there is embedded etcd, or the primary otherwise.
func (*Server) AddStartCallback ¶
func (s *Server) AddStartCallback(callbacks ...func())
AddStartCallback adds a callback in the startServer phase.
func (*Server) DeleteLabelProperty ¶
DeleteLabelProperty deletes a label property config.
func (*Server) GetAPIAccessServiceLabel ¶
func (s *Server) GetAPIAccessServiceLabel(accessPath apiutil.AccessPath) string
GetAPIAccessServiceLabel returns service label by given access path TODO: this function will be used for updating api rate limit config
func (*Server) GetAllocator ¶
GetAllocator returns the ID allocator of server.
func (*Server) GetAuditBackend ¶
GetAuditBackend returns audit backends
func (*Server) GetAuditConfig ¶
func (s *Server) GetAuditConfig() *config.AuditConfig
GetAuditConfig gets the audit config information.
func (*Server) GetBasicCluster ¶
func (s *Server) GetBasicCluster() *core.BasicCluster
GetBasicCluster returns the basic cluster of server.
func (*Server) GetClientScheme ¶
GetClientScheme returns the client URL scheme
func (*Server) GetClusterStatus ¶
GetClusterStatus gets cluster status.
func (*Server) GetClusterVersion ¶
GetClusterVersion returns the version of cluster.
func (*Server) GetControllerConfig ¶
func (s *Server) GetControllerConfig() *rm_server.ControllerConfig
GetControllerConfig gets the resource manager controller config.
func (*Server) GetEndpoints ¶
GetEndpoints returns the etcd endpoints for outer use.
func (*Server) GetExternalTS ¶
GetExternalTS returns external timestamp.
func (*Server) GetHBStreams ¶
func (s *Server) GetHBStreams() *hbstream.HeartbeatStreams
GetHBStreams returns the heartbeat streams.
func (*Server) GetHTTPClient ¶
GetHTTPClient returns builtin http client.
func (*Server) GetHandler ¶
GetHandler returns the handler for API.
func (*Server) GetHistoryHotRegionStorage ¶
func (s *Server) GetHistoryHotRegionStorage() *storage.HotRegionStorage
GetHistoryHotRegionStorage returns the backend storage of historyHotRegion.
func (*Server) GetKeyspaceGroupManager ¶
func (s *Server) GetKeyspaceGroupManager() *keyspace.GroupManager
GetKeyspaceGroupManager returns the keyspace group manager of server.
func (*Server) GetKeyspaceManager ¶
GetKeyspaceManager returns the keyspace manager of server.
func (*Server) GetLabelProperty ¶
func (s *Server) GetLabelProperty() config.LabelPropertyConfig
GetLabelProperty returns the whole label property config.
func (*Server) GetLeaderLease ¶
GetLeaderLease returns the leader lease.
func (*Server) GetLeaderListenUrls ¶
GetLeaderListenUrls gets service endpoints from the leader in election group.
func (*Server) GetMaxResetTSGap ¶
GetMaxResetTSGap gets the max gap to reset the tso.
func (*Server) GetMember ¶
func (s *Server) GetMember() *member.EmbeddedEtcdMember
GetMember returns the member of server.
func (*Server) GetMemberInfo ¶
GetMemberInfo returns the server member information.
func (*Server) GetMembers ¶
GetMembers returns PD server list.
func (*Server) GetMetaRegions ¶
GetMetaRegions gets meta regions from cluster.
func (*Server) GetPDServerConfig ¶
func (s *Server) GetPDServerConfig() *config.PDServerConfig
GetPDServerConfig gets the balance config information.
func (*Server) GetPersistOptions ¶
func (s *Server) GetPersistOptions() *config.PersistOptions
GetPersistOptions returns the schedule option.
func (*Server) GetRaftCluster ¶
func (s *Server) GetRaftCluster() *cluster.RaftCluster
GetRaftCluster gets Raft cluster. If cluster has not been bootstrapped, return nil.
func (*Server) GetRateLimitConfig ¶
func (s *Server) GetRateLimitConfig() *config.RateLimitConfig
GetRateLimitConfig gets the rate limit config information.
func (*Server) GetRegions ¶
func (s *Server) GetRegions() []*core.RegionInfo
GetRegions gets regions from cluster.
func (*Server) GetReplicationConfig ¶
func (s *Server) GetReplicationConfig() *config.ReplicationConfig
GetReplicationConfig get the replication config.
func (*Server) GetReplicationModeConfig ¶
func (s *Server) GetReplicationModeConfig() *config.ReplicationModeConfig
GetReplicationModeConfig returns the replication mode config.
func (*Server) GetScheduleConfig ¶
func (s *Server) GetScheduleConfig() *config.ScheduleConfig
GetScheduleConfig gets the balance config information.
func (*Server) GetServerOption ¶
func (s *Server) GetServerOption() *config.PersistOptions
GetServerOption gets the option of the server.
func (*Server) GetServiceAuditBackendLabels ¶
func (s *Server) GetServiceAuditBackendLabels(serviceLabel string) *audit.BackendLabels
GetServiceAuditBackendLabels returns audit backend labels by serviceLabel
func (*Server) GetServiceLabels ¶
func (s *Server) GetServiceLabels(serviceLabel string) []apiutil.AccessPath
GetServiceLabels returns ApiAccessPaths by given service label TODO: this function will be used for updating api rate limit config
func (*Server) GetServiceMiddlewareConfig ¶
func (s *Server) GetServiceMiddlewareConfig() *config.ServiceMiddlewareConfig
GetServiceMiddlewareConfig gets the service middleware config information.
func (*Server) GetServiceMiddlewarePersistOptions ¶
func (s *Server) GetServiceMiddlewarePersistOptions() *config.ServiceMiddlewarePersistOptions
GetServiceMiddlewarePersistOptions returns the service middleware persist option.
func (*Server) GetServicePrimaryAddr ¶
GetServicePrimaryAddr returns the primary address for a given service. Note: This function will only return primary address without judging if it's alive.
func (*Server) GetServiceRateLimiter ¶
GetServiceRateLimiter is used to get rate limiter
func (*Server) GetStorage ¶
GetStorage returns the backend storage of server.
func (*Server) GetTLSConfig ¶
GetTLSConfig get the security config.
func (*Server) GetTSOAllocatorManager ¶
func (s *Server) GetTSOAllocatorManager() *tso.AllocatorManager
GetTSOAllocatorManager returns the manager of TSO Allocator.
func (*Server) GetTSOSaveInterval ¶
GetTSOSaveInterval returns TSO save interval.
func (*Server) GetTSOUpdatePhysicalInterval ¶
GetTSOUpdatePhysicalInterval returns TSO update physical interval.
func (*Server) IsAPIServiceMode ¶
IsAPIServiceMode return whether the server is in API service mode.
func (*Server) IsInRateLimitAllowList ¶
IsInRateLimitAllowList returns whether given service label is in allow lost
func (*Server) IsLocalTSOEnabled ¶
IsLocalTSOEnabled returns if the local TSO is enabled.
func (*Server) IsServing ¶
IsServing returns whether the server is the leader if there is embedded etcd, or the primary otherwise.
func (*Server) IsSnapshotRecovering ¶
IsSnapshotRecovering check whether recovering-mark marked
func (*Server) IsTTLConfigExist ¶
IsTTLConfigExist returns true if the ttl config is existed for a given config.
func (*Server) LoopContext ¶
LoopContext returns the loop context of server.
func (*Server) MarkSnapshotRecovering ¶
MarkSnapshotRecovering mark pd that we're recovering tikv will get this state during BR EBS restore. we write this info into etcd for simplicity, the key only stays inside etcd temporary during BR EBS restore in which period the cluster is not able to serve request. and is deleted after BR EBS restore is done.
func (*Server) PersistFile ¶
PersistFile saves a file in DataDir.
func (*Server) RecoverAllocID ¶
RecoverAllocID recover alloc id. set current base id to input id
func (*Server) ReplicateFileToMember ¶
func (s *Server) ReplicateFileToMember(ctx context.Context, member *pdpb.Member, name string, data []byte) error
ReplicateFileToMember is used to synchronize state to a member. Each member will write `data` to a local file named `name`. For security reason, data should be in JSON format.
func (*Server) SaveTTLConfig ¶
SaveTTLConfig save ttl config
func (*Server) SetAuditConfig ¶
func (s *Server) SetAuditConfig(cfg config.AuditConfig) error
SetAuditConfig sets the audit config.
func (*Server) SetClusterVersion ¶
SetClusterVersion sets the version of cluster.
func (*Server) SetEnableLocalTSO ¶
SetEnableLocalTSO sets enable-local-tso flag of Server. This function only for test.
func (*Server) SetExternalTS ¶
SetExternalTS returns external timestamp.
func (*Server) SetLabelProperty ¶
SetLabelProperty inserts a label property config.
func (*Server) SetLabelPropertyConfig ¶
func (s *Server) SetLabelPropertyConfig(cfg config.LabelPropertyConfig) error
SetLabelPropertyConfig sets the label property config.
func (*Server) SetLogLevel ¶
SetLogLevel sets log level.
func (*Server) SetPDServerConfig ¶
func (s *Server) SetPDServerConfig(cfg config.PDServerConfig) error
SetPDServerConfig sets the server config.
func (*Server) SetRateLimitConfig ¶
func (s *Server) SetRateLimitConfig(cfg config.RateLimitConfig) error
SetRateLimitConfig sets the rate limit config.
func (*Server) SetReplicationConfig ¶
func (s *Server) SetReplicationConfig(cfg config.ReplicationConfig) error
SetReplicationConfig sets the replication config.
func (*Server) SetReplicationModeConfig ¶
func (s *Server) SetReplicationModeConfig(cfg config.ReplicationModeConfig) error
SetReplicationModeConfig sets the replication mode.
func (*Server) SetScheduleConfig ¶
func (s *Server) SetScheduleConfig(cfg config.ScheduleConfig) error
SetScheduleConfig sets the balance config information.
func (*Server) SetServiceAuditBackendForHTTP ¶
SetServiceAuditBackendForHTTP is used to register service audit config for HTTP.
func (*Server) SetServiceAuditBackendLabels ¶
SetServiceAuditBackendLabels is used to add audit backend labels for service by service label
func (*Server) SetStorage ¶
SetStorage changes the storage only for test purpose. When we use it, we should prevent calling GetStorage, otherwise, it may cause a data race problem.
func (*Server) StartTimestamp ¶
StartTimestamp returns the start timestamp of this server
func (*Server) UnmarkSnapshotRecovering ¶
UnmarkSnapshotRecovering unmark recovering mark
func (*Server) UpdateRateLimit ¶
func (s *Server) UpdateRateLimit(cfg *config.RateLimitConfig, key string, value interface{}) error
UpdateRateLimit is used to update rate-limit config which will overwrite limiter-config
func (*Server) UpdateRateLimitConfig ¶
func (s *Server) UpdateRateLimitConfig(key, label string, value ratelimit.DimensionConfig) error
UpdateRateLimitConfig is used to update rate-limit config which will reserve old limiter-config
func (*Server) UpdateServiceRateLimiter ¶
func (s *Server) UpdateServiceRateLimiter(serviceLabel string, opts ...ratelimit.Option) ratelimit.UpdateStatus
UpdateServiceRateLimiter is used to update RateLimiter