Commit graph

26884 commits

Author SHA1 Message Date
Igor Babaev
6c7360b540 Merge 2011-02-07 15:19:03 -08:00
Igor Babaev
cbeab25085 Fixed LP bug #702403 that caused a crash on the tree for mwl#128
with the test case added by this patch.
The bug cannot be reproduced with the same test case for the main
5.3 tree because the backported fix for bug 59696 masks the 
problem that causes the crash in the mentioned test case. It's not
clear weather this fix masks this problem in all possible cases. 

Anyway the patch for bug 698882 introduced some inconsistent data
structures that could contain indirect references to deleted object.
It happened when two Item_equal objects were merged and the Item_field
list of the second object was joined to such list of the first object.
This operation required adjustment of the backward pointers in 
Item fields from the joined list. However the adjustment was missing 
and this caused crashes in the tree for mwl#128.

Now the backward pointers are set only when Item_equal items are
completely built and are not changed anymore.
2011-02-05 20:57:03 -08:00
Igor Babaev
8041013fb1 Back-ported the patch for bug #59696 from mysql-5.6 code line.
The patch fixed the following optimizer defect: when performing
substitution for best equal fields into where conditions to be
able to do their evaluations as soon as possible the optimizer 
skipped conditions over views. That could lead to suboptimal 
execution of queries that used views.  
Slightly changed the test case to demonstrate the performance
improvements if this fix.
2011-01-31 19:33:32 -08:00
Igor Babaev
9ea80ac481 Merge 2011-01-28 18:54:30 -08:00
Igor Babaev
d492903502 Fixed LP bug #707827.
This bug could manifest itself when hash join over a varchar column
with NULL values in some rows was used. It happened because the
function key_buf_cmp erroneously returned FALSE when one of the joined
key fields was null while the second was not.
Also fixed two other bugs in the functions key_hashnr and key_buf_cmp 
that could possibly lead to wrong results for some queries that
used hash join over several columns with nulls.
Also reverted the latest addition of the test case for bug #45092. It
had been already backported earlier.
2011-01-27 21:23:02 -08:00
Igor Babaev
3e868cd3cb Fixed LP bug #707848.
This was another bug in the patch for bug 698882. The new
code from this patch did not ensured that substitutions
of fields for best equal fields were performed on all
AND-OR levels. As a result substitutions for best fields
in some predicates that had been used by the range optimizer
were not actually performed while range plans could employ
these substitutions. This could lead to inconsistent data
structures and ultimately to a crash.
2011-01-26 20:45:23 -08:00
Igor Babaev
a624f99e98 Fixed LP bug #707555.
The bug was in the code of the patch fixing bug 698882.
With improper casting the method store_key_field::change_source_field
was called for the elements of the array TABLE_REF::key_copy that
were either of a different type or not allocated at all. This caused
crashes in some queries.
2011-01-26 11:30:29 -08:00
Igor Babaev
edeeb023bc Post-second-review fixes for the patch that added the code allowing to use
hash join over equi-join conditions without supporting indexes.
2011-01-24 14:54:50 -08:00
Igor Babaev
b251d8a4c8 Merge 2011-01-23 10:39:53 -08:00
Igor Babaev
1f970d41e8 Fixed typo that caused printing 'range' instead of 'index_merge' as the type
of sort_intersect scans.
2011-01-22 23:45:52 -08:00
Igor Babaev
ec368ab9fa Merge 2011-01-21 22:48:28 -08:00
Sergey Petrunya
ff7f5879b5 Merge 5.3-subquery-bugfixing -> 5.3 2011-01-18 00:26:04 +03:00
Sergey Petrunya
d0e247b261 Enable testcase for BUG#49129 2011-01-17 15:09:30 +03:00
Igor Babaev
c0d6079d1a Corrected test case for bug 698882 to make it platform independent 2011-01-15 23:39:51 -08:00
Igor Babaev
e32efc013a Merge 2011-01-15 12:42:32 -08:00
Igor Babaev
84a0c9b2a2 Fixed LP bug #698882.
Made sure that the optimal fields are used by TABLE_REF objects
when building index access keys to joined tables.
Fixed a bug in the template function that sorts the elements of
a list using the bubble sort algorithm. The bug caused poor
performance of the function. Also added an optimization that
skips comparison with the most heavy elements that has been 
already properly placed in the list.
Made the comparison of the fields belonging to the same Item_equal
more granular: fields belonging to the same table are also ordered
according to some rules.
2011-01-15 11:14:36 -08:00
Igor Babaev
92f2392eb5 Merge 2011-01-14 23:53:27 -08:00
Igor Babaev
0aebdc115f Ported the fix for LP bug #702310 / bug #59493.
An assertion failure was triggered for a 6-way join query that used two
join buffers.
The failure happened because every call of JOIN_CACHE::join_matching_records
saved and restored status of all tables that were accessed before the table
join_tab. It must do it only for those of them that follow the last table 
using a join buffer.
2011-01-14 22:55:56 -08:00
Sergey Petrunya
770548442f Bug#46692 Crash occurring on queries with nested FROM subqueries using materialization
- Backport testcases
- We have a different fix because we've fixed part of the problem as part of fix for LPBUG#602574.
2011-01-15 02:07:04 +03:00
Sergey Petrunya
9dc14aa76e Backport testcase: BUG#45863 "Assertion failed: (fixed == 0), function fix_fields(), file item.cc, line 4448"
(The fix was backported with subquery code backport)
2011-01-14 20:40:16 +03:00
Sergey Petrunya
2d9f69334f Backport of:
3150 Olav Sandstaa     2010-05-07
Test cases for the following "ICP for InnoDB" bugs:

