Documentation ¶
Index ¶
- Constants
- Variables
- type ActionNode
- func ApplySchemaKeyspace(change string) *ActionNode
- func CheckShard() *ActionNode
- func KeyspaceCreateShard() *ActionNode
- func MigrateServedFrom(servedType topodatapb.TabletType) *ActionNode
- func MigrateServedTypes(servedType topodatapb.TabletType) *ActionNode
- func RebuildKeyspace() *ActionNode
- func RebuildShard() *ActionNode
- func RebuildSrvShard() *ActionNode
- func ReparentShard(operation string, masterElectAlias *topodatapb.TabletAlias) *ActionNode
- func SetKeyspaceServedFrom() *ActionNode
- func SetKeyspaceShardingInfo() *ActionNode
- func SetShardServedTypes(cells []string, servedType topodatapb.TabletType) *ActionNode
- func ShardExternallyReparented(tabletAlias *topodatapb.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, error)
- 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 MigrateServedFromArgs
- type MigrateServedTypesArgs
- type ReparentShardArgs
- type SetShardServedTypesArgs
- type SlaveWasRestartedArgs
Constants ¶
const ( // TabletActionPing checks a tablet is alive TabletActionPing = "Ping" // TabletActionSleep will sleep for a duration (used for tests) TabletActionSleep = "Sleep" // TabletActionExecuteHook will execute the provided hook remotely TabletActionExecuteHook = "ExecuteHook" // TabletActionSetReadOnly makes the mysql instance read-only TabletActionSetReadOnly = "SetReadOnly" // TabletActionSetReadWrite makes the mysql instance read-write TabletActionSetReadWrite = "SetReadWrite" // TabletActionChangeType changes the type of the tablet TabletActionChangeType = "ChangeType" // TabletActionResetReplication tells the tablet it should // reset its replication state TabletActionResetReplication = "ResetReplication" // TabletActionInitMaster tells the tablet it should make itself the new // master for the shard it's currently in. TabletActionInitMaster = "InitMaster" // TabletActionPopulateReparentJournal inserts an entry in the // _vt.reparent_journal table TabletActionPopulateReparentJournal = "PopulateReparentJournal" // TabletActionInitSlave tells the tablet it should make // itself a slave to the provided master at the given position. TabletActionInitSlave = "InitSlave" // TabletActionDemoteMaster tells the current master it's // about to not be a master any more, and should go read-only. TabletActionDemoteMaster = "DemoteMaster" // TabletActionPromoteSlaveWhenCaughtUp tells the tablet to wait // for a given replication point, and when it reaches it // switch to be a master. TabletActionPromoteSlaveWhenCaughtUp = "PromoteSlaveWhenCaughtUp" // TabletActionSlaveWasPromoted tells a tablet this previously slave // tablet is now the master. The tablet will update its // own topology record. TabletActionSlaveWasPromoted = "SlaveWasPromoted" // TabletActionSetMaster tells a tablet it has a new master. // The tablet will reparent to the new master, and wait for // the reparent_journal entry. TabletActionSetMaster = "SetMaster" // TabletActionSlaveWasRestarted tells a tablet the mysql // master was changed. The tablet will check it is indeed the // case, and update its own topology record. TabletActionSlaveWasRestarted = "SlaveWasRestarted" // TabletActionStopReplicationAndGetStatus will stop replication, // and return the current replication status. TabletActionStopReplicationAndGetStatus = "StopReplicationAndGetStatus" // TabletActionPromoteSlave will make this tablet the master TabletActionPromoteSlave = "PromoteSlave" // TabletActionStopSlave will stop MySQL replication. TabletActionStopSlave = "StopSlave" // TabletActionStopSlaveMinimum will stop MySQL replication // after it reaches a minimum point. TabletActionStopSlaveMinimum = "StopSlaveMinimum" // TabletActionStartSlave will start MySQL replication. TabletActionStartSlave = "StartSlave" // TabletActionExternallyReparented is sent directly to the new master // tablet when it becomes the master. It is functionnaly equivalent // to calling "ShardExternallyReparented" on the topology. TabletActionExternallyReparented = "TabletExternallyReparented" // TabletActionMasterPosition returns the current master position TabletActionMasterPosition = "MasterPosition" // TabletActionSlaveStatus returns the current slave status TabletActionSlaveStatus = "SlaveStatus" // TabletActionWaitBLPPosition waits until the slave reaches a // replication position in filtered replication TabletActionWaitBLPPosition = "WaitBlpPosition" // TabletActionStopBLP stops filtered replication TabletActionStopBLP = "StopBlp" // TabletActionStartBLP starts filtered replication TabletActionStartBLP = "StartBlp" // TabletActionRunBLPUntil will run filtered replication until // it reaches the provided stop position. TabletActionRunBLPUntil = "RunBlpUntil" // TabletActionGetSchema returns the tablet current schema. TabletActionGetSchema = "GetSchema" // TabletActionRefreshState tells the tablet to refresh its // tablet record from the topo server. TabletActionRefreshState = "RefreshState" // TabletActionRunHealthCheck tells the tablet to run a health check. TabletActionRunHealthCheck = "RunHealthCheck" // TabletActionIgnoreHealthError sets the regexp for health errors to ignore. TabletActionIgnoreHealthError = "IgnoreHealthError" // TabletActionReloadSchema tells the tablet to reload its schema. TabletActionReloadSchema = "ReloadSchema" // TabletActionPreflightSchema will check a schema change works TabletActionPreflightSchema = "PreflightSchema" // TabletActionApplySchema will actually apply the schema change TabletActionApplySchema = "ApplySchema" // TabletActionExecuteFetchAsDba uses the DBA connection to run queries. TabletActionExecuteFetchAsDba = "ExecuteFetchAsDba" // TabletActionExecuteFetchAsApp uses the App connection to run queries. TabletActionExecuteFetchAsApp = "ExecuteFetchAsApp" // TabletActionGetPermissions returns the mysql permissions set TabletActionGetPermissions = "GetPermissions" // TabletActionGetSlaves returns the current set of mysql // replication slaves. TabletActionGetSlaves = "GetSlaves" // TabletActionBackup takes a db backup and stores it into BackupStorage TabletActionBackup = "Backup" // ShardActionReparent handles reparenting of the shard ShardActionReparent = "ReparentShard" // ShardActionExternallyReparented locks the shard when it's // been reparented ShardActionExternallyReparented = "ShardExternallyReparented" // ShardActionRebuild recomputes derived shard-wise data ShardActionRebuild = "RebuildShard" // ShardActionCheck takes a generic read lock for inexpensive // shard-wide actions. ShardActionCheck = "CheckShard" // ShardActionSetServedTypes changes the ServedTypes inside a shard ShardActionSetServedTypes = "SetShardServedTypes" // ShardActionMigrateServedTypes migratew served types from // one shard to another ShardActionMigrateServedTypes = "MigrateServedTypes" // ShardActionUpdateShard updates the Shard object (Cells, ...) ShardActionUpdateShard = "UpdateShard" // KeyspaceActionRebuild rebuilds the keyspace serving graph KeyspaceActionRebuild = "RebuildKeyspace" // KeyspaceActionApplySchema applies a schema change on the keyspace KeyspaceActionApplySchema = "ApplySchemaKeyspace" // KeyspaceActionSetShardingInfo updates the sharding info KeyspaceActionSetShardingInfo = "SetKeyspaceShardingInfo" // KeyspaceActionMigrateServedFrom migrates ServedFrom to // another keyspace KeyspaceActionMigrateServedFrom = "MigrateServedFrom" // KeyspaceActionSetServedFrom updates ServedFrom KeyspaceActionSetServedFrom = "SetKeyspaceServedFrom" // KeyspaceActionCreateShard protects shard creation within the keyspace KeyspaceActionCreateShard = "KeyspaceCreateShard" // SrvShardActionRebuild locks the SvrShard for rebuild SrvShardActionRebuild = "RebuildSrvShard" // ActionStateQueued is for an action that is going to be executed ActionStateQueued = ActionState("") // All actions are queued initially // ActionStateRunning is for an action that is running ActionStateRunning = ActionState("Running") // Running inside vtaction process // ActionStateFailed is for an action that has failed ActionStateFailed = ActionState("Failed") // Ended with a failure // ActionStateDone is for an action that is done and successful ActionStateDone = 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 // LockTimeout is the command line flag that introduces a shorter // timeout for locking topology structures. LockTimeout = flag.Duration("lock_timeout", DefaultLockTimeout, "timeout for acquiring topology locks") )
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 == ActionStateRunning // 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) *ActionNode
ApplySchemaKeyspace returns an ActionNode
func KeyspaceCreateShard ¶
func KeyspaceCreateShard() *ActionNode
KeyspaceCreateShard returns an ActionNode to use to lock a keyspace for shard creation
func MigrateServedFrom ¶
func MigrateServedFrom(servedType topodatapb.TabletType) *ActionNode
MigrateServedFrom returns an ActionNode
func MigrateServedTypes ¶
func MigrateServedTypes(servedType topodatapb.TabletType) *ActionNode
MigrateServedTypes returns an ActionNode
func ReparentShard ¶
func ReparentShard(operation string, masterElectAlias *topodatapb.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 topodatapb.TabletType) *ActionNode
SetShardServedTypes returns an ActionNode
func ShardExternallyReparented ¶
func ShardExternallyReparented(tabletAlias *topodatapb.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, error)
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 ¶
type ApplySchemaKeyspaceArgs struct {
Change string
}
ApplySchemaKeyspaceArgs is the payload for ApplySchemaKeyspace
type MigrateServedFromArgs ¶
type MigrateServedFromArgs struct {
ServedType topodatapb.TabletType
}
MigrateServedFromArgs is the payload for MigrateServedFrom
type MigrateServedTypesArgs ¶
type MigrateServedTypesArgs struct {
ServedType topodatapb.TabletType
}
MigrateServedTypesArgs is the payload for MigrateServedTypes
type ReparentShardArgs ¶
type ReparentShardArgs struct { Operation string MasterElectAlias *topodatapb.TabletAlias }
ReparentShardArgs is the payload for ReparentShard
type SetShardServedTypesArgs ¶
type SetShardServedTypesArgs struct { Cells []string ServedType topodatapb.TabletType }
SetShardServedTypesArgs is the payload for SetShardServedTypes
type SlaveWasRestartedArgs ¶
type SlaveWasRestartedArgs struct {
Parent *topodatapb.TabletAlias
}
SlaveWasRestartedArgs is the paylod for SlaveWasRestarted