MDEV-14373: Reject incompatible PLUGIN_xxx build mode at configure time#4872
Draft
FaramosCZ wants to merge 1 commit intoMariaDB:mainfrom
Draft
MDEV-14373: Reject incompatible PLUGIN_xxx build mode at configure time#4872FaramosCZ wants to merge 1 commit intoMariaDB:mainfrom
FaramosCZ wants to merge 1 commit intoMariaDB:mainfrom
Conversation
When a user sets -DPLUGIN_PARTITION=DYNAMIC or
-DPLUGIN_PERFSCHEMA=DYNAMIC, these plugins are declared
STATIC_ONLY in their CMakeLists.txt. Previously, the
MYSQL_ADD_PLUGIN macro would silently skip building such
plugins: the STATIC branch wouldn't match (because the user
requested DYNAMIC), and the DYNAMIC branch would be blocked
by ARG_STATIC_ONLY. The plugin was simply not built.
This caused confusing downstream compile errors in other
plugins that depended on the missing one:
- PLUGIN_PARTITION=DYNAMIC -> CONNECT fails:
'struct TABLE_SHARE' has no member named
'partition_info_str_len'
'struct TABLE' has no member named 'part_info'
- PLUGIN_PERFSCHEMA=DYNAMIC -> MariaBackup fails:
'MY_WME' was not declared in this scope
'my_read' was not declared in this scope
'MY_FILE_ERROR' was not declared in this scope
- PLUGIN_ARIA=DYNAMIC -> Spider fails:
'MARIA_COLUMNDEF' has not been declared
(Note: Aria is now MANDATORY and already overrides
user input; this was likely reproducible in older
versions where Aria was DEFAULT)
Root cause: The MYSQL_ADD_PLUGIN macro in
cmake/plugin.cmake did not validate that the
user-requested build mode (STATIC or DYNAMIC) was
compatible with the plugin's declared capabilities
(STATIC_ONLY or MODULE_ONLY).
Fix: Add validation immediately after the existing
PLUGIN_xxx value check. If DYNAMIC is requested for a
STATIC_ONLY plugin, or STATIC is requested for a
MODULE_ONLY plugin, emit a FATAL_ERROR with a clear
message telling the user which option to use instead.
Affected plugins with STATIC_ONLY:
- partition (sql/CMakeLists.txt)
- perfschema (storage/perfschema/CMakeLists.txt)
- sql_sequence (sql/CMakeLists.txt)
- online_alter_log (sql/CMakeLists.txt)
Affected plugins with MODULE_ONLY:
- federated (storage/federated/CMakeLists.txt)
- example (storage/example/CMakeLists.txt)
- rocksdb (storage/rocksdb/CMakeLists.txt)
The YES and AUTO modes are unaffected since they already
gracefully fall through to whichever mode the plugin
supports.
Co-Authored-By: Claude AI <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When a user sets -DPLUGIN_PARTITION=DYNAMIC or
-DPLUGIN_PERFSCHEMA=DYNAMIC, these plugins are declared STATIC_ONLY in their CMakeLists.txt. Previously, the MYSQL_ADD_PLUGIN macro would silently skip building such plugins: the STATIC branch wouldn't match (because the user requested DYNAMIC), and the DYNAMIC branch would be blocked by ARG_STATIC_ONLY. The plugin was simply not built.
This caused confusing downstream compile errors in other plugins that depended on the missing one:
PLUGIN_PARTITION=DYNAMIC -> CONNECT fails: 'struct TABLE_SHARE' has no member named 'partition_info_str_len' 'struct TABLE' has no member named 'part_info'
PLUGIN_PERFSCHEMA=DYNAMIC -> MariaBackup fails: 'MY_WME' was not declared in this scope 'my_read' was not declared in this scope 'MY_FILE_ERROR' was not declared in this scope
PLUGIN_ARIA=DYNAMIC -> Spider fails: 'MARIA_COLUMNDEF' has not been declared (Note: Aria is now MANDATORY and already overrides user input; this was likely reproducible in older versions where Aria was DEFAULT)
Root cause: The MYSQL_ADD_PLUGIN macro in
cmake/plugin.cmake did not validate that the
user-requested build mode (STATIC or DYNAMIC) was
compatible with the plugin's declared capabilities (STATIC_ONLY or MODULE_ONLY).
Fix: Add validation immediately after the existing PLUGIN_xxx value check. If DYNAMIC is requested for a STATIC_ONLY plugin, or STATIC is requested for a
MODULE_ONLY plugin, emit a FATAL_ERROR with a clear message telling the user which option to use instead.
Affected plugins with STATIC_ONLY:
Affected plugins with MODULE_ONLY:
The YES and AUTO modes are unaffected since they already gracefully fall through to whichever mode the plugin supports.