mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
MDEV-34190: r_engine_stats.pages_read_count is unrealistically low
The symptoms were: take a server with no activity and a table that's not in the buffer pool. Run a query that reads the whole table and observe that r_engine_stats.pages_read_count shows about 2% of the table was read. Who reads the rest? The cause was that page prefetching done inside InnoDB was not counted. This counts page prefetch requests made in buf_read_ahead_random() and buf_read_ahead_linear() and makes them visible in: - ANALYZE: r_engine_stats.pages_prefetch_read_count - Slow Query Log: Pages_prefetched: This patch intentionally doesn't attempt to count the time to read the prefetched pages: * there's no obvious place where one can do it * prefetch reads may be done in parallel (right?), it is not clear how to count the time in this case.
This commit is contained in:
@@ -1727,6 +1727,8 @@ static void trace_engine_stats(handler *file, Json_writer *writer)
|
||||
if (hs->pages_read_time)
|
||||
writer->add_member("pages_read_time_ms").
|
||||
add_double(hs->pages_read_time * 1000. / timer_tracker_frequency());
|
||||
if (hs->pages_prefetched)
|
||||
writer->add_member("pages_prefetch_read_count").add_ull(hs->pages_prefetched);
|
||||
if (hs->undo_records_read)
|
||||
writer->add_member("old_rows_read").add_ull(hs->undo_records_read);
|
||||
writer->end_object();
|
||||
|
Reference in New Issue
Block a user