Documentation ¶
Overview ¶
Package utils contains some common utilities used by all other packages.
Index ¶
- Constants
- func AlgorithmInplaceConsideredSafe(sql string) error
- func AlterContainsAddUnique(sql string) error
- func AlterContainsIndexVisibility(sql string) error
- func AlterContainsUnsupportedClause(sql string) error
- func ErrInErr(_ error)
- func HashKey(key []interface{}) string
- func IntersectNonGeneratedColumns(t1, t2 *table.TableInfo) string
- func StripPort(hostname string) string
- func TrimAlter(alter string) string
- func UnhashKey(key string) string
Constants ¶
const (
PrimaryKeySeparator = "-#-" // used to hash a composite primary key
)
Variables ¶
This section is empty.
Functions ¶
func AlgorithmInplaceConsideredSafe ¶
AlgorithmInplaceConsideredSafe checks to see if all clauses of an ALTER statement are "safe". We consider an operation to be "safe" if it is "In Place" and "Only Modifies Metadata". See https://dev.mysql.com/doc/refman/8.0/en/innodb-online-ddl-operations.html for details. INPLACE DDL is not generally safe for online use in MySQL 8.0, because ADD INDEX can block replicas.
func AlterContainsAddUnique ¶
AlterContainsAddUnique checks to see if any clauses of an ALTER contains add UNIQUE index. We use this to customize the error returned from checksum fails.
func AlterContainsIndexVisibility ¶
AlterContainsIndexVisibility checks to see if there are any clauses of an ALTER to change index visibility. It really does not make sense for visibility changes to be anything except metadata only changes, because they are used for experiments. An experiment is not rebuilding the table. If you are experimenting setting an index to invisible and plan to switch it back to visible quickly if required, going through a full table rebuild does not make sense.
func AlterContainsUnsupportedClause ¶
AlterContainsUnsupportedClause checks to see if any clauses of an ALTER statement are unsupported by Spirit. These include clauses like ALGORITHM and LOCK, because they step on the toes of Spirit's own locking and algorithm selection.
func ErrInErr ¶
func ErrInErr(_ error)
ErrInErr is a wrapper func to not nest too deeply in an error being handled inside of an already error path. Not catching the error makes linters unhappy, but because it's already in an error path, there's not much to do.
func HashKey ¶
func HashKey(key []interface{}) string
HashKey is used to convert a composite key into a string so that it can be placed in a map.
func IntersectNonGeneratedColumns ¶
IntersectNonGeneratedColumns returns a string of columns that are in both tables
Types ¶
This section is empty.