Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
94c9f63
chore(deps): Upgrade TiDB dependencies and adapt to API changes
tenfyzhong Sep 2, 2025
3161fa2
chore(deps): Clean up go.sum
tenfyzhong Sep 2, 2025
e4bc97e
Update pkg/upstream/topo.go
tenfyzhong Sep 2, 2025
aef3883
feat(parser): Update DDL `IF NOT EXISTS` parsing expectation
tenfyzhong Sep 4, 2025
9948b95
test(parser): Update expected SQL output for `IF NOT EXISTS` clause
tenfyzhong Sep 4, 2025
5c99110
test(parser): Adjust expected output for ALTER TABLE ADD INDEX IF NOT…
tenfyzhong Sep 4, 2025
cae9b43
test(dm): Adjust expected SQL output in test case
tenfyzhong Sep 5, 2025
ed34d3d
test(dm): Update expected output for FOREIGN KEY IF NOT EXISTS
tenfyzhong Sep 5, 2025
5444ba2
test(dm): update expected output for IF EXISTS/NOT EXISTS clauses
tenfyzhong Sep 5, 2025
04e2c8b
refactor(cdc/entry): move SetSchemaLease to vardef package
tenfyzhong Sep 5, 2025
27101b0
refactor(filter): Update system schema name references in tests
tenfyzhong Sep 5, 2025
ae8ec04
refactor(filter): Use `filter.InspectionSchemaName` constant
tenfyzhong Sep 5, 2025
487406f
refactor(pkg/filter): Rename filter import alias
tenfyzhong Sep 5, 2025
1db5989
build(ci): Increase golangci-lint timeout for static checks
tenfyzhong Sep 5, 2025
40a5308
chore(build): Increase golangci-lint timeout for DM module
tenfyzhong Sep 5, 2025
c3927dd
build(golangci-lint): Increase golangci-lint timeout
tenfyzhong Sep 5, 2025
d34e2fe
build(lint): Add concurrency to golangci-lint runs
tenfyzhong Sep 5, 2025
9a3b0e4
build(Makefile): Remove check-static from 'check' target
tenfyzhong Sep 5, 2025
a62a5f7
fix(cloudstorage): Correct schema file object prefix for WalkDir
tenfyzhong Sep 5, 2025
3b3de77
fix(filter): Convert schema name to lowercase in isSysSchema
tenfyzhong Sep 5, 2025
3c35de9
test(ddl-sink): Fix DDL special comment test expectation
tenfyzhong Sep 7, 2025
21b58a5
test(logutil): Update error stack regex in TestShortError
tenfyzhong Sep 7, 2025
150838a
test(cdc/entry): Update expected TableID in schema test
tenfyzhong Sep 7, 2025
ee6f202
fix(cdc/entry): Update expected TableID in schema test
tenfyzhong Sep 7, 2025
d31ce9e
fix(filter): Handle system schema names case-insensitively
tenfyzhong Sep 8, 2025
7262943
build(Makefile): Include static analysis in main check target
tenfyzhong Sep 8, 2025
1fb5f29
build(ci): Increase golangci-lint timeout and remove explicit concurr…
tenfyzhong Sep 8, 2025
453d782
build(lint): Upgrade golangci-lint and optimize static checks
tenfyzhong Sep 9, 2025
792cd7c
chore(deps): Update go.sum for golang.org/x/term
tenfyzhong Sep 9, 2025
af808fe
build(lint): Measure golangci-lint execution time
tenfyzhong Sep 9, 2025
3219244
build(golangci-lint): Print golangci-lint version during static checks
tenfyzhong Sep 9, 2025
b0e9f52
ci(workflow): Fetch full git history in build workflow
tenfyzhong Sep 9, 2025
1e126e6
build(lint): Increase golangci-lint timeout
tenfyzhong Sep 9, 2025
5da8aed
build(makefile): Add verbose output to golangci-lint commands
tenfyzhong Sep 9, 2025
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
2 changes: 2 additions & 0 deletions .github/workflows/check_and_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ jobs:
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Go environment
uses: actions/setup-go@v3
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,9 @@ tidy:

