[MDEV-21691] mtr fails to start with "No option named 'plugin-dir' in group 'mysqld.1' at lib/My/ConfigFactory.pm line 349" Created: 2020-02-09  Updated: 2023-07-14

Status: Open
Project: MariaDB Server
Component/s: Packaging, Platform Debian, Tests
Affects Version/s: 10.4.12
Fix Version/s: 10.5

Type: Bug Priority: Major
Reporter: Otto Kekäläinen Assignee: Vicențiu Ciorbaru
Resolution: Unresolved Votes: 0
Labels: None

Attachments: PNG File salsa-ci-pipeline.png    
Issue Links:
Relates
relates to MDEV-14900 Upstream 10.4 debian patches Closed
relates to MDEV-31685 MariaDB 10.4.30 testsuite: No option ... Open

 Description   

When I packaged 10.4 for Debian back in July 2019 based on version 10.4.6 I did not see any issues in starting the mysql-test-run. Proof: https://salsa.debian.org/mariadb-team/mariadb-10.4/-/jobs/241143

However, now when imported 10.4.12 the test suite started to fail with:

root@7ed9ad728b3e:/usr/share/mysql/mysql-test# perl -I. ./mysql-test-run.pl --suite=main --vardir=$WORKDIR/var --tmpdir=$WORKDIR/tmp \
>     --parallel=auto --skip-rpl \
>     --force
Logging: ./mysql-test-run.pl  --suite=main --vardir=/build/var --tmpdir=/build/tmp --parallel=auto --skip-rpl --force
vardir: /build/var
Removing old var directory...
Creating var directory '/build/var'...
Checking supported features...
Can't exec "patch": No such file or directory at ./mysql-test-run.pl line 2152.
MariaDB Version 10.4.12-MariaDB-1
 - SSL connections supported
 - binaries built with wsrep patch
Using suites: main
Collecting tests...
No option named 'plugin-dir' in group 'mysqld.1' at lib/My/ConfigFactory.pm line 349.

I can reproduce this locally and it is also visible in CI: https://salsa.debian.org/mariadb-team/mariadb-10.4/-/jobs/553231

Please advice what might be wrong here and what might have changed in upstream regarding mtr and plugin_dir handling.

I checked the git history of include/plugin.defs and mysql-test-run.pl and lib/v1/mysql-test-run.pl and main/variables* but I don't spot anything that I think could be related. Remotely maybe 4fef644303ecdf6ea88ea40d3733dea6bd2cf41d ?

The section in +349 lib/My/ConfigFactory.pm points to:

