[MDEV-6575] main.view --ps-protocol fails in ANALYZE code Created: 2014-08-13 Updated: 2014-08-13 Resolved: 2014-08-13 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 10.1.0 |
| Fix Version/s: | 10.1.1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Sergei Petrunia | Assignee: | Sergei Petrunia |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
As reported by serg on IRC: main.view --ps-protocol fails in ANALYZE code. |
| Comments |
| Comment by Sergei Petrunia [ 2014-08-13 ] | |||||
|
It crashes in this line
because join_tab->tracker==NULL. The only reason it could be NULL is that JOIN::save_explain_data() has not been called for this join. | |||||
| Comment by Sergei Petrunia [ 2014-08-13 ] | |||||
|
Minimal sequence to do the crash:
The crash happens in the INSERT command. | |||||
| Comment by Sergei Petrunia [ 2014-08-13 ] | |||||
|
First, we enter: #0 JOIN::optimize (this=0x7fffc7276088) at /home/psergey/dev-git/10.1/sql/sql_select.cc:1022 Then, we enter This is "create vew v1 as select max the inner JOIN::optimize() finishes, calls JOIN::save_explain_data() and saves The outer JOIN::optimizer(this=0x7fffc7276088) finishes, attepts to save its Not saving the plan causes tracker counters not to be created, which later causes crash. | |||||
| Comment by Sergei Petrunia [ 2014-08-13 ] | |||||
|
It's generally a bad thing that two selects in the same query both have select_number=2. However, attempting to fix this may open a can of worms. What if I de-coupled query plan saving and creation of counters instead? They are logically two different tasks. | |||||
| Comment by Sergei Petrunia [ 2014-08-13 ] | |||||
|
The problem with the above approach is that the counters belong to the Explain data structures. We could have a separate function which walks through both JOIN_TABs and But it won't help. The point is, here we have a situation where there are two | |||||
| Comment by Sergei Petrunia [ 2014-08-13 ] | |||||
|
After a long discussion with sanja, came up with a way to avoid two select_lex objects having the same select_number. |