[MDEV-7827] Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed in Field_long::val_str on EXPLAIN EXTENDED Created: 2015-03-24 Updated: 2021-03-05 Resolved: 2016-02-05 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Admin statements, Data Manipulation - Subquery |
| Affects Version/s: | 5.3.12, 5.5, 10.0, 10.1 |
| Fix Version/s: | 5.5.48, 10.0.24, 10.1.12 |
| Type: | Bug | Priority: | Major |
| Reporter: | Elena Stepanova | Assignee: | Oleksandr Byelkin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | verified | ||
| Issue Links: |
|
||||||||
| Description |
|
|
| Comments |
| Comment by Daniel Black [ 2015-10-01 ] | ||||||||||||||||||||||||
|
Hitting assertions is quite a bit pain. There's quite a few confirmed assertions that aren't fixed: search 'text ~ "Assertion" and status=CONFIRMED' | ||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2016-01-24 ] | ||||||||||||||||||||||||
|
Situation is like this: Item_field::print() see that field belongs to constant table and want to print values (why?) but the field it try to print is not marked for read f2.t1.test (why?). | ||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2016-01-24 ] | ||||||||||||||||||||||||
|
Here is what is already printed before the crash:
and probably field is not marked for write because of materialization (not sure yet | ||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2016-01-24 ] | ||||||||||||||||||||||||
|
(gdb) p *table->read_set->bitmap
It is really f2 field that is left expression of IN so second field is correct and it is just not marked for read. | ||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2016-01-24 ] | ||||||||||||||||||||||||
|
What it should be if switch off the assertion: | ||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2016-01-24 ] | ||||||||||||||||||||||||
|
Without debug output or EXPLAIN value of f2.t1 is really not used. | ||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2016-01-24 ] | ||||||||||||||||||||||||
|
(gdb) p all_tables->next_global->table_name (gdb) p all_tables->next_global->table->read_set First all read_set set all bits by including * | ||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2016-01-25 ] | ||||||||||||||||||||||||
|
join->conds in first call of used tables update and on second one are different. Second contain no field we are looking for, so it is not updated. 2 calls of SELECT_LEX::update_used_tables() : (gdb) p join (gdb) p join | ||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2016-01-25 ] | ||||||||||||||||||||||||
|
condition transformation above made by t1.f2 returned by: but used tables was not updated after this | ||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2016-01-25 ] | ||||||||||||||||||||||||
|
revision-id: 30a3b97bb321706a0e271268ee30ed62964311a7 (mariadb-10.1.10-24-g30a3b97)
It looks like printing expression can touch fields which never be calculated normally, so it have no sens to print it by value Assert added: a view field should be never print by values (normally view is not optimized and constant tables is not read so we are safe) — | ||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2016-01-27 ] | ||||||||||||||||||||||||
|
An alternative fix:
It makes the crash go away. sanja, we need to discuss this. | ||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2016-02-04 ] | ||||||||||||||||||||||||
|
We've agreed that the last version of the fix is correct and should be pushed. |