phase2

package
v0.0.0-...-b09f6e5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2026 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanUseOnlineDDL

func CanUseOnlineDDL(sql string) bool

CanUseOnlineDDL checks if the SQL statement can use Online DDL This is a simplified check - MySQL/MariaDB would actually validate this

func ExtractAlterStatement

func ExtractAlterStatement(sql string) string

ExtractAlterStatement extracts the ALTER statement part from SQL

Types

type BackupMethod

type BackupMethod string

BackupMethod represents the type of backup to perform

const (
	BackupNone       BackupMethod = "none"
	BackupMysqldump  BackupMethod = "mysqldump"
	BackupXtrabackup BackupMethod = "xtrabackup"
)

type ExecuteOptions

type ExecuteOptions struct {
	TaskID         int
	StatementIndex int
	SQL            string
	TableName      string
	Target         *TableInfo
	BackupMethod   BackupMethod
	OkPTOSC        bool
	OkOnlineDDL    bool
	Config         *config.Config // Configuration with paths and directories
	Debug          bool           // Enable debug output (print commands and outputs)
}

ExecuteOptions contains options for schema change execution

type ExecuteResult

type ExecuteResult struct {
	BackupPerformed bool
	BackupPath      string
	ChangeExecuted  bool
	MethodUsed      string
	Warnings        []string
	Errors          []string
}

ExecuteResult represents the result of Phase 2 execution

type Executor

type Executor struct {
	// contains filtered or unexported fields
}

func NewExecutor

func NewExecutor(conn *sql.DB, logger Logger) *Executor

NewExecutor creates a new executor instance

func (*Executor) Execute

func (e *Executor) Execute(options ExecuteOptions) (*ExecuteResult, error)

Execute performs Phase 2 schema change execution

type Logger

type Logger interface {
	Infof(format string, v ...interface{})
	Errorf(format string, v ...interface{})
}

type TableInfo

type TableInfo struct {
	Database string
	Table    string
}

TableInfo represents table information

func ParseTableName

func ParseTableName(tableName string, getCurrentDB func() (string, error)) (TableInfo, error)

ParseTableName parses a table name that may include database name

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL