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
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add task id info in explain statement for mpp
  • Loading branch information
windtalker committed Dec 28, 2020
commit e3b786b9bd60d898e8d00d6a7516b029d4f82aba
2 changes: 1 addition & 1 deletion executor/mpp_gather.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,14 @@ func (e *MPPGather) appendMPPDispatchReq(pf *plannercore.Fragment, tasks []*kv.M
return nil
}


func CollectPlanIDS(plan plannercore.PhysicalPlan, ids []int) []int {
ids = append(ids, plan.ID())
for _, child := range plan.Children() {
ids = CollectPlanIDS(child, ids)
}
return ids
}

// Open decides the task counts and locations and generate exchange operators for every plan fragment.
// Then dispatch tasks to tiflash stores. If any task fails, it would cancel the rest tasks.
func (e *MPPGather) Open(ctx context.Context) (err error) {
Expand Down
8 changes: 8 additions & 0 deletions planner/core/explain.go
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,14 @@ func (p *PhysicalExchangeSender) ExplainInfo() string {
fmt.Fprintf(buffer, "HashPartition")
fmt.Fprintf(buffer, ", Hash Cols: %s", expression.ExplainColumnList(p.HashCols))
}
fmt.Fprintf(buffer, "tasks: [")
for idx, task := range p.Tasks {
if idx != 0 {
fmt.Fprintf(buffer, ", ")
}
fmt.Fprintf(buffer, "%v", task.ID)
}
fmt.Fprintf(buffer, "]")
return buffer.String()
}

Expand Down
4 changes: 2 additions & 2 deletions store/tikv/mpp.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ func (c *MPPClient) ConstructMPPTasks(ctx context.Context, req *kv.MPPBuildTasks

// mppResponse wraps mpp data packet.
type mppResponse struct {
pbResp *mpp.MPPDataPacket
detail *CopRuntimeStats
pbResp *mpp.MPPDataPacket
detail *CopRuntimeStats
respTime time.Duration
respSize int64

Expand Down
12 changes: 6 additions & 6 deletions util/execdetails/execdetails.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,9 @@ func (crs *CopRuntimeStats) RecordOneCopTask(address string, summary *tipb.Execu
defer crs.Unlock()
crs.stats[address] = append(crs.stats[address],
&BasicRuntimeStats{loop: int32(*summary.NumIterations),
consume: int64(*summary.TimeProcessedNs),
rows: int64(*summary.NumProducedRows),
concurrency: maxInt32(1, int32(summary.GetConcurrency()))})
consume: int64(*summary.TimeProcessedNs),
rows: int64(*summary.NumProducedRows),
concurrency: maxInt32(1, int32(summary.GetConcurrency()))})
}

// GetActRows return total rows of CopRuntimeStats.
Expand Down Expand Up @@ -571,9 +571,9 @@ func (e *BasicRuntimeStats) GetActRows() int64 {
// Clone implements the RuntimeStats interface.
func (e *BasicRuntimeStats) Clone() RuntimeStats {
return &BasicRuntimeStats{
loop: e.loop,
consume: e.consume,
rows: e.rows,
loop: e.loop,
consume: e.consume,
rows: e.rows,
concurrency: e.concurrency,
}
}
Expand Down