pdnode_coord

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: May 19, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BalanceV2Str = "v2"
)

Variables

View Source
var (
	ErrAlreadyExist    = errors.New("already exist")
	ErrNotLeader       = errors.New("Not leader")
	ErrClusterUnstable = errors.New("the cluster is unstable")

	ErrLeaderNodeLost            = cluster.NewCoordErr("leader node is lost", cluster.CoordTmpErr)
	ErrNodeNotFound              = cluster.NewCoordErr("node not found", cluster.CoordCommonErr)
	ErrNodeUnavailable           = cluster.NewCoordErr("No node is available for namespace", cluster.CoordTmpErr)
	ErrNamespaceRaftEnough       = cluster.NewCoordErr("the namespace isr and catchup nodes are enough", cluster.CoordTmpErr)
	ErrClusterNodeRemoving       = cluster.NewCoordErr("the node is mark as removed", cluster.CoordTmpErr)
	ErrNamespaceNodeConflict     = cluster.NewCoordErr("the namespace node info is conflicted", cluster.CoordClusterErr)
	ErrNamespaceRaftIDNotFound   = cluster.NewCoordErr("the namespace raft id is not found", cluster.CoordClusterErr)
	ErrNamespaceReplicaNotEnough = cluster.NewCoordErr("the replicas in the namespace is not enough", cluster.CoordTmpErr)
	ErrNamespaceMigrateWaiting   = cluster.NewCoordErr("the migrate is waiting", cluster.CoordTmpErr)
)
View Source
var (
	ErrBalanceNodeUnavailable = errors.New("can not find a node to be balanced")
	ErrClusterBalanceRunning  = errors.New("another balance is running, should wait")
)
View Source
var (
	ErrInvalidSchema = errors.New("invalid schema info")
)

Functions

func ChangeIntervalForTest

func ChangeIntervalForTest()

func IsAllISRFullReady

func IsAllISRFullReady(nsInfo *cluster.PartitionMetaInfo) (bool, error)

query the raft peers if all the isr nodes already in the raft group for the namespace and all logs synced in all peers

func IsRaftNodeFullReady

func IsRaftNodeFullReady(nsInfo *cluster.PartitionMetaInfo, nid string) (bool, error)

query the raft peers if the nid already in the raft group for the namespace and all logs synced in all peers

func IsRaftNodeJoined

func IsRaftNodeJoined(nsInfo *cluster.PartitionMetaInfo, nid string) (bool, error)

query the raft peers if the nid already in the raft group for the namespace in all raft peers

func IsRaftNodeSynced added in v0.6.3

func IsRaftNodeSynced(nsInfo *cluster.PartitionMetaInfo, nid string) (bool, error)

check if all nodes in list is raft synced for the namespace-partition

Types

type DataPlacement

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

func NewDataPlacement

func NewDataPlacement(coord *PDCoordinator) *DataPlacement

func (*DataPlacement) DoBalance

func (dp *DataPlacement) DoBalance(monitorChan chan struct{})

func (*DataPlacement) SetBalanceInterval

func (dp *DataPlacement) SetBalanceInterval(start int, end int)

type IntHeap

type IntHeap []int

An IntHeap is a min-heap of ints.

func (IntHeap) Len

func (h IntHeap) Len() int

func (IntHeap) Less

func (h IntHeap) Less(i, j int) bool

func (*IntHeap) Pop

func (h *IntHeap) Pop() interface{}

func (*IntHeap) Push

func (h *IntHeap) Push(x interface{})

func (IntHeap) Swap

func (h IntHeap) Swap(i, j int)

type PDCoordinator

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

func NewPDCoordinator

func NewPDCoordinator(clusterID string, n *cluster.NodeInfo, opts *cluster.Options) *PDCoordinator

func (*PDCoordinator) AddHIndexSchema

func (pdCoord *PDCoordinator) AddHIndexSchema(namespace string, table string, hindex *common.HsetIndexSchema) error

