Skip to content

Commit

Permalink
lightning: fix oom when mem/cpu ratio is low (#43729) (#43747)
Browse files Browse the repository at this point in the history
close #43728
  • Loading branch information
ti-chi-bot committed May 12, 2023
1 parent 52b57dd commit d50dc76
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions br/pkg/lightning/backend/kv/sql2kv.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,11 @@ func (kvcodec *tableKVEncoder) Encode(
_ string,
offset int64,
) (Row, error) {
// we ignore warnings when encoding rows now, but warnings uses the same memory as parser, since the input
// row []types.Datum share the same underlying buf, and when doing CastValue, we're using hack.String/hack.Slice.
// when generating error such as mysql.ErrDataOutOfRange, the data will be part of the error, causing the buf
// unable to release. So we truncate the warnings here.
defer kvcodec.se.vars.StmtCtx.TruncateWarnings(0)
cols := kvcodec.tbl.Cols()

var value types.Datum
Expand Down

0 comments on commit d50dc76

Please sign in to comment.