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.
I think the logic in this PR is very fragile.
In this PR:
- We put back the
allFmsin the pool inMergePartitionStats2GlobalStats - We put back the
GlobalStats.Fmsin the pool inhandleGlobalStatsandupdateGlobalStats, which is returned fromMergePartitionStats2GlobalStats - We put back the
tableAllPartitionStats.Column.FMSketchin 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.
Looks like we don't need this. We initiate globalStats below.
| // 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.
I think it's safer to set FMSketch to nil after putting to the pool.
There was a problem hiding this comment.
Ok to me to improve them in another PR or in another way at your convenience.
There was a problem hiding this comment.
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 DetailsNeeds 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. DetailsInstructions 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 DetailsIn 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>
…anic When FMSketchFromProto and NewFMSketch retrieve an FMSketch from sync.Pool, they must call reset() to clear stale hashset state. Without this, a reused swiss.Map can have inconsistent internal metadata, causing an index-out-of-range panic in swiss.Map.Put. The bug was introduced in bb49dc1 ("statstics: reuse fmsketch", pingcap#47070) which added pool reuse but omitted the reset call. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.