Documentation ¶
Index ¶
- type GhostDDLInfo
- type OnlinePlugin
- type RealOnlinePlugin
- func (r *RealOnlinePlugin) Apply(tctx *tcontext.Context, tables []*filter.Table, statement string, ...) ([]string, error)
- func (r *RealOnlinePlugin) CheckAndUpdate(tctx *tcontext.Context, schemas map[string]string, ...) error
- func (r *RealOnlinePlugin) CheckRegex(stmt ast.StmtNode, schema string, flavor conn.LowerCaseTableNamesFlavor) error
- func (r *RealOnlinePlugin) Clear(tctx *tcontext.Context) error
- func (r *RealOnlinePlugin) Close()
- func (r *RealOnlinePlugin) Finish(tctx *tcontext.Context, table *filter.Table) error
- func (r *RealOnlinePlugin) RealName(table string) string
- func (r *RealOnlinePlugin) ResetConn(tctx *tcontext.Context) error
- func (r *RealOnlinePlugin) TableType(table string) TableType
- type Storage
- func (s *Storage) CheckAndUpdate(tctx *tcontext.Context, schemaMap map[string]string, ...) error
- func (s *Storage) Clear(tctx *tcontext.Context) error
- func (s *Storage) Close()
- func (s *Storage) Delete(tctx *tcontext.Context, ghostSchema, ghostTable string) error
- func (s *Storage) Get(ghostSchema, ghostTable string) *GhostDDLInfo
- func (s *Storage) Init(tctx *tcontext.Context) error
- func (s *Storage) Load(tctx *tcontext.Context) error
- func (s *Storage) ResetConn(tctx *tcontext.Context) error
- func (s *Storage) Save(tctx *tcontext.Context, ...) error
- type TableType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GhostDDLInfo ¶
type GhostDDLInfo struct { Schema string `json:"schema"` Table string `json:"table"` DDLs []string `json:"ddls"` }
GhostDDLInfo stores ghost information and ddls.
type OnlinePlugin ¶
type OnlinePlugin interface { // Apply does: // * detect online ddl // * record changes // * apply online ddl on real table // returns sqls, error Apply(tctx *tcontext.Context, tables []*filter.Table, statement string, stmt ast.StmtNode, p *parser.Parser) ([]string, error) // Finish would delete online ddl from memory and storage Finish(tctx *tcontext.Context, table *filter.Table) error // TableType returns ghost/real table TableType(table string) TableType // RealName returns real table name that removed ghost suffix and handled by table router RealName(table string) string // ResetConn reset db connection ResetConn(tctx *tcontext.Context) error // Clear clears all online information // TODO: not used now, check if we could remove it later Clear(tctx *tcontext.Context) error // Close closes online ddl plugin Close() // CheckAndUpdate try to check and fix the schema/table case-sensitive issue CheckAndUpdate(tctx *tcontext.Context, schemas map[string]string, tables map[string]map[string]string) error // CheckRegex checks the regex of shadow/trash table rules and reports an error if a ddl event matches only either of the rules CheckRegex(stmt ast.StmtNode, schema string, flavor conn.LowerCaseTableNamesFlavor) error }
OnlinePlugin handles online ddl solutions like pt, gh-ost.
func NewRealOnlinePlugin ¶
func NewRealOnlinePlugin( tctx *tcontext.Context, cfg *config.SubTaskConfig, metricProxies *metrics.Proxies, ) (OnlinePlugin, error)
NewRealOnlinePlugin returns real online plugin.
type RealOnlinePlugin ¶
type RealOnlinePlugin struct {
// contains filtered or unexported fields
}
RealOnlinePlugin support ghost and pt Ghost's table format: _*_gho ghost table _*_ghc ghost changelog table _*_del ghost transh table. PT's table format: (_*).*_new ghost table (_*).*_old ghost trash table we don't support `--new-table-name` flag.
func (*RealOnlinePlugin) Apply ¶
func (r *RealOnlinePlugin) Apply(tctx *tcontext.Context, tables []*filter.Table, statement string, stmt ast.StmtNode, p *parser.Parser) ([]string, error)
Apply implements interface. returns ddls, error.
func (*RealOnlinePlugin) CheckAndUpdate ¶
func (r *RealOnlinePlugin) CheckAndUpdate(tctx *tcontext.Context, schemas map[string]string, tables map[string]map[string]string) error
CheckAndUpdate try to check and fix the schema/table case-sensitive issue.
func (*RealOnlinePlugin) CheckRegex ¶
func (r *RealOnlinePlugin) CheckRegex(stmt ast.StmtNode, schema string, flavor conn.LowerCaseTableNamesFlavor) error
CheckRegex checks the regex of shadow/trash table rules and reports an error if a ddl event matches only either of the rules.
func (*RealOnlinePlugin) Clear ¶
func (r *RealOnlinePlugin) Clear(tctx *tcontext.Context) error
Clear clears online ddl information.
func (*RealOnlinePlugin) RealName ¶
func (r *RealOnlinePlugin) RealName(table string) string
RealName implements interface.
func (*RealOnlinePlugin) ResetConn ¶
func (r *RealOnlinePlugin) ResetConn(tctx *tcontext.Context) error
ResetConn implements interface.
func (*RealOnlinePlugin) TableType ¶
func (r *RealOnlinePlugin) TableType(table string) TableType
TableType implements interface.
type Storage ¶
Storage stores sharding group online ddls information.
func NewOnlineDDLStorage ¶
func NewOnlineDDLStorage( logCtx *tcontext.Context, cfg *config.SubTaskConfig, metricProxies *metrics.Proxies, ) *Storage
NewOnlineDDLStorage creates a new online ddl storager.
func (*Storage) CheckAndUpdate ¶
func (s *Storage) CheckAndUpdate( tctx *tcontext.Context, schemaMap map[string]string, tablesMap map[string]map[string]string, realNameFn func(table string) string, ) error
CheckAndUpdate try to check and fix the schema/table case-sensitive issue.
func (*Storage) Get ¶
func (s *Storage) Get(ghostSchema, ghostTable string) *GhostDDLInfo
Get returns ddls by given schema/table.