Commit graph

63265 commits

Author SHA1 Message Date
Bjorn Munch
c3f69b4191 merge 55413 2010-08-30 11:26:40 +02:00
Bjorn Munch
fd9b6b8e07 Bug #55178 Set timeout on test-to-test-basis
Allow --testcase-timeout=<mins> to be set in .opt file for test
2010-08-30 11:25:10 +02:00
Mattias Jonsson
380c9d0dae Bug#53806: Wrong estimates for range query in partitioned MyISAM table
Bug#46754: 'rows' field doesn't reflect partition pruning
  
Update of test results after fixing the above bugs.
(fix in separate commit).
2010-08-27 10:43:51 +02:00
Mattias Jonsson
50150fd66a Bug#53806: Wrong estimates for range query in partitioned MyISAM table
Bug#46754: 'rows' field doesn't reflect partition pruning

The EXPLAIN's result in 'rows' field
was evaluated to number of rows when the table was opened
(not from the table cache) and only the partitions left
after pruning was updated with its correct number
of rows.

The evaluation of the 'rows' field was using handler::records()
which is a potentially expensive call, and ignores the partitioning
pruning.

The fix was to use the handlers stats.records after updating it
with ::info(HA_STATUS_VARIABLE) instead.
2010-08-26 17:14:18 +02:00
Vasil Dimov
72ec16b1d1 Increment InnoDB Plugin version to 1.0.12.
InnoDB Plugin 1.0.11 has been released with MySQL 5.1.50.
2010-08-26 18:06:07 +03:00
Alexey Kopytov
1f7b4031e8 Automerge. 2010-08-26 14:19:04 +04:00
Alexey Kopytov
8a310d69f2 Automerge. 2010-08-26 14:15:40 +04:00
Alexey Kopytov
6c6a3e8f44 Bug #53544: Server hangs during JOIN query in stored procedure
called twice in a row

Queries with nested joins could cause an infinite loop in the
server when used from SP/PS.

When flattening nested joins, simplify_joins() tracks if the
name resolution list needs to be updated by setting
fix_name_res to TRUE if the current loop iteration has done any
transformations to the join table list. The problem was that
the flag was not reset before the next loop iteration leading
to unnecessary "fixing" of the name resolution list which in
turn could lead to a loop (i.e. circularly-linked part) in that
list. This was causing problems on subsequent execution when
used together with stored procedures or prepared statements.

Fixed by making sure fix_name_res is reset on every loop
iteration.
2010-08-26 14:13:02 +04:00
Bjorn Munch
16b7af9ae0 Cherry pick 55501 2010-08-25 16:34:31 +02:00
Bjorn Munch
a22b5651fd Bug #52301 Add --protocol to mysqltest
Added code resulted in strange linking problem for embedded on Windows
Avoided by not doing this for embedded mode
It's irrelevant for embedded server anyway, --protocol will be ignored
2010-08-25 10:23:19 +02:00
Jimmy Yang
73d767644a This is to resolve a hang situation in 5.1 builtin raised by
bug #49251 (deadlock/crash with concurrent truncate table and index
statistics calculation) by backporting a solution from #54678 fixed
for 5.1 plugin and 5.5.
2010-08-24 20:42:33 -07:00
Davi Arnaut
a73b734949 Bug#55846: Link tests fail on Windows - my_compiler.h missing
Make the my_compiler.h header, like my_attribute.h, part of
the distribution. This is required due to the dependency of
the former on the latter (which can undefine __attribute__).
2010-08-24 10:48:45 -03:00
Gleb Shchepa
7a343e0c82 automerge local --> 5.1-bugteam (bug 53034) 2010-08-31 02:32:03 +04:00
Gleb Shchepa
9554b7ac6e Bug #53034: Multiple-table DELETE statements not accepting
"Access compatibility" syntax

The "wild" "DELETE FROM table_name.* ... USING ..." syntax
for multi-table DELETE statements is documented but it was
lost in the fix for the bug 30234.

