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

db: add IteratorStats, for counting the work done in Iterator #1129

Merged
merged 1 commit into from
May 5, 2021

Conversation

sumeerbhola
Copy link
Collaborator

The calls to internalIterator are tracked in Iterator
since we use both mergingIter and getIter in that role,
and we probably don't need these stats for background
work (compactions) involving mergingIter.

Informs cockroachdb/cockroach#59069

Intended to unblock
cockroachdb/cockroach#64503

@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Contributor

@itsbilal itsbilal left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 3 files at r1.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @jbowens, @petermattis, and @sumeerbhola)


iterator.go, line 132 at r1 (raw file):

	prefixOrFullSeekKey []byte
	readSampling        readSampling
	stats IteratorStats

Nit: align types


iterator.go, line 1174 at r1 (raw file):

// ResetStats resets the stats to 0.
func (i *Iterator) ResetStats() {

Is this called anywhere?


iterator.go, line 1237 at r1 (raw file):

func (stats *IteratorStats) SafeFormat(s redact.SafePrinter, verb rune) {
	for i := range stats.ForwardStepCount {
		if i == 0 {

Nit: i == InterfaceCall ?


iterator.go, line 1240 at r1 (raw file):

			s.SafeString("interface: ")
		} else {
			s.SafeString(" internal: ")

Wonder if we could do better spacing / separation before internal, right now it seems to be a continuation of the interface stats.

The calls to internalIterator are tracked in Iterator
since we use both mergingIter and getIter in that role,
and we probably don't need these stats for background
work (compactions) involving mergingIter.

Informs cockroachdb/cockroach#59069

Intended to unblock
cockroachdb/cockroach#64503
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.

TFTR!

Reviewable status: 1 of 3 files reviewed, 2 unresolved discussions (waiting on @itsbilal, @jbowens, and @petermattis)


iterator.go, line 132 at r1 (raw file):

Previously, itsbilal (Bilal Akhtar) wrote…

Nit: align types

Done. Odd that goland did not do it automatically.


iterator.go, line 1174 at r1 (raw file):

Previously, itsbilal (Bilal Akhtar) wrote…

Is this called anywhere?

Not yet. It will be called by pebbleIterator.Close when reusing the underlying iterator.


iterator.go, line 1237 at r1 (raw file):

Previously, itsbilal (Bilal Akhtar) wrote…

Nit: i == InterfaceCall ?

Done


iterator.go, line 1240 at r1 (raw file):

Previously, itsbilal (Bilal Akhtar) wrote…

Wonder if we could do better spacing / separation before internal, right now it seems to be a continuation of the interface stats.

I've adjusted this to add another pair of parentheses and cut out some repetition of literals (I was not happy with the lengthiness).

Copy link
Contributor

@itsbilal itsbilal 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 2 of 2 files at r2.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @jbowens and @petermattis)

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.

3 participants