Skip to content

MDEV-34817: Fix non-deterministic row order in perfschema.lowercase_fs_off#4922

Open
kjarir wants to merge 1 commit intoMariaDB:11.8from
kjarir:MDEV-34817-fix-test-order
Open

MDEV-34817: Fix non-deterministic row order in perfschema.lowercase_fs_off#4922
kjarir wants to merge 1 commit intoMariaDB:11.8from
kjarir:MDEV-34817-fix-test-order

Conversation

@kjarir
Copy link
Copy Markdown
Contributor

@kjarir kjarir commented Apr 9, 2026

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).

@gkodinov gkodinov added the External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements. label Apr 9, 2026
@grooverdan grooverdan self-assigned this Apr 9, 2026
Copy link
Copy Markdown
Member

@gkodinov gkodinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements.

Development

Successfully merging this pull request may close these issues.

3 participants