Commit graph

85401 commits

Author SHA1 Message Date
Sergey Petrunya
207f008220 Fix valgrind failure caused by calling c_ptr() of an empty StringBuffer<N>. 2013-10-15 19:24:43 +04:00
Sergey Petrunya
c0a741f005 Fix buildbot failures:
- MYSQL_MULTI_DELETE_DONE probe compile failure
- show_explain_non_select.test
2013-10-15 16:39:54 +04:00
Sergey Petrunya
7be365ea9c MDEV-3798: [SHOW] EXPLAIN UPDATE/DELETE
- When showing EXPLAIN output in the slow query log, 
  format it so that one could use grep or other tool
  to get the output.
2013-10-15 13:21:06 +04:00
Sergey Petrunya
282ff783b1 MDEV-5117: Explain for a query executed as a PS is not written into the slow log
- Save the query plan after the statement was executed so that its gets into
  the slow query log.
2013-10-15 13:14:44 +04:00
Sergey Petrunya
1e36cbfa39 MDEV-3798: [SHOW] EXPLAIN UPDATE/DELETE
- Merge with 10.0-base
2013-10-15 11:51:41 +04:00
Sergey Petrunya
25d0175fde MDEV-3798: EXPLAIN UPDATE/DELETE:
- Port grant_explain_non_select.{test,result} from mysql-5.6
- Per Sanja's hint, fix mysql_make_view() to take into 
  account that EXPLAIN now is not necessarily EXPLAIN SELECT.
2013-10-15 11:43:34 +04:00
Sergey Petrunya
e522ebc221 Update test results for the last cset. 2013-10-15 10:36:39 +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
a356cfbefb MDEV-3798: EXPLAIN UPDATE/DELETE
- eliminate join_save_qpf() function.
2013-10-15 08:00:48 +04:00
Igor Babaev
eb2c6f4513 Merge 5.5->10.0-base 2013-10-14 13:39:18 -07:00
Sergey Petrunya
1ec399ce03 Code cleanup. 2013-10-15 00:30:32 +04:00
Igor Babaev
eae0a45f4e Merge 2013-10-14 12:30:20 -07:00
Igor Babaev
1381585244 Merge 5.3->5.5 2013-10-14 12:08:55 -07:00
Igor Babaev
81623bdc35 Fixed bug mdev-5135.
The patch for bug mdev-5105 incorrectly counted conditions in nested joins.
2013-10-14 10:29:24 -07:00
Alexey Botchkov
4e243be509 MDEV-5131 create_embedded_thd is not thread safe, libmysqld.
The emb_free_embedded_thd() has the thread-unsafe code
        so should be 'mutexed' also.
2013-10-14 21:23:09 +05:00
Sergey Petrunya
105e3ae6c9 MDEV-3798: EXPLAIN UPDATE/DELETE
Update the SHOW EXPLAIN code to work with the 
new architecture (part#1):
Before, SHOW EXPLAIN operated on real query plan structures, 
which meant it had to check when SELECTs are created/deleted.
SELECTs would call apc_target->enable() when they got a query 
plan and disable() when their query plan was deleted.

Now, Explain data structure becomes available at once (and we
call apc_target->enable()) and then it stays until it is deleted
(when that happens, we call apc_target->disable()).
2013-10-14 20:09:33 +04:00
Sergey Petrunya
f67f8fd00f MDEV-3798: EXPLAIN UPDATE/DELETE
- Fix EXPLAIN INSERT DELAYED ... : do call end_delayed_insert().
2013-10-14 20:01:28 +04:00
Igor Babaev
ddc46740a5 Merge 5.5->10.0-base 2013-10-13 18:10:19 -07:00
Igor Babaev
c7db46a242 Merge 5.3-5.5 2013-10-13 13:43:29 -07:00
Alexey Botchkov
e37639e934 MDEV-5131 create_embedded_thd is not thread safe, libmysqld.
LOCK_thread_count locked when we do threads.append().
2013-10-13 23:25:57 +05:00
Igor Babaev
78b580b779 Fixed bug mdev-5132.
Objects of the classes Item_func_isnull and Item_func_isnotnull
must have the flag sargable set to TRUE.
Set the value of the flag sargable only in constructors of the 
classes inherited from Item_int_func.
2013-10-11 23:24:57 -07:00
Igor Babaev
092a238864 Fixed a problem of the patch for mdev-5105 that caused valgrind complains. 2013-10-11 12:50:30 -07: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
unknown
d61cffa6b1 MDEV-5130: More precise binlog position reporting for IO thread when reconnecting with GTID
Make IO thread check for end of event group, so that upon
disconnect at the end of an event group it can report the last
read GTID as expected. Also inject a fake Rotate event at
reconnect when skipping part of an initial event group, to
give SQL thread the correct Read_Master_Log_Pos.

Reported by Pavel Ivanov.
2013-10-11 11:21:18 +02:00
Sergey Petrunya
a1705b762e Update tests: log_slow_verbosity now supports query_plan=explan. 2013-10-11 12:40:25 +04:00
Alexander Barkov
032dc20541 MDEV-4425 Regexp enhancements
Mark a few PCRE CMake variables as advanced,
so the are not presented in cmake-gui by default.
2013-10-11 08:52:24 +04:00
Igor Babaev
7c87385e30 Fixed bug mdev-5105.
The bug caused a memory overwrite in the function update_ref_and_keys()
It happened due to a wrong value of SELECT_LEX::cond_count. This value
historically was calculated by the fix_fields method. Now the logic of
calling this method became too complicated and, as a result, this value
is calculated not always correctly.
The patch changes the way how and when  the values of SELECT_LEX::cond_count
and of SELECT_LEX::between_count are calculated. The new code does it just at
the beginning of update_ref_and_keys().
2013-10-10 10:08:26 -07:00
Sergey Petrunya
094f70fd19 MDEV-5106: Server crashes in Explain_union::print_explain on ER_TOO_BIG_SELECT
- Don't save UNION's EXPLAIN data if optimization failed with 
  an error. We could end up saving incomplete plan, which will 
  cause a crash when we attempt to print it.
2013-10-10 20:30:32 +04:00
Alexey Botchkov
508d40fbdb MDEV-4788 check mysql-5.5 changes in spatial.cc.
Additional patch for the 5.5.
2013-10-10 14:20:35 +05:00
Sergey Petrunya
582ecb2a25 MDEV-3798: EXPLAIN UPDATE/DELETE:
Backport mysql-test/t/myisam_explain_non_select_all.test from mysql-5.6
- the .result file was modified because MariaDB choses different 
  query plans in a number cases. Also, we don't have some of the 
  "incorrect EXPLAIN output" bugs that they still have.

The .test file and includes were taken verbatim with one 
exception: two tests were disabled with --disable parsing:

1. @@sql_safe_updates is not enforced EXPLAINs of multitable 
   updates. In MariaDB, the execution itself will produce 
   ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE, but EXPLAIN won't.
2. Their case #71 hits some old bug in MyISAM (See their comments
   in explain_non_select.inc for details).
