[MDEV-27188] Suppress optimizer output when executing prepare Created: 2021-12-07 Updated: 2022-03-22 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major |
| Reporter: | Sergei Petrunia | Assignee: | Sergei Petrunia |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Filing this based on igor's input on Slack: Igor wrote:
I've got no clue why this is needed but let's implement it. Initial patch:
|
| Comments |
| Comment by Sergei Petrunia [ 2021-12-07 ] | ||||||||||||||
|
Igor's input: @spetrunia: I applied your diff to my tree. It fixed the rdiff problem (it's not needed anymore). But now I have a failure for the first test case from main.opt_trace_security in --ps-protocol:
@spetrunia: I still don't understand why we need Opt_trace_start constructor anywhere in sql_prepare.cc code. | ||||||||||||||
| Comment by Sergei Petrunia [ 2021-12-07 ] | ||||||||||||||
|
The code in sql_prepare.cc has nothing to do with the above. I have:
and the main.opt_trace_security --ps-protocol still fails in the same way. | ||||||||||||||
| Comment by Sergei Petrunia [ 2021-12-07 ] | ||||||||||||||
|
Also, Igor reports that :
I do not confirm this. If I remove mysql-test/main/opt_trace,ps.rdiff file, then ./mtr --ps-protocol main.opt_trace starts to fail for me. | ||||||||||||||
| Comment by Sergei Petrunia [ 2021-12-07 ] | ||||||||||||||
|
Investigating the issue in main.opt_trace_security. Regular execution
Tracing starts, but then eventually Opt_trace_stmt::missing_privilege() is called and so tracing is aborted. we end up with I_S.OPTIMIZER_TRACE having one line which has an empty trace and INSUFFICIENT_PRIVILEGES=1. Prepared statement execution1. The client issues a Prepare command for select * from db1.t1. On the server, mysqld_stmt_prepare is called. 2. Tracing is not started because of this patch's logic. 3. A missing permission is detected. my_error(ER_TABLEACCESS_DENIED_ERROR, ...) is called. 4. Prepare finishes. Note that it did not produce any optimizer trace. 5. the client sees that Prepare command failed and does NOT issue an Execute command. 6. The next statement,
produces nothing, because the optimizer trace was never saved. This is why we get this difference in test output:
| ||||||||||||||
| Comment by Sergei Petrunia [ 2021-12-17 ] | ||||||||||||||
|
bb-10.7-mdev27188. (This probably won't go into 10.7. Either to 10.8 or to other earlier versions) |