Commit graph

27652 commits

Author SHA1 Message Date
Joerg Bruehe
f6bddff896 Automerge (most) changes of the 5.5.6-rc release build to main 5.5.
This is not the final merge!
2010-09-10 20:48:13 +02:00
Alfranio Correia
b5bc68c524 merge mysql-5.1-security --> mysql-5.5-security
Disabled the test case.
2010-09-10 11:56:02 +01:00
Alfranio Correia
821ac1e933 BUG#55675 rpl.rpl_log_pos fails sporadically with error binlog truncated in the middle
Disabled the test case.
2010-09-10 11:49:57 +01:00
Mattias Jonsson
a30b3b43d6 merge 2010-09-10 11:52:35 +02:00
Mattias Jonsson
4770f8d415 merge 2010-09-10 11:50:38 +02:00
Bjorn Munch
d898106014 merge 55178,55413,56383 2010-09-10 09:59:40 +02:00
Bjorn Munch
4b1d6118e8 merge 55178,55413,56383 2010-09-10 09:58:26 +02:00
Jon Olav Hauglid
e01a1bfdb8 Merge from mysql-5.5-bugfixing to mysql-5.5-runtime. 2010-09-10 09:26:00 +02:00
Marc Alff
2779f0aad1 Bug#56324 Race Condition while shutting down MySQL: "PSI_server"
Before this fix, the server could crash during shutdown,
due to race conditions, that occured when killing the server.

In particular, the performance schema instrumentation handle,
PSI_server, and the performance schema itself would be cleaned up
too soon, causing race conditions with a running kill server thread.

The specifics of the race condition found are that:
the main thread executing "PSI_server= NULL" can cause crashes in
other threads still running, which are executing
"if (PSI_server != NULL) PSI_server->xxx()"
as part of the performance schema instrumentation.

While the bug was reported for the kill server thread,
in theory the same crash could happen with the signal thread,
as found by code analysis.

The correct fix would be to only shutdown the performance schema
and set PSI_server to NULL after every other thread is guaranteed
to be completed, including the kill_server_thread.

However, due to the existing mysqld server design, this is not the case.
See in particular bug number 56666.

The work around used to fix this race condition is to simply not
perform the call to shutdown_performance_schema() when the server exits,
and to keep the PSI_server pointer unchanged.

This will cause memory leaks to be reported by tools like valgrind,
but no memory leak actually happen because the process is about to exit().

As a result, the file mysql-test/valgrind.supp has been updated
to filter out these false positive messages.

This code has been tested with running in a loop the following
tests in parallel, which have been known to fail with race conditions
in the past:
- rpl_change_master
- binlog_max_extension
- events_restart
- rpl_heartbeat_basic
and no crash of test failure has been seen with the changed code.
2010-09-09 15:33:35 -06:00
Marc Alff
712a8a2eb9 local merge 2010-09-09 09:26:55 -06:00
Alexey Kopytov
637c7529de Manual merge of the fix for bug #54190 and the addendum patch
to 5.5 (removed one test case as it is no longer valid).
2010-09-09 19:00:33 +04:00
Dmitry Lenev
3326614df1 Fix for bug #55273 "FLUSH TABLE tm WITH READ LOCK for Merge
table causes assert failure".

Attempting to use FLUSH TABLE table_list WITH READ LOCK
statement for a MERGE table led to an assertion failure if
one of its children was not present in the list of tables
to be flushed. The problem was not visible in non-debug builds.

The assertion failure was caused by the fact that in such
situations FLUSH TABLES table_list WITH READ LOCK implementation
tried to use (e.g. lock) such child tables without acquiring
metadata lock on them. This happened because when opening tables
we assumed metadata locks on all tables were already acquired
earlier during statement execution and a such assumption was
false for MERGE children.

This patch fixes the problem by ensuring at open_tables() time
that we try to acquire metadata locks on all tables to be opened. 
For normal tables such requests are satisfied instantly since
locks are already acquired for them. For MERGE children metadata
locks are acquired in normal fashion.

Note that FLUSH TABLES merge_table WITH READ LOCK will lock for
read both the MERGE table and its children but will flush only 
the MERGE table. To flush children one has to mention them in table
list explicitly. This is expected behavior and it is consistent with
usage patterns for this statement (e.g. in mysqlhotcopy script).
2010-09-09 18:29:14 +04:00
Alexey Kopytov
df198b5f6a Automerge. 2010-09-09 16:48:06 +04:00
Alexey Kopytov
9066714c81 Bug #54190: Comparison to row subquery produces incorrect
result

Row subqueries producing no rows were not handled as UNKNOWN
values in row comparison expressions.

That was a result of the following two problems:

1. Item_singlerow_subselect did not mark the resulting row
value as NULL/UNKNOWN when no rows were produced.

2. Arg_comparator::compare_row() did not take into account that
a whole argument may be NULL rather than just individual scalar
values.

Before bug#34384 was fixed, the above problems were hidden
because an uninitialized (i.e. without any stored value) cached
object would appear as NULL for scalar values in a row subquery
returning an empty result. After the fix
Arg_comparator::compare_row() would try to evaluate
uninitialized cached objects.

Fixed by removing the aforementioned problems.
2010-09-09 16:46:13 +04:00
Ramil Kalimullin
5eb7154faa Automerge. 2010-09-09 16:43:45 +04:00
Evgeny Potemkin
89b53f9908 Auto-merged. 2010-09-09 16:02:02 +04:00
Ramil Kalimullin
9080f681b4 Fix for bug#56679: gis.test: valgrind error
Item_func_spatial_collection::fix_length_and_dec()
changed to use argument's print() method to print
the ER_ILLEGAL_VALUE_FOR_TYPE error.
2010-09-09 13:40:17 +04:00
Marc Alff
92c6d9fc75 Bug#56528 Increased server footprint with MTR
With recent changes in the performance schema default sizing parameters,
the memory used by a mysqld binary increased accordingly.

This negatively affects the MTR test suite,
because running several tests in parallel now consumes more ressources.

The fix is to leave the default production values unchanged,
and to configure the MTR environment to limit memory
used when running tests in the test suite, which is ok
because only a few objects are typically used within a test script.

This fix:
- changed the default configuration in MTR to use less memory
- adjusted the performance schema tests accordingly

Note that 1,000 mutex instances was too short and caused test failures
in the past in team trees, so the default used is now 10,000 in MTR.

The amount of memory used by the performance schema itself
can be observed with the statement SHOW ENGINE PERFORMANCE_SCHEMA STATUS
2010-09-08 12:01:12 -06:00
Jon Olav Hauglid
51a3375c98 Bug #56292 Deadlock with ALTER TABLE and MERGE tables
ALTER TABLE on a MERGE table could cause a deadlock with two
other connections if we reached a situation where:

1) A connection doing ALTER TABLE can't upgrade to MDL_EXCLUSIVE on the
parent table, but holds TL_READ_NO_INSERT on the child tables.
2) A connection doing DELETE on a child table can't get TL_WRITE on it
since ALTER TABLE holds TL_READ_NO_INSERT.
3) A connection doing SELECT on the parent table can't get TL_READ on 
the child tables since TL_WRITE is ahead in the lock queue, but holds
MDL_SHARED_READ on the parent table preventing ALTER TABLE from upgrading.

For regular tables, this deadlock is avoided by having ALTER TABLE
take a MDL_SHARED_NO_WRITE metadata lock on the table. This prevents
DELETE from acquiring MDL_SHARED_WRITE on the table before ALTER TABLE
tries to upgrade to MDL_EXCLUSIVE. In the example above, SELECT would
therefore not be blocked by the pending DELETE as DELETE would not be
able to enter TL_WRITE in the table lock queue.

This patch fixes the problem for merge tables by using the same metadata
lock type for child tables as for the parent table. The child tables will
in this case therefore be locked with MDL_SHARED_NO_WRITE, preventing
DELETE from acquiring a metadata lock and enter into the table lock queue.

Change in behavior: By taking the same metadata lock for child tables
as for the parent table, LOCK TABLE on the parent table will now also
implicitly lock the child tables. Since LOCK TABLE on the parent table
now takes more than one metadata lock, it is possible for LOCK TABLE
... WRITE on the parent table or child tables to give ER_LOCK_DEADLOCK
error.

Test case added to mdl_sync.test.
Merge.test/.result has been updated to reflect the change to LOCK TABLE.
2010-09-08 10:25:37 +02:00
Kristofer Pettersson
ccc7ae0e17 merge 5.1-security => 5.5-security 2010-09-08 09:36:39 +02:00
Sergey Vojtovich
f7da62d2ad main.gis-rtree, main.type_float and main.type_newdecimal
were marked as experimental due to BUG38965.
2010-09-08 00:16:10 +04:00
Kristofer Pettersson
dc285eb7cd Post fix following fix for bug55531: Disabling testcase for
bug 55568 because {1} isn't a valid geometry for a geometry
collection.
2010-09-07 15:43:00 +02:00
Kristofer Pettersson
3a643b0a34 Manual resolve of mysql-test/r/gis.result 2010-09-07 13:34:18 +02:00
Martin Hansson
06b70326ce Merge of fix for Bug#51070. 2010-09-07 12:17:12 +02:00
Kristofer Pettersson
5caea4a995 Bug#55531 crash with conversions of geometry types / strings
Convertion from a floating point number to a string caused a
crash.

During rare circumstances a String object could crash when
it was requested to allocate new memory.
A crash could occcur in Field_double::val_str() because of
a pointer referencing memory inside a String object which was
of unknown size.
And finally, the geometric collection should not accept
arguments which are non geometric.
2010-09-07 11:37:46 +02:00
Martin Hansson
babebf9ceb Bug#51070: Query with a NOT IN subquery predicate returns a wrong result set
The EXISTS transformation has additional switches to catch the known corner
cases that appear when transforming an IN predicate into EXISTS. Guarded
conditions are used which are deactivated when a NULL value is seen in the
outer expression's row. When the inner query block supplies NULL values,
however, they are filtered out because no distinction is made between the
guarded conditions; guarded NOT x IS NULL conditions in the HAVING clause that
filter out NULL values cannot be de-activated in isolation from those that
match values or from the outer expression or NULL's.

The above problem is handled by making the guarded conditions remember whether
they have rejected a NULL value or not, and index access methods are taking
this into account as well. 

The bug consisted of 

1) Not resetting the property for every nested loop iteration on the inner
   query's result.

2) Not propagating the NULL result properly from inner query to IN optimizer.