func (*PDCoordinator) AutoBalanceEnabled

func (pdCoord *PDCoordinator) AutoBalanceEnabled() bool

func (*PDCoordinator) ChangeNamespaceMetaParam

func (pdCoord *PDCoordinator) ChangeNamespaceMetaParam(namespace string, newReplicator int,
	optimizeFsync string, snapCount int) error

func (*PDCoordinator) CreateNamespace

func (pdCoord *PDCoordinator) CreateNamespace(namespace string, meta cluster.NamespaceMetaInfo) error

func (*PDCoordinator) DelHIndexSchema

func (pdCoord *PDCoordinator) DelHIndexSchema(namespace string, table string, hindexName string) error

func (*PDCoordinator) DeleteNamespace

func (pdCoord *PDCoordinator) DeleteNamespace(ns string, partition string) error

func (*PDCoordinator) GetAllDataNodes

func (pdCoord *PDCoordinator) GetAllDataNodes() (map[string]cluster.NodeInfo, int64)

func (*PDCoordinator) GetAllNamespaces

func (pdCoord *PDCoordinator) GetAllNamespaces() (map[string]map[int]cluster.PartitionMetaInfo, int64, error)

may return old cached data if register not available

func (*PDCoordinator) GetAllPDNodes

func (pdCoord *PDCoordinator) GetAllPDNodes() ([]cluster.NodeInfo, error)

func (*PDCoordinator) GetLearnerRunningState added in v0.9.0

func (pdCoord *PDCoordinator) GetLearnerRunningState() (bool, error)

func (*PDCoordinator) GetPDLeader

func (pdCoord *PDCoordinator) GetPDLeader() cluster.NodeInfo

func (*PDCoordinator) IsClusterStable

func (pdCoord *PDCoordinator) IsClusterStable() bool

some API for outside

func (*PDCoordinator) IsMineLeader

func (pdCoord *PDCoordinator) IsMineLeader() bool

func (*PDCoordinator) MarkNodeAsRemoving

func (pdCoord *PDCoordinator) MarkNodeAsRemoving(nid string) error

func (*PDCoordinator) RemoveLearnerFromNs

func (pdCoord *PDCoordinator) RemoveLearnerFromNs(ns string, pidStr string, nid string) error

func (*PDCoordinator) RemoveNamespaceFromNode added in v0.9.0

func (pdCoord *PDCoordinator) RemoveNamespaceFromNode(ns string, pidStr string, nid string) error

func (*PDCoordinator) SetBalanceInterval

func (pdCoord *PDCoordinator) SetBalanceInterval(start, end int)

func (*PDCoordinator) SetClusterStableNodeNum

func (pdCoord *PDCoordinator) SetClusterStableNodeNum(num int) error

func (*PDCoordinator) SetClusterUpgradeState

func (pdCoord *PDCoordinator) SetClusterUpgradeState(upgrading bool) error

func (*PDCoordinator) SetRegister

func (pdCoord *PDCoordinator) SetRegister(r cluster.PDRegister)

func (*PDCoordinator) Start

func (pdCoord *PDCoordinator) Start() error

func (*PDCoordinator) Stop

func (pdCoord *PDCoordinator) Stop()

func (*PDCoordinator) SwitchAutoBalance

func (pdCoord *PDCoordinator) SwitchAutoBalance(enable bool)

func (*PDCoordinator) SwitchStartLearner added in v0.9.0

func (pdCoord *PDCoordinator) SwitchStartLearner(enable bool) error

use this to switch start or stop learner without restart the node

type SortableStrings

type SortableStrings []string

func (SortableStrings) Len

func (s SortableStrings) Len() int

func (SortableStrings) Less

func (s SortableStrings) Less(l, r int) bool

func (SortableStrings) Swap

func (s SortableStrings) Swap(l, r int)

Jump to

Keyboard shortcuts

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