Documentation ¶
Index ¶
- Variables
- func GhostBinaryFileName() (fileName string, isOverride bool)
- func PTOSCFileName() (fileName string, isOverride bool)
- func RandomHash() string
- func ReadableTimestamp() string
- func ToReadableTimestamp(t time.Time) string
- type ConstraintType
- type Executor
- func (e *Executor) CancelMigration(ctx context.Context, uuid string, message string, issuedByUser bool) (result *sqltypes.Result, err error)
- func (e *Executor) CancelPendingMigrations(ctx context.Context, message string, issuedByUser bool) (result *sqltypes.Result, err error)
- func (e *Executor) CleanupMigration(ctx context.Context, uuid string) (result *sqltypes.Result, err error)
- func (e *Executor) Close()
- func (e *Executor) CompleteMigration(ctx context.Context, uuid string) (result *sqltypes.Result, err error)
- func (e *Executor) CompletePendingMigrations(ctx context.Context) (result *sqltypes.Result, err error)
- func (e *Executor) ExecuteWithGhost(ctx context.Context, onlineDDL *schema.OnlineDDL) error
- func (e *Executor) ExecuteWithPTOSC(ctx context.Context, onlineDDL *schema.OnlineDDL) error
- func (e *Executor) ExecuteWithVReplication(ctx context.Context, onlineDDL *schema.OnlineDDL, ...) error
- func (e *Executor) InitDBConfig(keyspace, shard, dbName string)
- func (e *Executor) LaunchMigration(ctx context.Context, uuid string, shardsArg string) (result *sqltypes.Result, err error)
- func (e *Executor) LaunchMigrations(ctx context.Context) (result *sqltypes.Result, err error)
- func (e *Executor) OnSchemaMigrationStatus(ctx context.Context, ...) (err error)
- func (e *Executor) Open() error
- func (e *Executor) RetryMigration(ctx context.Context, uuid string) (result *sqltypes.Result, err error)
- func (e *Executor) ShowMigrationLogs(ctx context.Context, stmt *sqlparser.ShowMigrationLogs) (result *sqltypes.Result, err error)
- func (e *Executor) ShowMigrations(ctx context.Context, show *sqlparser.Show) (result *sqltypes.Result, err error)
- func (e *Executor) SubmitMigration(ctx context.Context, stmt sqlparser.Statement) (*sqltypes.Result, error)
- func (e *Executor) TabletAliasString() string
- func (e *Executor) ThrottleAllMigrations(ctx context.Context, expireString string, ratioLiteral *sqlparser.Literal) (result *sqltypes.Result, err error)
- func (e *Executor) ThrottleMigration(ctx context.Context, uuid string, expireString string, ...) (result *sqltypes.Result, err error)
- func (e *Executor) UnthrottleAllMigrations(ctx context.Context) (result *sqltypes.Result, err error)
- func (e *Executor) UnthrottleMigration(ctx context.Context, uuid string) (result *sqltypes.Result, err error)
- type SpecialAlterPlan
- type VRepl
- type VReplStream
Constants ¶
This section is empty.
Variables ¶
var ( // ErrExecutorNotWritableTablet is generated when executor is asked to run gh-ost on a read-only server ErrExecutorNotWritableTablet = errors.New("cannot run migration on non-writable tablet") // ErrExecutorMigrationAlreadyRunning is generated when an attempt is made to run an operation that conflicts with a running migration ErrExecutorMigrationAlreadyRunning = errors.New("cannot run migration since a migration is already running") // ErrMigrationNotFound is returned by readMigration when given UUI cannot be found ErrMigrationNotFound = errors.New("migration not found") )
Functions ¶
func GhostBinaryFileName ¶
GhostBinaryFileName returns the full path+name of the gh-ost binary
func PTOSCFileName ¶
PTOSCFileName returns the full path+name of the pt-online-schema-change binary Note that vttablet does not include pt-online-schema-change
func ReadableTimestamp ¶
func ReadableTimestamp() string
ReadableTimestamp returns a timestamp, in seconds resolution, that is human readable (as opposed to unix timestamp which is just a number), and which corresponds to the time now. Example: for Aug 25 2020, 16:04:25 we return "20200825160425"
func ToReadableTimestamp ¶
ToReadableTimestamp returns a timestamp, in seconds resolution, that is human readable (as opposed to unix timestamp which is just a number) Example: for Aug 25 2020, 16:04:25 we return "20200825160425"
Types ¶
type ConstraintType ¶ added in v0.16.0
type ConstraintType int
const ( UnknownConstraintType ConstraintType = iota CheckConstraintType ForeignKeyConstraintType )
func GetConstraintType ¶ added in v0.16.0
func GetConstraintType(constraintInfo sqlparser.ConstraintInfo) ConstraintType
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
Executor wraps and manages the execution of a gh-ost migration.
func NewExecutor ¶
func NewExecutor(env tabletenv.Env, tabletAlias *topodatapb.TabletAlias, ts *topo.Server, lagThrottler *throttle.Throttler, tabletTypeFunc func() topodatapb.TabletType, toggleBufferTableFunc func(cancelCtx context.Context, tableName string, timeout time.Duration, bufferQueries bool), ) *Executor
NewExecutor creates a new gh-ost executor.
func (*Executor) CancelMigration ¶ added in v0.10.0
func (e *Executor) CancelMigration(ctx context.Context, uuid string, message string, issuedByUser bool) (result *sqltypes.Result, err error)
CancelMigration attempts to abort a scheduled or a running migration
func (*Executor) CancelPendingMigrations ¶ added in v0.10.0
func (e *Executor) CancelPendingMigrations(ctx context.Context, message string, issuedByUser bool) (result *sqltypes.Result, err error)
CancelPendingMigrations cancels all pending migrations (that are expected to run or are running) for this keyspace
func (*Executor) CleanupMigration ¶ added in v0.13.0
func (e *Executor) CleanupMigration(ctx context.Context, uuid string) (result *sqltypes.Result, err error)
CleanupMigration sets migration is ready for artifact cleanup. Artifacts are not immediately deleted: all we do is set retain_artifacts_seconds to a very small number (it's actually a negative) so that the next iteration of gcArtifacts() picks up the migration's artifacts and schedules them for deletion
func (*Executor) CompleteMigration ¶ added in v0.13.0
func (e *Executor) CompleteMigration(ctx context.Context, uuid string) (result *sqltypes.Result, err error)
CompleteMigration clears the postpone_completion flag for a given migration, assuming it was set in the first place
func (*Executor) CompletePendingMigrations ¶ added in v0.15.0
func (e *Executor) CompletePendingMigrations(ctx context.Context) (result *sqltypes.Result, err error)
CompletePendingMigrations completes all pending migrations (that are expected to run or are running) for this keyspace
func (*Executor) ExecuteWithGhost ¶
ExecuteWithGhost validates and runs a gh-ost process. Validation included testing the backend MySQL server and the gh-ost binary itself Execution runs first a dry run, then an actual migration
func (*Executor) ExecuteWithPTOSC ¶
ExecuteWithPTOSC validates and runs a pt-online-schema-change process. Validation included testing the backend MySQL server and the pt-online-schema-change binary itself Execution runs first a dry run, then an actual migration
func (*Executor) ExecuteWithVReplication ¶ added in v0.10.0
func (e *Executor) ExecuteWithVReplication(ctx context.Context, onlineDDL *schema.OnlineDDL, revertMigration *schema.OnlineDDL) error
ExecuteWithVReplication sets up the grounds for a vreplication schema migration
func (*Executor) InitDBConfig ¶
InitDBConfig initializes keyspace
func (*Executor) LaunchMigration ¶ added in v0.15.0
func (e *Executor) LaunchMigration(ctx context.Context, uuid string, shardsArg string) (result *sqltypes.Result, err error)
LaunchMigration clears the postpone_launch flag for a given migration, assuming it was set in the first place
func (*Executor) LaunchMigrations ¶ added in v0.15.0
LaunchMigrations launches all launch-postponed queued migrations for this keyspace
func (*Executor) OnSchemaMigrationStatus ¶
func (e *Executor) OnSchemaMigrationStatus(ctx context.Context, uuidParam, statusParam, dryrunParam, progressParam, etaParam, rowsCopiedParam, hint string) (err error)
OnSchemaMigrationStatus is called by TabletServer's API, which is invoked by a running gh-ost migration's hooks.
func (*Executor) RetryMigration ¶ added in v0.10.0
func (e *Executor) RetryMigration(ctx context.Context, uuid string) (result *sqltypes.Result, err error)
RetryMigration marks given migration for retry
func (*Executor) ShowMigrationLogs ¶ added in v0.11.0
func (e *Executor) ShowMigrationLogs(ctx context.Context, stmt *sqlparser.ShowMigrationLogs) (result *sqltypes.Result, err error)
ShowMigrationLogs reads the migration log for a given migration
func (*Executor) ShowMigrations ¶ added in v0.17.0
func (e *Executor) ShowMigrations(ctx context.Context, show *sqlparser.Show) (result *sqltypes.Result, err error)
ShowMigrations shows migrations, optionally filtered by a condition
func (*Executor) SubmitMigration ¶ added in v0.11.0
func (e *Executor) SubmitMigration( ctx context.Context, stmt sqlparser.Statement, ) (*sqltypes.Result, error)
SubmitMigration inserts a new migration request
func (*Executor) TabletAliasString ¶ added in v0.9.0
TabletAliasString returns tablet alias as string (duh)
func (*Executor) ThrottleAllMigrations ¶ added in v0.14.0
func (e *Executor) ThrottleAllMigrations(ctx context.Context, expireString string, ratioLiteral *sqlparser.Literal) (result *sqltypes.Result, err error)
ThrottleAllMigrations
func (*Executor) ThrottleMigration ¶ added in v0.14.0
func (e *Executor) ThrottleMigration(ctx context.Context, uuid string, expireString string, ratioLiteral *sqlparser.Literal) (result *sqltypes.Result, err error)
ThrottleMigration
type SpecialAlterPlan ¶ added in v0.14.0
type SpecialAlterPlan struct {
// contains filtered or unexported fields
}
func AnalyzeInstantDDL ¶ added in v0.14.0
func AnalyzeInstantDDL(alterTable *sqlparser.AlterTable, createTable *sqlparser.CreateTable, capableOf mysql.CapableOf) (*SpecialAlterPlan, error)
AnalyzeInstantDDL takes declarative CreateTable and AlterTable, as well as a server version, and checks whether it is possible to run the ALTER using ALGORITM=INSTANT for that version. This function is INTENTIONALLY public, even though we do not guarantee that it will remain so.
func NewSpecialAlterOperation ¶ added in v0.14.0
func NewSpecialAlterOperation(operation specialAlterOperation, alterTable *sqlparser.AlterTable, createTable *sqlparser.CreateTable) *SpecialAlterPlan
func (*SpecialAlterPlan) Detail ¶ added in v0.14.0
func (p *SpecialAlterPlan) Detail(key string) string
func (*SpecialAlterPlan) SetDetail ¶ added in v0.14.0
func (p *SpecialAlterPlan) SetDetail(key string, val string) *SpecialAlterPlan
func (*SpecialAlterPlan) String ¶ added in v0.14.0
func (p *SpecialAlterPlan) String() string
type VRepl ¶ added in v0.10.0
type VRepl struct {
// contains filtered or unexported fields
}
VRepl is an online DDL helper for VReplication based migrations (ddl_strategy="online")
type VReplStream ¶ added in v0.10.0
type VReplStream struct {
// contains filtered or unexported fields
}
VReplStream represents a row in _vt.vreplication table