Skip to content

Commit

Permalink
Merge branch 'master' into migrate_tidb_tools
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkingrei authored Mar 23, 2022
2 parents aa913f6 + 6d01855 commit 82a653b
Show file tree
Hide file tree
Showing 55 changed files with 3,412 additions and 4,554 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/br_compatible_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: 1.18

- name: Generate compatibility test backup data
timeout-minutes: 15
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/compile_br.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: 1.18

- name: Run build
run: make build_tools
Expand All @@ -73,7 +73,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: 1.18

- name: Run build
run: make build_tools
Expand All @@ -88,7 +88,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: 1.18

- name: Compile for FreeBSD
run: GOOS=freebsd make build_tools
12 changes: 6 additions & 6 deletions .github/workflows/dumpling_integration_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ jobs:
- uses: actions/checkout@v2
- name: Shutdown Ubuntu MySQL (SUDO)
run: sudo service mysql stop # Shutdown the Default MySQL, "sudo" is necessary, please not remove it
- name: Set up Go 1.16
- name: Set up Go 1.18
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: 1.18
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
Expand Down Expand Up @@ -87,10 +87,10 @@ jobs:
- uses: actions/checkout@v2
- name: Shutdown Ubuntu MySQL (SUDO)
run: sudo service mysql stop # Shutdown the Default MySQL, "sudo" is necessary, please not remove it
- name: Set up Go 1.16
- name: Set up Go 1.18
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: 1.18
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
Expand Down Expand Up @@ -124,10 +124,10 @@ jobs:
- uses: actions/checkout@v2
- name: Shutdown Ubuntu MySQL (SUDO)
run: sudo service mysql stop # Shutdown the Default MySQL, "sudo" is necessary, please not remove it
- name: Set up Go 1.16
- name: Set up Go 1.18
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: 1.18
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
Expand Down
8 changes: 8 additions & 0 deletions br/pkg/restore/split_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -567,12 +567,17 @@ func TestRegionConsistency(t *testing.T) {
}

type fakeRestorer struct {
mu sync.Mutex

errorInSplit bool
splitRanges []rtree.Range
restoredFiles []*backuppb.File
}

