Commit graph

68279 commits

Author SHA1 Message Date
Sergey Petrunya
9fce78a482 Merge fix for BUG#922254 2012-01-30 17:38:14 +04:00
Igor Babaev
5ca1dd8f0b Fixed LP bug #922971.
Applied the fix for bug #12546542 from the mysql-5.6 code line:
JOIN_CACHE::join_records forgot to reset JOIN_TAB::first_unmatched
in some cases.
2012-01-28 01:12:45 -08:00
Igor Babaev
d25f6bb3eb Merge. 2012-01-27 19:23:08 -08:00
Igor Babaev
4e2b6d45e0 Back-ported test cases for bug #59919 of mysql-5.6 code line. The bug could
not be reproduced in the latest release of mariadb-5.3 as it was was fixed
by Sergey Petrunia when working on the problems concerning outer joins within
in subqueries converted to semi-joins.
2012-01-27 19:01:26 -08:00
Sergey Petrunya
4f4047a259 Make testcase stable by adding --sorted_result for SHOW STATUS commands. 2012-01-27 17:51:40 +04:00
Sergey Petrunya
53fde5bb6f BUG#922254: Assertion `0' failed at item_cmpfunc.cc:5899: Item* Item_equal::get_first(JOIN_TAB*, Item*)
Fixed Item* Item_equal::get_first(JOIN_TAB *context, Item *field_item) to work correctly in the case where:
- context!= NO_PARTICULAR_TAB, it points to a table within SJ-Materialization nest
- field_item points to an item_equal that has a constant Item_field but does not have any fields
  from tables that are within semi-join nests.
2012-01-27 17:35:26 +04:00
Sergey Petrunya
8a8e5a50c9 Fix compile failure when built without query cache: define
QUERY_CACHE_DB_LENGTH_SIZE 0, just like it is done with
QUERY_CACHE_FLAGS_SIZE.
2012-01-26 14:20:34 +04:00
Sergey Petrunya
a0c1ada91c Sort counters by name (will this make them show in the same order on all platforms?) 2012-01-26 12:22:02 +04:00
Sergey Petrunya
424f56b3ba BUG#920713: Wrong result (missing rows) with firstmatch+BNL, IN subquery, ...
- Disable use of join cache when we're using FirstMatch strategy, and the join
  order is such that subquery's inner tables are interleaved with outer.  Join 
  buffering code is incapable of handling such join orders.

- The testcase requires use of @@debug_optimizer_prefer_join_prefix to hit the bug, 
  but I'm pushing it anyway (including the mention of the variable in .test file), 
  so that it can be found and enabled when/if we get something comparable in the 
  main tree.
2012-01-25 22:05:20 +04:00
Sergey Petrunya
364c07934c Merge 2012-01-25 18:36:57 +04:00
Sergey Petrunya
73cc529b51 BUG#920255: Wrong result (extra rows) with loosescan and IN subquery
The problem was that LooseScan execution code assumed that tab->key holds 
the index used for looseScan. This is only true when range or full index
scan are used. In case of ref access, the index is in tab->ref.key (and 
tab->index==0 which explains how LooseScan passed tests with ref access: they 
used one index)

Fixed by setting/using loosescan_key, which always the correct index#.
2012-01-25 18:33:57 +04:00
Sergey Petrunya
e10816118a Update handler status variables after the last commit. 2012-01-25 18:27:34 +04:00
Sergey Petrunya
2ae3fca465 Add MRR counters: Handler_mrr_init, Handler_mrr_extra_rowid_sorts,
Handler_mrr_extra_key_sorts.
2012-01-23 23:35:52 +04:00
unknown
5db8b5113b Fixed creating limit for exists subquery. 2012-01-23 15:14:13 +02:00
Igor Babaev
7bdbdb05ce Back-ported test cases for bugs #54437, #55955, #52329, #57623 from subquery_sj
of mysql-5.6 code line. The bugs could not be reproduced in the latest release
of mariadb-5.3 as they were fixed either when the code of subquery optimization
was back-ported from mysql-6.0 or later when some other bugs were fixed.
2012-01-22 12:54:30 -08:00
Igor Babaev
80009f5862 Back-ported test cases for bugs #53060, #53305, #50358, #49453 from subquery_sj
of mysql-5.6 code line. The bugs could not be reproduced in the latest release
of mariadb-5.3 as they were fixed either when the code of subquery optimization
was back-ported from mysql-6.0 or later when some other bugs were fixed.
2012-01-21 20:58:23 -08:00
Sergey Petrunya
9f60aa27f7 BUG#912513: Wrong result (missing rows) with join_cache_hashed+materialization+semijoin=on
- equality substitution code was geared towards processing WHERE/ON clauses.
  that is, it assumed that it was doing substitions on the code that 
   = wasn't attached to any particular join_tab yet
   = was going to be fed to make_join_select() which would take the condition
     apart and attach various parts of it to tables inside/outside semi-joins.
- However, somebody added equality substition for ref access. That is, if 
  we have a ref access on TBL.key=expr, they would do equality substition in
  'expr'. This possibility wasn't accounted for.
- Fixed equality substition code by adding a mode that does equality 
  substition under assumption that the processed expression will be 
  attached to a certain particular table TBL.
2012-01-20 02:11:53 +04:00
Sergey Petrunya
8bedf1ea1c BUG#912538: Wrong result (missing rows) with semijoin=on, firstmatch=on, ...
- setup_semijoin_dups_elimination() would incorrectly set join_tab->do_firstmatch 
  when the join order had outer tables interleaved with inner.
2012-01-19 23:44:43 +04:00
Vladislav Vaintroub
0e975ded65 Fix compiler warning on Windows. 2012-01-19 13:46:59 +01:00
Igor Babaev
d92e84e083 Merge 2012-01-18 15:28:13 -08:00
Igor Babaev
40e4d09c53 Merge 2012-01-18 14:19:28 -08:00
Sergei Golubchik
88f451aa6e multi-delete should ignore semi-join internal temp tables, when looking for tables to delete from 2012-01-18 14:52:56 +01:00
Sergei Golubchik
b297463407 lp:893522 more problems found by PVS Studio 2012-01-18 14:52:38 +01:00
Igor Babaev
746dbbe583 Fixed LP bug #917990.
If the expression for a derived table of a query contained a LIMIT
clause the estimate of the number of rows in this derived table
returned by the EXPLAIN command could be badly off since the
optimizer ignored the limit number from the LIMIT clause when
getting the estimate. 
The call of the method SELECT_LEX_UNIT->set_limit added in the code
of mysql_derived_optimize() will be needed also in maria-5.5 where
parameters in the LIMIT clause are supported.
2012-01-18 03:31:20 -08:00
unknown
69327e2987 Adjust test results after Monty's push of the new
handler counter Handler_read_rnd_deleted.
2012-01-18 12:53:50 +02:00
unknown
6b4c132bc7 Removed unused code merged from 5.2. In 5.3 we fix this problem by checking if we put max/min group function
without GROUP BY artificially in case of MODE_ONLY_FULL_GROUP_BY sql mode.
2012-01-17 15:16:00 +02:00
Michael Widenius
5438d57315 Added Handler_read_rnd_deleted, number of deleted rows found with ha_read_rnd_first. 2012-01-13 14:35:49 +02:00
unknown
296b450d3b Fix the comment. 2012-01-11 10:35:16 +02:00
unknown
cf31ccc33c Fix for LP BUG#908269 Wrong result with subquery in select list, EXISTS, constant MyISAM/Aria table.
Problem: When building the condition for JOIN::outer_ref_cond the optimizer forgot to take into account
that this condition could depend on constant tables as well.
2012-01-10 23:26:00 +02:00
Sergey Petrunya
d21189d775 Merge fix for BUG#912510 2012-01-10 18:20:56 +04:00
Michael Widenius
a148cf7fb0 Fixed that --sorted-result in mysql-test-run also works for exec
mysql-test/r/information_schema_all_engines.result:
  Update result
mysql-test/t/information_schema_all_engines.test:
  Added --sorted-results as tables in information_schema are not sorted.
2012-01-09 13:49:47 +02:00
Vladislav Vaintroub
cf86abffbf MDEV-77 - possible deadlock in XtraDB async io subsystem on Windows.
Split IO threads into ones that handle only read completion and ones that handle only write completion, as it was originally done, but got lost with "completion port" patch. The reason we need to have dedicated read and dedicated write threads is that read completion routine can block waiting for write io to complete, and in rare cases where all io threads are handling async reads, it can deadlock.
2012-01-08 21:14:07 +01:00
Sergey Petrunya
0b590282fc BUG#912510: Crash in do_copy_not_null with semijoin=ON, firstmatch=ON, aggregate ...
- Create/use do_copy_nullable_row_to_notnull() function for ref access, which is used 
  when copying from not-NULL field in table that can be NULL-complemented to not-NULL field.
2012-01-08 14:43:14 +04:00
Igor Babaev
cd55894a52 Fixed LP bug #910083.
The patch for bug 685411 erroneously removed a call of engine->set_thd()
from Item_subselect::fix_fields().
2012-01-02 20:06:36 -08:00
Sergey Petrunya
7714496dc1 Make test results stable. 2011-12-30 22:19:05 +01:00
unknown
0868847b55 Update version in configure.in (was forgotten in 5.3.3 release). 2011-12-30 20:22:52 +01:00
Sergey Petrunya
0346e25f07 Continuation of the efforts in previous cset. 2011-12-30 11:34:29 +01:00
Sergey Petrunya
d9fcec5acd Make test results stable (they weren't, because filesort() used to read
from a heap temptable, which uses pointers to records (that is, byte*
pointers) as rowids.  
This meant that for rows with the same sort key value, the order 
was determined by memory layout.
2011-12-29 22:29:02 +01:00
Sergey Petrunya
3759df08eb Update test results. 2011-12-28 12:12:48 +04:00
Sergey Petrunya
679b7704c6 Merge 2011-12-28 03:37:34 +04:00
Igor Babaev
c583aaf56b Changed a test case from join_cache.test to make it platform independent. 2011-12-25 18:03:03 -08:00
Igor Babaev
2b1f0b8757 Back-ported the patch of the mysql-5.6 code line that
fixed several defects in the greedy optimization:

1) The greedy optimizer calculated the 'compare-cost' (CPU-cost)
   for iterating over the partial plan result at each level in
   the query plan as 'record_count / (double) TIME_FOR_COMPARE'

   This cost was only used locally for 'best' calculation at each
   level, and *not* accumulated into the total cost for the query plan.

   This fix added the 'CPU-cost' of processing 'current_record_count'
   records at each level to 'current_read_time' *before* it is used as
   'accumulated cost' argument to recursive 
   best_extension_by_limited_search() calls. This ensured that the
   cost of a huge join-fanout early in the QEP was correctly
   reflected in the cost of the final QEP.

   To get identical cost for a 'best' optimized query and a
   straight_join with the same join order, the same change was also
   applied to optimize_straight_join() and get_partial_join_cost()

2) Furthermore to get equal cost for 'best' optimized query and a
   straight_join the new code substrcated the same '0.001' in
   optimize_straight_join() as it had been already done in
   best_extension_by_limited_search()

3) When best_extension_by_limited_search() aggregated the 'best' plan a
   plan was 'best' by the check :

   'if ((search_depth == 1) || (current_read_time < join->best_read))'

   The term '(search_depth == 1' incorrectly caused a new best plan to be
   collected whenever the specified 'search_depth' was reached - even if
   this partial query plan was more expensive than what we had already
   found.
2011-12-24 08:55:10 -08:00
Sergey Petrunya
5d9fbc6177 Fix version number: it's 5.3.3 2011-12-20 12:13:47 +04:00
Sergey Petrunya
fa061af373 Update mysql-test/suite/pbxt/r/subselect.result for the previous push 2011-12-20 09:57:42 +04:00
unknown
072073c09e Backport of WL#5953 from MySQL 5.6
The patch differs from the original MySQL patch as follows:
- All test case differences have been reviewed one by one, and
  care has been taken to restore the original plan so that each
  test case executes the code path it was designed for.
- A bug was found and fixed in MariaDB 5.3 in
  Item_allany_subselect::cleanup().
- ORDER BY is not removed because we are unsure of all effects,
  and it would prevent enabling ORDER BY ... LIMIT subqueries.
- ref_pointer_array.m_size is not adjusted because we don't do
  array bounds checking, and because it looks risky.

Original comment by Jorgen Loland:
-------------------------------------------------------------
WL#5953 - Optimize away useless subquery clauses
      
For IN/ALL/ANY/SOME/EXISTS subqueries, the following clauses are 
meaningless:
      
* ORDER BY (since we don't support LIMIT in these subqueries)
* DISTINCT
* GROUP BY if there is no HAVING clause and no aggregate 
  functions
      
This WL detects and optimizes away these useless parts of the
query during JOIN::prepare()
2011-12-19 23:05:44 +02:00
Sergey Petrunya
a05a566cf0 BUG#906357: Incorrect result with outer join and full text match
- The problem was that const-table-reading code would try to evaluate MATCH()
  before init_ftfuncs() was called. 
- Fixed by making MATCH function "expensive" so that nobody tries to evaluate it
  at optimization phase.
2011-12-20 00:55:32 +04:00
Sergey Petrunya
15ea7238e4 BUG#906385: EXPLAIN EXTENDED crashes in TABLE_LIST::print with limited max_join_size
- Take into account that subquery's optimization can fail because of @@max_join_size error.
2011-12-19 22:24:10 +04:00
Sergey Petrunya
be3e52984f BUG#904432: Wrong result with LEFT JOIN, constant table, semijoin=ON,materialization=ON
- Correct handling for SJ-Materialization + outer joins (details in the comments in the code)
2011-12-19 20:58:55 +04:00
Sergey Petrunya
263ee55318 Remove garbage comments 2011-12-19 18:07:19 +04:00
unknown
11e2462152 Supression condition made wider to cover some other system cases. 2011-12-19 10:11:21 +02:00