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

statistics: add a priority queue API #57385

Merged
merged 21 commits into from
Nov 19, 2024

Conversation

Rustin170506
Copy link
Member

@Rustin170506 Rustin170506 commented Nov 14, 2024

What problem does this PR solve?

Issue Number: close #55063

Problem Summary:

What changed and how does it work?

This PR added a new API /stats/priority-queue to output all current jobs in the priority queue.

The test output looks like:

curl http://10.2.6.161:10080/stats/priority-queue
{
 "current_jobs": [
  {
   "type": "analyzeDynamicPartition",
   "table_id": 18303,
   "weight": 0.39783801684240416,
   "partition_ids": [
    89490
   ],
   "index_ids": null,
   "partition_index_ids": {},
   "indicators": {
    "change_percentage": "2.31%",
    "table_size": "2948.00",
    "last_analysis_duration": "2m21.6s"
   },
   "has_newly_added_index": false
  },
  {
   "type": "analyzeDynamicPartition",
   "table_id": 17904,
   "weight": 0.3969517635632116,
   "partition_ids": [
    89360,
    87716,
    89770
   ],
   "index_ids": null,
   "partition_index_ids": {},
   "indicators": {
    "change_percentage": "2.23%",
    "table_size": "3322.00",
    "last_analysis_duration": "2m48.883666666s"
   },
   "has_newly_added_index": false
  },
  {
   "type": "analyzeDynamicPartition",
   "table_id": 17806,
   "weight": 0.22839572041819045,
   "partition_ids": [
    84340
   ],
   "index_ids": null,
   "partition_index_ids": {},
   "indicators": {
    "change_percentage": "1.03%",
    "table_size": "6772.00",
    "last_analysis_duration": "2m6.7s"
   },
   "has_newly_added_index": false
  }
 ],
 "must_retry_tables": []
}%           

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.

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.

None

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 14, 2024
Copy link

codecov bot commented Nov 14, 2024

Codecov Report

Attention: Patch coverage is 37.23404% with 59 lines in your changes missing coverage. Please review.

Project coverage is 73.6207%. Comparing base (8382fdb) to head (8486e27).
Report is 1 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #57385        +/-   ##
================================================
+ Coverage   72.8567%   73.6207%   +0.7639%     
================================================
  Files          1672       1702        +30     
  Lines        462738     470825      +8087     