func (f *fakeRestorer) SplitRanges(ctx context.Context, ranges []rtree.Range, rewriteRules *restore.RewriteRules, updateCh glue.Progress, isRawKv bool) error {
f.mu.Lock()
defer f.mu.Unlock()

if ctx.Err() != nil {
return ctx.Err()
}
Expand All @@ -587,6 +592,9 @@ func (f *fakeRestorer) SplitRanges(ctx context.Context, ranges []rtree.Range, re
}

func (f *fakeRestorer) RestoreFiles(ctx context.Context, files []*backuppb.File, rewriteRules *restore.RewriteRules, updateCh glue.Progress) error {
f.mu.Lock()
defer f.mu.Unlock()

if ctx.Err() != nil {
return ctx.Err()
}
Expand Down
911 changes: 911 additions & 0 deletions ddl/cancel_ddl_test.go

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions ddl/column.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func createColumnInfo(tblInfo *model.TableInfo, colInfo *model.ColumnInfo, pos *

func checkAddColumn(t *meta.Meta, job *model.Job) (*model.TableInfo, *model.ColumnInfo, *model.ColumnInfo, *ast.ColumnPosition, int, error) {
schemaID := job.SchemaID
tblInfo, err := getTableInfoAndCancelFaultJob(t, job, schemaID)
tblInfo, err := GetTableInfoAndCancelFaultJob(t, job, schemaID)
if err != nil {
return nil, nil, nil, nil, 0, errors.Trace(err)
}
Expand Down Expand Up @@ -258,7 +258,7 @@ func onAddColumn(d *ddlCtx, t *meta.Meta, job *model.Job) (ver int64, err error)

func checkAddColumns(t *meta.Meta, job *model.Job) (*model.TableInfo, []*model.ColumnInfo, []*model.ColumnInfo, []*ast.ColumnPosition, []int, []bool, error) {
schemaID := job.SchemaID
tblInfo, err := getTableInfoAndCancelFaultJob(t, job, schemaID)
tblInfo, err := GetTableInfoAndCancelFaultJob(t, job, schemaID)
if err != nil {
return nil, nil, nil, nil, nil, nil, errors.Trace(err)
}
Expand Down Expand Up @@ -497,7 +497,7 @@ func onDropColumns(t *meta.Meta, job *model.Job) (ver int64, _ error) {

func checkDropColumns(t *meta.Meta, job *model.Job) (*model.TableInfo, []*model.ColumnInfo, int, []*model.IndexInfo, error) {
schemaID := job.SchemaID
tblInfo, err := getTableInfoAndCancelFaultJob(t, job, schemaID)
tblInfo, err := GetTableInfoAndCancelFaultJob(t, job, schemaID)
if err != nil {
return nil, nil, 0, nil, errors.Trace(err)
}
Expand Down Expand Up @@ -639,7 +639,7 @@ func onDropColumn(t *meta.Meta, job *model.Job) (ver int64, _ error) {

func checkDropColumn(t *meta.Meta, job *model.Job) (*model.TableInfo, *model.ColumnInfo, []*model.IndexInfo, error) {
schemaID := job.SchemaID
tblInfo, err := getTableInfoAndCancelFaultJob(t, job, schemaID)
tblInfo, err := GetTableInfoAndCancelFaultJob(t, job, schemaID)
if err != nil {
return nil, nil, nil, errors.Trace(err)
}
Expand Down Expand Up @@ -783,7 +783,7 @@ func getModifyColumnInfo(t *meta.Meta, job *model.Job) (*model.DBInfo, *model.Ta
return nil, nil, nil, jobParam, errors.Trace(err)
}

tblInfo, err := getTableInfoAndCancelFaultJob(t, job, job.SchemaID)
tblInfo, err := GetTableInfoAndCancelFaultJob(t, job, job.SchemaID)
if err != nil {
return nil, nil, nil, jobParam, errors.Trace(err)
}
Expand Down Expand Up @@ -1711,7 +1711,7 @@ func checkForNullValue(ctx context.Context, sctx sessionctx.Context, isDataTrunc
}

func updateColumnDefaultValue(t *meta.Meta, job *model.Job, newCol *model.ColumnInfo, oldColName *model.CIStr) (ver int64, _ error) {
tblInfo, err := getTableInfoAndCancelFaultJob(t, job, job.SchemaID)
tblInfo, err := GetTableInfoAndCancelFaultJob(t, job, job.SchemaID)
if err != nil {
return ver, errors.Trace(err)
}
Expand Down
8 changes: 4 additions & 4 deletions ddl/column_modify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ func TestCancelDropColumn(t *testing.T) {
if testCase.needAddColumn {
tk.MustExec("alter table test_drop_column add column c3 int")
tk.MustExec("alter table test_drop_column add index idx_c3(c3)")
c3IdxID = testGetIndexID(t, tk.Session(), "test", "test_drop_column", "idx_c3")
c3IdxID = external.GetIndexID(t, tk, "test", "test_drop_column", "idx_c3")
}

err := tk.ExecToErr("alter table test_drop_column drop column c3")
Expand Down Expand Up @@ -607,7 +607,7 @@ func TestCancelDropColumns(t *testing.T) {
if testCase.needAddColumn {
tk.MustExec("alter table test_drop_column add column c3 int, add column c4 int")
tk.MustExec("alter table test_drop_column add index idx_c3(c3)")
c3IdxID = testGetIndexID(t, tk.Session(), "test", "test_drop_column", "idx_c3")
c3IdxID = external.GetIndexID(t, tk, "test", "test_drop_column", "idx_c3")
}
err := tk.ExecToErr("alter table test_drop_column drop column c3, drop column c4")
tbl := external.GetTableByName(t, tk, "test", "test_drop_column")
Expand Down Expand Up @@ -885,15 +885,15 @@ func TestTransactionWithWriteOnlyColumn(t *testing.T) {
dom.DDL().SetHook(hook)
done := make(chan error, 1)
// test transaction on add column.
go backgroundExecT(store, "alter table t1 add column c int not null", done)
go backgroundExec(store, "alter table t1 add column c int not null", done)
err := <-done
require.NoError(t, err)
require.NoError(t, checkErr)
tk.MustQuery("select a from t1").Check(testkit.Rows("2"))
tk.MustExec("delete from t1")

// test transaction on drop column.
go backgroundExecT(store, "alter table t1 drop column c", done)
go backgroundExec(store, "alter table t1 drop column c", done)
err = <-done
require.NoError(t, err)
require.NoError(t, checkErr)
Expand Down
Loading

0 comments on commit 82a653b

Please sign in to comment.