3) A hack that may or may not have been needed at some point. According to a
   comment it was aimed to fix #2 by returning NULL when FALSE was actually
   the result. This caused failures when #2 was properly fixed. The hack is
   now removed.

The fix resolves all three points.
2010-09-07 11:21:09 +02:00
Dmitry Shulga
417092560c Auto-merge from mysql-5.1-bugteam. 2010-09-07 16:00:41 +07:00
Dmitry Shulga
70807d1473 Fixed bug #55421 - Protocol::end_statement(): Assertion `0' on
multi-table UPDATE IGNORE.
The problem was that if there was an active SELECT statement
during trigger execution, an error risen during the execution
may cause a crash. The fix is to temporary reset LEX::current_select
before trigger execution and restore it afterwards. This way
errors risen during the trigger execution are processed as
if there was no active SELECT.
2010-09-07 15:53:46 +07:00
Martin Hansson
3825f36429 Merge of fix for Bug#54543. Test case only (bug is not present in this tree). 2010-09-07 10:00:52 +02:00
Martin Hansson
3d5b9792e6 Bug#54543: update ignore with incorrect subquery leads to assertion failure:
inited==INDEX

When an error occurs while sending the data in a temporary table there was no
cleanup performed. This caused a failed assertion in the case when different
access methods were used for populating the table vs. retrieving the data from
the table if IGNORE was specified and sql_safe_updates = 0. In this case
execution continues, but the handler expects to continue with the access
method used for row retrieval.

Fixed by doing the cleanup even if errors occur.
2010-09-07 09:58:05 +02:00
Evgeny Potemkin
e408bf4e14 Bug#56271: Wrong comparison result with STR_TO_DATE function
The Item_func_str_to_date class wasn't providing correct integer DATETIME
representation as expected. This led to wrong comparison result and didn't
allowed the STR_TO_DATE function to be used with indexes.
Also, STR_TO_DATE function was inconsisted on throwing warnings/errors.
Fixed now.

val_int and result_as_longlong methods were added to the Item_func_str_to_date
class.
2010-09-07 10:45:00 +04:00
Jimmy Yang
1566c3657e Port fix for bug #53756 from 5.1 built-in to 5.1 plugin. 2010-09-06 22:41:37 -07:00
Georgi Kodinov
1f84bb0c0f merge 2010-09-06 17:04:32 +02:00
Mats Kindahl
788d3c4518 Bug #55966: "plugin" tests fail in 5.5
On Solaris with version 3.4.6, the ha_example.so shared library is built
with DTrace and the server is built without DTrace support. This occurs
because dtrace.cmake disables DTrace support for 3.4.6, but still set
HAVE_DTRACE, which causes probes_mysql.h to include probes_mysql_dtrace.h
instead of probes_mysql_nodtrace.h.

This patch fixes this by not setting HAVE_DTRACE on Solaris for GCC 3.4.6.
2010-09-06 14:45:12 +02:00
Ramil Kalimullin
df798550cc Automerge. 2010-09-06 13:54:44 +04:00
Jon Olav Hauglid
dd4cd40a87 Merge from mysql-5.5-bugfixing to mysql-5.5-runtime. 2010-09-03 09:42:51 +02:00
Vladislav Vaintroub
08e1a5b770 Small fixes in CMake:
create data dir correctly in initial_database target on Windows
 handle case where INSTALL_MYSQLTESTDIR is empty (e.g someone does not want
 to install tests)
2010-09-03 00:17:08 +02:00
Georgi Kodinov
684c3e9e3d merge from 5.5-merge 2010-09-02 16:57:59 +03:00
Alfranio Correia
1ce9eb084f BUG#55961 Savepoint Identifier should be enclosed with backticks
Added backticks to the savepoint identifier.
2010-09-02 14:05:06 +01:00
Jimmy Yang
edbae904ff Merge from mysql-5.1-bugteam to mysql-5.1-security 2010-09-01 17:43:02 -07:00
Magne Mahre
24fc7ca4c8 Bug#39932 "create table fails if column for FK is in different
case than in corr index".
      
Server was unable to find existing or explicitly created supporting
index for foreign key if corresponding statement clause used field
names in case different than one used in key specification and created
yet another supporting index.
In cases when name of constraint (and thus name of generated index)
was the same as name of existing/explicitly created index this led
to duplicate key name error.
      
The problem was that unlike all other code Key_part_spec::operator==()
compared field names in case sensitive fashion. As result routines
responsible for getting rid of redundant generated supporting indexes
for foreign key were not working properly for versions of field names
using different cases.

(backported from mysql-trunk)
2010-09-01 19:38:34 +02:00
Bjorn Munch
4698ed2be8 upmerge 56383 2010-09-01 15:52:31 +02:00
Bjorn Munch
2154211192 merge from 5.5 2010-09-01 15:49:43 +02:00
Alexander Nozdrin
7405361bc3 Auto-merge from mysql-5.5. 2010-09-01 17:12:42 +04:00
Jon Olav Hauglid
370eaa56aa Merge from mysql-5.5-bugfixing to mysql-5.5-runtime. 2010-09-01 14:45:13 +02:00
Alexander Nozdrin
157f080614 Cherry-picking patch for Bug#55980.
Original changeset:
------------------------------------------------------------
revno: 3197
revision-id: alik@sun.com-20100831135426-h5a4s2w6ih1d8q2x
parent: magnus.blaudd@sun.com-20100830120632-u3xzy002mdwueli8
committer: Alexander Nozdrin <alik@sun.com>
branch nick: mysql-5.5-bugfixing
timestamp: Tue 2010-08-31 17:54:26 +0400
message:
  Bug#55980 Character sets: supplementary character _bin ordering is wrong
  
  Problem:
  - ORDER BY for utf8mb4_bin, utf16_bin and utf32_bin returned
    results in a wrong order, because old functions
    (supporting only BMP range) were used to handle these collations.
  - Additionally, utf16_bin did not sort supplementary characters
    between U+D700 and U+E000, as WL#1213 specification specified.
------------------------------------------------------------
2010-08-31 18:22:03 +04:00
Alexander Nozdrin
b75958e665 Disable mysqlhotcopy* test cases due to Bug 54129. 2010-08-31 18:05:35 +04:00
Alexander Nozdrin
8da22a75f3 Bug#55980 Character sets: supplementary character _bin ordering is wrong
Problem:
- ORDER BY for utf8mb4_bin, utf16_bin and utf32_bin returned
  results in a wrong order, because old functions
  (supporting only BMP range) were used to handle these collations.
- Additionally, utf16_bin did not sort supplementary characters
  between U+D700 and U+E000, as WL#1213 specification specified.
2010-08-31 17:54:26 +04:00
Alexander Nozdrin
55c1da5a7e Cherry-picking patch for Bug#56137 from mysql-5.5-runtime.
------------------------------------------------------------
revno: 3124
revision-id: dlenev@mysql.com-20100831090419-rzr5ktekby2gspm1
parent: alik@sun.com-20100827083901-x4wvtc10u9p7gcs9
committer: Dmitry Lenev <dlenev@mysql.com>
branch nick: mysql-5.5-rt-56137
timestamp: Tue 2010-08-31 13:04:19 +0400
message:
  Bug #56137 "Assertion `thd->lock == 0' failed on upgrading 
  from 5.1.50 to 5.5.6".
  
  Debug builds of the server aborted due to an assertion
  failure when DROP DATABASE statement was run on an
  installation which had outdated or corrupt mysql.proc table.
  Particularly this affected the mysql_upgrade tool which is
  run as part of 5.1 to 5.5 upgrade.
  
  The problem was that sp_drop_db_routines(), which was invoked
  during dropping of the database, could have returned without
  closing and unlocking mysql.proc table in cases when this
  table was not up-to-date with the current server. As a result
  further attempt to open and lock the mysql.event table, which
  was necessary to complete dropping of the database, ended up
  with an assert.
  
  This patch solves this problem by ensuring that
  sp_drop_db_routines() always closes mysql.proc table and
  releases metadata locks on it. This is achieved by changing
  open_proc_table_for_update() function to close tables and
  release metadata locks acquired by it in case of failure.
  This step also makes behavior of the latter function
  consistent with behavior of open_proc_table_for_read()/
  open_and_lock_tables().
  
  
  Test case for this bug was added to sp-destruct.test.
------------------------------------------------------------
2010-08-31 17:49:41 +04:00
Alexander Nozdrin
00eb62847d Cherry-pick patch for Bug#56120 from mysql-5.5-bugfixing. 2010-08-31 17:47:10 +04:00
Bjorn Munch
e59b1980e6 Bug #56383 provide option to restart mysqld after each mtr test
Added --force-restart
2010-08-31 11:27:57 +02:00
Dmitry Lenev
26bc3b34d5 Bug #56137 "Assertion `thd->lock == 0' failed on upgrading
from 5.1.50 to 5.5.6".

Debug builds of the server aborted due to an assertion
failure when DROP DATABASE statement was run on an
installation which had outdated or corrupt mysql.proc table.
Particularly this affected the mysql_upgrade tool which is
run as part of 5.1 to 5.5 upgrade.

The problem was that sp_drop_db_routines(), which was invoked
during dropping of the database, could have returned without
closing and unlocking mysql.proc table in cases when this
table was not up-to-date with the current server. As a result
further attempt to open and lock the mysql.event table, which
was necessary to complete dropping of the database, ended up
with an assert.

This patch solves this problem by ensuring that
sp_drop_db_routines() always closes mysql.proc table and
releases metadata locks on it. This is achieved by changing
open_proc_table_for_update() function to close tables and
release metadata locks acquired by it in case of failure.
This step also makes behavior of the latter function
consistent with behavior of open_proc_table_for_read()/
open_and_lock_tables().


Test case for this bug was added to sp-destruct.test.
2010-08-31 13:04:19 +04:00
Alexander Nozdrin
e4a7db6c67 Auto-merge from mysql-5.5-merge. 2010-08-31 11:55:41 +04:00
Gleb Shchepa
4c47c78c41 automerge 5.1-bugteam --> 5.5-merge (bug 53034) 2010-08-31 02:22:01 +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
Mattias Jonsson
e7dc80b807 Bug#50036: Inconsistent errors when using TIMESTAMP columns/expressions
It was hard to understand what the error really meant.

The error checking in partitioning is done in several different
parts during the execution of a query which can make it
hard to return useful errors.

Added a new error for bad VALUES part in the per PARTITION clause.
Using the more verbose error that a column is not allowed in
the partitioning function instead of just that the function is
not allowed.
2010-08-30 17:33:55 +02:00
Alexander Nozdrin
dc195adf34 Auto-merge from mysql-5.5-merge. 2010-08-30 18:07:40 +04:00
Bjorn Munch
8ee29b7e6a upmerge 55178,55413 2010-08-30 15:19:46 +02:00
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
Dmitry Shulga
05482f3c7b Follow-up for Bug#29751: FLUSH LOGS doesn't create -old file,
so test case has to be updated.
2010-08-30 16:09:28 +07:00
Alexander Nozdrin
862af4eeaa Auto-merge from mysql-5.5. 2010-08-30 12:36:02 +04:00
Alexander Nozdrin
a87059b940 Disable 'plugin*' tests due to Bug 55966. 2010-08-30 12:32:53 +04:00
Alexander Nozdrin
2c89cb23af Auto-merge from mysql-5.5-bugfixing. 2010-08-30 12:27:27 +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
0a95aff58a Automerge. 2010-08-30 11:36:04 +04:00
Alexey Kopytov
d5b40686b0 Automerge. 2010-08-30 11:19:09 +04:00
0688c086a0 Bug #54579 Wrong unsafe warning for INSERT DELAYED in SBR
The lock_type is upgrade to TL_WRITE from TL_WRITE_DELAYED for
INSERT DELAYED when inserting multi values in one statement.
It's safe. But it causes an unsafe warning in SBR.
      
Make INSERT DELAYED safe by logging it as INSERT without DELAYED.
2010-08-30 14:03:28 +08:00
Alexander Nozdrin
19908377b8 Update result files. 2010-08-28 20:36:17 +04:00
Vasil Dimov
74c32d69b0 Merge mysql-5.1-innodb -> mysql-5.1-bugteam 2010-08-28 00:58:46 +03:00
Marc Alff
7357081989 local merge 2010-08-27 15:23:37 -06:00
Sergey Vojtovich
ab2414577a Merge 5.1-bugteam to 5.5-merge. 2010-08-27 15:33:32 +04: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
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
Marc Alff
fe3221d6a9 local merge 2010-08-26 15:21:23 -06:00
Alexander Nozdrin
c88cfec29c Enable plugin tests (Bug 55966) to check if they still fail. 2010-08-26 19:29:44 +04: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
Marc Alff
81cdce4d22 local merge 2010-08-26 08:41:24 -06:00
Alexey Kopytov
2df3a61c3f Automerge. 2010-08-26 16:36:48 +04:00
Alexander Barkov
3509fecfc1 Bug#42511 mysqld: ctype-ucs2.c:2044: my_strnncollsp_utf32: Assertion (tlen % 4) == 0' fai
Problem: trailing spaces were stripped using 8-bit code,
so the truncation result length was incorrect, which led
to an assertion failure.
Fix: using multi-byte safe code.
2010-08-26 16:36:33 +04:00
Alexey Kopytov
d39dbd1084 Automerge. 2010-08-26 16:35:38 +04:00
Sergey Vojtovich
0648087ca0 Fixed race condition in a test case for BUG#55580. 2010-08-26 15:23:44 +04:00
Alexey Kopytov
d63b9feb10 Automerge. 2010-08-26 14:17:27 +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
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
Marc Alff
4c2de881de Bug#55873 short startup options do not work in 5.5
Before this fix, the server did not recognize 'short' (as in -a)
options but only 'long' (as in --ansi) options
in the startup command line, due to earlier changes in 5.5
introduced for the performance schema.

The root cause is that handle_options() did not honor the
my_getopt_skip_unknown flag when parsing 'short' options.

The fix changes handle_options(), so that my_getopt_skip_unknown is
honored in all cases.

Note that there are limitations to this,
see the added doxygen documentation in handle_options().

The current usage of handle_options() by the server to
parse early performance schema options fits within the limitations.
This has been enforced by an assert for PARSE_EARLY options, for safety.
2010-08-25 18:59:28 -06:00
Marc Alff
b4dd6de474 Bug#52312 lost Handler_read_last status variable
Before this fix, the ha_read_last_count status variable was defined and
updated internally, for never exposed as a system variable.

This fix exposes the system variable as "Handler_read_last",
for completness of the Handler_read_* system variables interface.

Adjusted tests results accordingly.
2010-08-25 13:00:38 -06:00
Alexey Kopytov
df389d0135 Bug#55077: Assertion failed: width > 0 && to != ((void *)0),
file .\dtoa.c

The assertion failure was correct because the 'width' argument
of my_gcvt() has the signed integer type, whereas the unsigned
value UINT_MAX32 was being passed by the caller
(Field_double::val_str()) leading to a negative width in
my_gcvt().

The following chain of problems was found by further analysis:

1. The display width for a floating point number is calculated
in Field_double::val_str() as either field_length or the
maximum possible length of string representation of a floating
point number, whichever is greater. Since in the bug's test
case field_length is UINT_MAX32, we get the same value as the
display width. This does not make any sense because for numeric
values field_length only matters for ZEROFILL columns,
otherwise it does not make sense to allocate that much memory
just to print a number. Field_float::val_str() has a similar
problem.

2. Even if the above wasn't the case, we would still get a
crash on a slightly different test case when trying to allocate
UINT_MAX32 bytes with String::alloc() because the latter does
not handle such large input values correctly due to alignment
overflows.

3. Even when String::alloc() is fixed to return an error when
an alignment overflow occurs, there is still a problem because
almost no callers check its return value, and
Field_double::val_str() is not an exception (same for
Field_float::val_str()).

4. Even if all of the above wasn't the case, creating a
Field_double object with UINT_MAX32 as its field_length does
not make much sense either, since the .frm code limits it to
MAX_FIELD_CHARLENGTH (255) bytes. Such a beast can only be
created by create_tmp_field_from_item() from an Item with
REAL_RESULT as its result_type() and UINT_MAX32 as its
max_length.

5. For the bug's test case, the above condition (REAL_RESULT
Item with max_length = UINT_MAX32) was a result of
Item_func_if::fix_length_and_dec() "shortcutting" aggregation
of argument types when one of the arguments was a constant
NULL. In this case, the attributes of the aggregated type were
simply copied from the other, non-NULL argument, but max_length
was still calculated as per the general, non-shortcut case, by
choosing the greatest of argument's max_length, which is
obviously not correct.

The patch addresses all of the above problems, even though
fixing the assertion failure for the particular test case would
require only a subset of the above problems to be solved.
2010-08-25 19:57:53 +04:00
Bjorn Munch
16b7af9ae0 Cherry pick 55501 2010-08-25 16:34:31 +02:00
Alexey Botchkov
f0d2765cc3 mysqlhotcopy tests fixed.
The 'mysqlhotcopy' tool gets into bin/ directory after the installation
from the scripts/.
So check for it in that in the mysql-test-run.pl.

per-file comments:
  mysql-test/mysql-test-run.pl
Check the bin/ for mysqlhotcopy presence.
2010-08-25 18:55:22 +05:00
Alfranio Correia
4f37e847d6 Post-fix push for BUG#53452.
Updated the result files for ndb test cases.
2010-08-25 15:13:20 +01:00
Alexander Nozdrin
593c6db299 Auto-merge from mysql-5.5-merge. 2010-08-25 14:22:34 +04:00
Alexander Nozdrin
640528ea5d Revert patch for Bug#56120 temporarily. 2010-08-25 13:17:45 +04:00
Alexey Botchkov
9492861342 mysql.test fixed.
Parts that aren't supposed to work on Windows moved to the separate
mysql_not_windows.test.
2010-08-25 13:17:15 +05:00
Marc Alff
d2df3a8ac5 Bug#55576 Two perfschema tests failed on mysql-next-mr-innodb PB2 tests
Before this fix, some tests failed due to lack of instrumentation slots
in the performance schema, because the default sizing was too low.

Now that more code has been instrumented, the default sizing has to be adjusted
to match the current instrumentation consumption.

This change:
- increases the number of rwlock classes from 20 to 30,
- increases the number of rwlock and mutex instances to 1 million.
Both are to account for the volume of data instrumented
when the innodb storage engine is used (because of the innodb buffer pool).

Adjusted the test output accordingly.
2010-08-24 18:21:43 -06:00
Evgeny Potemkin
b7f0ce88d0 Auto-merged. 2010-08-24 22:20:45 +04:00
Dmitry Lenev
6c50022ac8 Fixed --ps-protocol failures of test for bug#54332 "Deadlock
with two connections doing LOCK TABLE+INSERT DELAYED".

Disabled --ps-protocol for this part of the test as INSERT
DELAYED simply doesn't work with it under LOCK TABLES.
2010-08-24 20:20:00 +04: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
Gleb Shchepa
7a343e0c82 automerge local --> 5.1-bugteam (bug 53034) 2010-08-31 02:32:03 +04:00
Alfranio Correia
12668c148b merge mysql-5.5-bugfixing (local) --> mysql-5.5-bugfixing 2010-08-24 13:37:11 +01: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
Alfranio Correia
037958bfbc Post-fix push for BUG#53452. 2010-08-23 23:31:12 +01:00
Evgeny Potemkin
137ede4ac3 Bug#56120: Failed assertion on MIX/MAX on negative time value
The Item_cache_datetime::val_str function wasn't taking into account that time
could be negative. This led to failed assertion.
Now Item_cache_datetime::val_str correctly converts negative time values
from integer to string representation.
2010-08-23 19:59:56 +04:00
Jon Olav Hauglid
d2210981e3 Bug #54332 Deadlock with two connections doing LOCK TABLE+INSERT DELAYED
The problem was that deadlocks involving INSERT DELAYED were not detected.

The reason for this is that two threads are involved in INSERT DELAYED:
the connection thread and the handler thread. The connection thread would
wait while the handler thread acquired locks and opened the table.
In essence, this adds an edge to the wait-for-graph between the 
connection thread and the handler thread that the deadlock detector is
unaware of. Therefore many deadlocks involving INSERT DELAYED were not 
detected.

This patch fixes the problem by having the connection thread acquire the
metadata lock the table before starting the handler thread. This allows the
deadlock detector to detect any possible deadlocks resulting from trying to
acquire a metadata lock the table. If a metadata lock is successfully acquired,
the handler thread is started and given a copy of the ticket representing the
metadata lock. When the handler thread then tries to lock and open the table,
it will find that it already has the metadata lock and therefore not acquire
any new metadata locks.

Test cases added to delayed.test.
2010-08-23 17:42:53 +02:00
Mats Kindahl
6c64f826eb Merging with mysql-5.5 2010-08-23 15:32:39 +02:00
Alexander Barkov
622250cba7 Bug#52121 partition by key on utf32 enum field cause debug assertion: (length % 4) == 0
Problem: ENUM columns are sorted and distributed according to their
numeric value, but Field::hash() incorrectly passed string character set
(utf32) in combination with numeric value to the hash function,
which made assertion fail.

