-
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
pkg(ticdc): add a faster raw string rendering version of GenUpdateSQL #8069
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. |
/cc |
pkg/sqlmodel/multirow.go
Outdated
// Input `changes` should have same target table and same columns for WHERE | ||
// (typically same PK/NOT NULL UK), otherwise the behaviour is undefined. | ||
// It is a faster version compared with GenUpdateSQL. | ||
func GenUpdateSQLFast(changes ...*RowChange) (string, []interface{}) { |
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.
Should the batch size be limited ?
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.
I have summited a related issue #8084, and this limit will be added in another PR.
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. Thanks!
// It is a faster version compared with GenUpdateSQL. | ||
func GenUpdateSQLFast(changes ...*RowChange) (string, []interface{}) { | ||
if len(changes) == 0 { | ||
log.L().DPanic("row changes is empty") |
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 seems we always use log.Panic()
in TiCDC. Why do we need to get the current logger here? I'm not quite familiar with this API.
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 keeps the same DPanic
usage as GenUpdateSQL
, since this function is also used in DM. If we don't panic here(not in development mode), row changes will be lost.
@lance6716 Is it ok to change to log.Panic()
here for DM?
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.
I think it's OK to use log.Panic.
@hi-rustin in DM when the log level is debug, we turn on Development flag.
Lines 107 to 118 in 171e21b
inDev := strings.ToLower(cfg.Level) == "debug" | |
// init DM logger | |
logger, props, err := pclog.InitLogger(&pclog.Config{ | |
Level: cfg.Level, | |
Format: cfg.Format, | |
File: pclog.FileLogConfig{ | |
Filename: cfg.File, | |
MaxSize: cfg.FileMaxSize, | |
MaxDays: cfg.FileMaxDays, | |
MaxBackups: cfg.FileMaxBackups, | |
}, | |
Development: inDev, |
and DM integration tests always use debug level log, so we can detect the misuse in developement and control the blast radius when the bug is really happened at user's side. But it's not important.
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.
Changed to log.Panic()
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 89b7b23
|
@amyangfei: Your PR was out of date, I have automatically updated it for you. At the same time I will also trigger all tests for you: /run-all-tests
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-engine-integration-test |
What problem does this PR solve?
Issue Number: ref #8057
ref #8084
Task-2
What is changed and how it works?
GenUpdate
withGenUpdateFast
, we will useGenUpdateFast
after more correctness check and test.10%-16%
, memory allocation decreases to5%-11%
. (Horizontal axis denotes the batch size ofRowChange
)Check List
Tests
Questions
Will it cause performance regression or break compatibility?
Do you need to update user documentation, design documentation or monitoring documentation?
Release note