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

Server crash when issuing bad SQL partition syntax

    XMLWordPrintable

Details

    • 10.2.11

    Description

      Invalid syntax in a partition-related ALTER TABLE statement can cause the server to crash. To reproduce, you can execute:

      drop table if exists t;
      CREATE TABLE `t` (
      `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
      `d` date NOT NULL,
      PRIMARY KEY (`id`,`d`)
      ) ENGINE=InnoDB
      /*!50500 PARTITION BY RANGE COLUMNS(d)
      (PARTITION p20171016 VALUES LESS THAN ('2017-10-17') ENGINE = InnoDB,
      PARTITION p20171017 VALUES LESS THAN ('2017-10-18') ENGINE = InnoDB,
      PARTITION p99991231 VALUES LESS THAN (MAXVALUE) ENGINE = InnoDB) */;
       
      alter table t reorganize partition p99991231 into (
      partition p20171018 values less than ('2017-10-19'),
      partition p20171126,
      PARTITION p99991231 VALUES LESS THAN (MAXVALUE));
      

      Notice that partition p20171126 is not valid in the above statement. The server should reject the statement. Instead, it leads to the following crash:

      170912 19:41:23 [ERROR] mysqld got signal 11 ;
      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.1.26-MariaDB
      key_buffer_size=134217728
      read_buffer_size=131072
      max_used_connections=1
      max_threads=153
      thread_count=3
      It is possible that mysqld could use up to
      key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 467133 K  bytes of memory
      Hope that's ok; if not, decrease some variables in the equation.
       
      Thread pointer: 0x7fb668a5a008
      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...
      stack_bottom = 0x7fb6910950b0 thread_stack 0x48400
      /usr/sbin/mysqld(my_print_stacktrace+0x2e)[0x7fb69657952e]
      /usr/sbin/mysqld(handle_fatal_signal+0x305)[0x7fb69609ced5]
      /lib64/libpthread.so.0(+0xf5e0)[0x7fb6956ad5e0]
      /usr/sbin/mysqld(_ZN14partition_info21check_range_constantsEP3THD+0xd3)[0x7fb695fd97a3]
      /usr/sbin/mysqld(_ZN14partition_info20check_partition_infoEP3THDPP10handlertonP7handlerP14HA_CREATE_INFOb+0x6d1)[0x7fb695fda691]
      /usr/sbin/mysqld(_Z21prep_alter_part_tableP3THDP5TABLEP10Alter_infoP14HA_CREATE_INFOP15Alter_table_ctxPbS9_+0xa65)[0x7fb6961d8805]
      /usr/sbin/mysqld(_Z17mysql_alter_tableP3THDPcS1_P14HA_CREATE_INFOP10TABLE_LISTP10Alter_infojP8st_orderb+0x891)[0x7fb695fa3e71]
      /usr/sbin/mysqld(_ZN19Sql_cmd_alter_table7executeEP3THD+0x60a)[0x7fb695fed6aa]
      /usr/sbin/mysqld(_Z21mysql_execute_commandP3THD+0x1327)[0x7fb695f12a17]
      /usr/sbin/mysqld(_Z11mysql_parseP3THDPcjP12Parser_state+0x342)[0x7fb695f1ad52]
      /usr/sbin/mysqld(+0x43d671)[0x7fb695f1b671]
      /usr/sbin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcj+0x2111)[0x7fb695f1dfc1]
      /usr/sbin/mysqld(_Z10do_commandP3THD+0x136)[0x7fb695f1f016]
      /usr/sbin/mysqld(_Z24do_handle_one_connectionP3THD+0x18a)[0x7fb695fea9da]
      /usr/sbin/mysqld(handle_one_connection+0x40)[0x7fb695feab80]
      /lib64/libpthread.so.0(+0x7e25)[0x7fb6956a5e25]
      /lib64/libc.so.6(clone+0x6d)[0x7fb693ac934d]
       
      Trying to get some variables.
      Some pointers may be invalid and cause the dump to abort.
      Query (0x7fb668b14020): alter table t reorganize partition p99991231 into ( partition p20171018 values less than ('2017-10-19'), partition p20171126, PARTITION p99991231 VALUES LESS THAN (MAXVALUE))
      Connection ID (thread ID): 5
      Status: NOT_KILLED
      

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              GeoffMontee Geoff Montee (Inactive)
              Votes:
              1 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.