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

planner: cp refactor planner module's warning and note generation logic (get rid of unnecessary stack info) (#49390) #49708

Merged
merged 3 commits into from
Dec 22, 2023
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
4 changes: 2 additions & 2 deletions DEPS.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3392,8 +3392,8 @@ def go_deps():
name = "com_github_pingcap_errors",
build_file_proto_mode = "disable_global",
importpath = "github.com/pingcap/errors",
sum = "h1:m5ZsBa5o/0CkzZXfXLaThzKuR85SnHHetqBCpzQ30h8=",
version = "v0.11.5-0.20221009092201-b66cddb77c32",
sum = "h1:yqyP+k0mgRPpXJQDOCrtaG2YZym0ZDD+vt5JzlBUkrw=",
version = "v0.11.5-0.20231212100244-799fae176cfb",
)
go_repository(
name = "com_github_pingcap_failpoint",
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ require (
github.com/opentracing/opentracing-go v1.2.0
github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2
github.com/pingcap/badger v1.5.1-0.20230103063557-828f39b09b6d
github.com/pingcap/errors v0.11.5-0.20221009092201-b66cddb77c32
github.com/pingcap/errors v0.11.5-0.20231212100244-799fae176cfb
github.com/pingcap/failpoint v0.0.0-20220801062533-2eaa32854a6c
github.com/pingcap/fn v0.0.0-20200306044125-d5540d389059
github.com/pingcap/kvproto v0.0.0-20231011074246-fa00d2b03372
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -780,8 +780,8 @@ github.com/pingcap/check v0.0.0-20200212061837-5e12011dc712/go.mod h1:PYMCGwN0JH
github.com/pingcap/errors v0.11.0/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8=
github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8=
github.com/pingcap/errors v0.11.5-0.20190809092503-95897b64e011/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8=
github.com/pingcap/errors v0.11.5-0.20221009092201-b66cddb77c32 h1:m5ZsBa5o/0CkzZXfXLaThzKuR85SnHHetqBCpzQ30h8=
github.com/pingcap/errors v0.11.5-0.20221009092201-b66cddb77c32/go.mod h1:X2r9ueLEUZgtx2cIogM0v4Zj5uvvzhuuiu7Pn8HzMPg=
github.com/pingcap/errors v0.11.5-0.20231212100244-799fae176cfb h1:yqyP+k0mgRPpXJQDOCrtaG2YZym0ZDD+vt5JzlBUkrw=
github.com/pingcap/errors v0.11.5-0.20231212100244-799fae176cfb/go.mod h1:X2r9ueLEUZgtx2cIogM0v4Zj5uvvzhuuiu7Pn8HzMPg=
github.com/pingcap/failpoint v0.0.0-20220801062533-2eaa32854a6c h1:CgbKAHto5CQgWM9fSBIvaxsJHuGP0uM74HXtv3MyyGQ=
github.com/pingcap/failpoint v0.0.0-20220801062533-2eaa32854a6c/go.mod h1:4qGtCB0QK0wBzKtFEGDhxXnSnbQApw1gc9siScUl8ew=
github.com/pingcap/fn v0.0.0-20200306044125-d5540d389059 h1:Pe2LbxRmbTfAoKJ65bZLmhahmvHm7n9DUxGRQT00208=
Expand Down
12 changes: 6 additions & 6 deletions planner/core/common_plans.go
Original file line number Diff line number Diff line change
Expand Up @@ -860,12 +860,12 @@ func (e *Explain) RenderResult() error {
// output cost formula and factor costs through warning under model ver2 and true_card_cost mode for cost calibration.
cost, _ := pp.getPlanCostVer2(property.RootTaskType, NewDefaultPlanCostOption())
trace := cost.trace
pp.SCtx().GetSessionVars().StmtCtx.AppendWarning(errors.Errorf("cost formula: %v", trace.formula))
pp.SCtx().GetSessionVars().StmtCtx.AppendWarning(errors.NewNoStackErrorf("cost formula: %v", trace.formula))
data, err := json.Marshal(trace.factorCosts)
if err != nil {
pp.SCtx().GetSessionVars().StmtCtx.AppendWarning(errors.Errorf("marshal factor costs error %v", err))
pp.SCtx().GetSessionVars().StmtCtx.AppendWarning(errors.NewNoStackErrorf("marshal factor costs error %v", err))
}
pp.SCtx().GetSessionVars().StmtCtx.AppendWarning(errors.Errorf("factor costs: %v", string(data)))
pp.SCtx().GetSessionVars().StmtCtx.AppendWarning(errors.NewNoStackErrorf("factor costs: %v", string(data)))

// output cost factor weights for cost calibration
factors := defaultVer2Factors.tolist()
Expand All @@ -876,13 +876,13 @@ func (e *Explain) RenderResult() error {
}
}
if wstr, err := json.Marshal(weights); err != nil {
pp.SCtx().GetSessionVars().StmtCtx.AppendWarning(errors.Errorf("marshal weights error %v", err))
pp.SCtx().GetSessionVars().StmtCtx.AppendWarning(errors.NewNoStackErrorf("marshal weights error %v", err))
} else {
pp.SCtx().GetSessionVars().StmtCtx.AppendWarning(errors.Errorf("factor weights: %v", string(wstr)))
pp.SCtx().GetSessionVars().StmtCtx.AppendWarning(errors.NewNoStackErrorf("factor weights: %v", string(wstr)))
}
}
} else {
e.SCtx().GetSessionVars().StmtCtx.AppendWarning(errors.Errorf("'explain format=true_card_cost' cannot support this plan"))
e.SCtx().GetSessionVars().StmtCtx.AppendWarning(errors.NewNoStackError("'explain format=true_card_cost' cannot support this plan"))
}
}

