Commit graph

60586 commits

Author SHA1 Message Date
Jorgen Loland
76f135966c local merge 2010-01-04 10:51:05 +01:00
Jorgen Loland
3dab08f157 Bug#48920: COUNT DISTINCT returns 1 for NULL values when in a
subquery in the select list
      
When a dependent subquery with count(distinct <col>) was 
evaluated multiple times, the Distinct_Aggregator was reused. 
However, the Aggregator was not reset, so when the subquery was
evaluated for the next record in the outer select, old dependent
info was used.
      
The fix is to clear() the existing aggregator in 
Item_sum::set_aggregator(). This ensures that the aggregator is
reevaluated with the new dependent information.
2010-01-04 10:39:42 +01:00
Alexander Nozdrin
c5151a6e9b Auto-merge from mysql-next-mr. 2010-01-04 12:39:33 +03:00
Alexander Nozdrin
f37f38006b Auto-merge from mysql-next-mr-serg. 2010-01-04 12:34:59 +03:00
Sergei Golubchik
4949ee3a75 possible fix for sporadic sys_vars.delayed_insert_limit_func failures 2009-12-31 14:05:33 +01:00
dbe02e6d4a Bug #49137 Replication failure on SBR/MBR + multi-table DROP TEMPORARY TABLE
In statement-based or mixed-mode replication, use DROP TEMPORARY TABLE
to drop multiple tables causes different errors on master and slave, 
when one or more of these tables do not exist. Because when executed
on slave, it would automatically add IF EXISTS to the query to ignore
all ER_BAD_TABLE_ERROR errors.

To fix the problem, do not add IF EXISTS when executing DROP TEMPORARY
TABLE on the slave, and clear the ER_BAD_TABLE_ERROR error after
execution if the query does not expect any errors.
2009-12-31 12:04:19 +08:00
ccc3a46856 Bug #49137 Replication failure on SBR/MBR + multi-table DROP TEMPORARY TABLE
In statement-based or mixed-mode replication, use DROP TEMPORARY TABLE
to drop multiple tables causes different errors on master and slave, 
when one or more of these tables do not exist. Because when executed
on slave, it would automatically add IF EXISTS to the query to ignore
all ER_BAD_TABLE_ERROR errors.

To fix the problem, do not add IF EXISTS when executing DROP TEMPORARY
TABLE on the slave, and clear the ER_BAD_TABLE_ERROR error after
execution if the query does not expect any errors.
2009-12-31 11:33:10 +08:00
Kent Boortz
5f60e1ef7b Merge 2009-12-30 23:26:49 +01:00
Kent Boortz
d64f049351 Removed unwanted Perl DBI dependency 2009-12-30 23:06:14 +01:00
Dmitry Lenev
236539b471 Implementation of simple deadlock detection for metadata locks.
This change is supposed to reduce number of ER_LOCK_DEADLOCK
errors which occur when multi-statement transaction encounters
conflicting metadata lock in cases when waiting is possible.

The idea is not to fail ER_LOCK_DEADLOCK error immediately when
we encounter conflicting metadata lock. Instead we release all
metadata locks acquired by current statement and start to wait
until conflicting lock go away. To avoid deadlocks we use simple
empiric which aborts waiting with ER_LOCK_DEADLOCK error if it
turns out that somebody is waiting for metadata locks owned by
this transaction.

This patch also fixes bug #46273 "MySQL 5.4.4 new MDL: Bug#989
is not fully fixed in case of ALTER".

The bug was that concurrent execution of UPDATE or MULTI-UPDATE
statement as a part of multi-statement transaction that already
has used table being updated and ALTER TABLE statement might have
resulted of loss of isolation between this transaction and ALTER
TABLE statement, which manifested itself as changes performed by
ALTER TABLE becoming visible in transaction and wrong binary log
order as a consequence.

This problem occurred when UPDATE or MULTI-UPDATE's wait in
mysql_lock_tables() call was aborted due to metadata lock
upgrade performed by concurrent ALTER TABLE. After such abort all
metadata locks held by transaction were released but transaction
silently continued to be executed as if nothing has happened.

We solve this problem by changing our code not to release all
locks in such case. Instead we release only locks which were
acquired by current statement and then try to reacquire them
by restarting open/lock tables process. We piggyback on simple
deadlock detector implementation since this change has to be
done anyway for it.
2009-12-30 20:53:30 +03:00
Alexander Nozdrin
cd6fbffc38 Disable test case for Bug#49972. 2009-12-29 21:12:06 +03:00
Alexander Nozdrin
93613d4e07 A test case for Bug#49972 (Crash in prepared statements). 2009-12-29 18:50:01 +03:00
Konstantin Osipov
3b311f399d Apply and review:
3655 Jon Olav Hauglid   2009-10-19
Bug #30977 Concurrent statement using stored function and DROP FUNCTION 
           breaks SBR
Bug #48246 assert in close_thread_table

Implement a fix for:
Bug #41804 purge stored procedure cache causes mysterious hang for many
           minutes
Bug #49972 Crash in prepared statements

The problem was that concurrent execution of DML statements that
use stored functions and DDL statements that drop/modify the same
function might result in incorrect binary log in statement (and
mixed) mode and therefore break replication.

This patch fixes the problem by introducing metadata locking for
stored procedures and functions. This is similar to what is done
in Bug#25144 for views. Procedures and functions now are
locked using metadata locks until the transaction is either
committed or rolled back. This prevents other statements from
modifying the procedure/function while it is being executed. This
provides commit ordering - guaranteeing serializability across
multiple transactions and thus fixes the reported binlog problem.

Note that we do not take locks for top-level CALLs. This means
that procedures called directly are not protected from changes by
simultaneous DDL operations so they are executed at the state they
had at the time of the CALL. By not taking locks for top-level
CALLs, we still allow transactions to be started inside
procedures.

This patch also changes stored procedure cache invalidation.
Upon a change of cache version, we no longer invalidate the entire
cache, but only those routines which we use, only when a statement
is executed that uses them.

This patch also changes the logic of prepared statement validation.
A stored procedure used by a prepared statement is now validated
only once a metadata lock has been acquired. A version mismatch
causes a flush of the obsolete routine from the cache and
statement reprepare.
Incompatible changes:
1) ER_LOCK_DEADLOCK is reported for a transaction trying to access
   a procedure/function that is locked by a DDL operation in
   another connection.

2) Procedure/function DDL operations are now prohibited in LOCK
   TABLES mode as exclusive locks must be taken all at once and
   LOCK TABLES provides no way to specifiy procedures/functions to
   be locked.

Test cases have been added to sp-lock.test and rpl_sp.test.

Work on this bug has very much been a team effort and this patch
includes and is based on contributions from Davi Arnaut, Dmitry
Lenev, Magne Mæhre and Konstantin Osipov.
2009-12-29 15:19:05 +03:00
Alexander Nozdrin
8050affe24 Auto-merge from mysql-next-mr. 2009-12-29 13:02:43 +03:00
Alexey Kopytov
0807a23775 Fixed a build failure in mysql-trunk-merge caused by a bad
merge from mysql-5.1-bugteam.
2009-12-28 16:59:12 +03:00
Alexey Kopytov
85d5a08b51 Manual merge of WL#4738 from mysql-next-mr:
- backported code that handles %f/%g arguments in 
my_vsnprintf.c from 6.0 
- backported %f/%g tests in unittest/mysys/my_vsnprintf-t.c 
from 6.0 
- replaced snprintf("%g") in sql/set_var.cc with my_gcvt() 
- removed unnecessary "--replace-result"s for Windows in 
mysql-test/suite/sys_vars/t/long_query_time_basic.test 
- some test results adjustments
2009-12-28 15:54:16 +03:00
Alfranio Correia
7ff2dcea09 merge mysql-5.1-rep+2 --> mysql-5.1-rep+2-delivery1 2009-12-28 00:06:12 +00:00
Alfranio Correia
d08385fe23 merging from 5.1 to rep+2 starting at gca(5.1, next-mr) == ramil@mysql.com-20091215170821-eexh9rqrnw1ruzh2 2009-12-27 23:47:04 +00:00
Sergei Golubchik
31cd0643ae my_once.c: clarify the comment 2009-12-26 21:55:32 +01:00
Ramil Kalimullin
176a4172e7 Auto-merge. 2009-12-26 15:25:56 +04:00
Ramil Kalimullin
6c16fb6d4e Auto-merge. 2009-12-26 14:59:56 +04:00
Sergei Golubchik
825ba2ec8b don't show the value of open_files_limit 2009-12-26 09:35:42 +01:00
Sergei Golubchik
28056ba204 don't show --ssl* option if ssl is not compiled in 2009-12-25 22:36:59 +01:00
Joerg Bruehe
4b430b897a Backport into the 5.5.1-m2 release build:
| Bug#49898 - Fix for bug#37408 introduces a linker error
|
| the declaration of THR_LOCK_myisam_mmap in mi_static 
| is redundant as it accessible via the extern declaration 
| in include/myisam.h
2009-12-25 17:02:08 +01:00
Alexander Nozdrin
ece5ad57e9 Auto-merge from mysql-next-mr. 2009-12-25 16:22:25 +03:00
Alexey Kopytov
24fc798fc7 Manual merge of mysql-5.1-bugteam into mysql-trunk-merge.
Conflicts:

mysql-test/collections/default.experimental
2009-12-25 13:56:50 +03:00
Alexey Kopytov
1d13320d9a Null merge. 2009-12-25 12:15:16 +03:00
0c4e5f784b Backport Bug #43913 rpl_cross_version can't pass on conflicts complainig clash with --slave-load-tm
The 'rpl_cross_version' fails on mysql-next-mr-bugfixing as following:
mysqltest: In included file "./include/setup_fake_relay_log.inc": At line 80: query
'select './$_fake_filename-fake.000001\n' into dumpfile '$_fake_relay_index'' failed:
1290: The MySQL server is running with the --secure-file-priv option so it cannot execute
this statement.

To fix the problem by removeing the --secure-file-priv option
for adapting the update of the 'setup_fake_relay_log.inc'.
2009-12-25 14:12:49 +08:00
Alexey Kopytov
ca409d5756 Automerge. 2009-12-25 00:09:18 +03:00
Alexey Kopytov
064ebe5769 Addendum to the backport patch for WL#2934:
Unlike other platforms --mfpmath=sse is the default 
gcc mode on Mac OS X Intel. So it is unnecessary
to switch FPU to double precision mode (in fact,
it even breaks some math library functions).
2009-12-25 00:06:53 +03:00
Sergei Golubchik
50f9dc6a1d merged 2009-12-24 21:18:53 +01:00
Luis Soares
9b0e91044e Valgrind warnings that have poped up ever since WL#5151 was pushed.
This fixes two more warnings for tests: 
  - rpl_row_colSize
  - rpl_typeconv
2009-12-24 15:55:46 +00:00
Luis Soares
b367b03bcb BUG#48738: null merge mysql-5.0-bugteam into mysql-5.1-bugteam latest. 2009-12-24 15:26:15 +00:00
Luis Soares
6d96d334fa BUG#48738: post-push fix. Multi-platform test improvements, mainly
to make the test run gracefully on windows.

There was also a syntax error in windows part of the test.
2009-12-24 15:20:58 +00:00
Alfranio Correia
b79df3bc19 merge mysql-next-mr --> mysql-5.1-rpl-merge 2009-12-24 11:51:30 +00:00
Sergei Golubchik
b4a39aeb5d slightly more complete mysqld--help test 2009-12-24 12:30:23 +01:00
Alexander Nozdrin
7917f0852f Auto-merge from mysql-trunk-merge. 2009-12-24 10:56:13 +03:00
Alexander Nozdrin
e446a244e0 Auto-merge from mysql-next-mr. 2009-12-24 10:34:13 +03:00
Alexander Nozdrin
6bb8cd8429 Auto-merge from mysql-trunk. 2009-12-24 10:34:04 +03:00
Alexander Nozdrin
fa64b359ab Auto-merge (empty) from mysql-trunk-bugfixing. 2009-12-24 10:31:09 +03:00
Alexander Nozdrin
27e7547bc6 Auto-merge from mysql-next-mr. 2009-12-24 10:30:13 +03:00
Alexander Nozdrin
2af3baceaf Auto-merge from mysql-trunk. 2009-12-24 10:30:04 +03:00
Alexander Nozdrin
9f335d9e91 Manual merge from mysql-trunk.
Conflicts:
  - storage/myisam/mi_static.c
2009-12-24 10:12:07 +03:00
Alexander Nozdrin
9721437edf Postfix for Bug#37408 (fix for Bug#49898). 2009-12-24 10:10:05 +03:00
ff16e34df7 Enable rpl_get_master_version_and clock and rpl_cross_version
as the bug#46931 and bug#43913 have been closed.
2009-12-24 11:01:39 +08:00
Luis Soares
b85a186c66 BUG#49836: Replication of geometric fields is broken after WL#5151
Metadata for geometric fields was not being properly stored by
the slave in its the table definition. This happened because
MYSQL_TYPE_GEOMETRY was not included in the 'switch... case' that
handles field metadata according to the field type. Therefore, it
would default to 0, leading to always have a mismatch between
master's field and slave fields'. 

We fix this by deploying the missing 'case MYSQL_TYPE_GEOMETRY:'.
2009-12-24 01:07:35 +00:00
Joerg Bruehe
980b34b81c Remove the "fix_privilege_tables" manual from the RPM spec file,
there is none in 5.5.
2009-12-23 22:42:44 +01:00
Sergei Golubchik
dec9ad1e25 backport typos found 2009-12-23 17:51:03 +01:00
Georgi Kodinov
c968fd4818 Bug #49512 : subquery with aggregate function crash
subselect_single_select_engine::exec()

When a subquery doesn't need to be evaluated because
it returns only aggregate functions and these aggregates
can be calculated from the metadata about the table it
was not updating all the relevant members of the JOIN 
structure to reflect that this is a constant query.
This caused problems to the enclosing subquery 
('<> SOME' in the test case above) trying to read some
data about the tables.

Fixed by setting const_tables to the number of tables 
when the SELECT is optimized away.
2009-12-23 17:11:22 +02:00
Alexey Kopytov
af74c3436f Manual merge of mysql-5.1-bugteam into mysql-trunk-merge.
Conflicts:

Conflict adding files to server-tools.  Created directory.
Conflict because server-tools is not versioned, but has versioned children.  Versioned directory.
Conflict adding files to server-tools/instance-manager.  Created directory.
Conflict because server-tools/instance-manager is not versioned, but has versioned children.  Versioned directory.
Contents conflict in server-tools/instance-manager/instance_map.cc
Contents conflict in server-tools/instance-manager/listener.cc
Contents conflict in server-tools/instance-manager/options.cc
Contents conflict in server-tools/instance-manager/user_map.cc
2009-12-23 16:42:05 +03:00