Commit graph

63017 commits

Author SHA1 Message Date
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
Bjorn Munch
16b7af9ae0 Cherry pick 55501 2010-08-25 16:34:31 +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
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
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
Mattias Jonsson
6973c354de post push test fix 2010-08-20 21:17:51 +02: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
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
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
Georgi Kodinov
12f7d57d42 Bug #55580 : segfault in read_view_sees_trx_id
The server was not checking for errors generated during
the execution of Item::val_xxx() methods when copying
data to the group, order, or distinct temp table's row.
Fixed by extending the copy_funcs() to return an error
code and by checking for that error code on the places
copy_funcs() is called. 
Test case added.
2010-08-13 11:07:39 +03:00
Georgi Kodinov
b6e3adf10f Bug #55565: debug assertion when ordering by expressions with user
variable assignments

The assert() that is firing is checking if expressions that can't be
null return a NULL when evaluated.
MAKEDATE() function can return NULL if the second argument is 
less then or equal to 0. Thus its nullability depends not only on 
the nullability of its arguments but also on their values.
Fixed by (overoptimistically) setting MAKEDATE() to be nullable 
despite the nullability of its arguments.
Test added.
Had to update one test result to reflect the metadata change.
2010-08-13 16:05:46 +03:00
Martin Hansson
a89224ba85 Bug#54444: Do not run main.range test for products without partitioning
feature

The test for bug no 50939 was put in range.test which isn't such a good idea
since it requires partitioning. Fixed by moving the test case to
partitioning_range.test.
2010-08-11 14:13:59 +02:00
Georgi Kodinov
11b1c9b76c merge 2010-08-10 16:39:57 +03:00
Georgi Kodinov
5781bfa271 Bug #55809: Server README not current
Updated the README file.
2010-08-10 16:32:45 +03:00
Jon Olav Hauglid
cc3be1aee0 Bug #54106 assert in Protocol::end_statement,
INSERT IGNORE ... SELECT ... UNION SELECT ...

This assert was triggered by INSERT IGNORE ... SELECT. The assert checks that a
statement either sends OK or an error to the client. If the bug was triggered
on release builds, it caused OK to be sent to the client instead of the correct
error message (in this case ER_FIELD_SPECIFIED_TWICE).

The reason the assert was triggered, was that lex->no_error was set to TRUE
during JOIN::optimize() because of IGNORE. This causes all errors to be ignored.
However, not all errors can be ignored. Some, such as ER_FIELD_SPECIFIED_TWICE
will cause the INSERT to fail no matter what. But since lex->no_error was set,
the critical errors were ignored, the INSERT failed and neither OK nor the
error message was sent to the client.

This patch fixes the problem by temporarily turning off lex->no_error in
places where errors cannot be ignored during processing of INSERT ... SELECT.

Test case added to insert.test.
2010-08-09 13:39:59 +02:00
Georgi Kodinov
87acb536f1 Bug #54909: Confusing description about read_buffer_size and
read_rnd_buffer_size

Applied the updated description from Paul's patch.
2010-08-06 15:56:23 +03:00
Bjorn Munch
ae2c3d62e9 Bug #55503 MTR fails to filter LEAK SUMMARY from valgrind report of restarted servers
Undo workaround as fix is being merged in
2010-08-06 11:35:17 +02:00
Bjorn Munch
8e242e8140 merge from 5.1-mtr 2010-08-06 11:13:52 +02:00
Georgi Kodinov
82e2ca0181 Addendum to bug #42144 : fixed a wrong type conversation causing plugin tests
failures on sparc64.
2010-08-05 15:10:24 +03:00
Martin Hansson
f77996950a Bug#54568: create view cause Assertion failed: 0,
file .\item_subselect.cc, line 836

IN quantified predicates are never executed directly. They are rather wrapped
inside nodes called IN Optimizers (Item_in_optimizer) which take care of the
execution. However, this is not done during query preparation. Unfortunately
the LIKE predicate pre-evaluates constant right-hand side arguments even
during name resolution. Likely this is meant as an optimization.

Fixed by not pre-evaluating LIKE arguments in view prepare mode.
2010-08-05 12:42:14 +02:00
Georgi Kodinov
84686593ad Bug #42144: plugin_load fails
Reverted the ulong->uint diff
Re-applied the first diff.
The original commit message follows:

