cockroachdb / cockroach

CockroachDB - the open source, cloud-native distributed SQL database.
https://www.cockroachlabs.com
Other
29.56k stars 3.71k forks source link

storage: iterator stats should consider block count #125111

Open nicktrav opened 1 month ago

nicktrav commented 1 month ago

We currently have iterator stats reported in trace bundles that look as follows:

event:scan stats: stepped 0 times (0 internal); seeked 1 times (1 internal); block-bytes: (total 895 KiB, cached 883 KiB, duration 1.533227ms); points: (count 1, key-bytes 65 B, value-bytes 88 B, tombstoned: 0) ranges: (count 0), (contained-points 0, skipped-points 0) evaluated requests: 1 gets, 0 scans, 0 reverse scans

It would be useful to include a count of total block "touches" and block misses.

This will require a change down in Pebble to accumulate the stats. And then a second change to wire up the stats in the protos in Cockroach to allow the trace data to be propagated.

More context here (internal).

Jira issue: CRDB-39251

RaduBerinde commented 1 month ago

Updating iterator stats will require changes in MVCCIteratorStats and the crdb_internal.node_transaction_statistics system table. First PR can just update the Pebble stats and use them to calculate the old stats for MVCCIteratorStats. But then we'll want to update everything which will require a bit of legwork to see what will be affected.