Skip to content
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

sinkv2 (ticdc): limit batch dml size #7960

Merged
merged 7 commits into from
Dec 26, 2022

Conversation

asddongmen
Copy link
Contributor

@asddongmen asddongmen commented Dec 22, 2022

What problem does this PR solve?

Issue Number: close #7959

What is changed and how it works?

Add a batched dml size limitation. After this PR, the batched dmls in a single SQL will not exceed the maxTxnRow value.

Check List

Tests

  • Unit test
  • Manual test (add detailed scripts or steps below)

Questions

Will it cause performance regression or break compatibility?
Do you need to update user documentation, design documentation or monitoring documentation?

Release note

Fix a bug that causes big transaction can not be excuted.

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Dec 22, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • hi-rustin
  • nongfushanquan

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 22, 2022
@asddongmen
Copy link
Contributor Author

/run-all-tests

event *eventsink.TxnCallbackableEvent,
tableInfo *timodel.TableInfo,
spiltUpdate bool,
) (insertRows, updateRows, deleteRows []*sqlmodel.RowChange) {
) (insertRows, updateRows, deleteRows [][]*sqlmodel.RowChange) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you add a test case to verify the issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, I will do it.

@ti-chi-bot ti-chi-bot added the needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. label Dec 26, 2022
@ti-chi-bot ti-chi-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 26, 2022
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Dec 26, 2022
convert2RowChanges(row, tableInfo, sqlmodel.RowChangeUpdate))
if len(updateRow) >= s.cfg.MaxTxnRow {
updateRows = append(updateRows, updateRow)
updateRow = make([]*sqlmodel.RowChange, 0, s.cfg.MaxTxnRow)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we use s.cfg.MaxTxnRow here but use preAllocateSize above?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the most time len(event) is far more less than s.cfg.MaxTxnRow, it will be a waste if just use s.cfg.MaxTxnRow.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your reminder.

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Dec 26, 2022
@asddongmen
Copy link
Contributor Author

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: a92c641

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Dec 26, 2022
@ti-chi-bot ti-chi-bot merged commit 314d79c into pingcap:master Dec 26, 2022
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-6.5: #7979.

ti-chi-bot added a commit that referenced this pull request Jan 6, 2023
@asddongmen asddongmen deleted the fix-batch-dml-error branch May 18, 2023 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error when replicating a big txn
4 participants