Commit graph

66912 commits

Author SHA1 Message Date
Joerg Bruehe
e6a3c8c458 Fix bug#56574:
After installation from RPM, server is run under root, not mysql user

The problem was that in the cmake way of building
the variable "MYSQLD_USER" was not set and propagated.
In the script "mysqld_safe" its value is used as the
name of the user who should run the server process.

The fix is to explicitly set this variable to "mysql"
and propagate it in the build process.
It was analyzed and proposed by Jonathan Perkin.
2010-09-07 17:05:16 +02: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
Dmitry Shulga
d439036a04 Auto-merge from mysql-5.1-bugteam. 2010-09-07 14:49:47 +07:00
Dmitry Shulga
14dbc7e4e6 Fixed bug #47485 - mysql_store_result returns a not NULL result set
for a prepared statement.
2010-09-07 14:18:01 +07: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
Dmitry Lenev
ac35157899 A temporary workaround for bug #56405 "Deadlock in the
MDL deadlock detector".

Deadlock could have occurred when workload containing mix
of DML, DDL and FLUSH TABLES statements affecting same
set of tables was executed in heavily concurrent environment.

This deadlock occurred when several connections tried to
perform deadlock detection in metadata locking subsystem.
The first connection started traversing wait-for graph,
encountered sub-graph representing wait for flush, acquired
LOCK_open and dived into sub-graph inspection. When it has
encounterd sub-graph corresponding to wait for metadata lock
and blocked while trying to acquire rd-lock on
MDL_lock::m_rwlock (*) protecting this subgraph, since some
other thread had wr-lock on it. When this wr-lock was released
it could have happened (if there was other pending wr-lock
against this rwlock) that rd-lock from the first connection
was left unsatisfied but at the same time new rd-lock request
from the second connection sneaked in and was satisfied (for
this to be possible second rd- request should come exactly
after wr-lock is released but before pending wr-lock manages
to grab rwlock, which is possible both on Linux and in our
own rwlock implementation). If this second connection
continued traversing wait-for graph and encountered sub-graph
representing wait for flush it tried to acquire LOCK_open
and thus deadlock was created.

This patch tries to workaround this problem but not allowing
deadlock detector to lock LOCK_open mutex if some other thread
doing deadlock detection already owns it and current search
depth is greater than 0. Instead deadlock is reported.

Other possible solutions are either known to have negative
effects on performance or require much more time for proper
implementation and testing.

No test case is provided as this bug is very hard to repeat
in MTR environment but is repeatable with the help of RQG
tests.
2010-09-06 21:29:02 +04:00
Alfranio Correia
95116114a4 BUG#55415 wait_for_update_bin_log enters a condition but does not leave
In sql/log.c, member function wait_for_update_bin_log, a condition is entered with
THD::enter_cond but is not exited. This might leave dangling references to the
mutex/condition in the per-thread information area.
      
To fix the problem, we call exit_cond to properly remove references to the mutex,
LOCK_log.
2010-09-06 18:18:44 +01:00
Georgi Kodinov
1f84bb0c0f merge 2010-09-06 17:04:32 +02:00
Magne Mahre
f3dae641ad Null merge of mysql-5.1-bugteam into mysql-5.5-merge 2010-09-06 15:40:55 +02:00
Davi Arnaut
bb080fc7cd Null merge of mysql-5.1-bugteam into mysql-5.5-merge. 2010-09-06 10:32:45 -03: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
Gleb Shchepa
01818ec2da automerge 5.1-bugteam --> 5.5-merge (bug 53034) 2010-09-06 16:10:36 +04:00
Joerg Bruehe
8fd74f66a9 Fix bug#56547 mysql client interprets commands in comments
The problem was not caused by a change in the client,
rather by the tests using the Windows built-in "echo"
and not the one built by MySQL.
This again happened because the binary was missing in the package,
caused by the wrong macro being used to build it in "cmake".
2010-09-06 13:26:23 +02:00
Ramil Kalimullin
df798550cc Automerge. 2010-09-06 13:54:44 +04:00
Magne Mahre
f4bbb44ac9 Null merge (InnoDB changes are already in 5.5) 2010-09-03 12:36:44 +02: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
Alexey Botchkov
3886c3a46d Bug#53251 mysql_library_init fails on second execution with embedded library
thread-specific variables weren't set when we load error message files.

per-file comments:
  libmysqld/lib_sql.cc