Fix: pass "binary" character set in combination with numeric value
to the hash function.

  mysql-test/suite/parts/r/part_ctype_utf32.result
  Adding tests

  mysql-test/suite/parts/t/part_ctype_utf32.test
  Adding test

  sql/field.cc
  Pass correct character set pointer to the hash function.
2010-08-23 13:56:21 +04:00
Alexey Botchkov
46fe17c523 mysqlhotcopy tests fixed.
The include/mysqlhotcopy.inc had an error in the 'if' condition, so it failed
if the mysqlhotcopy tool was found.

per-file comments:
  mysql-test/include/mysqlhotcopy.inc
        test should proceed exactly if the mysqlhotcopy was set.
  mysql-test/mysql-test-run.pl
        don't set the MYSQL_HOTCOPY variable if no mysqlhotcopy was found.
2010-08-23 13:48:27 +05:00
Alexander Barkov
5d873f5815 After fix for Bug#55912 FORMAT with locale set fails for numbers < 1000
Recording fixed correct results results.
2010-08-24 10:15:43 +04:00
Mattias Jonsson
0827d824f3 merge 2010-08-20 21:32:44 +02:00
Mattias Jonsson
6973c354de post push test fix 2010-08-20 21:17:51 +02:00
Mattias Jonsson
0c2b883dd2 Bug#54747: Deadlock between REORGANIZE PARTITION and SELECT is not detected
The ALTER PARTITION and SELECT seemed to be deadlocked
when having innodb_thread_concurrency = 1.

Problem was that there was unreleased latches
in the ALTER PARTITION thread which was needed
by the SELECT thread to be able to continue.

Solution was to release the latches by commit 
before requesting upgrade to exclusive MDL lock.

Updated according to reviewers comments (3).
2010-08-20 19:15:48 +02:00
Georgi Kodinov
bd62942ec1 merge 2010-08-20 16:10:49 +03:00
Georgi Kodinov
2488c65a85 merge 2010-08-20 15:08:01 +03:00
Georgi Kodinov
a54c3dd5c0 merge 2010-08-20 14:22:46 +03:00
Georgi Kodinov
352f2ada7b merge 2010-08-20 13:23:47 +03:00
Georgi Kodinov
f1517f4861 merge 2010-08-20 12:09:17 +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
Alexey Botchkov
e1d285d1e0 Bug#54129 Missing the execute bit for scripts
files for cmake had some minor bugs causing this.
      
per-file comments:
  mysql-test/CMakeLists.txt
Bug#54129      Missing the execute bit for scripts
    use same permissions as in the source folder

  mysql-test/t/disabled.def
Bug#54129      Missing the execute bit for scripts
      mysqlhotcopy tests enabled

  scripts/CMakeLists.txt
Bug#54129      Missing the execute bit for scripts
    chmod +x for the script files
2010-08-19 17:11:31 +05:00
Alexey Botchkov
e4da0b0af6 merging. 2010-08-19 17:08:17 +05:00
Alexander Barkov
bf78f4767d Bug#55912 FORMAT with locale set fails for numbers < 1000
Problems:
- dot character was always printed as decimal point
  instead of localized decimal point for short
  numbers without thousands
- Item_func_format::val_str always returned values in ASCII
format,
  regargless of @@character_set_connection, which in case of utf32
  led to crash in debug build, or to incorrect values in release build.

Fix:
- Adding a piece of code to replace dot character to
  localized decimal point in short numbers.
- Changing parent class for Item_func_format to
  Item_str_ascii_func, because its val_str() implementation is heavily ASCII oriented.
2010-08-20 15:14:11 +04:00
Jon Olav Hauglid
39ac44d660 Merge from mysql-5.5-runtime to mysql-5.5-bugfixing. 2010-08-20 10:24:32 +02:00
Dmitry Lenev
27cb76cd30 Fixed failure of parts.partition_debug_sync_innodb.test which
was caused by change of thread state name from "Waiting for
table" to "Waiting for table metadata lock" (which has 
happened as part of fix for bug 52044 "FLUSH TABLES WITH READ
LOCK and FLUSH TABLES <list> WITH READ LOCK are incompati").
2010-08-20 11:54:37 +04:00
Jon Olav Hauglid
9bd8a62d62 Bug #55973 Assertion `thd->transaction.stmt.is_empty()'
on CREATE TABLE .. SELECT I_S.PART

This assert was triggered if an InnoDB table was created using
CREATE TABLE ... AS SELECT where the query used an I_S table, and
a view existed in the database. It would also be triggered for
any statement changing an InnoDB table (e.g. INSERT, UPDATE, DELETE)
which had a subquery referencing an I_S table.

The assert was triggered if open_normal_and_derived_tables() failed
and a statement transaction had been started. This will usually not
happen as tables are opened before a statement transaction is started.
However, e.g. CREATE TABLE ... AS SELECT starts a transaction in order
to insert tuples into the new table. And if the subquery references
an I_S table, all current tables and views can be opened in order to
fill the I_S table on the fly. If a view is discovered, open will fail
as it is instructed to open tables only (OPEN_TABLE_ONLY). This would
cause the assert to be triggered.

The assert was added in the patch for Bug#52044 and was therefore
not in any released versions of the server.

This patch fixes the problem by adjusting the assert to take into
consideration the possibility of tables being opened as part of
an I_S query. This is similar to what is already done for 
close_tables_for_reopen().

Test case added to information_schema_inno.test.
2010-08-20 09:16:26 +02:00
Alfranio Correia
c6d4915f3c BUG#53452 Inconsistent behavior of binlog_direct_non_transactional_updates with
temp table
            
This patch introduces two key changes in the replication's behavior.
            
Firstly, it reverts part of BUG#51894 which puts any update to temporary tables
into the trx-cache. Now, updates to temporary tables are handled according to
the type of their engines as a regular table.
            
Secondly, an unsafe mixed statement, (i.e. a statement that access transactional
table as well non-transactional or temporary table, and writes to any of them),
are written into the trx-cache in order to minimize errors in the execution when
the statement logging format is in use.
            
Such changes has a direct impact on which statements are classified as unsafe
statements and thus part of BUG#53259 is reverted.
2010-08-20 03:59:58 +01:00
Alexander Barkov
6e9298bddc Bug#54916 GROUP_CONCAT + IFNULL truncates output
Problem: a few functions did not calculate their max_length correctly.
This is an after-fix for WL#2649 Number-to-string conversions".

Fix: changing the buggy functions to calculate max_length
using fix_char_length() introduced in WL#2649,
instead of setting max_length directly

  mysql-test/include/ctype_numconv.inc
     Adding new tests

  mysql-test/r/ctype_binary.result
     Adding new tests

  mysql-test/r/ctype_cp1251.result
     Adding new tests

  mysql-test/r/ctype_latin1.result
     Adding new tests

  mysql-test/r/ctype_ucs.result
     Adding new tests

  mysql-test/r/ctype_utf8.result
     Adding new tests

  mysql-test/t/ctype_utf8.test
    Including ctype_numconv

  sql/item.h
    - Introducing new method fix_char_length_ulonglong(),
    for the cases when length is potentially greater
    than UINT_MAX32. This method removes a few
    instances of duplicate code, e.g. in item_strfunc.cc.
    - Setting collation in Item_copy properly. This change
    fixes wrong metadata on client side in some cases, when
    "binary" instead of the real character set was reported.

  sql/item_cmpfunc.cc
    - Using fix_char_length() and max_char_length() methods,
    instead of direct access to max_length, to calculate
    item length properly.
    - Moving count_only_length() in COALESCE after
    agg_arg_charsets_for_string_result(). The old
    order was incorrect and led to wrong length
    calucation in case of multi-byte character sets.
    
  sql/item_func.cc
    Fixing that count_only_length() didn't work
    properly for multi-byte character sets.
    Using fix_char_length() and max_char_length()
    instead of direct access to max_length.

  sql/item_strfunc.cc
    - Using fix_char_length(), fix_char_length_ulonglong(),
    max_char_length() instead of direct access to max_length.
    - Removing wierd condition: "if (collation.collation->mbmaxlen > 0)",
    which is never FALSE.
2010-08-19 15:55:35 +04:00
Alexey Botchkov
15ee13fbf7 Bug#54466 client 5.5 built from source lacks "pager" support
#ifdef THREAD removed from mysql.cc.
               No reason was found for this limitation to persist.

per-file comments:
  client/mysql.cc
Bug#54466      client 5.5 built from source lacks "pager" support
        now we have USE_POPEN always if not __WIN__
  mysql-test/r/mysql.result
Bug#54466      client 5.5 built from source lacks "pager" support
        result updated.
  mysql-test/t/mysql.test
Bug#54466      client 5.5 built from source lacks "pager" support
        test case added.
2010-08-19 16:35:47 +05:00
Mattias Jonsson
3166b9153a merge 2010-08-19 10:22:23 +02:00
Bernt M. Johnsen
67d895d499 Bug#53563 Fix and enable charset/collation tests in funcs_2 2010-08-19 09:31:24 +02:00
Mattias Jonsson
89d7ac6007 merge 2010-08-19 09:20:17 +02:00
Alexander Barkov
89e6eb0b1e Backporting Bug#32391 Character sets: crash with --character-set-server
from mysql-trunk-bugfixing (5.6.1-m5) from mysql-5.5-bugfixing (5.5.6-m3).
2010-08-19 10:00:43 +04:00
Alexander Barkov
cdce606121 Bug#45263 utf32_general_ci, bad effects around CREATE TABLE AS SELECT
Problem: Item_func_hex::val_str() returned data in ASCII format,
which did not match collation.collation pointing to my_charset_utf32_general_ci.
Fix: changing parent class of Item_func_hex to Item_str_ascii_func,
as val_str() implementation is heavily ASCII-oriented.

  mysql-test/r/ctype_utf32.result
  mysql-test/t/ctype_utf32.test
  Adding test case


  sql/item_strfunc.cc
  sql/item_strfunc.h
  - Changing parent class to Item_str_ascii_func
  - Clean-up in Item_func_hex::fix_length_and_dec()
    Using fix_char_length() instead of setting max_length directly.
