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: add table id in resource tag #55555

Merged
merged 5 commits into from
Sep 10, 2024
Merged

Conversation

nolouch
Copy link
Member

@nolouch nolouch commented Aug 21, 2024

What problem does this PR solve?

Issue Number: ref #55540
Problem Summary:
*: add table id in resource tag

What changed and how does it work?

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.

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 do-not-merge/needs-tests-checked release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 21, 2024
@nolouch nolouch force-pushed the add-label1 branch 2 times, most recently from 6171494 to cff6f74 Compare August 21, 2024 16:50
Copy link

codecov bot commented Aug 27, 2024

Codecov Report

Attention: Patch coverage is 84.14634% with 13 lines in your changes missing coverage. Please review.

Project coverage is 57.1252%. Comparing base (a6c83ba) to head (5b81246).
Report is 3 commits behind head on master.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #55555         +/-   ##
=================================================
- Coverage   72.8605%   57.1252%   -15.7353%     
=================================================
  Files          1605       1755        +150     
  Lines        446214     631878     +185664     
=================================================
+ Hits         325114     360962      +35848     
- Misses       101062     246321     +145259     
- Partials      20038      24595       +4557     
Flag Coverage Δ
integration 39.7604% <76.8292%> (?)
unit 72.4008% <84.1463%> (+0.4208%) ⬆️

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

Components Coverage Δ
dumpling 52.9567% <ø> (ø)
parser ∅ <ø> (∅)
br 63.1318% <ø> (+17.3876%) ⬆️

@nolouch nolouch force-pushed the add-label1 branch 4 times, most recently from 6a4eb54 to 291022e Compare August 27, 2024 09:39
@nolouch nolouch force-pushed the add-label1 branch 2 times, most recently from 37ba9b4 to c70e529 Compare August 27, 2024 16:06
Signed-off-by: nolouch <nolouch@gmail.com>
pkg/kv/kv.go Outdated Show resolved Hide resolved
tag.PlanDigest = b.planDigest.Bytes()
}
if len(key) > 0 {
tag.TableId = decodeTableID(key)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to consider any error cases here?

Copy link
Member Author

Choose a reason for hiding this comment

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

If the decoded fails, it will be tagged as 0.

Copy link
Contributor

Choose a reason for hiding this comment

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

I've no idea, do we need to distinguish real '0' with the error '0'?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think no need, and the real table_id must be greater than 0, https://github.com/pingcap/tidb/blob/master/pkg/meta/meta.go#L253-L254

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it

@@ -125,6 +125,12 @@ func GetFirstKeyFromRequest(req *tikvrpc.Request) (firstKey []byte) {
}
}
}
case *kvrpcpb.PessimisticLockRequest:
Copy link
Contributor

Choose a reason for hiding this comment

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

Why add this new case?

Copy link
Member Author

Choose a reason for hiding this comment

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

I just think it was missing, so I added it.

pkg/kv/kv.go Show resolved Hide resolved
Signed-off-by: nolouch <nolouch@gmail.com>
Copy link
Contributor

@yibin87 yibin87 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 needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Sep 6, 2024
@nolouch
Copy link
Member Author

nolouch commented Sep 9, 2024

/retest-required

@nolouch
Copy link
Member Author

nolouch commented Sep 9, 2024

PTAL @XuHuaiyu

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

ti-chi-bot bot commented Sep 9, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-09-06 08:47:24.694686576 +0000 UTC m=+514.435110514: ☑️ agreed by yibin87.
  • 2024-09-09 10:07:05.529750448 +0000 UTC m=+264495.270174388: ☑️ agreed by crazycs520.

@nolouch nolouch changed the title *: add table id in resource tag TopSQL: add table id in resource tag Sep 10, 2024
Copy link

ti-chi-bot bot commented Sep 10, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: crazycs520, tangenta, XuHuaiyu, yibin87

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 the approved label Sep 10, 2024
@ti-chi-bot ti-chi-bot bot merged commit c8732f7 into pingcap:master Sep 10, 2024
25 checks passed
Benjamin2037 pushed a commit to Benjamin2037/tidb that referenced this pull request Sep 11, 2024
@nolouch nolouch deleted the add-label1 branch September 19, 2024 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none Denotes a PR that doesn't merit a release note. 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.

5 participants