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

topsql: fix the issue of TiDB doesn't set the request tag for DDL before send RPC request to TiKV #33133

Merged
merged 14 commits into from
Mar 17, 2022

Conversation

crazycs520
Copy link
Contributor

@crazycs520 crazycs520 commented Mar 16, 2022

What problem does this PR solve?

Issue Number: close #33132

Problem Summary: This PR fix the issue of TiDB doesn't set the request tag for DDL before send rpc to TiKV.

What is changed and how it works?

Set the DDL request tag.

Other problem: After this PR, TopSQL still doesn't contain the scan_row/scan_index data , I will fix this in next PR.

Check List

Tests

  • Manual test (add detailed scripts or steps below)
  1. create a table and insert 10000000 rows data.
CREATE TABLE `t_full_table_scan` (
  `a` bigint(20) NOT NULL,
  `b` bigint(20) DEFAULT NULL,
  `c` timestamp(6) NULL DEFAULT NULL,
  `d` varchar(100) DEFAULT NULL,
  `e` decimal(30,8) DEFAULT NULL,
  PRIMARY KEY (`a`)
);
  1. execute following DDL:
alter table t_full_table_scan add index idx2 (c,d,b);
alter table t_full_table_scan modify column e decimal(30, 8);
  1. check the topsql UI in tidb-dashboard.

TiDB:
image

TiKV:
image

Release note

None

Signed-off-by: crazycs520 <[email protected]>
Signed-off-by: crazycs520 <[email protected]>
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Mar 16, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • breeswish
  • zhongzc

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 do-not-merge/needs-triage-completed release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 16, 2022
@sre-bot
Copy link
Contributor

sre-bot commented Mar 16, 2022

@ti-chi-bot ti-chi-bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 16, 2022
Signed-off-by: crazycs520 <[email protected]>
Signed-off-by: crazycs520 <[email protected]>
@crazycs520
Copy link
Contributor Author

/run-all-tests

sqlDigests map[stmtstats.BinaryDigest]struct{}
}

func (c *resourceTagChecker) checkExist(t *testing.T, digest stmtstats.BinaryDigest, sqlStr string) {
Copy link
Member

Choose a reason for hiding this comment

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

How about checkExist for all requests happened in the test suite? In this way, when there are new kind of requests, it will be caught.

Copy link
Contributor

Choose a reason for hiding this comment

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

I have a similar thought: require all requests to contain tags.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not all RPC requests are caused by SQL. So I can't check the all request. But maybe I can check the ALL cop kind RPC request, since as I know, cop kind request must cause by SQL.

Copy link
Member

@breezewish breezewish Mar 17, 2022

Choose a reason for hiding this comment

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

Instead of using white allow list that only checks cop requests, maybe we can use black block lists to check all requests except for some kinds. In this way, when there are new kind of RPC requests, people must review, check and change the test case in order to pass CI. Is this possible?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will refine this test in this issue later. #33208

@breezewish
Copy link
Member

This PR should not close #33132 since it does not fully resolve the issue.

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Mar 17, 2022
@crazycs520
Copy link
Contributor Author

This PR should not close #33132 since it does not fully resolve the issue.

Great, I already changed the issue description.

@breezewish
Copy link
Member

This PR should not close #33132 since it does not fully resolve the issue.

Great, I already changed the issue description.

@crazycs520 This is a nice workaround. Just remember to also fix remaining problems. You may like to open new issues to track them.

@ti-chi-bot ti-chi-bot added the needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. label Mar 17, 2022
@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 Mar 17, 2022
@crazycs520
Copy link
Contributor Author

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 80ccb7d

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Mar 17, 2022
@crazycs520
Copy link
Contributor Author

/merge

@ti-chi-bot ti-chi-bot merged commit e8ee6c1 into pingcap:master Mar 17, 2022
@crazycs520 crazycs520 deleted the topsql-ddl-tag branch March 17, 2022 08:18
ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Mar 17, 2022
@ti-srebot
Copy link
Contributor

cherry pick to release-5.4 in PR #33210

@ti-srebot
Copy link
Contributor

cherry pick to release-6.0 failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 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.

TiKV Top SQL failed to catch the CPU of DDL executions
6 participants