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

ALTER TABLE CHANGE COLUMN Corrupts Index Leading to Crashes in 10.2

    XMLWordPrintable

    Details

      Description

      ALTER TABLE CHANGE COLUMN Corrupts Index Leading to Crashes in 10.2

      Run the following test in 10.2.9 (tested 10.2.6 through 10.2.9) and it will crash:

      CREATE DATABASE IF NOT EXISTS `crashtest`;
      USE `crashtest`;
      drop table if exists t1;
      CREATE TABLE `t1` (
        `id1`    INT(11)      NOT NULL AUTO_INCREMENT,
        `id2`    VARCHAR(30)  NOT NULL,
        `id3`    DATETIME     NOT NULL DEFAULT CURRENT_TIMESTAMP,
        PRIMARY KEY (`id1`),
        UNIQUE KEY `unique_id2` (`id2`)
      );
      ALTER TABLE `t1` CHANGE COLUMN `id2` `id4` VARCHAR(100) NOT NULL;
      SELECT * FROM `t1` where id4 like 'a';
      

      MariaDB [crashtest]> SELECT * FROM `t1` where id4 like 'a';
      ERROR 2013 (HY000): Lost connection to MySQL server during query
      

      This does not crash in 10.1.28.

      Note that If I remove id3 (the column after id2 - the one being changed), then it does not crash:

      CREATE DATABASE IF NOT EXISTS `crashtest`;
      USE `crashtest`;
      drop table if exists t1;
      CREATE TABLE `t1` (
        `id1`    INT(11)      NOT NULL AUTO_INCREMENT,
        `id2`    VARCHAR(30)  NOT NULL,
        PRIMARY KEY (`id1`),
        UNIQUE KEY `unique_id2` (`id2`)
      );
      ALTER TABLE `t1` CHANGE COLUMN `id2` `id4` VARCHAR(100) NOT NULL;
      SELECT * FROM `t1` where id4 like 'a';
      

      Here is the error log stack trace:

      2017-10-16 18:25:48 25472 [Note] C:\Program Files\MariaDB 10.2\bin\mysqld.exe: ready for connections.
      Version: '10.2.9-MariaDB'  socket: ''  port: 3317  mariadb.org binary distribution
      2017-10-16 18:25:48 35452 [Note] InnoDB: Buffer pool(s) load completed at 171016 18:25:48
      2017-10-16 18:26:47 29244 [ERROR] Found index unique_id2 whose column info does not match that of MariaDB.
      2017-10-16 18:26:47 29244 [ERROR] Build InnoDB index translation table for Table .\crashtest\t1 failed
      171016 18:26:47 [ERROR] mysqld got exception 0xc0000005 ;
      This could be because you hit a bug. It is also possible that this binary
      or one of the libraries it was linked against is corrupt, improperly built,
      or misconfigured. This error can also be caused by malfunctioning hardware.
       
      To report this bug, see https://mariadb.com/kb/en/reporting-bugs
       
      We will try our best to scrape up some info that will hopefully help
      diagnose the problem, but since we have already crashed, 
      something is definitely wrong and this may fail.
       
      Server version: 10.2.9-MariaDB
      key_buffer_size=134217728
      read_buffer_size=131072
      max_used_connections=1
      max_threads=65537
      thread_count=7
      It is possible that mysqld could use up to 
      key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 136039 K  bytes of memory
      Hope that's ok; if not, decrease some variables in the equation.
       
      Thread pointer: 0x11f13258
      Attempting backtrace. You can use the following information to find out
      where mysqld died. If you see no messages after this, something went
      terribly wrong...
      mysqld.exe!my_xml_error_string()
      mysqld.exe!?get_tok_start_prev@Lex_input_stream@@QEAAPEBDXZ()
      mysqld.exe!?ha_index_read_map@handler@@QEAAHPEAEPEBEKW4ha_rkey_function@@@Z()
      mysqld.exe!?read_range_first@handler@@UEAAHPEBUst_key_range@@0_N1@Z()
      mysqld.exe!?multi_range_read_next@handler@@UEAAHPEAPEAX@Z()
      mysqld.exe!?get_next@Mrr_simple_index_reader@@UEAAHPEAPEAX@Z()
      mysqld.exe!?dsmrr_next@DsMrr_impl@@QEAAHPEAPEAX@Z()
      mysqld.exe!?get_next@QUICK_RANGE_SELECT@@UEAAHXZ()
      mysqld.exe!?rr_from_pointers@@YAHPEAUREAD_RECORD@@@Z()
      mysqld.exe!?sub_select@@YA?AW4enum_nested_loop_state@@PEAVJOIN@@PEAUst_join_table@@_N@Z()
      mysqld.exe!?disjoin@?$List@VItem@@@@QEAAXPEAV1@@Z()
      mysqld.exe!?exec_inner@JOIN@@QEAAXXZ()
      mysqld.exe!?exec@JOIN@@QEAAXXZ()
      mysqld.exe!?mysql_select@@YA_NPEAVTHD@@PEAUTABLE_LIST@@IAEAV?$List@VItem@@@@PEAVItem@@IPEAUst_order@@434_KPEAVselect_result@@PEAVst_select_lex_unit@@PEAVst_select_lex@@@Z()
      mysqld.exe!?handle_select@@YA_NPEAVTHD@@PEAULEX@@PEAVselect_result@@K@Z()
      mysqld.exe!?execute_init_command@@YAXPEAVTHD@@PEAUst_mysql_lex_string@@PEAUst_mysql_rwlock@@@Z()
      mysqld.exe!?mysql_execute_command@@YAHPEAVTHD@@@Z()
      mysqld.exe!?mysql_parse@@YAXPEAVTHD@@PEADIPEAVParser_state@@_N3@Z()
      mysqld.exe!?dispatch_command@@YA_NW4enum_server_command@@PEAVTHD@@PEADI_N3@Z()
      mysqld.exe!?do_command@@YA_NPEAVTHD@@@Z()
      mysqld.exe!?pool_of_threads_scheduler@@YAXPEAUscheduler_functions@@PEAKPEAI@Z()
      mysqld.exe!?tp_callback@@YAXPEAUTP_connection@@@Z()
      ntdll.dll!TpPostWork()
      ntdll.dll!TpDisassociateCallback()
      kernel32.dll!BaseThreadInitThunk()
      ntdll.dll!RtlUserThreadStart()
       
      Trying to get some variables.
      Some pointers may be invalid and cause the dump to abort.
      Query (0x11f1fc40): SELECT * FROM `t1` where id4 like 'a'
      Connection ID (thread ID): 9
      Status: NOT_KILLED
       
      Optimizer switch: index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on
       
      The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
      information that should help you find out what is causing the crash.
      2017-10-16 18:27:04 26064 [Note] InnoDB: page_cleaner: 1000ms intended loop took 5733ms. The settings might not be optimal. (flushed=0 and evicted=0, during the time.)
      

        Attachments

          Activity

            People

            Assignee:
            serg Sergei Golubchik
            Reporter:
            ccalender Chris Calender
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: