Documentation
¶
Index ¶
- Constants
- func FileExists(fileName string) bool
- func PrettifyDurationOutput(d time.Duration) string
- func StringContainsAll(s string, substrings ...string) bool
- type ContextConfig
- type CutOver
- type LoadMap
- type MigrationContext
- func (this *MigrationContext) ApplyCredentials()
- func (this *MigrationContext) ElapsedRowCopyTime() time.Duration
- func (this *MigrationContext) ElapsedTime() time.Duration
- func (this *MigrationContext) GetChangelogTableName() string
- func (this *MigrationContext) GetCriticalLoad() LoadMap
- func (this *MigrationContext) GetGhostTableName() string
- func (this *MigrationContext) GetIteration() int64
- func (this *MigrationContext) GetMaxLoad() LoadMap
- func (this *MigrationContext) GetOldTableName() string
- func (this *MigrationContext) GetThrottleControlReplicaKeys() *mysql.InstanceKeyMap
- func (this *MigrationContext) GetThrottleQuery() string
- func (this *MigrationContext) GetTotalRowsCopied() int64
- func (this *MigrationContext) GetVoluntaryLockName() string
- func (this *MigrationContext) HasMigrationRange() bool
- func (this *MigrationContext) InspectorIsAlsoApplier() bool
- func (this *MigrationContext) IsThrottled() (bool, string)
- func (this *MigrationContext) IsTransactionalTable() bool
- func (this *MigrationContext) MarkPointOfInterest() int64
- func (this *MigrationContext) MarkRowCopyEndTime()
- func (this *MigrationContext) MaxRetries() int64
- func (this *MigrationContext) ReadConfigFile() error
- func (this *MigrationContext) ReadCriticalLoad(criticalLoadList string) error
- func (this *MigrationContext) ReadMaxLoad(maxLoadList string) error
- func (this *MigrationContext) ReadThrottleControlReplicaKeys(throttleControlReplicas string) error
- func (this *MigrationContext) RequiresBinlogFormatChange() bool
- func (this *MigrationContext) SetChunkSize(chunkSize int64)
- func (this *MigrationContext) SetCutOverLockTimeoutSeconds(timeoutSeconds int64) error
- func (this *MigrationContext) SetDefaultNumRetries(retries int64)
- func (this *MigrationContext) SetThrottleQuery(newQuery string)
- func (this *MigrationContext) SetThrottled(throttle bool, reason string)
- func (this *MigrationContext) TimeSincePointOfInterest() time.Duration
- type RowsEstimateMethod
Constants ¶
const ( TableStatusRowsEstimate RowsEstimateMethod = "TableStatusRowsEstimate" ExplainRowsEstimate = "ExplainRowsEstimate" CountRowsEstimate = "CountRowsEstimate" )
const ( CutOverAtomic CutOver = iota CutOverSafe = iota CutOverTwoStep = iota )
Variables ¶
This section is empty.
Functions ¶
func FileExists ¶ added in v0.7.2
func PrettifyDurationOutput ¶
func StringContainsAll ¶ added in v0.9.6
StringContainsAll returns true if `s` contains all non empty given `substrings` The function returns `false` if no non-empty arguments are given.
Types ¶
type ContextConfig ¶ added in v0.7.16
type LoadMap ¶ added in v0.9.6
LoadMap is a mapping of status variable & threshold e.g. [Threads_connected: 100, Threads_running: 50]
func NewLoadMap ¶ added in v0.9.6
func NewLoadMap() LoadMap
func ParseLoadMap ¶ added in v0.9.6
NewLoadMap parses a `--*-load` flag (e.g. `--max-load`), which is in multiple key-value format, such as:
'Threads_running=100,Threads_connected=500'
type MigrationContext ¶
type MigrationContext struct {
DatabaseName string
OriginalTableName string
AlterStatement string
CountTableRows bool
AllowedRunningOnMaster bool
AllowedMasterMaster bool
SwitchToRowBinlogFormat bool
NullableUniqueKeyAllowed bool
ApproveRenamedColumns bool
SkipRenamedColumns bool
ConfigFile string
CliUser string
CliPassword string
ChunkSize int64
NiceRatio int64
MaxLagMillisecondsThrottleThreshold int64
ReplictionLagQuery string
ThrottleControlReplicaKeys *mysql.InstanceKeyMap
ThrottleFlagFile string
ThrottleAdditionalFlagFile string
ThrottleQuery string
ThrottleCommandedByUser int64
PostponeCutOverFlagFile string
CutOverLockTimeoutSeconds int64
PanicFlagFile string
ServeSocketFile string
ServeTCPPort int64
Noop bool
TestOnReplica bool
MigrateOnReplica bool
OkToDropTable bool
InitiallyDropOldTable bool
InitiallyDropGhostTable bool
CutOverType CutOver
TableEngine string
RowsEstimate int64
UsedRowsEstimateMethod RowsEstimateMethod
OriginalBinlogFormat string
OriginalBinlogRowImage string
InspectorConnectionConfig *mysql.ConnectionConfig
ApplierConnectionConfig *mysql.ConnectionConfig
StartTime time.Time
RowCopyStartTime time.Time
RowCopyEndTime time.Time
LockTablesStartTime time.Time
RenameTablesStartTime time.Time
RenameTablesEndTime time.Time
CurrentLag int64
TotalRowsCopied int64
TotalDMLEventsApplied int64
IsPostponingCutOver int64
OriginalTableColumns *sql.ColumnList
OriginalTableUniqueKeys [](*sql.UniqueKey)
GhostTableColumns *sql.ColumnList
GhostTableUniqueKeys [](*sql.UniqueKey)
UniqueKey *sql.UniqueKey
ColumnRenameMap map[string]string
MigrationRangeMinValues *sql.ColumnValues
MigrationRangeMaxValues *sql.ColumnValues
Iteration int64
MigrationIterationRangeMinValues *sql.ColumnValues
MigrationIterationRangeMaxValues *sql.ColumnValues
CanStopStreaming func() bool
// contains filtered or unexported fields
}
MigrationContext has the general, global state of migration. It is used by all components throughout the migration process.
func (*MigrationContext) ApplyCredentials ¶ added in v0.7.16
func (this *MigrationContext) ApplyCredentials()
ApplyCredentials sorts out the credentials between the config file and the CLI flags
func (*MigrationContext) ElapsedRowCopyTime ¶
func (this *MigrationContext) ElapsedRowCopyTime() time.Duration
ElapsedRowCopyTime returns time since starting to copy chunks of rows
func (*MigrationContext) ElapsedTime ¶
func (this *MigrationContext) ElapsedTime() time.Duration
ElapsedTime returns time since very beginning of the process
func (*MigrationContext) GetChangelogTableName ¶
func (this *MigrationContext) GetChangelogTableName() string
GetChangelogTableName generates the name of changelog table, based on original table name
func (*MigrationContext) GetCriticalLoad ¶ added in v0.9.6
func (this *MigrationContext) GetCriticalLoad() LoadMap
func (*MigrationContext) GetGhostTableName ¶
func (this *MigrationContext) GetGhostTableName() string
GetGhostTableName generates the name of ghost table, based on original table name
func (*MigrationContext) GetIteration ¶
func (this *MigrationContext) GetIteration() int64
func (*MigrationContext) GetMaxLoad ¶ added in v0.8.8
func (this *MigrationContext) GetMaxLoad() LoadMap
func (*MigrationContext) GetOldTableName ¶
func (this *MigrationContext) GetOldTableName() string
GetOldTableName generates the name of the "old" table, into which the original table is renamed.
func (*MigrationContext) GetThrottleControlReplicaKeys ¶ added in v0.9.6
func (this *MigrationContext) GetThrottleControlReplicaKeys() *mysql.InstanceKeyMap
func (*MigrationContext) GetThrottleQuery ¶ added in v0.9.6
func (this *MigrationContext) GetThrottleQuery() string
func (*MigrationContext) GetTotalRowsCopied ¶
func (this *MigrationContext) GetTotalRowsCopied() int64
GetTotalRowsCopied returns the accurate number of rows being copied (affected) This is not exactly the same as the rows being iterated via chunks, but potentially close enough
func (*MigrationContext) GetVoluntaryLockName ¶
func (this *MigrationContext) GetVoluntaryLockName() string
GetVoluntaryLockName returns a name of a voluntary lock to be used throughout the swap-tables process.
func (*MigrationContext) HasMigrationRange ¶
func (this *MigrationContext) HasMigrationRange() bool
HasMigrationRange tells us whether there's a range to iterate for copying rows. It will be `false` if the table is initially empty
func (*MigrationContext) InspectorIsAlsoApplier ¶
func (this *MigrationContext) InspectorIsAlsoApplier() bool
InspectorIsAlsoApplier is `true` when the both inspector and applier are the same database instance. This would be true when running directly on master or when testing on replica.
func (*MigrationContext) IsThrottled ¶
func (this *MigrationContext) IsThrottled() (bool, string)
func (*MigrationContext) IsTransactionalTable ¶
func (this *MigrationContext) IsTransactionalTable() bool
func (*MigrationContext) MarkPointOfInterest ¶ added in v0.8.2
func (this *MigrationContext) MarkPointOfInterest() int64
func (*MigrationContext) MarkRowCopyEndTime ¶ added in v0.9.6
func (this *MigrationContext) MarkRowCopyEndTime()
ElapsedRowCopyTime returns time since starting to copy chunks of rows
func (*MigrationContext) MaxRetries ¶
func (this *MigrationContext) MaxRetries() int64
func (*MigrationContext) ReadConfigFile ¶
func (this *MigrationContext) ReadConfigFile() error
ReadConfigFile attempts to read the config file, if it exists
func (*MigrationContext) ReadCriticalLoad ¶ added in v0.9.6
func (this *MigrationContext) ReadCriticalLoad(criticalLoadList string) error
ReadMaxLoad parses the `--max-load` flag, which is in multiple key-value format, such as: 'Threads_running=100,Threads_connected=500' It only applies changes in case there's no parsing error.
func (*MigrationContext) ReadMaxLoad ¶
func (this *MigrationContext) ReadMaxLoad(maxLoadList string) error
ReadMaxLoad parses the `--max-load` flag, which is in multiple key-value format, such as: 'Threads_running=100,Threads_connected=500' It only applies changes in case there's no parsing error.
func (*MigrationContext) ReadThrottleControlReplicaKeys ¶ added in v0.9.6
func (this *MigrationContext) ReadThrottleControlReplicaKeys(throttleControlReplicas string) error
func (*MigrationContext) RequiresBinlogFormatChange ¶
func (this *MigrationContext) RequiresBinlogFormatChange() bool
RequiresBinlogFormatChange is `true` when the original binlog format isn't `ROW`
func (*MigrationContext) SetChunkSize ¶ added in v0.8.4
func (this *MigrationContext) SetChunkSize(chunkSize int64)
func (*MigrationContext) SetCutOverLockTimeoutSeconds ¶ added in v1.0.1
func (this *MigrationContext) SetCutOverLockTimeoutSeconds(timeoutSeconds int64) error
func (*MigrationContext) SetDefaultNumRetries ¶ added in v0.9.6
func (this *MigrationContext) SetDefaultNumRetries(retries int64)
func (*MigrationContext) SetThrottleQuery ¶ added in v0.9.6
func (this *MigrationContext) SetThrottleQuery(newQuery string)
func (*MigrationContext) SetThrottled ¶
func (this *MigrationContext) SetThrottled(throttle bool, reason string)
func (*MigrationContext) TimeSincePointOfInterest ¶ added in v0.8.2
func (this *MigrationContext) TimeSincePointOfInterest() time.Duration
type RowsEstimateMethod ¶
type RowsEstimateMethod string
RowsEstimateMethod is the type of row number estimation