Documentation
¶
Index ¶
- func CopyMap(mapDest map[string]DataNodePxc, mapSource map[string]DataNodePxc) map[string]DataNodePxc
- func MergeMaps(arrayOfMaps [4]map[string]DataNodePxc) map[string]DataNodePxc
- type DataCluster
- type DataNode
- func (node *DataNode) CloseConnection() bool
- func (node *DataNode) DELETE_NODE() int
- func (node *DataNode) GetConnection() bool
- func (node *DataNode) INSERT_READ() int
- func (node *DataNode) INSERT_WRITE() int
- func (node *DataNode) MOVE_DOWN_HG_CHANGE() int
- func (node *DataNode) MOVE_DOWN_OFFLINE() int
- func (node *DataNode) MOVE_OUT_MAINTENANCE() int
- func (node *DataNode) MOVE_SWAP_READER_TO_WRITER() int
- func (node *DataNode) MOVE_SWAP_WRITER_TO_READER() int
- func (node *DataNode) MOVE_TO_MAINTENANCE() int
- func (node *DataNode) MOVE_UP_HG_CHANGE() int
- func (node *DataNode) MOVE_UP_OFFLINE() int
- func (node *DataNode) NOTHING_TO_DO() int
- func (node *DataNode) ReturnActionCategory(code int) string
- func (node *DataNode) ReturnTextFromCode(code int) string
- func (node *DataNode) SAVE_RETRY() int
- type DataNodePxc
- type Hostgroup
- type Locker
- func (locker *Locker) CheckClusterLock() *ProxySQLNode
- func (locker *Locker) CheckFileLock() *ProxySQLNode
- func (locker *Locker) Init(config *global.Configuration) bool
- func (locker *Locker) PushSchedulerLock(nodes map[string]ProxySQLNode) bool
- func (locker *Locker) RemoveLockFile() bool
- func (locker *Locker) SetLockFile() bool
- type ProxySQLCluster
- type ProxySQLNode
- func (node *ProxySQLNode) CloseConnection() bool
- func (node *ProxySQLNode) DeleteDataNode(dataNode DataNode, hg int, ip string, port int) string
- func (node *ProxySQLNode) GetConnection() bool
- func (node *ProxySQLNode) GetDataCluster(config global.Configuration) bool
- func (node *ProxySQLNode) Init(config *global.Configuration) bool
- func (node *ProxySQLNode) InsertRead(dataNode DataNode, hg int, ip string, port int) string
- func (node *ProxySQLNode) InsertWrite(dataNode DataNode, hg int, ip string, port int) string
- func (node *ProxySQLNode) MoveNodeDownToHGCange(dataNode DataNode, hg int, ip string, port int) string
- func (node *ProxySQLNode) MoveNodeDownToOfflineSoft(dataNode DataNode, hg int, ip string, port int) string
- func (node *ProxySQLNode) MoveNodeUpFromHGCange(dataNode DataNode, hg int, ip string, port int) string
- func (node *ProxySQLNode) MoveNodeUpFromOfflineSoft(dataNode DataNode, hg int, ip string, port int) string
- func (node *ProxySQLNode) ProcessChanges() bool
- func (node *ProxySQLNode) SaveRetry(dataNode DataNode, hg int, ip string, port int) string
- type PxcClusterView
- type SslCertificates
- type SyncMap
- type VariableStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyMap ¶
func CopyMap(mapDest map[string]DataNodePxc, mapSource map[string]DataNodePxc) map[string]DataNodePxc
func MergeMaps ¶
func MergeMaps(arrayOfMaps [4]map[string]DataNodePxc) map[string]DataNodePxc
==================== Generic
Types ¶
type DataCluster ¶
type DataCluster struct { ActiveFailover int FailBack bool ActionNodes map[string]DataNodePxc BackupReaders map[string]DataNodePxc BackupWriters map[string]DataNodePxc BackupHgReaderId int BakcupHgWriterId int CheckTimeout int ClusterIdentifier int //cluster_id ClusterSize int HasPrimary bool ClusterName string Comment string Debug bool FailOverNode DataNodePxc HasFailoverNode bool Haswriter bool HgReaderId int HgWriterId int Hostgroups map[int]Hostgroup // Hosts map[string] DataNode MainSegment int MonitorPassword string MonitorUser string Name string NodesPxc *SyncMap //[string] DataNodePxc // <ip:port,datanode> NodesPxcMaint []DataNodePxc MaxNumWriters int OffLineReaders map[string]DataNodePxc OffLineWriters map[string]DataNodePxc OffLineHgReaderID int OffLineHgWriterId int ReaderNodes map[string]DataNodePxc RequireFailover bool RetryDown int RetryUp int Singlenode bool SinglePrimary bool Size int Ssl *SslCertificates Status int WriterIsReader int WriterNodes map[string]DataNodePxc // contains filtered or unexported fields }
func (*DataCluster) GetActionList ¶
func (cluster *DataCluster) GetActionList() map[string]DataNodePxc
This method is where we initiate the analysis of the nodes an the starting point of the population of the actionList The actionList is the object returning the list of nodes that require modification Any modification at their status in ProxySQL is done by the ProxySQLNode object
type DataNode ¶
type DataNode struct { ActionType int NodeIsNew bool RetryUp int RetryDown int Comment string Compression int Connection *sql.DB ConnUsed int Debug bool Dns string GtidPort int HostgroupId int Hostgroups []Hostgroup Ip string MaxConnection int MaxLatency int MaxReplicationLag int Name string NodeTCPDown bool Password string Port int Processed bool ProcessStatus int ProxyStatus string ReadOnly bool Ssl *SslCertificates Status map[string]string UseSsl bool User string Variables map[string]string Weight int }
func (*DataNode) CloseConnection ¶
func (*DataNode) DELETE_NODE ¶
func (*DataNode) GetConnection ¶
this method is used to assign a connection to a proxySQL node return true if successful in any other case false
func (*DataNode) INSERT_READ ¶
func (*DataNode) INSERT_WRITE ¶
func (*DataNode) MOVE_DOWN_HG_CHANGE ¶
func (*DataNode) MOVE_DOWN_OFFLINE ¶
func (*DataNode) MOVE_OUT_MAINTENANCE ¶
func (*DataNode) MOVE_SWAP_READER_TO_WRITER ¶
func (*DataNode) MOVE_SWAP_WRITER_TO_READER ¶
func (*DataNode) MOVE_TO_MAINTENANCE ¶
func (*DataNode) MOVE_UP_HG_CHANGE ¶
func (*DataNode) MOVE_UP_OFFLINE ¶
func (*DataNode) NOTHING_TO_DO ¶
NODE CONSTANT declaration by methods
func (*DataNode) ReturnActionCategory ¶
func (*DataNode) ReturnTextFromCode ¶
func (*DataNode) SAVE_RETRY ¶
type DataNodePxc ¶
type DataNodePxc struct { DataNodeBase DataNode PxcMaintMode string WsrepConnected bool WsrepDesinccount int WsrepDonorrejectqueries bool WsrepGcommUuid string WsrepLocalIndex int WsrepPcWeight int WsrepProvider map[string]string WsrepReady bool WsrepRejectqueries bool WsrepSegment int WsrepStatus int WsrepClusterSize int WsrepClusterName string WsrepClusterStatus string WsrepNodeName string HasPrimaryState bool PxcView PxcClusterView }
type Locker ¶
type Locker struct { MyServerIp string MyServerPort int MyServer *ProxySQLNode FileLock string FileLockPath string FileLockInterval int64 FileLockReset bool ClusterLockId string ClusterLockInterval int64 ClusterLockReset bool ClusterLastLockTime int64 ClusterCurrentLockTime int64 IsClusterLocked bool IsFileLocked bool LockFileTimeout int64 LockClusterTimeout int64 // contains filtered or unexported fields }
func (*Locker) CheckClusterLock ¶
func (locker *Locker) CheckClusterLock() *ProxySQLNode
func (*Locker) CheckFileLock ¶
func (locker *Locker) CheckFileLock() *ProxySQLNode
TODO fill the method
func (*Locker) Init ¶
func (locker *Locker) Init(config *global.Configuration) bool
Initialize the locker TODO initialize
func (*Locker) PushSchedulerLock ¶
func (locker *Locker) PushSchedulerLock(nodes map[string]ProxySQLNode) bool
We are ready to submit our changes. As always all is executed in a transaction TODO SHOULD we remove the proxysql node that doesn't work ????
func (*Locker) RemoveLockFile ¶
func (*Locker) SetLockFile ¶
type ProxySQLCluster ¶
type ProxySQLCluster struct { Name string Nodes map[string]ProxySQLNode Active bool User string Password string }
Cluster object and methods
func (ProxySQLCluster) GetProxySQLnodes ¶
func (cluster ProxySQLCluster) GetProxySQLnodes(myNode *ProxySQLNode) bool
This method in ProxySQL Cluster Object is responsible for getting the list of ACTIVE ProxySQL servers. Interestingly ProxySQL has not clue if a ProxySQL nodes ur down. Or at least is not reported in the proxysql_server tables or any stats table Given that we check if nodes are reachable opening a connection and closing it
type ProxySQLNode ¶
type ProxySQLNode struct { ActionNodeList map[string]DataNodePxc Dns string Hostgoups map[int]Hostgroup Ip string MonitorPassword string MonitorUser string Password string Port int User string Connection *sql.DB MySQLCluster *DataCluster Variables map[string]string IsInitialized bool Weight int HoldLock bool IsLockExpired bool LastLockTime int64 Comment string }
func (*ProxySQLNode) CloseConnection ¶
func (node *ProxySQLNode) CloseConnection() bool
func (*ProxySQLNode) DeleteDataNode ¶
Delete the given node
func (*ProxySQLNode) GetConnection ¶
func (node *ProxySQLNode) GetConnection() bool
this method is used to assign a connection to a proxySQL node return true if successful in any other case false
Note ?timeout=1s is HARDCODED on purpose. This is a check that MUST execute in less than a second. Having a connection taking longer than that is outrageous. Period!
func (*ProxySQLNode) GetDataCluster ¶
func (node *ProxySQLNode) GetDataCluster(config global.Configuration) bool
Retrieve active cluster check for pxc_cluster and cluster_id add to the object a DataCluster object. DataCluster returns already Initialized, which means it returns with all node populated with status ProxySQLNode
| |-> DataCluster | |-> DataObject | Pxc | GR
func (*ProxySQLNode) Init ¶
func (node *ProxySQLNode) Init(config *global.Configuration) bool
Init the proxySQL node
func (*ProxySQLNode) InsertRead ¶
When inserting a node we need to differentiate when is a NEW node coming from the Bakcup HG because in that case we will NOT push it directly to prod
func (*ProxySQLNode) InsertWrite ¶
When inserting a node we need to differentiate when is a NEW node coming from the Bakcup HG because in that case we will NOT push it directly to prod
func (*ProxySQLNode) MoveNodeDownToHGCange ¶
func (*ProxySQLNode) MoveNodeDownToOfflineSoft ¶
func (*ProxySQLNode) MoveNodeUpFromHGCange ¶
func (*ProxySQLNode) MoveNodeUpFromOfflineSoft ¶
func (*ProxySQLNode) ProcessChanges ¶
func (node *ProxySQLNode) ProcessChanges() bool
This method is the one applying the changes to the proxy database
type PxcClusterView ¶
type SslCertificates ¶
type SslCertificates struct {
// contains filtered or unexported fields
}
type SyncMap ¶
func NewRegularIntMap ¶
func NewRegularIntMap() *SyncMap
Sync Map =====================================
func (*SyncMap) ExposeMap ¶
func (rm *SyncMap) ExposeMap() map[string]DataNodePxc
func (*SyncMap) Store ¶
func (rm *SyncMap) Store(key string, value DataNodePxc)