Skip to content
/ server Public

MDEV-14373: Reject incompatible PLUGIN_xxx build mode at configure time#4872

Draft
FaramosCZ wants to merge 1 commit intoMariaDB:mainfrom
FaramosCZ:MDEV-14373
Draft

MDEV-14373: Reject incompatible PLUGIN_xxx build mode at configure time#4872
FaramosCZ wants to merge 1 commit intoMariaDB:mainfrom
FaramosCZ:MDEV-14373

Conversation

@FaramosCZ
Copy link
Copy Markdown
Contributor

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.

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>
@gkodinov gkodinov added the External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements. label Mar 27, 2026
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.

2 participants