Skip to content

Commit 4b07633

Browse files
ti-chi-botbaurine
authored andcommitted
fix: fix not show plan issue (#1748) (#1751)
1 parent 0ef175a commit 4b07633

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

pkg/apiserver/slowquery/service.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,15 @@ func (s *Service) getDetails(c *gin.Context) {
109109
// See: https://github.com/pingcap/tidb-dashboard/issues/1515
110110
if result.BinaryPlan != "" {
111111
// may failed but it's ok
112-
result.BinaryPlanText, _ = utils.GenerateBinaryPlanText(db, result.BinaryPlan)
112+
result.BinaryPlanText, err = utils.GenerateBinaryPlanText(db, result.BinaryPlan)
113113
// may failed but it's ok
114114
result.BinaryPlanJSON, _ = utils.GenerateBinaryPlanJSON(result.BinaryPlan)
115115

116-
// reduce response size
117-
result.BinaryPlan = ""
118-
result.Plan = ""
116+
if err == nil {
117+
// reduce response size
118+
result.BinaryPlan = ""
119+
result.Plan = ""
120+
}
119121
}
120122

121123
c.JSON(http.StatusOK, *result)

pkg/apiserver/statement/service.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,13 +237,15 @@ func (s *Service) planDetailHandler(c *gin.Context) {
237237

238238
if result.AggBinaryPlan != "" {
239239
// may failed but it's ok
240-
result.BinaryPlanText, _ = utils.GenerateBinaryPlanText(db, result.AggBinaryPlan)
240+
result.BinaryPlanText, err = utils.GenerateBinaryPlanText(db, result.AggBinaryPlan)
241241
// may failed but it's ok
242242
result.BinaryPlanJSON, _ = utils.GenerateBinaryPlanJSON(result.AggBinaryPlan)
243243

244-
// reduce response size
245-
result.AggBinaryPlan = ""
246-
result.AggPlan = ""
244+
if err == nil {
245+
// reduce response size
246+
result.AggBinaryPlan = ""
247+
result.AggPlan = ""
248+
}
247249
}
248250

249251
c.JSON(http.StatusOK, result)

ui/packages/tidb-dashboard-lib/src/apps/SlowQuery/pages/Detail/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ function DetailPage() {
170170
)
171171
})()}
172172
</Descriptions>
173-
{(binaryPlanObj || !!data.plan) && (
173+
{(!!data.binary_plan_text || !!data.plan) && (
174174
<>
175175
<Space size="middle" style={{ color: '#8c8c8c' }}>
176176
{t('slow_query.detail.plan.title')}

ui/packages/tidb-dashboard-lib/src/apps/Statement/pages/Detail/PlanDetail.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ function PlanDetail({ query }: IPlanDetailProps) {
175175
) : null}
176176
</Descriptions>
177177

178-
{(binaryPlanObj || !!data.plan) && (
178+
{(!!data.binary_plan_text || !!data.plan) && (
179179
<>
180180
<Space size="middle" style={{ color: '#8c8c8c' }}>
181181
{t('statement.pages.detail.desc.plans.execution.title')}

0 commit comments

Comments
 (0)