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

ddl, util/codec: fix add index OOM and prevent panic in logging #29925

Merged
merged 6 commits into from
Nov 24, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 6 additions & 0 deletions ddl/backfilling.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,12 @@ func (w *worker) handleReorgTasks(reorgInfo *reorgInfo, totalAddedCount *int64,
}

func tryDecodeToHandleString(key kv.Key) string {
defer func() {
r := recover()
tangenta marked this conversation as resolved.
Show resolved Hide resolved
logutil.BgLogger().Warn("tryDecodeToHandleString panic",
zap.Any("recover()", r),
zap.Binary("key", key))
}()
handle, err := tablecodec.DecodeRowKey(key)
if err != nil {
recordPrefixIdx := bytes.Index(key, []byte("_r"))
Expand Down
2 changes: 1 addition & 1 deletion util/codec/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,7 @@ func peek(b []byte) (length int, err error) {
return 0, errors.Trace(err)
}
length += l
if length < 0 {
if length <= 0 {
return 0, errors.New("invalid encoded key")
} else if length > originLength {
return 0, errors.Errorf("invalid encoded key, "+
Expand Down