MDEV-33910 Mark mysql and performance_schema tables as SYSTEM TABLE/VIEW #4243
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR addresses issue where tables residing in databases
mysqlandperformance_schemawere not properly identified as SYSTEM TABLE/SYSTEM VIEW inINFORMATION_SCHEMA.TABLES.The fix involves modifying the
get_schema_tables_record()function to:sysschema tables as regular tables/views as intendedNOTE: A specific exception was made for
mysql.userto resolve failures in the test suite. Themain.mysql_upgrade_to_100502test failed because itsmysql_upgradescript requires direct write access tomysql.userwhich was blocked when it was classified as a SYSTEM TABLE. Also,main.plugin_authand manualFLUSH PRIVILEGEScommands failed with ERROR 1347: 'mysql.user' is not of type 'TABLE'. This indicates that the server's internal privilege reload mechanism (acl_reload) expects to read the grant tables as standard BASE TABLEs. Classifying them as SYSTEM objects breaks this core server function, leading to privilege inconsistencies. This targeted exception formysql.userfixed these inconsistencies. Could there be any better way of handling this?How can this PR be tested?
NOTE: Make sure performance_schema is enabled when starting the server.
Run queries to check the table types before and after the fix:
Results from my testing
Before changes
Result will show mysql and performance_schema tables as "BASE TABLE"
After Changes
Result should show:
Basing the PR against the correct MariaDB version
PR quality check
CODING_STANDARDS.mdfile and my PR conforms to this where appropriate.