Second assertion `keypart_map' failed in maria_rkey with semijoin
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| MariaDB |
Fix Released
|
Critical
|
Sergey Petrunia | ||
Bug Description
Even with the fix for bug 860535
this query:
SELECT *
FROM t1
JOIN t2
ON ( t2.col_int_key = t1.pk )
WHERE t1.col_varchar_key IN (
SELECT t3.col_varchar_key FROM t3, t4
);
asserts as follows:
mysqld: ma_rkey.c:69: maria_rkey: Assertion `keypart_map' failed.
#5 0x00000035a6e340d5 in abort () from /lib64/libc.so.6
#6 0x00000035a6e2b8b5 in __assert_fail () from /lib64/libc.so.6
#7 0x00000000009e6625 in maria_rkey (info=0x7f80600
buf=
#8 0x00000000009c4975 in ha_maria:
buf=
#9 0x00000000005a9a36 in handler:
buf=
#10 0x0000000000766fea in join_read_
#11 0x000000000076557d in sub_select (join=0x7f80600
#12 0x0000000000764d52 in do_select (join=0x7f80600
#13 0x0000000000744f90 in JOIN::exec (this=0x7f80600
#14 0x0000000000745811 in mysql_select (thd=0x2549218, rref_pointer_
og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_
at sql_select.cc:2900
#15 0x000000000073c6c7 in handle_select (thd=0x2549218, lex=0x254b618, result=
#16 0x00000000006c88cb in execute_
#17 0x00000000006bf62a in mysql_execute_
#18 0x00000000006cb417 in mysql_parse (thd=0x2549218,
rawbuf=
#19 0x00000000006bce67 in dispatch_command (command=COM_QUERY, thd=0x2549218, packet=0x25c3f09 "", packet_length=126) at sql_parse.cc:1221
#20 0x00000000006bc1e7 in do_command (thd=0x2549218) at sql_parse.cc:916
#21 0x00000000006b90c3 in handle_
#22 0x00000035a7207761 in start_thread () from /lib64/
#23 0x00000035a6ee098d in clone () from /lib64/libc.so.6
Explain:
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ref col_varchar_key NULL NULL NULL 3 Using where; Using index; Start temporary
1 PRIMARY t4 index NULL PRIMARY 4 NULL 3 Using index; Using join buffer (flat, BNL join)
1 PRIMARY t1 ref PRIMARY,
1 PRIMARY t2 ref col_int_key col_int_key 5 test.t1.pk 3
minimal switch: semijoin=on?
full switch: index_merge=
bzr version-info:
revision-id: <email address hidden>
date: 2011-11-07 16:39:02 +0400
build-date: 2011-11-08 11:03:47 +0200
revno: 3273
branch-nick: maria-5.3
| Changed in maria: | |
| importance: | Undecided → Critical |
| status: | New → Confirmed |
| Changed in maria: | |
| status: | Confirmed → Fix Committed |
| Changed in maria: | |
| status: | Fix Committed → Fix Released |

