Documentation ¶
Index ¶
- Constants
- Variables
- type ActionNode
- func ApplySchemaKeyspace(change string, simple bool) *ActionNode
- func ApplySchemaShard(masterTabletAlias topo.TabletAlias, change string, simple bool) *ActionNode
- func CheckShard() *ActionNode
- func MigrateServedFrom(servedType topo.TabletType) *ActionNode
- func MigrateServedTypes(servedType topo.TabletType) *ActionNode
- func RebuildKeyspace() *ActionNode
- func RebuildShard() *ActionNode
- func RebuildSrvShard() *ActionNode
- func ReparentShard(tabletAlias topo.TabletAlias) *ActionNode
- func SetKeyspaceServedFrom() *ActionNode
- func SetKeyspaceShardingInfo() *ActionNode
- func SetShardServedTypes(cells []string, servedType topo.TabletType) *ActionNode
- func ShardExternallyReparented(tabletAlias topo.TabletAlias) *ActionNode
- func UpdateShard() *ActionNode
- func (n *ActionNode) LockKeyspace(ctx context.Context, ts topo.Server, keyspace string) (lockPath string, err error)
- func (n *ActionNode) LockShard(ctx context.Context, ts topo.Server, keyspace, shard string) (lockPath string, err error)
- func (n *ActionNode) LockSrvShard(ctx context.Context, ts topo.Server, cell, keyspace, shard string) (lockPath string, err error)
- func (n *ActionNode) SetGuid() *ActionNode
- func (n *ActionNode) ToJson() string
- func (n *ActionNode) UnlockKeyspace(ctx context.Context, ts topo.Server, keyspace string, lockPath string, ...) error
- func (n *ActionNode) UnlockShard(ctx context.Context, ts topo.Server, keyspace, shard string, lockPath string, ...) error
- func (n *ActionNode) UnlockSrvShard(ctx context.Context, ts topo.Server, cell, keyspace, shard string, ...) error
- type ActionState
- type ApplySchemaKeyspaceArgs
- type ApplySchemaShardArgs
- type HealthStreamReply
- type MigrateServedFromArgs
- type MigrateServedTypesArgs
- type ReserveForRestoreArgs
- type RestartSlaveData
- type RestoreArgs
- type SetShardServedTypesArgs
- type SlaveWasRestartedArgs
- type SnapshotArgs
- type SnapshotReply
- type SnapshotSourceEndArgs
Constants ¶
const ( // Ping checks a tablet is alive TABLET_ACTION_PING = "Ping" // Sleep will sleep for a duration (used for tests) TABLET_ACTION_SLEEP = "Sleep" // ExecuteHook will execute the provided hook remotely TABLET_ACTION_EXECUTE_HOOK = "ExecuteHook" // SetReadOnly makes the mysql instance read-only TABLET_ACTION_SET_RDONLY = "SetReadOnly" // SetReadWrite makes the mysql instance read-write TABLET_ACTION_SET_RDWR = "SetReadWrite" // ChangeType changes the type of the tablet TABLET_ACTION_CHANGE_TYPE = "ChangeType" // Scrap scraps the live running tablet TABLET_ACTION_SCRAP = "Scrap" // DemoteMaster tells the current master it's about to not be a master // any more, and should go read-only. TABLET_ACTION_DEMOTE_MASTER = "DemoteMaster" // PromoteSlave tells the tablet it is going to be the master. TABLET_ACTION_PROMOTE_SLAVE = "PromoteSlave" // SlaveWasPromoted tells a tablet this previously slave // tablet is now the master. The tablet will update its // own topology record. TABLET_ACTION_SLAVE_WAS_PROMOTED = "SlaveWasPromoted" // RestartSlave tells the remote tablet it has a new master. TABLET_ACTION_RESTART_SLAVE = "RestartSlave" // SlaveWasRestarted tells a tablet the mysql master was changed. // The tablet will check it is indeed the case, and update its own // topology record. TABLET_ACTION_SLAVE_WAS_RESTARTED = "SlaveWasRestarted" // BreakSlaves will tinker with the replication stream in a way // that will stop all the slaves. TABLET_ACTION_BREAK_SLAVES = "BreakSlaves" // StopSlave will stop MySQL replication. TABLET_ACTION_STOP_SLAVE = "StopSlave" // StopSlave will stop MySQL replication after it reaches a // minimum point. TABLET_ACTION_STOP_SLAVE_MINIMUM = "StopSlaveMinimum" // StartSlave will start MySQL replication. TABLET_ACTION_START_SLAVE = "StartSlave" // TabletExternallyReparented is sent directly to the new master // tablet when it becomes the master. It is functionnaly equivalent // to calling "ShardExternallyReparented" on the topology. TABLET_ACTION_EXTERNALLY_REPARENTED = "TabletExternallyReparented" // MasterPosition returns the current master position TABLET_ACTION_MASTER_POSITION = "MasterPosition" // ReparentPosition returns the data for a slave to use to reparent // to the target tablet at the given position. TABLET_ACTION_REPARENT_POSITION = "ReparentPosition" // SlaveStatus returns the current slave status TABLET_ACTION_SLAVE_STATUS = "SlaveStatus" // WaitSlavePosition waits until the slave reaches a // replication position in MySQL replication TABLET_ACTION_WAIT_SLAVE_POSITION = "WaitSlavePosition" // WaitBlpPosition waits until the slave reaches a // replication position in filtered replication TABLET_ACTION_WAIT_BLP_POSITION = "WaitBlpPosition" // Stop and Start filtered replication TABLET_ACTION_STOP_BLP = "StopBlp" TABLET_ACTION_START_BLP = "StartBlp" // RunBlpUntil will run filtered replication until it reaches // the provided stop position. TABLET_ACTION_RUN_BLP_UNTIL = "RunBlpUntil" // GetSchema returns the tablet current schema. TABLET_ACTION_GET_SCHEMA = "GetSchema" // RefreshState tells the tablet to refresh its tablet record from // the topo server. TABLET_ACTION_REFRESH_STATE = "RefreshState" // RunHealthCheck tells the tablet to refresh its tablet record from // the topo server. TABLET_ACTION_RUN_HEALTH_CHECK = "RunHealthCheck" // HealthStream will stream the health status TABLET_ACTION_HEALTH_STREAM = "HealthStream" // ReloadSchema tells the tablet to reload its schema. TABLET_ACTION_RELOAD_SCHEMA = "ReloadSchema" // PreflightSchema will check a schema change works TABLET_ACTION_PREFLIGHT_SCHEMA = "PreflightSchema" // ApplySchema will actually apply the schema change TABLET_ACTION_APPLY_SCHEMA = "ApplySchema" // ExecuteFetch uses the DBA connection pool to run queries. TABLET_ACTION_EXECUTE_FETCH = "ExecuteFetch" // GetPermissions returns the mysql permissions set TABLET_ACTION_GET_PERMISSIONS = "GetPermissions" // GetSlaves returns the current set of mysql replication slaves. TABLET_ACTION_GET_SLAVES = "GetSlaves" // Snapshot takes a db snapshot TABLET_ACTION_SNAPSHOT = "Snapshot" // SnapshotSourceEnd restarts the mysql server TABLET_ACTION_SNAPSHOT_SOURCE_END = "SnapshotSourceEnd" // ReserveForRestore will prepare a server for restore TABLET_ACTION_RESERVE_FOR_RESTORE = "ReserveForRestore" // Restore will restore a backup TABLET_ACTION_RESTORE = "Restore" SHARD_ACTION_REPARENT = "ReparentShard" SHARD_ACTION_EXTERNALLY_REPARENTED = "ShardExternallyReparented" // Recompute derived shard-wise data SHARD_ACTION_REBUILD = "RebuildShard" // Generic read lock for inexpensive shard-wide actions. SHARD_ACTION_CHECK = "CheckShard" // Apply a schema change on an entire shard SHARD_ACTION_APPLY_SCHEMA = "ApplySchemaShard" // Changes the ServedTypes inside a shard SHARD_ACTION_SET_SERVED_TYPES = "SetShardServedTypes" // Migrate served types from one shard to another SHARD_ACTION_MIGRATE_SERVED_TYPES = "MigrateServedTypes" // Update the Shard object (Cells, ...) SHARD_ACTION_UPDATE_SHARD = "UpdateShard" KEYSPACE_ACTION_REBUILD = "RebuildKeyspace" KEYSPACE_ACTION_APPLY_SCHEMA = "ApplySchemaKeyspace" KEYSPACE_ACTION_SET_SHARDING_INFO = "SetKeyspaceShardingInfo" KEYSPACE_ACTION_MIGRATE_SERVED_FROM = "MigrateServedFrom" KEYSPACE_ACTION_SET_SERVED_FROM = "SetKeyspaceServedFrom" SRV_SHARD_ACTION_REBUILD = "RebuildSrvShard" ACTION_STATE_QUEUED = ActionState("") // All actions are queued initially ACTION_STATE_RUNNING = ActionState("Running") // Running inside vtaction process ACTION_STATE_FAILED = ActionState("Failed") // Ended with a failure ACTION_STATE_DONE = ActionState("Done") // Ended with no failure )
Variables ¶
var ( // DefaultLockTimeout is a good value to use as a default for // locking a shard / keyspace. DefaultLockTimeout = 30 * time.Second )
Functions ¶
This section is empty.
Types ¶
type ActionNode ¶
type ActionNode struct { Action string ActionGuid string Error string State ActionState Pid int // only != 0 if State == ACTION_STATE_RUNNING // do not serialize the next fields // path in topology server representing this action Path string `json:"-"` Args interface{} `json:"-"` Reply interface{} `json:"-"` }
ActionNode describes a long-running action on a tablet, or an action on a shard or keyspace that locks it.
func ApplySchemaKeyspace ¶
func ApplySchemaKeyspace(change string, simple bool) *ActionNode
ApplySchemaKeyspace returns an ActionNode
func ApplySchemaShard ¶
func ApplySchemaShard(masterTabletAlias topo.TabletAlias, change string, simple bool) *ActionNode
ApplySchemaShard returns an ActionNode
func MigrateServedFrom ¶
func MigrateServedFrom(servedType topo.TabletType) *ActionNode
MigrateServedFrom returns an ActionNode
func MigrateServedTypes ¶
func MigrateServedTypes(servedType topo.TabletType) *ActionNode
MigrateServedTypes returns an ActionNode
func ReparentShard ¶
func ReparentShard(tabletAlias topo.TabletAlias) *ActionNode
ReparentShard returns an ActionNode
func SetKeyspaceServedFrom ¶
func SetKeyspaceServedFrom() *ActionNode
SetKeyspaceServedFrom returns an ActionNode
func SetKeyspaceShardingInfo ¶
func SetKeyspaceShardingInfo() *ActionNode
SetKeyspaceShardingInfo returns an ActionNode
func SetShardServedTypes ¶
func SetShardServedTypes(cells []string, servedType topo.TabletType) *ActionNode
SetShardServedTypes returns an ActionNode
func ShardExternallyReparented ¶
func ShardExternallyReparented(tabletAlias topo.TabletAlias) *ActionNode
ShardExternallyReparented returns an ActionNode
func (*ActionNode) LockKeyspace ¶
func (n *ActionNode) LockKeyspace(ctx context.Context, ts topo.Server, keyspace string) (lockPath string, err error)
LockKeyspace will lock the keyspace in the topology server. UnlockKeyspace should be called if this returns no error.
func (*ActionNode) LockShard ¶
func (n *ActionNode) LockShard(ctx context.Context, ts topo.Server, keyspace, shard string) (lockPath string, err error)
LockShard will lock the shard in the topology server. UnlockShard should be called if this returns no error.
func (*ActionNode) LockSrvShard ¶
func (n *ActionNode) LockSrvShard(ctx context.Context, ts topo.Server, cell, keyspace, shard string) (lockPath string, err error)
LockSrvShard will lock the serving shard in the topology server. UnlockSrvShard should be called if this returns no error.
func (*ActionNode) SetGuid ¶
func (n *ActionNode) SetGuid() *ActionNode
SetGuid will set the ActionGuid field for the action node and return the action node.
func (*ActionNode) ToJson ¶
func (n *ActionNode) ToJson() string
ToJson returns a JSON representation of the object.
func (*ActionNode) UnlockKeyspace ¶
func (n *ActionNode) UnlockKeyspace(ctx context.Context, ts topo.Server, keyspace string, lockPath string, actionError error) error
UnlockKeyspace unlocks a previously locked keyspace.
type ApplySchemaKeyspaceArgs ¶
ApplySchemaKeyspaceArgs is the payload for ApplySchemaKeyspace
type ApplySchemaShardArgs ¶
type ApplySchemaShardArgs struct { MasterTabletAlias topo.TabletAlias Change string Simple bool }
ApplySchemaShardArgs is the payload for ApplySchemaShard
type HealthStreamReply ¶
type HealthStreamReply struct { // Tablet is the current tablet record, as cached by tabletmanager Tablet *topo.Tablet // BinlogPlayerMapSize is the size of the binlog player map. // If non zero, the ReplicationDelay is the binlog players' maximum // replication delay. BinlogPlayerMapSize int64 // HealthError is the last error we got from health check, // or empty is the server is healthy. HealthError string // ReplicationDelay is either from MySQL replication, or from // filtered replication ReplicationDelay time.Duration }
HealthStreamReply is the structure we stream from HealthStream
type MigrateServedFromArgs ¶
type MigrateServedFromArgs struct {
ServedType topo.TabletType
}
MigrateServedFromArgs is the payload for MigrateServedFrom
type MigrateServedTypesArgs ¶
type MigrateServedTypesArgs struct {
ServedType topo.TabletType
}
MigrateServedTypesArgs is the payload for MigrateServedTypes
type ReserveForRestoreArgs ¶
type ReserveForRestoreArgs struct {
SrcTabletAlias topo.TabletAlias
}
ReserveForRestoreArgs is the payload for ReserveForRestore
type RestartSlaveData ¶
type RestartSlaveData struct { ReplicationStatus *myproto.ReplicationStatus WaitPosition myproto.ReplicationPosition TimePromoted int64 // used to verify replication - a row will be inserted with this timestamp Parent topo.TabletAlias Force bool }
RestartSlaveData is returned by the master, and used to promote or restart slaves
func (*RestartSlaveData) String ¶
func (rsd *RestartSlaveData) String() string
type RestoreArgs ¶
type RestoreArgs struct { SrcTabletAlias topo.TabletAlias SrcFilePath string ParentAlias topo.TabletAlias FetchConcurrency int FetchRetryCount int WasReserved bool DontWaitForSlaveStart bool }
RestoreArgs is the payload for Restore
type SetShardServedTypesArgs ¶
type SetShardServedTypesArgs struct { Cells []string ServedType topo.TabletType }
SetShardServedTypesArgs is the payload for SetShardServedTypes
type SlaveWasRestartedArgs ¶
type SlaveWasRestartedArgs struct {
Parent topo.TabletAlias
}
SlaveWasRestartedArgs is the paylod for SlaveWasRestarted
type SnapshotArgs ¶
SnapshotArgs is the paylod for Snapshot
type SnapshotReply ¶
type SnapshotReply struct { ParentAlias topo.TabletAlias ManifestPath string // these two are only used for ServerMode=true full snapshot SlaveStartRequired bool ReadOnly bool }
SnapshotReply is the response for Snapshot
type SnapshotSourceEndArgs ¶
type SnapshotSourceEndArgs struct { SlaveStartRequired bool ReadOnly bool OriginalType topo.TabletType }
SnapshotSourceEndArgs is the payload for SnapshotSourceEnd