Bug #58015 | Assert in row_sel_field_store_in_mysql_format when running innodb_mrr_icp test | ||
---|---|---|---|
Submitted: | 5 Nov 2010 13:22 | Modified: | 12 Jan 2011 22:17 |
Reporter: | Olav Sandstå | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: InnoDB storage engine | Severity: | S2 (Serious) |
Version: | 5.6.1 | OS: | Any |
Assigned to: | Marko Mäkelä | CPU Architecture: | Any |
Tags: | index_condition_pushdown, optimizer_switch |
[5 Nov 2010 13:22]
Olav Sandstå
[5 Nov 2010 14:31]
Olav Sandstå
Test case that reproduces this crash (taken from innodb_mrr_icp test): CREATE TABLE t0 (a INT); INSERT INTO t0 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); CREATE TABLE t1 (a INT, b CHAR(20), filler CHAR(200), KEY(a,b(10))) ENGINE=InnoDB; INSERT INTO t1 SELECT A.a + 10*(B.a + 10*C.a), 'bbb','filler' FROM t0 A, t0 B, t0 C; UPDATE t1 SET b=REPEAT(char(65+a), 20) WHERE a < 25; SELECT * FROM t1 WHERE a < 10 AND b = REPEAT(CHAR(65+a), 20); DROP TABLE t0,t1;
[5 Nov 2010 14:32]
Olav Sandstå
Query plan/explain for the failing query: EXPLAIN SELECT * FROM t1 WHERE a < 10 AND b = REPEAT(CHAR(65+a), 20); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range a a 5 NULL 19 Using index condition; Using where
[5 Nov 2010 14:46]
Olav Sandstå
The crash goes away if I disable use of Index Condition Pushdown.
[5 Nov 2010 15:10]
Olav Sandstå
The index condition that we push down is: `test`.`t1`.`a` < 10 Note that this condition does not involve the b field of the key.
[8 Nov 2010 8:36]
Olav Sandstå
Looking at the values that are compared in the failing assert: ut_ad(templ->mysql_col_len == len); shows (dbx) print templ->mysql_col_len templ->mysql_col_len = 20U (dbx) print len len = 10U These values corresponds well with the size of the b field (CHAR(20)) and the size of the prefix of the field b in the index (KEY(a, b(10)).
[8 Nov 2010 12:06]
Marko Mäkelä
This is a too strict debug assertion. In the index condition check, we can legitimately return a column prefix to MySQL. If the condition passes, we will convert all columns from the clustered index record to MySQL format, overwriting the column prefix with the full column. The re-conversion is already needed for Bug #56680, to deliver columns of case-insensitive indexes in the correct case.
[5 Dec 2010 12:38]
Bugs System
Pushed into mysql-trunk 5.6.1 (revid:alexander.nozdrin@oracle.com-20101205122447-6x94l4fmslpbttxj) (version source revid:alexander.nozdrin@oracle.com-20101205122447-6x94l4fmslpbttxj) (merge vers: 5.6.1) (pib:23)
[9 Dec 2010 5:30]
MySQL Verification Team
bug still exists in mysql-trunk (5.6.1) but since the testcase here is incomplete, I made a new testcase. The charset is important, imho. drop table if exists `t1`; create table `t1` (`a` char(2),`b` double, primary key (`a`(1)),key (`b`)) engine=innodb default charset=utf8; insert into `t1` values ('',1); select 1 from `t1` where `b` <= 1 and `a` <> '';
[13 Dec 2010 10:23]
Marko Mäkelä
I am testing my patch for this. It was just a bogus debug assertion failure, nothing to worry about. Normally, InnoDB never returns an index prefix to MySQL. In index condition pushdown, we can return an index prefix so that MySQL can evaluate it. (The column will be padded by spaces; only the prefix will be collation-equal to the row. I hope that ICP will never be used when the condition depends on more than the column prefix, or more than collation equality.)
[13 Dec 2010 15:23]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/126660
[13 Dec 2010 15:23]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/126661
[22 Dec 2010 21:30]
Bugs System
Pushed into mysql-trunk 5.6.1 (revid:alexander.nozdrin@oracle.com-20101222212842-y0t3ibtd32wd9qaw) (version source revid:alexander.nozdrin@oracle.com-20101222212842-y0t3ibtd32wd9qaw) (merge vers: 5.6.1) (pib:24)