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,roachpb: expose pebble.InternalIteratorStats for scans #77512

Merged
merged 1 commit into from
Mar 9, 2022

Conversation

sumeerbhola
Copy link
Collaborator

The current IteratorStats only include information from the top
of the tree (pebble.Iterator). The new InternalIteratorStats
includes block bytes loaded (and cached), and stats for points
iterated over when merging across levels in the log-structured
merge tree. The latter includes points that were ignored because
of range tombstones, but could not be cheaply skipped.

These stats can be used to make inferences about root causes
of slow scans.

This change exposes these in roachpb.ScanStats and the trace
span recorded when doing a mvcc get or scan. There are todos for
plumbing all or part of it through the higher layers via
roachpb.ScanStats and execinfrapb.KVStats.

Informs #59069
Informs cockroachdb/pebble#1342

Release justification: low risk, and potentially high benefit
observability increase for existing functionality.

Release note: None

The current IteratorStats only include information from the top
of the tree (pebble.Iterator). The new InternalIteratorStats
includes block bytes loaded (and cached), and stats for points
iterated over when merging across levels in the log-structured
merge tree. The latter includes points that were ignored because
of range tombstones, but could not be cheaply skipped.

These stats can be used to make inferences about root causes
of slow scans.

This change exposes these in roachpb.ScanStats and the trace
span recorded when doing a mvcc get or scan. There are todos for
plumbing all or part of it through the higher layers via
roachpb.ScanStats and execinfrapb.KVStats.

Informs cockroachdb#59069
Informs cockroachdb/pebble#1342

Release justification: low risk, and potentially high benefit
observability increase for existing functionality.

Release note: None
@sumeerbhola sumeerbhola requested review from andreimatei, yuzefovich, Azhng and a team March 8, 2022 23:00
@sumeerbhola sumeerbhola requested a review from a team as a code owner March 8, 2022 23:00
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator Author

@sumeerbhola sumeerbhola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a trivial PR, that exposes additional stats for scans.
@yuzefovich @Azhng : I am including you here because you reviewed #64503 by @jordanlewis, that initially added plumbing for stats.
@andreimatei : including you since you have expressed interest in the past, and because this is adding a slightly bigger tracing payload.
I would like to get this in for v22.1. One question is whether we have enough tracing for customer deployments that we will be able to see these stats and make inferences, or do we think we need to do the additional upstream plumbing that is currently listed as todos.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @andreimatei, @Azhng, and @yuzefovich)

@yuzefovich
Copy link
Member

I'll defer to Archer on the observability side of things (my only comment on #64503 was this which I made after that PR was merged).

Copy link
Collaborator

@nicktrav nicktrav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pkg/storage :lgtm:

Reviewed 6 of 6 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @andreimatei, @Azhng, and @yuzefovich)

Copy link
Collaborator Author

@sumeerbhola sumeerbhola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll defer to Archer on the observability side of things (my only comment on #64503 was this which I made after that PR was merged).

I don't have a good answer to that:

  • The member variable of type execinfra.ScanStats in joinReader looks unnecessary. It is read into and then read from in the same method. The same is true of invertedJoiner.
  • The implementations of execStatsForTrace in both joinReader and invertedJoiner look similar, which relates to your question.
  • These implementations do hook into the same ProcessorBaseNoHelper.ExecStatsForTrace, so at least there is generalization on when they are called.
  • The changes in my PR don't propagate to execinfra.ScanStats and execinfrapb.KVStats. Even if we add those, I don't think it will change any of the integration in these joiners.

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @andreimatei, @Azhng, and @yuzefovich)

Copy link
Contributor

@Azhng Azhng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 1 of 6 files at r1.
Reviewable status: :shipit: complete! 2 of 0 LGTMs obtained (waiting on @andreimatei, @sumeerbhola, and @yuzefovich)


pkg/sql/execinfra/stats.go, line 60 at r1 (raw file):

// of each stat.
// TODO(sql-observability): include other fields that are in roachpb.ScanStats,
// here and in execinfrapb.KVStats.

How urgent does this need to be plumbed through?

@sumeerbhola
Copy link
Collaborator Author

How urgent does this need to be plumbed through?

It depends on how useful it is to only have the current trace statements. Do you know the answer?

@sumeerbhola
Copy link
Collaborator Author

TFTRs!

@sumeerbhola
Copy link
Collaborator Author

bors r=azhng,yuzefovich,nicktrav

@craig
Copy link
Contributor

craig bot commented Mar 9, 2022

Build succeeded:

@craig craig bot merged commit 70a7826 into cockroachdb:master Mar 9, 2022
@Azhng
Copy link
Contributor

Azhng commented Mar 9, 2022

It depends on how useful it is to only have the current trace statements. Do you know the answer?

Hmm I don't have a definite answer 🤔 . I filed #77580 so we can track the plumbing work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants