Commit graph

19 commits

Author SHA1 Message Date
Sergei Petrunia
1289794799 Fix for MDEV-8321, MDEV-6223
EXPLAIN INSERT ... SELECT tried to use SELECT's execution path. This
caused a collection of problems:
- SELECT_DESCRIBE flag was not put into select_lex->options, which
  means it was not in JOIN::select_options either (except for the first
  member of the UNION).
- This caused UNION members to be executed. They would attempt to write
  join output rows to the output.
- (Actual cause of the crash) second join sibling would call
  result->send_eof() when finished execution. Then,
  Explain_query::print_explain would attempt to write to query output
  again, and cause an assertion due to non-empty query output.
2015-10-06 15:54:37 +03:00
Sergei Petrunia
a7dd24cdaa MDEV-8299: MyISAM or Aria table gets corrupted after EXPLAIN INSERT and INSERT
[EXPLAIN] INSERT .. SELECT creates a select_insert object.
select_insert calls handler->start_bulk_insert() during
initialization.

For MyISAM/Aria this requires that a matching call to
handler->end_bulk_insert() call is made.

Regular INSERT .. SELECT accomplishes this by calling either
select_result->send_eof() or select_result->abort_result_set().

EXPLAIN INSERT ... SELECT didn't call either, which resulted in
improper de-initializaiton of handler object. Make it call
abort_result_set(), which invokes handler->end_bulk_insert().
2015-10-06 13:52:27 +03:00
Vicențiu Ciorbaru
acab0faa14 MDEV-7038 Assertion `status_var.memory_used == 0' failed in THD::~THD() on disconnect after executing EXPLAIN for multi-table UPDATE
Added test case that caught this bug. It is no longer reproducible in
the current tree.
2015-05-02 21:46:32 +03:00
Sergey Petrunya
e5d13c1567 Merge 10.0-base -> 10.0 2013-10-16 13:38:42 +04:00
Sergey Petrunya
a06170c8d8 MDEV-3798: EXPLAIN UPDATE/DELETE
- Fix a problem with EXPLAIN multi_table UPDATE: 
  = Do use multi_update object, because multi_update::prepare() does
    various setup, e.g. it disables index-only for the tables to be updated.
  = Protect multi_update::prepare() from being invoked multiple times. 
    If the query has subqueries, they may try to invoke it, for some reason.
2013-10-15 10:34:46 +04:00
Sergey Petrunya
3e8f7c8516 MDEV-5122: "Commands out of sync", "Malformed packet" or client hang up...
- When INSERT catches an error, it should not attempt to send parts of 
  EXPLAIN output.
2013-10-11 19:27:53 +04:00
Sergey Petrunya
7e919c52a5 MDEV-3798: EXPLAIN UPDATE/DELETE
- Produce correct `key_len` when type=index.
2013-10-09 17:15:34 +04:00
Sergey Petrunya
3c6ac6694d MDEV-3798: EXPLAIN UPDATE/DELETE
- Produce correct #rows for ORDER BY ... LIMIT N queries that take advantage of 
  ordered index read to read only N rows.
2013-10-09 13:07:46 +04:00
Sergey Petrunya
69e6a2bb22 MDEV-3798: EXPLAIN UPDATE/DELETE
- Update test results after last few csets
- Generate correct value for `possible_keys` column for single table UPDATE/DELETE.
2013-10-08 16:13:49 +04:00
Sergey Petrunya
98a8642fe8 MDEV-3798: EXPLAIN UPDATE/DELETE
- Add support for EXPLAIN INSERT.
2013-10-07 17:29:51 +04:00
Sergey Petrunya
abcf14e595 MDEV-3798: EXPLAIN UPDATE/DELETE
- Handle the case when EXPLAIN UPDATE/DELETE has pruned away all partitions.
2013-10-05 13:44:01 +04:00
Sergey Petrunya
5e4044e92c MDEV-5093, MDEV-5094:
- Make EXPLAIN {PARTITIONS,EXTENDED} {UPDATE,DELETE} work.
2013-10-04 18:50:47 +04:00
Sergey Petrunya
6519ca51dd EXPLAIN UPDATE/DELETE
- Make EXPLAIN UPDATE/DELETE work inside SPs
- Return correct error code from mysql_delete()
- EXPLAIN <multi-DELETE> will create a multi_delete object (as it 
  affects the optimization). select_result will be only used for 
  producing EXPLAIN output.
2013-10-01 17:49:03 +04:00
Sergey Petrunya
e8eeb2e7f9 Update test results for the previous cset 2013-09-26 14:47:32 +04:00
Sergey Petrunya
ac54df04d8 MDEV-5070 - EXPLAIN INSERT ... SELECT crashes on 10.0-base-explain-slowquerylog
- Add EXPLAIN output print out for INSERT/REPLACE ... SELECT
2013-09-25 17:23:22 +04:00
Sergey Petrunya
69c386d9a6 Code cleanup 2013-09-04 15:37:33 +04:00
Sergey Petrunya
52cfa54c1d [SHOW] EXPLAIN UPDATE/DELETE, code re-structuring
Single table UPDATE/DELETE
- Correctly print type=SIMPLE vs type=PRIMARY
- Handle UPDATE/DELETE of mergeable VIEWs: we get the 
  VIEW's select as the first subquery. 
  (MySQL 5.6 doesn't print it because it finds that the
   subquery is not attached to any select)
2013-06-20 20:58:26 +04:00
Sergey Petrunya
d2995031d9 SHOW EXPLAIN for MariaDB
- Support [SHOW] EXPLAIN UPDATE (needs code cleanup).
2013-02-12 14:37:08 +04:00
Sergey Petrunya
b38b44cfe1 EXPLAIN DELETE for MariaDB
- Include the testcases in the backport.
2013-02-12 08:24:48 +04:00