[MDEV-6219] Server crashes in Bitmap<64u>::merge (this=0x180, map2=...) on 2nd execution of PS with INSERT .. SELECT, derived_merge Created: 2014-05-07 Updated: 2015-08-31 Resolved: 2015-08-31 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | OTHER |
| Affects Version/s: | 10.0.10 |
| Fix Version/s: | 10.0.22, 10.1.7 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Elena Stepanova | Assignee: | Oleksandr Byelkin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Stack trace from:
Also reproducible on earlier versions of 10.0. |
| Comments |
| Comment by Oleksandr Byelkin [ 2014-05-13 ] | |||||||||||||||||
|
A field (key field) refers to table which is not mentioned in current join. | |||||||||||||||||
| Comment by Oleksandr Byelkin [ 2014-06-11 ] | |||||||||||||||||
|
It is temporary table (created). So probably it moved somehow from derived table... (wrong merge?) | |||||||||||||||||
| Comment by Oleksandr Byelkin [ 2014-06-12 ] | |||||||||||||||||
|
It looks like the derived table prepared to be merged then materialized without converting references. | |||||||||||||||||
| Comment by Oleksandr Byelkin [ 2014-06-13 ] | |||||||||||||||||
|
The derived table turned to materialized because of updating the same table. References converted. the field refers via reference array => everythoing should work. Where it finds reference on old table it is not clear... | |||||||||||||||||
| Comment by Oleksandr Byelkin [ 2015-02-18 ] | |||||||||||||||||
|
The same problem exists for second execution of SP.
| |||||||||||||||||
| Comment by Oleksandr Byelkin [ 2015-02-18 ] | |||||||||||||||||
|
Opening tables looks the same => problem probably is in expressions. | |||||||||||||||||
| Comment by Oleksandr Byelkin [ 2015-02-19 ] | |||||||||||||||||
|
Comparing debug trace of 5.5 and 10.0 did not show some big differences which could explain the problem | |||||||||||||||||
| Comment by Oleksandr Byelkin [ 2015-02-19 ] | |||||||||||||||||
|
field we are trying to process was allocated during opening tables in previous procedure call | |||||||||||||||||
| Comment by Oleksandr Byelkin [ 2015-02-19 ] | |||||||||||||||||
|
The Item_field which refer this field was resolved in this execution, so probably it found somewhere bad table reference... | |||||||||||||||||
| Comment by Oleksandr Byelkin [ 2015-02-19 ] | |||||||||||||||||
|
Above was false trace | |||||||||||||||||
| Comment by Oleksandr Byelkin [ 2015-02-19 ] | |||||||||||||||||
|
1)first execution uses t1 table in make_join_statistics | |||||||||||||||||
| Comment by Oleksandr Byelkin [ 2015-02-19 ] | |||||||||||||||||
|
the temporary table looks like real materialized derived table | |||||||||||||||||
| Comment by Oleksandr Byelkin [ 2015-02-19 ] | |||||||||||||||||
|
find_dup_table() decided to materialize the table | |||||||||||||||||
| Comment by Oleksandr Byelkin [ 2015-02-19 ] | |||||||||||||||||
|
First execution i was also materialized | |||||||||||||||||
| Comment by Oleksandr Byelkin [ 2015-02-20 ] | |||||||||||||||||
|
There is no mysql_derived_merge() call but second execution have such condition: WHERE:(WHERE in setup_conds) 0x7fffe8034a78 (`test`.`t1`.`a` = 'bar') | |||||||||||||||||
| Comment by Oleksandr Byelkin [ 2015-02-20 ] | |||||||||||||||||
|
list of leaves tables is not empty on second execution in setup_tables()... | |||||||||||||||||
| Comment by Oleksandr Byelkin [ 2015-02-20 ] | |||||||||||||||||
|
actually 1 table when on first execution there was 2 tables... | |||||||||||||||||
| Comment by Oleksandr Byelkin [ 2015-02-20 ] | |||||||||||||||||
|
mysql_insert_select_prepare removes one table the it will be returned, so leaf list should be correct | |||||||||||||||||
| Comment by Oleksandr Byelkin [ 2015-02-22 ] | |||||||||||||||||
|
It looks like something wrong with leaf_tables_exec, because it is manipulated in mysql_insert_select_prepare() only on the first execution. | |||||||||||||||||
| Comment by Oleksandr Byelkin [ 2015-02-23 ] | |||||||||||||||||
|
tables / tables list are OK, so problem in Item resolving (where it found wrong table?) | |||||||||||||||||
| Comment by Oleksandr Byelkin [ 2015-02-23 ] | |||||||||||||||||
|
Item_equal are different but Item_direct_view_res is the same in both cases (resolved differently...) | |||||||||||||||||
| Comment by Oleksandr Byelkin [ 2015-02-23 ] | |||||||||||||||||
|
ref of the Item_direct_view_res is the same (which should be) but *ref differ. | |||||||||||||||||
| Comment by Oleksandr Byelkin [ 2015-02-24 ] | |||||||||||||||||
|
Item_direct_view_res of the condition in both 5.5 and 10.0 created in fix_fields() of left expression in check_and_do_in_subquery_rewrites on first execution only and reverted to temporary tables also only on first execution. But in 5.5 it manage to work on second execution. | |||||||||||||||||
| Comment by Oleksandr Byelkin [ 2015-02-24 ] | |||||||||||||||||
|
the problem is in used_items. if save it after creating second Item_direct_view_res in persistent_used_items on first execution. which causes converting the item to temporary table on the second execution everything goes OK. 1) how it happens that 5.5 works without switching to temporary table? (not rolled back conversion?) | |||||||||||||||||
| Comment by Oleksandr Byelkin [ 2015-02-24 ] | |||||||||||||||||
|
5.5 has exactly the same problem with non changed for temporary table on second execution Item_direct_view_ref, but execution has different path in join_make_statistic on the second run (first run goes the same path which 10.0 goes both times). |