Commit graph

68349 commits

Author SHA1 Message Date
Igor Babaev
3ef46370e9 Fixed bug #934348.
This bug is the result of an incomplete/inconsistent change introduced into
5.3 code when the cond_equal parameter were added to the function optimize_cond.
The change was made during a merge from 5.2 in October 2010.
The bug could affect only queries with HAVING.
2012-02-18 19:11:57 -08:00
Igor Babaev
cd81f57830 Fixed LP bug #934342.
An outer join query with a semi-join subquery could return a wrong result
if the optimizer chose to materialize the subquery.
It happened because when substituting for the best field into a ref item
used to build access keys not all COND_EQUAL objects that could be employed
at substitution were checked.

Also refined some code in the function check_join_cache_usage to make it
safer.
2012-02-18 16:06:38 -08:00
Sergei Golubchik
bbb3527635 Remove engine-specific (but identical) icp callbacks. create one reusable
common icp callback in the handler.cc.

It can also increment status counters, without making the engine
dependent on the exact THD layout (that is different in embedded).
2012-02-17 13:27:41 +01:00
Igor Babaev
2d19b077d5 Fixed LP bug #928352.
This bug led to wrong values of the use_count fields in some SEL_ARG
trees that triggered complains on the server side when executing the
test case for LP bug 800184 if a debug build of the server was used.
  
This was the result of the incomplete fix for bug 800184.
To complete it the following corrections had to be made:
- the copy constructor for SEL_TREE must call the new function incr_refs_all()
  instead of the function incr_refs(), because references to next key parts
  from any SEL_ARG tree belonging to the list of the first key part has to be
  adjusted.
- the method and_sel_tree of the class SEL_IMERGE must use the copy constructor
  of the SEL_TREE class to make a copy of its second argument before it ANDs it
  with any SEL_TREE tree from the processed SEL_IMERGE object.
2012-02-16 20:13:28 -08:00
Sergey Petrunya
541334c5ac Backport of:
timestamp: Thu 2011-12-01 15:12:10 +0100
Fix for Bug#13430436 PERFORMANCE DEGRADATION IN SYSBENCH ON INNODB DUE TO ICP

When running sysbench on InnoDB there is a performance degradation due
to index condition pushdown (ICP). Several of the queries in sysbench
have a WHERE condition that the optimizer uses for executing these
queries as range scans. The upper and lower limit of the range scan
will ensure that the WHERE condition is fulfilled. Still, the WHERE
condition is part of the queries' condition and if ICP is enabled the
condition will be pushed down to InnoDB as an index condition. 

Due to the range scan's upper and lower limits ensure that the WHERE
condition is fulfilled, the pushed index condition will not filter out
any records. As a result the use of ICP for these queries results in a
performance overhead for sysbench. This overhead comes from using
resources for determining the part of the condition that can be pushed
down to InnoDB and overhead in InnoDB for executing the pushed index
condition.

With the default configuration for sysbench the range scans will use
the primary key. This is a clustered index in InnoDB. Using ICP on a
clustered index provides the lowest performance benefit since the
entire record is part of the clustered index and in InnoDB it has the
highest relative overhead for executing the pushed index condition.

The fix for removing the overhead ICP introduces when running sysbench
is to disable use of ICP when the index used by the query is a
clustered index.

When WL#6061 is implemented this change should be re-evaluated.
2012-02-16 20:15:57 +04:00
Sergey Petrunya
e98e05da7a Added comments 2012-02-16 18:56:10 +04:00
unknown
607aab9c1d Counters for Index Condition Pushdown added (MDEV-130). 2012-02-16 08:49:10 +02:00
unknown
764eeeee74 Fix for LP BUG#910123 MariaDB 5.3.3 causes 1093 error on Drupal
Problem was that now we can merge derived table (subquery in the FROM clause).
Fix: in case of detected conflict and presence of derived table "over" the table which cased the conflict - try materialization strategy.
2012-02-14 16:52:56 +02:00
Alexey Botchkov
7ab53e8062 MDEV-59 Review and push crashsafe GIS keys.
tests for RTree keys recovery.
2012-02-14 16:04:06 +04:00
Sergey Petrunya
e41e56ae99 Merge fix for BUG#928048 2012-02-14 14:13:10 +04:00
Sergey Petrunya
c9355dc279 BUG#928048: Query containing IN subquery with OR in the where clause returns a wrong result
- Make equality propagation work correctly when done inside the OR branches
2012-02-14 13:58:57 +04:00
Igor Babaev
c8bbe06ac7 Fixed LP bug #925985.
If the flag 'optimize_join_buffer_size' is set to 'off' and the value
of the system variable 'join_buffer_size' is greater than the value of
the system variable 'join_buffer_space_limit' than no join cache can
be employed to join tables of the executed query.
A bug in the function JOIN_CACHE::alloc_buffer allowed to use join
buffer even in this case while another bug in the function 
revise_cache_usage could cause a crash of the server in this case if the
chosen execution plan for the query contained outer join or semi-join
operation.
2012-02-13 23:46:57 -08:00
unknown
27dfa45e70 When we fail during slave thread initialisation, keep mi->run_lock
locked until we have finished clean up.