Bug#53251      mysql_library_init fails on second execution with embedded library
      we need to call my_thread_init() once more. Normally it's called at the my_init()
      stage but that doesn't happen on the second my_init() call.

  sql/derror.cc
Bug#53251      mysql_library_init fails on second execution with embedded library
     use default errors for the embedded server.

  sql/mysqld.cc
Bug#53251      mysql_library_init fails on second execution with embedded library
        unregister server errors in clean_up(). Without it the error list contains
        that on the second mysql_server_init() which is not good.

  sql/set_var.cc
Bug#53251      mysql_library_init fails on second execution with embedded library
        sys_var::cleanup() call instead of the destructor

  sql/set_var.h
Bug#53251      mysql_library_init fails on second execution with embedded library
        sys_var::cleanup() introduced instead of the destructor
        
  sql/sys_vars.h
Bug#53251      mysql_library_init fails on second execution with embedded library
        Sys_var_charptr::cleanup() implemented
2010-09-02 23:37:04 +05:00
Joerg Bruehe
aad96fccad Check the build mechanisms: Do they support a "-rc" suffix? 2010-09-02 17:44:25 +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
Marc Alff
b9e063ca31 Bug#55873 short startup options do not work in 5.5
Merge cleanup, fixed a build warning:

my_getopt.c:156: warning: 'opt_found' may be used uninitialized in this function
2010-09-01 19:13:24 -06: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
f8f23158c7 Auto-merge from mysql-5.5. 2010-09-01 17:17:57 +04:00
Alexander Nozdrin
afe9d44c3a Auto-merge from mysql-5.5-stage. 2010-09-01 16:59:52 +04:00
Alexey Botchkov
236f1a6d55 merging. 2010-09-01 17:49:25 +05: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
Alexey Botchkov
26119c1337 Bug#54861 Additional connections not handled properly in mtr --embedded
When in embedded-serve mode, mysqltest tried to run '--send' commands in the separate thread.
        That upsets some engines (InnoDB particularly) as the transaction has to be executed in the same
        thread completely. So i implemented some different approach. So we create one separate thread for
        each connection and execute all the queries of this connection inside it. Looks even simpler than it was
        for me.

per-file comments:
  client/mysqltest.cc
Bug#54861      Additional connections not handled properly in mtr --embedded
        Now the connection has one running connection_thread() attached. And sends all the
        query and read-result requests to it.
2010-09-01 17:34:05 +05:00
Alexey Botchkov
a334004420 Bug#54906 Inconsistent license of libmysqld
made libmysqld/Makefile.am to have same licence as libmysqld/CMakeLists.txt

per-file comments:
  libmysqld/Makefile.am
Bug#54906      Inconsistent license of libmysqld
        Added GPL license header instead of Library GPL.
2010-09-01 08:38:53 +05:00
Alexander Nozdrin
f919f9e327 Cherry-picking patch for Bug#55846.
Original changeset:
------------------------------------------------------------
revno: 3186
revision-id: davi.arnaut@oracle.com-20100831142822-2qhufn3hho4xqr4p
parent: gshchepa@mysql.com-20100830222201-ie7n43mjy4irlllk
committer: Davi Arnaut <davi.arnaut@oracle.com>
branch nick: mysql-5.5-merge
timestamp: Tue 2010-08-31 11:28:22 -0300
message:
  Bug#55846: Link tests fail on Windows - my_compiler.h missing
  
  Make the my_compiler.h header, like my_attribute.h, part of
  the distribution. This is required due to the dependency of
  the former on the latter (which can undefine __attribute__).
------------------------------------------------------------
2010-08-31 18:33:19 +04:00
Davi Arnaut
0ce793faf6 Bug#55846: Link tests fail on Windows - my_compiler.h missing
Make the my_compiler.h header, like my_attribute.h, part of
the distribution. This is required due to the dependency of
the former on the latter (which can undefine __attribute__).
2010-08-31 11:28:22 -03: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
Daniel Fischer
f62bf940af Bug#56387 Create initial database in the proper location 2010-08-31 13:06:56 +02:00
Alexander Nozdrin
d2159e37f2 Bug#27480 (Extend CREATE TEMPORARY TABLES privilege
to allow temp table operations) -- prerequisite patch #3.

Rename open_temporary_table() to open_table_uncached().
open_temporary_table() will be introduced in following patches
to open temporary tables for a statement.
2010-08-31 14:03:36 +04:00