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

*: add global sort related metric and fix cancel add index #47485

Merged
merged 18 commits into from
Oct 17, 2023

Conversation

wjhuang2016
Copy link
Member

@wjhuang2016 wjhuang2016 commented Oct 9, 2023

What problem does this PR solve?

Issue Number: ref #45719 and close #47715 #47534

Problem Summary:
Add global sort related metric.

What is changed and how it works?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
image
  • 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

Signed-off-by: wjhuang2016 <[email protected]>
@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 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. labels Oct 9, 2023
@codecov
Copy link

codecov bot commented Oct 9, 2023

Codecov Report

Merging #47485 (6709be1) into master (4b0b47c) will increase coverage by 0.8911%.
Report is 11 commits behind head on master.
The diff coverage is 98.7804%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #47485        +/-   ##
================================================
+ Coverage   71.9282%   72.8194%   +0.8911%     
================================================
  Files          1396       1421        +25     
  Lines        404781     411938      +7157     
================================================
+ Hits         291152     299971      +8819     
+ Misses        94027      93126       -901     
+ Partials      19602      18841       -761     
Flag Coverage Δ
integration 41.3468% <67.0731%> (?)
unit 71.9481% <98.7804%> (+0.0198%) ⬆️

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

Components Coverage Δ
dumpling 53.9913% <ø> (ø)
parser ∅ <ø> (∅)
br 48.6947% <100.0000%> (-4.2354%) ⬇️

Signed-off-by: wjhuang2016 <[email protected]>
Signed-off-by: wjhuang2016 <[email protected]>
@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 10, 2023
Signed-off-by: wjhuang2016 <[email protected]>
Signed-off-by: wjhuang2016 <[email protected]>
Signed-off-by: wjhuang2016 <[email protected]>
Signed-off-by: wjhuang2016 <[email protected]>
Signed-off-by: wjhuang2016 <[email protected]>
Signed-off-by: wjhuang2016 <[email protected]>
@ti-chi-bot ti-chi-bot bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. do-not-merge/needs-linked-issue labels Oct 16, 2023
@wjhuang2016 wjhuang2016 changed the title WIP *: add global sort related metric Oct 16, 2023
Signed-off-by: wjhuang2016 <[email protected]>
Signed-off-by: wjhuang2016 <[email protected]>
Signed-off-by: wjhuang2016 <[email protected]>
Signed-off-by: wjhuang2016 <[email protected]>
Signed-off-by: wjhuang2016 <[email protected]>
Signed-off-by: wjhuang2016 <[email protected]>
Signed-off-by: wjhuang2016 <[email protected]>
}
if iter.Error() != nil {
return nil, errors.Trace(iter.Error())
}

metrics.GlobalSortReadFromCloudStorageRate.WithLabelValues("read_and_sort").Observe(float64(totalSize) / 1024.0 / 1024.0 / time.Since(startTs).Seconds())
Copy link
Contributor

Choose a reason for hiding this comment

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

for hot path we should cache the result of WithLabelValues to avoid the inner lookup.

@@ -229,6 +229,8 @@ func (i *mergeIter[T, R]) next() bool {
// currently only one reader will become hotspot
if cnt > (checkHotspotPeriod / 2) {
i.lastHotspotIdx = idx

logutil.BgLogger().Info("new hotspot reader", zap.Any("idx", i.lastHotspotIdx), zap.Any("cnt", cnt))
Copy link
Contributor

Choose a reason for hiding this comment

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

I remember the comment of Any says it's a bit slower, we can use zap.Int64 instead

Copy link
Member Author

Choose a reason for hiding this comment

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

It's for debug, I forgot to remove it

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Oct 16, 2023
Signed-off-by: wjhuang2016 <[email protected]>
@ti-chi-bot
Copy link

ti-chi-bot bot commented Oct 17, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lance6716, ywqzzy

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 lgtm label Oct 17, 2023
@ywqzzy
Copy link
Contributor

ywqzzy commented Oct 17, 2023

/retest

@ti-chi-bot ti-chi-bot bot removed the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Oct 17, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Oct 17, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-10-16 11:52:02.870331433 +0000 UTC m=+1657920.457441579: ☑️ agreed by lance6716.
  • 2023-10-17 02:34:31.24161649 +0000 UTC m=+1710868.828726634: ☑️ agreed by ywqzzy.

@ti-chi-bot ti-chi-bot bot merged commit 5ac13d9 into pingcap:master Oct 17, 2023
4 checks passed
@D3Hunter
Copy link
Contributor

/cherry-pick release-7.5

@ti-chi-bot
Copy link
Member

@D3Hunter: new pull request created to branch release-7.5: #47710.

In response to this:

/cherry-pick release-7.5

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 ti-community-infra/tichi repository.

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Oct 17, 2023
@wjhuang2016 wjhuang2016 changed the title *: add global sort related metric *: add global sort related metric and fix cancel add index Oct 17, 2023
wuhuizuo pushed a commit to wuhuizuo/tidb that referenced this pull request Apr 2, 2024
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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cancel add index using global sort may be blocked
5 participants