2010-08-18 16:08:59 +04:00
Jon Olav Hauglid
8f36eaa11e Merge from mysql-5.5-bugfixing to mysql-5.5-runtime 2010-08-18 13:55:37 +02:00
Jon Olav Hauglid
5139bf6c8f Manual merge from mysql-5.5-bugfixing to mysql-5.5-runtime. 2010-08-18 13:29:04 +02:00
Mats Kindahl
f0af63ad50 WL#5363: Thread pool interface
Updating result files containing output of --help --verbose.
2010-08-18 12:53:43 +02:00
d3b7cd3ff2 WL#5370 Keep forward-compatibility when changing
'CREATE TABLE IF NOT EXISTS ... SELECT' behaviour
BUG#47132, BUG#47442, BUG49494, BUG#23992 and BUG#48814 will disappear
automatically after the this patch.
BUG#55617 is fixed by this patch too.
            
This is the 5.5 part.
It implements:
- 'CREATE TABLE IF NOT EXISTS ... SELECT' statement will not insert
  anything and binlog anything if the table already exists.
  It only generate a warning that table already exists.
- A couple of test cases for the behavior changing.
2010-08-18 17:35:41 +08:00
Alexander Nozdrin
8977575cff Auto-merge from mysql-5.5. 2010-08-18 11:48:38 +04:00
Vasil Dimov
02492ae36f Merge mysql-5.5-bugfixing -> mysql-5.5-innodb 2010-08-18 10:14:06 +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
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
607f1adabd merge 2010-08-17 15:12:52 +03:00
Vasil Dimov
793dee2d5c Make main.endspace more deterministic
Followup to vasil.dimov@oracle.com-20100817063430-inglmzgdtj95t29d
which didn't fully fix the test because the order of the returned
rows was different in embedded and non-embedded version. So the only
way to fix this is to add an ORDER BY clause.
2010-08-17 14:54:29 +03:00
Magne Mahre
7d2d2e0f9b Bug #54850 rpl_ndb.rpl_ndb_stm_innodb and
rpl_ndb.rpl_ndb_2other fails

The two regressions tests failed after WL#5349 was
pushed, since they were writted with the implicit
requirement that MyISAM is the default storage engine.

Adding --default-storage-engine=MyISAM as startup
parameter, to mimic the pre-wl#5349 situation.
2010-08-17 10:56:50 +02:00
Vasil Dimov
15fd2b4ffa Adjust endspace.result
This is a followup to vasil.dimov@oracle.com-20100816142329-yimenbuktd416z1a
which improved the sampling algorithm. The endspace test is non-deterministic
because it does not include ORDER BY clause in its queries.
2010-08-17 09:34:30 +03:00
Vasil Dimov
260ff5be5e Adjust type_bit_innodb.result
This is a followup to vasil.dimov@oracle.com-20100816142329-yimenbuktd416z1a
which improved the sampling algorithm.
2010-08-17 09:26:41 +03:00
Vasil Dimov
0c7b390448 Adjust rowid_order_innodb.result
This is a followup to vasil.dimov@oracle.com-20100816142329-yimenbuktd416z1a
which improved the sampling algorithm.
2010-08-17 09:25:08 +03:00
Vasil Dimov
4a3ba7343d Adjust innodb_gis.result
This is a followup to vasil.dimov@oracle.com-20100816142329-yimenbuktd416z1a
which improved the sampling algorithm.
2010-08-17 09:24:33 +03:00
Vasil Dimov
f8b5843005 Adjust innodb_mysql.result
This is a followup to vasil.dimov@oracle.com-20100816142329-yimenbuktd416z1a
which improved the sampling algorithm. I have manually checked that the new
values are actually the correct ones, for example:
-rows	16
+rows	32
the number of rows returned by the query is 32.
2010-08-17 09:17:04 +03:00
Georgi Kodinov
5c81e2cf16 merged mysql-5.5 into WL1054-5.5 2010-08-16 18:16:07 +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
Magne Mahre
19c9957367 Bug#55001 Change in behavior: thread_concurrency (docs,
example files)

The system variable 'thread_concurrency' has been
(re-)enabled on all platforms, to prevent startup
errors.

'thread_concurrency' is unused and has no effect,
on any platform, in MySQL 5.1 and later versions.  It 
will be deprecated, and removed, in context of 
worklog WL#5265
2010-08-16 15:05:01 +02:00
Mattias Jonsson
7641dd7b4b merge 2010-08-16 14:58:38 +02:00
Mattias Jonsson
25ae81f133 Bug#49907: ALTER TABLE ... TRUNCATE PARTITION does not wait for
locks on the table

Fixing the partitioning specifics after TRUNCATE TABLE in
bug-42643 was fixed.

Reorganize of code to decrease the size of the giant switch
in mysql_execute_command, and to prepare for future parser
reengineering. Moved code into Sql_statement objects.

Updated patch according to davi's review comments.
2010-08-16 14:53:30 +02:00
Georgi Kodinov
5f211511e8 merge 2010-08-16 10:11:57 +03:00
Alexander Nozdrin
9c41a9909a Auto-merge from mysql-5.5. 2010-08-16 10:46:21 +04:00
Alexander Nozdrin
62b441b4f5 Auto-merge from mysql-5.5. 2010-08-16 10:38:26 +04:00
Sunny Bains
787f0c54cb Fix Bug #55277 - Failing assertion: auto_inc > 0
Handle overflow when reading value from SELECT MAX(C) FROM T;

Call ha_innobase::info() after initializing the autoinc value
in ha_innobase::open().

Fix for both the builtin and plugin.

rb://402

Merge from mysql-5.1-security.
2010-08-16 11:59:43 +10:00
Sunny Bains
62aa8943b8 Add test to the plugin branch from fix for bug# 55277. 2010-08-16 10:12:22 +10:00
Gleb Shchepa
ce5b12db7a automerge 5.1-security --> 5.5-security (bug 55424) 2010-08-15 11:56:14 +04:00
Evgeny Potemkin
48738f737a Bug#49746: Const expression caching led to NDB not using engine condition
pushdown.
      
NDB supports only a limited set of item nodes for use in engine condition
pushdown. Because of this adding cache for const expression effectively
disabled this optimization.
      
The ndb_serialize_cond function is extended to support Item_cache and treat
it as a constant values.
A helper function called ndb_serialize_const is added. It is used to create
Ndb_cond value node from given const item.
2010-08-14 13:11:33 +04:00
Inaam Rana
231a97fde0 Change default for innodb_strict_mode to FALSE.
Note that this was originally pushed by Calvin but the was later
reverted by mistake.

bug#54702
2010-08-13 15:07:22 -04:00
Konstantin Osipov
2086e1664f Bug#52117 "Pending FLUSH TALBES <list> aborts transactions unnecessarily"
The bug was fixed by the patch for Bug 52044.
Add a test case.
2010-08-13 18:14:36 +04: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
Georgi Kodinov
2ecc81cb30 merge 2010-08-13 14:20:49 +03:00
Georgi Kodinov
a557509653 Bug #55615 and bug #55564
An user assignment variable expression that's 
evaluated in a logical expression context 
(Item::val_bool()) can be pre-calculated in a 
temporary table for GROUP BY.
However when the expression value is used after the
temp table creation it was re-evaluated instead of
being read from the temp table due to a missing 
val_bool_result() method.
Fixed by implementing the method.
2010-08-13 14:18:46 +03:00
Alexander Nozdrin
496e1fb46c Disable test cases due to Bug 55966. 2010-08-13 14:07:27 +04:00
Jon Olav Hauglid
f8372252dd Merge from mysql-5.5-bugfixing to mysql-5.5-runtime. 2010-08-13 10:43:26 +02:00
Mattias Jonsson
87f655d52d merge 2010-08-13 10:14:37 +02: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
Jon Olav Hauglid
3bc4d54073 Bug #54105 assert in MDL_context::release_locks_stored_before
The problem was that SHOW CREATE EVENT released all metadata locks
held by the current transaction. This made any exisiting savepoints
invalid, triggering the assert when ROLLBACK TO SAVEPOINT later
was executed.

This patch fixes the problem by making sure SHOW CREATE EVENT only
releases metadata locks acquired by the statement itself.

Test case added to event_trans.test.
2010-08-13 10:02:37 +02:00
Mattias Jonsson
9a7a64acdb Bug#53676: Unexpected errors and possible table
corruption on ADD PARTITION and LOCK TABLE
Bug#53770: Server crash at handler.cc:2076 on
           LOAD DATA after timed out COALESCE PARTITION

5.5 fix for:
Bug#51042: REORGANIZE PARTITION can leave table in an
           inconsistent state in case of crash
Needs to be back-ported to 5.1

5.5 fix for:
Bug#50418: DROP PARTITION does not interact with
           transactions

Main problem was non-persistent operations done
before meta-data lock was taken (53770+53676).
And 53676 needed to keep the table/partitions opened and locked
while copying the data to the new partitions.

Also added thorough tests to spot some additional bugs
in the ddl_log code, which could result in bad state
between the .frm and partitions.

Collapsed patch, includes all fixes required from the reviewers.
2010-08-13 09:50:25 +02:00
Konstantin Osipov
add2913a40 A follow up patch for WL#5000: add a test case
and a comment for the case when a connection
issuing FLUSH TABLES <list> WITH READ LOCK
has an open handler.
2010-08-12 19:29:41 +04:00
Alexander Nozdrin
13ec2a1625 Patch for Bug#55854 (MySQL AB should not be AUTHOR, copyright incorrect).
Fixing copyright text.
2010-08-12 19:19:57 +04:00
Marc Alff
7dd4600850 Bug#55416 Renaming of performance_schema tables for 5.5
Removed table SETUP_OBJECTS.
      
Renamed table PROCESSLIST to THREADS.
      
Renamed table EVENTS_WAITS_SUMMARY_BY_EVENT_NAME
to EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME.
      
Adjusted Makefiles, code and tests accordingly.
2010-08-12 08:08:52 -06:00
Alexander Nozdrin
93594dff84 Auto-merge from mysql-5.5-bugfixing. 2010-08-12 17:55:27 +04:00
Konstantin Osipov
8673d2b20f Commit on behalf of Dmitry Lenev.
Merge his patch for Bug#52044 into 5.5, and apply 
review comments.
2010-08-12 17:50:23 +04:00
Guilhem Bichot
124fc93dba fix for Bug #55672 "mysql_upgrade dies with internal error":
it couldn't parse the --ssl option.
2010-08-11 19:56:56 +02:00
Martin Hansson
76aee43060 Merge of fix for Bug#54444. 2010-08-11 17:55:07 +02: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
Alfranio Correia
bd3aa7eb78 BUG#50312 Warnings for unsafe sub-statement not returned to client
After BUG#36649, warnings for sub-statements are cleared when a 
new sub-statement is started. This is problematic since it suppresses
warnings for unsafe statements in some cases. It is important that we
always give a warning to the client, because the user needs to know
when there is a risk that the slave goes out of sync.
                        
We fixed the problem by generating warning messages for unsafe statements
while returning from a stored procedure, function, trigger or while
executing a top level statement.
                        
We also started checking unsafeness when both performance and log tables are
used. This is necessary after the performance schema which does a distinction
between performance and log tables.
2010-08-10 12:32:54 +01:00
Jon Olav Hauglid
756f992fe5 Followup for Bug #54360 Deadlock DROP/ALTER/CREATE DATABASE
with open HANDLER

This patch changes the code for table renames to not drop metadata
locks. Since table renames are done as a part of ALTER DATABASE ...
UPGRADE, dropping metadata locks in the middle of execution can
result in wrong binlog order since it means that no locks are held
when the binlog is written to.

The RENAME TABLE statement is unafffected since it auto commits and
therefore already drops metadata locks at the end of execution.

This patch also reverts the regression test for Bug#48940 back to
its original version. The test was temporarily changed due to the
issue mentioned above.
2010-08-10 13:16:44 +02:00
Bjorn Munch
3ca814b760 Bug #55413 mysqltest gives parse error for lines matching "^let.*\\.*;$"
Allow escaped quotes also in statements not starting with --
But will not support single unescaped ' or `
2010-08-10 12:13:58 +02:00
Mattias Jonsson
5bde03c8e1 Bug#55458: Partitioned MyISAM table gets crashed by multi-table update
Problem was that the handler call ::extra(HA_EXTRA_CACHE) was cached
but the ::extra(HA_EXTRA_PREPARE_FOR_UPDATE) was not.

Solution was to also cache the other call and forward it when moving
to a new partition to scan.
2010-08-10 10:43:12 +02:00
Konstantin Osipov
f8bfa3287d A fix for Bug#41158 "DROP TABLE holds LOCK_open during unlink()".
Remove acquisition of LOCK_open around file system operations,
since such operations are now protected by metadata locks.
Rework table discovery algorithm to not require LOCK_open.

No new tests added since all MDL locking operations are covered
in lock.test and mdl_sync.test, and as long as these tests
pass despite the increased concurrency, consistency must be
unaffected.
2010-08-09 22:33:47 +04:00
Alexander Nozdrin
c70328c4d5 Disable rpl_ndb.rpl_ndb_row_implicit_commit_binlog due to Bug 55849. 2010-08-09 20:55:26 +04:00
Alexander Nozdrin
e7f79394bd Follow-up for Bug 23032: update NDB result files. 2010-08-09 20:52:26 +04:00
Konstantin Osipov
9862f8c756 Merge 5.5-bugfixing -> 5.5-runtime. 2010-08-09 18:33:17 +04:00
Jon Olav Hauglid
6d3078e231 manual merge from mysql-5.1-bugteam 2010-08-09 14:11:29 +02: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
881a76699e WL#1054: Pluggable authentication support
Merged the implementation to a new base tree.
2010-08-09 11:32:50 +03:00
Gleb Shchepa
ed736379f5 Bug #55424: convert_tz crashes when fed invalid data
The CONVERT_TZ function crashes the server when the
timezone argument is an empty SET field value.

1) The CONVERT_TZ may find a timezone string in the
   tz_names hash.
2) A string representation of the empty SET is a
   String of zero length with the NULL pointer.
3) If the key argument length is zero, hash functions
   do comparison using the length of the record being
   compared against.

I.e. a zero-length String buffer is an invalid
argument for hash search functions, and if String
points to NULL buffer, hashcmp() fails with SEGV
accessing that memory.

The my_tz_find function has been modified to
treat empty Strings as invalid timezone values
to skip unnecessary hash search.
2010-08-06 23:29:37 +04:00
Bjorn Munch
6777cc0db6 merge from 5.1-bugteam of merge from 5.1-mtr 2010-08-06 13:37:05 +02:00
Dmitry Lenev
a6c00c276e Part of fix for bug#52044 "FLUSH TABLES WITH READ LOCK and
FLUSH TABLES <list> WITH READ LOCK are incompatible" to
be pushed as separate patch.

Replaced thread state name "Waiting for table", which was
used by threads waiting for a metadata lock or table flush, 
with a set of names which better reflect types of resources
being waited for.

Also replaced "Table lock" thread state name, which was used 
by threads waiting on thr_lock.c table level lock, with more
elaborate "Waiting for table level lock", to make it 
more consistent with other thread state names.

Updated test cases and their results according to these 
changes.

Fixed sys_vars.query_cache_wlock_invalidate_func test to not
to wait for timeout of wait_condition.inc script.
2010-08-06 15:29:37 +04: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
Bjorn Munch
f886745dfa merge from trunk-mtr 2010-08-05 14:53:09 +02:00
Bjorn Munch
489e6c136b upmerge 55582 2010-08-05 14:41:07 +02:00
Georgi Kodinov
99f7f9a907 merge 2010-08-05 15:34:19 +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
Evgeny Potemkin
1eb9375a18 Auto-merged. 2010-08-05 14:33:10 +04:00
Sunny Bains
6c0f9301ea Fix Bug #55277 - Failing assertion: auto_inc > 0
Handle overflow when reading value from SELECT MAX(C) FROM T;

Call ha_innobase::info() after initializing the autoinc value
in ha_innobase::open().

Fix for both the builtin and plugin.

rb://402
2010-08-05 19:24:34 +10: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
Alexander Nozdrin
c13ce64e0c Auto-merge from mysql-5.5-merge. 2010-08-04 12:43:44 +04:00
Alexander Nozdrin
7d0c4cb5c6 Auto-merge from mysql-5.5. 2010-08-04 12:18:32 +04:00
Georgi Kodinov
711b6618c4 merge 2010-08-03 19:21:13 +03: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
Georgi Kodinov
a394519ef9 addendum to the fix for bug #54476: fixed a failing test case. 2010-08-03 14:52:20 +03:00
Alfranio Correia
c0a2bac26d auto-merge mysql-5.1-security (local) --> mysql-5.1-security 2010-08-03 12:52:02 +01:00
1292851b0d Bug #34283 mysqlbinlog leaves tmpfile after termination if binlog contains load data infile
Post fix
2010-08-03 18:36:09 +08: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
136c5212b1 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 11:49:14 +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
Evgeny Potemkin
424b68d7ca Bug#55648: Server crash on MIX/MAX on maximum time value
A typo in the Item_cache_datetime::val_str caused an assertion to fail on the
maximum time value.
2010-08-02 16:36:41 +04:00
Bjorn Munch
3cd9a145e3 upmerge 55503,55597 2010-08-02 12:52:18 +02: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
05e88a5bbf merge 2010-08-02 11:17:47 +03:00
Georgi Kodinov
06469e2323 merge mysql-trunk-merge to mysql-trunk-security 2010-08-02 10:52:29 +03:00
Georgi Kodinov
9a561cca25 merge mysql-5.1-bugteam into mysql-5.1-security 2010-08-02 10:50:15 +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
Alexander Nozdrin
86e68740dd Fix federated.federated_server.test. 2010-07-31 17:10:27 +04:00
Alexander Nozdrin
361022c60c A follow-up patch for Bug 23032: fix federated_server.result. 2010-07-31 11:45:05 +04:00
Alexander Nozdrin
b2f8005094 Auto-merge from mysql-trunk-bugfixing.
******
This patch fixes the following bugs:
  - Bug#5889: Exit handler for a warning doesn't hide the warning in
    trigger
  - Bug#9857: Stored procedures: handler for sqlwarning ignored
  - Bug#23032: Handlers declared in a SP do not handle warnings generated
    in sub-SP
  - Bug#36185: Incorrect precedence for warning and exception handlers

The problem was in the way warnings/errors during stored routine execution
were handled. Prior to this patch the logic was as follows:

  - when a warning/an error happens: if we're executing a stored routine,
    and there is a handler for that warning/error, remember the handler,
    ignore the warning/error and continue execution.

  - after a stored routine instruction is executed: check for a remembered
    handler and activate one (if any).

This logic caused several problems:

  - if one instruction generates several warnings (errors) it's impossible
    to choose the right handler -- a handler for the first generated
    condition was chosen and remembered for activation.

  - mess with handling conditions in scopes different from the current one.

  - not putting generated warnings/errors into Warning Info (Diagnostic
    Area) is against The Standard.

The patch changes the logic as follows:

  - Diagnostic Area is cleared on the beginning of each statement that
    either is able to generate warnings, or is able to work with tables.

  - at the end of a stored routine instruction, Diagnostic Area is left
    intact.

  - Diagnostic Area is checked after each stored routine instruction. If
    an instruction generates several condition, it's now possible to take a
    look at all of them and determine an appropriate handler.
2010-07-30 19:28:36 +04:00
Luis Soares
abbcf12e0e Automerge mysql-trunk-merge into latest mysql-trunk-merge. 2010-07-30 15:32:57 +01: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
Georgi Kodinov
c896749581 merge 2010-07-30 16:56:57 +03:00
Luis Soares
f7202b84cb Manual merge from mysql-5.1-bugteam into mysql-trunk-merge.
Revert BUG#34283.

Conflicts
=========
  Text conflict in sql/sql_load.cc
  1 conflicts encountered.
2010-07-30 14:49:57 +01: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
a79187b8a6 Merge of mysql-5.1-bugteam into mysql-trunk-merge. 2010-07-30 09:43:42 -03:00
Davi Arnaut
0d7c321540 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:17:10 -03:00
ddeee24b39 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-07-30 13:15:46 +08:00
96e113b60a 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-07-30 11:59:34 +08:00
Davi Arnaut
5b2f69df44 Merge of mysql-5.1-bugteam into mysql-trunk-merge. 2010-07-29 15:53:53 -03:00
Alexander Nozdrin
dfc63866eb Auto-merge from mysql-trunk-merge. 2010-07-29 16:32:11 +04:00
Konstantin Osipov
14b769cfc6 Merge trunk-bugfixing -> trunk-runtime. 2010-07-29 14:18:13 +04:00
Vasil Dimov
61eeca5a4c Merge mysql-trunk-bugfixing -> mysql-trunk-innodb 2010-07-29 12:42:55 +03:00
Vasil Dimov
a95441c03a Merge mysql-5.1-bugteam -> mysql-5.1-innodb 2010-07-29 11:51:00 +03:00
c61ce4143c Manual merge 2010-07-29 11:24:35 +08:00
2ad690fdf8 BUG#49124 Security issue with /*!-versioned */ SQL statements on Slave
/*![:version:] Query Code */, where [:version:] is a sequence of 5 
digits representing the mysql server version(e.g /*!50200 ... */),
is a special comment that the query in it can be executed on those 
servers whose versions are larger than the version appearing in the 
comment. It leads to a security issue when slave's version is larger 
than master's. A malicious user can improve his privileges on slaves. 
Because slave SQL thread is running with SUPER privileges, so it can
execute queries that he/she does not have privileges on master.