enum plugin system variables are ulong internally, not int.
On systems where long is not the same as an int it causes
problems. 
Fixed by correct typecasting. Removed the test from the 
experimental list.
2010-08-04 15:58:09 +03:00
Bjorn Munch
992f49c0c4 merge from 5.1 2010-08-04 12:19:51 +02:00
Bjorn Munch
0792d2b069 Bug #55582 mtr root detection (and if-expression execution) broken
Follow-up patch: added test cases for -0 and while
2010-08-04 10:52:45 +02:00
Georgi Kodinov
534e69338a Bug #42144: plugin_load fails
The enum system variables were handled inconsistently 
as ints, unsigned int and unsigned long on various places.
This caused problems on platforms on which 
sizeof(int) != sizeof(long).
Fixed by homogenizing the type of the enum variables
to unsigned int, since it's size compatible with the C enum
type. 
Removed the test from the experimental list.
2010-08-03 19:01:30 +03:00
Bjorn Munch
1ba9d79b7b Bug #55582 mtr root detection (and if-expression execution) broken
if() treated any non-numeric string as false
Fixed to treat those as true instead
Added some test cases
Fixed missing $ in variable name in include/mix2.inc
2010-08-03 16:11:23 +02:00
Alfranio Correia
c0a2bac26d auto-merge mysql-5.1-security (local) --> mysql-5.1-security 2010-08-03 12:52:02 +01:00
029bc22b67 Bug #34283 mysqlbinlog leaves tmpfile after termination if binlog contains load data infile
Post fix
2010-08-03 18:27:45 +08:00
aa1572f46d Bug #34283 mysqlbinlog leaves tmpfile after termination if binlog contains load data infile
With statement- or mixed-mode logging, "LOAD DATA INFILE" queries
are written to the binlog using special types of log events.
When mysqlbinlog reads such events, it re-creates the file in a
temporary directory with a generated filename and outputs a
"LOAD DATA INFILE" query where the filename is replaced by the
generated file. The temporary file is not deleted by mysqlbinlog
after termination.

To fix the problem, in mixed mode we go to row-based. In SBR, we
document it to remind user the tmpfile is left in a temporary
directory.
2010-08-03 10:22:19 +08:00
Alfranio Correia
1feee134fd BUG#55625 RBR breaks on failing 'CREATE TABLE'
A CREATE...SELECT that fails is written to the binary log if a non-transactional
statement is updated. If the logging format is ROW, the CREATE statement and the
changes are written to the binary log as distinct events and by consequence the
created table is not rolled back in the slave.

In this patch, we opted to let the slave goes out of sync by not writting to the
binary log the CREATE statement. We do this by simply reseting the binary log's
cache.
2010-08-02 20:48:56 +01:00
Bjorn Munch
01e6820115 Bug #55597 MTR: Restart the server, from within the test case, with new CLI options.
The expect file can now include "restart:<server options>"
Also drop check-testcase if this has been done
Added comment explaining the restart: syntax
2010-08-02 12:43:28 +02:00
Georgi Kodinov
b7e8fd0863 merge 2010-08-02 11:03:41 +03:00
Georgi Kodinov
9a561cca25 merge mysql-5.1-bugteam into mysql-5.1-security 2010-08-02 10:50:15 +03:00
Georgi Kodinov
4ee89071af tree name update 2010-08-02 10:48:24 +03:00
Georgi Kodinov
8edf06e2cc merge 2010-08-02 10:45:43 +03:00
Gleb Shchepa
38165ce4a3 Bug #54461: crash with longblob and union or update with subquery
Queries may crash, if
  1) the GREATEST or the LEAST function has a mixed list of
     numeric and LONGBLOB arguments and
  2) the result of such a function goes through an intermediate
     temporary table.

An Item that references a LONGBLOB field has max_length of
UINT_MAX32 == (2^32 - 1).

The current implementation of GREATEST/LEAST returns REAL
result for a mixed list of numeric and string arguments (that
contradicts with the current documentation, this contradiction
was discussed and it was decided to update the documentation).

The max_length of such a function call was calculated as a
maximum of argument max_length values (i.e. UINT_MAX32).

