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

SEGV in ha_innobase::discard_or_import_tablespace

Details

    Description

      worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 16000..16019
      SET SESSION sql_mode = 'NO_ENGINE_SUBSTITUTION' ;
      SET DEFAULT_STORAGE_ENGINE= 'InnoDB' ;
      USE test ;
      CREATE TABLE `t1` (
      `col_varchar_255` varchar(255),
      `col_int` int,
      `col_text` text) ENGINE=innodb ;
      FLUSH TABLES t1 FOR EXPORT ;
      UNLOCK TABLES ;
      CREATE TABLE imp_t1 LIKE t1 ;
      ALTER TABLE imp_t1 ADD KEY idx ( col_text(13) ) ;
      'copy ibd file around'
      ALTER TABLE imp_t1 DISCARD TABLESPACE ;
      ALTER TABLE imp_t1 IMPORT TABLESPACE ;
      ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB
      'copy ibd file around'
      ALTER TABLE imp_t1 IMPORT TABLESPACE ;
      ERROR HY000: Lost connection to server during query
      DROP TABLE t1, imp_t1 ;
      main.ML_import1 'innodb'                 [ fail ]
              Test ended at 2021-07-12 09:31:01
       
      CURRENT_TEST: main.ML_import1
      /data/Server_bin/10.6G_fast/bin/mysqltest: Can't create/write to file '/data/Server_bin/10.6G_fast/mysql-test/var/mysqld.1/data/test/imp_t1.ibd' (Errcode: 17 "File exists")
      mysqltest: At line 35: query 'DROP TABLE t1, imp_t1 ' failed: <Unknown> (2006): Server has gone away
      ...
      2021-07-12  9:31:00 0 [Note] /data/Server_bin/10.6G_fast/bin/mariadbd: ready for connections.
      Version: '10.6.3-MariaDB-log'  socket: '/data/Server_bin/10.6G_fast/mysql-test/var/tmp/mysqld.1.sock'  port: 16000  Source distribution
      2021-07-12  9:31:00 4 [Note] InnoDB: Sync to disk of `test`.`t1` started.
      2021-07-12  9:31:00 4 [Note] InnoDB: Stopping purge
      2021-07-12  9:31:00 4 [Note] InnoDB: Writing table metadata to './test/t1.cfg'
      2021-07-12  9:31:00 4 [Note] InnoDB: Table `test`.`t1` flushed to disk
      2021-07-12  9:31:00 4 [Note] InnoDB: Deleting the meta-data file './test/t1.cfg'
      2021-07-12  9:31:00 4 [Note] InnoDB: Resuming purge
      2021-07-12  9:31:00 4 [ERROR] InnoDB: Operating system error number 2 in a file operation.
      2021-07-12  9:31:00 4 [ERROR] InnoDB: The error means the system cannot find the path specified.
      2021-07-12  9:31:00 4 [ERROR] InnoDB: Trying to import a tablespace, but could not open the tablespace file ./test/imp_t1.ibd
      2021-07-12  9:31:00 4 [Note] InnoDB: Discarding tablespace of table `test`.`imp_t1`: Tablespace not found
      2021-07-12  9:31:00 4 [Note] InnoDB: Sync to disk
      2021-07-12  9:31:00 4 [Note] InnoDB: Sync to disk - done!
      2021-07-12  9:31:00 4 [Warning] InnoDB: Table `test`.`imp_t1` should have 2 indexes but the tablespace has 1 indexes
      2021-07-12  9:31:00 4 [Note] InnoDB: Phase I - Update all pages
      2021-07-12  9:31:00 4 [Note] InnoDB: Sync to disk
      2021-07-12  9:31:00 4 [Note] InnoDB: Sync to disk - done!
      2021-07-12  9:31:00 4 [Warning] InnoDB: Skip adjustment of root pages for index `idx`.
      2021-07-12  9:31:00 4 [Note] InnoDB: Phase III - Flush changes to disk
      2021-07-12  9:31:00 4 [Note] InnoDB: Phase IV - Flush complete
      2021-07-12  9:31:00 4 [ERROR] InnoDB: Index `idx` of table `test`.`imp_t1` is corrupted
      2021-07-12  9:31:00 4 [Note] InnoDB: Load corrupted index `idx` of table `test`.`imp_t1`
      2021-07-12  9:31:00 4 [ERROR] InnoDB: Trying to load index `idx` for table `test`.`imp_t1`, but the index tree has been freed!
      2021-07-12  9:31:00 4 [Warning] InnoDB: Failed to load table `test`.`imp_t1`:Data structure corruption
      210712  9:31:00 [ERROR] mysqld got signal 11 ;
      ...
      Query (0x7f3bbc010650): ALTER TABLE imp_t1 IMPORT TABLESPACE
      Connection ID (thread ID): 4
      Status: NOT_KILLED
       
      #3  <signal handler called>
      #4  0x000055c41ab763e0 in ha_innobase::discard_or_import_tablespace (this=0x7f3bbc0baa70, discard=<optimized out>) at /data/Server/10.6G/storage/innobase/handler/ha_innodb.cc:13201
      #5  0x000055c41a77ff96 in mysql_discard_or_import_tablespace (thd=thd@entry=0x7f3bbc000c58, table_list=table_list@entry=0x7f3bbc010740, discard=<optimized out>) at /data/Server/10.6G/sql/sql_table.cc:5463
      #6  0x000055c41a7ebe54 in Sql_cmd_discard_import_tablespace::execute (this=0x7f3bbc010e28, thd=0x7f3bbc000c58) at /data/Server/10.6G/sql/sql_alter.cc:591
      #7  0x000055c41a6ed626 in mysql_execute_command (thd=0x7f3bbc000c58, is_called_from_prepared_stmt=<optimized out>) at /data/Server/10.6G/sql/sql_parse.cc:5995
      #8  0x000055c41a6de446 in mysql_parse (rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>, thd=0x7f3bbc000c58) at /data/Server/10.6G/sql/sql_parse.cc:8028
      #9  mysql_parse (thd=0x7f3bbc000c58, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>) at /data/Server/10.6G/sql/sql_parse.cc:7950
      #10 0x000055c41a6e9e12 in dispatch_command (command=COM_QUERY, thd=0x7f3bbc000c58, packet=<optimized out>, packet_length=<optimized out>, blocking=<optimized out>) at /data/Server/10.6G/sql/sql_class.h:1340
      #11 0x000055c41a6eba98 in do_command (thd=0x7f3bbc000c58, blocking=blocking@entry=true) at /data/Server/10.6G/sql/sql_parse.cc:1406
      #12 0x000055c41a7e7837 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55c41e0a5a58, put_in_cache=put_in_cache@entry=true) at /data/Server/10.6G/sql/sql_connect.cc:1410
      #13 0x000055c41a7e7b2d in handle_one_connection (arg=0x55c41e0a5a58) at /data/Server/10.6G/sql/sql_connect.cc:1312
      #14 0x00007f3bf84df609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #15 0x00007f3bf80b3293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      GIT_SHOW: HEAD, origin/HEAD, origin/10.6, 10.6 315380a4d16ddb16461d906a23be341e354c30ed 2021-07-01T19:06:53+03:00

      I am aware that the MTR test shows some rather ugly scenario. But mistakes happen and they should not end up with SEGV.

      Attachments

        Issue Links

          Activity

            mleich Matthias Leich created issue -
            mleich Matthias Leich made changes -
            Field Original Value New Value
            Description
            {noformat}

            {noformat}
            worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 16000..16019
            SET SESSION sql_mode = 'NO_ENGINE_SUBSTITUTION' ;
            SET DEFAULT_STORAGE_ENGINE= 'InnoDB' ;
            USE test ;
            CREATE TABLE `t1` (
            `col_varchar_255` varchar(255),
            `col_int` int,
            `col_text` text) ENGINE=innodb ;
            FLUSH TABLES t1 FOR EXPORT ;
            UNLOCK TABLES ;
            CREATE TABLE imp_t1 LIKE t1 ;
            ALTER TABLE imp_t1 ADD KEY idx ( col_text(13) ) ;
            'copy ibd file around'
            ALTER TABLE imp_t1 DISCARD TABLESPACE ;
            ALTER TABLE imp_t1 IMPORT TABLESPACE ;
            ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB
            'copy ibd file around'
            ALTER TABLE imp_t1 IMPORT TABLESPACE ;
            ERROR HY000: Lost connection to server during query
            DROP TABLE t1, imp_t1 ;
            main.ML_import1 'innodb' [ fail ]
                    Test ended at 2021-07-12 09:31:01

            CURRENT_TEST: main.ML_import1
            /data/Server_bin/10.6G_fast/bin/mysqltest: Can't create/write to file '/data/Server_bin/10.6G_fast/mysql-test/var/mysqld.1/data/test/imp_t1.ibd' (Errcode: 17 "File exists")
            mysqltest: At line 35: query 'DROP TABLE t1, imp_t1 ' failed: <Unknown> (2006): Server has gone away
            ...
            2021-07-12 9:31:00 0 [Note] /data/Server_bin/10.6G_fast/bin/mariadbd: ready for connections.
            Version: '10.6.3-MariaDB-log' socket: '/data/Server_bin/10.6G_fast/mysql-test/var/tmp/mysqld.1.sock' port: 16000 Source distribution
            2021-07-12 9:31:00 4 [Note] InnoDB: Sync to disk of `test`.`t1` started.
            2021-07-12 9:31:00 4 [Note] InnoDB: Stopping purge
            2021-07-12 9:31:00 4 [Note] InnoDB: Writing table metadata to './test/t1.cfg'
            2021-07-12 9:31:00 4 [Note] InnoDB: Table `test`.`t1` flushed to disk
            2021-07-12 9:31:00 4 [Note] InnoDB: Deleting the meta-data file './test/t1.cfg'
            2021-07-12 9:31:00 4 [Note] InnoDB: Resuming purge
            2021-07-12 9:31:00 4 [ERROR] InnoDB: Operating system error number 2 in a file operation.
            2021-07-12 9:31:00 4 [ERROR] InnoDB: The error means the system cannot find the path specified.
            2021-07-12 9:31:00 4 [ERROR] InnoDB: Trying to import a tablespace, but could not open the tablespace file ./test/imp_t1.ibd
            2021-07-12 9:31:00 4 [Note] InnoDB: Discarding tablespace of table `test`.`imp_t1`: Tablespace not found
            2021-07-12 9:31:00 4 [Note] InnoDB: Sync to disk
            2021-07-12 9:31:00 4 [Note] InnoDB: Sync to disk - done!
            2021-07-12 9:31:00 4 [Warning] InnoDB: Table `test`.`imp_t1` should have 2 indexes but the tablespace has 1 indexes
            2021-07-12 9:31:00 4 [Note] InnoDB: Phase I - Update all pages
            2021-07-12 9:31:00 4 [Note] InnoDB: Sync to disk
            2021-07-12 9:31:00 4 [Note] InnoDB: Sync to disk - done!
            2021-07-12 9:31:00 4 [Warning] InnoDB: Skip adjustment of root pages for index `idx`.
            2021-07-12 9:31:00 4 [Note] InnoDB: Phase III - Flush changes to disk
            2021-07-12 9:31:00 4 [Note] InnoDB: Phase IV - Flush complete
            2021-07-12 9:31:00 4 [ERROR] InnoDB: Index `idx` of table `test`.`imp_t1` is corrupted
            2021-07-12 9:31:00 4 [Note] InnoDB: Load corrupted index `idx` of table `test`.`imp_t1`
            2021-07-12 9:31:00 4 [ERROR] InnoDB: Trying to load index `idx` for table `test`.`imp_t1`, but the index tree has been freed!
            2021-07-12 9:31:00 4 [Warning] InnoDB: Failed to load table `test`.`imp_t1`:Data structure corruption
            210712 9:31:00 [ERROR] mysqld got signal 11 ;
            ...
            Query (0x7f3bbc010650): ALTER TABLE imp_t1 IMPORT TABLESPACE
            Connection ID (thread ID): 4
            Status: NOT_KILLED

            #3 <signal handler called>
            #4 0x000055c41ab763e0 in ha_innobase::discard_or_import_tablespace (this=0x7f3bbc0baa70, discard=<optimized out>) at /data/Server/10.6G/storage/innobase/handler/ha_innodb.cc:13201
            #5 0x000055c41a77ff96 in mysql_discard_or_import_tablespace (thd=thd@entry=0x7f3bbc000c58, table_list=table_list@entry=0x7f3bbc010740, discard=<optimized out>) at /data/Server/10.6G/sql/sql_table.cc:5463
            #6 0x000055c41a7ebe54 in Sql_cmd_discard_import_tablespace::execute (this=0x7f3bbc010e28, thd=0x7f3bbc000c58) at /data/Server/10.6G/sql/sql_alter.cc:591
            #7 0x000055c41a6ed626 in mysql_execute_command (thd=0x7f3bbc000c58, is_called_from_prepared_stmt=<optimized out>) at /data/Server/10.6G/sql/sql_parse.cc:5995
            #8 0x000055c41a6de446 in mysql_parse (rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>, thd=0x7f3bbc000c58) at /data/Server/10.6G/sql/sql_parse.cc:8028
            #9 mysql_parse (thd=0x7f3bbc000c58, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>) at /data/Server/10.6G/sql/sql_parse.cc:7950
            #10 0x000055c41a6e9e12 in dispatch_command (command=COM_QUERY, thd=0x7f3bbc000c58, packet=<optimized out>, packet_length=<optimized out>, blocking=<optimized out>) at /data/Server/10.6G/sql/sql_class.h:1340
            #11 0x000055c41a6eba98 in do_command (thd=0x7f3bbc000c58, blocking=blocking@entry=true) at /data/Server/10.6G/sql/sql_parse.cc:1406
            #12 0x000055c41a7e7837 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55c41e0a5a58, put_in_cache=put_in_cache@entry=true) at /data/Server/10.6G/sql/sql_connect.cc:1410
            #13 0x000055c41a7e7b2d in handle_one_connection (arg=0x55c41e0a5a58) at /data/Server/10.6G/sql/sql_connect.cc:1312
            #14 0x00007f3bf84df609 in start_thread (arg=<optimized out>) at pthread_create.c:477
            #15 0x00007f3bf80b3293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

            GIT_SHOW: HEAD, origin/HEAD, origin/10.6, 10.6 315380a4d16ddb16461d906a23be341e354c30ed 2021-07-01T19:06:53+03:00
            {noformat}

            {noformat}
            worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 16000..16019
            SET SESSION sql_mode = 'NO_ENGINE_SUBSTITUTION' ;
            SET DEFAULT_STORAGE_ENGINE= 'InnoDB' ;
            USE test ;
            CREATE TABLE `t1` (
            `col_varchar_255` varchar(255),
            `col_int` int,
            `col_text` text) ENGINE=innodb ;
            FLUSH TABLES t1 FOR EXPORT ;
            UNLOCK TABLES ;
            CREATE TABLE imp_t1 LIKE t1 ;
            ALTER TABLE imp_t1 ADD KEY idx ( col_text(13) ) ;
            'copy ibd file around'
            ALTER TABLE imp_t1 DISCARD TABLESPACE ;
            ALTER TABLE imp_t1 IMPORT TABLESPACE ;
            ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB
            'copy ibd file around'
            ALTER TABLE imp_t1 IMPORT TABLESPACE ;
            ERROR HY000: Lost connection to server during query
            DROP TABLE t1, imp_t1 ;
            main.ML_import1 'innodb' [ fail ]
                    Test ended at 2021-07-12 09:31:01

            CURRENT_TEST: main.ML_import1
            /data/Server_bin/10.6G_fast/bin/mysqltest: Can't create/write to file '/data/Server_bin/10.6G_fast/mysql-test/var/mysqld.1/data/test/imp_t1.ibd' (Errcode: 17 "File exists")
            mysqltest: At line 35: query 'DROP TABLE t1, imp_t1 ' failed: <Unknown> (2006): Server has gone away
            ...
            2021-07-12 9:31:00 0 [Note] /data/Server_bin/10.6G_fast/bin/mariadbd: ready for connections.
            Version: '10.6.3-MariaDB-log' socket: '/data/Server_bin/10.6G_fast/mysql-test/var/tmp/mysqld.1.sock' port: 16000 Source distribution
            2021-07-12 9:31:00 4 [Note] InnoDB: Sync to disk of `test`.`t1` started.
            2021-07-12 9:31:00 4 [Note] InnoDB: Stopping purge
            2021-07-12 9:31:00 4 [Note] InnoDB: Writing table metadata to './test/t1.cfg'
            2021-07-12 9:31:00 4 [Note] InnoDB: Table `test`.`t1` flushed to disk
            2021-07-12 9:31:00 4 [Note] InnoDB: Deleting the meta-data file './test/t1.cfg'
            2021-07-12 9:31:00 4 [Note] InnoDB: Resuming purge
            2021-07-12 9:31:00 4 [ERROR] InnoDB: Operating system error number 2 in a file operation.
            2021-07-12 9:31:00 4 [ERROR] InnoDB: The error means the system cannot find the path specified.
            2021-07-12 9:31:00 4 [ERROR] InnoDB: Trying to import a tablespace, but could not open the tablespace file ./test/imp_t1.ibd
            2021-07-12 9:31:00 4 [Note] InnoDB: Discarding tablespace of table `test`.`imp_t1`: Tablespace not found
            2021-07-12 9:31:00 4 [Note] InnoDB: Sync to disk
            2021-07-12 9:31:00 4 [Note] InnoDB: Sync to disk - done!
            2021-07-12 9:31:00 4 [Warning] InnoDB: Table `test`.`imp_t1` should have 2 indexes but the tablespace has 1 indexes
            2021-07-12 9:31:00 4 [Note] InnoDB: Phase I - Update all pages
            2021-07-12 9:31:00 4 [Note] InnoDB: Sync to disk
            2021-07-12 9:31:00 4 [Note] InnoDB: Sync to disk - done!
            2021-07-12 9:31:00 4 [Warning] InnoDB: Skip adjustment of root pages for index `idx`.
            2021-07-12 9:31:00 4 [Note] InnoDB: Phase III - Flush changes to disk
            2021-07-12 9:31:00 4 [Note] InnoDB: Phase IV - Flush complete
            2021-07-12 9:31:00 4 [ERROR] InnoDB: Index `idx` of table `test`.`imp_t1` is corrupted
            2021-07-12 9:31:00 4 [Note] InnoDB: Load corrupted index `idx` of table `test`.`imp_t1`
            2021-07-12 9:31:00 4 [ERROR] InnoDB: Trying to load index `idx` for table `test`.`imp_t1`, but the index tree has been freed!
            2021-07-12 9:31:00 4 [Warning] InnoDB: Failed to load table `test`.`imp_t1`:Data structure corruption
            210712 9:31:00 [ERROR] mysqld got signal 11 ;
            ...
            Query (0x7f3bbc010650): ALTER TABLE imp_t1 IMPORT TABLESPACE
            Connection ID (thread ID): 4
            Status: NOT_KILLED

            #3 <signal handler called>
            #4 0x000055c41ab763e0 in ha_innobase::discard_or_import_tablespace (this=0x7f3bbc0baa70, discard=<optimized out>) at /data/Server/10.6G/storage/innobase/handler/ha_innodb.cc:13201
            #5 0x000055c41a77ff96 in mysql_discard_or_import_tablespace (thd=thd@entry=0x7f3bbc000c58, table_list=table_list@entry=0x7f3bbc010740, discard=<optimized out>) at /data/Server/10.6G/sql/sql_table.cc:5463
            #6 0x000055c41a7ebe54 in Sql_cmd_discard_import_tablespace::execute (this=0x7f3bbc010e28, thd=0x7f3bbc000c58) at /data/Server/10.6G/sql/sql_alter.cc:591
            #7 0x000055c41a6ed626 in mysql_execute_command (thd=0x7f3bbc000c58, is_called_from_prepared_stmt=<optimized out>) at /data/Server/10.6G/sql/sql_parse.cc:5995
            #8 0x000055c41a6de446 in mysql_parse (rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>, thd=0x7f3bbc000c58) at /data/Server/10.6G/sql/sql_parse.cc:8028
            #9 mysql_parse (thd=0x7f3bbc000c58, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>) at /data/Server/10.6G/sql/sql_parse.cc:7950
            #10 0x000055c41a6e9e12 in dispatch_command (command=COM_QUERY, thd=0x7f3bbc000c58, packet=<optimized out>, packet_length=<optimized out>, blocking=<optimized out>) at /data/Server/10.6G/sql/sql_class.h:1340
            #11 0x000055c41a6eba98 in do_command (thd=0x7f3bbc000c58, blocking=blocking@entry=true) at /data/Server/10.6G/sql/sql_parse.cc:1406
            #12 0x000055c41a7e7837 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55c41e0a5a58, put_in_cache=put_in_cache@entry=true) at /data/Server/10.6G/sql/sql_connect.cc:1410
            #13 0x000055c41a7e7b2d in handle_one_connection (arg=0x55c41e0a5a58) at /data/Server/10.6G/sql/sql_connect.cc:1312
            #14 0x00007f3bf84df609 in start_thread (arg=<optimized out>) at pthread_create.c:477
            #15 0x00007f3bf80b3293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

            GIT_SHOW: HEAD, origin/HEAD, origin/10.6, 10.6 315380a4d16ddb16461d906a23be341e354c30ed 2021-07-01T19:06:53+03:00

            I am aware that the MTR test shows some rather ugly scenario. But mistakes happen and they should not end up with SEGV.
            mleich Matthias Leich made changes -
            Assignee Matthias Leich [ mleich ] Eugene Kosov [ kevg ]
            Summary Draft: SEGV in ha_innobase::discard_or_import_tablespace SEGV in ha_innobase::discard_or_import_tablespace
            thiru Thirunarayanan Balathandayuthapani made changes -
            Assignee Eugene Kosov [ kevg ] Thirunarayanan Balathandayuthapani [ thiru ]
            thiru Thirunarayanan Balathandayuthapani made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            thiru Thirunarayanan Balathandayuthapani made changes -
            Affects Version/s 10.3 [ 22126 ]
            Affects Version/s 10.4 [ 22408 ]
            Affects Version/s 10.5 [ 23123 ]
            thiru Thirunarayanan Balathandayuthapani made changes -
            Fix Version/s 10.3 [ 22126 ]
            Fix Version/s 10.4 [ 22408 ]
            Fix Version/s 10.5 [ 23123 ]
            thiru Thirunarayanan Balathandayuthapani made changes -
            Assignee Thirunarayanan Balathandayuthapani [ thiru ] Marko Mäkelä [ marko ]
            Status In Progress [ 3 ] In Review [ 10002 ]
            marko Marko Mäkelä made changes -
            Assignee Marko Mäkelä [ marko ] Thirunarayanan Balathandayuthapani [ thiru ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            mleich Matthias Leich made changes -
            mleich Matthias Leich made changes -
            marko Marko Mäkelä made changes -
            thiru Thirunarayanan Balathandayuthapani made changes -
            Assignee Thirunarayanan Balathandayuthapani [ thiru ] Marko Mäkelä [ marko ]
            Status Stalled [ 10000 ] In Review [ 10002 ]
            thiru Thirunarayanan Balathandayuthapani made changes -
            Affects Version/s 10.2 [ 14601 ]
            marko Marko Mäkelä made changes -
            Assignee Marko Mäkelä [ marko ] Thirunarayanan Balathandayuthapani [ thiru ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            thiru Thirunarayanan Balathandayuthapani made changes -
            Fix Version/s 10.2.41 [ 26032 ]
            Fix Version/s 10.3.32 [ 26029 ]
            Fix Version/s 10.4.22 [ 26031 ]
            Fix Version/s 10.5.13 [ 26026 ]
            Fix Version/s 10.6.5 [ 26034 ]
            Fix Version/s 10.3 [ 22126 ]
            Fix Version/s 10.4 [ 22408 ]
            Fix Version/s 10.5 [ 23123 ]
            Fix Version/s 10.6 [ 24028 ]
            Resolution Fixed [ 1 ]
            Status Stalled [ 10000 ] Closed [ 6 ]
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 123396 ] MariaDB v4 [ 159502 ]
            marko Marko Mäkelä made changes -
            serg Sergei Golubchik made changes -
            Description {noformat}

            {noformat}
            worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 16000..16019
            SET SESSION sql_mode = 'NO_ENGINE_SUBSTITUTION' ;
            SET DEFAULT_STORAGE_ENGINE= 'InnoDB' ;
            USE test ;
            CREATE TABLE `t1` (
            `col_varchar_255` varchar(255),
            `col_int` int,
            `col_text` text) ENGINE=innodb ;
            FLUSH TABLES t1 FOR EXPORT ;
            UNLOCK TABLES ;
            CREATE TABLE imp_t1 LIKE t1 ;
            ALTER TABLE imp_t1 ADD KEY idx ( col_text(13) ) ;
            'copy ibd file around'
            ALTER TABLE imp_t1 DISCARD TABLESPACE ;
            ALTER TABLE imp_t1 IMPORT TABLESPACE ;
            ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB
            'copy ibd file around'
            ALTER TABLE imp_t1 IMPORT TABLESPACE ;
            ERROR HY000: Lost connection to server during query
            DROP TABLE t1, imp_t1 ;
            main.ML_import1 'innodb' [ fail ]
                    Test ended at 2021-07-12 09:31:01

            CURRENT_TEST: main.ML_import1
            /data/Server_bin/10.6G_fast/bin/mysqltest: Can't create/write to file '/data/Server_bin/10.6G_fast/mysql-test/var/mysqld.1/data/test/imp_t1.ibd' (Errcode: 17 "File exists")
            mysqltest: At line 35: query 'DROP TABLE t1, imp_t1 ' failed: <Unknown> (2006): Server has gone away
            ...
            2021-07-12 9:31:00 0 [Note] /data/Server_bin/10.6G_fast/bin/mariadbd: ready for connections.
            Version: '10.6.3-MariaDB-log' socket: '/data/Server_bin/10.6G_fast/mysql-test/var/tmp/mysqld.1.sock' port: 16000 Source distribution
            2021-07-12 9:31:00 4 [Note] InnoDB: Sync to disk of `test`.`t1` started.
            2021-07-12 9:31:00 4 [Note] InnoDB: Stopping purge
            2021-07-12 9:31:00 4 [Note] InnoDB: Writing table metadata to './test/t1.cfg'
            2021-07-12 9:31:00 4 [Note] InnoDB: Table `test`.`t1` flushed to disk
            2021-07-12 9:31:00 4 [Note] InnoDB: Deleting the meta-data file './test/t1.cfg'
            2021-07-12 9:31:00 4 [Note] InnoDB: Resuming purge
            2021-07-12 9:31:00 4 [ERROR] InnoDB: Operating system error number 2 in a file operation.
            2021-07-12 9:31:00 4 [ERROR] InnoDB: The error means the system cannot find the path specified.
            2021-07-12 9:31:00 4 [ERROR] InnoDB: Trying to import a tablespace, but could not open the tablespace file ./test/imp_t1.ibd
            2021-07-12 9:31:00 4 [Note] InnoDB: Discarding tablespace of table `test`.`imp_t1`: Tablespace not found
            2021-07-12 9:31:00 4 [Note] InnoDB: Sync to disk
            2021-07-12 9:31:00 4 [Note] InnoDB: Sync to disk - done!
            2021-07-12 9:31:00 4 [Warning] InnoDB: Table `test`.`imp_t1` should have 2 indexes but the tablespace has 1 indexes
            2021-07-12 9:31:00 4 [Note] InnoDB: Phase I - Update all pages
            2021-07-12 9:31:00 4 [Note] InnoDB: Sync to disk
            2021-07-12 9:31:00 4 [Note] InnoDB: Sync to disk - done!
            2021-07-12 9:31:00 4 [Warning] InnoDB: Skip adjustment of root pages for index `idx`.
            2021-07-12 9:31:00 4 [Note] InnoDB: Phase III - Flush changes to disk
            2021-07-12 9:31:00 4 [Note] InnoDB: Phase IV - Flush complete
            2021-07-12 9:31:00 4 [ERROR] InnoDB: Index `idx` of table `test`.`imp_t1` is corrupted
            2021-07-12 9:31:00 4 [Note] InnoDB: Load corrupted index `idx` of table `test`.`imp_t1`
            2021-07-12 9:31:00 4 [ERROR] InnoDB: Trying to load index `idx` for table `test`.`imp_t1`, but the index tree has been freed!
            2021-07-12 9:31:00 4 [Warning] InnoDB: Failed to load table `test`.`imp_t1`:Data structure corruption
            210712 9:31:00 [ERROR] mysqld got signal 11 ;
            ...
            Query (0x7f3bbc010650): ALTER TABLE imp_t1 IMPORT TABLESPACE
            Connection ID (thread ID): 4
            Status: NOT_KILLED

            #3 <signal handler called>
            #4 0x000055c41ab763e0 in ha_innobase::discard_or_import_tablespace (this=0x7f3bbc0baa70, discard=<optimized out>) at /data/Server/10.6G/storage/innobase/handler/ha_innodb.cc:13201
            #5 0x000055c41a77ff96 in mysql_discard_or_import_tablespace (thd=thd@entry=0x7f3bbc000c58, table_list=table_list@entry=0x7f3bbc010740, discard=<optimized out>) at /data/Server/10.6G/sql/sql_table.cc:5463
            #6 0x000055c41a7ebe54 in Sql_cmd_discard_import_tablespace::execute (this=0x7f3bbc010e28, thd=0x7f3bbc000c58) at /data/Server/10.6G/sql/sql_alter.cc:591
            #7 0x000055c41a6ed626 in mysql_execute_command (thd=0x7f3bbc000c58, is_called_from_prepared_stmt=<optimized out>) at /data/Server/10.6G/sql/sql_parse.cc:5995
            #8 0x000055c41a6de446 in mysql_parse (rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>, thd=0x7f3bbc000c58) at /data/Server/10.6G/sql/sql_parse.cc:8028
            #9 mysql_parse (thd=0x7f3bbc000c58, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>) at /data/Server/10.6G/sql/sql_parse.cc:7950
            #10 0x000055c41a6e9e12 in dispatch_command (command=COM_QUERY, thd=0x7f3bbc000c58, packet=<optimized out>, packet_length=<optimized out>, blocking=<optimized out>) at /data/Server/10.6G/sql/sql_class.h:1340
            #11 0x000055c41a6eba98 in do_command (thd=0x7f3bbc000c58, blocking=blocking@entry=true) at /data/Server/10.6G/sql/sql_parse.cc:1406
            #12 0x000055c41a7e7837 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55c41e0a5a58, put_in_cache=put_in_cache@entry=true) at /data/Server/10.6G/sql/sql_connect.cc:1410
            #13 0x000055c41a7e7b2d in handle_one_connection (arg=0x55c41e0a5a58) at /data/Server/10.6G/sql/sql_connect.cc:1312
            #14 0x00007f3bf84df609 in start_thread (arg=<optimized out>) at pthread_create.c:477
            #15 0x00007f3bf80b3293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

            GIT_SHOW: HEAD, origin/HEAD, origin/10.6, 10.6 315380a4d16ddb16461d906a23be341e354c30ed 2021-07-01T19:06:53+03:00

            I am aware that the MTR test shows some rather ugly scenario. But mistakes happen and they should not end up with SEGV.
            {noformat}
            worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 16000..16019
            SET SESSION sql_mode = 'NO_ENGINE_SUBSTITUTION' ;
            SET DEFAULT_STORAGE_ENGINE= 'InnoDB' ;
            USE test ;
            CREATE TABLE `t1` (
            `col_varchar_255` varchar(255),
            `col_int` int,
            `col_text` text) ENGINE=innodb ;
            FLUSH TABLES t1 FOR EXPORT ;
            UNLOCK TABLES ;
            CREATE TABLE imp_t1 LIKE t1 ;
            ALTER TABLE imp_t1 ADD KEY idx ( col_text(13) ) ;
            'copy ibd file around'
            ALTER TABLE imp_t1 DISCARD TABLESPACE ;
            ALTER TABLE imp_t1 IMPORT TABLESPACE ;
            ERROR HY000: Got error 194 "Tablespace is missing for a table" from storage engine InnoDB
            'copy ibd file around'
            ALTER TABLE imp_t1 IMPORT TABLESPACE ;
            ERROR HY000: Lost connection to server during query
            DROP TABLE t1, imp_t1 ;
            main.ML_import1 'innodb' [ fail ]
                    Test ended at 2021-07-12 09:31:01

            CURRENT_TEST: main.ML_import1
            /data/Server_bin/10.6G_fast/bin/mysqltest: Can't create/write to file '/data/Server_bin/10.6G_fast/mysql-test/var/mysqld.1/data/test/imp_t1.ibd' (Errcode: 17 "File exists")
            mysqltest: At line 35: query 'DROP TABLE t1, imp_t1 ' failed: <Unknown> (2006): Server has gone away
            ...
            2021-07-12 9:31:00 0 [Note] /data/Server_bin/10.6G_fast/bin/mariadbd: ready for connections.
            Version: '10.6.3-MariaDB-log' socket: '/data/Server_bin/10.6G_fast/mysql-test/var/tmp/mysqld.1.sock' port: 16000 Source distribution
            2021-07-12 9:31:00 4 [Note] InnoDB: Sync to disk of `test`.`t1` started.
            2021-07-12 9:31:00 4 [Note] InnoDB: Stopping purge
            2021-07-12 9:31:00 4 [Note] InnoDB: Writing table metadata to './test/t1.cfg'
            2021-07-12 9:31:00 4 [Note] InnoDB: Table `test`.`t1` flushed to disk
            2021-07-12 9:31:00 4 [Note] InnoDB: Deleting the meta-data file './test/t1.cfg'
            2021-07-12 9:31:00 4 [Note] InnoDB: Resuming purge
            2021-07-12 9:31:00 4 [ERROR] InnoDB: Operating system error number 2 in a file operation.
            2021-07-12 9:31:00 4 [ERROR] InnoDB: The error means the system cannot find the path specified.
            2021-07-12 9:31:00 4 [ERROR] InnoDB: Trying to import a tablespace, but could not open the tablespace file ./test/imp_t1.ibd
            2021-07-12 9:31:00 4 [Note] InnoDB: Discarding tablespace of table `test`.`imp_t1`: Tablespace not found
            2021-07-12 9:31:00 4 [Note] InnoDB: Sync to disk
            2021-07-12 9:31:00 4 [Note] InnoDB: Sync to disk - done!
            2021-07-12 9:31:00 4 [Warning] InnoDB: Table `test`.`imp_t1` should have 2 indexes but the tablespace has 1 indexes
            2021-07-12 9:31:00 4 [Note] InnoDB: Phase I - Update all pages
            2021-07-12 9:31:00 4 [Note] InnoDB: Sync to disk
            2021-07-12 9:31:00 4 [Note] InnoDB: Sync to disk - done!
            2021-07-12 9:31:00 4 [Warning] InnoDB: Skip adjustment of root pages for index `idx`.
            2021-07-12 9:31:00 4 [Note] InnoDB: Phase III - Flush changes to disk
            2021-07-12 9:31:00 4 [Note] InnoDB: Phase IV - Flush complete
            2021-07-12 9:31:00 4 [ERROR] InnoDB: Index `idx` of table `test`.`imp_t1` is corrupted
            2021-07-12 9:31:00 4 [Note] InnoDB: Load corrupted index `idx` of table `test`.`imp_t1`
            2021-07-12 9:31:00 4 [ERROR] InnoDB: Trying to load index `idx` for table `test`.`imp_t1`, but the index tree has been freed!
            2021-07-12 9:31:00 4 [Warning] InnoDB: Failed to load table `test`.`imp_t1`:Data structure corruption
            210712 9:31:00 [ERROR] mysqld got signal 11 ;
            ...
            Query (0x7f3bbc010650): ALTER TABLE imp_t1 IMPORT TABLESPACE
            Connection ID (thread ID): 4
            Status: NOT_KILLED

            #3 <signal handler called>
            #4 0x000055c41ab763e0 in ha_innobase::discard_or_import_tablespace (this=0x7f3bbc0baa70, discard=<optimized out>) at /data/Server/10.6G/storage/innobase/handler/ha_innodb.cc:13201
            #5 0x000055c41a77ff96 in mysql_discard_or_import_tablespace (thd=thd@entry=0x7f3bbc000c58, table_list=table_list@entry=0x7f3bbc010740, discard=<optimized out>) at /data/Server/10.6G/sql/sql_table.cc:5463
            #6 0x000055c41a7ebe54 in Sql_cmd_discard_import_tablespace::execute (this=0x7f3bbc010e28, thd=0x7f3bbc000c58) at /data/Server/10.6G/sql/sql_alter.cc:591
            #7 0x000055c41a6ed626 in mysql_execute_command (thd=0x7f3bbc000c58, is_called_from_prepared_stmt=<optimized out>) at /data/Server/10.6G/sql/sql_parse.cc:5995
            #8 0x000055c41a6de446 in mysql_parse (rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>, thd=0x7f3bbc000c58) at /data/Server/10.6G/sql/sql_parse.cc:8028
            #9 mysql_parse (thd=0x7f3bbc000c58, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>) at /data/Server/10.6G/sql/sql_parse.cc:7950
            #10 0x000055c41a6e9e12 in dispatch_command (command=COM_QUERY, thd=0x7f3bbc000c58, packet=<optimized out>, packet_length=<optimized out>, blocking=<optimized out>) at /data/Server/10.6G/sql/sql_class.h:1340
            #11 0x000055c41a6eba98 in do_command (thd=0x7f3bbc000c58, blocking=blocking@entry=true) at /data/Server/10.6G/sql/sql_parse.cc:1406
            #12 0x000055c41a7e7837 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55c41e0a5a58, put_in_cache=put_in_cache@entry=true) at /data/Server/10.6G/sql/sql_connect.cc:1410
            #13 0x000055c41a7e7b2d in handle_one_connection (arg=0x55c41e0a5a58) at /data/Server/10.6G/sql/sql_connect.cc:1312
            #14 0x00007f3bf84df609 in start_thread (arg=<optimized out>) at pthread_create.c:477
            #15 0x00007f3bf80b3293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
            {noformat}

            GIT_SHOW: HEAD, origin/HEAD, origin/10.6, 10.6 315380a4d16ddb16461d906a23be341e354c30ed 2021-07-01T19:06:53+03:00

            I am aware that the MTR test shows some rather ugly scenario. But mistakes happen and they should not end up with SEGV.

            People

              thiru Thirunarayanan Balathandayuthapani
              mleich Matthias Leich
              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.