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

execution: support explain analyze in mpp execution. #22053

Merged
merged 25 commits into from
Jan 7, 2021

Conversation

windtalker
Copy link
Contributor

What problem does this PR solve?

Issue Number: close pingcap/tiflash#1288

Problem Summary:
Currently, explain analyze does not show cop executor's execution summaries when in mpp execution mode

What is changed and how it works?

Proposal: xxx

What's Changed:

How it Works:

Collect cop executor execution summaries in mpp mode.

Related changes

  • PR to update pingcap/docs/pingcap/docs-cn:
  • Need to cherry-pick to the release branch

Check List

Tests

  • Manual test (add detailed scripts or steps below)

Side effects

  • Performance regression
    • Consumes more CPU
    • Consumes more MEM
  • Breaking backward compatibility

Release note

  • No release note

@windtalker windtalker requested review from a team as code owners December 28, 2020 08:24
@windtalker windtalker requested review from lzmhhh123 and removed request for a team December 28, 2020 08:24
@sre-bot
Copy link
Contributor

sre-bot commented Dec 28, 2020

Please follow PR Title Format:

  • pkg [, pkg2, pkg3]: what's changed

Or if the count of mainly changed packages are more than 3, use

  • *: what's changed

@windtalker windtalker changed the title support explain analyze in mpp execution. planner: support explain analyze in mpp execution. Dec 28, 2020
@github-actions github-actions bot added the sig/execution SIG execution label Dec 28, 2020
@windtalker windtalker changed the title planner: support explain analyze in mpp execution. execution: support explain analyze in mpp execution. Dec 28, 2020
@windtalker
Copy link
Contributor Author

/run-all-tests

if stats.GetCopStats(aggID).String() != "tikv_task:{proc max:4ns, min:3ns, p80:4ns, p95:4ns, iters:7, tasks:2}" {
t.Fatal("agg")
if stats.GetCopStats(aggID).String() != "tikv_task:{proc max:4ns, min:3ns, p80:4ns, p95:4ns, iters:7, tasks:2, concurrency:2}" {
t.Fatalf("agg cop stats string is not expect, got: %v", stats.GetCopStats(aggID).String())
Copy link
Contributor

Choose a reason for hiding this comment

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

expected?

Copy link
Member

Choose a reason for hiding this comment

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

more common way is "as expected"

Copy link
Member

@hanfei1991 hanfei1991 left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-srebot ti-srebot added the status/LGT1 Indicates that a PR has LGTM 1. label Dec 29, 2020
@fzhedu
Copy link
Contributor

fzhedu commented Jan 5, 2021

/run-tics-test

@@ -112,7 +112,7 @@ func (s *testSerialSuite) TestExplainFor(c *C) {
}
c.Assert(buf.String(), Matches, ""+
"TableReader_5 10000.00 0 root time:.*, loops:1, cop_task: {num:.*, max:.*, proc_keys: 0, rpc_num: 1, rpc_time:.*} data:TableFullScan_4 N/A N/A\n"+
"└─TableFullScan_4 10000.00 0 cop.* table:t1 tikv_task:{time:.*, loops:0}, scan_detail:.* keep order:false, stats:pseudo N/A N/A")
"└─TableFullScan_4 10000.00 0 cop.* table:t1 tikv_task:{time:.*, loops:0, concurrency:1}, scan_detail:.* keep order:false, stats:pseudo N/A N/A")
Copy link
Contributor

Choose a reason for hiding this comment

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

tikv_task?
should tikv tasks show concurrency?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

By default, every TiKV task has concurrency 1, I think it is at least harmless to show it for TiKV tasks, user can just ignore it.

Copy link
Contributor

Choose a reason for hiding this comment

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

you should ask the related PM.

Copy link
Member

Choose a reason for hiding this comment

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

I think keeping tikv's result still is better. No changes is better than harmless changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For TiKV, I will print threads:N/A instead

@windtalker
Copy link
Contributor Author

/run-all-tests

return &tipb.ExecutorExecutionSummary{TimeProcessedNs: &TimeProcessedNs, NumProducedRows: &NumProducedRows,
NumIterations: &NumIterations, ExecutorId: &ExecutorID, XXX_unrecognized: nil}
NumIterations: &NumIterations, Concurrency: &Concurrency, ExecutorId: &ExecutorID, XXX_unrecognized: nil}
Copy link
Contributor

Choose a reason for hiding this comment

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

why here show concurrency?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For single cop/mpp task, this field is the running concurrency of the executor.

consume: int64(*summary.TimeProcessedNs),
rows: int64(*summary.NumProducedRows)})
rows: int64(*summary.NumProducedRows)},
threads: int32(summary.GetConcurrency()),
Copy link
Contributor

Choose a reason for hiding this comment

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

getConcurrency() -> getThreads()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

getConcurrency is a method generated by protobuf

for backoff := range bo.backoffTimes {
backoffName := backoff.String()
resp.detail.BackoffTimes[backoffName] = bo.backoffTimes[backoff]
resp.detail.BackoffSleep[backoffName] = time.Duration(bo.backoffSleepMS[backoff]) * time.Millisecond
Copy link
Contributor

Choose a reason for hiding this comment

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

why *?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because time.Duration(bo.backoffSleepMS[backoff]) is Nanosecond based.

fzhedu
fzhedu previously approved these changes Jan 7, 2021
Copy link
Contributor

@fzhedu fzhedu left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-srebot ti-srebot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jan 7, 2021
ti-srebot
ti-srebot previously approved these changes Jan 7, 2021
@windtalker windtalker dismissed stale reviews from ti-srebot and fzhedu via d931ddf January 7, 2021 05:15
@fzhedu
Copy link
Contributor

fzhedu commented Jan 7, 2021

/LGTM

@fzhedu
Copy link
Contributor

fzhedu commented Jan 7, 2021

/merge

@ti-srebot ti-srebot added the status/can-merge Indicates a PR has been approved by a committer. label Jan 7, 2021
@ti-srebot
Copy link
Contributor

Your auto merge job has been accepted, waiting for:

  • 22165

@ti-srebot
Copy link
Contributor

/run-all-tests

@ti-srebot
Copy link
Contributor

@windtalker merge failed.

@windtalker
Copy link
Contributor Author

/run-e2e-test

@windtalker
Copy link
Contributor Author

/run-all-tests

Copy link
Contributor

@fzhedu fzhedu left a comment

Choose a reason for hiding this comment

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

LGTM

@windtalker
Copy link
Contributor Author

/run-all-tests

@windtalker
Copy link
Contributor Author

/run-unit-test

@fzhedu
Copy link
Contributor

fzhedu commented Jan 7, 2021

/merge

@ti-srebot
Copy link
Contributor

Your auto merge job has been accepted, waiting for:

  • 22197

@ti-srebot
Copy link
Contributor

/run-all-tests

@ti-srebot ti-srebot merged commit caa8c16 into pingcap:master Jan 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/execution SIG execution 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.

Support explain analyze for mpp
5 participants