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

InnoDB: Failing assertion: table->get_ref_count() == 0 upon truncating a temporary table

Details

    Description

      Note: I have no idea why PREPARE is important in the scenario below, but it doesn't crash without it.

      --source include/have_innodb.inc
       
      CREATE TEMPORARY TABLE t ENGINE=InnoDB SELECT 1 AS a;
      PREPARE stmt FROM 'CREATE TEMPORARY TABLE t SELECT 1 AS b FROM t';
      TRUNCATE TABLE t;
      

      10.3 6b61f1bbad1a ASAN build

      2018-09-10 18:14:41 0x7f558e7de700  InnoDB: Assertion failure in file /data/src/10.3/storage/innobase/dict/dict0dict.cc line 1986
      InnoDB: Failing assertion: table->get_ref_count() == 0
       
      ut/ut0dbg.cc:62(__static_initialization_and_destruction_0(int, int))[0x557f0b975f47]
      dict/dict0dict.cc:1987(dict_table_remove_from_cache_low(dict_table_t*, unsigned long))[0x557f0babc2a5]
      dict/dict0dict.cc:2070(dict_table_remove_from_cache(dict_table_t*))[0x557f0babd33a]
      row/row0mysql.cc:3470(row_drop_table_for_mysql(char const*, trx_t*, enum_sql_command, bool, bool))[0x557f0b801e15]
      handler/ha_innodb.cc:12833(ha_innobase::delete_table(char const*, enum_sql_command))[0x557f0b5a9c18]
      handler/ha_innodb.cc:13224(ha_innobase::truncate())[0x557f0b57f8ca]
      sql/handler.cc:4306(handler::ha_truncate())[0x557f0adb42ff]
      sql/sql_truncate.cc:242(Sql_cmd_truncate_table::handler_truncate(THD*, TABLE_LIST*, bool))[0x557f0b20ab7e]
      sql/sql_truncate.cc:404(Sql_cmd_truncate_table::truncate_table(THD*, TABLE_LIST*))[0x557f0b20bb7d]
      sql/sql_truncate.cc:502(Sql_cmd_truncate_table::execute(THD*))[0x557f0b20c1dd]
      sql/sql_parse.cc:6285(mysql_execute_command(THD*))[0x557f0a6b06c8]
      sql/sql_parse.cc:8089(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x557f0a6bb55d]
      sql/sql_parse.cc:1852(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x557f0a6957e8]
      sql/sql_parse.cc:1395(do_command(THD*))[0x557f0a692870]
      sql/sql_connect.cc:1402(do_handle_one_connection(CONNECT*))[0x557f0aa02b2c]
      sql/sql_connect.cc:1309(handle_one_connection)[0x557f0aa02538]
      perfschema/pfs.cc:1864(pfs_spawn_thread)[0x557f0b51c51c]
      nptl/pthread_create.c:333(start_thread)[0x7f84f666d494]
      x86_64/clone.S:99(clone)[0x7f84f4a5393f]
       
      Trying to get some variables.
      Some pointers may be invalid and cause the dump to abort.
      Query (0x62b000000288): TRUNCATE TABLE t
      Connection ID (thread ID): 9
      Status: NOT_KILLED
      

      The failure starting happening in 10.3 from this commit:

      commit 5a1868b58d26b286b6ad433096e7184895953311
      Merge: 4901f31 980d1bf
      Author: Marko Mäkelä <marko.makela@mariadb.com>
      Date:   Fri Sep 7 22:15:06 2018 +0300
       
          MDEV-13564 Mariabackup does not work with TRUNCATE
      

      Attachments

        Issue Links

          Activity

            elenst Elena Stepanova created issue -

            The test seems to work without crashes on the 10.2-based branch that I merged to 10.3, but it does crash in 10.3.
            The InnoDB code in this area should be similar between the two branches, so I would suspect something in the SQL layer.

            marko Marko Mäkelä added a comment - The test seems to work without crashes on the 10.2-based branch that I merged to 10.3, but it does crash in 10.3. The InnoDB code in this area should be similar between the two branches, so I would suspect something in the SQL layer.
            marko Marko Mäkelä made changes -
            Field Original Value New Value
            Status Open [ 1 ] Confirmed [ 10101 ]
            elenst Elena Stepanova made changes -
            Labels regression
            elenst Elena Stepanova made changes -
            Description _Note: I have no idea why PREPARE is important in the scenario below, but it doesn't crash without it._

            {code:sql}
            --source include/have_innodb.inc

            CREATE TEMPORARY TABLE t ENGINE=InnoDB SELECT 1 AS a;
            PREPARE stmt FROM 'CREATE TEMPORARY TABLE t SELECT 1 AS b FROM t';
            TRUNCATE TABLE t;
            {code}
            {noformat:title=10.3 6b61f1bbad1a ASAN build}
            2018-09-10 18:14:41 0x7f558e7de700 InnoDB: Assertion failure in file /data/src/10.3/storage/innobase/dict/dict0dict.cc line 1986
            InnoDB: Failing assertion: table->get_ref_count() == 0

            ut/ut0dbg.cc:62(__static_initialization_and_destruction_0(int, int))[0x557f0b975f47]
            dict/dict0dict.cc:1987(dict_table_remove_from_cache_low(dict_table_t*, unsigned long))[0x557f0babc2a5]
            dict/dict0dict.cc:2070(dict_table_remove_from_cache(dict_table_t*))[0x557f0babd33a]
            row/row0mysql.cc:3470(row_drop_table_for_mysql(char const*, trx_t*, enum_sql_command, bool, bool))[0x557f0b801e15]
            handler/ha_innodb.cc:12833(ha_innobase::delete_table(char const*, enum_sql_command))[0x557f0b5a9c18]
            handler/ha_innodb.cc:13224(ha_innobase::truncate())[0x557f0b57f8ca]
            sql/handler.cc:4306(handler::ha_truncate())[0x557f0adb42ff]
            sql/sql_truncate.cc:242(Sql_cmd_truncate_table::handler_truncate(THD*, TABLE_LIST*, bool))[0x557f0b20ab7e]
            sql/sql_truncate.cc:404(Sql_cmd_truncate_table::truncate_table(THD*, TABLE_LIST*))[0x557f0b20bb7d]
            sql/sql_truncate.cc:502(Sql_cmd_truncate_table::execute(THD*))[0x557f0b20c1dd]
            sql/sql_parse.cc:6285(mysql_execute_command(THD*))[0x557f0a6b06c8]
            sql/sql_parse.cc:8089(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x557f0a6bb55d]
            sql/sql_parse.cc:1852(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x557f0a6957e8]
            sql/sql_parse.cc:1395(do_command(THD*))[0x557f0a692870]
            sql/sql_connect.cc:1402(do_handle_one_connection(CONNECT*))[0x557f0aa02b2c]
            sql/sql_connect.cc:1309(handle_one_connection)[0x557f0aa02538]
            perfschema/pfs.cc:1864(pfs_spawn_thread)[0x557f0b51c51c]
            nptl/pthread_create.c:333(start_thread)[0x7f84f666d494]
            x86_64/clone.S:99(clone)[0x7f84f4a5393f]

            Trying to get some variables.
            Some pointers may be invalid and cause the dump to abort.
            Query (0x62b000000288): TRUNCATE TABLE t
            Connection ID (thread ID): 9
            Status: NOT_KILLED
            {noformat}
            _Note: I have no idea why PREPARE is important in the scenario below, but it doesn't crash without it._

            {code:sql}
            --source include/have_innodb.inc

            CREATE TEMPORARY TABLE t ENGINE=InnoDB SELECT 1 AS a;
            PREPARE stmt FROM 'CREATE TEMPORARY TABLE t SELECT 1 AS b FROM t';
            TRUNCATE TABLE t;
            {code}
            {noformat:title=10.3 6b61f1bbad1a ASAN build}
            2018-09-10 18:14:41 0x7f558e7de700 InnoDB: Assertion failure in file /data/src/10.3/storage/innobase/dict/dict0dict.cc line 1986
            InnoDB: Failing assertion: table->get_ref_count() == 0

            ut/ut0dbg.cc:62(__static_initialization_and_destruction_0(int, int))[0x557f0b975f47]
            dict/dict0dict.cc:1987(dict_table_remove_from_cache_low(dict_table_t*, unsigned long))[0x557f0babc2a5]
            dict/dict0dict.cc:2070(dict_table_remove_from_cache(dict_table_t*))[0x557f0babd33a]
            row/row0mysql.cc:3470(row_drop_table_for_mysql(char const*, trx_t*, enum_sql_command, bool, bool))[0x557f0b801e15]
            handler/ha_innodb.cc:12833(ha_innobase::delete_table(char const*, enum_sql_command))[0x557f0b5a9c18]
            handler/ha_innodb.cc:13224(ha_innobase::truncate())[0x557f0b57f8ca]
            sql/handler.cc:4306(handler::ha_truncate())[0x557f0adb42ff]
            sql/sql_truncate.cc:242(Sql_cmd_truncate_table::handler_truncate(THD*, TABLE_LIST*, bool))[0x557f0b20ab7e]
            sql/sql_truncate.cc:404(Sql_cmd_truncate_table::truncate_table(THD*, TABLE_LIST*))[0x557f0b20bb7d]
            sql/sql_truncate.cc:502(Sql_cmd_truncate_table::execute(THD*))[0x557f0b20c1dd]
            sql/sql_parse.cc:6285(mysql_execute_command(THD*))[0x557f0a6b06c8]
            sql/sql_parse.cc:8089(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x557f0a6bb55d]
            sql/sql_parse.cc:1852(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x557f0a6957e8]
            sql/sql_parse.cc:1395(do_command(THD*))[0x557f0a692870]
            sql/sql_connect.cc:1402(do_handle_one_connection(CONNECT*))[0x557f0aa02b2c]
            sql/sql_connect.cc:1309(handle_one_connection)[0x557f0aa02538]
            perfschema/pfs.cc:1864(pfs_spawn_thread)[0x557f0b51c51c]
            nptl/pthread_create.c:333(start_thread)[0x7f84f666d494]
            x86_64/clone.S:99(clone)[0x7f84f4a5393f]

            Trying to get some variables.
            Some pointers may be invalid and cause the dump to abort.
            Query (0x62b000000288): TRUNCATE TABLE t
            Connection ID (thread ID): 9
            Status: NOT_KILLED
            {noformat}

            The failure starting happening in 10.3 from this commit:
            {noformat}
            commit 5a1868b58d26b286b6ad433096e7184895953311
            Merge: 4901f31 980d1bf
            Author: Marko Mäkelä <marko.makela@mariadb.com>
            Date: Fri Sep 7 22:15:06 2018 +0300

                MDEV-13564 Mariabackup does not work with TRUNCATE
            {noformat}
            svoj Sergey Vojtovich made changes -
            Assignee Marko Mäkelä [ marko ] Sergey Vojtovich [ svoj ]

            serg, please review fix for this bug. I'm not completely sure on replication and LOCK TABLES impact, however basic tests passed.

            Patch: https://github.com/MariaDB/server/commit/e11e0e6c8b9a85ca7f16c6b9b28fb505d464a96e

            svoj Sergey Vojtovich added a comment - serg , please review fix for this bug. I'm not completely sure on replication and LOCK TABLES impact, however basic tests passed. Patch: https://github.com/MariaDB/server/commit/e11e0e6c8b9a85ca7f16c6b9b28fb505d464a96e
            svoj Sergey Vojtovich made changes -
            Assignee Sergey Vojtovich [ svoj ] Sergei Golubchik [ serg ]
            Status Confirmed [ 10101 ] In Review [ 10002 ]
            elenst Elena Stepanova made changes -
            Labels regression affects-tests regression
            serg Sergei Golubchik made changes -
            Assignee Sergei Golubchik [ serg ] Sergey Vojtovich [ svoj ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            elenst Elena Stepanova made changes -
            Priority Major [ 3 ] Blocker [ 1 ]
            svoj Sergey Vojtovich made changes -
            Fix Version/s 10.3.10 [ 23140 ]
            Fix Version/s 10.3 [ 22126 ]
            Resolution Fixed [ 1 ]
            Status Stalled [ 10000 ] Closed [ 6 ]
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            Fix Version/s 10.2.25 [ 23408 ]
            Fix Version/s 10.4.0 [ 23115 ]
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 89513 ] MariaDB v4 [ 154913 ]

            People

              svoj Sergey Vojtovich
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              5 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.