-
Notifications
You must be signed in to change notification settings - Fork 288
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
syncer(dm): fix log error caused by "COMMIT" in QueryEvent #7726
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. |
Codecov Report
Additional details and impacted files
Flags with carried forward coverage won't be shown. Click here to find out more. @@ Coverage Diff @@
## master #7726 +/- ##
================================================
+ Coverage 55.0067% 60.0027% +4.9960%
================================================
Files 415 813 +398
Lines 52739 94049 +41310
================================================
+ Hits 29010 56432 +27422
- Misses 20957 32723 +11766
- Partials 2772 4894 +2122 |
/run-dm-integration-test |
/cc @lance6716 |
@@ -2272,7 +2272,18 @@ func (s *Syncer) Run(ctx context.Context) (err error) { | |||
} | |||
case *replication.QueryEvent: | |||
originSQL = strings.TrimSpace(string(ev.Query)) | |||
err2 = s.ddlWorker.HandleQueryEvent(ev, ec, originSQL) | |||
if originSQL == "COMMIT" { |
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.
maybe use a fallthrough
to run into the case *replication.XIDEvent:
branch
dm/syncer/syncer.go
Outdated
} | ||
} | ||
|
||
s.tctx.L().Debug("", zap.String("event", "XID"), zap.Stringer("last location", lastTxnEndLocation), log.WrapStringerField("location", endLocation)) | ||
|
||
job := newXIDJob(endLocation, startLocation, endLocation) | ||
_, err2 = s.handleJobFunc(job) | ||
_, err = s.handleJobFunc(job) | ||
return needContinue, err |
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.
return needContinue, err | |
return false, err |
use explicit value for better understanding
dm/syncer/syncer.go
Outdated
case *replication.QueryEvent: | ||
originSQL = strings.TrimSpace(string(ev.Query)) | ||
if originSQL == "COMMIT" { | ||
needContinue, _ := funCommit() |
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.
don't call funCommit
twice
cleanup_data start_task | ||
prepare_data_MyISAM | ||
|
||
cp $cur/conf/source1.yaml $WORK_DIR/source1.yaml |
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 need to copy them if you won't change the file content
/run-all-tests |
/cc @D3Hunter |
Co-authored-by: lance6716 <[email protected]>
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.
rest lgtm
echo "check data" | ||
check_sync_diff $WORK_DIR $cur/conf/diff_config.toml | ||
|
||
check_log_not_contains $WORK_DIR/worker1/log/dm-worker.log "originSQL: COMMIT" |
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 does this log printed previously?
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 trackOriginDDL
, "COMMIT" QueryEvent is identified as ddl, and print log in parseOneStmt
Line 2797 in 3f4a8a7
stmt, err := parseOneStmt(qec) |
Line 934 in 3f4a8a7
qec.tctx.L().Info("parse ddl", zap.String("event", "query"), zap.Stringer("query event context", qec)) |
[2022/11/28 14:48:30.512 +08:00] [INFO] [ddl.go:934] ["parse ddl"] [task=test] [unit="binlog replication"] [event=query] ["query event context"="{schema: , originSQL: COMMIT, startLocation: position: (mysql-bin|000001.000001, 4407), gtid-set: e266a895-6e51-11ed-b110-0242ac110002:1-16, endLocation: position: (mysql-bin|000001.000001, 4476), gtid-set: e266a895-6e51-11ed-b110-0242ac110002:1-16, lastLocation: position: (mysql-bin|000001.000001, 4476), gtid-set: e266a895-6e51-11ed-b110-0242ac110002:1-16, re-sync: , needHandleDDLs: , trackInfos: }"]
/run-all-tests |
/run-dm-integration-test |
1 similar comment
/run-dm-integration-test |
/run-all-tests |
/run-dm-integration-test |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 030d73c
|
/run-all-tests |
1 similar comment
/run-all-tests |
/run-dm-integration-test |
/run-dm-integration-test |
@liumengya94: Your PR was out of date, I have automatically updated it for you. If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes. 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 ti-community-infra/tichi repository. |
/run-all-tests |
In response to a cherrypick label: new pull request created: #7773. |
Signed-off-by: ti-chi-bot <[email protected]>
What problem does this PR solve?
Issue Number: ref #7525
What is changed and how it works?
fix log error and save checkpoint for COMMIT QueryEvent
Check List
Tests
Questions
Will it cause performance regression or break compatibility?
No
Do you need to update user documentation, design documentation or monitoring documentation?
No
Release note