Skip to content

cdc: do not send too much tasks if cannot be handled in time#17724

Merged
ti-chi-bot[bot] merged 27 commits intotikv:masterfrom
3AceShowHand:cdc-quota-task-channel
Nov 6, 2024
Merged

cdc: do not send too much tasks if cannot be handled in time#17724
ti-chi-bot[bot] merged 27 commits intotikv:masterfrom
3AceShowHand:cdc-quota-task-channel

Conversation

@3AceShowHand
Copy link
Contributor

@3AceShowHand 3AceShowHand commented Oct 28, 2024

What is changed and how it works?

Issue Number: Close #17696

What's Changed:

* take cdc tasks into memory quota to prevent the TiKV OOM caused by too many pending tasks

Related changes

  • PR to update pingcap/docs/pingcap/docs-cn:
  • Need to cherry-pick to the release branch

Check List

Tests

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

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Release note

fix the TiKV may oom if too much internal pending tasks due to read old value too slow

Signed-off-by: 3AceShowHand <jinl1037@hotmail.com>
Signed-off-by: 3AceShowHand <jinl1037@hotmail.com>
Signed-off-by: 3AceShowHand <jinl1037@hotmail.com>
Signed-off-by: 3AceShowHand <jinl1037@hotmail.com>
Signed-off-by: 3AceShowHand <jinl1037@hotmail.com>
Signed-off-by: 3AceShowHand <jinl1037@hotmail.com>
@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-linked-issue dco-signoff: yes Indicates the PR's author has signed the dco. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 28, 2024
Signed-off-by: 3AceShowHand <jinl1037@hotmail.com>
Signed-off-by: 3AceShowHand <jinl1037@hotmail.com>
Signed-off-by: 3AceShowHand <jinl1037@hotmail.com>
Signed-off-by: 3AceShowHand <jinl1037@hotmail.com>
Signed-off-by: 3AceShowHand <jinl1037@hotmail.com>
Signed-off-by: 3AceShowHand <jinl1037@hotmail.com>
Signed-off-by: 3AceShowHand <jinl1037@hotmail.com>
Signed-off-by: 3AceShowHand <jinl1037@hotmail.com>
Signed-off-by: 3AceShowHand <jinl1037@hotmail.com>
@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 5, 2024
Signed-off-by: 3AceShowHand <jinl1037@hotmail.com>
@3AceShowHand 3AceShowHand changed the title [DNM] cdc: do not send too much tasks if cannot be handled in time cdc: do not send too much tasks if cannot be handled in time Nov 5, 2024
Signed-off-by: 3AceShowHand <jinl1037@hotmail.com>
Copy link
Member

@overvenus overvenus left a comment

Choose a reason for hiding this comment

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

Rest LGTM

};

let size = cmd_batches.iter().map(|b| b.size()).sum();
self.memory_quota.alloc_force(size);
Copy link
Member

Choose a reason for hiding this comment

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

Please add a test that ensures that too many pending CmdBatch causes TxnExtra to be dropped due to memory quota.

Signed-off-by: 3AceShowHand <jinl1037@hotmail.com>
Signed-off-by: Neil Shen <overvenus@gmail.com>
Signed-off-by: 3AceShowHand <jinl1037@hotmail.com>
Signed-off-by: 3AceShowHand <jinl1037@hotmail.com>
@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Nov 6, 2024
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Nov 6, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hicqu, overvenus

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

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Nov 6, 2024
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Nov 6, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-11-06 05:51:16.660780405 +0000 UTC m=+1020189.499935943: ☑️ agreed by overvenus.
  • 2024-11-06 06:05:49.668532044 +0000 UTC m=+1021062.507687592: ☑️ agreed by hicqu.

@ti-chi-bot ti-chi-bot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Nov 6, 2024
@ti-chi-bot ti-chi-bot bot merged commit bc2c652 into tikv:master Nov 6, 2024
@ti-chi-bot ti-chi-bot bot added this to the Pool milestone Nov 6, 2024
@3AceShowHand
Copy link
Contributor Author

/cherry-pick release-8.4

@ti-chi-bot
Copy link
Member

@3AceShowHand: new pull request created to branch release-8.4: #17777.

Details

In response to this:

/cherry-pick release-8.4

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.

@overvenus overvenus added needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. needs-cherry-pick-release-8.4 Should cherry pick this PR to release-8.4 branch. labels Nov 6, 2024
@ti-chi-bot
Copy link
Member

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

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request could not be created: failed to create pull request against tikv/tikv#release-8.4 from head ti-chi-bot:cherry-pick-17724-to-release-8.4: status code 422 not one of [201], body: {"message":"Validation Failed","errors":[{"resource":"PullRequest","code":"custom","message":"A pull request already exists for ti-chi-bot:cherry-pick-17724-to-release-8.4."}],"documentation_url":"https://docs.github.com/rest/pulls/pulls#create-a-pull-request","status":"422"}

ti-chi-bot bot pushed a commit that referenced this pull request Nov 6, 2024
…#17777)

close #17696

* take cdc tasks into memory quota to prevent the TiKV OOM caused by too many pending tasks

Signed-off-by: 3AceShowHand <jinl1037@hotmail.com>
Signed-off-by: Neil Shen <overvenus@gmail.com>

Co-authored-by: 3AceShowHand <jinl1037@hotmail.com>
Co-authored-by: Neil Shen <overvenus@gmail.com>
ti-chi-bot bot added a commit that referenced this pull request Nov 13, 2024
…#17778)

close #17696

* take cdc tasks into memory quota to prevent the TiKV OOM caused by too many pending tasks

Signed-off-by: Neil Shen <overvenus@gmail.com>
Signed-off-by: 3AceShowHand <jinl1037@hotmail.com>

Co-authored-by: Neil Shen <overvenus@gmail.com>
Co-authored-by: 3AceShowHand <jinl1037@hotmail.com>
Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved dco-signoff: yes Indicates the PR's author has signed the dco. lgtm needs-cherry-pick-release-8.4 Should cherry pick this PR to release-8.4 branch. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TiDB latency not stable and TiKV OOM if running cdc changefeed when titan is on and average region size is large

4 participants