checker

package
v0.0.0-...-abf4276 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultName is the default name of the command line.
	DefaultName = "mysql-agent-checker"
)

Variables

View Source
var ChaosRegistry map[string]func(s *Server) error

ChaosRegistry registers chaos situation

Functions

func CheckCall

func CheckCall(command string) (result string, err error)

CheckCall runs the command, returned with the result and error

func IPOf

func IPOf(node string) (string, error)

IPOf returns the ip of the container, given the container name/ID

func PartitionIncoming

func PartitionIncoming(partitionTemplate, partitionedAZ, partitionType string) error

PartitionIncoming partitions the incoming network for the partitionedAZ, with the partitionType

func PartitionOutgoing

func PartitionOutgoing(partitionTemplate, partitionedAZ, partitionType string) error

PartitionOutgoing partitions the outgoing network for the partitionedAZ, with the partitionType

func RunKill9Agent

func RunKill9Agent(containerName string) error

RunKill9Agent runs `docker exec <containerName> kill -9 <agentPID>`

func RunStartAgent

func RunStartAgent(containerName string) error

RunStartAgent runs `docker start <containerName>`

func RunStopAgent

func RunStopAgent(containerName string) error

RunStopAgent runs `docker stop <containerName>`

func RunStopSlave

func RunStopSlave(rootConn *sql.DB) error

RunStopSlave runs `stop slave` on the given DB

Types

type Config

type Config struct {
	*flag.FlagSet

	ClusterName string `toml:"cluster-name" json:"cluster-name"`

	EtcdURLs        string `toml:"etcd-urls" json:"etcd-urls"`
	EtcdDialTimeout time.Duration
	EtcdRootPath    string `toml:"etcd-root-path" json:"etcd-root-path"`
	EtcdUsername    string `toml:"etcd-username" json:"etcd-username"`
	EtcdPassword    string `toml:"etcd-password" json:"etcd-password"`

	MaxCounter int `toml:"max-counter" json:"max-counter"`

	LogLevel  string `toml:"log-level" json:"log-level"`
	LogFile   string `toml:"log-file" json:"log-file"`
	LogRotate string `toml:"log-rotate" json:"log-rotate"`

	DBConfig     types.DBConfig `toml:"db-config" json:"db-config"`
	RootUser     string         `toml:"root-user" json:"user"`
	RootPassword string         `toml:"root-password" json:"password"`

	IDContainerMapping map[string]string `toml:"id-container-mapping" json:"id-container-mapping"`
	ContainerAZMapping map[string]string `toml:"container-az-mapping" json:"container-az-mapping"`

	PartitionTemplate string `toml:"partition-template" json:"partition-template"`
	PartitionType     string `toml:"partition-type" json:"partition-type"`

	ChaosJob string
	// contains filtered or unexported fields
}

Config is the config of checker

func NewConfig

func NewConfig() *Config

NewConfig return an instance of configuration

func (*Config) Parse

func (cfg *Config) Parse(arguments []string) error

Parse parse all config from command-line flags, or configuration file.

type DMLJob

type DMLJob interface {
	Prepare(db *sql.DB) error
	RunDML(db *sql.DB, counter int) error
	Check(db *sql.DB) int
	GetInterval() time.Duration
	GetMaxCounter() int
	GetCheckWaitTime() time.Duration
}

DMLJob is the abstraction of the writing and checking job

type LongTxnJob

type LongTxnJob struct{}

LongTxnJob is the DMLJob that runs time costing DML

func (LongTxnJob) Check

func (job LongTxnJob) Check(db *sql.DB) int

Check is how this job is checked

func (LongTxnJob) GetCheckWaitTime

func (job LongTxnJob) GetCheckWaitTime() time.Duration

GetCheckWaitTime returns the time to wait before check

func (LongTxnJob) GetInterval

func (job LongTxnJob) GetInterval() time.Duration

GetInterval returns the interval of running dml

func (LongTxnJob) GetMaxCounter

func (job LongTxnJob) GetMaxCounter() int

GetMaxCounter return the times that the dml will be run

func (LongTxnJob) Prepare

func (job LongTxnJob) Prepare(db *sql.DB) error

Prepare is used for DB prepare

func (LongTxnJob) RunDML

func (job LongTxnJob) RunDML(db *sql.DB, c int) error

RunDML is run dml

type Server

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

Server is the checker server

func NewServer

func NewServer(cfg *Config) (*Server, error)

NewServer creates a new server

func (*Server) Start

func (s *Server) Start() error

Start starts the checker

type SimpleDMLJob

type SimpleDMLJob struct{}

SimpleDMLJob is the DMLJob that runs simple DML

func (SimpleDMLJob) Check

func (job SimpleDMLJob) Check(db *sql.DB) int

Check is how this job is checked

func (SimpleDMLJob) GetCheckWaitTime

func (job SimpleDMLJob) GetCheckWaitTime() time.Duration

GetCheckWaitTime returns the time to wait before check

func (SimpleDMLJob) GetInterval

func (job SimpleDMLJob) GetInterval() time.Duration

GetInterval returns the interval of running dml

func (SimpleDMLJob) GetMaxCounter

func (job SimpleDMLJob) GetMaxCounter() int

GetMaxCounter return the times that the dml will be run

func (SimpleDMLJob) Prepare

func (job SimpleDMLJob) Prepare(db *sql.DB) error

Prepare is used for DB prepare

func (SimpleDMLJob) RunDML

func (job SimpleDMLJob) RunDML(db *sql.DB, c int) error

RunDML is run dml

type Status

type Status struct {
	NodeID       string
	InternalHost string
	ExternalHost string
	IsAlive      bool
}

Status describes the status stored in etcd

Jump to

Keyboard shortcuts

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