Previously, the code released the lock without marking that the thread
was running. This allowed a new slave thread to start while the old one
was still in the middle of cleaning up, causing assertions and probably
general mayhem.
2012-02-13 17:14:10 +01:00
Vladislav Vaintroub
e2deff6f02 merge 2012-02-12 23:03:36 +01:00
Vladislav Vaintroub
0c265a5eb8 Use newly released HeidiSQL 7.0 in the MSI installer 2012-02-12 23:02:56 +01:00
Vladislav Vaintroub
e777a6cc57 merge 2012-02-11 15:05:07 +01:00
Vladislav Vaintroub
941572137c merge 2012-02-11 15:00:15 +01:00
Vladislav Vaintroub
e2cb03c980 Fix for MDEV-140, LPBug#930145 - broken SSL connectivity for some connectors 2012-02-11 14:57:44 +01:00
Vladislav Vaintroub
b3e15f8389 A recent change in the server protocol code broke SSL connection for some client libraries.
Protocol documentation (http://forge.mysql.com/wiki/MySQL_Internals_ClientServer_Protocol)
says that initial packet sent by client if client wants SSL, consists of client capability flags only
(4 bytes or 2 bytes edependent on protocol versionl). 
Some clients happen to send more in the initial SSL packet (C client, Python connector), while others (Java, .NET) follow the docs and send only client capability flags.

A change that broke Java client was a newly introduced check that frst client packet
has 32 or more bytes. This is generally wrong, if client capability flags contains CLIENT_SSL.

Also, fixed the code such that read max client packet size and charset in the first packet prior to SSL handshake.  With SSL, clients do not have to send this info, they can only send client flags.

This is now fixed such that max packet size and charset are not read prior to SSL handshake, in case of SSL they are read from the "complete" client authentication packet after SSL initialization.
2012-02-11 03:25:49 +01:00
unknown
4360bd8094 Merge fix for lp:910817: Race condition in kill_threads_for_user(). 2012-02-10 22:09:57 +01:00
Michael Widenius
6fa209f7ad Automatic merge 2012-02-10 22:56:34 +02:00
Michael Widenius
ea45d770af Fixed that prepared statements are properly igored (if possible) by query cache. 2012-02-10 22:53:46 +02:00
unknown
e76a0476cc Merge fix for lp:910817: Race condition in kill_threads_for_user(). 2012-02-10 21:20:32 +01:00
unknown
3d61c1399d lp:910817: Race condition in kill_threads_for_user()
The code was accessing a pointer in a mem_root that might be freed by
another concurrent thread. Fix by moving the access to be done while the
LOCK_thd_data is held, preventing the memory from being freed too early.
2012-02-10 21:19:12 +01:00
unknown
f6cdddf51f Test case for bug lp:905353
The bug itself is fixed by the patch for bug lp:908269.
2012-02-09 23:35:26 +02:00
Igor Babaev
3efc8d016f Made mrr related counters temporarily invisible until we agree upon their names. 2012-02-03 12:49:17 -08:00
unknown
74b61f845b Fixed typos in Query Cache. 2012-02-03 16:56:12 +02:00
unknown
f5c8749a47 Merge with 5.2 2012-02-03 13:32:29 +02:00
unknown
79a04a2c9c Moving LP BUG#794005 to 5.3 + fixing INSERT of multi-table view. 2012-02-03 13:01:05 +02:00
unknown
52d4103ccc Fixed DELETE issues of view over view over table. 2012-02-03 12:24:55 +02:00
Igor Babaev
046988661d Back-ported the fix for bug #12831587 from mysql-5.6 code line.
The comment for the fix commit says:
Due to the changes required by ICP we first copy a row from the InnoDB
format to the MySQL row buffer and then copy it to the pre-fetch queue.
This was done for the non-ICP code path too. This change removes the
double copy for the latter.
2012-02-03 00:46:34 -08:00
unknown
b9616d815d Added 5.2 test result delimiter 2012-02-03 10:31:30 +02:00
unknown
d6e1377ac2 Fix check of view updatability in case of underlying view changes its updatability.
For single table update/insert added deep check of single tables (single_table_updatable()).
For multi-table view insert added additional check of target table (check_view_single_update).
Multi-update was correct.

Test suite for all cases added.
2012-02-03 10:28:23 +02:00
Igor Babaev
94c316069e Applied the patch from mysql-5.6 code line that fixed
a significant performance drop for high concurrency bechmarks
(bug #11765850 - 58854).

Here's the comment of the patch commit:

The bug is that the InnoDB pre-fetch cache was not being used in
row_search_for_mysql().  Secondly the changeset that planted the
bug also introduced some inefficient code. It would read an extra
row, convert it to MySQL row format (for ICP==off), copy the row
to the pre-fetch cache row buffer, then check for cache overflow
and dequeue the row that was pushed if there was a possibility of
a cache overflow.
2012-02-02 22:22:27 -08:00
Igor Babaev
51e4bf7356 Merge. 2012-02-01 17:48:45 -08:00
Igor Babaev
7b79d8a33f Merge 5.2->5.3 in preparation for the release of mariadb-5.3.4-rc. 2012-02-01 15:48:02 -08:00
unknown
b4643d75fe fix for LP BUG#921878.
Problem was in try to check/use Item_direct_ref of derived view when we have to use real Item_field under it.
2012-02-01 17:09:49 +02:00
Sergei Golubchik
7ed15e6e50 sort status variables alphabetically in mysqld.cc 2012-01-31 21:12:26 +01:00
Sergey Petrunya
12bd3dfe29 BUG#923246: Loosescan reports different result than other semijoin methods
- If LooseScan is used with quick select, require that quick select produces 
  data in key order (this disables use of MRR, which can return data in arbitrary order).
2012-01-30 20:34:47 +04:00
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