-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
executor: add the missed runtime stats when the index merge partial task returns 0 row #35297
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Code Coverage Details: https://codecov.io/github/pingcap/tidb/commit/ed39731f531c799b6baad9984d5e72e69a546a3c |
@@ -820,6 +820,9 @@ func (w *partialIndexWorker) fetchHandles( | |||
return count, err | |||
} | |||
if len(handles) == 0 { | |||
if basicStats != nil { | |||
basicStats.Record(time.Since(start), chk.NumRows()) |
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.
What does the chk.NumRows()
mean for partialIndexWorker?
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.
This line of code is the same as this line in the same function:
tidb/executor/index_merge_reader.go
Line 840 in b91bdd0
basicStats.Record(time.Since(start), chk.NumRows()) |
I just copied it here.
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.
Theoretically, it should be the actual row count of this operator but in fact, it's useless.
Because the root operator of a partial worker has both root stats and cop stats, and according to getRuntimeInfo()
, in this case, the actual row count in the cop stats will be used:
tidb/planner/core/common_plans.go
Lines 1514 to 1528 in b91bdd0
if runtimeStatsColl.ExistsRootStats(explainID) { | |
rootStats := runtimeStatsColl.GetRootStats(explainID) | |
analyzeInfo = rootStats.String() | |
actRows = strconv.FormatInt(rootStats.GetActRows(), 10) | |
} else { | |
actRows = "0" | |
} | |
if runtimeStatsColl.ExistsCopStats(explainID) { | |
if len(analyzeInfo) > 0 { | |
analyzeInfo += ", " | |
} | |
copStats := runtimeStatsColl.GetCopStats(explainID) | |
analyzeInfo += copStats.String() | |
actRows = strconv.FormatInt(copStats.GetActRows(), 10) | |
} |
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.
LGTM
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 97f3394
|
/run-unit-test |
/run-mysql-test |
TiDB MergeCI notify✅ Well Done! New fixed [1] after this pr merged.
|
* upstream/master: sessionctx: support encoding and decoding session variables (pingcap#35531) planner: add batch_point_get access object (pingcap#35230) sessionctx: set skipInit false for TiDBOptProjectionPushDown and TiDBOptAggPushDown (pingcap#35491) *: add support for disabling noop variables (pingcap#35496) lightning: add store write limiter (pingcap#35193) expression: avoid padding 0 when implicitly cast to binary (pingcap#35053) types: fix creating partition tables fail in ANSI_QUOTES mode (pingcap#35379) executor: add the missed runtime stats when the index merge partial task returns 0 row (pingcap#35297) statistics: batch insert topn and bucket when saving table stats (pingcap#35326) parser: Add support for INTERVAL expr unit + expr (pingcap#30253) (pingcap#35390) config: add missing nodelay example (pingcap#35255) *: Introduce `OptimisticTxnContextProvider` for optimistic txn (pingcap#35131) statistics: fix panic when using wrong globalStats.Indices key (pingcap#35424) *: fix store token is up to the limit in test (pingcap#35374) *: enable more flaky and update bazel config (pingcap#35500) ddl: expose getPrimaryKey() as a public method of model.TableInfo (pingcap#35512) expression, util: add `KeyWithoutTrimRightSpace` for collator (pingcap#35475) infoschema: try on each PD member until one succeeds or all fail (pingcap#35285)
What problem does this PR solve?
Issue Number: close #35296
Problem Summary:
If the there is no more handle, the time for this cop task execution is not recorded.
What is changed and how it works?
Record the missed information.
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.