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: Filter the DDL Job History based on DDL types #54389

Closed
wants to merge 8 commits into from

Conversation

sachin-japate
Copy link

@sachin-japate sachin-japate commented Jul 2, 2024

Adding the capability to filter the DDL Job History based on DDL types

What problem does this PR solve?

This PR extends the DDL history job API capability to filter the DDL jobs based on their types.

Issue Number: close #54391

Problem Summary:

Requirements raised due to issues with incremental backups in TiDB have some limitations, incremental backup after certain types of DDL executed can lead to data inconsistency issues.
To solve this, we wanted to handle this situation with our backup scheduling platform, We will introduce a validation before triggering any incremental backup if we encounter such DDLs, full backup will be triggered instead of incremental.

Currently, ddl/history API can return all DDLs or DDLs with a starting job_id.
http://{TiDBIP}:10080/ddl/history
http://{TiDBIP}:10080/ddl/history?limit={number}
http://{TIDBIP}:10080/ddl/history?start_job_id={id}&limit={number}

Extending API to filter based on the DDL types.
http://{TIDBIP}:10080/ddl/history?ddl_types="2,4,47"
http://{TIDBIP}:10080/ddl/history?ddl_types="2,4,47"&limit={number}
http://{TIDBIP}:10080/ddl/history?start_job_id={id}&ddl_types="2,4,47"&limit={number}

What changed and how does it work?

  1. Filter the DDL job history based on the DDL types,

http://{TIDBIP}:10080/ddl/history?ddl_types="2,4,47"

  1. Filter the DDL job history based on the DDL types and apply the limit

http://{TIDBIP}:10080/ddl/history?ddl_types="2,4,47"&limit={number}

  1. Filter the DDL job history based on the DDL types from the starting job ID and apply the limit

http://{TIDBIP}:10080/ddl/history?start_job_id={id}&ddl_types="2,4,47"&limit={number}

the combination of start_job_id and ddl_types will not work without limit, as the previous implementation was if the start_job_id was sent limit was a mandatory param. So behavior will remain the same as previously.

Check List

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

Documentation

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

Release note

None

Copy link

ti-chi-bot bot commented Jul 2, 2024

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

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 added do-not-merge/invalid-title do-not-merge/needs-linked-issue do-not-merge/needs-tests-checked 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 Jul 2, 2024
@sre-bot
Copy link
Contributor

sre-bot commented Jul 2, 2024

CLA assistant check
All committers have signed the CLA.

Copy link

ti-chi-bot bot commented Jul 2, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign tangenta for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

Copy link

ti-chi-bot bot commented Jul 2, 2024

Welcome @sachin-japate!

It looks like this is your first PR to pingcap/tidb 🎉.

I'm the bot to help you request reviewers, add labels and more, See available commands.

We want to make sure your contribution gets all the attention it needs!



Thank you, and welcome to pingcap/tidb. 😃

Copy link

ti-chi-bot bot commented Jul 2, 2024

Hi @sachin-japate. Thanks for your PR.

I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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 added needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 2, 2024
Copy link

tiprow bot commented Jul 2, 2024

Hi @sachin-japate. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

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.

@wuhuizuo
Copy link
Contributor

wuhuizuo commented Jul 2, 2024

/ok-to-test

@ti-chi-bot ti-chi-bot bot added ok-to-test Indicates a PR is ready to be tested. and removed needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Jul 2, 2024
@sachin-japate
Copy link
Author

/retest

Copy link

codecov bot commented Jul 2, 2024

Codecov Report

Attention: Patch coverage is 0% with 51 lines in your changes missing coverage. Please review.

Project coverage is 55.8435%. Comparing base (ebc9620) to head (ccba9d5).
Report is 20 commits behind head on master.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #54389         +/-   ##
=================================================
- Coverage   72.8286%   55.8435%   -16.9852%     
=================================================
  Files          1530       1648        +118     
  Lines        435981     609940     +173959     
=================================================
+ Hits         317519     340612      +23093     
- Misses        98821     246706     +147885     
- Partials      19641      22622       +2981     
Flag Coverage Δ
integration 35.3724% <0.0000%> (?)

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

Components Coverage Δ
dumpling 52.9656% <ø> (ø)
parser ∅ <ø> (∅)
br 46.2404% <ø> (+0.0987%) ⬆️

@sachin-japate sachin-japate changed the title Adding the capability to filter the DDL Job History based on DDL types Filter the DDL Job History based on DDL types Jul 2, 2024
@sachin-japate sachin-japate changed the title Filter the DDL Job History based on DDL types ddl: Filter the DDL Job History based on DDL types Jul 2, 2024
@sachin-japate
Copy link
Author

/test unit-test

Copy link

tiprow bot commented Jul 2, 2024

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

  • /test fast_test_tiprow
  • /test tidb_parser_test

Use /test all to run all jobs.

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
Contributor

@lance6716 lance6716 left a comment

Choose a reason for hiding this comment

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

Thansk for your contribution. Can you add some tests to better show the usage? You can refer to

func TestAllHistory(t *testing.T) {

@D3Hunter
Copy link
Contributor

D3Hunter commented Jul 2, 2024

/hold

features require discussion first

@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 Jul 2, 2024
Copy link

ti-chi-bot bot commented Jul 3, 2024

[FORMAT CHECKER NOTIFICATION]

Notice: To remove the do-not-merge/needs-tests-checked label, please finished the tests then check the finished items in description.

For example:

Tests

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

📖 For more info, you can check the "Contribute Code" section in the development guide.

Copy link

tiprow bot commented Jul 3, 2024

@sachin-japate: 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 ccba9d5 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.

Copy link

ti-chi-bot bot commented Jul 3, 2024

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

Test name Commit Details Required Rerun command
idc-jenkins-ci-tidb/check_dev_2 ccba9d5 link true /test check-dev2
idc-jenkins-ci-tidb/unit-test ccba9d5 link true /test unit-test

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

@sachin-japate sachin-japate deleted the filter-ddlhistory branch July 3, 2024 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. do-not-merge/needs-tests-checked do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. ok-to-test Indicates a PR is ready to be tested. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Filter the DDL Job History based on DDL types
5 participants