Currently, MVCCIterator mandates that HasPointAndRange() must return a consistent value with true. However, this means that pebbleIterator.HasPointAndRange() needs to call through to Valid() to do additional checks (e.g. that we haven't moved into the lock table), but most times the caller has already called Valid(). This additional validation can be expensive, and HasPointAndRange() has been seen to have a non-negligible cost.
We should change the MVCCIterator contract to require Valid() to be called before HasPointAndRange(), to avoid this cost.
Jira issue: CRDB-17273
Epic CRDB-2624
Currently,
MVCCIteratormandates thatHasPointAndRange()must return a consistent value withtrue. However, this means thatpebbleIterator.HasPointAndRange()needs to call through toValid()to do additional checks (e.g. that we haven't moved into the lock table), but most times the caller has already calledValid(). This additional validation can be expensive, andHasPointAndRange()has been seen to have a non-negligible cost.We should change the
MVCCIteratorcontract to requireValid()to be called beforeHasPointAndRange(), to avoid this cost.Jira issue: CRDB-17273
Epic CRDB-2624