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

executor: fix cte mem tracker failpoint condition again (#54523) #54764

Merged
Merged
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
13 changes: 6 additions & 7 deletions executor/cte.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"github.com/pingcap/tidb/util/logutil"
"github.com/pingcap/tidb/util/memory"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)

var _ Executor = &CTEExec{}
Expand Down Expand Up @@ -434,15 +435,13 @@
if chk.NumRows() == 0 {
if iterNum%1000 == 0 {
// To avoid too many logs.
p.logTbls(ctx, err, iterNum)
p.logTbls(ctx, err, iterNum, zapcore.DebugLevel)
}
iterNum++
failpoint.Inject("assertIterTableSpillToDisk", func(maxIter failpoint.Value) {
if iterNum > 0 && iterNum < uint64(maxIter.(int)) && err == nil {
if p.iterInTbl.GetMemBytes() != 0 || p.iterInTbl.GetDiskBytes() == 0 ||
p.iterOutTbl.GetMemBytes() != 0 || p.iterOutTbl.GetDiskBytes() == 0 ||
p.resTbl.GetMemBytes() != 0 || p.resTbl.GetDiskBytes() == 0 {
p.logTbls(ctx, err, iterNum)
if p.iterInTbl.GetDiskBytes() == 0 && p.iterOutTbl.GetDiskBytes() == 0 && p.resTbl.GetDiskBytes() == 0 {
p.logTbls(ctx, err, iterNum, zapcore.InfoLevel)

Check warning on line 444 in executor/cte.go

View check run for this annotation

Codecov / codecov/patch

executor/cte.go#L443-L444

Added lines #L443 - L444 were not covered by tests
panic("assert row container spill disk failed")
}
}
Expand Down Expand Up @@ -761,8 +760,8 @@
return changed
}

func (p *cteProducer) logTbls(ctx context.Context, err error, iterNum uint64) {
Copy link
Contributor

Choose a reason for hiding this comment

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

why modify this?

logutil.Logger(ctx).Debug("cte iteration info",
func (p *cteProducer) logTbls(ctx context.Context, err error, iterNum uint64, lvl zapcore.Level) {
logutil.Logger(ctx).Log(lvl, "cte iteration info",
zap.Any("iterInTbl mem usage", p.iterInTbl.GetMemBytes()), zap.Any("iterInTbl disk usage", p.iterInTbl.GetDiskBytes()),
zap.Any("iterOutTbl mem usage", p.iterOutTbl.GetMemBytes()), zap.Any("iterOutTbl disk usage", p.iterOutTbl.GetDiskBytes()),
zap.Any("resTbl mem usage", p.resTbl.GetMemBytes()), zap.Any("resTbl disk usage", p.resTbl.GetDiskBytes()),
Expand Down