actionnode

package
v2.0.0-alpha2+incompat... Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2015 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
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"

	// TabletActionScrap scraps the live running tablet
	TabletActionScrap = "Scrap"

	// 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 refresh its
	// tablet record from the topo server.
	TabletActionRunHealthCheck = "RunHealthCheck"

	// 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"

	// ShardActionApplySchema applies a schema change on an entire shard
	ShardActionApplySchema = "ApplySchemaShard"

	// 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

View Source
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 == 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, simple bool) *ActionNode

ApplySchemaKeyspace returns an ActionNode

func ApplySchemaShard

func ApplySchemaShard(masterTabletAlias *pb.TabletAlias, change string, simple bool) *ActionNode

ApplySchemaShard returns an ActionNode

func CheckShard

func CheckShard() *ActionNode

CheckShard 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 pb.TabletType) *ActionNode

MigrateServedFrom returns an ActionNode

func MigrateServedTypes

func MigrateServedTypes(servedType pb.TabletType) *ActionNode

MigrateServedTypes returns an ActionNode

func RebuildKeyspace

func RebuildKeyspace() *ActionNode

RebuildKeyspace returns an ActionNode

func RebuildShard

func RebuildShard() *ActionNode

RebuildShard returns an ActionNode

func RebuildSrvShard

func RebuildSrvShard() *ActionNode

RebuildSrvShard returns an ActionNode

func ReparentShard

func ReparentShard(operation string, masterElectAlias *pb.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 pb.TabletType) *ActionNode

SetShardServedTypes returns an ActionNode

func ShardExternallyReparented

func ShardExternallyReparented(tabletAlias *pb.TabletAlias) *ActionNode

ShardExternallyReparented returns an ActionNode

func UpdateShard

func UpdateShard() *ActionNode

UpdateShard 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.

func (*ActionNode) UnlockShard

func (n *ActionNode) UnlockShard(ctx context.Context, ts topo.Server, keyspace, shard string, lockPath string, actionError error) error

UnlockShard unlocks a previously locked shard.

func (*ActionNode) UnlockSrvShard

func (n *ActionNode) UnlockSrvShard(ctx context.Context, ts topo.Server, cell, keyspace, shard string, lockPath string, actionError error) error

UnlockSrvShard unlocks a previously locked serving shard.

type ActionState

type ActionState string

ActionState is the state an ActionNode

type ApplySchemaKeyspaceArgs

type ApplySchemaKeyspaceArgs struct {
	Change string
	Simple bool
}

ApplySchemaKeyspaceArgs is the payload for ApplySchemaKeyspace

type ApplySchemaShardArgs

type ApplySchemaShardArgs struct {
	MasterTabletAlias *pb.TabletAlias
	Change            string
	Simple            bool
}

ApplySchemaShardArgs is the payload for ApplySchemaShard

type MigrateServedFromArgs

type MigrateServedFromArgs struct {
	ServedType pb.TabletType
}

MigrateServedFromArgs is the payload for MigrateServedFrom

type MigrateServedTypesArgs

type MigrateServedTypesArgs struct {
	ServedType pb.TabletType
}

MigrateServedTypesArgs is the payload for MigrateServedTypes

type ReparentShardArgs

type ReparentShardArgs struct {
	Operation        string
	MasterElectAlias *pb.TabletAlias
}

ReparentShardArgs is the payload for ReparentShard

type SetShardServedTypesArgs

type SetShardServedTypesArgs struct {
	Cells      []string
	ServedType pb.TabletType
}

SetShardServedTypesArgs is the payload for SetShardServedTypes

type SlaveWasRestartedArgs

type SlaveWasRestartedArgs struct {
	Parent *pb.TabletAlias
}

SlaveWasRestartedArgs is the paylod for SlaveWasRestarted

Jump to

Keyboard shortcuts

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