-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
statstics: reuse fmsketch #47070
statstics: reuse fmsketch #47070
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #47070 +/- ##
================================================
- Coverage 72.9633% 72.6115% -0.3519%
================================================
Files 1337 1358 +21
Lines 399007 405580 +6573
================================================
+ Hits 291129 294498 +3369
- Misses 89075 92380 +3305
+ Partials 18803 18702 -101
Flags with carried forward coverage won't be shown. Click here to find out more.
|
d704319
to
882572e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the logic in this PR is very fragile.
In this PR:
- We put back the
allFms
in the pool inMergePartitionStats2GlobalStats
- We put back the
GlobalStats.Fms
in the pool inhandleGlobalStats
andupdateGlobalStats
, which is returned fromMergePartitionStats2GlobalStats
- We put back the
tableAllPartitionStats.Column.FMSketch
in the pool inhandleGlobalStats
, which is also created inMergePartitionStats2GlobalStats
.
The assumptions are very fragile, if we share structs in any two of the above three places, there will be bugs. And it's hard to realize this, because we put them back in the pool in totally different places.
And we are handling the logic inconsistently. |
My suggestion is to do all the |
In fact, we optimize the two places. 1、create FM sketch from the NewFmSketch all the implements create Fmsketch from the pool and release Fmsketch at the end of the lift. the root cause is at the |
I have refactor this code. Now we have an external cache in the mergeGlobalStatus. if it is not from the external, we will release it in the |
Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
2d79e44
to
4f718d4
Compare
// initialized the globalStats | ||
globalStats = new(GlobalStats) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we don't need this. We initiate globalStats
below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
// ReleaseAndPutToPool releases data structures of Table and put itself back to pool. | ||
func (t *Table) ReleaseAndPutToPool() { | ||
for _, col := range t.Columns { | ||
col.FMSketch.DestroyAndPutToPool() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's safer to set FMSketch
to nil
after putting to the pool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok to me to improve them in another PR or in another way at your convenience.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done,use map.clear
to clean it.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: qw4990, time-and-fate 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 |
[LGTM Timeline notifier]Timeline:
|
@hawkingrei: The following test failed, say
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. |
/retest |
/cherrypick release-6.5 |
@hawkingrei: new pull request created to branch In response to this:
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. |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
What problem does this PR solve?
Issue Number: close #47071
Problem Summary:
What is changed and how it works?
Check List
Tests
before:
after:
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.