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

Crash with partitioned table, PARTITION syntax, and index_merge

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 10.3.20
    • Fix Version/s: 10.3
    • Component/s: Partitioning
    • Labels:
      None

      Description

      create table t1 (
        pk int primary key,
        a int,
        b int,
        filler char(32),
        key (a),
        key (b)
      ) engine=myisam  partition by range(pk) (
        partition p0 values less than (10),
        partition p1 values less than MAXVALUE
      ) ;
      

      insert into t1 select 
         seq,
         MOD(seq, 100),
         MOD(seq, 100),
         'filler-data-filler-data'
      from
       seq_1_to_50000;
      

      explain 
      select * from t1 partition (p1) where a=10 and b=10;
      flush tables;
      select * from t1 partition (p1)where a=10 and b=10;
      

      explain output:

      MariaDB [j3]> explain 
          -> select * from t1 partition (p1) where a=10 and b=10;
      +------+-------------+-------+-------------+---------------+------+---------+------+------+-----------------------------------+
      | id   | select_type | table | type        | possible_keys | key  | key_len | ref  | rows | Extra                             |
      +------+-------------+-------+-------------+---------------+------+---------+------+------+-----------------------------------+
      |    1 | SIMPLE      | t1    | index_merge | a,b           | a,b  | 5,5     | NULL |    4 | Using intersect(a,b); Using where |
      +------+-------------+-------+-------------+---------------+------+---------+------+------+-----------------------------------+
      

      The select crashes

        Thread 38 "mysqld" received signal SIGSEGV, Segmentation fault.
        [Switching to LWP 803]
        0x0000555556776031 in ha_partition::compare_number_of_records (me=0x7ffe54076f10, a=0x7ffe54069c30, b=0x7ffe54069c34) at /home/psergey/dev-git/10.3.20/sql/ha_partition.cc:8058
      (gdb) wher
        #0  0x0000555556776031 in ha_partition::compare_number_of_records (me=0x7ffe54076f10, a=0x7ffe54069c30, b=0x7ffe54069c34) at /home/psergey/dev-git/10.3.20/sql/ha_partition.cc:8058
        #1  0x00005555567a09e8 in my_qsort2 (base_ptr=0x7ffe54069c30, count=2, size=4, cmp=0x555556775ff8 <ha_partition::compare_number_of_records(ha_partition*, unsigned int const*, unsigned int const*)>, cmp_argument=0x7ffe54076f10) at /home/psergey/dev-git/10.3.20/mysys/mf_qsort.c:131
        #2  0x0000555556776a07 in ha_partition::info (this=0x7ffe54076f10, flag=280) at /home/psergey/dev-git/10.3.20/sql/ha_partition.cc:8340
        #3  0x0000555556769806 in ha_partition::open (this=0x7ffe54076f10, name=0x7ffe54044b80 "./j2/t1", mode=33, test_if_locked=1026) at /home/psergey/dev-git/10.3.20/sql/ha_partition.cc:3653
        #4  0x0000555555f4481d in handler::ha_open (this=0x7ffe54076f10, table_arg=0x7ffe54040a40, name=0x7ffe54044b80 "./j2/t1", mode=33, test_if_locked=1026, mem_root=0x0, partitions_to_open=0x0) at /home/psergey/dev-git/10.3.20/sql/handler.cc:2760
        #5  0x0000555556769acd in ha_partition::clone (this=0x7ffe5407c978, name=0x7ffe54044b80 "./j2/t1", mem_root=0x7ffe5403b510) at /home/psergey/dev-git/10.3.20/sql/ha_partition.cc:3752
        #6  0x00005555560acefe in QUICK_RANGE_SELECT::init_ror_merged_scan (this=0x7ffe6c014810, reuse_handler=false, local_alloc=0x7ffe5403b510) at /home/psergey/dev-git/10.3.20/sql/opt_range.cc:1503
        #7  0x00005555560ad3b0 in QUICK_ROR_INTERSECT_SELECT::init_ror_merged_scan (this=0x7ffe5403b4b0, reuse_handler=true, local_alloc=0x7ffe5403b510) at /home/psergey/dev-git/10.3.20/sql/opt_range.cc:1608
        #8  0x00005555560ad63e in QUICK_ROR_INTERSECT_SELECT::reset (this=0x7ffe5403b4b0) at /home/psergey/dev-git/10.3.20/sql/opt_range.cc:1643
        #9  0x0000555555ca281b in join_init_read_record (tab=0x7ffe54017460) at /home/psergey/dev-git/10.3.20/sql/sql_select.cc:20451
        #10 0x0000555555ca050b in sub_select (join=0x7ffe54014c88, join_tab=0x7ffe54017460, end_of_records=false) at /home/psergey/dev-git/10.3.20/sql/sql_select.cc:19527
        #11 0x0000555555c9f9f7 in do_select (join=0x7ffe54014c88, procedure=0x0) at /home/psergey/dev-git/10.3.20/sql/sql_select.cc:19070
        #12 0x0000555555c76a00 in JOIN::exec_inner (this=0x7ffe54014c88) at /home/psergey/dev-git/10.3.20/sql/sql_select.cc:4040
        #13 0x0000555555c75dd0 in JOIN::exec (this=0x7ffe54014c88) at /home/psergey/dev-git/10.3.20/sql/sql_select.cc:3834
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sanja Oleksandr Byelkin
              Reporter:
              psergey Sergei Petrunia
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated: