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

Assertion `trx_get_dict_operation(trx) == TRX_DICT_OP_INDEX || tr x_get_dict_operation(trx) == TRX_DICT_OP_TABLE' fails upon TRUNCATE after upgrade from 10.1

    Details

      Description

      • Start 10.1 server with --innodb-page-size=32k --innodb-file-format=Barracuda (or 64k)
      • create a table as

        CREATE TABLE t1 (a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
        

      • shut down the server normally
      • start 10.3 server on the same datadir
      • run mysql_upgrade (just to rule out the effect of not running it)
      • run

        TRUNCATE t1;
        

      10.3 4c0d391c92

      mysqld: /data/src/10.3/storage/innobase/handler/ha_innodb.cc:13054: dberr_t innobase_rename_table(trx_t*, const char*, const char*): Assertion `trx_get_dict_operation(trx) == TRX_DICT_OP_INDEX || tr
      x_get_dict_operation(trx) == TRX_DICT_OP_TABLE' failed.
      180909 21:07:23 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f33d9875ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x0000562e84e79e53 in innobase_rename_table (trx=0x7f33d83e22a0, from=0x7f336839c958 "test/#sql-ib18-2772800632", to=0x7f336839c988 "test/t1") at /data/src/10.3/storage/innobase/handler/ha_innodb.cc:13053
      #9  0x0000562e84e66840 in ha_innobase::truncate (this=0x7f3368291e48) at /data/src/10.3/storage/innobase/handler/ha_innodb.cc:13211
      #10 0x0000562e84b424cb in handler::ha_truncate (this=0x7f3368291e48) at /data/src/10.3/sql/handler.cc:4305
      #11 0x0000562e84d0c46a in Sql_cmd_truncate_table::handler_truncate (this=0x7f33680140a8, thd=0x7f3368000b00, table_ref=0x7f3368013a58, is_tmp_table=false) at /data/src/10.3/sql/sql_truncate.cc:242
      #12 0x0000562e84d0cb58 in Sql_cmd_truncate_table::truncate_table (this=0x7f33680140a8, thd=0x7f3368000b00, table_ref=0x7f3368013a58) at /data/src/10.3/sql/sql_truncate.cc:446
      #13 0x0000562e84d0ccde in Sql_cmd_truncate_table::execute (this=0x7f33680140a8, thd=0x7f3368000b00) at /data/src/10.3/sql/sql_truncate.cc:502
      #14 0x0000562e84851bc5 in mysql_execute_command (thd=0x7f3368000b00) at /data/src/10.3/sql/sql_parse.cc:6285
      #15 0x0000562e84856c64 in mysql_parse (thd=0x7f3368000b00, rawbuf=0x7f3368013990 "truncate t1", length=11, parser_state=0x7f33d8349640, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:8089
      #16 0x0000562e84843f1a in dispatch_command (command=COM_QUERY, thd=0x7f3368000b00, packet=0x7f336801ba71 "truncate t1", packet_length=11, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1850
      #17 0x0000562e8484293e in do_command (thd=0x7f3368000b00) at /data/src/10.3/sql/sql_parse.cc:1395
      #18 0x0000562e849a9783 in do_handle_one_connection (connect=0x562e87297400) at /data/src/10.3/sql/sql_connect.cc:1402
      #19 0x0000562e849a9507 in handle_one_connection (arg=0x562e87297400) at /data/src/10.3/sql/sql_connect.cc:1308
      #20 0x00007f33db54c494 in start_thread (arg=0x7f33d834a700) at pthread_create.c:333
      #21 0x00007f33d993293f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      An example of the datadir stored after shutting down 10.1 server is attached.

      Please note that something is not quite right with the table. First of all, when it's created, InnoDB throws a warning that the parameters are illegal and claims to create a table with ROW_FORMAT=COMPACT, but SHOW TABLE STATUS shows Dynamic (see MDEV-17160 for more detail).
      But what's more worrisome than just a wrong message is that the crash above doesn't happen upon a table created right away with DYNAMIC (or COMPACT) format, but only with the table which was attempted to be created with COMPRESSED format, which suggests that the table is different somehow, which is unexpected.

      That is, if we create on 10.1 three tables like this:

      MariaDB [test]> CREATE TABLE t1 (a INT) ENGINE=InnoDB ROW_FORMAT=COMPACT;
      Query OK, 0 rows affected (0.28 sec)
       
      MariaDB [test]> CREATE TABLE t2 (a INT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
      Query OK, 0 rows affected (0.29 sec)
       
      MariaDB [test]> CREATE TABLE t3 (a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
      Query OK, 0 rows affected, 1 warning (0.28 sec)
       
      MariaDB [test]> show warnings;
      +---------+------+----------------------------------------------------------------------------------------------------+
      | Level   | Code | Message                                                                                            |
      +---------+------+----------------------------------------------------------------------------------------------------+
      | Warning | 1478 | InnoDB: Cannot create a COMPRESSED table when innodb_page_size > 16k. Assuming ROW_FORMAT=COMPACT. |
      +---------+------+----------------------------------------------------------------------------------------------------+
      1 row in set (0.00 sec)
      

      The last two appear identical in SHOW TABLE STATUS:

      MariaDB [test]> show table status;
      +------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+-------------------+----------+-----------------------+---------+
      | Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment | Create_time         | Update_time | Check_time | Collation         | Checksum | Create_options        | Comment |
      +------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+-------------------+----------+-----------------------+---------+
      | t1   | InnoDB |      10 | Compact    |    0 |              0 |       32768 |               0 |            0 |         0 |           NULL | 2018-09-09 21:15:30 | NULL        | NULL       | latin1_swedish_ci |     NULL | row_format=COMPACT    |         |
      | t2   | InnoDB |      10 | Dynamic    |    0 |              0 |       32768 |               0 |            0 |         0 |           NULL | 2018-09-09 21:15:37 | NULL        | NULL       | latin1_swedish_ci |     NULL | row_format=DYNAMIC    |         |
      | t3   | InnoDB |      10 | Dynamic    |    0 |              0 |       32768 |               0 |            0 |         0 |           NULL | 2018-09-09 21:15:52 | NULL        | NULL       | latin1_swedish_ci |     NULL | row_format=COMPRESSED |         |
      +------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+-------------------+----------+-----------------------+---------+
      3 rows in set (0.00 sec)
      

      But the crash above only happens on t3.

      The problem appeared in 10.3 tree just recently, in the past days.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: