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

Server crash in st_join_table::save_explain_data or assertion `sel->quick' failure in JOIN::make_range_rowid_filters upon query with rowid_filter=ON

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.4
    • Fix Version/s: 10.4.5
    • Component/s: Optimizer
    • Labels:
      None

      Description

      CREATE TABLE t1 (pk1 INT PRIMARY KEY, a1 INT, b1 VARCHAR(1), KEY(b1)) ENGINE=MyISAM;
      INSERT INTO t1 VALUES
      (10,0,'z'),(11,3,'j'),(12,8,'f'),(13,8,'p'),(14,6,'w'),(15,0,'c'),(16,1,'j'),
      (17,1,'f'),(18,5,'v'),(19,3,'f'),(20,2,'q'),(21,8,'y'),(22,0,'a'),(23,9,'w'),
      (24,3,'e'),(25,1,'b'),(26,9,'r'),(27,2,'k'),(28,5,'c'),(29,3,'k'),(30,9,'b'),
      (31,8,'j'),(32,1,'t'),(33,8,'n'),(34,3,'z'),(35,0,'u'),(36,3,'a'),(37,3,'g'),
      (38,1,'f'),(39,6,'p'),(40,6,'m'),(41,6,'t'),(42,7,'i'),(43,4,'h'),(44,3,'d'),
      (45,2,'b'),(46,1,'o'),(47,2,'j'),(48,6,'s'),(49,5,'q'),(50,6,'l'),(51,9,'j'),
      (52,6,'y'),(53,0,'i'),(54,7,'x'),(55,2,'u'),(56,6,'t'),(57,4,'b'),(58,5,'m'),
      (59,4,'x'),(60,8,'x'),(61,6,'v'),(62,8,'m'),(63,4,'j'),(64,8,'z'),(65,2,'a'),
      (66,9,'i'),(67,4,'g'),(68,8,'h'),(69,1,'p'),(70,8,'a'),(71,0,'x'),(72,2,'s'),
      (73,6,'k'),(74,0,'m'),(75,6,'e'),(76,9,'y'),(77,7,'d'),(78,7,'w'),(79,6,'y'),
      (80,9,'s'),(81,9,'x'),(82,6,'l'),(83,9,'f'),(84,8,'x'),(85,1,'p'),(86,7,'y'),
      (87,6,'p'),(88,1,'g'),(89,3,'c'),(90,5,'h'),(91,3,'p'),(92,2,'b'),(93,1,NULL),
      (94,3,NULL),(95,2,'y'),(96,7,'s'),(97,7,'x'),(98,6,'i'),(99,9,'t'),(100,5,'j'),
      (101,0,'u'),(102,7,'r'),(103,2,'x'),(104,8,'e'),(105,8,'i'),(106,5,'q'),
      (107,8,'z'),(108,3,'k'),(109,65,NULL);
       
      CREATE TABLE t2 (pk2 INT PRIMARY KEY, a2 INT, b2 VARCHAR(1)) ENGINE=MyISAM;
      INSERT INTO t2 VALUES (1,1,'x');
      INSERT INTO t2 SELECT * FROM t1;
       
      SELECT * FROM t1 INNER JOIN t2 ON ( pk1 <> pk2 AND pk1 = a2 ) WHERE b1 <= ( SELECT MAX(b2) FROM t2 WHERE pk2 <= 1 );
      

      10.4 3c352b59 non-debug

      #2  <signal handler called>
      #3  st_join_table::save_explain_data (this=this@entry=0x7f12a40561e8, eta=eta@entry=0x7f12a4057a08, prefix_tables=prefix_tables@entry=2, distinct_arg=distinct_arg@entry=false, first_top_tab=first_top_tab@entry=0x7f12a4055e20) at /data/src/10.4/sql/sql_select.cc:25858
      #4  0x000055fd1a2268a0 in JOIN::save_explain_data_intern (this=this@entry=0x7f12a4016de8, output=0x7f12a40510d8, need_tmp_table_arg=<optimized out>, need_order_arg=<optimized out>, distinct_arg=distinct_arg@entry=false, message=<optimized out>) at /data/src/10.4/sql/sql_select.cc:26404
      #5  0x000055fd1a2269eb in JOIN::save_explain_data (this=this@entry=0x7f12a4016de8, output=0x7f12a40510d8, can_overwrite=can_overwrite@entry=false, need_tmp_table=<optimized out>, need_order=<optimized out>, distinct=<optimized out>) at /data/src/10.4/sql/sql_select.cc:4130
      #6  0x000055fd1a226c2a in JOIN::build_explain (this=this@entry=0x7f12a4016de8) at /data/src/10.4/sql/sql_select.cc:1514
      #7  0x000055fd1a22eb44 in JOIN::optimize (this=this@entry=0x7f12a4016de8) at /data/src/10.4/sql/sql_select.cc:1567
      #8  0x000055fd1a22fa40 in mysql_select (thd=thd@entry=0x7f12a40009a8, tables=0x7f12a4012670, wild_num=1, fields=..., conds=0x7f12a4016280, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f12a4016dc0, unit=0x7f12a4004718, select_lex=0x7f12a40120b0) at /data/src/10.4/sql/sql_select.cc:4588
      #9  0x000055fd1a23052e in handle_select (thd=thd@entry=0x7f12a40009a8, lex=lex@entry=0x7f12a4004650, result=result@entry=0x7f12a4016dc0, setup_tables_done_option=setup_tables_done_option@entry=0) at /data/src/10.4/sql/sql_select.cc:424
      #10 0x000055fd1a0db076 in execute_sqlcom_select (thd=thd@entry=0x7f12a40009a8, all_tables=0x7f12a4012670) at /data/src/10.4/sql/sql_parse.cc:6602
      #11 0x000055fd1a1d26a7 in mysql_execute_command (thd=thd@entry=0x7f12a40009a8) at /data/src/10.4/sql/sql_parse.cc:3891
      #12 0x000055fd1a1d8ff1 in mysql_parse (thd=thd@entry=0x7f12a40009a8, rawbuf=<optimized out>, length=115, parser_state=parser_state@entry=0x7f12b652a1d0, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/src/10.4/sql/sql_parse.cc:8154
      #13 0x000055fd1a1db867 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7f12a40009a8, packet=packet@entry=0x7f12a4009bf9 "SELECT * FROM t1 INNER JOIN t2 ON ( pk1 <> pk2 AND pk1 = a2 ) WHERE b1 <= ( SELECT MAX(b2) FROM t2 WHERE pk2 <= 1 )", packet_length=packet_length@entry=115, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/src/10.4/sql/sql_parse.cc:1832
      #14 0x000055fd1a1dcbe7 in do_command (thd=0x7f12a40009a8) at /data/src/10.4/sql/sql_parse.cc:1365
      #15 0x000055fd1a2b825c in do_handle_one_connection (connect=connect@entry=0x55fd1d974b18) at /data/src/10.4/sql/sql_connect.cc:1398
      #16 0x000055fd1a2b83c4 in handle_one_connection (arg=arg@entry=0x55fd1d974b18) at /data/src/10.4/sql/sql_connect.cc:1301
      #17 0x000055fd1a5d5914 in pfs_spawn_thread (arg=0x55fd1d974d78) at /data/src/10.4/storage/perfschema/pfs.cc:1862
      #18 0x00007f12be4a7494 in start_thread (arg=0x7f12b652b700) at pthread_create.c:333
      #19 0x00007f12bc46f93f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      10.4 3c352b59

      mysqld: /data/src/10.4/sql/sql_select.cc:1640: bool JOIN::make_range_rowid_filters(): Assertion `sel->quick' failed.
      190415 22:28:23 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f17e4f1bee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x0000563493b1ef5b in JOIN::make_range_rowid_filters (this=0x7f17c401a470) at /data/src/10.4/sql/sql_select.cc:1640
      #9  0x0000563493b21341 in JOIN::optimize_stage2 (this=0x7f17c401a470) at /data/src/10.4/sql/sql_select.cc:2241
      #10 0x0000563493b2118b in JOIN::optimize_inner (this=0x7f17c401a470) at /data/src/10.4/sql/sql_select.cc:2217
      #11 0x0000563493b1ecc0 in JOIN::optimize (this=0x7f17c401a470) at /data/src/10.4/sql/sql_select.cc:1561
      #12 0x0000563493b29b10 in mysql_select (thd=0x7f17c4000b00, tables=0x7f17c4015cf8, wild_num=1, fields=..., conds=0x7f17c4019908, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f17c401a448, unit=0x7f17c4004a30, select_lex=0x7f17c4015738) at /data/src/10.4/sql/sql_select.cc:4588
      #13 0x0000563493b1a140 in handle_select (thd=0x7f17c4000b00, lex=0x7f17c4004968, result=0x7f17c401a448, setup_tables_done_option=0) at /data/src/10.4/sql/sql_select.cc:424
      #14 0x0000563493ae39fd in execute_sqlcom_select (thd=0x7f17c4000b00, all_tables=0x7f17c4015cf8) at /data/src/10.4/sql/sql_parse.cc:6602
      #15 0x0000563493ad8fd3 in mysql_execute_command (thd=0x7f17c4000b00) at /data/src/10.4/sql/sql_parse.cc:3891
      #16 0x0000563493ae7783 in mysql_parse (thd=0x7f17c4000b00, rawbuf=0x7f17c40155e8 "SELECT * FROM t1 INNER JOIN t2 ON ( pk1 <> pk2 AND pk1 = a2 ) WHERE b1 <= ( SELECT MAX(b2) FROM t2 WHERE pk2 <= 1 )", length=115, parser_state=0x7f17db058180, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8154
      #17 0x0000563493ad31da in dispatch_command (command=COM_QUERY, thd=0x7f17c4000b00, packet=0x7f17c400a8a1 "SELECT * FROM t1 INNER JOIN t2 ON ( pk1 <> pk2 AND pk1 = a2 ) WHERE b1 <= ( SELECT MAX(b2) FROM t2 WHERE pk2 <= 1 )", packet_length=115, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1832
      #18 0x0000563493ad19c0 in do_command (thd=0x7f17c4000b00) at /data/src/10.4/sql/sql_parse.cc:1365
      #19 0x0000563493c49d4f in do_handle_one_connection (connect=0x563496c66520) at /data/src/10.4/sql/sql_connect.cc:1398
      #20 0x0000563493c49ac0 in handle_one_connection (arg=0x563496c66520) at /data/src/10.4/sql/sql_connect.cc:1301
      #21 0x000056349413483f in pfs_spawn_thread (arg=0x563496d588f0) at /data/src/10.4/storage/perfschema/pfs.cc:1862
      #22 0x00007f17e7010494 in start_thread (arg=0x7f17db059700) at pthread_create.c:333
      #23 0x00007f17e4fd893f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      EXPLAIN EXTENDED
      SELECT * FROM t1 INNER JOIN t2 ON ( pk1 <> pk2 AND pk1 = a2 ) WHERE b1 <= ( SELECT MAX(b2) FROM t2 WHERE pk2 <= 1 );
      id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
      1	PRIMARY	t2	ALL	NULL	NULL	NULL	NULL	101	100.00	Using where
      1	PRIMARY	t1	eq_ref|filter	PRIMARY,b1	PRIMARY|b1	4|4	test.t2.a2	1 (87%)	87.00	Using where; Using rowid filter
      2	SUBQUERY	t2	range	PRIMARY	PRIMARY	4	NULL	1	100.00	Using index condition
      Warnings:
      Note	1003	/* select#1 */ select `test`.`t1`.`pk1` AS `pk1`,`test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t2`.`pk2` AS `pk2`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b2` AS `b2` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`pk1` = `test`.`t2`.`a2` and `test`.`t1`.`b1` <= (/* select#2 */ select max(`test`.`t2`.`b2`) from `test`.`t2` where `test`.`t2`.`pk2` <= 1) and `test`.`t2`.`a2` <> `test`.`t2`.`pk2`
      

        Attachments

          Activity

            People

            • Assignee:
              igor Igor Babaev
              Reporter:
              elenst Elena Stepanova
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: