-
Notifications
You must be signed in to change notification settings - Fork 287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
checker(dm): change checker to more smart and gentle #3812
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
/run-verify |
/run-dm-integration-test |
1 similar comment
/run-dm-integration-test |
Due to
Wait the better sharding table check pr merge(not yet open). |
dee5b2a
to
204cd63
Compare
/run-dm-integration-test |
…g/ticdc into pre-check-01 merge
@okJiang: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Codecov Report
Flags with carried forward coverage won't be shown. Click here to find out more. @@ Coverage Diff @@
## master #3812 +/- ##
================================================
+ Coverage 55.6402% 55.7074% +0.0672%
================================================
Files 494 507 +13
Lines 61283 63128 +1845
================================================
+ Hits 34098 35167 +1069
- Misses 23750 24469 +719
- Partials 3435 3492 +57 |
dm/pkg/checker/binlog.go
Outdated
} | ||
|
||
// NewBinlogDBChecker returns a RealChecker. | ||
func NewBinlogDBChecker(db *sql.DB, dbinfo *dbutil.DBConfig, schemas map[string]struct{}) RealChecker { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need an it test for this checker?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is inconvenient to add it, because should set it in my.cnf
.
Maybe manual test is enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
manual test is updated in description.
// If both of them are empty, it will log changes for all DBs. | ||
if len(binlogDoDB) != 0 { | ||
for _, doDB := range binlogDoDBs { | ||
delete(c.schemas, doDB) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where c.chemas init?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we also need to think about case-sensitive of this schemas
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where c.chemas init?
Line 214 in 1e3dd15
checkSchemas := make(map[string]struct{}, len(mapping)) |
we also need to think about case-sensitive of this schemas
To be further confirmed. Because I think if schema name is case-sensitive, the binlog_do_db/binlog_ignore_db
are too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After test, binlog_db_db/binlog_ignore_db
is not affected by lower_case_table_names
.
[mysqld]
binlog_do_db = Do
binlog_do_db = TestCaseSensitive
lower_case_table_names = 1
mysql> show master status;
+------------------+----------+----------------------+------------------+--------------------------------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+----------------------+------------------+--------------------------------------------+
| mysql-bin.000004 | 194 | Do,TestCaseSensitive | | a0ec2f1a-d811-11eb-84a7-16210329b3ba:1-112 |
+------------------+----------+----------------------+------------------+--------------------------------------------+
1 row in set (0.00 sec)
I will add code about case-sensitive.
/run-dm-integration-test |
/run-dm-integration-test |
/check-issue-triage-complete |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM great job
@@ -259,7 +264,7 @@ func (c *Checker) Init(ctx context.Context) (err error) { | |||
continue | |||
} | |||
if instance.cfg.ShardMode == config.ShardPessimistic { | |||
c.checkList = append(c.checkList, checker.NewShardingTablesChecker(targetTableID, dbs, shardingSet, columnMapping, checkingShardID, dumpThreads)) | |||
c.checkList = append(c.checkList, checker.NewShardingTablesChecker(targetTableID, dbs, shardingSet, checkingShardID, dumpThreads)) | |||
} else { | |||
c.checkList = append(c.checkList, checker.NewOptimisticShardingTablesChecker(targetTableID, dbs, shardingSet, dumpThreads)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should also check AutoID for optimistic sharding mode. Will the optimistic table structure join itself can report the AutoID problem so we don't need extra checking logic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, optimistic table structure join can report the autoID problem.
I will add some UT later
@@ -575,7 +575,7 @@ func (s *Server) StartTask(ctx context.Context, req *pb.StartTaskRequest) (*pb.S | |||
|
|||
resp.Result = true | |||
if cfg.RemoveMeta { | |||
resp.Msg += "`remove-meta` in task config is deprecated, please use `start-task ... --remove-meta` instead" | |||
resp.Msg = "`remove-meta` in task config is deprecated, please use `start-task ... --remove-meta` instead" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add a comment that what message will be overwritten
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no message will be overwritten. The resp.Msg is just assigned once. Because this pr
msg, err := checker.CheckSyncConfigFunc(ctx, stCfgs, ctlcommon.DefaultErrorCnt, ctlcommon.DefaultWarnCnt)
if err != nil {
resp.CheckResult = terror.WithClass(err, terror.ClassDMMaster).Error()
return resp, nil
}
resp.CheckResult = msg
resp.Msg
is changed to resp.CheckResult
.
So I just remove +
from here.
dm/pkg/checker/binlog.go
Outdated
binlogDoDB = strings.ToLower(binlogDoDB) | ||
binlogIgnoreDB = strings.ToLower(binlogIgnoreDB) | ||
} | ||
binlogDoDB = strings.ReplaceAll(binlogDoDB, " ", "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
identifier can have spaces as long as they are backquoted, so this is incorrect
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact, there is no spaces among the list of binlog_do_db
. So, I just remove this later.
But another question, it seems that identifier also can have ,
(comma)?
dm/pkg/checker/binlog.go
Outdated
} | ||
if len(c.schemas) > 0 { | ||
dbs := []string{} | ||
for db := range c.schemas { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have a helper function SetToSlice
/merge |
This pull request has been accepted and is ready to merge. Commit hash: f763630
|
What problem does this PR solve?
Issue Number: close #3766
What is changed and how it works?
tiflow/dm/docs/RFCS/20211130_enhanced_pre_checker.md
Lines 61 to 75 in 1fb41f9
add binlog_do_db checker
Check List
Tests
test case-sensitive
test check failed(not in binlog_do_db)
Upper_DB1
frombinlog_do_db
Related changes
Release note