Documentation ¶
Overview ¶
Package migration contains the logic for running online schema changes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrMismatchedAlter = errors.New("alter statement in checkpoint table does not match the alter statement specified here")
)
Functions ¶
This section is empty.
Types ¶
type CutOver ¶
type CutOver struct {
// contains filtered or unexported fields
}
func NewCutOver ¶
func NewCutOver(db *sql.DB, table, newTable *table.TableInfo, oldTableName string, feed *repl.Client, dbConfig *dbconn.DBConfig, logger loggers.Advanced) (*CutOver, error)
NewCutOver contains the logic to perform the final cut over. It requires the original table, new table, and a replication feed which is used to ensure consistency before the cut over.
type Migration ¶
type Migration struct { Host string `name:"host" help:"Hostname" optional:"" default:"127.0.0.1:3306"` Username string `name:"username" help:"User" optional:"" default:"msandbox"` Password string `name:"password" help:"Password" optional:"" default:"msandbox"` Database string `name:"database" help:"Database" optional:"" default:"test"` Table string `name:"table" help:"Table" optional:"" default:"stock"` Alter string `name:"alter" help:"The alter statement to run on the table" optional:"" default:"engine=innodb"` Threads int `name:"threads" help:"Number of concurrent threads for copy and checksum tasks" optional:"" default:"4"` TargetChunkTime time.Duration `name:"target-chunk-time" help:"The target copy time for each chunk" optional:"" default:"500ms"` ForceInplace bool `` /* 135-byte string literal not displayed */ Checksum bool `name:"checksum" help:"Checksum new table before final cut-over" optional:"" default:"true"` ReplicaDSN string `name:"replica-dsn" help:"A DSN for a replica which (if specified) will be used for lag checking." optional:""` ReplicaMaxLag time.Duration `` /* 127-byte string literal not displayed */ LockWaitTimeout time.Duration `name:"lock-wait-timeout" help:"The DDL lock_wait_timeout required for checksum and cutover" optional:"" default:"30s"` SkipDropAfterCutover bool `name:"skip-drop-after-cutover" help:"Keep old table after completing cutover" optional:"" default:"false"` DeferCutOver bool `name:"defer-cutover" help:"Defer cutover (and checksum) until sentinel table is dropped" optional:"" default:"false"` Strict bool `name:"strict" help:"Exit on --alter mismatch when incomplete migration is detected" optional:"" default:"false"` }
type Progress ¶
type Progress struct { CurrentState string // string of current state, i.e. copyRows Summary string // text based representation, i.e. "12.5% copyRows ETA 1h 30m" }
Progress is returned as a struct because we may add more to it later. It is designed for wrappers (like a GUI) to be able to summarize the current status without parsing log output.
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
func (*Runner) GetProgress ¶
func (*Runner) SetMetricsSink ¶
Click to show internal directories.
Click to hide internal directories.