Documentation ¶
Index ¶
- Constants
- Variables
- func GetAllComponent(dir string) error
- func GetIndex(memberName string) (int, error)
- func GetSQLChannelProc() (*os.Process, error)
- func MaxInt64(x, y int64) int64
- func RegisterManager(characterType, workloadType string, manager DBManager)
- type Component
- type ComponentSpec
- type DBManager
- type DBManagerBase
- func (mgr *DBManagerBase) CreateRoot(context.Context) error
- func (mgr *DBManagerBase) Demote(context.Context) error
- func (mgr *DBManagerBase) Follow(context.Context, *dcs.Cluster) error
- func (mgr *DBManagerBase) GetCurrentMemberName() string
- func (mgr *DBManagerBase) GetDBState(context.Context, *dcs.Cluster) *dcs.DBState
- func (mgr *DBManagerBase) GetLogger() logr.Logger
- func (mgr *DBManagerBase) HasOtherHealthyLeader(context.Context, *dcs.Cluster) *dcs.Member
- func (mgr *DBManagerBase) IsClusterHealthy(context.Context, *dcs.Cluster) bool
- func (mgr *DBManagerBase) IsDBStartupReady() bool
- func (mgr *DBManagerBase) IsFirstMember() bool
- func (mgr *DBManagerBase) IsMemberLagging(context.Context, *dcs.Cluster, *dcs.Member) (bool, int64)
- func (mgr *DBManagerBase) IsPromoted(context.Context) bool
- func (mgr *DBManagerBase) IsRootCreated(context.Context) (bool, error)
- func (*DBManagerBase) JoinCurrentMemberToCluster(context.Context, *dcs.Cluster) error
- func (*DBManagerBase) LeaveMemberFromCluster(context.Context, *dcs.Cluster, string) error
- func (mgr *DBManagerBase) MoveData(context.Context, *dcs.Cluster) error
- func (mgr *DBManagerBase) ShutDownWithWait()
- func (mgr *DBManagerBase) Start(context.Context, *dcs.Cluster) error
- func (mgr *DBManagerBase) Stop() error
- type FakeManager
- func (*FakeManager) CreateRoot(context.Context) error
- func (*FakeManager) Demote(context.Context) error
- func (*FakeManager) Follow(context.Context, *dcs.Cluster) error
- func (*FakeManager) GetHealthiestMember(*dcs.Cluster, string) *dcs.Member
- func (*FakeManager) GetMemberAddrs(context.Context, *dcs.Cluster) []string
- func (*FakeManager) HasOtherHealthyLeader(context.Context, *dcs.Cluster) *dcs.Member
- func (*FakeManager) HasOtherHealthyMembers(context.Context, *dcs.Cluster, string) []*dcs.Member
- func (*FakeManager) InitializeCluster(context.Context, *dcs.Cluster) error
- func (*FakeManager) IsClusterHealthy(context.Context, *dcs.Cluster) bool
- func (*FakeManager) IsClusterInitialized(context.Context, *dcs.Cluster) (bool, error)
- func (*FakeManager) IsCurrentMemberHealthy(context.Context, *dcs.Cluster) bool
- func (*FakeManager) IsCurrentMemberInCluster(context.Context, *dcs.Cluster) bool
- func (*FakeManager) IsDBStartupReady() bool
- func (*FakeManager) IsFirstMember() bool
- func (*FakeManager) IsLeader(context.Context, *dcs.Cluster) (bool, error)
- func (*FakeManager) IsLeaderMember(context.Context, *dcs.Cluster, *dcs.Member) (bool, error)
- func (*FakeManager) IsMemberHealthy(context.Context, *dcs.Cluster, *dcs.Member) bool
- func (*FakeManager) IsPromoted(context.Context) bool
- func (*FakeManager) IsRootCreated(context.Context) (bool, error)
- func (*FakeManager) IsRunning() bool
- func (*FakeManager) JoinCurrentMemberToCluster(context.Context, *dcs.Cluster) error
- func (*FakeManager) LeaveMemberFromCluster(context.Context, *dcs.Cluster, string) error
- func (*FakeManager) Lock(context.Context, string) error
- func (*FakeManager) Promote(context.Context, *dcs.Cluster) error
- func (*FakeManager) Recover(context.Context) error
- func (*FakeManager) Unlock(context.Context) error
- type Properties
Constants ¶
View Source
const ( // types for probe CheckRunningType int = iota CheckStatusType CheckRoleChangedType )
Variables ¶
View Source
var Name2Property = map[string]Properties{}
Functions ¶
func GetAllComponent ¶
func GetSQLChannelProc ¶
func RegisterManager ¶
Types ¶
type Component ¶
type Component struct { Name string Spec ComponentSpec }
type ComponentSpec ¶
type ComponentSpec struct { Version string Metadata []kv }
type DBManager ¶
type DBManager interface { IsRunning() bool IsDBStartupReady() bool // Functions related to cluster initialization. InitializeCluster(context.Context, *dcs.Cluster) error IsClusterInitialized(context.Context, *dcs.Cluster) (bool, error) // IsCurrentMemberInCluster checks if current member is configured in cluster for consensus. // it will always return true for replicationset. IsCurrentMemberInCluster(context.Context, *dcs.Cluster) bool // IsClusterHealthy is only for consensus cluster healthy check. // For Replication cluster IsClusterHealthy will always return true, // and its cluster's healthy is equal to leader member's healthy. IsClusterHealthy(context.Context, *dcs.Cluster) bool // Member healthy check // IsMemberHealthy focuses on the database's read and write capabilities. IsMemberHealthy(context.Context, *dcs.Cluster, *dcs.Member) bool IsCurrentMemberHealthy(context.Context, *dcs.Cluster) bool // IsMemberLagging focuses on the latency between the leader and standby IsMemberLagging(context.Context, *dcs.Cluster, *dcs.Member) (bool, int64) // GetDBState will get most required database kernel states of current member in one HA loop to Avoiding duplicate queries and conserve I/O. // We believe that the states of database kernel remains unchanged within a single HA loop. GetDBState(context.Context, *dcs.Cluster) *dcs.DBState // HasOtherHealthyLeader is applicable only to consensus cluster, // where the db's internal role services as the source of truth. // for replicationset cluster, HasOtherHealthyLeader will always be nil. HasOtherHealthyLeader(context.Context, *dcs.Cluster) *dcs.Member HasOtherHealthyMembers(context.Context, *dcs.Cluster, string) []*dcs.Member // Functions related to member check. IsLeader(context.Context, *dcs.Cluster) (bool, error) IsLeaderMember(context.Context, *dcs.Cluster, *dcs.Member) (bool, error) IsFirstMember() bool JoinCurrentMemberToCluster(context.Context, *dcs.Cluster) error LeaveMemberFromCluster(context.Context, *dcs.Cluster, string) error // IsPromoted is applicable only to consensus cluster, which is used to // check if DB has complete switchover. // for replicationset cluster, it will always be true. IsPromoted(context.Context) bool // Functions related to HA // The functions should be idempotent, indicating that if they have been executed in one ha cycle, // any subsequent calls during that cycle will have no effect. Promote(context.Context, *dcs.Cluster) error Demote(context.Context) error Follow(context.Context, *dcs.Cluster) error Recover(context.Context) error // Start and Stop just send signal to sqlChannel Start(context.Context, *dcs.Cluster) error Stop() error GetHealthiestMember(*dcs.Cluster, string) *dcs.Member GetCurrentMemberName() string GetMemberAddrs(context.Context, *dcs.Cluster) []string // Functions related to account manage IsRootCreated(context.Context) (bool, error) CreateRoot(context.Context) error // Readonly lock for disk full Lock(context.Context, string) error Unlock(context.Context) error MoveData(context.Context, *dcs.Cluster) error GetLogger() logr.Logger ShutDownWithWait() }
func GetDefaultManager ¶
func GetManager ¶
type DBManagerBase ¶
type DBManagerBase struct { CurrentMemberName string ClusterCompName string Namespace string DataDir string Logger logr.Logger DBStartupReady bool IsLocked bool DBState *dcs.DBState }
func (*DBManagerBase) CreateRoot ¶
func (mgr *DBManagerBase) CreateRoot(context.Context) error
func (*DBManagerBase) GetCurrentMemberName ¶
func (mgr *DBManagerBase) GetCurrentMemberName() string
func (*DBManagerBase) GetDBState ¶
func (*DBManagerBase) GetLogger ¶
func (mgr *DBManagerBase) GetLogger() logr.Logger
func (*DBManagerBase) HasOtherHealthyLeader ¶
func (*DBManagerBase) IsClusterHealthy ¶
func (*DBManagerBase) IsDBStartupReady ¶
func (mgr *DBManagerBase) IsDBStartupReady() bool
func (*DBManagerBase) IsFirstMember ¶
func (mgr *DBManagerBase) IsFirstMember() bool
func (*DBManagerBase) IsMemberLagging ¶
func (*DBManagerBase) IsPromoted ¶
func (mgr *DBManagerBase) IsPromoted(context.Context) bool
func (*DBManagerBase) IsRootCreated ¶
func (mgr *DBManagerBase) IsRootCreated(context.Context) (bool, error)
func (*DBManagerBase) JoinCurrentMemberToCluster ¶
func (*DBManagerBase) LeaveMemberFromCluster ¶
func (*DBManagerBase) ShutDownWithWait ¶
func (mgr *DBManagerBase) ShutDownWithWait()
func (*DBManagerBase) Stop ¶
func (mgr *DBManagerBase) Stop() error
type FakeManager ¶
type FakeManager struct {
DBManagerBase
}
func (*FakeManager) CreateRoot ¶
func (*FakeManager) CreateRoot(context.Context) error
func (*FakeManager) GetHealthiestMember ¶
func (*FakeManager) GetMemberAddrs ¶
func (*FakeManager) HasOtherHealthyLeader ¶
func (*FakeManager) HasOtherHealthyMembers ¶
func (*FakeManager) InitializeCluster ¶
func (*FakeManager) IsClusterHealthy ¶
func (*FakeManager) IsClusterInitialized ¶
func (*FakeManager) IsCurrentMemberHealthy ¶
func (*FakeManager) IsCurrentMemberInCluster ¶
func (*FakeManager) IsDBStartupReady ¶
func (*FakeManager) IsDBStartupReady() bool
func (*FakeManager) IsFirstMember ¶
func (*FakeManager) IsFirstMember() bool
func (*FakeManager) IsLeaderMember ¶
func (*FakeManager) IsMemberHealthy ¶
func (*FakeManager) IsPromoted ¶
func (*FakeManager) IsPromoted(context.Context) bool
func (*FakeManager) IsRootCreated ¶
func (*FakeManager) IsRootCreated(context.Context) (bool, error)
func (*FakeManager) IsRunning ¶
func (*FakeManager) IsRunning() bool
func (*FakeManager) JoinCurrentMemberToCluster ¶
func (*FakeManager) LeaveMemberFromCluster ¶
type Properties ¶
func GetProperties ¶
func GetProperties(name string) Properties
Click to show internal directories.
Click to hide internal directories.