Test case. Due to the instability of the plan and the impossibility to force particular semijoin plans, further simplification was not possible.
CREATE TABLE t1 ( pk int(11) NOT NULL AUTO_INCREMENT, col_int_nokey int(11) DEFAULT NULL, col_int_key int(11) DEFAULT NULL, col_date_key date DEFAULT NULL, col_date_nokey date DEFAULT NULL, col_time_key time DEFAULT NULL, col_time_nokey time DEFAULT NULL, col_datetime_key datetime DEFAULT NULL, col_datetime_nokey datetime DEFAULT NULL, col_varchar_key varchar(1) DEFAULT NULL, col_varchar_nokey varchar(1) DEFAULT NULL, PRIMARY KEY (pk), KEY col_int_key (col_int_key), KEY col_date_key (col_date_key), KEY col_time_key (col_time_key), KEY col_datetime_key (col_datetime_key), KEY col_varchar_key (col_varchar_ key,col_ int_key) ) ENGINE=Aria AUTO_INCREMENT=30 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1; '2002-10- 20','2002- 10-20', '03:47: 16','03: 47:16', NULL,NULL, NULL,NULL) ,(11,5, 4,'2008- 09-12', '2008-09- 12','01: 41:48', '01:41: 48','1900- 01-01 00:00:00' ,'1900- 01-01 00:00:00' ,'d','d' ),(12,7, 8,'2006- 06-16', '2006-06- 16','00: 00:00', '00:00: 00',NULL, NULL,'g' ,'g'),( 13,6,NULL, '2004-09- 18','2004- 09-18', '22:32: 04','22: 32:04', '2007-08- 22 14:10:22' ,'2007- 08-22 14:10:22' ,'x','x' ),(14,6, NULL,'1900- 01-01', '1900-01- 01','16: 44:14', '16:44: 14','2005- 01-07 12:15:05' ,'2005- 01-07 12:15:05' ,'f','f' ),(15,2, 0,'2005- 09-13', '2005-09- 13','17: 38:37', '17:38: 37','2008- 07-18 00:00:00' ,'2008- 07-18 00:00:00' ,'p','p' ),(16,9, NULL,'2007- 04-09', '2007-04- 09','08: 46:48', '08:46: 48','2005- 03-24 07:33:11' ,'2005- 03-24 07:33:11' ,'j','j' ),(17,6, 8,'2000- 09-20', '2000-09- 20','14: 11:27', '14:11: 27','2003- 06-13 23:19:49' ,'2003- 06-13 23:19:49' ,'c','c' ),(18,0, 8,'1900- 01-01', '1900-01- 01','07: 55:54', '07:55: 54','2008- 11-09 06:28:05' ,'2008- 11-09 06:28:05' ,'z','z' ),(19,3, 6,NULL, NULL,'14: 18:47', '14:18: 47','2009- 02-11 10:59:50' ,'2009- 02-11 10:59:50' ,'j','j' ),(20,8, 2,'2009- 09-06', '2009-09- 06','00: 00:00', '00:00: 00','2000- 02-23 00:39:41' ,'2000- 02-23 00:39:41' ,NULL,NULL) ,(21,8, 3,'2008- 08-23', '2008-08- 23','01: 57:54', '01:57: 54','1900- 01-01 00:00:00' ,'1900- 01-01 00:00:00' ,'p','p' ),(22,6, 1,'2009- 03-24', '2009-03- 24','21: 24:27', '21:24: 27','2009- 07-03 13:47:15' ,'2009- 07-03 13:47:15' ,'w','w' ),(23,0, NULL,'2009- 11-15', '2009-11- 15',NULL, NULL,'2001- 04-11 12:39:06' ,'2001- 04-11 12:39:06' ,'c','c' ),(24,NULL, 1,'2001- 12-23', '2001-12- 23','21: 34:24', '21:34: 24','2007- 01-26 15:51:38' ,'2007- 01-26 15:51:38' ,'j','j' ),(25,158, 10,'2007- 02-11', '2007-02- 11','18: 11:35', '18:11: 35','2003- 04-27 19:48:50' ,'2003- 04-27 19:48:50' ,'f','f' ),(26,5, 2,'2005- 04-16', '2005-04- 16','09: 21:51', '09:21: 51','2001- 11-15 10:51:46' ,'2001- 11-15 10:51:46' ,'v','v' ),(27,163, 103,'2007- 05-12', '2007-05- 12','09: 02:21', '09:02: 21','1900- 01-01 00:00:00' ,'1900- 01-01 00:00:00' ,'f','f' ),(28,2, 3,'2000- 07-20', '2000-07- 20','22: 40:03', '22:40: 03','2000- 10-20 17:09:41' ,'2000- 10-20 17:09:41' ,'q','q' ),(29,8, 6,'2008- 08-14', '2008-08- 14','19: 29:48', '19:29: 48','2005- 10-03 00:00:00' ,'2005- 10-03 00:00:00','y','y');
INSERT INTO t1 VALUES (10,2,0,
CREATE TABLE t2 ( pk int(11) NOT NULL AUTO_INCREMENT, col_int_nokey int(11) DEFAULT NULL, col_int_key int(11) DEFAULT NULL, col_date_key date DEFAULT NULL, col_date_nokey date DEFAULT NULL, col_tim...