Repository navigation
statistics: reduce allocation of types.Context - #52615
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #52615 +/- ##
=================================================
- Coverage 72.3860% 55.6253% -16.7607%
=================================================
Files 1482 1593 +111
Lines 428754 598394 +169640
=================================================
+ Hits 310358 332859 +22501
- Misses 99088 242580 +143492
- Partials 19308 22955 +3647
Flags with carried forward coverage won't be shown. Click here to find out more.
|
293bc35 to
c648886
Compare
c648886 to
6ada327
Compare
|
/cc |
0xPoe
left a comment
There was a problem hiding this comment.
Do you have any test results? Could you please put it on GitHub?
| // Invalid date values may be inserted into table under some relaxed sql mode. Those values may exist in statistics. | ||
| // Hence, when reading statistics, we should skip invalid date check. See #39336. | ||
| sc := ctx.GetSessionVars().StmtCtx | ||
| sc.SetTypeFlags(sc.TypeFlags().WithIgnoreInvalidDateErr(true).WithIgnoreZeroInDate(true)) |
There was a problem hiding this comment.
Could we use a function for it? Then we don't need to copy the comments and code again in other places.
There was a problem hiding this comment.
Do you have any good ideas?
I'm not sure how to make it better(
| prevSQL := s.sessionVars.StmtCtx.OriginalSQL | ||
| prevStmtType := s.sessionVars.StmtCtx.StmtType | ||
| prevTables := s.sessionVars.StmtCtx.Tables | ||
| prevTypeFlags := s.sessionVars.StmtCtx.TypeFlags() |
There was a problem hiding this comment.
Why do we need this change? Could you explain a little bit?
There was a problem hiding this comment.
The useCurrentSession will return a func as the clean func after the session executes a SQL.
We need to make sure that the CLEAN operation will not clean the flag we set.
| return prefixLens, nil | ||
| } | ||
|
|
||
| // ExtractTopN extracts topn from histogram. |
The test env is under rebuilding( |
7c679bd to
b6faed1
Compare
89487df to
3a4f760
Compare
time-and-fate
left a comment
There was a problem hiding this comment.
Please note that not all places use flags with FlagIgnoreInvalidDateErr and FlagIgnoreZeroInDateErr.
Others LGTM.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hawkingrei, 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:
|
|
/retest |
|
/cherrypick release-8.1 |
|
@winoros: 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. |
What problem does this PR solve?
Issue Number: close #52342
Problem Summary:
We still have #52429, but we can reduce the allocations first.
What changed and how does it work?
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.