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

ddl: limit the count of getting ddlhistory jobs (#55590) #56142

Merged

Conversation

ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #55590

What problem does this PR solve?

Issue Number: close #55711

Problem Summary:
If user want to get all of DDL-history jobs, the tidb-server has the risk of OOM because of large mount of DDL-history jobs.

What changed and how does it work?

  1. Limit the count of jobs when getting the ddl history jobs.
  2. The parameter 'limit' should be large than 1 and less than or equal to 1024.
  3. If use default 'limit', user can get the 1024 ddl history jobs by default.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Manual test steps

  1. create 5k table in database with the 'sysbench' tool.
  2. query the mount of ddl-history jobs, it contains 6052 ddl history jobs.
mysql> select count(*) from mysql.tidb_ddl_history;
+----------+
| count(*) |
+----------+
|     6052 |
+----------+
1 row in set (0.00 sec)
  1. run below command
curl -X POST http://172.16.6.95:11080/ddl/history

and the it gets the 1024 ddl history jobs by default.

  1. run below command, it gets the fault messages when limit < 0 or limit >= 1025
# curl -X POST http://172.16.6.95:11080/ddl/history -d "limit=0"
ddl history limit must be greater than 0 and less than or equal to 1024

# curl -X POST http://172.16.6.95:11080/ddl/history -d "limit=1025"
ddl history limit must be greater than 0 and less than or equal to 1024

curl -X POST http://172.16.6.95:11080/ddl/history -d "limit=1024" > output2.log
  1. run below command, it gets 1024 ddl history jobs with the parameter 'limit'.
curl -X POST http://172.16.6.95:11080/ddl/history -d "limit=1024" > output2.log
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 5357k    0 5357k  100    10  22.0M     42 --:--:-- --:--:-- --:--:-- 22.0M

Side effects

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

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

Limit the count of jobs when getting the ddl history jobs.

@ti-chi-bot ti-chi-bot added affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-8.1 This bug affects the 8.1.x(LTS) versions. ok-to-test Indicates a PR is ready to be tested. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. type/cherry-pick-for-release-6.5 This PR is cherry-picked to release-6.5 from a source PR. labels Sep 19, 2024
@ti-chi-bot ti-chi-bot bot added do-not-merge/cherry-pick-not-approved size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 19, 2024
@joccau joccau requested a review from xiabee September 19, 2024 02:35
Copy link

ti-chi-bot bot commented Sep 19, 2024

@xiabee: adding LGTM is restricted to approvers and reviewers in OWNERS files.

In response to this:

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.

@ti-chi-bot ti-chi-bot closed this Feb 11, 2025
@joccau joccau reopened this Feb 11, 2025
@ti-chi-bot ti-chi-bot bot added cherry-pick-approved Cherry pick PR approved by release team. and removed do-not-merge/cherry-pick-not-approved labels Feb 11, 2025
@joccau joccau force-pushed the cherry-pick-55590-to-release-6.5 branch from 05de9bb to a8a3c90 Compare February 11, 2025 08:15
@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Feb 11, 2025
@joccau joccau removed affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-8.1 This bug affects the 8.1.x(LTS) versions. labels Feb 11, 2025
@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Feb 11, 2025
Copy link

ti-chi-bot bot commented Feb 11, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: joccau, tangenta, xiabee

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

The pull request process is described here

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 Feb 11, 2025
Copy link

ti-chi-bot bot commented Feb 11, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-02-11 09:45:54.468341898 +0000 UTC m=+349796.864563962: ☑️ agreed by joccau.
  • 2025-02-11 10:14:05.113497086 +0000 UTC m=+351487.509719147: ☑️ agreed by tangenta.

@joccau
Copy link
Member

joccau commented Feb 11, 2025

/test unit-test

Copy link

tiprow bot commented Feb 11, 2025

@joccau: No presubmit jobs available for pingcap/[email protected]

In response to this:

/test unit-test

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-sigs/prow repository.

Copy link

codecov bot commented Feb 11, 2025

Codecov Report

Attention: Patch coverage is 89.47368% with 2 lines in your changes missing coverage. Please review.

Please upload report for BASE (release-6.5@407a57b). Learn more about missing BASE report.

Additional details and impacted files
@@               Coverage Diff                @@
##             release-6.5     #56142   +/-   ##
================================================
  Coverage               ?   73.6475%           
================================================
  Files                  ?       1097           
  Lines                  ?     353447           
  Branches               ?          0           
================================================
  Hits                   ?     260305           
  Misses                 ?      76405           
  Partials               ?      16737           

@ti-chi-bot ti-chi-bot bot merged commit 7ae654c into pingcap:release-6.5 Feb 11, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved cherry-pick-approved Cherry pick PR approved by release team. lgtm ok-to-test Indicates a PR is ready to be tested. 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. type/cherry-pick-for-release-6.5 This PR is cherry-picked to release-6.5 from a source PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants