db: add IteratorStats, for counting the work done in Iterator#1129
db: add IteratorStats, for counting the work done in Iterator#1129sumeerbhola merged 1 commit intocockroachdb:masterfrom
Conversation
itsbilal
left a comment
There was a problem hiding this comment.
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
sumeerbhola
left a comment
There was a problem hiding this comment.
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).
itsbilal
left a comment
There was a problem hiding this comment.
Reviewed 2 of 2 files at r2.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @jbowens and @petermattis)
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