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

storage: include range key stats in ScanStats #94345

Merged
merged 1 commit into from
Jan 3, 2023
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
8 changes: 6 additions & 2 deletions pkg/roachpb/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1781,14 +1781,18 @@ func humanizePointCount(n uint64) redact.SafeString {
func (s *ScanStats) SafeFormat(w redact.SafePrinter, _ rune) {
w.Printf("scan stats: stepped %d times (%d internal); seeked %d times (%d internal); "+
"block-bytes: (total %s, cached %s); "+
"points: (count %s, key-bytes %s, value-bytes %s, tombstoned: %s)",
"points: (count %s, key-bytes %s, value-bytes %s, tombstoned: %s) "+
"ranges: (count %s), (contained-points %s, skipped-points %s)",
s.NumInterfaceSteps, s.NumInternalSteps, s.NumInterfaceSeeks, s.NumInternalSeeks,
humanizeutil.IBytes(int64(s.BlockBytes)),
humanizeutil.IBytes(int64(s.BlockBytesInCache)),
humanizePointCount(s.PointCount),
humanizeutil.IBytes(int64(s.KeyBytes)),
humanizeutil.IBytes(int64(s.ValueBytes)),
humanizePointCount(s.PointsCoveredByRangeTombstones))
humanizePointCount(s.PointsCoveredByRangeTombstones),
humanizePointCount(s.RangeKeyCount),
humanizePointCount(s.RangeKeyContainedPoints),
humanizePointCount(s.RangeKeySkippedPoints))
}

// String implements fmt.Stringer.
Expand Down
3 changes: 3 additions & 0 deletions pkg/roachpb/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3200,4 +3200,7 @@ message ScanStats {
uint64 value_bytes = 8;
uint64 point_count = 9;
uint64 points_covered_by_range_tombstones = 10;
uint64 range_key_count = 11;
uint64 range_key_contained_points = 12;
uint64 range_key_skipped_points = 13;
}
3 changes: 3 additions & 0 deletions pkg/storage/mvcc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3557,6 +3557,9 @@ func recordIteratorStats(ctx context.Context, iter MVCCIterator) {
ValueBytes: stats.InternalStats.ValueBytes,
PointCount: stats.InternalStats.PointCount,
PointsCoveredByRangeTombstones: stats.InternalStats.PointsCoveredByRangeTombstones,
RangeKeyCount: uint64(stats.RangeKeyStats.Count),
RangeKeyContainedPoints: uint64(stats.RangeKeyStats.ContainedPoints),
RangeKeySkippedPoints: uint64(stats.RangeKeyStats.SkippedPoints),
})
}

Expand Down