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: support tracking histogram #36170

Merged
merged 37 commits into from
Jul 28, 2022

Conversation

Yisaer
Copy link
Contributor

@Yisaer Yisaer commented Jul 13, 2022

What problem does this PR solve?

Issue Number: ref #34052

Problem Summary:

What is changed and how it works?

Check List

Tests

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

test report

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

Yisaer added 23 commits June 2, 2022 16:45
Signed-off-by: yisaer <[email protected]>
Signed-off-by: yisaer <[email protected]>

make loaded atomic

Signed-off-by: yisaer <[email protected]>
Signed-off-by: yisaer <[email protected]>
Signed-off-by: yisaer <[email protected]>

add size metrics

Signed-off-by: yisaer <[email protected]>

Revert "add size metrics"

This reverts commit 05b06a3f4f3ad98ae3f6ca389db2fc8ccc193dc4.
Signed-off-by: yisaer <[email protected]>
Signed-off-by: yisaer <[email protected]>
Signed-off-by: yisaer <[email protected]>
Signed-off-by: yisaer <[email protected]>

add comment

Signed-off-by: yisaer <[email protected]>
This reverts commit e25e725.
Signed-off-by: yisaer <[email protected]>
Signed-off-by: yisaer <[email protected]>
Signed-off-by: yisaer <[email protected]>
Signed-off-by: yisaer <[email protected]>

fix test

Signed-off-by: yisaer <[email protected]>

fix test

Signed-off-by: yisaer <[email protected]>

use topn

Signed-off-by: yisaer <[email protected]>

fix test

Signed-off-by: yisaer <[email protected]>

fix test

Signed-off-by: yisaer <[email protected]>

fix test

Signed-off-by: yisaer <[email protected]>

fix test

Signed-off-by: yisaer <[email protected]>

fix test

Signed-off-by: yisaer <[email protected]>

fix test

Signed-off-by: yisaer <[email protected]>

Revert "fix test"

This reverts commit bdaa13a04a475df129e40ffbc70a16064df37886.

Revert "fix test"

This reverts commit a206543ea2ac7712d6a1f2748d1acb50ff0f426f.

Revert "fix test"

This reverts commit 290d516009f6f92711a9b4a73d5c90f7051413c2.

Revert "fix test"

This reverts commit f29737ace34c3174af4e64943640675f2aaa1178.
Signed-off-by: yisaer <[email protected]>
Signed-off-by: yisaer <[email protected]>
Signed-off-by: yisaer <[email protected]>
Signed-off-by: yisaer <[email protected]>
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Jul 13, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • chrysan
  • xuyifangreeneyes

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/work-in-progress Indicates that a PR should not merge because it is a work in progress. 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 Jul 13, 2022
Yisaer added 3 commits July 15, 2022 10:42
Signed-off-by: yisaer <[email protected]>
Signed-off-by: yisaer <[email protected]>
Signed-off-by: yisaer <[email protected]>
@Yisaer Yisaer force-pushed the support_tracking_hist branch from 986e237 to ea4d45f Compare July 21, 2022 03:03
Yisaer added 2 commits July 21, 2022 11:13
Signed-off-by: yisaer <[email protected]>
Signed-off-by: yisaer <[email protected]>
statistics/handle/lru_cache.go Show resolved Hide resolved
statistics/handle/lru_cache.go Show resolved Hide resolved
statistics/histogram.go Outdated Show resolved Hide resolved
func (c *Column) dropHist() {
c.Histogram.Bounds = chunk.NewChunkWithCapacity([]*types.FieldType{types.NewFieldType(mysql.TypeBlob)}, 0)
c.Histogram.Buckets = make([]Bucket, 0)
c.Histogram.scalars = make([]scalar, 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we just set Bounds, Buckets and scalars to nil?

Copy link
Contributor Author

@Yisaer Yisaer Jul 27, 2022

Choose a reason for hiding this comment

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

This may cause panic in some Histogram functions which are hard to cover, thus I tend to set it as empty slice.

@@ -139,8 +139,11 @@ func (hg *Histogram) MemoryUsage() (sum int64) {
if hg == nil {
return
}
if len(hg.Buckets) == 0 && len(hg.scalars) == 0 && hg.Bounds.Capacity() == 0 {
return
Copy link
Contributor

Choose a reason for hiding this comment

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

hg still takes EmptyHistogramSize if it is not nil?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, but we will think it as 0, the difference is acceptable.

@sre-bot
Copy link
Contributor

sre-bot commented Jul 27, 2022

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Jul 27, 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 Jul 28, 2022
@Yisaer
Copy link
Contributor Author

Yisaer commented Jul 28, 2022

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 1c04420

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jul 28, 2022
@ti-chi-bot ti-chi-bot merged commit 212d62e into pingcap:master Jul 28, 2022
@sre-bot
Copy link
Contributor

sre-bot commented Jul 28, 2022

TiDB MergeCI notify

🔴 Bad News! New failing [1] after this pr merged.
These new failed integration tests seem to be caused by the current PR, please try to fix these new failed integration tests, thanks!

CI Name Result Duration Compare with Parent commit
idc-jenkins-ci-tidb/integration-common-test 🟥 failed 1, success 16, total 17 32 min New failing
idc-jenkins-ci/integration-cdc-test 🟢 all 36 tests passed 29 min Existing passed
idc-jenkins-ci-tidb/common-test 🟢 all 11 tests passed 17 min Existing passed
idc-jenkins-ci-tidb/integration-ddl-test 🟢 all 6 tests passed 7 min 46 sec Existing passed
idc-jenkins-ci-tidb/sqllogic-test-2 🟢 all 28 tests passed 6 min 15 sec Existing passed
idc-jenkins-ci-tidb/tics-test 🟢 all 1 tests passed 6 min 6 sec Existing passed
idc-jenkins-ci-tidb/sqllogic-test-1 🟢 all 26 tests passed 5 min 14 sec Existing passed
idc-jenkins-ci-tidb/mybatis-test 🟢 all 1 tests passed 4 min 0 sec Existing passed
idc-jenkins-ci-tidb/integration-compatibility-test 🟢 all 1 tests passed 3 min 19 sec Existing passed
idc-jenkins-ci-tidb/plugin-test 🟢 build success, plugin test success 4min Existing passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. 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.

5 participants