# TODO: Unified cdc and dm config.
check-static: tools/bin/golangci-lint
tools/bin/golangci-lint run --timeout 10m0s --exclude-dirs "^dm/","^tests/"
cd dm && ../tools/bin/golangci-lint run --timeout 10m0s
tools/bin/golangci-lint version
time tools/bin/golangci-lint run --new-from-merge-base master --timeout 120m0s -v --exclude-dirs "^dm/","^tests/"
cd dm && time ../tools/bin/golangci-lint run --new-from-merge-base master --timeout 120m0s -v

check: check-copyright generate_mock go-generate fmt check-static tidy terror_check errdoc \
check-merge-conflicts check-ticdc-dashboard check-diff-line-width check-makefiles \
Expand Down
3 changes: 2 additions & 1 deletion cdc/entry/mounter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
"github.com/pingcap/tidb/pkg/parser/ast"
"github.com/pingcap/tidb/pkg/parser/mysql"
"github.com/pingcap/tidb/pkg/session"
"github.com/pingcap/tidb/pkg/sessionctx/vardef"
"github.com/pingcap/tidb/pkg/store/mockstore"
"github.com/pingcap/tidb/pkg/testkit"
"github.com/pingcap/tidb/pkg/types"
Expand Down Expand Up @@ -270,7 +271,7 @@ func testMounterDisableOldValue(t *testing.T, tc struct {
ticonfig.UpdateGlobal(func(conf *ticonfig.Config) {
// we can update the tidb config here
})
session.SetSchemaLease(time.Second)
vardef.SetSchemaLease(time.Second)
session.DisableStats4Test()
domain, err := session.BootstrapSession(store)
require.Nil(t, err)
Expand Down
9 changes: 5 additions & 4 deletions cdc/entry/schema_storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"github.com/pingcap/tidb/pkg/parser/mysql"
"github.com/pingcap/tidb/pkg/session"
"github.com/pingcap/tidb/pkg/sessionctx"
"github.com/pingcap/tidb/pkg/sessionctx/vardef"
"github.com/pingcap/tidb/pkg/store/mockstore"
"github.com/pingcap/tidb/pkg/testkit"
"github.com/pingcap/tidb/pkg/types"
Expand Down Expand Up @@ -677,7 +678,7 @@ func TestCreateSnapFromMeta(t *testing.T) {
require.Nil(t, err)
defer store.Close() //nolint:errcheck

session.SetSchemaLease(time.Second)
vardef.SetSchemaLease(time.Second)
session.DisableStats4Test()
domain, err := session.BootstrapSession(store)
require.Nil(t, err)
Expand Down Expand Up @@ -712,7 +713,7 @@ func TestExplicitTables(t *testing.T) {
require.Nil(t, err)
defer store.Close() //nolint:errcheck

session.SetSchemaLease(time.Second)
vardef.SetSchemaLease(time.Second)
session.DisableStats4Test()
domain, err := session.BootstrapSession(store)
require.Nil(t, err)
Expand Down Expand Up @@ -863,7 +864,7 @@ func TestSchemaStorage(t *testing.T) {
ticonfig.UpdateGlobal(func(conf *ticonfig.Config) {
conf.AlterPrimaryKey = true
})
session.SetSchemaLease(time.Second)
vardef.SetSchemaLease(time.Second)
session.DisableStats4Test()
domain, err := session.BootstrapSession(store)
require.Nil(t, err)
Expand Down Expand Up @@ -956,7 +957,7 @@ func TestHandleKey(t *testing.T) {
require.Nil(t, err)
defer store.Close() //nolint:errcheck

session.SetSchemaLease(time.Second)
vardef.SetSchemaLease(time.Second)
session.DisableStats4Test()
domain, err := session.BootstrapSession(store)
require.Nil(t, err)
Expand Down
6 changes: 4 additions & 2 deletions cdc/entry/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,11 @@ func TestAllTables(t *testing.T) {
require.Nil(t, err)
require.Len(t, tableInfos, 2)
tableName := tableInfos[1].TableName
// BUG tenfyzhong 2025-09-07 18:28:26 Unittest failed 114->116
require.Equal(t, model.TableName{
Schema: "test",
Table: "t1",
TableID: 114,
TableID: 116,
}, tableName)
// add ineligible table
job = helper.DDL2Job("create table test.t2(id int)")
Expand All @@ -147,10 +148,11 @@ func TestAllTables(t *testing.T) {
require.Nil(t, err)
require.Len(t, tableInfos, 2)
tableName = tableInfos[1].TableName
// BUG tenfyzhong 2025-09-07 18:28:26 Unittest failed 114->116
require.Equal(t, model.TableName{
Schema: "test",
Table: "t1",
TableID: 114,
TableID: 116,
}, tableName)
}

Expand Down
3 changes: 2 additions & 1 deletion cdc/entry/schema_test_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
timodel "github.com/pingcap/tidb/pkg/meta/model"
pmodel "github.com/pingcap/tidb/pkg/parser/ast"
"github.com/pingcap/tidb/pkg/session"
"github.com/pingcap/tidb/pkg/sessionctx/vardef"
"github.com/pingcap/tidb/pkg/store/mockstore"
"github.com/pingcap/tidb/pkg/testkit"
"github.com/pingcap/tiflow/cdc/model"
Expand Down Expand Up @@ -62,7 +63,7 @@ func NewSchemaTestHelperWithReplicaConfig(
ticonfig.UpdateGlobal(func(conf *ticonfig.Config) {
conf.AlterPrimaryKey = true
})
session.SetSchemaLease(time.Second)
vardef.SetSchemaLease(time.Second)
session.DisableStats4Test()
domain, err := session.BootstrapSession(store)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion cdc/owner/ddl_sink_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ func TestAddSpecialComment(t *testing.T) {
event: &model.DDLEvent{
Query: "alter table t force auto_increment = 12;",
},
result: "ALTER TABLE `t` /*T![force_inc] FORCE */ AUTO_INCREMENT = 12",
result: "ALTER TABLE `t` /*T![force_inc] FORCE */AUTO_INCREMENT = 12",
},
{
event: &model.DDLEvent{
Expand Down
2 changes: 1 addition & 1 deletion dm/pkg/conn/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ func FetchAllDoTables(ctx context.Context, db *BaseDB, bw *filter.Filter) (map[s

ftSchemas := make([]*filter.Table, 0, len(schemas))
for _, schema := range schemas {
if filter.IsSystemSchema(schema) {
if filter.IsSystemSchema(strings.ToLower(schema)) {
continue
}
ftSchemas = append(ftSchemas, &filter.Table{
Expand Down
3 changes: 2 additions & 1 deletion dm/pkg/conn/mockdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"github.com/pingcap/tidb/pkg/kv"
"github.com/pingcap/tidb/pkg/server"
"github.com/pingcap/tidb/pkg/session"
"github.com/pingcap/tidb/pkg/sessionctx/vardef"
"github.com/pingcap/tidb/pkg/store/mockstore"
"github.com/tikv/client-go/v2/testutils"
)
Expand Down Expand Up @@ -147,7 +148,7 @@ func NewCluster() (*Cluster, error) {
}
cluster.Storage = storage

session.SetSchemaLease(time.Second)
vardef.SetSchemaLease(time.Second)
session.DisableStats4Test()
dom, err := session.BootstrapSession(storage)
if err != nil {
Expand Down
40 changes: 20 additions & 20 deletions dm/pkg/parser/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,66 +216,66 @@ var testCases = []testCase{
},
{
"alter table `t1` add column if not exists c1 int",
[]string{"ALTER TABLE `test`.`t1` ADD COLUMN IF NOT EXISTS `c1` INT"},
[]string{"ALTER TABLE `test`.`t1` ADD COLUMN /*T! IF NOT EXISTS */`c1` INT"},
[][]*filter.Table{{genTableName("test", "t1")}},
[][]*filter.Table{{genTableName("xtest", "xt1")}},
[]string{"ALTER TABLE `xtest`.`xt1` ADD COLUMN IF NOT EXISTS `c1` INT"},
[]string{"ALTER TABLE `xtest`.`xt1` ADD COLUMN /*T! IF NOT EXISTS */`c1` INT"},
},
{
"alter table `t1` add index if not exists (a) using btree comment 'a'",
[]string{"ALTER TABLE `test`.`t1` ADD INDEX IF NOT EXISTS(`a`) USING BTREE COMMENT 'a'"},
[]string{"ALTER TABLE `test`.`t1` ADD INDEX/*T! IF NOT EXISTS */(`a`) USING BTREE COMMENT 'a'"},
[][]*filter.Table{{genTableName("test", "t1")}},
[][]*filter.Table{{genTableName("xtest", "xt1")}},
[]string{"ALTER TABLE `xtest`.`xt1` ADD INDEX IF NOT EXISTS(`a`) USING BTREE COMMENT 'a'"},
[]string{"ALTER TABLE `xtest`.`xt1` ADD INDEX/*T! IF NOT EXISTS */(`a`) USING BTREE COMMENT 'a'"},
},
{
"alter table `t1` add constraint fk_t2_id foreign key if not exists (t2_id) references t2(id)",
[]string{"ALTER TABLE `test`.`t1` ADD CONSTRAINT `fk_t2_id` FOREIGN KEY IF NOT EXISTS (`t2_id`) REFERENCES `t2`(`id`)"},
[]string{"ALTER TABLE `test`.`t1` ADD CONSTRAINT `fk_t2_id` FOREIGN KEY /*T! IF NOT EXISTS */(`t2_id`) REFERENCES `t2`(`id`)"},
[][]*filter.Table{{genTableName("test", "t1")}},
[][]*filter.Table{{genTableName("xtest", "xt1")}},
[]string{"ALTER TABLE `xtest`.`xt1` ADD CONSTRAINT `fk_t2_id` FOREIGN KEY IF NOT EXISTS (`t2_id`) REFERENCES `t2`(`id`)"},
[]string{"ALTER TABLE `xtest`.`xt1` ADD CONSTRAINT `fk_t2_id` FOREIGN KEY /*T! IF NOT EXISTS */(`t2_id`) REFERENCES `t2`(`id`)"},
},
{
"create index if not exists i1 on `t1`(`c1`)",
[]string{"CREATE INDEX IF NOT EXISTS `i1` ON `test`.`t1` (`c1`)"},
[]string{"CREATE INDEX /*T! IF NOT EXISTS */`i1` ON `test`.`t1` (`c1`)"},
[][]*filter.Table{{genTableName("test", "t1")}},
[][]*filter.Table{{genTableName("xtest", "xt1")}},
[]string{"CREATE INDEX IF NOT EXISTS `i1` ON `xtest`.`xt1` (`c1`)"},
[]string{"CREATE INDEX /*T! IF NOT EXISTS */`i1` ON `xtest`.`xt1` (`c1`)"},
},
{
"alter table `t1` add partition if not exists ( partition p2 values less than maxvalue)",
[]string{"ALTER TABLE `test`.`t1` ADD PARTITION IF NOT EXISTS (PARTITION `p2` VALUES LESS THAN (MAXVALUE))"},
[]string{"ALTER TABLE `test`.`t1` ADD PARTITION/*T! IF NOT EXISTS */ (PARTITION `p2` VALUES LESS THAN (MAXVALUE))"},
[][]*filter.Table{{genTableName("test", "t1")}},
[][]*filter.Table{{genTableName("xtest", "xt1")}},
[]string{"ALTER TABLE `xtest`.`xt1` ADD PARTITION IF NOT EXISTS (PARTITION `p2` VALUES LESS THAN (MAXVALUE))"},
[]string{"ALTER TABLE `xtest`.`xt1` ADD PARTITION/*T! IF NOT EXISTS */ (PARTITION `p2` VALUES LESS THAN (MAXVALUE))"},
},
{
"alter table `t1` drop column if exists c2",
[]string{"ALTER TABLE `test`.`t1` DROP COLUMN IF EXISTS `c2`"},
[]string{"ALTER TABLE `test`.`t1` DROP COLUMN /*T! IF EXISTS */`c2`"},
[][]*filter.Table{{genTableName("test", "t1")}},
[][]*filter.Table{{genTableName("xtest", "xt1")}},
[]string{"ALTER TABLE `xtest`.`xt1` DROP COLUMN IF EXISTS `c2`"},
[]string{"ALTER TABLE `xtest`.`xt1` DROP COLUMN /*T! IF EXISTS */`c2`"},
},
{
"alter table `t1` change column if exists a b varchar(255)",
[]string{"ALTER TABLE `test`.`t1` CHANGE COLUMN IF EXISTS `a` `b` VARCHAR(255)"},
[]string{"ALTER TABLE `test`.`t1` CHANGE COLUMN /*T! IF EXISTS */`a` `b` VARCHAR(255)"},
[][]*filter.Table{{genTableName("test", "t1")}},
[][]*filter.Table{{genTableName("xtest", "xt1")}},
[]string{"ALTER TABLE `xtest`.`xt1` CHANGE COLUMN IF EXISTS `a` `b` VARCHAR(255)"},
[]string{"ALTER TABLE `xtest`.`xt1` CHANGE COLUMN /*T! IF EXISTS */`a` `b` VARCHAR(255)"},
},
{
"alter table `t1` modify column if exists a varchar(255)",
[]string{"ALTER TABLE `test`.`t1` MODIFY COLUMN IF EXISTS `a` VARCHAR(255)"},
[]string{"ALTER TABLE `test`.`t1` MODIFY COLUMN /*T! IF EXISTS */`a` VARCHAR(255)"},
[][]*filter.Table{{genTableName("test", "t1")}},
[][]*filter.Table{{genTableName("xtest", "xt1")}},
[]string{"ALTER TABLE `xtest`.`xt1` MODIFY COLUMN IF EXISTS `a` VARCHAR(255)"},
[]string{"ALTER TABLE `xtest`.`xt1` MODIFY COLUMN /*T! IF EXISTS */`a` VARCHAR(255)"},
},
{
"alter table `t1` drop index if exists i1",
[]string{"ALTER TABLE `test`.`t1` DROP INDEX IF EXISTS `i1`"},
[]string{"ALTER TABLE `test`.`t1` DROP INDEX /*T! IF EXISTS */`i1`"},
[][]*filter.Table{{genTableName("test", "t1")}},
[][]*filter.Table{{genTableName("xtest", "xt1")}},
[]string{"ALTER TABLE `xtest`.`xt1` DROP INDEX IF EXISTS `i1`"},
[]string{"ALTER TABLE `xtest`.`xt1` DROP INDEX /*T! IF EXISTS */`i1`"},
},
{
"alter table `t1` drop foreign key fk_t2_id",
Expand All @@ -286,10 +286,10 @@ var testCases = []testCase{
},
{
"alter table `t1` drop partition if exists p2",
[]string{"ALTER TABLE `test`.`t1` DROP PARTITION IF EXISTS `p2`"},
[]string{"ALTER TABLE `test`.`t1` DROP PARTITION /*T! IF EXISTS */`p2`"},
[][]*filter.Table{{genTableName("test", "t1")}},
[][]*filter.Table{{genTableName("xtest", "xt1")}},
[]string{"ALTER TABLE `xtest`.`xt1` DROP PARTITION IF EXISTS `p2`"},
[]string{"ALTER TABLE `xtest`.`xt1` DROP PARTITION /*T! IF EXISTS */`p2`"},
},
{
"alter table `t1` partition by hash(a)",
Expand Down
4 changes: 3 additions & 1 deletion dm/syncer/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
package syncer

import (
"strings"

"github.com/go-mysql-org/go-mysql/replication"
"github.com/pingcap/tidb/pkg/util/filter"
"github.com/pingcap/tiflow/dm/pkg/terror"
Expand Down Expand Up @@ -136,7 +138,7 @@ func (s *Syncer) skipByTable(table *filter.Table) bool {
// * any schema of table names is system schema.
// * any table name doesn't pass block-allow list.
func skipByTable(baList *filter.Filter, table *filter.Table) bool {
if filter.IsSystemSchema(table.Schema) {
if filter.IsSystemSchema(strings.ToLower(table.Schema)) {
return true
}
tables := baList.Apply([]*filter.Table{table})
Expand Down
Loading
Loading