← Back to team overview

maria-developers team mailing list archive

Re: d78273d: MDEV-14288 Add MTR option to run tests with real server defaults

 

Hi, Elena!

On Nov 05, elenst@xxxxxxxxxxxxxxxx wrote:
> revision-id: d78273d1e53308c8fe78b9e067a88c43bd05e540
> parent(s): 737a4da94ae9b25a7ebe828c5b35a1ce4acf03d6
> committer: Elena Stepanova
> branch nick: bb-10.0-elenst
> timestamp: 2017-11-05 01:30:40 +0200
> message:
> 
> MDEV-14288 Add MTR option to run tests with real server defaults
> 
> diff --git a/mysql-test/lib/My/ConfigFactory.pm b/mysql-test/lib/My/ConfigFactory.pm
> index b8ce038..dcdb534 100644
> --- a/mysql-test/lib/My/ConfigFactory.pm
> +++ b/mysql-test/lib/My/ConfigFactory.pm
> @@ -37,7 +37,9 @@ sub add_opt_values {
>  
>    # add auto-options
>    $config->insert('OPT', 'port'   => sub { fix_port($self, $config) });
> -  $config->insert('mysqld', "loose-skip-plugin-$_" => undef) for (@::optional_plugins);
> +  if (!$::opt_default_server_options) {
> +    $config->insert('mysqld', "loose-skip-plugin-$_" => undef) for (@::optional_plugins);
> +  }

Dunno. I'd prefer to remove magic from mtr, not to add it.
Generating different configs feels like magic. I wonder whether this
could work:
 - mtr always disables plugins, but in a separate .cnf file. And
   default_mysqld.cnf will !include it, but yours won't.
or
 - all this disabling will go where, say, @DISABLE_ALL_PLUGINS line is.
   it'll be in default_mysqld.cnf but not in yours.

>  }
>  
>  my @pre_rules=
> diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm
> index 38c52b7..26a4edd 100644
> --- a/mysql-test/lib/mtr_cases.pm
> +++ b/mysql-test/lib/mtr_cases.pm
> @@ -876,7 +876,10 @@ sub collect_one_test_case {
>      if (not $config)
>      {
>        # Suite has no config, autodetect which one to use
> -      if ($tinfo->{rpl_test}) {
> +      if ($::opt_default_server_options) {
> +        $config= "include/hard_default_my.cnf";
> +      }
> +      elsif ($tinfo->{rpl_test}) {

yuck. I never liked that rpl suite magically gets a different cnf file.
may be it's time to fix it? e.g. by moving it into suite/rpl/my.cnf or
into include/rpl_init.cnf ?

>          $config= "suite/rpl/my.cnf";
>        } else {
>          $config= "include/default_my.cnf";
> diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
> index 33d9c7b..997fb82 100755
> --- a/mysql-test/mysql-test-run.pl
> +++ b/mysql-test/mysql-test-run.pl
> @@ -131,6 +131,7 @@ our $plugindir;
>  my $path_vardir_trace;          # unix formatted opt_vardir for trace files
>  my $opt_tmpdir;                 # Path to use for tmp/ dir
>  my $opt_tmpdir_pid;
> +our $opt_default_server_options;
>  
>  my $opt_start;
>  my $opt_start_dirty;
> @@ -1106,6 +1107,9 @@ sub command_line_setup {
>  	     # Extra config file to append to all generated configs
>  	     'defaults-extra-file=s'    => \&collect_option,
>  
> +	     # Use hard defaults instead of heavily modified MTR configuration
> +	     'default-server-options'    => \$opt_default_server_options,

with the changes above, you could use --defaults-file=hard_default_my
or something like that (even better with a short cnf file name)

You could even commit a bunch of templates, like vanilla.cnf, rpm.cnf,
debian.cnf and use them like

  ./mtr --defaults-file=debian

> +
>               # Control what test suites or cases to run
>               'force+'                   => \$opt_force,
>               'with-ndbcluster-only'     => \&collect_option,
> @@ -3509,12 +3517,14 @@ sub mysql_install_db {
>    mtr_add_arg($args, "--basedir=%s", $install_basedir);
>    mtr_add_arg($args, "--datadir=%s", $install_datadir);
>    mtr_add_arg($args, "--plugin-dir=%s", $plugindir);
> -  mtr_add_arg($args, "--default-storage-engine=myisam");
> -  mtr_add_arg($args, "--loose-skip-plugin-$_") for @optional_plugins;
> -  # starting from 10.0 bootstrap scripts require InnoDB
> -  mtr_add_arg($args, "--loose-innodb");
> -  mtr_add_arg($args, "--loose-innodb-log-file-size=5M");
> -  mtr_add_arg($args, "--disable-sync-frm");
> +  if (!$opt_default_server_options) {
> +    mtr_add_arg($args, "--default-storage-engine=myisam");
> +    mtr_add_arg($args, "--loose-skip-plugin-$_") for @optional_plugins;
> +    # starting from 10.0 bootstrap scripts require InnoDB
> +    mtr_add_arg($args, "--loose-innodb");
> +    mtr_add_arg($args, "--loose-innodb-log-file-size=5M");
> +    mtr_add_arg($args, "--disable-sync-frm");
> +  }

why is that? it's just mysql_install_db

>    mtr_add_arg($args, "--tmpdir=%s", "$opt_vardir/tmp/");
>    mtr_add_arg($args, "--core-file");
>    mtr_add_arg($args, "--console");

Regards,
Sergei
Chief Architect MariaDB
and security@xxxxxxxxxxx