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

fix: fix not show plan issue (#1748) #1751

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 6 additions & 4 deletions pkg/apiserver/slowquery/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,15 @@ func (s *Service) getDetails(c *gin.Context) {
// See: https://github.com/pingcap/tidb-dashboard/issues/1515
if result.BinaryPlan != "" {
// may failed but it's ok
result.BinaryPlanText, _ = utils.GenerateBinaryPlanText(db, result.BinaryPlan)
result.BinaryPlanText, err = utils.GenerateBinaryPlanText(db, result.BinaryPlan)
// may failed but it's ok
result.BinaryPlanJSON, _ = utils.GenerateBinaryPlanJSON(result.BinaryPlan)

// reduce response size
result.BinaryPlan = ""
result.Plan = ""
if err == nil {
// reduce response size
result.BinaryPlan = ""
result.Plan = ""
}
}

c.JSON(http.StatusOK, *result)
Expand Down
10 changes: 6 additions & 4 deletions pkg/apiserver/statement/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,15 @@ func (s *Service) planDetailHandler(c *gin.Context) {

if result.AggBinaryPlan != "" {
// may failed but it's ok
result.BinaryPlanText, _ = utils.GenerateBinaryPlanText(db, result.AggBinaryPlan)
result.BinaryPlanText, err = utils.GenerateBinaryPlanText(db, result.AggBinaryPlan)
// may failed but it's ok
result.BinaryPlanJSON, _ = utils.GenerateBinaryPlanJSON(result.AggBinaryPlan)

// reduce response size
result.AggBinaryPlan = ""
result.AggPlan = ""
if err == nil {
// reduce response size
result.AggBinaryPlan = ""
result.AggPlan = ""
}
}

c.JSON(http.StatusOK, result)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ function DetailPage() {
)
})()}
</Descriptions>
{(binaryPlanObj || !!data.plan) && (
{(!!data.binary_plan_text || !!data.plan) && (
<>
<Space size="middle" style={{ color: '#8c8c8c' }}>
{t('slow_query.detail.plan.title')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ function PlanDetail({ query }: IPlanDetailProps) {
) : null}
</Descriptions>

{(binaryPlanObj || !!data.plan) && (
{(!!data.binary_plan_text || !!data.plan) && (
<>
<Space size="middle" style={{ color: '#8c8c8c' }}>
{t('statement.pages.detail.desc.plans.execution.title')}
Expand Down
Loading