[MDEV-22179] rr(record and replay) support for mtr Created: 2020-04-07  Updated: 2020-10-15  Resolved: 2020-06-24

Status: Closed
Project: MariaDB Server
Component/s: Scripts & Clients
Fix Version/s: 10.2.33, 10.3.24, 10.4.14, 10.5.5

Type: Task Priority: Major
Reporter: Sachin Setiya (Inactive) Assignee: Aleksey Midenkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-23945 Document rr option for mtr Open

 Description   

Add option for --rr and --boot-rr in mtr



 Comments   
Comment by Sachin Setiya (Inactive) [ 2020-04-07 ]

Patch

diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 98a8e90556e..3a6e8ab7902 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -267,8 +267,10 @@ our %gprof_dirs;
 
 our $glob_debugger= 0;
 our $opt_gdb;
+our $opt_rr;
 our $opt_client_gdb;
 my $opt_boot_gdb;
+my $opt_boot_rr;
 our $opt_dbx;
 our $opt_client_dbx;
 my $opt_boot_dbx;
@@ -1320,10 +1322,12 @@ sub command_line_setup {
              'debug-common'             => \$opt_debug_common,
              'debug-server'             => \$opt_debug_server,
              'gdb=s'                    => \$opt_gdb,
+             'rr'                       => \$opt_rr,
              'client-gdb'               => \$opt_client_gdb,
              'manual-gdb'               => \$opt_manual_gdb,
              'manual-lldb'              => \$opt_manual_lldb,
 	     'boot-gdb'                 => \$opt_boot_gdb,
+	     'boot-rr'                  => \$opt_boot_rr,
              'manual-debug'             => \$opt_manual_debug,
              'ddd'                      => \$opt_ddd,
              'client-ddd'               => \$opt_client_ddd,
@@ -3339,8 +3343,20 @@ sub mysql_install_db {
 
   mtr_report("Installing system database...");
 
+  # If DISABLE_GRANT_OPTIONS is defined when the server is compiled (e.g.,
+  # configure --disable-grant-options), mysqld will not recognize the
+  # --bootstrap or --skip-grant-tables options.  The user can set
+  # MYSQLD_BOOTSTRAP to the full path to a mysqld which does accept
+  # --bootstrap, to accommodate this.
+  my $exe_mysqld_bootstrap =
+    $ENV{'MYSQLD_BOOTSTRAP'} || find_mysqld($install_basedir);
+
   my $args;
   mtr_init_args(\$args);
+  if ($opt_boot_rr) {
+    mtr_add_arg($args, "record");
+    mtr_add_arg($args, "$exe_mysqld_bootstrap" );
+  }
   mtr_add_arg($args, "--no-defaults");
   mtr_add_arg($args, "--disable-getopt-prefix-matching");
   mtr_add_arg($args, "--bootstrap");
@@ -3375,13 +3391,6 @@ sub mysql_install_db {
     }
   }
 
-  # If DISABLE_GRANT_OPTIONS is defined when the server is compiled (e.g.,
-  # configure --disable-grant-options), mysqld will not recognize the
-  # --bootstrap or --skip-grant-tables options.  The user can set
-  # MYSQLD_BOOTSTRAP to the full path to a mysqld which does accept
-  # --bootstrap, to accommodate this.
-  my $exe_mysqld_bootstrap =
-    $ENV{'MYSQLD_BOOTSTRAP'} || find_mysqld($install_basedir);
 
   # ----------------------------------------------------------------------
   # export MYSQLD_BOOTSTRAP_CMD variable containing <path>/mysqld <args>
@@ -3506,7 +3515,9 @@ sub mysql_install_db {
 
   # Create directories mysql
   mkpath("$install_datadir/mysql");
-
+  if ($opt_boot_rr) {
+    $exe_mysqld_bootstrap= "rr";
+  }
   my $realtime= gettimeofday();
   if ( My::SafeProcess->run
        (
@@ -5345,6 +5356,12 @@ sub mysqld_start ($$) {
 
   my $args;
   mtr_init_args(\$args);
+  if ( $opt_rr)
+  {
+    mtr_add_arg($args, "record");
+    mtr_add_arg($args, "$exe");
+    $exe= "rr";
+  }
 
   if ( $opt_valgrind_mysqld and not $opt_gdb and not $opt_manual_gdb )
   {
@@ -6528,6 +6545,7 @@ Options for debugging the product
   boot-dbx              Start bootstrap server in dbx
   boot-ddd              Start bootstrap server in ddd
   boot-gdb              Start bootstrap server in gdb
+  boot-rr               Start bootstrap server in rr
   client-dbx            Start mysqltest client in dbx
   client-ddd            Start mysqltest client in ddd
   client-debugger=NAME  Start mysqltest in the selected debugger
@@ -6541,6 +6559,7 @@ Options for debugging the product
                         tracing
   debugger=NAME         Start mysqld in the selected debugger
   gdb                   Start the mysqld(s) in gdb
+  rr                    Start the mysqld(s) in rr
   manual-debug          Let user manually start mysqld in debugger, before
                         running test(s)
   manual-gdb            Let user manually start mysqld in gdb, before running

Comment by Sachin Setiya (Inactive) [ 2020-04-08 ]

http://lists.askmonty.org/pipermail/commits/2020-April/014239.html

Comment by Sachin Setiya (Inactive) [ 2020-05-25 ]

-> % ./mtr mdev_21804 --rr
Logging: /home/sachin/10.4/server/mysql-test/mysql-test-run.pl  mdev_21804 --rr
Invalid option "--rr"
For full list of options, use /home/sachin/10.4/server/mysql-test/mysql-test-run.pl --help
sachin@sachin-sp52 [01:08:34  IST] [~/10.4/build/mysql-test] 
-> % ./mtr mdev_21804 --rr
Logging: /home/sachin/10.4/server/mysql-test/mysql-test-run.pl  mdev_21804 --rr
vardir: /home/sachin/10.4/build/mysql-test/var
Checking leftover processes...
Removing old var directory...

Sometime --rr randomly fails

Comment by Sachin Setiya (Inactive) [ 2020-05-28 ]

Changed --rr=ARG to --rr_option=ARG , And that seems to stop above random failure

Comment by Sachin Setiya (Inactive) [ 2020-06-11 ]

10.2 branch 10.2-22179

Comment by Aleksey Midenkov [ 2020-06-16 ]

More random failures:

mtr --suite=main --reorder --rr contributors 1st
...
worker[1] mysql-test-run: WARNING: Process [mysqld.1 - pid: 28328, winpid: 28328, exit: 17664] died after mysql-test-run waited 0.2 seconds for /home/midenok/src/mariadb/10.2/build/mysql-test/var/run/mysqld.1.pid to be created.
worker[1] mysql-test-run: __* ERROR: Failed to start mysqld mysqld.1 with command rr
mysql-test-run: __* ERROR: Test suite aborted
Status: 1

$ cat mysqld.1.err
CURRENT_TEST: main.1st
 
execve failed: 'contributors' (or interpreter) not found (ENOENT)

Comment by Ian Gilfillan [ 2020-10-15 ]

Thanks anel for creating a documentation task. Reminder to developers that new options or behaviour changes need to be documented.

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