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.2: storage: fix cases of unencoded key ranges #128816

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
14 changes: 9 additions & 5 deletions pkg/storage/pebble.go
Original file line number Diff line number Diff line change
Expand Up @@ -910,8 +910,8 @@ func DefaultPebbleOptions() *pebble.Options {
}
opts.Experimental.ShortAttributeExtractor = shortAttributeExtractorForValues
opts.Experimental.RequiredInPlaceValueBound = pebble.UserKeyPrefixBound{
Lower: keys.LocalRangeLockTablePrefix,
Upper: keys.LocalRangeLockTablePrefix.PrefixEnd(),
Lower: EncodeMVCCKey(MVCCKey{Key: keys.LocalRangeLockTablePrefix}),
Upper: EncodeMVCCKey(MVCCKey{Key: keys.LocalRangeLockTablePrefix.PrefixEnd()}),
}

for i := 0; i < len(opts.Levels); i++ {
Expand Down Expand Up @@ -1184,8 +1184,8 @@ func (p *Pebble) Download(ctx context.Context, span roachpb.Span, copy bool) err
return nil
}
downloadSpan := pebble.DownloadSpan{
StartKey: span.Key,
EndKey: span.EndKey,
StartKey: EncodeMVCCKey(MVCCKey{Key: span.Key}),
EndKey: EncodeMVCCKey(MVCCKey{Key: span.EndKey}),
ViaBackingFileDownload: copy,
}
return p.db.Download(ctx, []pebble.DownloadSpan{downloadSpan})
Expand Down Expand Up @@ -2419,7 +2419,11 @@ func (p *Pebble) PreIngestDelay(ctx context.Context) {

// GetTableMetrics implements the Engine interface.
func (p *Pebble) GetTableMetrics(start, end roachpb.Key) ([]enginepb.SSTableMetricsInfo, error) {
tableInfo, err := p.db.SSTables(pebble.WithKeyRangeFilter(start, end), pebble.WithProperties(), pebble.WithApproximateSpanBytes())
filterOpt := pebble.WithKeyRangeFilter(
EncodeMVCCKey(MVCCKey{Key: start}),
EncodeMVCCKey(MVCCKey{Key: end}),
)
tableInfo, err := p.db.SSTables(filterOpt, pebble.WithProperties(), pebble.WithApproximateSpanBytes())

if err != nil {
return []enginepb.SSTableMetricsInfo{}, err
Expand Down