The table_ident_opt_wild parser rule has been added
to restore the lost syntax.
2010-08-31 02:16:38 +04:00
Ramil Kalimullin
03d0aedd8e Automerge. 2010-08-30 12:08:28 +04:00
Ramil Kalimullin
9c6143ef80 Fix for bug #51875: crash when loading data into geometry function polyfromwkb
Check for number of line strings in the incoming polygon data (wkb) and
for number of points in the incoming linestring wkb.
2010-08-30 11:51:46 +04:00
Alexey Kopytov
d5b40686b0 Automerge. 2010-08-30 11:19:09 +04:00
Vasil Dimov
74c32d69b0 Merge mysql-5.1-innodb -> mysql-5.1-bugteam 2010-08-28 00:58:46 +03:00
Alexey Kopytov
b409a2218e Bug #54465: assert: field_types == 0 || field_types[field_pos]
== MYSQL_TYPE_LONGLONG

A MIN/MAX() function with a subquery as its argument could lead
to a debug assertion on debug builds or wrong data on release
ones.

The problem was a combination of the following factors:

- Item_sum_hybrid::fix_fields() might use the argument
(args[0]) to calculate 'hybrid_field_type' which was later used
to decide how the data should be sent to the client.

- Item_sum::make_field() might use the argument again to
calculate the field's type when sending result set metadata to
the client.

- The argument could be changed in between these two calls via
  Item::set_arg() leading to inconsistent metadata being
  reported.

Here is what was happening for the bug's test case:

1. Item_sum_hybrid::fix_fields() calculates hybrid_field_type
as MYSQL_TYPE_LONGLONG based on args[0] which is an
Item::SUBSELECT_ITEM at that time.

2. A temporary table is created to execute the
query. create_tmp_field_from_item() creates a Field_long object
according to the subselect's max_length.

3. The subselect item in Item_sum_hybrid is replaced by the
Item_field object referencing the newly created Field_long.

4. Item_sum::make_field() rightfully returns the
MYSQL_TYPE_LONG type when calculating the result set metadata.

5. When sending the actual data, Item::send() relies on the
virtual field_type() function which in our case returns
previously calculated hybrid_field_type == MYSQL_TYPE_LONGLONG.

It looks like the only solution is to never refer to the
argument's metadata after the result metadata has been
calculated in fix_fields(), since the argument itself may be
different by then. In this sense, Item_sum::make_field() should
never be used, because it may rely on the argument's metadata
and is only called after fix_fields(). The "default"
implementation in Item::make_field() should be used instead as
it relies only on field_type(), but not on the argument's type.

Fixed by removing Item_sum::make_field() so that the superclass
implementation Item::make_field() is always used.
2010-08-27 13:44:35 +04:00
Ramil Kalimullin
1087cfc4d5 Fix for bug #54253: memory leak when using I_S plugins w/o deinit method
Free memory allocated by the server for all plugins,
with or without deinit() method.
2010-08-27 11:44:06 +04:00
Bjorn Munch
fba50f8401 Reduced #ifndef for 52301, caused compile warning 2010-08-26 15:14:50 +02:00
Alexey Kopytov
2df3a61c3f Automerge. 2010-08-26 16:36:48 +04:00
Sergey Vojtovich
0648087ca0 Fixed race condition in a test case for BUG#55580. 2010-08-26 15:23:44 +04:00
Evgeny Potemkin
151af144ff Bug #55656: mysqldump can be slower after bug 39653 fix.
After fix for bug 39653 the shortest available secondary index was used for
full table scan. Primary clustered key was used only if no secondary index
can be used. However, when chosen secondary index includes all fields of the
table being scanned it's better to use primary index since the amount of
data to scan is the same but the primary index is clustered.
Now the find_shortest_key function takes this into account.
2010-08-26 13:31:04 +04:00
Bjorn Munch
79aefacb04 merge followup fix for 52301 2010-08-25 22:49:52 +02:00
Dmitry Shulga
8520a9fd62 Fixed bug #29751 - do not rename the error log at FLUSH LOGS.
Added open log file with FILE_SHARE_DELETE flag on Windows.
2010-08-25 15:47:45 +07:00
Alexey Kopytov
756076bd23 Bug #54802: 'NOT BETWEEN' evaluation is incorrect
Queries involving predicates of the form "const NOT BETWEEN
not_indexed_column AND indexed_column" could return wrong data
due to incorrect handling by the range optimizer.

For "c NOT BETWEEN f1 AND f2" predicates, get_mm_tree()
produces a disjunction of the SEL_ARG trees for "f1 > c" and
"f2 < c". If one of the trees is empty (i.e. one of the
arguments is not sargable) the resulting tree should be empty
as well, since the whole expression in this case is not
sargable.

The above logic is implemented in get_mm_tree() as follows. The
initial state of the resulting tree is NULL (aka empty). We
then iterate through arguments and compute the corresponding
SEL_ARG tree (either "f1 > c" or "f2 < c"). If the resulting
tree is NULL, it is simply replaced by the generated
tree. Otherwise it is replaced by a disjunction of itself and
the generated tree. The obvious flaw in this implementation is
that if the first argument is not sargable and thus produces a
NULL tree, the resulting tree will simply be replaced by the
tree for the second argument. As a result, "c NOT BETWEEN f1
AND f2" will end up as just "f2 < c".

Fixed by adding a check so that when the first argument
produces an empty tree for the NOT BETWEEN case, the loop is
aborted with an empty tree as a result. The whole idea of using
a loop for 2 arguments does not make much sense, but it was
probably used to avoid code duplication for several BETWEEN
variants.
2010-08-24 19:51:32 +04:00
Alexey Kopytov
947c7f3029 Automerge. 2010-08-24 14:44:15 +04:00
Alexey Kopytov
0e74ac5028 Bug #55568: user variable assignments crash server when used
within query

The server could crash after materializing a derived table
which requires a temporary table for grouping.

When destroying the temporary table used to execute a query for
a derived table, JOIN::destroy() did not clean up Item_fields
pointing to fields in the temporary table. This led to
dereferencing a dangling pointer when printing out the items
tree later in the outer SELECT.

The solution is an addendum to the patch for bug37362: in
addition to cleaning up items in tmp_all_fields3, do the same
for items in tmp_all_fields1, since now we have an example
where this is necessary.
2010-08-24 14:35:48 +04:00
Marko Mäkelä
ce7d6a288c Bug#55832: selects crash too easily when innodb_force_recovery>3
dict_update_statistics_low(): Create bogus statistics for those
indexes that cannot be accessed because of the innodb_force_recovery
setting.

ha_innobase::info(): Calculate statistics for each index, even if
innodb_force_recovery is set. Fill in bogus data for those indexes
that are not accessed because of the innodb_force_recovery setting.
2010-08-24 11:10:03 +03:00
Marko Mäkelä
109893dac0 Bug#55832: selects crash too easily when innodb_force_recovery>3
dict_update_statistics_low(): Create bogus statistics for those
indexes that cannot be accessed because of the innodb_force_recovery
setting.

ha_innobase::info(): Calculate statistics for each index, even if
innodb_force_recovery is set. Fill in bogus data for those indexes
that are not accessed because of the innodb_force_recovery setting.
2010-08-23 13:28:54 +03:00
Mattias Jonsson
6973c354de post push test fix 2010-08-20 21:17:51 +02:00
Georgi Kodinov
8f81ceeb98 merge 2010-08-20 15:23:24 +03:00
Georgi Kodinov
2488c65a85 merge 2010-08-20 15:08:01 +03:00
Georgi Kodinov
86720c49d4 merge 2010-08-20 14:45:08 +03:00
Georgi Kodinov
bbaad8880e merge 2010-08-20 12:13:05 +03:00
Georgi Kodinov
f1517f4861 merge 2010-08-20 12:09:17 +03:00
Georgi Kodinov
f2adff5da1 merge 2010-08-20 12:05:31 +03:00
Georgi Kodinov
3b36a677ba Bug #55826: create table .. select crashes with when
KILL_BAD_DATA is returned

