[MDEV-2872] LP:818280 - crash in do_copy_not_null() in maria-5.3 with semijoin Created: 2011-07-29 Updated: 2015-02-02 Resolved: 2012-10-04 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Critical |
| Reporter: | Dan Vande More | Assignee: | Sergei Petrunia |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | Launchpad | ||
| Attachments: |
|
| Description |
|
Attaching test data for reproduction. Sometimes it can take a few times to crash. Already upgraded to beta from a trunk, bug still exists. Best reproduced with: set optimizer_switch='index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=on,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=off,mrr=on,mrr_cost_based=off,mrr_sort_keys=on,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=off,table_elimination=on'; Not sure which flag or combo it is, I'm sorry, I didn't have the time to test every combination. Stacktrace: 110729 22:29:13 [ERROR] mysqld got signal 11 ; key_buffer_size=0 Thread pointer: 0x7f5281b8fd00 Trying to get some variables. The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains |
| Comments |
| Comment by Dan Vande More [ 2011-07-29 ] | ||||||||||||||||||||||||||||||||||||||||||||
|
Re: crashing bug (signal 11) in 5.3.0-MariaDB-beta-log | ||||||||||||||||||||||||||||||||||||||||||||
| Comment by Dan Vande More [ 2011-07-29 ] | ||||||||||||||||||||||||||||||||||||||||||||
|
test case | ||||||||||||||||||||||||||||||||||||||||||||
| Comment by Philip Stoev (Inactive) [ 2011-08-02 ] | ||||||||||||||||||||||||||||||||||||||||||||
|
Re: crashing bug (signal 11) in 5.3.0-MariaDB-beta-log explain: id select_type table type possible_keys key key_len ref rows Extra simplified test case: CREATE TABLE t1 ( c1 varchar(32) NOT NULL , c2 int, PRIMARY KEY (c1)) ; CREATE TABLE t2 ( c1 varchar(32) NOT NULL , c5 int NOT NULL ); backtrace: #3 <signal handler called> INSERT IGNORE INTO t2 VALUES (24276075,2),(24853084,2); SET SESSION optimizer_switch='semijoin=on'; bzr version-info | ||||||||||||||||||||||||||||||||||||||||||||
| Comment by Philip Stoev (Inactive) [ 2011-08-02 ] | ||||||||||||||||||||||||||||||||||||||||||||
|
Re: crash in do_copy_not_null() in maria-5.3 with semijoin CREATE TABLE t1 ( c1 int NOT NULL , c2 int NOT NULL, PRIMARY KEY (c1)) ; CREATE TABLE t3 ( c1 int NOT NULL , c2 int NOT NULL, PRIMARY KEY (c1)) ; CREATE TABLE t2 ( c1 int NOT NULL , c5 int NOT NULL ); SET SESSION optimizer_switch='semijoin=on'; | ||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2011-08-05 ] | ||||||||||||||||||||||||||||||||||||||||||||
|
Re: crash in do_copy_not_null() in maria-5.3 with semijoin MariaDB [j2]> explain extended SELECT * FROM t1 WHERE c1 IN (SELECT t3.c1 FROM t3 LEFT JOIN t2 ON t2.c1 = t3.c1 WHERE t2.c5 != 0);
---
--- | ||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2011-08-05 ] | ||||||||||||||||||||||||||||||||||||||||||||
|
Re: crash in do_copy_not_null() in maria-5.3 with semijoin (gdb) wher 4 where from->maybe_null() == true to->maybe_null() == false based on this, Copy_field::set() sets do_copy= do_copy_not_null. do_copy_not_null() copies from NULL-able field to non-NULLable. It crashes when | ||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2011-08-05 ] | ||||||||||||||||||||||||||||||||||||||||||||
|
Re: crash in do_copy_not_null() in maria-5.3 with semijoin Problem-A). Why we have from= {t2.c1}, from->maybe_null() == true This seems to be a known problem of field NULLability attributes not being updated after outer-to-inner join conversion. Problem-B). Still, it is a valid situation when ref access refers to a table column that is on an inner side of outer join and so has from->maybe_null() == true do_copy_not_null() function does not provide valid processing for this case. | ||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2011-08-05 ] | ||||||||||||||||||||||||||||||||||||||||||||
|
Re: crash in do_copy_not_null() in maria-5.3 with semijoin create table t0 (a int); create table t1 (a int, b int); create table t2a (a not null, b not null); create table t3a ( b int not null, filler char(100), key(b)); MariaDB [j33]> explain extended select * from (t1 left join t2a on t1.a=t2a.a) join t3a on t3a.b<=>t2a.b;
---
--- from = {t2a.b} to = {t3a.b}to->real_maybe_null() == true to->maybe_null() = true We don't get into crashing scenario, because {t3a.b} ->maybe_null()==TRUE. This is odd, because in table definition t3a.b was defined as NOT NULL. Further investigation shows that the Field_long object used for t3a.b was created here: #0 Field::new_key_field (this=0xa0ebc68, root=0x959040a4, new_table=0xa0e54e0, new_ptr=0xa0f3c98 "", new_null_ptr=0xa0f3ce0 "", new_null_bit=1) at field.cc:1795 In particular, Field::new_key_field() created a new field object that is NULLable while the field itself was not: (gdb) p this->maybe_null() | ||||||||||||||||||||||||||||||||||||||||||||
| Comment by Rasmus Johansson (Inactive) [ 2011-12-13 ] | ||||||||||||||||||||||||||||||||||||||||||||
|
Launchpad bug id: 818280 |