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

Assertion `m_status == DA_ERROR' failed in Diagnostics_area::sql_errno upon SELECT from I_S with concurrent backup locking

    Details

      Description

      NOTES:

      • The test case is for reproducing purposes only, don't put it into the regression suite!
      • The test case has a loop of 100 attempts. It appears to be enough for me, usually it fails within first 50, but it can vary on different machines and builds. Increase it if it's not enough. It can also be done via usual --repeat, but it will be slower.
      • The test case has a little bit of everything – sequences, backup locks, etc., so it's not applicable to previous versions, thus it hasn't been checked on versions other than 10.4, and I'm not sure to which component it really belongs.
      • I've added to the test case some protection against other sporadic failures. Timeouts are probably expected, but also DROP SEQUENCE and CREATE SEQUENCE sometimes fail due to "sequence doesn't exist" and "sequence already exists". It's probably a problem in itself.
      • Even now, the test case sometimes fails with

        connect  con1,localhost,root,,test;
        CREATE SEQUENCE IF NOT EXISTS s ENGINE=InnoDB;
        bug.2965a 'innodb'                       [ fail ]
                Test ended at 2019-06-23 19:11:29
         
        CURRENT_TEST: bug.2965a
        mysqltest: At line 47: query 'CREATE SEQUENCE IF NOT EXISTS s ENGINE=InnoDB' failed: 1813: Tablespace for table '`test`.`s`' exists. Please DISCARD the tablespace before IMPORT
        

        I don't want to complicate the test case further by hiding it, besides, something is definitely wrong when it happens, so it requires attention as well. I'm not sure whether it is related to the main complaint in this report or not.

      • Might be related to MDEV-19555, but I couldn't make this one fail on CHECK, so I'm filing it separately.

      --source include/have_innodb.inc
       
      --let $run= 100
       
      CREATE TABLE t1 (a INT) ENGINE=InnoDB;
      CREATE TABLE t2 (b INT) ENGINE=InnoDB;
      CREATE TABLE t3 (c INT) ENGINE=InnoDB;
      CREATE TABLE t4 (d INT) ENGINE=InnoDB;
      CREATE TABLE t5 (e INT) ENGINE=InnoDB;
       
      while ($run)
      {
          --echo #
          --echo # $run rounds left
          --connection default
          BEGIN;
          SELECT * FROM t4;
       
          --connect (con1,localhost,root,,test)
          CREATE SEQUENCE IF NOT EXISTS s ENGINE=InnoDB;
          --connection default
          --error ER_BAD_FIELD_ERROR
          UPDATE t2 SET x = 0;
          --connection default
          --send
            SELECT * FROM information_schema.tables;
          --connection con1
          SET lock_wait_timeout= 1;
          --send
            LOCK TABLE t3 READ, t5 WRITE, t2 READ;
          --connect (con2,localhost,root,,test)
          SET lock_wait_timeout= 1;
          BACKUP STAGE START;
          --error 0,ER_LOCK_WAIT_TIMEOUT
          BACKUP STAGE BLOCK_COMMIT;
       
          # Cleanup
          --disconnect con2
          --connection default
          --reap
          DROP SEQUENCE IF EXISTS s;
          --connection con1
          --error 0,ER_LOCK_WAIT_TIMEOUT
          --reap
          --disconnect con1
          --dec $run
      }
      --connection default
      DROP TABLE IF EXISTS t1, t3, t2, t4, t5;
      

      a82e42fd

      mysqld: /data/src/10.4/sql/sql_error.h:1036: uint Diagnostics_area::sql_errno() const: Assertion `m_status == DA_ERROR' failed.
      190623 19:12:25 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f22d8caff12 in __GI___assert_fail (assertion=0x55d4bd81ac94 "m_status == DA_ERROR", file=0x55d4bd81ac00 "/data/src/10.4/sql/sql_error.h", line=1036, function=0x55d4bd81b7c0 <Diagnostics_area::sql_errno() const::__PRETTY_FUNCTION__> "uint Diagnostics_area::sql_errno() const") at assert.c:101
      #8  0x000055d4bcb2c4e4 in Diagnostics_area::sql_errno (this=0x7f22880064b8) at /data/src/10.4/sql/sql_error.h:1036
      #9  0x000055d4bcf8389a in ha_rollback_trans (thd=0x7f2288000b00, all=true) at /data/src/10.4/sql/handler.cc:1919
      #10 0x000055d4bcdcfc3b in trans_rollback_implicit (thd=0x7f2288000b00) at /data/src/10.4/sql/transaction.cc:387
      #11 0x000055d4bcc4f13d in mysql_execute_command (thd=0x7f2288000b00) at /data/src/10.4/sql/sql_parse.cc:6169
      #12 0x000055d4bcc53cdb in mysql_parse (thd=0x7f2288000b00, rawbuf=0x7f2288013108 "SELECT * FROM information_schema.tables", length=39, parser_state=0x7f22ce070180, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7892
      #13 0x000055d4bcc3ff85 in dispatch_command (command=COM_QUERY, thd=0x7f2288000b00, packet=0x7f2288137ba1 "0\001Y\247", packet_length=39, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1827
      #14 0x000055d4bcc3e743 in do_command (thd=0x7f2288000b00) at /data/src/10.4/sql/sql_parse.cc:1360
      #15 0x000055d4bcdb7993 in do_handle_one_connection (connect=0x55d4bfc6fdd0) at /data/src/10.4/sql/sql_connect.cc:1403
      #16 0x000055d4bcdb76f7 in handle_one_connection (arg=0x55d4bfc6fdd0) at /data/src/10.4/sql/sql_connect.cc:1306
      #17 0x000055d4bd6e2e49 in pfs_spawn_thread (arg=0x55d4bfbee760) at /data/src/10.4/storage/perfschema/pfs.cc:1862
      #18 0x00007f22da8244a4 in start_thread (arg=0x7f22ce071700) at pthread_create.c:456
      #19 0x00007f22d8d6cd0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      No obvious effect on a non-debug build, but there is no guarantee at all, given how non-deterministic the test is.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                svoj Sergey Vojtovich
                Reporter:
                elenst Elena Stepanova
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: