Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea/
.vscode
schrddl
.DS_Store
12 changes: 11 additions & 1 deletion ddl/datatype.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ var TestFieldType = []int{
KindTIMESTAMP,
KindYEAR,

//KindJSON, // have `admin check table when index is virtual generated column` bug unfixed.
KindJSON,
KindEnum,
KindSet,

Expand All @@ -155,6 +155,16 @@ func RandDataType() int {
return TestFieldType[i]
}

// RandDataTypeForJSONDeps returns a random data type that can be used in JSON dependencies.
// Currently, only integer is supported for JSON dependencies.
func RandDataTypeForJSONDeps() int {
var available = []int{
KindBigInt,
}
i := rand.Intn(len(available))
return available[i]
}

const (
BitMaxLen = 64
CharMaxLen = 256
Expand Down
12 changes: 6 additions & 6 deletions ddl/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,14 +321,14 @@ const (
)

type ddlTestOpExecutor struct {
executeFunc func(interface{}, chan *ddlJobTask) error
config interface{}
executeFunc func(any, chan *ddlJobTask) error
config any
ddlKind DDLKind
}

type dmlTestOpExecutor struct {
prepareFunc func(interface{}, chan *dmlJobTask) error
config interface{}
prepareFunc func(any, chan *dmlJobTask) error
config any
}

type DMLKind int
Expand Down Expand Up @@ -653,7 +653,7 @@ func (c *testCase) readDataFromTiDB() error {
// See https://stackoverflow.com/questions/14477941/read-select-columns-into-string-in-go
rawResult := make([][]byte, len(cols))
result := make([]string, len(cols))
dest := make([]interface{}, len(cols))
dest := make([]any, len(cols))
for i := range rawResult {
dest[i] = &rawResult[i]
}
Expand Down Expand Up @@ -706,7 +706,7 @@ func readData(ctx context.Context, conn *sql.Conn, query string) ([][]string, er
// See https://stackoverflow.com/questions/14477941/read-select-columns-into-string-in-go
rawResult := make([][]byte, len(cols))
result := make([]string, len(cols))
dest := make([]interface{}, len(cols))
dest := make([]any, len(cols))
for i := range rawResult {
dest[i] = &rawResult[i]
}
Expand Down
10 changes: 5 additions & 5 deletions ddl/ddl_multi_schema_change.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type multiSchemaChangeCtx struct {
arg *ddlMultiSchemaChangeJobArg
}

func checkAddDropColumn(ctx interface{}, col *ddlTestColumn) bool {
func checkAddDropColumn(ctx any, col *ddlTestColumn) bool {
if ctx == nil {
return true
}
Expand All @@ -50,7 +50,7 @@ func checkAddDropColumn(ctx interface{}, col *ddlTestColumn) bool {
return true
}

func checkModifyColumn(ctx interface{}, col *ddlTestColumn) bool {
func checkModifyColumn(ctx any, col *ddlTestColumn) bool {
if ctx == nil {
return true
}
Expand All @@ -65,7 +65,7 @@ func checkModifyColumn(ctx interface{}, col *ddlTestColumn) bool {
return true
}

func checkRelatedColumn(ctx interface{}, col *ddlTestColumn) bool {
func checkRelatedColumn(ctx any, col *ddlTestColumn) bool {
if ctx == nil {
return true
}
Expand All @@ -77,7 +77,7 @@ func checkRelatedColumn(ctx interface{}, col *ddlTestColumn) bool {
return true
}

func checkModifyIdx(ctx interface{}, idx *ddlTestIndex) bool {
func checkModifyIdx(ctx any, idx *ddlTestIndex) bool {
if ctx == nil {
return true
}
Expand Down Expand Up @@ -167,7 +167,7 @@ func (c *testCase) prepareSubJobs(ctx *multiSchemaChangeCtx, ddlKind DDLKind) er
return nil
}

func (c *testCase) prepareMultiSchemaChange(_ interface{}, taskCh chan *ddlJobTask) error {
func (c *testCase) prepareMultiSchemaChange(_ any, taskCh chan *ddlJobTask) error {
table := c.pickupRandomTable()
if table == nil {
return nil
Expand Down
Loading