MDEV-34817: Fix non-deterministic row order in perfschema.lowercase_fs_off#4922
MDEV-34817: Fix non-deterministic row order in perfschema.lowercase_fs_off#4922kjarir wants to merge 1 commit intoMariaDB:11.8from
Conversation
gkodinov
left a comment
There was a problem hiding this comment.
Thank you for your contribution. This is a preliminary review.
What you changed is not wrong. But I do not see how it fixes the jira at hand.
All reports in the Jira (the ones still available that is) are not about a stable sort order.
They are about either an extra row or a difference in count_start or count_statements.
Can you reproduce either of these? I was able to. But it wasn't about a stable order (see my comment in the jira).
Apparently something is not cleared in the cache somehow.
I would improve the test's stability by removing the extra counters from the SELECT statement: they're not really relevant to the test at hand: it's about how many rows do you see. I'd of course still report the original count issue as a separate jira should I go this way.
But, feel free to analyze the cache garbling case and fix that instead.
Note that I needed to do at least 10 iterations. 1 iteration wasn't enough.
Note also that adding an ORDER BY changes the execution plan by adding an extra filesort, which is probably not wha the test is supposed to do:
MariaDB [(none)]> explain SELECT object_type, object_schema, object_name, count_star, count_statements, sum_rows_sent FROM performance_schema.events_statements_summary_by_program WHERE object_type='procedure' AND LOWER(object_schema)='m33020_db1';
+------+-------------+--------------------------------------+------+---------------+------+---------+------+------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+------+-------------+--------------------------------------+------+---------------+------+---------+------+------+-------------+
| 1 | SIMPLE | events_statements_summary_by_program | ALL | NULL | NULL | NULL | NULL | 0 | Using where |
+------+-------------+--------------------------------------+------+---------------+------+---------+------+------+-------------+
1 row in set (0.006 sec)
MariaDB [(none)]> explain SELECT object_type, object_schema, object_name, count_star, count_statements, sum_rows_sent FROM performance_schema.events_statements_summary_by_program WHERE object_type='procedure' AND LOWER(object_schema)='m33020_db1' order by object_schema, object_name;
+------+-------------+--------------------------------------+------+---------------+------+---------+------+------+-----------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+------+-------------+--------------------------------------+------+---------------+------+---------+------+------+-----------------------------+
| 1 | SIMPLE | events_statements_summary_by_program | ALL | NULL | NULL | NULL | NULL | 0 | Using where; Using filesort |
+------+-------------+--------------------------------------+------+---------------+------+---------+------+------+-----------------------------+
1 row in set (0.001 sec)
Added ORDER BY object_schema, object_name to SELECT queries in lowercase_fs_off.test and updated the result file. This ensures stable row order in case-sensitive environments (MDEV-34817).