================================================
+ Hits         337136     346625      +9489     
+ Misses       104829     102765      -2064     
- Partials      20773      21435       +662     
Flag Coverage Δ
integration 46.1498% <8.5106%> (?)
unit 72.2081% <37.2340%> (-0.0291%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 52.7673% <ø> (ø)
parser ∅ <ø> (∅)
br 45.1091% <ø> (+0.0061%) ⬆️
---- 🚨 Try these New Features:

Signed-off-by: Rustin170506 <[email protected]>
Signed-off-by: Rustin170506 <[email protected]>
@Rustin170506
Copy link
Member Author

Rustin170506 commented Nov 14, 2024

Tested locally:

curl http://127.0.0.1:10080/stats/priority-queue
{
 "current_jobs": [],
 "must_retry_tables": []
}%     


curl http://127.0.0.1:10080/stats/priority-queue
{
 "current_jobs": [
  {
   "partition_index_ids": {},
   "indicators": {
    "change_percentage": "50.71%",
    "table_size": "2979.00",
    "last_analysis_duration": "86287.30s"
   },
   "type": "analyzeDynamicPartition",
   "partition_ids": [
    47042,
    45664
   ],
   "index_ids": null,
   "table_id": 17953,
   "weight": 1.5215503655836162,
   "has_newly_added_index": false
  },
 ],
 "must_retry_tables": []
}

Signed-off-by: Rustin170506 <[email protected]>
Signed-off-by: Rustin170506 <[email protected]>
Signed-off-by: Rustin170506 <[email protected]>
Signed-off-by: Rustin170506 <[email protected]>
Signed-off-by: Rustin170506 <[email protected]>
Signed-off-by: Rustin170506 <[email protected]>
Signed-off-by: Rustin170506 <[email protected]>
Signed-off-by: Rustin170506 <[email protected]>
Signed-off-by: Rustin170506 <[email protected]>
Signed-off-by: Rustin170506 <[email protected]>
@Rustin170506
Copy link
Member Author

/retest

Signed-off-by: Rustin170506 <[email protected]>
Signed-off-by: Rustin170506 <[email protected]>
Signed-off-by: Rustin170506 <[email protected]>
Signed-off-by: Rustin170506 <[email protected]>
Copy link
Member Author

@Rustin170506 Rustin170506 left a comment

Choose a reason for hiding this comment

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

🔢 Self-check (PR reviewed by myself and ready for feedback.)

Copy link
Contributor

@elsa0520 elsa0520 left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot bot added the approved label Nov 18, 2024
@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Nov 18, 2024
@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Nov 19, 2024
Copy link

ti-chi-bot bot commented Nov 19, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-11-18 09:14:47.713557962 +0000 UTC m=+866049.904426958: ☑️ agreed by elsa0520.
  • 2024-11-19 03:16:55.860075975 +0000 UTC m=+930978.050944973: ☑️ agreed by qw4990.

@Rustin170506
Copy link
Member Author

/hold

@ti-chi-bot ti-chi-bot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 19, 2024
Copy link
Member Author

@Rustin170506 Rustin170506 left a comment

Choose a reason for hiding this comment

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

🔢 Self-check (PR reviewed by myself and ready for feedback.)

@Rustin170506
Copy link
Member Author

/unhold

@ti-chi-bot ti-chi-bot bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 19, 2024
Copy link

ti-chi-bot bot commented Nov 19, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: elsa0520, qw4990

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

@Rustin170506 Rustin170506 added the needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. label Nov 19, 2024
Copy link

tiprow bot commented Nov 19, 2024

@Rustin170506: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
fast_test_tiprow 8486e27 link true /test fast_test_tiprow

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@Rustin170506
Copy link
Member Author

/retest

@Rustin170506
Copy link
Member Author

/test testbot

Copy link

ti-chi-bot bot commented Nov 19, 2024

@Rustin170506: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test build
  • /test check-dev
  • /test check-dev2
  • /test mysql-test
  • /test pull-br-integration-test
  • /test pull-integration-ddl-test
  • /test pull-integration-e2e-test
  • /test pull-lightning-integration-test
  • /test pull-mysql-client-test
  • /test pull-unit-test-ddlv1
  • /test unit-test

The following commands are available to trigger optional jobs:

  • /test pingcap/tidb/canary_ghpr_unit_test
  • /test pull-common-test
  • /test pull-e2e-test
  • /test pull-integration-common-test
  • /test pull-integration-copr-test
  • /test pull-integration-jdbc-test
  • /test pull-integration-mysql-test
  • /test pull-integration-nodejs-test
  • /test pull-integration-python-orm-test
  • /test pull-sqllogic-test
  • /test pull-tiflash-test

Use /test all to run the following jobs that were automatically triggered:

  • pingcap/tidb/ghpr_build
  • pingcap/tidb/ghpr_check
  • pingcap/tidb/ghpr_check2
  • pingcap/tidb/ghpr_mysql_test
  • pingcap/tidb/ghpr_unit_test
  • pingcap/tidb/pull_integration_ddl_test
  • pingcap/tidb/pull_integration_e2e_test
  • pingcap/tidb/pull_lightning_integration_test
  • pingcap/tidb/pull_mysql_client_test

In response to this:

/test testbot

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.

Copy link

tiprow bot commented Nov 19, 2024

@Rustin170506: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test fast_test_tiprow
  • /test fast_test_tiprow_ddlargsv1
  • /test tidb_parser_test

Use /test all to run the following jobs that were automatically triggered:

  • fast_test_tiprow
  • tidb_parser_test

In response to this:

/test testbot

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.

@Rustin170506
Copy link
Member Author

/test testbot

Copy link

ti-chi-bot bot commented Nov 19, 2024

@Rustin170506: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test build
  • /test check-dev
  • /test check-dev2
  • /test mysql-test
  • /test pull-br-integration-test
  • /test pull-integration-ddl-test
  • /test pull-integration-e2e-test
  • /test pull-lightning-integration-test
  • /test pull-mysql-client-test
  • /test pull-unit-test-ddlv1
  • /test unit-test

The following commands are available to trigger optional jobs:

  • /test pingcap/tidb/canary_ghpr_unit_test
  • /test pull-common-test
  • /test pull-e2e-test
  • /test pull-integration-common-test
  • /test pull-integration-copr-test
  • /test pull-integration-jdbc-test
  • /test pull-integration-mysql-test
  • /test pull-integration-nodejs-test
  • /test pull-integration-python-orm-test
  • /test pull-sqllogic-test
  • /test pull-tiflash-test

Use /test all to run the following jobs that were automatically triggered:

  • pingcap/tidb/ghpr_build
  • pingcap/tidb/ghpr_check
  • pingcap/tidb/ghpr_check2
  • pingcap/tidb/ghpr_mysql_test
  • pingcap/tidb/ghpr_unit_test
  • pingcap/tidb/pull_integration_ddl_test
  • pingcap/tidb/pull_integration_e2e_test
  • pingcap/tidb/pull_lightning_integration_test
  • pingcap/tidb/pull_mysql_client_test

In response to this:

/test testbot

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.

Copy link

tiprow bot commented Nov 19, 2024

@Rustin170506: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test fast_test_tiprow
  • /test fast_test_tiprow_ddlargsv1
  • /test tidb_parser_test

Use /test all to run the following jobs that were automatically triggered:

  • fast_test_tiprow
  • tidb_parser_test

In response to this:

/test testbot

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.

@time-and-fate
Copy link
Member

/test xxx

Copy link

ti-chi-bot bot commented Nov 19, 2024

@time-and-fate: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test build
  • /test check-dev
  • /test check-dev2
  • /test mysql-test
  • /test pull-br-integration-test
  • /test pull-integration-ddl-test
  • /test pull-integration-e2e-test
  • /test pull-lightning-integration-test
  • /test pull-mysql-client-test
  • /test pull-unit-test-ddlv1
  • /test unit-test

The following commands are available to trigger optional jobs:

  • /test pingcap/tidb/canary_ghpr_unit_test
  • /test pull-common-test
  • /test pull-e2e-test
  • /test pull-integration-common-test
  • /test pull-integration-copr-test
  • /test pull-integration-jdbc-test
  • /test pull-integration-mysql-test
  • /test pull-integration-nodejs-test
  • /test pull-integration-python-orm-test
  • /test pull-sqllogic-test
  • /test pull-tiflash-test

Use /test all to run the following jobs that were automatically triggered:

  • pingcap/tidb/ghpr_build
  • pingcap/tidb/ghpr_check
  • pingcap/tidb/ghpr_check2
  • pingcap/tidb/ghpr_mysql_test
  • pingcap/tidb/ghpr_unit_test
  • pingcap/tidb/pull_integration_ddl_test
  • pingcap/tidb/pull_integration_e2e_test
  • pingcap/tidb/pull_lightning_integration_test
  • pingcap/tidb/pull_mysql_client_test

In response to this:

/test xxx

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 bot merged commit cfa52d0 into pingcap:master Nov 19, 2024
24 of 25 checks passed
Copy link

tiprow bot commented Nov 19, 2024

@time-and-fate: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test fast_test_tiprow
  • /test fast_test_tiprow_ddlargsv1
  • /test tidb_parser_test

Use /test all to run the following jobs that were automatically triggered:

  • fast_test_tiprow
  • tidb_parser_test

In response to this:

/test xxx

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.

@ti-chi-bot
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner 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.

Tracking Issue For Maintaining Priority Queue In Memory
5 participants