Documentation ¶
Index ¶
- type Optimist
- func (o *Optimist) Close()
- func (o *Optimist) Locks() map[string]*optimism.Lock
- func (o *Optimist) RemoveMetaDataWithTask(task string) error
- func (o *Optimist) RemoveMetaDataWithTaskAndSources(task string, sources ...string) error
- func (o *Optimist) ShowLocks(task string, sources []string) ([]*pb.DDLLock, error)
- func (o *Optimist) Start(pCtx context.Context, etcdCli *clientv3.Client) error
- func (o *Optimist) UnlockLock(ctx context.Context, id, source, upstreamSchema, upstreamTable string, ...) error
- type PessimismInfoSlice
- type Pessimist
- func (p *Pessimist) Close()
- func (p *Pessimist) Locks() map[string]*pessimism.Lock
- func (p *Pessimist) RemoveMetaData(task string) error
- func (p *Pessimist) ShowLocks(task string, sources []string) []*pb.DDLLock
- func (p *Pessimist) Start(pCtx context.Context, etcdCli *clientv3.Client) error
- func (p *Pessimist) UnlockLock(ctx context.Context, id, replaceOwner string, forceRemove bool) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Optimist ¶
type Optimist struct {
// contains filtered or unexported fields
}
Optimist is used to coordinate the shard DDL migration in optimism mode.
func NewOptimist ¶
func NewOptimist(pLogger *log.Logger, getDownstreamMetaFunc func(string) (*dbconfig.DBConfig, string)) *Optimist
NewOptimist creates a new Optimist instance.
func (*Optimist) RemoveMetaDataWithTask ¶
RemoveMetaDataWithTask removes meta data for a specified task NOTE: this function can only be used when the specified task is not running. This function only be used when --remove-meta or stop-task NOTE: For stop-task, we still delete drop columns in etcd though user may restart the task again later.
func (*Optimist) RemoveMetaDataWithTaskAndSources ¶
RemoveMetaDataWithTaskAndSources removes meta data for a specified task and sources NOTE: this function can only be used when the specified task for source is not running.
func (*Optimist) Start ¶
Start starts the shard DDL coordination in optimism mode. NOTE: for logic errors, it should start without returning errors (but report via metrics or log) so that the user can fix them.
func (*Optimist) UnlockLock ¶
func (o *Optimist) UnlockLock(ctx context.Context, id, source, upstreamSchema, upstreamTable string, action pb.UnlockDDLLockOp) error
UnlockLock unlocks a shard DDL lock manually only when using `unlock-ddl-lock` command. ID: the shard DDL lock ID. source, upstreamSchema, upstreamTable: reveal the upstream table's info which we need to skip/exec action: whether to skip/exec the blocking DDLs for the specified upstream table NOTE: this function has side effects, if it failed, some status can't revert anymore. NOTE: this function should not be called if the lock is still in automatic resolving.
type PessimismInfoSlice ¶
PessimismInfoSlice attaches the methods of Interface to []pessimism.Info, sorting in increasing order according to `Source` field.
func (PessimismInfoSlice) Less ¶
func (p PessimismInfoSlice) Less(i, j int) bool
Less implements Sorter.Less.
func (PessimismInfoSlice) Swap ¶
func (p PessimismInfoSlice) Swap(i, j int)
Swap implements Sorter.Swap.
type Pessimist ¶
type Pessimist struct {
// contains filtered or unexported fields
}
Pessimist used to coordinate the shard DDL migration in pessimism mode.
func NewPessimist ¶
NewPessimist creates a new Pessimist instance.
func (*Pessimist) RemoveMetaData ¶
RemoveMetaData removes meta data for a specified task NOTE: this function can only be used when the specified task is not running.
func (*Pessimist) Start ¶
Start starts the shard DDL coordination in pessimism mode. NOTE: for logic errors, it should start without returning errors (but report via metrics or log) so that the user can fix them.
func (*Pessimist) UnlockLock ¶
func (p *Pessimist) UnlockLock(ctx context.Context, id, replaceOwner string, forceRemove bool) error
UnlockLock unlocks a shard DDL lock manually when using `unlock-ddl-lock` command. ID: the shard DDL lock ID. replaceOwner: the new owner used to replace the original DDL for executing DDL to downstream.
if the original owner is still exist, we should NOT specify any replaceOwner.
forceRemove: whether force to remove the DDL lock even fail to unlock it (for the owner).
if specified forceRemove and then fail to unlock, we may need to use `BreakLock` later.
NOTE: this function has side effects, if it failed, some status can't revert anymore. NOTE: this function should not be called if the lock is still in automatic resolving.