Two problems discovered with the LEAST()/GREATEST() 
functions:
1. The check for a null value should happen even 
after the second call to val_str() in the args. This is
important because two subsequent calls to the same
Item::val_str() may yield different results.
Fixed by checking for NULL value before dereferencing
the string result.

2. While looping over the arguments and evaluating them 
the loop should stop if there was an error evaluating so far
or the statement was killed. Fixed by checking for error
and bailing out.
2010-08-20 11:52:16 +03:00
Sunny Bains
54fd56c5c3 Fix Bug #54538 - use of exclusive innodb dictionary lock limits performance.
This patch doesn't get rid of the need to acquire the dict_sys->mutex but
reduces the need to keep the mutex locked for the duration of the query
to fsp_get_available_space_in_free_extents() from ha_innobase::info().

rb://390.
2010-08-20 17:49:43 +10:00
Sunny Bains
eff4a5d202 Fix Bug #55027: assertion: mutex_own(&dict_sys->mutex) in dict_table_get_on_id()
The callers should indicate that the dictionary is locked or not using
the trx->dict_operation_lock_mode == RW_X_LATCH mode. Checking explicitly
for system tables is unnecessary.

Approved by Marko on IRC.
2010-08-20 12:57:04 +10:00
Sunny Bains
73c92b1408 Fix bug#55699 - Assertion failure in innodb plugin with large number of threads
Fix a debug assertion that was missed in svnrev:2380 (fix for Bug# 35352).

Approved by Marko on IRC
2010-08-20 12:55:52 +10:00
karen.langford@oracle.com
05d0568bee Merge from mysql-5.1.50-release 2010-08-19 17:18:58 +02:00
MySQL Build Team
12e10ba2ba Raise the version number, 5.1.50 is (was) being built in a parellel tree. 2010-08-19 17:03:29 +02:00
Mattias Jonsson
89d7ac6007 merge 2010-08-19 09:20:17 +02:00
Marko Mäkelä
d3a7ef9913 Bug#55626: MIN and MAX reading a delete-marked record from secondary index
Remove a bogus debug assertion that triggered the bug.
Add assertions precisely where records must not be delete-marked.
And a comment to clarify when the record is allowed to be delete-marked.
2010-08-18 14:01:10 +03:00
b766a51f41 WL#5370 Keep forward-compatibility when changing
'CREATE TABLE IF NOT EXISTS ... SELECT' behaviour
BUG#55474, BUG#55499, BUG#55598, BUG#55616 and BUG#55777 are fixed
in this patch too.

This is the 5.1 part.
It implements:
- if the table exists, binlog two events: CREATE TABLE IF NOT EXISTS
  and INSERT ... SELECT

- Insert nothing and binlog nothing on master if the existing object
  is a view. It only generates a warning that table already exists.
2010-08-18 12:56:06 +08:00
Vasil Dimov
ae55711efa Merge mysql-5.1-innodb from bk-internal into my local tree 2010-08-17 22:39:34 +03:00
Vasil Dimov
fbfbe2a6eb Disable all innodb_plugin tests on Solaris until the problem is resolved.
Track this via:
Bug#56063 InnoDB Plugin mysql-tests fail on Solaris
2010-08-17 22:37:18 +03:00
Georgi Kodinov
a22056e846 Bug #53296: LONG BLOB value types are not recognized
Fixed the length of system variables to be 2^24 - 1 
as it is documented for MEDIUMBLOB instead of 
2^24.
2010-08-16 16:43:21 +03:00