2013-10-09 17:20:42 +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
Alexey Botchkov
ae82601035 MDEV-3856 Import of a large polygon fails/hangs.
The Gis_point::init_from_wkt called the String::realloc(),
        and this call is quite slow in the DEBUG mode. Which makes
        loading the huge polygon hang forever.
        Fixed by using the String::realloc(size, inc_size) version instead
        as it's done for other spatial features.
2013-10-09 17:30:50 +05: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
161d687594 MDEV-3798: EXPLAIN UPDATE/DELETE
- Generate correct contents of `Extra` column for UPDATEs/DELETEs that use quick selects
- UPDATEs with used_key_is_modified=true will show "Using buffer"
2013-10-09 09:40:33 +04:00
Alexander Barkov
1bcd2bebc6 MDEV-4425 Regexp enhancements
Do not pass PCRE_UCP flag for binary data.
This makes bytes 0x80..FF not to belong to 
generic character classes \d (digit) and \w (word character).

SELECT 0xFF RLIKE '\\w';
 -> 0

Note, this change does not affect non-binary data,
which is still examined with the PCRE_UCP flag by default.
2013-10-08 18:25:17 +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
fda46df620 MDEV-3798: EXPLAIN UPDATE/DELETE
- if EXPLAIN DELETE prints "Deleting all rows", it should show the 
  expected number of rows in the rows column.
2013-10-08 14:26:14 +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
69393db3d1 MDEV-3798: EXPLAIN UPDATE/DELETE
- Better EXPLAIN-saving methods for quick selects
2013-10-07 13:58:47 +04:00
Sergey Petrunya
8346a498ea MDEV-3798: EXPLAIN UPDATE/DELETE
- Run probes like MYSQL_INSERT_SELECT_START or 
  MYSQL_MULTI_DELETE_START for EXPLAIN, too.
  We should run them, because 1. EXPLAIN SELECT does it, and 
  2. MySQL also does it.
2013-10-07 13:20:22 +04:00
Sergey Petrunya
062b7bfa39 Better comments 2013-10-05 13:48:45 +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
72bc6d7364 MDEV-3798: EXPLAIN UPDATE/DELETE
- Address review feedback: more renames
2013-10-05 13:19:45 +04:00
Sergey Petrunya
6a7f8af3f9 MDEV-3798: EXPLAIN UPDATE/DELETE
- Address review feedback: rename files
2013-10-05 10:25:59 +04:00
Sergey Petrunya
fedf769f0b MDEV-3798: EXPLAIN UPDATE/DELETE
- Address review feedback: rename nearly any name used by the new EXPLAIN code.
2013-10-05 09:58:22 +04:00
Igor Babaev
ec226e553a Fixed bug mdev-5078.
For aggregated fields from views/derived tables the possible adjustment
of thd->lex->in_sum_func->max_arg_level in the function Item_field::fix_fields
must be done before we leave the function.
2013-10-04 09:51:07 -07:00
Sergey Petrunya
f5fba6564b MDEV-411: (different results for EXPLAIN and SHOW EXPLAIN)
- Added a testcase
2013-10-04 19:09:39 +04:00
Sergey Petrunya
5e4044e92c MDEV-5093, MDEV-5094:
- Make EXPLAIN {PARTITIONS,EXTENDED} {UPDATE,DELETE} work.
2013-10-04 18:50:47 +04:00
Alexander Barkov
43c09c15ff MDEV-4425 Regexp enhancements
Fixing compilation failure on Solaris.
The int64_t type was not defined because stdint.h was not included
due to a missing definition in pcre/config-cmake.h.in.
2013-10-04 09:57:30 +04:00
Alexander Barkov
c8e6cb9643 MDEV-4425 Regexp enhancements
Clean-up: moving initialization of my_string_stack_guard
and pcre_stack_guard into init_libstrings() and init_pcre().
2013-10-03 16:42:20 +04:00