This bug is fixed with the logic below: 
- To replace '!' with ' ' in the magic comments which are not applied on
  master. So they become common comments and will not be applied on slave.

- Example:
  'INSERT INTO t1 VALUES (1) /*!10000, (2)*/ /*!99999 ,(3)*/
  will be binlogged as
  'INSERT INTO t1 VALUES (1) /*!10000, (2)*/ /* 99999 ,(3)*/
2010-07-29 11:00:57 +08:00
Gleb Shchepa
95ec38c5b1 Bug #55472: Assertion failed in heap_rfirst function of hp_rfirst.c on
DELETE statement

Single-table delete ordered by a field that has a hash-type index
may cause an assertion failure or a crash.

An optimization added by the fix for the bug 36569 forced the
optimizer to use ORDER BY-compatible indices when applicable.

However, the existence of unsorted indices (HASH index algorithm
for some engines such as MEMORY/HEAP, NDB) was ignored.

The test_if_order_by_key function has been modified to skip
unsorted indices.
2010-07-29 01:02:43 +04:00
Davi Arnaut
ccf6ec093e Bug#53463: YaSSL patch appears to be reverted
The problem is that the fix Bug#29784 was mistakenly
reverted when updating YaSSL to a newer version.

The solution is to re-apply the fix and this time
actually add a meaningful test case so that possible
regressions are caught.
2010-07-28 12:59:19 -03:00
Alexey Kopytov
497f58a4cf Manual merge from 5.1 2010-07-28 15:42:16 +04:00
Bjorn Munch
0ebd10bc3b Bug #54660 MTR cannot start server properly with non-default innodb_log_file_size
Pass any --innodb* options to bootstrap as well
Backported to v1, where also a removal of --loose-skip-innodb is needed
2010-07-28 13:28:21 +02:00
Bjorn Munch
56a1917b71 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
2010-07-28 12:24:38 +02:00
Konstantin Osipov
2abe7b9d4e Merge trunk-bugfixing -> trunk-runtime. 2010-07-27 18:32:42 +04:00
Dmitry Lenev
5fff906edd Fix for bug #52044 "FLUSH TABLES WITH READ LOCK and FLUSH
TABLES <list> WITH READ LOCK are incompatible".

The problem was that FLUSH TABLES <list> WITH READ LOCK
which was issued when other connection has acquired global
read lock using FLUSH TABLES WITH READ LOCK was blocked
and has to wait until global read lock is released.

This issue stemmed from the fact that FLUSH TABLES <list>
WITH READ LOCK implementation has acquired X metadata locks
on tables to be flushed. Since these locks required acquiring
of global IX lock this statement was incompatible with global
read lock.

This patch addresses problem by using SNW metadata type of
lock for tables to be flushed by FLUSH TABLES <list> WITH
READ LOCK. It is OK to acquire them without global IX lock
as long as we won't try to upgrade those locks. Since SNW
locks allow concurrent statements using same table FLUSH
TABLE <list> WITH READ LOCK now has to wait until old
versions of tables to be flushed go away after acquiring
metadata locks. Since such waiting can lead to deadlock
MDL deadlock detector was extended to take into account
waits for flush and resolve such deadlocks.

As a bonus code in open_tables() which was responsible for
waiting old versions of tables to go away was refactored.
Now when we encounter old version of table in open_table()
we don't back-off and wait for all old version to go away,
but instead wait for this particular table to be flushed.
Such approach supported by deadlock detection should reduce
number of scenarios in which FLUSH TABLES aborts concurrent
multi-statement transactions.

Note that active FLUSH TABLES <list> WITH READ LOCK still
blocks concurrent FLUSH TABLES WITH READ LOCK statement
as the former keeps tables open and thus prevents the
latter statement from doing flush.
2010-07-27 17:34:58 +04:00
Konstantin Osipov
ec2c3bf2c1 A pre-requisite patch for the fix for Bug#52044.
This patch also fixes Bug#55452 "SET PASSWORD is
replicated twice in RBR mode".

The goal of this patch is to remove the release of 
metadata locks from close_thread_tables().
This is necessary to not mistakenly release
the locks in the course of a multi-step
operation that involves multiple close_thread_tables()
or close_tables_for_reopen().

On the same token, move statement commit outside 
close_thread_tables().

