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

release-24.3: stats, encoding: improve UUID-decoding error #136037

Merged
merged 1 commit into from
Nov 23, 2024
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
7 changes: 7 additions & 0 deletions pkg/sql/stats/histogram.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package stats

import (
"context"
"encoding/hex"
"fmt"
"math"
"sort"
Expand Down Expand Up @@ -135,6 +136,12 @@ func DecodeUpperBound(
} else {
datum, _, err = keyside.Decode(a, typ, upperBound, encoding.Ascending)
}
if err != nil {
err = errors.Wrapf(
err, "decoding histogram version %d type %v value %v",
int(version), typ.Family().Name(), hex.EncodeToString(upperBound),
)
}
return datum, err
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/util/encoding/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -3162,6 +3162,9 @@ func DecodeUUIDValue(b []byte) (remaining []byte, u uuid.UUID, err error) {

// DecodeUntaggedUUIDValue decodes a value encoded by EncodeUntaggedUUIDValue.
func DecodeUntaggedUUIDValue(b []byte) (remaining []byte, u uuid.UUID, err error) {
if len(b) < uuidValueEncodedLength {
return b, uuid.UUID{}, errors.Errorf("invalid uuid length of %d", len(b))
}
u, err = uuid.FromBytes(b[:uuidValueEncodedLength])
if err != nil {
return b, uuid.UUID{}, err
Expand Down