Expand Down
39 changes: 19 additions & 20 deletions planner/core/exhaust_physical_plans.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ func (p *LogicalJoin) GetMergeJoin(prop *property.PhysicalProperty, schema *expr
if p.preferJoinType&preferMergeJoin == 0 {
return nil
}
p.SCtx().GetSessionVars().StmtCtx.AppendWarning(ErrInternal.GenWithStack(
p.SCtx().GetSessionVars().StmtCtx.AppendWarning(ErrInternal.FastGen(
"Some MERGE_JOIN and NO_MERGE_JOIN hints conflict, NO_MERGE_JOIN is ignored"))
}

Expand Down Expand Up @@ -399,7 +399,7 @@ func (p *LogicalJoin) getHashJoins(prop *property.PhysicalProperty) (joins []Phy
forceLeftToBuild := ((p.preferJoinType & preferLeftAsHJBuild) > 0) || ((p.preferJoinType & preferRightAsHJProbe) > 0)
forceRightToBuild := ((p.preferJoinType & preferRightAsHJBuild) > 0) || ((p.preferJoinType & preferLeftAsHJProbe) > 0)
if forceLeftToBuild && forceRightToBuild {
p.ctx.GetSessionVars().StmtCtx.AppendWarning(ErrInternal.GenWithStack("Some HASH_JOIN_BUILD and HASH_JOIN_PROBE hints are conflicts, please check the hints"))
p.ctx.GetSessionVars().StmtCtx.AppendWarning(ErrInternal.FastGen("Some HASH_JOIN_BUILD and HASH_JOIN_PROBE hints are conflicts, please check the hints"))
forceLeftToBuild = false
forceRightToBuild = false
}
Expand All @@ -410,7 +410,7 @@ func (p *LogicalJoin) getHashJoins(prop *property.PhysicalProperty) (joins []Phy
joins = append(joins, p.getHashJoin(prop, 1, false))
if forceLeftToBuild || forceRightToBuild {
// Do not support specifying the build side.
p.ctx.GetSessionVars().StmtCtx.AppendWarning(ErrInternal.GenWithStack(fmt.Sprintf("We can't use the HASH_JOIN_BUILD or HASH_JOIN_PROBE hint for %s, please check the hint", p.JoinType)))
p.ctx.GetSessionVars().StmtCtx.AppendWarning(ErrInternal.FastGen(fmt.Sprintf("We can't use the HASH_JOIN_BUILD or HASH_JOIN_PROBE hint for %s, please check the hint", p.JoinType)))
forceLeftToBuild = false
forceRightToBuild = false
}
Expand Down Expand Up @@ -455,7 +455,7 @@ func (p *LogicalJoin) getHashJoins(prop *property.PhysicalProperty) (joins []Phy
if !forced && p.shouldSkipHashJoin() {
return nil, false
} else if forced && p.shouldSkipHashJoin() {
p.SCtx().GetSessionVars().StmtCtx.AppendWarning(ErrInternal.GenWithStack(
p.SCtx().GetSessionVars().StmtCtx.AppendWarning(ErrInternal.FastGen(
"A conflict between the HASH_JOIN hint and the NO_HASH_JOIN hint, " +
"or the tidb_opt_enable_hash_join system variable, the HASH_JOIN hint will take precedence."))
}
Expand Down Expand Up @@ -2037,13 +2037,13 @@ func (p *LogicalJoin) tryToGetIndexJoin(prop *property.PhysicalProperty) (indexJ
// Handle hints conflict first.
stmtCtx := p.SCtx().GetSessionVars().StmtCtx
if p.preferAny(preferLeftAsINLJInner, preferRightAsINLJInner) && p.preferAny(preferNoIndexJoin) {
stmtCtx.AppendWarning(ErrInternal.GenWithStack("Some INL_JOIN and NO_INDEX_JOIN hints conflict, NO_INDEX_JOIN may be ignored"))
stmtCtx.AppendWarning(ErrInternal.FastGen("Some INL_JOIN and NO_INDEX_JOIN hints conflict, NO_INDEX_JOIN may be ignored"))
}
if p.preferAny(preferLeftAsINLHJInner, preferRightAsINLHJInner) && p.preferAny(preferNoIndexHashJoin) {
stmtCtx.AppendWarning(ErrInternal.GenWithStack("Some INL_HASH_JOIN and NO_INDEX_HASH_JOIN hints conflict, NO_INDEX_HASH_JOIN may be ignored"))
stmtCtx.AppendWarning(ErrInternal.FastGen("Some INL_HASH_JOIN and NO_INDEX_HASH_JOIN hints conflict, NO_INDEX_HASH_JOIN may be ignored"))
}
if p.preferAny(preferLeftAsINLMJInner, preferRightAsINLMJInner) && p.preferAny(preferNoIndexMergeJoin) {
stmtCtx.AppendWarning(ErrInternal.GenWithStack("Some INL_MERGE_JOIN and NO_INDEX_MERGE_JOIN hints conflict, NO_INDEX_MERGE_JOIN may be ignored"))
stmtCtx.AppendWarning(ErrInternal.FastGen("Some INL_MERGE_JOIN and NO_INDEX_MERGE_JOIN hints conflict, NO_INDEX_MERGE_JOIN may be ignored"))
}

candidates, canForced = p.handleForceIndexJoinHints(prop, candidates)
Expand Down Expand Up @@ -2123,7 +2123,7 @@ func (p *LogicalJoin) handleForceIndexJoinHints(prop *property.PhysicalProperty,
errMsg += " without column equal ON condition"
}
// Generate warning message to client.
p.SCtx().GetSessionVars().StmtCtx.AppendWarning(ErrInternal.GenWithStack(errMsg))
p.SCtx().GetSessionVars().StmtCtx.AppendWarning(ErrInternal.FastGen(errMsg))
}
return candidates, false
}
Expand Down Expand Up @@ -2268,7 +2268,7 @@ func (p *LogicalJoin) exhaustPhysicalPlans(prop *property.PhysicalProperty) ([]P
if !isJoinHintSupportedInMPPMode(p.preferJoinType) {
if hasMPPJoinHints(p.preferJoinType) {
// If there are MPP hints but has some conflicts join method hints, all the join hints are invalid.
p.SCtx().GetSessionVars().StmtCtx.AppendWarning(ErrInternal.GenWithStack("The MPP join hints are in conflict, and you can only specify join method hints that are currently supported by MPP mode now"))
p.SCtx().GetSessionVars().StmtCtx.AppendWarning(ErrInternal.FastGen("The MPP join hints are in conflict, and you can only specify join method hints that are currently supported by MPP mode now"))
p.preferJoinType = 0
} else {
// If there are no MPP hints but has some conflicts join method hints, the MPP mode will be blocked.
Expand Down Expand Up @@ -2313,7 +2313,7 @@ func (p *LogicalJoin) exhaustPhysicalPlans(prop *property.PhysicalProperty) ([]P
hasMppHints = true
}
if hasMppHints {
warning := ErrInternal.GenWithStack(errMsg)
warning := ErrInternal.FastGen(errMsg)
p.ctx.GetSessionVars().StmtCtx.AppendWarning(warning)
}
}
Expand Down Expand Up @@ -2435,7 +2435,7 @@ func (p *LogicalJoin) tryToGetMppHashJoin(prop *property.PhysicalProperty, useBC
forceLeftToBuild := ((p.preferJoinType & preferLeftAsHJBuild) > 0) || ((p.preferJoinType & preferRightAsHJProbe) > 0)
forceRightToBuild := ((p.preferJoinType & preferRightAsHJBuild) > 0) || ((p.preferJoinType & preferLeftAsHJProbe) > 0)
if forceLeftToBuild && forceRightToBuild {
p.ctx.GetSessionVars().StmtCtx.AppendWarning(ErrInternal.GenWithStack("Some HASH_JOIN_BUILD and HASH_JOIN_PROBE hints are conflicts, please check the hints"))
p.ctx.GetSessionVars().StmtCtx.AppendWarning(ErrInternal.FastGen("Some HASH_JOIN_BUILD and HASH_JOIN_PROBE hints are conflicts, please check the hints"))
forceLeftToBuild = false
forceRightToBuild = false
}
Expand Down Expand Up @@ -2482,7 +2482,7 @@ func (p *LogicalJoin) tryToGetMppHashJoin(prop *property.PhysicalProperty, useBC
if !match {
if fixedBuildSide {
// A warning will be generated if the build side is fixed, but we attempt to change it using the hint.
p.ctx.GetSessionVars().StmtCtx.AppendWarning(ErrInternal.GenWithStack("Some HASH_JOIN_BUILD and HASH_JOIN_PROBE hints cannot be utilized for MPP joins, please check the hints"))
p.ctx.GetSessionVars().StmtCtx.AppendWarning(ErrInternal.FastGen("Some HASH_JOIN_BUILD and HASH_JOIN_PROBE hints cannot be utilized for MPP joins, please check the hints"))
} else {
// The HASH_JOIN_BUILD OR HASH_JOIN_PROBE hints can take effective.
preferredBuildIndex = 1 - preferredBuildIndex
Expand Down Expand Up @@ -2636,8 +2636,7 @@ func pushLimitOrTopNForcibly(p LogicalPlan) bool {
}
if *preferPushDown {
errMsg := "Optimizer Hint LIMIT_TO_COP is inapplicable"
warning := ErrInternal.GenWithStack(errMsg)
p.SCtx().GetSessionVars().StmtCtx.AppendWarning(warning)
p.SCtx().GetSessionVars().StmtCtx.AppendWarning(ErrInternal.FastGen(errMsg))
*preferPushDown = false
}
}
Expand Down Expand Up @@ -2724,7 +2723,7 @@ func (la *LogicalApply) exhaustPhysicalPlans(prop *property.PhysicalProperty) ([
return nil, true, nil
}
if !prop.IsSortItemEmpty() && la.SCtx().GetSessionVars().EnableParallelApply {
la.ctx.GetSessionVars().StmtCtx.AppendWarning(errors.Errorf("Parallel Apply rejects the possible order properties of its outer child currently"))
la.ctx.GetSessionVars().StmtCtx.AppendWarning(errors.NewNoStackErrorf("Parallel Apply rejects the possible order properties of its outer child currently"))
return nil, true, nil
}
disableAggPushDownToCop(la.children[0])
Expand Down Expand Up @@ -3126,7 +3125,7 @@ func (la *LogicalAggregation) checkCanPushDownToMPP() bool {
}
}
if hasUnsupportedDistinct {
warnErr := errors.New("Aggregation can not be pushed to storage layer in mpp mode because it contains agg function with distinct")
warnErr := errors.NewNoStackError("Aggregation can not be pushed to storage layer in mpp mode because it contains agg function with distinct")
if la.ctx.GetSessionVars().StmtCtx.InExplainStmt {
la.ctx.GetSessionVars().StmtCtx.AppendWarning(warnErr)
} else {
Expand Down Expand Up @@ -3295,7 +3294,7 @@ func (la *LogicalAggregation) getHashAggs(prop *property.PhysicalProperty) []Phy
hasMppHints = true
}
if hasMppHints {
warning := ErrInternal.GenWithStack(errMsg)
warning := ErrInternal.FastGen(errMsg)
la.ctx.GetSessionVars().StmtCtx.AppendWarning(warning)
}
}
Expand Down Expand Up @@ -3325,7 +3324,7 @@ func (la *LogicalAggregation) ResetHintIfConflicted() (preferHash bool, preferSt
preferStream = (la.aggHints.preferAggType & preferStreamAgg) > 0
if preferHash && preferStream {
errMsg := "Optimizer aggregation hints are conflicted"
warning := ErrInternal.GenWithStack(errMsg)
warning := ErrInternal.FastGen(errMsg)
la.ctx.GetSessionVars().StmtCtx.AppendWarning(warning)
la.aggHints.preferAggType = 0
preferHash, preferStream = false, false
Expand All @@ -3337,7 +3336,7 @@ func (la *LogicalAggregation) exhaustPhysicalPlans(prop *property.PhysicalProper
if la.aggHints.preferAggToCop {
if !la.canPushToCop(kv.TiKV) {
errMsg := "Optimizer Hint AGG_TO_COP is inapplicable"
warning := ErrInternal.GenWithStack(errMsg)
warning := ErrInternal.FastGen(errMsg)
la.ctx.GetSessionVars().StmtCtx.AppendWarning(warning)
la.aggHints.preferAggToCop = false
}
Expand All @@ -3359,7 +3358,7 @@ func (la *LogicalAggregation) exhaustPhysicalPlans(prop *property.PhysicalProper

if streamAggs == nil && preferStream && !prop.IsSortItemEmpty() {
errMsg := "Optimizer Hint STREAM_AGG is inapplicable"
warning := ErrInternal.GenWithStack(errMsg)
warning := ErrInternal.FastGen(errMsg)
la.ctx.GetSessionVars().StmtCtx.AppendWarning(warning)
}

Expand Down
22 changes: 11 additions & 11 deletions planner/core/expression_rewriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ func (er *expressionRewriter) handleCompareSubquery(ctx context.Context, v *ast.

noDecorrelate := hintFlags&HintFlagNoDecorrelate > 0
if noDecorrelate && len(extractCorColumnsBySchema4LogicalPlan(np, er.p.Schema())) == 0 {
er.sctx.GetSessionVars().StmtCtx.AppendWarning(ErrInternal.GenWithStack(
er.sctx.GetSessionVars().StmtCtx.AppendWarning(ErrInternal.FastGen(
"NO_DECORRELATE() is inapplicable because there are no correlated columns."))
noDecorrelate = false
}
Expand Down Expand Up @@ -841,13 +841,13 @@ func (er *expressionRewriter) handleExistSubquery(ctx context.Context, v *ast.Ex

noDecorrelate := hintFlags&HintFlagNoDecorrelate > 0
if noDecorrelate && len(extractCorColumnsBySchema4LogicalPlan(np, er.p.Schema())) == 0 {
er.sctx.GetSessionVars().StmtCtx.AppendWarning(ErrInternal.GenWithStack(
er.sctx.GetSessionVars().StmtCtx.AppendWarning(ErrInternal.FastGen(
"NO_DECORRELATE() is inapplicable because there are no correlated columns."))
noDecorrelate = false
}
semiJoinRewrite := hintFlags&HintFlagSemiJoinRewrite > 0
if semiJoinRewrite && noDecorrelate {
er.sctx.GetSessionVars().StmtCtx.AppendWarning(ErrInternal.GenWithStack(
er.sctx.GetSessionVars().StmtCtx.AppendWarning(ErrInternal.FastGen(
"NO_DECORRELATE() and SEMI_JOIN_REWRITE() are in conflict. Both will be ineffective."))
noDecorrelate = false
semiJoinRewrite = false
Expand Down Expand Up @@ -988,7 +988,7 @@ func (er *expressionRewriter) handleInSubquery(ctx context.Context, v *ast.Patte
noDecorrelate := hintFlags&HintFlagNoDecorrelate > 0
corCols := extractCorColumnsBySchema4LogicalPlan(np, er.p.Schema())
if len(corCols) == 0 && noDecorrelate {
er.sctx.GetSessionVars().StmtCtx.AppendWarning(ErrInternal.GenWithStack(
er.sctx.GetSessionVars().StmtCtx.AppendWarning(ErrInternal.FastGen(
"NO_DECORRELATE() is inapplicable because there are no correlated columns."))
noDecorrelate = false
}
Expand Down Expand Up @@ -1048,7 +1048,7 @@ func (er *expressionRewriter) handleScalarSubquery(ctx context.Context, v *ast.S

noDecorrelate := hintFlags&HintFlagNoDecorrelate > 0
if noDecorrelate && len(extractCorColumnsBySchema4LogicalPlan(np, er.p.Schema())) == 0 {
er.sctx.GetSessionVars().StmtCtx.AppendWarning(ErrInternal.GenWithStack(
er.sctx.GetSessionVars().StmtCtx.AppendWarning(ErrInternal.FastGen(
"NO_DECORRELATE() is inapplicable because there are no correlated columns."))
noDecorrelate = false
}
Expand Down Expand Up @@ -1396,7 +1396,7 @@ func (er *expressionRewriter) rewriteVariable(v *ast.VariableExpr) {
}
if sysVar.IsNoop && !variable.EnableNoopVariables.Load() {
// The variable does nothing, append a warning to the statement output.
sessionVars.StmtCtx.AppendWarning(ErrGettingNoopVariable.GenWithStackByArgs(sysVar.Name))
sessionVars.StmtCtx.AppendWarning(ErrGettingNoopVariable.FastGenByArgs(sysVar.Name))
}
if sem.IsEnabled() && sem.IsInvisibleSysVar(sysVar.Name) {
err := ErrSpecificAccessDenied.GenWithStackByArgs("RESTRICTED_VARIABLES_ADMIN")
Expand Down Expand Up @@ -2180,7 +2180,7 @@ func decodeKeyFromString(ctx sessionctx.Context, s string) string {
sc := ctx.GetSessionVars().StmtCtx
key, err := hex.DecodeString(s)
if err != nil {
sc.AppendWarning(errors.Errorf("invalid key: %X", key))
sc.AppendWarning(errors.NewNoStackErrorf("invalid key: %X", key))
return s
}
// Auto decode byte if needed.
Expand All @@ -2190,17 +2190,17 @@ func decodeKeyFromString(ctx sessionctx.Context, s string) string {
}
tableID := tablecodec.DecodeTableID(key)
if tableID == 0 {
sc.AppendWarning(errors.Errorf("invalid key: %X", key))
sc.AppendWarning(errors.NewNoStackErrorf("invalid key: %X", key))
return s
}
dm := domain.GetDomain(ctx)
if dm == nil {
sc.AppendWarning(errors.Errorf("domain not found when decoding key: %X", key))
sc.AppendWarning(errors.NewNoStackErrorf("domain not found when decoding key: %X", key))
return s
}
is := dm.InfoSchema()
if is == nil {
sc.AppendWarning(errors.Errorf("infoschema not found when decoding key: %X", key))
sc.AppendWarning(errors.NewNoStackErrorf("infoschema not found when decoding key: %X", key))
return s
}
tbl, _ := is.TableByID(tableID)
Expand Down Expand Up @@ -2230,7 +2230,7 @@ func decodeKeyFromString(ctx sessionctx.Context, s string) string {
}
return ret
}
sc.AppendWarning(errors.Errorf("invalid key: %X", key))
sc.AppendWarning(errors.NewNoStackErrorf("invalid key: %X", key))
return s
}

Expand Down
2 changes: 1 addition & 1 deletion planner/core/find_best_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ func (ds *DataSource) findBestTask(prop *property.PhysicalProperty, planCounter
pruningInfo := ds.getPruningInfo(candidates, prop)
defer func() {
if err == nil && t != nil && !t.invalid() && pruningInfo != "" {
warnErr := errors.New(pruningInfo)
warnErr := errors.NewNoStackError(pruningInfo)
if ds.ctx.GetSessionVars().StmtCtx.InVerboseExplain {
ds.ctx.GetSessionVars().StmtCtx.AppendNote(warnErr)
} else {
Expand Down
Loading