Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-14840

Assertion `!log->same_pk' failed in row_log_table_apply_delete

    XMLWordPrintable

Details

    Description

      Notes:

      • it can be related to MDEV-14837, or even be a direct consequence of it. If so, please feel free to close as a duplicate.
      • Please note that you (probably) need to apply the attached/pasted patch mtr_default_server.patch to MTR, and run the test case with --default-server-options. The patch doesn't do any dirty tricks, it simply makes MTR to bootstrap and run the server with real default server options. On some reason, I couldn't reproduce it otherwise, even by restoring all options changed by MTR to their true default values on the command line. Possibly it has something to do with how the server bootstraps, but I couldn't positively confirm it. In any case, I expect that the reason will become apparent when the cause of the failure is known.
      • Even with the MTR patch, the test case is highly non-deterministic and mustn't be put into the regression suite. The current test case runs 50 loops inside it (so there is no need to run with --repeat). On my machine it has always failed withing first 20 loops, but I assume it can vary.
      • It fails for me on an ASAN build, too.

      # Apply the provided mtr_default_server.patch and run with --default-server-options
       
      --source include/have_innodb.inc
      --source include/have_log_bin.inc
       
      --let $run= 50
      while ($run)
      {
        --connect (con1,localhost,root,,test)
        CREATE TABLE t1 (c1 INT, c2 INT, c3 INT, c4 TEXT, PRIMARY KEY (c4(10))) ENGINE=InnoDB;
        INSERT INTO t1 (c1,c2,c3,c4) VALUES (1,1,1,REPEAT('a',8193));
        ALTER TABLE t1 ADD COLUMN c5 INT;
        UPDATE t1 SET c5 = c1;
        --connection default
        --send
          ALTER TABLE t1 DROP COLUMN c1;
        --connection con1
        --error ER_DUP_ENTRY
        INSERT INTO t1 (c1,c2,c3,c4) VALUES (2,2,2,REPEAT('a',8193)),(3,3,3,REPEAT('a',8193));
        ROLLBACK;
       
        --connection default
        --reap
        --source include/restart_mysqld.inc
        --disconnect con1
        --connection default
        DROP TABLE t1;
        --dec $run
        --echo #
        --echo # $run runs left
        --echo #
      }
      

      10.3 c664c48726cdfab1

      mysqld: /data/src/10.3/storage/innobase/row/row0log.cc:1992: dberr_t row_log_table_apply_delete(que_thr_t*, ulint, const mrec_t*, const ulint*, mem_heap_t*, mem_heap_t*, const row_log_t*, const row_ext_t
      *, ulint): Assertion `!log->same_pk' failed.
      180101 15:47:10 [ERROR] mysqld got signal 6 ;
       
      7  0x00007fda1874fee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x000055ec6cc3a12b in row_log_table_apply_delete (thr=0x7fd9a42f64b0, trx_id_col=1, mrec=0x7fda003db046 "aaaaaaaaaa", moffsets=0x7fd9a42d2c60, offsets_heap=0x7fd9a4301090, heap=0x7fd9a42fc2e0, log=0x7fd9a42a7b10, save_ext=0x7fd9a42fc368, ext_size=3128) at /data/src/10.3/storage/innobase/row/row0log.cc:1992
      #9  0x000055ec6cc3ba95 in row_log_table_apply_op (thr=0x7fd9a42f64b0, new_trx_id_col=1, dup=0x7fda15377240, error=0x7fda15376fec, offsets_heap=0x7fd9a4301090, heap=0x7fd9a42fc2e0, mrec=0x7fda003db046 "aaaaaaaaaa", mrec_end=0x7fda003dbc95 "", offsets=0x7fd9a42d2c60) at /data/src/10.3/storage/innobase/row/row0log.cc:2507
      #10 0x000055ec6cc3dbd1 in row_log_table_apply_ops (thr=0x7fd9a42f64b0, dup=0x7fda15377240, stage=0x7fd9a4025fa0) at /data/src/10.3/storage/innobase/row/row0log.cc:3023
      #11 0x000055ec6cc3e190 in row_log_table_apply (thr=0x7fd9a42f64b0, old_table=0x7fd998015d48, table=0x7fd9a42f43a0, stage=0x7fd9a4025fa0) at /data/src/10.3/storage/innobase/row/row0log.cc:3122
      #12 0x000055ec6cb04759 in ha_innobase::inplace_alter_table (this=0x7fd9980354a8, altered_table=0x7fd9a42f43a0, ha_alter_info=0x7fda15377570) at /data/src/10.3/storage/innobase/handler/handler0alter.cc:7082
      #13 0x000055ec6c59dc39 in handler::ha_inplace_alter_table (this=0x7fd9980354a8, altered_table=0x7fd9a42f43a0, ha_alter_info=0x7fda15377570) at /data/src/10.3/sql/handler.h:3991
      #14 0x000055ec6c594c1a in mysql_inplace_alter_table (thd=0x7fd9a4000b00, table_list=0x7fd9a402ae50, table=0x7fd998018540, altered_table=0x7fd9a42f43a0, ha_alter_info=0x7fda15377570, inplace_supported=HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE, target_mdl_request=0x7fda153775e0, alter_ctx=0x7fda153781a0) at /data/src/10.3/sql/sql_table.cc:7388
      #15 0x000055ec6c59a096 in mysql_alter_table (thd=0x7fd9a4000b00, new_db=0x7fd9a402b460 "test", new_name=0x0, create_info=0x7fda15378db0, table_list=0x7fd9a402ae50, alter_info=0x7fda15378d00, order_num=0, order=0x0, ignore=false) at /data/src/10.3/sql/sql_table.cc:9395
      #16 0x000055ec6c61a61b in Sql_cmd_alter_table::execute (this=0x7fd9a402b490, thd=0x7fd9a4000b00) at /data/src/10.3/sql/sql_alter.cc:331
      #17 0x000055ec6c4cb688 in mysql_execute_command (thd=0x7fd9a4000b00) at /data/src/10.3/sql/sql_parse.cc:6251
      #18 0x000055ec6c4d0098 in mysql_parse (thd=0x7fd9a4000b00, rawbuf=0x7fd9a402ad68 "ALTER TABLE t1 DROP COLUMN c1", length=29, parser_state=0x7fda1537a660, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7966
      #19 0x000055ec6c4bda0d in dispatch_command (command=COM_QUERY, thd=0x7fd9a4000b00, packet=0x7fd9a400b161 "ALTER TABLE t1 DROP COLUMN c1", packet_length=29, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1824
      #20 0x000055ec6c4bc441 in do_command (thd=0x7fd9a4000b00) at /data/src/10.3/sql/sql_parse.cc:1369
      #21 0x000055ec6c615190 in do_handle_one_connection (connect=0x55ec6f0aac00) at /data/src/10.3/sql/sql_connect.cc:1420
      #22 0x000055ec6c614f1d in handle_one_connection (arg=0x55ec6f0aac00) at /data/src/10.3/sql/sql_connect.cc:1326
      #23 0x00007fda1a426494 in start_thread (arg=0x7fda1537b700) at pthread_create.c:333
      #24 0x00007fda1880c93f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      MTR patch (same as attached)

      diff --git a/mysql-test/include/hard_default_my.cnf b/mysql-test/include/hard_default_my.cnf
      new file mode 100644
      index 0000000..b89b69e
      --- /dev/null
      +++ b/mysql-test/include/hard_default_my.cnf
      @@ -0,0 +1,43 @@
      +# Copyright (c) 2017 MariaDB Corporation
      +#
      +# This program is free software; you can redistribute it and/or modify
      +# it under the terms of the GNU General Public License as published by
      +# the Free Software Foundation; version 2 of the License.
      +#
      +# This program is distributed in the hope that it will be useful,
      +# but WITHOUT ANY WARRANTY; without even the implied warranty of
      +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      +# GNU General Public License for more details.
      +#
      +# You should have received a copy of the GNU General Public License
      +# along with this program; if not, write to the Free Software
      +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
      +
      +# Use real default settings for mysqld processes
      +
      +[mysqld]
      +open-files-limit=           1024
      +log-basename=mysqld
      +
      +loose-ssl-ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem
      +loose-ssl-cert=@ENV.MYSQL_TEST_DIR/std_data/server-cert.pem
      +loose-ssl-key=@ENV.MYSQL_TEST_DIR/std_data/server-key.pem
      +
      +[embedded]
      +local-infile
      +
      +[client]
      +plugin-dir=@mysqld.1.plugin-dir
      +
      +[mysqltest]
      +loose-ssl-ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem
      +loose-ssl-cert=@ENV.MYSQL_TEST_DIR/std_data/client-cert.pem
      +loose-ssl-key=@ENV.MYSQL_TEST_DIR/std_data/client-key.pem
      +
      +[mysqld.1]
      +
      +#!run-master-sh
      +
      +[ENV]
      +MASTER_MYPORT=           @mysqld.1.port
      +MASTER_MYSOCK=           @mysqld.1.socket
      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);
      +  }
       }
       
       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}) {
               $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,
      +
                    # Control what test suites or cases to run
                    'force+'                   => \$opt_force,
                    'with-ndbcluster-only'     => \&collect_option,
      @@ -3473,11 +3477,15 @@ sub sql_to_bootstrap {
       sub default_mysqld {
         # Generate new config file from template
         environment_setup();
      +  my $config_template= ($opt_default_server_options
      +      ? 'include/hard_default_my.cnf'
      +      : 'include/default_my.cnf'
      +  );
         my $config= My::ConfigFactory->new_config
           ( {
              basedir         => $basedir,
              testdir         => $glob_mysql_test_dir,
      -       template_path   => "include/default_my.cnf",
      +       template_path   => $config_template,
              vardir          => $opt_vardir,
              tmpdir          => $opt_tmpdir,
              baseport        => 0,
      @@ -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");
      +  }
         mtr_add_arg($args, "--tmpdir=%s", "$opt_vardir/tmp/");
         mtr_add_arg($args, "--core-file");
         mtr_add_arg($args, "--console");
      @@ -6438,6 +6448,8 @@ Options to control what engine/variation to run:
                               tests
         defaults-extra-file=<config template> Extra config template to add to
                               all generated configs
      +  default-server-options Use hard server defaults instead of the usual
      +                        heavily adjusted defaults-file
         combination=<opt>     Use at least twice to run tests with specified
                               options to mysqld
         dry-run               Don't run any tests, print the list of tests
      

      Attachments

        Issue Links

          Activity

            People

              marko Marko Mäkelä
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.