That max_length value of UINT_MAX32 was used as a length for
the intermediate temporary table Field_double to hold
GREATEST/LEAST function result.

The Field_double::val_str() method call on that field
allocates a String value.

Since an allocation of String reserves an additional byte
for a zero-termination, the size of String buffer was
set to (UINT_MAX32 + 1), that caused an integer overflow:
actually, an empty buffer of size 0 was allocated.

An initialization of the "first" byte of that zero-size
buffer with '\0' caused a crash.

The Item_func_min_max::fix_length_and_dec() has been
modified to calculate max_length for the REAL result like
we do it for arithmetical operators.


******
Bug #54461: crash with longblob and union or update with subquery

Queries may crash, if
  1) the GREATEST or the LEAST function has a mixed list of
     numeric and LONGBLOB arguments and
  2) the result of such a function goes through an intermediate
     temporary table.

An Item that references a LONGBLOB field has max_length of
UINT_MAX32 == (2^32 - 1).

The current implementation of GREATEST/LEAST returns REAL
result for a mixed list of numeric and string arguments (that
contradicts with the current documentation, this contradiction
was discussed and it was decided to update the documentation).

The max_length of such a function call was calculated as a
maximum of argument max_length values (i.e. UINT_MAX32).

That max_length value of UINT_MAX32 was used as a length for
the intermediate temporary table Field_double to hold
GREATEST/LEAST function result.

The Field_double::val_str() method call on that field
allocates a String value.

Since an allocation of String reserves an additional byte
for a zero-termination, the size of String buffer was
set to (UINT_MAX32 + 1), that caused an integer overflow:
actually, an empty buffer of size 0 was allocated.

An initialization of the "first" byte of that zero-size
buffer with '\0' caused a crash.

The Item_func_min_max::fix_length_and_dec() has been
modified to calculate max_length for the REAL result like
we do it for arithmetical operators.
2010-08-01 22:12:36 +04:00
Davi Arnaut
e260cc3ff2 Bug#45288: pb2 returns a lot of compilation warnings on linux
Fix compiler warnings.
2010-07-30 17:33:10 -03:00
Luis Soares
70928da9a6 Automerge mysql-5.1-bugteam into mysql-5.1-bugteam latest. 2010-07-30 15:32:28 +01:00
Georgi Kodinov
a9356a894c Disable the tests failing under valgrind because of bug #55503 2010-07-30 17:09:24 +03:00
Luis Soares
c8adc1d5e1 Revert patch for BUG#34283. Causing lots of test failures in PB2,
mostly because existing test result files were not updated.
2010-07-30 14:44:39 +01:00
Georgi Kodinov
d765e30a1d Bug #55188: GROUP BY, GROUP_CONCAT and TEXT - inconsistent results
In order to be able to check if the set of the grouping fields in a 
GROUP BY has changed (and thus to start a new group) the optimizer
caches the current values of these fields in a set of Cached_item 
derived objects.
The Cached_item_str, used for caching varchar and TEXT columns,
is limited in length by the max_sort_length variable.
A String buffer to store the value with an alloced length of either
the max length of the string or the value of max_sort_length 
(whichever is smaller) in Cached_item_str's constructor.
Then, at compare time the value of the string to compare to was 
truncated to the alloced length of the string buffer inside 
Cached_item_str.
This is all fine and valid, but only if you're not assigning 
values near or equal to the alloced length of this buffer.
Because when assigning values like this the alloced length is 
rounded up and as a result the next set of data will not match the
group buffer, thus leading to wrong results because of the changed
alloced_length.
Fixed by preserving the original maximum length in the 
Cached_item_str's constructor and using this instead of the 
alloced_length to limit the string to compare to.
Test case added.
2010-07-30 16:35:06 +03:00
Davi Arnaut
93e81ccdc7 Merge of mysql-5.0-bugteam into mysql-5.1-bugteam. 2010-07-30 09:38:18 -03:00
Davi Arnaut
6d60052e32 Bug#54041: MySQL 5.0.92 fails when tests from Connector/C suite run
Fix a regression (due to a typo) which caused spurious incorrect
argument errors for long data stream parameters if all forms of
logging were disabled (binary, general and slow logs).
2010-07-30 09:34:40 -03:00