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

MariaDB Server crashes with ill-formed partitions

    XMLWordPrintable

Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Critical
    • Resolution: Unresolved
    • 10.4, 10.5, 10.6, 10.9, 10.10, 10.11, 11.0, 11.1, 11.3.0
    • 10.4, 10.5, 10.6, 10.11, 11.0, 11.1
    • Server
    • Ubuntu Desktop 20.04 LTS
      Intel(R) Core(TM) i7-10700 CPU @ 2.90GHz

    Description

      The latest version of MariDB Server: Git commit hash: `e987b9350cb83038c73` crashes when executing the following query:

      drop database if exists test;
      create database test;
      use test;
      CREATE TABLE IF NOT EXISTS v0 ( c1 SET ( 'abc' ) BINARY UNICODE ) PARTITION BY LINEAR HASH ( c1 MOD c1 ) PARTITIONS 0x100 ;
      ALTER TABLE v0 CHECK PARTITION ALL FOR UPGRADE ;
      ALTER TABLE v0 LOCK SHARED , ORDER BY v0 ;
      

      Here is a crashing stack trace:

      (gdb) bt
      #0  0x0000aaaada90e030 in ha_partition::create_handlers (mem_root=0xffff8412ceb0, this=0xffff280caa90) at /home/mysql/mariadb/sql/ha_partition.cc:3034
      #1  ha_partition::create_handlers (this=0xffff280caa90, mem_root=0xffff8412ceb0) at /home/mysql/mariadb/sql/ha_partition.cc:3015
      #2  0x0000aaaada90e2b0 in ha_partition::setup_engine_array (this=0xffff280caa90, mem_root=0xffff8412ceb0, first_engine=0xaaaae03f49c8)
          at /home/mysql/mariadb/sql/ha_partition.cc:3271
      #3  0x0000aaaada90f310 in ha_partition::initialize_partition (this=0xffff280caa90, mem_root=<optimized out>) at /home/mysql/mariadb/sql/ha_partition.cc:569
      #4  0x0000aaaada9108fc in partition_create_handler (hton=0xaaaae03e1108, share=0xffff8412ce28, mem_root=0xffff8412ceb0) at /home/mysql/mariadb/sql/ha_partition.cc:264
      #5  0x0000aaaada7220d0 in get_new_handler (share=share@entry=0xffff8412ce28, alloc=0xffff8412ceb0, db_type=<optimized out>) at /home/mysql/mariadb/sql/handler.cc:384
      #6  0x0000aaaada5cc184 in TABLE_SHARE::init_from_binary_frm_image (this=this@entry=0xffff8412ce28, thd=thd@entry=0xffff28000c68, write=<optimized out>,
          frm_image=<optimized out>, frm_length=<optimized out>, par_image=par_image@entry=0x0, par_length=par_length@entry=0) at /home/mysql/mariadb/sql/handler.h:1717
      #7  0x0000aaaada72a780 in ha_create_table (thd=thd@entry=0xffff28000c68, path=path@entry=0xffff8412fa47 "./test/#sql-alter-5c73-3", db=0xffff28012b48 "test",
          table_name=0xffff28012400 "v0", create_info=0xffff8412fde0, create_info@entry=0xffff8412fb90, frm=frm@entry=0xffff8412d4e8, skip_frm_file=false,
          skip_frm_file@entry=64) at /home/mysql/mariadb/sql/handler.cc:6122
      #8  0x0000aaaada5a732c in mysql_alter_table (thd=thd@entry=0xffff28000c68, new_db=new_db@entry=0xffff280058b8, new_name=new_name@entry=0xffff28005d08,
          create_info=0xffff8412fb90, create_info@entry=0xffff8412fde0, table_list=<optimized out>, table_list@entry=0xffff28012438, recreate_info=0xffff00000000,
          recreate_info@entry=0xffff8412fce0, alter_info=alter_info@entry=0xffff8412fcf8, order_num=2215836944, order=<optimized out>, ignore=<optimized out>,
          if_exists=<optimized out>) at /home/mysql/mariadb/sql/sql_alter.h:298
      #9  0x0000aaaada603c94 in Sql_cmd_alter_table::execute (this=<optimized out>, thd=0xffff28000c68) at /home/mysql/mariadb/sql/structs.h:568
      #10 0x0000aaaada507028 in mysql_execute_command (thd=thd@entry=0xffff28000c68, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false)
          at /home/mysql/mariadb/sql/sql_parse.cc:5733
      #11 0x0000aaaada4f9760 in mysql_parse (thd=thd@entry=0xffff28000c68, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>)
          at /home/mysql/mariadb/sql/sql_parse.cc:7760
      #12 0x0000aaaada50382c in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0xffff28000c68,
          packet=packet@entry=0xffff280087b9 "ALTER TABLE v0 LOCK SHARED , ORDER BY v0", packet_length=packet_length@entry=40, blocking=blocking@entry=true)
          at /home/mysql/mariadb/sql/sql_class.h:1489
      #13 0x0000aaaada505488 in do_command (thd=0xffff28000c68, blocking=blocking@entry=true) at /home/mysql/mariadb/sql/sql_parse.cc:1406
      #14 0x0000aaaada5ff814 in do_handle_one_connection (connect=<optimized out>, put_in_cache=put_in_cache@entry=true) at /home/mysql/mariadb/sql/sql_connect.cc:1445
      #15 0x0000aaaada5ffbf0 in handle_one_connection (arg=arg@entry=0xaaaae0a66aa8) at /home/mysql/mariadb/sql/sql_connect.cc:1347
      #16 0x0000aaaada917698 in pfs_spawn_thread (arg=<optimized out>) at /home/mysql/mariadb/storage/perfschema/pfs.cc:2201
      #17 0x0000ffff9ac3d624 in start_thread (arg=0xaaaada9175f8 <pfs_spawn_thread(void*)>) at pthread_create.c:477
      #18 0x0000ffff9a8cc49c in thread_start () at ../sysdeps/unix/sysv/linux/aarch64/clone.S:78
      ```
       
      Some other useful information: 
       
      ```
      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=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off,hash_join_cardinality=on,sargable_casefold=on
      

      The bug could corrupt the database, causing future MariaDB access to the same database to also crash. Therefore, I label the bug as `Critical`.

      Attachments

        Issue Links

          Activity

            People

              monty Michael Widenius
              luy70 Yu Liang
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.