Other cleanups:
Cleanup COM_FIELD_LIST.
Don't call close_thread_tables() in COM_SHUTDOWN -- there
are no open tables there that can be closed (we leave
the locked tables mode in THD destructor, and this
close_thread_tables() won't leave it anyway).

Make open_and_lock_tables() and open_and_lock_tables_derived()
call close_thread_tables() upon failure.
Remove the calls to close_thread_tables() that are now
unnecessary.

Simplify the back off condition in Open_table_context.

Streamline metadata lock handling in LOCK TABLES 
implementation.

Add asserts to ensure correct life cycle of 
statement transaction in a session.

Remove a piece of dead code that has also become redundant
after the fix for Bug 37521.
2010-07-27 14:25:53 +04:00
Matthias Leich
62b0262dd2 Merge of fix for Bug#53102 perfschema.pfs_upgrade fails on sol10 sparc64 max in parallel mode
into actual tree. No conflicts.
2010-07-26 19:00:01 +02:00
Davi Arnaut
ed434ce045 Bug#45377: ARCHIVE tables aren't discoverable after OPTIMIZE
The problem was that the optimize method of the ARCHIVE storage
engine was not preserving the FRM embedded in the ARZ file when
rewriting the ARZ file for optimization. The ARCHIVE engine stores
the FRM in the ARZ file so it can be transferred from machine to
machine without also copying the FRM -- the engine restores the
embedded FRM during discovery.

The solution is to copy over the FRM when rewriting the ARZ file.
In addition, some initial error checking is performed to ensure
garbage is not copied over.
2010-07-26 12:54:20 -03:00
Sven Sandberg
8ff3360f07 merged BUG#55322 from 5.1-bugteam to trunk-merge 2010-07-26 12:52:59 +02:00
Jimmy Yang
e168621d61 Fix Bug #55395 INNODB_TRX duplicates columns
rb://408 approved by Sunny Bains
2010-07-26 03:07:36 -07:00
Sven Sandberg
93324cbf0e merged BUG#55322 to 5.1-bugteam 2010-07-26 11:56:30 +02:00
Dmitry Lenev
c67cf159e9 Test for bug #53820 "ALTER a MEDIUMINT column table causes full
table copy".

This patch only adds test case as the bug itself was addressed 
by Ramil's fix for bug 50946 "fast index creation still seems
to copy the table".
2010-07-26 13:22:38 +04:00
Alexander Nozdrin
c8fa4f33e0 Make lowercase_table2 experimental due to Bug 55509. 2010-07-26 12:47:30 +04:00
Davi Arnaut
f860873c0d Bug#55501: Disable innodb plugin usage in the embedded server on certain OSes
Do not attempt to test the innodb plugin with the embedded server,
it's not supported for now.
2010-07-23 21:55:03 -03:00
Davi Arnaut
85bbcfee02 WL#5498: Remove dead and unused source code
Remove the ancient and dead raid code. By now, even the server side
has been removed.
2010-07-23 17:15:07 -03:00
Davi Arnaut
e83f1d37c4 WL#5498: Remove dead and unused source code
Remove unused source code and associated paraphernalia.
2010-07-23 17:14:35 -03:00
Bjorn Munch
be55e8d59d merge from trunk 2010-07-23 15:12:58 +02:00
Bjorn Munch
2994f8b7f1 Bug #55503 MTR fails to filter LEAK SUMMARY from valgrind report of restarted servers
Was not covered by "skip" pattern
Replace with a more generic pattern for SUMMARY
2010-07-23 14:53:09 +02:00
Alexey Kopytov
bb3fbba1af Bug #54476: crash when group_concat and 'with rollup' in
prepared statements

Using GROUP_CONCAT() together with the WITH ROLLUP modifier
could crash the server.

The reason was a combination of several facts:

1. The Item_func_group_concat class stores pointers to ORDER
objects representing the columns in the ORDER BY clause of
GROUP_CONCAT().

2. find_order_in_list() called from
Item_func_group_concat::setup() modifies the ORDER objects so
that their 'item' member points to the arguments list
allocated in the Item_func_group_concat constructor.

3. In some cases (e.g. in JOIN::rollup_make_fields) a copy of
the original Item_func_group_concat object could be created by
using the Item_func_group_concat::Item_func_group_concat(THD
*thd, Item_func_group_concat *item) copy constructor. The
latter essentially creates a shallow copy of the source
object. Memory for the arguments array is allocated on
thd->mem_root, but the pointers for arguments and ORDER are
copied verbatim.

What happens in the test case is that when executing the query
for the first time, after a copy of the original
Item_func_group_concat object has been created by
JOIN::rollup_make_fields(), find_order_in_list() is called for
this new object. It then resolves ORDER BY by modifying the
ORDER objects so that they point to elements of the arguments
array which is local to the cloned object. When thd->mem_root
is freed upon completing the execution, pointers in the ORDER
objects become invalid. Those ORDER objects, however, are also
shared with the original Item_func_group_concat object which is
preserved between executions of a prepared statement. So the
first call to find_order_in_list() for the original object on
the second execution tries to dereference an invalid pointer.

The solution is to create copies of the ORDER objects when
copying Item_func_group_concat to not leave any stale pointers
in other instances with different lifecycles.
2010-07-23 15:52:54 +04:00
Vasil Dimov
10870186e5 Merge mysql-5.1 -> mysql-5.1-innodb 2010-07-23 12:51:14 +03:00
Jon Olav Hauglid
97bfd559f1 Bug #55498 SHOW CREATE TRIGGER takes wrong type of metadata lock
The first problem was that SHOW CREATE TRIGGER took a stronger metadata
lock than required. This caused the statement to be blocked when it was
not needed. For example, LOCK TABLE WRITE in one connection would block
SHOW CREATE TRIGGER in another connection.

Another problem was that a SHOW CREATE TRIGGER statement issued inside
a transaction did not release its metadata locks at the end of the
statement execution. This happened even if SHOW CREATE TRIGGER is an
information statement. The consequence was that SHOW CREATE TRIGGER
was able to block other connections from accessing the table
(e.g. using ALTER TABLE).

This patch fixes the problem by changing SHOW CREATE TRIGGER to take
a MDL_SHARED_HIGH_PRIO metadata lock similar to what is already done
for SHOW CREATE TABLE. The patch also changes SHOW CREATE TRIGGER to
explicitly release any metadata locks taken by the statement after
it completes.

Test case added to show_check.test.
2010-07-23 10:44:55 +02:00
Vasil Dimov
3074ff5233 Fix the failing innodb.innodb_bug54679 test
A change in the default values of some config parameters
caused this test to fail, adjust the test and make it more
robust so it does not fail for the same reason in the future.
2010-07-23 10:37:44 +03:00
Jon Olav Hauglid
e814e9ac1e Bug #54905 Connection with WRITE lock cannot ALTER table due to
concurrent SHOW CREATE

The problem was that a SHOW CREATE TABLE statement issued inside
a transaction did not release its metadata locks at the end of the
statement execution. This happened even if SHOW CREATE TABLE is an
information statement. 

The consequence was that SHOW CREATE TABLE was able to block other
connections from accessing the table (e.g. using ALTER TABLE).

This patch fixes the problem by explicitly releasing any metadata
locks taken by SHOW CREATE TABLE after the statement completes.

Test case added to show_check.test.
2010-07-22 11:10:35 +02:00
Georgi Kodinov
98357570b4 merge 2010-07-21 18:54:11 +03:00
Georgi Kodinov
335a623c41 merge 2010-07-21 18:51:36 +03:00
Georgi Kodinov
7330233b96 merge 2010-07-21 18:20:29 +03:00
Georgi Kodinov
047d47241c Addendum #4 to bug #53095
SHOW DATABASES LIKE ... was not converting to lowercase on comparison as the
documentation is suggesting. 
Fixed it to behave similarly to SHOW TABLES LIKE ... and updated the failing
on MacOSX lowercase_table2 test case.
2010-07-21 18:05:57 +03:00
Vasil Dimov
8152cd0ac8 Merge mysql-trunk-bugfixing -> mysql-trunk-innodb
(resolving conflicts in mysql-test/suite/rpl/t/rpl_sync-slave.opt and
configure.cmake)
2010-07-21 17:22:29 +03:00
Matthias Leich
6a029cc54c Bug#53102 perfschema.pfs_upgrade fails on sol10 sparc64 max in parallel mode
The reason for the bug above is unclear but
- Modify pfs_upgrade so that it's result is easier to analyze in case something fails
- Fix several minor weaknesses which could cause that a successing test (either an
  already existing or a to be developed one) fails because of imperfect cleanup,
  too slow disconnected sessions etc.
should either fix the bug or reduce it's probability or at least
make the analysis of failures easier.
2010-07-20 21:15:29 +02:00
Davi Arnaut
17b9155f00 Bug#54453: Failing assertion: trx->active_trans when renaming a
table with active trx

Essentially, the problem is that InnoDB does a implicit commit
when a cursor (table handler) is unlocked/closed, creating
a dissonance between the transaction state within the server
layer and the storage engine layer. Theoretically, a statement
transaction can encompass several table instances in a similar
manner to a multiple statement transaction, hence it does not
make sense to limit a statement transaction to the lifetime of
the table instances (cursors) used within it.

Since this particular instance of the problem is only triggerable
on 5.1 and is masked on 5.5 due 2PC being skipped (assertion is in
the prepare phase of a 2PC), the solution (which is less risky) is
to explicitly end the transaction before the cached table is unlock
on rename table.

The patch is to be null merged into trunk.
2010-07-20 14:36:15 -03:00
Sven Sandberg
cf5e69c904 BUG#55322: SHOW BINLOG EVENTS increases @@SESSION.MAX_ALLOWED_PACKET
Problem: when SHOW BINLOG EVENTS was issued, it increased the value of
@@session.max_allowed_packet. This allowed a non-root user to increase
the amount of memory used by her thread arbitrarily. Thus, it removes
the bound on the amount of system resources used by a client, so it
presents a security risk (DoS attack).

Fix: it is correct to increase the value of @@session.max_allowed_packet
while executing SHOW BINLOG EVENTS (see BUG 30435). However, the
increase should only be temporary. Thus, the fix is to restore the value
when SHOW BINLOG EVENTS ends.
The value of @@session.max_allowed_packet is also increased in
mysql_binlog_send (i.e., the binlog dump thread). It is not clear if this
can cause any trouble, since normally the client that issues
COM_BINLOG_DUMP will not issue any other commands that would be affected
by the increased value of @@session.max_allowed_packet. However, we
restore the value just in case.
2010-07-20 17:27:13 +02:00
Alexander Nozdrin
9d0ef81e27 Auto-merge from mysql-trunk-merge. 2010-07-20 12:09:51 +04:00
Davi Arnaut
ce2403e6ee Merge into mysql-trunk-merge.. 2010-07-19 16:03:59 -03:00
Davi Arnaut
13f856f57b Merge of mysql-5.1 into mysql-5.1-bugteam. 2010-07-19 15:34:28 -03:00
Evgeny Potemkin
589027b2f5 Bug#49771: Incorrect MIN/MAX for date/time values.
This bug is a design flaw of the fix for the bug#33546. It assumed that an
item can be used only in one comparison context, but actually it isn't the
case. Item_cache_datetime is used to store result for MIX/MAX aggregate
functions. Because Arg_comparator always compares datetime values as INTs when
possible the Item_cache_datetime most time caches only INT value. But
since all datetime values has STRING result type MIN/MAX functions are asked
for a STRING value when the result is being sent to a client. The
Item_cache_datetime was designed to avoid conversions and get INT/STRING
values from an underlying item, but at the moment the values is asked
underlying item doesn't hold it anymore thus wrong result is returned.
Beside that MIN/MAX aggregate functions was wrongly initializing cached result
and this led to a wrong result.

The Item::has_compatible_context helper function is added. It checks whether
this and given items has the same comparison context or can be compared as
DATETIME values by Arg_comparator. The equality propagation optimization is
adjusted to take into account that items which being compared as DATETIME
can have different comparison contexts.
The Item_cache_datetime now converts cached INT value to a correct STRING
DATETIME value by means of number_to_datetime & my_TIME_to_str functions.
The Arg_comparator::set_cmp_context_for_datetime helper function is added. 
It sets comparison context of items being compared as DATETIMEs to INT if
items will be compared as longlong.
The Item_sum_hybrid::setup function now correctly initializes its result
value.
In order to avoid unnecessary conversions Item_sum_hybrid now states that it
can provide correct longlong value if the item being aggregated can do it
too.
2010-07-19 21:11:47 +04:00
Jon Olav Hauglid
d4885416b7 manual merge from mysql-5.1-bugteam 2010-07-19 11:21:24 +02:00
Jon Olav Hauglid
4b2378a148 Bug #54734 assert in Diagnostics_area::set_ok_status
This assert checks that the server does not try to send OK to the
client if there has been some error during processing. This is done
to make sure that the error is in fact sent to the client.

The problem was that view errors during processing of WHERE conditions
in UPDATE statements where not detected by the update code. It therefore
tried to send OK to the client, triggering the assert.
The bug was only noticeable in debug builds.

This patch fixes the problem by making sure that the update code
checks for errors during condition processing and acts accordingly.
2010-07-19 11:03:52 +02:00
Jon Olav Hauglid
52b1e11ee1 merge from mysql-trunk-bugfixing 2010-07-19 10:27:53 +02:00
Andrei Elkin
c225cde943 merging for bug#54935 to trunk-bugfixing 2010-07-17 14:07:36 +03:00
Davi Arnaut
4d532f6ea6 Merge of mysql-trunk-merge into mysql-trunk-bugfixing. 2010-07-16 17:02:40 -03:00
Andrei Elkin
2d91f05e88 bug#54935
applying bundle made for next-mr-bugfixing to trunk-bugfixing branch of the bug
2010-07-16 21:25:38 +03:00
Andrei Elkin
48d1c50ac1 bug#54935
applying bundle made for next-mr-bugfixing to trunk-bugfixing branch of the bug
2010-07-16 21:25:00 +03:00
Georgi Kodinov
a95b184630 merge 2010-07-16 18:04:39 +03:00
Marc Alff
3fa071bbd6 Bug#53392 Tests: perfschema.query_cache fails
Backport from mysql-next-mr (5.6) to mysql-trunk (5.5)
2010-07-16 08:28:19 -06:00
Marc Alff
d32d8f8d58 Bug#53394 Tests: perfschema.myisam_file_io fails
Backport from mysql-next-mr (5.6) to mysql-trunk (5.5)
2010-07-16 08:21:07 -06:00
Georgi Kodinov
d4931e4beb Addendum to bug #53814 : test results updates 2010-07-16 16:56:33 +03:00
Marc Alff
ae127ed601 Bug#54782 Performance schema per thread accounting and thread cache
Backport from mysql-next-mr (5.6) to mysql-trunk (5.5)
2010-07-16 07:50:50 -06:00
Bjorn Munch
17ed4f6880 Bug #54835 MTR version 1 cannot start server - bootstrap reports unknown InnoDB engine
Remove --loose-skip-innodb from startup options
This is a simple backport of change done in WL #5349
Same as shown as "temporary fix", cherry picked to -mtr branch
2010-07-16 10:21:06 +02:00
Marc Alff
a809475699 Bug#52586 Misleading error message on attempt to access a P_S table using a wrong name
Backport from mysql-next-mr (5.6) to mysql-trunk (5.5)
2010-07-15 18:50:39 -06:00
Davi Arnaut
66dd2f49b6 Bug#53613: mysql_upgrade incorrectly revokes ...
Post-merge fix: adjust line numbers in pfs_upgrade test case
result given that mysql_system_tables_fix.sql was modified.
2010-07-15 18:57:47 -03:00
Georgi Kodinov
aaf5f8d5c4 merge 2010-07-15 18:46:41 +03:00
Davi Arnaut
649390ac81 Merge of mysql-trunk-bugfixing into mysql-trunk-merge. 2010-07-15 10:47:50 -03:00
Davi Arnaut
f54a118249 WL#5486: Remove code for unsupported platforms
Remove Netware specific code.
2010-07-15 08:13:30 -03:00
Marc Alff
adf29ed689 local merge 2010-07-14 09:57:50 -06:00