sub resolve_at_variable {
  my ($self, $config, $group, $option)= @_;
  local $_ = $option->value();
  my ($res, $after);
 
  while (m/(.*?)\@((?:\w+\.)+)(#?[-\w]+)/g) {
    my ($before, $group_name, $option_name)= ($1, $2, $3);
    $after = $';
    chop($group_name);
 
  my $from_group= $config->group($group_name)
    or croak "There is no group named '$group_name' that ",
      "can be used to resolve '$option_name' for test '$self->{testname}'";
 
    my $value= $from_group->value($option_name);
    $res .= $before.$value;
  }
  $res .= $after;
 
  $option->{value}= $res;
}

This section has only one change since summer: 9b22354a594570e23cc675d90836743ce7a3ba1c But I don't see how that could cause this error.



 Comments   
Comment by Otto Kekäläinen [ 2020-02-10 ]

I have everything else pretty much set for uploading mariadb-10.4 to Debian, but this mtr start failure is the only major one remaining to be solved. Could maybe serg check it out and suggest what I could try to debug next?

https://salsa.debian.org/mariadb-team/mariadb-10.4/pipelines/108149

Comment by Otto Kekäläinen [ 2020-02-11 ]

Just a reminder that this is about Debian packaging in their official repos, source at https://salsa.debian.org/mariadb-team/mariadb-10.4/commits/master

Comment by Otto Kekäläinen [ 2020-02-17 ]

If you cvicentiu don't know what is the solution, even giving some hints of what related you've found out could help me debug it...

Comment by Vicențiu Ciorbaru [ 2020-02-17 ]

Hi otto!

I do now know yet what is causing the packages in salsa CI to not-work, however I am now investigating this commit, which is the likely cause of change in behaviour:

https://github.com/MariaDB/server/commit/4fef644303ecdf6ea88ea40d3733dea6bd2cf41d#diff-2231e5936098e13c6b6ee8660f401382L2646

I will keep you updated.

Comment by Vicențiu Ciorbaru [ 2020-02-17 ]

Ok, this was a tricky one...

The roots of this problem start from 2016, with this commit in the debian packaging repository:

commit 5aecef81f774e245f60e8c3f70f44190f7473537
Author: Otto Kekäläinen <otto@debian.org>
Date:   Thu Nov 10 14:23:28 2016 +0200
 
    Move plugins to $ARCH/*/mariadb18 to meet multiarch needs (Closes: #739452)
    
    Previously all plugins were installed to usr/lib/mysql/plugin, including
    the plugins in the client library package, which inhibited installing
    other architecture versions of the same package on the same system,
    which is expected to work in multiarch situations.
    
    As client plugins alone cannot change directory with current build options,
    and moving the server plugins too does not have any negative effects,
    move all plugins to a multiarch directory.
    
    Using the ABI version in the path also makes it possible to install
    multiple versions of the shared library side-by-side as is normally
    facilitated by the soname .so.18 naming scheme, which the client
    plugins did not follow.
    
    See also discussion at https://bugs.debian.org/842454

This commit introduces a custom INSTALL_PLUGINDIR (different to what is default in the base MariaDB repository for deb packages) to the cmake invocation that debian packaging uses with debian/autobake-deb.sh. mysql-test-run.pl never properly worked with a custom plugin directory. The tests that require plugins are always skipped. This is also visible even in 10.4.6 packaging on salsa https://salsa.debian.org/mariadb-team/mariadb-10.4/-/jobs/241143, search for the test:

main.blackhole_plugin                    [ skipped ]  Need blackhole plugin

This worked because internally mysql-test-run.pl defaulted to the "current directory" aka dot (.) when it was run from an installed location.

Now, what caused this problem to finally be apparent is when serg committed the following patch https://github.com/MariaDB/server/commit/4fef644303ecdf6ea88ea40d3733dea6bd2cf41d#diff-2231e5936098e13c6b6ee8660f401382L2646

The subtle change is that we no longer have a dot as default plugin-dir value. This is only apparent when we've chosen to modify the install plugin directory and we are not running mtr from the source directory.

Additionally, because the debian/autobake-deb.sh in the upstream MariaDB repository is not the same as the one Salsa, buildbot never caught the problem either.

In essence, the implementation of mtr should "configure" the script to account for INSTALL_PLUGINDIR, but I do not feel comfortable doing these edits right now, not with some input from serg that I did not miss anything in my analysis.

I am however quite comfortable suggesting the following patch to apply to mysql-test-run.pl in debian packaging patches series until we implement a proper fix to account for a custom INSTALL_PLUGINDIR.

diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 6ee8e926ad4..a05607a9418 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -2824,6 +2824,7 @@ sub setup_vardir() {
         set_plugin_var($pname);
         $plugindir=dirname($_) unless $plugindir;
       }
+      $plugindir= ($mysqld_variables{'plugin-dir'} || '.') unless $plugindir;
     }
   }

Comment by Otto Kekäläinen [ 2020-02-18 ]

main.blackhole_plugin                    [ skipped ]  Need blackhole plugin

Good catch! Indeed the plugins in the mariadb-test are in upstream in wrong directory (not arch compatible) and some recent changes even ship plugins in the mariadb-test-data package that should be data-only (the same package is used on all architectures), see MDEV-21654. Directories are not versioned as they should be (thus I did https://github.com/MariaDB/server/commit/b9dea911bf8e3d4d8fc57ce3ef15ab0e2ab4d076).

I have known about these problems since 10.3 was released but because of timing issues I havn't been able to submit or champion proper changes upstream. I plan to do that now in the 10.5 cycle before it gets GA so that the delta between downstream Debian packaging and upstream 10.5 can be finally closed.

Comment by Otto Kekäläinen [ 2020-02-18 ]

MTR in autopkgtest passed now, thanks!
https://salsa.debian.org/mariadb-team/mariadb-10.4/-/jobs/566977

By the way, the Debian builds us the debbuild directly (and thus assumes proper debian/ contents). The MariaDB autobake-deb.sh is not used in official Debian at all.

Comment by Otto Kekäläinen [ 2020-02-18 ]

This is now solved downstream, let's keep it open until also fixed upstream.


https://salsa.debian.org/mariadb-team/mariadb-10.4/pipelines/110060

Comment by Otto Kekäläinen [ 2020-06-27 ]

Should this be applied on 10.5 now?

Comment by Otto Kekäläinen [ 2020-10-06 ]

This is still open, and we still carry the patch https://salsa.debian.org/mariadb-team/mariadb-10.5/-/blob/master/debian/patches/mtr-plugin-path.patch downstream in Debian. Any updates on this cvicentiu (or maybe danblack)?

Comment by Otto Kekäläinen [ 2020-10-11 ]

I removed this patch in https://salsa.debian.org/mariadb-team/mariadb-10.5/-/commit/bde2cf481fa48a0dd85b9ad40e27ad5005ad1122 and at least mariadb-10.5 builds and test suite seems to run fine without it. See e.g. https://buildd.debian.org/status/package.php?p=mariadb-10.5

Comment by Otto Kekäläinen [ 2020-10-12 ]

Tested also locally and works just fine now:

# cd /usr/share/mysql/mysql-test
# export WORKDIR=$(mktemp -d)
# perl -I. ./mysql-test-run.pl --suite=main --vardir=$WORKDIR/var --tmpdir=$WORKDIR/tmp  --parallel=auto --skip-rpl --force
Logging: ./mysql-test-run.pl  --suite=main --vardir=/var --tmpdir=/tmp --parallel=auto --skip-rpl --force
vardir: /var
Checking leftover processes...
mysql-test-run: WARNING: Found non pid file 'utmp' in '/var/run'
Removing old var directory...
Creating var directory '/var'...
Checking supported features...
Can't exec "patch": No such file or directory at ./mysql-test-run.pl line 2029.
MariaDB Version 10.5.5-MariaDB-4
 - SSL connections supported
Using suites: main
Collecting tests...
Installing system database...
Using parallel: 8
 
==============================================================================
 
TEST                                  WORKER RESULT   TIME (ms) or COMMENT
--------------------------------------------------------------------------
...

Generated at Thu Feb 08 09:09:04 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.