MDEV-40786 make mariadb-plugin great - #5597
Draft
MooSayed1 wants to merge 1 commit into
Draft
Conversation
gkodinov
requested changes
Aug 26, 2026
gkodinov
left a comment
Member
There was a problem hiding this comment.
Thanks for looking into this. This is nowhere near close to being ready for review. Converting to draft until it's actually delivering towards the specification in the jira.
gkodinov
marked this pull request as draft
August 26, 2026 08:20
MooSayed1
force-pushed
the
MDEV-40786
branch
5 times, most recently
from
August 31, 2026 02:18
6385c9a to
a54ebba
Compare
Add search, install, and uninstall subcommands to mariadb-plugin with input validation and case normalization, while keeping legacy ENABLE and DISABLE syntax functional for backward compatibility. Bake the installation layout into the binary at compile time (RPM, DEB, or tarball), as it cannot be derived from the path alone since RPM and DEB use the same directory, and verify the executable path at runtime via argv[0] and mysys path helpers to ensure package managers and tarball directories target the correct installation. Delegate install and uninstall to the system package manager on RPM and DEB installations, so that plugin files stay owned by it. The plugin name maps to the uniform package name mariadb-plugin-<name>. Commands run through fork and execvp with an argument vector, never a shell, and inherit the standard streams, so the package manager prompts the user itself and its exit code is passed through. RPM packages are named differently, so they get the uniform name as a Provides, derived from the plugin component in cmake/plugin.cmake. DEB packages already carry it. On RPM, uninstall resolves the real package name with rpm --whatprovides, because dnf 5 does not accept Provides names for removal. Search lists the plugins the installation can install: the plugin name, installed or available, and the description, filtered by an optional search term. The distribution's package index is queried for everything providing mariadb-plugin-* (repoquery for dnf, apt-cache, zypper search plus info --provides) and each output is parsed into the same uniform format, so the user always sees plugin names, not the distribution's package names. Add a --dry-run option that prints the commands install and uninstall would run instead of running them, with the package name resolved, and without requiring root. It is long only, as -n is taken by the legacy --no-defaults option. Test the command line handling in main.mariadb-plugin: unknown commands, argument counts, plugin name validation and that the deprecated ENABLE|DISABLE syntax still reaches the old code path. Installing and removing packages is not testable there, as the tool acts only when it runs from the location it was installed to.
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.
The Jira issue number for this PR is: MDEV-40786
Description
First step of turning the
mariadb-plugintool into a plugin packagemanager, as described in the MDEV. This covers the package-manager half:
RPM and DEB installations. The binary tarball half comes later, as it
needs the plugin metadata on the download site.
The legacy
<plugin> ENABLE|DISABLEsyntax is kept for backwardcompatibility: it is recognized on the raw arguments, before any option
parsing, and continues through the original code path unchanged. A command
word wins over the keywords, so
search enablesearches for "enable"instead of taking the deprecated path.
Plugin names are normalized to lower case and validated against
[a-z0-9_-](max 64 chars), since they are used to build package names.Install-method detection. The install layout (RPM, DEB, tarball) is
compiled in from
INSTALL_LAYOUT, as it cannot be derived from the path:RPM and DEB share the same directories. At runtime the tool locates itself
through
argv[0](my_path()+my_realpath(), which also resolves thelegacy
mysql_pluginsymlink) and verifies it belongs to thatinstallation: on RPM/DEB the binary must sit in the compiled-in bindir, on
a tarball the plugin directory must exist under the basedir. A build tree
is therefore not accepted.
Delegation. On RPM and DEB installations
installanduninstalldelegate to the system package manager, so plugin files stay owned by it
and dependency resolution, signature checks and upgrades keep working.
apt-getis used on DEB; on RPMdnfis preferred andzypperused whendnfis absent. Commands run throughfork()/execvp()with an argumentvector, never a shell, and inherit the standard streams, so the package
manager prompts the user itself and its exit code is passed through
unchanged. Non-root invocations are rejected before anything is spawned.
uninstallon RPM first resolves the real package name withrpm -q --whatprovides, because dnf 5 does not acceptProvidesnames forremoval (dnf 4 and zypper do); this also gives a clear message when the
plugin is not installed.
Uniform naming. RPM packages keep their own names
(
MariaDB-rocksdb-engine) and get the uniform name as aProvides,generated per plugin component in
cmake/plugin.cmake. DEB packagesalready carry it. So the tool knows one naming rule and zero package names.
Search. The distribution's package index is queried for everything
providing
mariadb-plugin-*and printed uniformly as plugin name,installed/available, and description.
dnf searchignoresProvides, sorepoqueryis used; zypper never reports which capability matched, so asecond
zypper info --providescall recovers the uniform name. An optionalterm filters by substring. Needs no root; exits non-zero when nothing
matches.
--dry-runprints the commandsinstallanduninstallwould run,with the package name resolved, without running them and without needing
root. Long-only, as
-nis taken by the legacy--no-defaults.Still to come: the binary tarball engine (download, checksum, unpack,
file manifest) and tarball search, which needs the plugin index on the
download site.
Release Notes
mariadb-plugingainssearch,installanduninstallsubcommands. OnRPM and DEB installations they delegate to the system package manager, with
plugins named uniformly as
mariadb-plugin-<name>everywhere. A--dry-runoption shows what would be run. The legacyENABLE|DISABLEsyntax still works and is now deprecated.
How can this PR be tested?
main.mariadb-plugincovers the command line: unknown commands, argumentcounts, plugin name validation, and that
ENABLE|DISABLEstill reaches theold code path. The delegation itself cannot run under mtr, since the tool
only acts when it runs from the location it was installed to, so it belongs
to the install/upgrade builders.
Manually, with a binary built for the matching layout and placed in the real
bindir:
Tested in containers:
mariadb-plugin-*packages listed, andmariadb-plugin-rocksdbinstalled and removed through the tool.
repository of packages built from this branch, so they carry the
generated
Provides: install resolves the uniform name, uninstallresolves the real package name, and search lists them.
both produce a single clear error.
Basing the PR against the correct MariaDB version
This is a new feature, so this PR targets
main.PR quality check