Skip to content

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

Open
FaramosCZ wants to merge 1 commit intoMariaDB:10.11from
FaramosCZ:MDEV-14373
Open

MDEV-14373: Reject incompatible PLUGIN_xxx build mode at configure time#4872
FaramosCZ wants to merge 1 commit intoMariaDB:10.11from
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.

@gkodinov gkodinov added the External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements. label Mar 27, 2026
@FaramosCZ FaramosCZ force-pushed the MDEV-14373 branch 4 times, most recently from 1d81a76 to 8cf1ca7 Compare March 30, 2026 00:19
@FaramosCZ FaramosCZ marked this pull request as ready for review March 30, 2026 01:33
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.

LGTM. And makes a lot of sense too. But this is a bug fix. Please rebase to 10.11.

@FaramosCZ FaramosCZ changed the base branch from main to 10.11 March 31, 2026 13:53
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.

Non-MANDATORY plugins with STATIC_ONLY (the new check
catches -DPLUGIN_xxx=DYNAMIC for these):
  - partition (sql/CMakeLists.txt)
  - perfschema (storage/perfschema/CMakeLists.txt)
  - thread_pool_info (sql/CMakeLists.txt)

Conditionally STATIC_ONLY (platform/config-dependent):
  - feedback (only on Windows)

The MANDATORY + STATIC_ONLY plugin sql_sequence is
unaffected: the MANDATORY flag overrides user input to
YES before the new check runs.

MODULE_ONLY plugins (the new check catches
-DPLUGIN_xxx=STATIC for these) include all dynamically-
loaded plugins: federated, spider, rocksdb, mroonga,
oqgraph, example, and ~25 others under plugin/ and
storage/.

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