Bug#40992 InnoDB: Crash when engine_condition_pushdown is on
Bug#35080 Innodb crash at mem_block_get_len line 72
Bug#41996 multi-table delete crashes server (InnoDB table)
Bug#43448 Server crashes on multi table delete with Innodb

All these bugs are duplicates of either one or both of Bug 43360 or 36981.

(backporting of olav@sun.com-20100226091930-qxvakxmcp6463t5w)
2011-01-14 17:30:27 +03:00
Sergey Petrunya
d0535d80a1 Test case backport for: Bug#42580 - Innodb's ORDER BY ..LIMIT returns no rows for null-safe operator <=> NULL 2011-01-14 16:38:41 +03:00
Sergey Petrunya
71be71da15 Testcase backport: Bug#43249 2011-01-14 14:13:11 +03:00
Sergey Petrunya
b1e0e22e6d Testcase backport: BUG#46548 IN-subqueries return 0 rows with materialization=on
(the bug itself was fixed during the subquery code backport)
2011-01-14 13:51:30 +03:00
Sergey Petrunya
7fd3c9e2ff Merge backported subquery bugfixes/testcases into MariaDB 5.3 2011-01-14 13:07:50 +03:00
Sergey Petrunya
b266e5b972 Backport testcase for: Bug#43360 - Server crash with a simple multi-table update 2011-01-14 00:47:03 +03:00
Sergey Petrunya
e43c7a2ff5 Testcase Backport: BUG#48093: 6.0 Server not processing equivalent IN clauses properly 2011-01-14 00:15:44 +03:00
Sergey Petrunya
26599d9260 Backport testcase for:
Bug #45092: join buffer contains two blob columns one of which is used in the key employed to access the joined table
2011-01-13 23:47:15 +03:00
Sergey Petrunya
d2cbb10443 Backport of (see below) + temporary measures to make SJ-Materialization work with join buffering.
Date: Mon, 01 Nov 2010 15:15:25 -0000
3272 Roy Lyseng        2010-11-01
Bug#52068: Optimizer generates invalid semijoin materialization plan

When MaterializeScan semijoin strategy was used and there were one
or more outer dependent tables before the semijoin tables, the scan
over the materialized table was not properly reset for each row of
the prefix outer tables.

Example: suppose we have a join order:

  ot1 SJ-Mat-Scan(it2 it3)  ot4

Notice that this is called a MaterializeScan, even though there is an
outer table ahead of the materialized tables. Usually a MaterializeScan
has the outer tables after the materialized table, but this is
a special (but legal) case with outer dependent tables both before and
after the materialized table.

For each qualifying row from ot1, a new scan over the materialized
table must be set up. The code failed to do that, so all scans after
the first one returned zero rows from the materialized table.
2011-01-13 19:25:31 +03:00
Sergey Petrunya
ad78c24a20 BUG#665669: Result differences on query re-execution
- Cause: handler::in_range_check_pushed_down was not reset when a 
  command would call handler->idx_cond_push() without later calling
  handler->index_end().
- Fix: reset the variable in handler->reset(), too (like we do with other
  Index Condition Pushdown members).
2011-01-12 15:00:10 +03:00
Igor Babaev
ed2405788f Fixed vargrind problems in check_join_cache_usage().
Merged the patch for bug 697557. Adjusted the results.
2011-01-06 11:40:01 -08:00
Igor Babaev
cb4fa7f401 Fixed LP bug #697557.
When stored in a key buffer any varchar field has a length prefix
that always takes 2 bytes.
2011-01-05 15:03:30 -08:00
Igor Babaev
af800fd92f The patch adds the code that allows to use equi-join conditions
for hash join in the cases when there are no suitable indexes
for these conditions.
2011-01-04 21:59:41 -08:00
Igor Babaev
77cbad4b31 Corrected the test case for bug 695304.
Added a test case for bug #695442 - a duplicate of bug 694092.
2010-12-29 18:14:03 -08:00
Igor Babaev
a2a09f06bf Merge. 2010-12-29 13:45:38 -08:00
Igor Babaev
f844a7bae7 Fixed LP bug#695304.
The bug was the result of a bad merge maria-5.2-wl21 -> 5.3.
2010-12-29 11:00:22 -08:00
Igor Babaev
0dc5ef87d4 Merge 2010-12-27 14:22:05 -08:00
Igor Babaev
18dc64eca2 Fixed LP bug #694443.
One of the hash functions employed by the BNLH join algorithm
calculates the the value of hash index for key value utilizing
every byte of the key buffer. To make this calculation valid
one has to ensure that for any key value unused bytes of the 
buffer are filled with with a certain filler. We choose 0 as
a filler for these bytes.

Added an optional boolean parameter with_zerofill to the function
key_copy. If the value of the parameter is TRUE all unused bytes
of the key buffer is filled with 0.
2010-12-26 16:31:03 -08:00
Igor Babaev
1eb21dc4be Merge 2010-12-25 18:54:14 -08:00
Sergey Petrunya
959bf3c1ee Bug #46680: Assertion failed in file item_subselect.cc, line 305 crashing on HAVING subquery
- Backport the testcase (the fix itself was included with the subquery optimizations backport)
2010-12-25 16:23:16 +03:00
Igor Babaev
1eb5e0e603 Merge 2010-12-24 16:24:20 -08:00
Igor Babaev
d9a81475c7 Fixed LP bug#694092.
In some cases the function make_cond_for_index() was mistaken
when detecting index only pushdown conditions for a table: 
a pushdown condition that was not index only could be marked
as such.
It happened because the procedure erroneously used the markers
for index only conditions that remained from the calls of
this function that extracted the index conditions for other 
tables.
Fixed by erasing index only markers as soon as they are need
anymore.
2010-12-24 14:36:35 -08:00
Igor Babaev
7d68e1ead7 Merge: mwl#24+mwl#21 5.1->5.2 2010-12-24 08:17:43 -08:00
Igor Babaev
6f2db629a0 Post-review fixes. 2010-12-22 18:45:44 -08:00
Igor Babaev
a095346a9d Fixed LP bug #670380.
Lifted the limitation that hash join could not be used over 
varchar fields with non-binary collation.
2010-12-22 00:37:35 -08:00
Sergei Golubchik
6c958d6e80 bug#683112 Maria 5.2 incorrectly reports "(using password: NO)" even when password is specified
set thd->password appropriately also for cases when a user was not found.
2010-12-20 19:19:24 +01:00
Michael Widenius
09d2e7f680 merge with 5.1
(Includes patch for overrun detected by valgrind thanks to previous my_alloca() -> my_malloc() patch)
2010-12-13 15:51:47 +02:00
Michael Widenius
ffb0cd6146 When compiling with valgrind, change my_alloca() to use my_malloc()
- This allows us to detect missing my_afree() calls and also find overruns (when running with valgrind) to alloca() areas.
- Added missing my_afree() calls
- Fixed wrong call to my_afree()


include/my_sys.h:
  When compiling with valgrind, change my_alloca() to use my_malloc()
mysql-test/suite/innodb/t/innodb_bug57255.test:
  Speed up taste case (patch from Stewart Smith)
mysql-test/suite/innodb_plugin/t/innodb_bug57255.test:
  Speed up taste case (patch from Stewart Smith)
sql/ha_partition.cc:
  Removed casts from my_afree()
sql/opt_range.cc:
  Add missing my_afree() calls.
storage/maria/ma_rt_split.c:
  Fixed wrong parameter to my_afree()
2010-12-13 15:05:57 +02:00
Sergey Petrunya
58b646001a Merge DS-MRR/CPK improvements into 5.3-main 2010-12-13 13:42:40 +03:00
Igor Babaev
7f52af655a Merge. 2010-12-10 23:23:34 -08:00