Documentation ¶
Overview ¶
wrangler contains the Wrangler object to manage complex topology actions.
Index ¶
- Constants
- Variables
- func CopyMapKeys(m interface{}, typeHint interface{}) interface{}
- func CopyMapValues(m interface{}, typeHint interface{}) interface{}
- func FindTabletByIPAddrAndPort(tabletMap map[topo.TabletAlias]*topo.TabletInfo, addr, portName string, ...) (topo.TabletAlias, error)
- func GetAllTablets(ts topo.Server, cell string) ([]*topo.TabletInfo, error)
- func GetAllTabletsAccrossCells(ts topo.Server) ([]*topo.TabletInfo, error)
- func RecordChangeSlaveTypeAction(cleaner *Cleaner, tabletAlias topo.TabletAlias, tabletType topo.TabletType)
- func RecordStartBlpAction(cleaner *Cleaner, tabletAlias topo.TabletAlias, waitTime time.Duration)
- func RecordStartSlaveAction(cleaner *Cleaner, tabletAlias topo.TabletAlias, waitTime time.Duration)
- func RecordTabletTagAction(cleaner *Cleaner, tabletAlias topo.TabletAlias, name, value string)
- func SignalInterrupt()
- func WriteAddr(zconn zk.Conn, zkPath string, addr *zkns.ZknsAddr) error
- func WriteAddrs(zconn zk.Conn, zkPath string, addrs *LegacyZknsAddrs) error
- type ChangeSlaveTypeAction
- type Cleaner
- type CleanerAction
- type KeyspaceNodes
- type LegacyZknsAddrs
- type ServingGraph
- type ShardNodes
- type StartBlpAction
- type StartSlaveAction
- type TabletNode
- type TabletNodesByType
- type TabletStatus
- type TabletTagAction
- type Topology
- type Wrangler
- func (wr *Wrangler) ActionInitiator() *initiator.ActionInitiator
- func (wr *Wrangler) ApplySchema(tabletAlias topo.TabletAlias, sc *myproto.SchemaChange) (*myproto.SchemaChangeResult, error)
- func (wr *Wrangler) ApplySchemaKeyspace(keyspace string, change string, simple, force bool) (*myproto.SchemaChangeResult, error)
- func (wr *Wrangler) ApplySchemaShard(keyspace, shard, change string, newParentTabletAlias topo.TabletAlias, ...) (*myproto.SchemaChangeResult, error)
- func (wr *Wrangler) ChangeType(tabletAlias topo.TabletAlias, tabletType topo.TabletType, force bool) error
- func (wr *Wrangler) ChangeTypeNoRebuild(tabletAlias topo.TabletAlias, tabletType topo.TabletType, force bool) (rebuildRequired bool, cell, keyspace, shard string, err error)
- func (wr *Wrangler) Clone(srcTabletAlias topo.TabletAlias, dstTabletAliases []topo.TabletAlias, ...) error
- func (wr *Wrangler) DbTopology() (*Topology, error)
- func (wr *Wrangler) DeleteShard(keyspace, shard string) error
- func (wr *Wrangler) DeleteTablet(tabletAlias topo.TabletAlias) error
- func (wr *Wrangler) ExecuteFetch(tabletAlias topo.TabletAlias, query string, maxRows int, ...) (*mproto.QueryResult, error)
- func (wr *Wrangler) ExecuteHook(tabletAlias topo.TabletAlias, hook *hk.Hook) (hookResult *hk.HookResult, err error)
- func (wr *Wrangler) ExecuteOptionalTabletInfoHook(ti *topo.TabletInfo, hook *hk.Hook) (err error)
- func (wr *Wrangler) ExecuteTabletInfoHook(ti *topo.TabletInfo, hook *hk.Hook) (hookResult *hk.HookResult, err error)
- func (wr *Wrangler) ExportZkns(cell string) error
- func (wr *Wrangler) ExportZknsForKeyspace(keyspace string) error
- func (wr *Wrangler) GetPermissions(tabletAlias topo.TabletAlias) (*myproto.Permissions, error)
- func (wr *Wrangler) GetSchema(tabletAlias topo.TabletAlias, tables, excludeTables []string, ...) (*myproto.SchemaDefinition, error)
- func (wr *Wrangler) GetVersion(tabletAlias topo.TabletAlias) (string, error)
- func (wr *Wrangler) InitTablet(tablet *topo.Tablet, force, createShardAndKeyspace, update bool) error
- func (wr *Wrangler) MigrateServedFrom(keyspace, shard string, servedType topo.TabletType, reverse bool) error
- func (wr *Wrangler) MigrateServedTypes(keyspace, shard string, servedType topo.TabletType, reverse bool) error
- func (wr *Wrangler) MultiRestore(dstTabletAlias topo.TabletAlias, sources []topo.TabletAlias, ...) error
- func (wr *Wrangler) MultiSnapshot(keyRanges []key.KeyRange, tabletAlias topo.TabletAlias, concurrency int, ...) (manifests []string, parent topo.TabletAlias, err error)
- func (wr *Wrangler) PreflightSchema(tabletAlias topo.TabletAlias, change string) (*myproto.SchemaChangeResult, error)
- func (wr *Wrangler) RebuildKeyspaceGraph(keyspace string, cells []string) error
- func (wr *Wrangler) RebuildReplicationGraph(cells []string, keyspaces []string) error
- func (wr *Wrangler) RebuildShardGraph(keyspace, shard string, cells []string) error
- func (wr *Wrangler) ReloadSchema(tabletAlias topo.TabletAlias) error
- func (wr *Wrangler) RemoveShardCell(keyspace, shard, cell string, force bool) error
- func (wr *Wrangler) ReparentShard(keyspace, shard string, masterElectTabletAlias topo.TabletAlias, ...) error
- func (wr *Wrangler) ReparentTablet(tabletAlias topo.TabletAlias) error
- func (wr *Wrangler) ReserveForRestore(srcTabletAlias, dstTabletAlias topo.TabletAlias) (err error)
- func (wr *Wrangler) ResetActionTimeout(actionTimeout time.Duration)
- func (wr *Wrangler) Restore(srcTabletAlias topo.TabletAlias, srcFilePath string, ...) error
- func (wr *Wrangler) Scrap(tabletAlias topo.TabletAlias, force, skipRebuild bool) (actionPath string, err error)
- func (wr *Wrangler) ServingGraph(cell string) (servingGraph *ServingGraph)
- func (wr *Wrangler) SetBlacklistedTablesByShard(keyspace, shard string, tabletType topo.TabletType, tables []string) error
- func (wr *Wrangler) SetKeyspaceShardingInfo(keyspace, shardingColumnName string, shardingColumnType key.KeyspaceIdType, ...) error
- func (wr *Wrangler) SetShardServedTypes(keyspace, shard string, servedTypes []topo.TabletType) error
- func (wr *Wrangler) SetSourceShards(keyspace, shard string, sources []topo.TabletAlias, tables []string) error
- func (wr *Wrangler) ShardExternallyReparented(keyspace, shard string, masterElectTabletAlias topo.TabletAlias) error
- func (wr *Wrangler) ShardMultiRestore(keyspace, shard string, sources []topo.TabletAlias, tables []string, ...) error
- func (wr *Wrangler) ShardReplicationPositions(keyspace, shard string) ([]*topo.TabletInfo, []*myproto.ReplicationPosition, error)
- func (wr *Wrangler) Snapshot(tabletAlias topo.TabletAlias, forceMasterSnapshot bool, ...) (manifest string, parent topo.TabletAlias, slaveStartRequired, readOnly bool, ...)
- func (wr *Wrangler) SnapshotSourceEnd(tabletAlias topo.TabletAlias, slaveStartRequired, readWrite bool, ...) (err error)
- func (wr *Wrangler) TopoServer() topo.Server
- func (wr *Wrangler) UnreserveForRestore(dstTabletAlias topo.TabletAlias) (err error)
- func (wr *Wrangler) UnreserveForRestoreMulti(dstTabletAliases []topo.TabletAlias)
- func (wr *Wrangler) Validate(pingTablets bool) error
- func (wr *Wrangler) ValidateKeyspace(keyspace string, pingTablets bool) error
- func (wr *Wrangler) ValidatePermissionsKeyspace(keyspace string) error
- func (wr *Wrangler) ValidatePermissionsShard(keyspace, shard string) error
- func (wr *Wrangler) ValidateSchemaKeyspace(keyspace string, excludeTables []string, includeViews bool) error
- func (wr *Wrangler) ValidateSchemaShard(keyspace, shard string, excludeTables []string, includeViews bool) error
- func (wr *Wrangler) ValidateShard(keyspace, shard string, pingTablets bool) error
- func (wr *Wrangler) ValidateVersionKeyspace(keyspace string) error
- func (wr *Wrangler) ValidateVersionShard(keyspace, shard string) error
- func (wr *Wrangler) WaitForCompletion(actionPath string) error
- func (wr *Wrangler) WaitForCompletionReply(actionPath string) (interface{}, error)
Constants ¶
const ChangeSlaveTypeActionName = "ChangeSlaveTypeAction"
const (
SLAVE_STATUS_DEADLINE = 10e9
)
const StartBlpActionName = "StartBlpAction"
const StartSlaveActionName = "StartSlaveAction"
const TabletTagActionName = "TabletTagAction"
Variables ¶
var ( // DefaultActionTimeout is a good default for interactive // remote actions. We usually take a lock then do an action, // so basing this to be greater than DefaultLockTimeout is good. DefaultActionTimeout = actionnode.DefaultLockTimeout * 4 )
Functions ¶
func CopyMapKeys ¶
func CopyMapKeys(m interface{}, typeHint interface{}) interface{}
CopyMapKeys copies keys from from map m into a new slice with the type specified by typeHint. Reflection can't make a new slice type just based on the key type AFAICT.
func CopyMapValues ¶
func CopyMapValues(m interface{}, typeHint interface{}) interface{}
CopyMapKeys copies values from from map m into a new slice with the type specified by typeHint. Reflection can't make a new slice type just based on the key type AFAICT.
func FindTabletByIPAddrAndPort ¶
func FindTabletByIPAddrAndPort(tabletMap map[topo.TabletAlias]*topo.TabletInfo, addr, portName string, port int) (topo.TabletAlias, error)
FindTabletByIPAddrAndPort searches within a tablet map for tablets
func GetAllTablets ¶
GetAllTablets returns a sorted list of tablets.
func GetAllTabletsAccrossCells ¶
func GetAllTabletsAccrossCells(ts topo.Server) ([]*topo.TabletInfo, error)
GetAllTabletsAccrossCells returns all tablets from known cells. If it returns topo.ErrPartialResult, then the list is valid, but partial.
func RecordChangeSlaveTypeAction ¶
func RecordChangeSlaveTypeAction(cleaner *Cleaner, tabletAlias topo.TabletAlias, tabletType topo.TabletType)
RecordChangeSlaveTypeAction records a new ChangeSlaveTypeAction into the specified Cleaner
func RecordStartBlpAction ¶
func RecordStartBlpAction(cleaner *Cleaner, tabletAlias topo.TabletAlias, waitTime time.Duration)
RecordStartBlpAction records a new StartBlpAction into the specified Cleaner
func RecordStartSlaveAction ¶
func RecordStartSlaveAction(cleaner *Cleaner, tabletAlias topo.TabletAlias, waitTime time.Duration)
RecordStartSlaveAction records a new StartSlaveAction into the specified Cleaner
func RecordTabletTagAction ¶
func RecordTabletTagAction(cleaner *Cleaner, tabletAlias topo.TabletAlias, name, value string)
RecordTabletTagAction records a new TabletTagAction into the specified Cleaner
func SignalInterrupt ¶
func SignalInterrupt()
SignalInterrupt needs to be called when a signal interrupts the current process.
func WriteAddrs ¶
func WriteAddrs(zconn zk.Conn, zkPath string, addrs *LegacyZknsAddrs) error
Types ¶
type ChangeSlaveTypeAction ¶
type ChangeSlaveTypeAction struct { TabletAlias topo.TabletAlias TabletType topo.TabletType }
ChangeSlaveTypeAction will change a server type to another type
func FindChangeSlaveTypeActionByTarget ¶
func FindChangeSlaveTypeActionByTarget(cleaner *Cleaner, tabletAlias topo.TabletAlias) (*ChangeSlaveTypeAction, error)
FindChangeSlaveTypeActionByTarget finds the first action for the target
func (ChangeSlaveTypeAction) CleanUp ¶
func (csta ChangeSlaveTypeAction) CleanUp(wr *Wrangler) error
CleanUp is part of CleanerAction interface.
type Cleaner ¶
type Cleaner struct {
// contains filtered or unexported fields
}
Cleaner remembers a list of cleanup steps to perform. Just record action cleanup steps, and execute them at the end in reverse order, with various guarantees.
func (*Cleaner) CleanUp ¶
CleanUp will run the recorded actions. If an action on a target fails, it will not run the next action on the same target. We return the aggregate errors for all cleanups. TODO(alainjobart) Actions should run concurrently on a per target basis. They are then serialized on each target.
func (*Cleaner) GetActionByName ¶
func (cleaner *Cleaner) GetActionByName(name, target string) (CleanerAction, error)
GetActionByName returns the first action in the list with the given name and target
func (*Cleaner) Record ¶
func (cleaner *Cleaner) Record(name, target string, action CleanerAction)
Record will add a cleaning action to the list
func (*Cleaner) RemoveActionByName ¶
RemoveActionByName removes an action from the cleaner list
type CleanerAction ¶
CleanerAction is the interface that clean-up actions need to implement
type KeyspaceNodes ¶
type KeyspaceNodes struct { ShardNodes []*ShardNodes // sorted by shard name ServedFrom map[topo.TabletType]string }
KeyspaceNodes represents all tablet nodes in a keyspace.
func (KeyspaceNodes) HasType ¶
func (ks KeyspaceNodes) HasType(tabletType topo.TabletType) bool
HasType returns true if ks has any tablets with the named type.
func (KeyspaceNodes) TabletTypes ¶
func (ks KeyspaceNodes) TabletTypes() []topo.TabletType
TabletTypes returns a slice of tablet type names this ks contains.
type LegacyZknsAddrs ¶
type LegacyZknsAddrs struct {
Endpoints []string `json:"endpoints"`
}
type ServingGraph ¶
type ServingGraph struct { Cell string Keyspaces map[string]*KeyspaceNodes // indexed by keyspace name Errors []string // collected during creation }
ServingGraph contains the representation of the serving graph for a given cell.
type ShardNodes ¶
type ShardNodes struct { Name string TabletNodes TabletNodesByType ServedTypes []topo.TabletType }
ShardNodes represents all tablet nodes for a shard, indexed by tablet type.
type StartBlpAction ¶
type StartBlpAction struct { TabletAlias topo.TabletAlias WaitTime time.Duration }
StartBlpAction will restart binlog replication on a server
func (StartBlpAction) CleanUp ¶
func (sba StartBlpAction) CleanUp(wr *Wrangler) error
CleanUp is part of CleanerAction interface.
type StartSlaveAction ¶
type StartSlaveAction struct { TabletAlias topo.TabletAlias WaitTime time.Duration }
StartSlaveAction will restart binlog replication on a server
func (StartSlaveAction) CleanUp ¶
func (sba StartSlaveAction) CleanUp(wr *Wrangler) error
CleanUp is part of CleanerAction interface.
type TabletNode ¶
type TabletNode struct { Host string Alias topo.TabletAlias Port int }
TabletNode is the representation of a tablet in the db topology. It can be constructed from a Tablet object, or from an EndPoint.
func (*TabletNode) ShortName ¶
func (tn *TabletNode) ShortName() string
ShortName returns a displayable representation of the host name.
type TabletNodesByType ¶
type TabletNodesByType map[topo.TabletType][]*TabletNode
TabletNodesByType maps tablet types to slices of tablet nodes.
type TabletStatus ¶
type TabletStatus struct {
// contains filtered or unexported fields
}
local structure used to keep track of what we're doing
type TabletTagAction ¶
type TabletTagAction struct { TabletAlias topo.TabletAlias Name string Value string }
TabletTagAction will add / remove a tag to a tablet. If Value is empty, will remove the tag.
func (TabletTagAction) CleanUp ¶
func (tta TabletTagAction) CleanUp(wr *Wrangler) error
CleanUp is part of CleanerAction interface.
type Topology ¶
type Topology struct { Assigned map[string]*KeyspaceNodes // indexed by keyspace name Idle []*TabletNode Scrap []*TabletNode Partial bool }
Topology is the entire set of tablets in the topology.
type Wrangler ¶
type Wrangler struct { // UseRPCs makes the wrangler use RPCs to trigger short live // remote actions. It is faster in production, as we don't // fork a vtaction. However, unit tests don't support it. UseRPCs bool // contains filtered or unexported fields }
Wrangler manages complex actions on the topology, like reparents, snapshots, restores, ...
func New ¶
New creates a new Wrangler object.
actionTimeout: how long should we wait for an action to complete?
- if using wrangler for just one action, this is set properly upon wrangler creation.
- if re-using wrangler multiple times, call ResetActionTimeout before every action.
lockTimeout: how long should we wait for the initial lock to start a complex action? This is distinct from actionTimeout because most of the time, we want to immediately know that our action will fail. However, automated action will need some time to arbitrate the locks.
func (*Wrangler) ActionInitiator ¶
func (wr *Wrangler) ActionInitiator() *initiator.ActionInitiator
ActionInitiator returns the initiator.ActionInitiator this wrangler is using.
func (*Wrangler) ApplySchema ¶
func (wr *Wrangler) ApplySchema(tabletAlias topo.TabletAlias, sc *myproto.SchemaChange) (*myproto.SchemaChangeResult, error)
ApplySchema will apply a schema change on the remote tablet.
func (*Wrangler) ApplySchemaKeyspace ¶
func (wr *Wrangler) ApplySchemaKeyspace(keyspace string, change string, simple, force bool) (*myproto.SchemaChangeResult, error)
apply a schema change to an entire keyspace. take a keyspace lock to do this. first we will validate the Preflight works the same on all shard masters and fail if not (unless force is specified) if simple, we just do it on all masters. if complex, we do the shell game in parallel on all shards
func (*Wrangler) ApplySchemaShard ¶
func (wr *Wrangler) ApplySchemaShard(keyspace, shard, change string, newParentTabletAlias topo.TabletAlias, simple, force bool) (*myproto.SchemaChangeResult, error)
Note for 'complex' mode (the 'simple' mode is easy enough that we don't need to handle recovery that much): this method is able to recover if interrupted in the middle, because it knows which server has the schema change already applied, and will just pass through them very quickly.
func (*Wrangler) ChangeType ¶
func (wr *Wrangler) ChangeType(tabletAlias topo.TabletAlias, tabletType topo.TabletType, force bool) error
Change the type of tablet and recompute all necessary derived paths in the serving graph. If force is true, it will bypass the vtaction system and make the data change directly, and not run the remote hooks.
Note we don't update the master record in the Shard here, as we can't ChangeType from and out of master anyway.
func (*Wrangler) ChangeTypeNoRebuild ¶
func (wr *Wrangler) ChangeTypeNoRebuild(tabletAlias topo.TabletAlias, tabletType topo.TabletType, force bool) (rebuildRequired bool, cell, keyspace, shard string, err error)
ChangeTypeNoRebuild changes a tablet's type, and returns whether there's a shard that should be rebuilt, along with its cell, keyspace, and shard. If force is true, it will bypass the vtaction system and make the data change directly, and not run the remote hooks.
Note we don't update the master record in the Shard here, as we can't ChangeType from and out of master anyway.
func (*Wrangler) Clone ¶
func (wr *Wrangler) Clone(srcTabletAlias topo.TabletAlias, dstTabletAliases []topo.TabletAlias, forceMasterSnapshot bool, snapshotConcurrency, fetchConcurrency, fetchRetryCount int, serverMode bool) error
func (*Wrangler) DbTopology ¶
DbTopology returns the Topology for the current topo server.
func (*Wrangler) DeleteShard ¶
DeleteShard will do all the necessary changes in the topology server to entirely remove a shard. It can only work if there are no tablets in that shard.
func (*Wrangler) DeleteTablet ¶
func (wr *Wrangler) DeleteTablet(tabletAlias topo.TabletAlias) error
DeleteTablet will get the tablet record, and if it's scrapped, will delete the record from the topology.
func (*Wrangler) ExecuteFetch ¶
func (wr *Wrangler) ExecuteFetch(tabletAlias topo.TabletAlias, query string, maxRows int, wantFields, disableBinlogs bool) (*mproto.QueryResult, error)
ExecuteFetch will get data from a remote tablet
func (*Wrangler) ExecuteHook ¶
func (wr *Wrangler) ExecuteHook(tabletAlias topo.TabletAlias, hook *hk.Hook) (hookResult *hk.HookResult, err error)
func (*Wrangler) ExecuteOptionalTabletInfoHook ¶
Execute a hook and returns an error only if the hook failed, not if the hook doesn't exist.
func (*Wrangler) ExecuteTabletInfoHook ¶
func (wr *Wrangler) ExecuteTabletInfoHook(ti *topo.TabletInfo, hook *hk.Hook) (hookResult *hk.HookResult, err error)
func (*Wrangler) ExportZkns ¶
Export addresses from the VT serving graph to a legacy zkns server. Note these functions only work with a zktopo.
func (*Wrangler) ExportZknsForKeyspace ¶
Export addresses from the VT serving graph to a legacy zkns server.
func (*Wrangler) GetPermissions ¶
func (wr *Wrangler) GetPermissions(tabletAlias topo.TabletAlias) (*myproto.Permissions, error)
func (*Wrangler) GetSchema ¶
func (wr *Wrangler) GetSchema(tabletAlias topo.TabletAlias, tables, excludeTables []string, includeViews bool) (*myproto.SchemaDefinition, error)
GetSchema uses an RPC to get the schema from a remote tablet
func (*Wrangler) GetVersion ¶
func (wr *Wrangler) GetVersion(tabletAlias topo.TabletAlias) (string, error)
func (*Wrangler) InitTablet ¶
func (wr *Wrangler) InitTablet(tablet *topo.Tablet, force, createShardAndKeyspace, update bool) error
InitTablet creates or updates a tablet. If no parent is specified in the tablet, and the tablet has a slave type, we will find the appropriate parent. If createShardAndKeyspace is true and the parent keyspace or shard don't exist, they will be created. If update is true, and a tablet with the same ID exists, update it. If Force is true, and a tablet with the same ID already exists, it will be scrapped and deleted, and then recreated.
func (*Wrangler) MigrateServedFrom ¶
func (*Wrangler) MigrateServedTypes ¶
func (*Wrangler) MultiRestore ¶
func (wr *Wrangler) MultiRestore(dstTabletAlias topo.TabletAlias, sources []topo.TabletAlias, concurrency, fetchConcurrency, insertTableConcurrency, fetchRetryCount int, strategy string) error
func (*Wrangler) MultiSnapshot ¶
func (*Wrangler) PreflightSchema ¶
func (wr *Wrangler) PreflightSchema(tabletAlias topo.TabletAlias, change string) (*myproto.SchemaChangeResult, error)
PreflightSchema will try a schema change on the remote tablet.
func (*Wrangler) RebuildKeyspaceGraph ¶
Rebuild the serving graph data while locking out other changes.
func (*Wrangler) RebuildReplicationGraph ¶
This is a quick and dirty tool to resurrect the TopologyServer data from the canonical data stored in the tablet nodes.
cells: local vt cells to scan for all tablets keyspaces: list of keyspaces to rebuild
func (*Wrangler) RebuildShardGraph ¶
Rebuild the serving and replication rollup data data while locking out other changes.
func (*Wrangler) ReloadSchema ¶
func (wr *Wrangler) ReloadSchema(tabletAlias topo.TabletAlias) error
ReloadSchema forces the remote tablet to reload its schema.
func (*Wrangler) RemoveShardCell ¶
RemoveShardCell will remove a cell from the Cells list in a shard. It will first check the shard has no tablets there. if 'force' is specified, it will remove the cell even when the tablet map cannot be retrieved. This is intended to be used when a cell is completely down and its topology server cannot even be reached.
func (*Wrangler) ReparentShard ¶
func (wr *Wrangler) ReparentShard(keyspace, shard string, masterElectTabletAlias topo.TabletAlias, leaveMasterReadOnly, forceReparentToCurrentMaster bool) error
ReparentShard creates the reparenting action and launches a goroutine to coordinate the procedure.
leaveMasterReadOnly: leave the master in read-only mode, even
though all the other necessary updates have been made.
forceReparentToCurrentMaster: mostly for test setups, this can
cause data loss.
func (*Wrangler) ReparentTablet ¶
func (wr *Wrangler) ReparentTablet(tabletAlias topo.TabletAlias) error
ReparentTablet attempts to reparent this tablet to the current master, based on the current replication position. If there is no match, it will fail.
func (*Wrangler) ReserveForRestore ¶
func (wr *Wrangler) ReserveForRestore(srcTabletAlias, dstTabletAlias topo.TabletAlias) (err error)
func (*Wrangler) ResetActionTimeout ¶
ResetActionTimeout should be used before every action on a wrangler object that is going to be re-used: - vtctl will not call this, as it does one action - vtctld will call this, as it re-uses the same wrangler for actions
func (*Wrangler) Restore ¶
func (wr *Wrangler) Restore(srcTabletAlias topo.TabletAlias, srcFilePath string, dstTabletAlias, parentAlias topo.TabletAlias, fetchConcurrency, fetchRetryCount int, wasReserved, dontWaitForSlaveStart bool) error
func (*Wrangler) Scrap ¶
func (wr *Wrangler) Scrap(tabletAlias topo.TabletAlias, force, skipRebuild bool) (actionPath string, err error)
Scrap a tablet. If force is used, we write to topo.Server directly and don't remote-execute the command.
If we scrap the master for a shard, we will clear its record from the Shard object (only if that was the right master)
func (*Wrangler) ServingGraph ¶
func (wr *Wrangler) ServingGraph(cell string) (servingGraph *ServingGraph)
ServingGraph returns the ServingGraph for the given cell.
func (*Wrangler) SetBlacklistedTablesByShard ¶
func (wr *Wrangler) SetBlacklistedTablesByShard(keyspace, shard string, tabletType topo.TabletType, tables []string) error
SetBlacklistedTablesByShard sets the blacklisted table list of all tablets of a given type in a shard. It would work for the master, but it wouldn't be very efficient.
func (*Wrangler) SetKeyspaceShardingInfo ¶
func (*Wrangler) SetShardServedTypes ¶
func (wr *Wrangler) SetShardServedTypes(keyspace, shard string, servedTypes []topo.TabletType) error
SetShardServedTypes changes the ServedTypes parameter of a shard. It does not rebuild any serving graph or do any consistency check (yet).
func (*Wrangler) SetSourceShards ¶
func (*Wrangler) ShardExternallyReparented ¶
func (wr *Wrangler) ShardExternallyReparented(keyspace, shard string, masterElectTabletAlias topo.TabletAlias) error
ShardExternallyReparented updates the topology after the master tablet in a keyspace/shard has changed. We trust that whoever made the change completed the change successfully. We lock the shard while doing the update. We will then rebuild the serving graph in the cells that need it (the old master cell and the new master cell)
func (*Wrangler) ShardMultiRestore ¶
func (*Wrangler) ShardReplicationPositions ¶
func (wr *Wrangler) ShardReplicationPositions(keyspace, shard string) ([]*topo.TabletInfo, []*myproto.ReplicationPosition, error)
ShardReplicationPositions returns the ReplicationPositions for all the tablets in a shard.
func (*Wrangler) Snapshot ¶
func (wr *Wrangler) Snapshot(tabletAlias topo.TabletAlias, forceMasterSnapshot bool, snapshotConcurrency int, serverMode bool) (manifest string, parent topo.TabletAlias, slaveStartRequired, readOnly bool, originalType topo.TabletType, err error)
forceMasterSnapshot: Normally a master is not a viable tablet to snapshot. However, there are degenerate cases where you need to override this, for instance the initial clone of a new master.
func (*Wrangler) SnapshotSourceEnd ¶
func (wr *Wrangler) SnapshotSourceEnd(tabletAlias topo.TabletAlias, slaveStartRequired, readWrite bool, originalType topo.TabletType) (err error)
func (*Wrangler) TopoServer ¶
TopoServer returns the topo.Server this wrangler is using.
func (*Wrangler) UnreserveForRestore ¶
func (wr *Wrangler) UnreserveForRestore(dstTabletAlias topo.TabletAlias) (err error)
func (*Wrangler) UnreserveForRestoreMulti ¶
func (wr *Wrangler) UnreserveForRestoreMulti(dstTabletAliases []topo.TabletAlias)
func (*Wrangler) ValidateKeyspace ¶
func (*Wrangler) ValidatePermissionsKeyspace ¶
func (*Wrangler) ValidatePermissionsShard ¶
func (*Wrangler) ValidateSchemaKeyspace ¶
func (wr *Wrangler) ValidateSchemaKeyspace(keyspace string, excludeTables []string, includeViews bool) error
ValidateSchemaShard will diff the schema from all the tablets in the keyspace.
func (*Wrangler) ValidateSchemaShard ¶
func (wr *Wrangler) ValidateSchemaShard(keyspace, shard string, excludeTables []string, includeViews bool) error
ValidateSchemaShard will diff the schema from all the tablets in the shard.
func (*Wrangler) ValidateShard ¶
func (*Wrangler) ValidateVersionKeyspace ¶
func (*Wrangler) ValidateVersionShard ¶
func (*Wrangler) WaitForCompletion ¶
WaitForCompletion will wait for the actionPath to complete, using the wrangler default action timeout.
func (*Wrangler) WaitForCompletionReply ¶
WaitForCompletionReply will wait for the actionPath to complete, using the wrangler default action timeout, and return the result
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package events defines the structures used for events dispatched from the wrangler package.
|
Package events defines the structures used for events dispatched from the wrangler package. |
Package testlib contains utility methods to include in unit tests to deal with topology common tasks, liek fake tablets and action loops.
|
Package testlib contains utility methods to include in unit tests to deal with topology common tasks, liek fake tablets and action loops. |