Commit graph

180 commits

Author SHA1 Message Date
unknown
d9f975d08b MDEV-26: Global transaction ID
Adjust full test suite to work with GTID.

Huge patch, mainly due to having to update .result file for all SHOW BINLOG
EVENTS and mysqlbinlog outputs, where the new GTID events pop up.

Everything was painstakingly checked to be still correct and valid .result
file updates.
2013-03-26 10:35:34 +01:00
unknown
a5ad8d15f6 MDEV-4121: binlog.binlog_row_binlog sporadic test failure
Add a wait for binlog checkpoint to avoid thread scheduling
giving different binlog order at random.
2013-01-31 11:29:58 +01:00
Sergei Golubchik
0af4b6c6ee 5.5 merge 2013-01-29 15:10:47 +01:00
Sergei Golubchik
aca8e7ed6b 5.3 merge 2013-01-15 19:07:46 +01:00
Sergei Golubchik
4f67a14700 5.2->5.3 merge 2013-01-10 15:40:21 +01:00
Shivji Kumar Jha
7c7de142a3 BUG#14659685 - main.mysqlbinlog_row_myisam and
main.mysqlbinlog_row_innodb are skipped by mtr

=== Problem ===

The following tests are wrongly placed in main suite and as a
result these are not run with proper binlog format combinations.
Some are always skipped by mtr.
1) mysqlbinlog_row_myisam
2) mysqlbinlog_row_innodb
3) mysqlbinlog_row.test
4) mysqlbinlog_row_trans.test
5) mysqlbinlog-cp932
6) mysqlbinlog2
7) mysqlbinlog_base64

=== Background ===

mtr runs the tests placed in main suite with binlog format=stmt.
Those that need to be tested against binlog format=row or mixed
or more than one binlog format and require only one mysql server
are placed in binlog suite. mtr runs tests in binlog suite with
all three binlog formats(stmt,row and mixed).

=== Fix ===


1) Moved the test listed in problem section above to binlog suite.
2) Added prefix "binlog_" to the name of each test case moved.
   Renamed the coresponding result files and option files accordingly. 


mysql-test/extra/binlog_tests/mysqlbinlog_row_engine.inc:
  include file for mysqlbinlog_row_myisam.test and 
  mysqlbinlog_row_myisam.test which are being moved to
  binlog suite.
mysql-test/suite/binlog/r/binlog_mysqlbinlog-cp932.result:
  result file for mysqlbinlog-cp932.test which is being moved to
  binlog suite.
mysql-test/suite/binlog/r/binlog_mysqlbinlog2.result:
  result file for mysqlbinlog2.test which is being moved to
  binlog suite.
mysql-test/suite/binlog/r/binlog_mysqlbinlog_base64.result:
  result file for mysqlbinlog_base64.test which is being moved to
  binlog suite.
mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result:
  result file for mysqlbinlog_row.test which is being moved to
  binlog suite.
mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result:
  result file for mysqlbinlog_row_innodb.test which is being moved to
  binlog suite.
mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result:
  result file for mysqlbinlog_row_myisam.test which is being moved to
  binlog suite.
mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_trans.result:
  result file for mysqlbinlog_row_trans.test which is being moved to
  binlog suite.
mysql-test/suite/binlog/t/binlog_mysqlbinlog-cp932-master.opt:
  option file for mysqlbinlog-cp932.test which is being moved to
  binlog suite.
mysql-test/suite/binlog/t/binlog_mysqlbinlog-cp932.test:
  the test requires binlog format=stmt or mixed. Since, it was placed in
  main suite earlier, it was only run with binlog format=stmt, and hence
  this test was never run with binlog format=mixed.
mysql-test/suite/binlog/t/binlog_mysqlbinlog2.test:
  the test requires binlog format=stmt or mixed. Since, it was placed in
  main suite earlier, it was only run with binlog format=stmt, and hence
  this test was never run with binlog format=mixed.
mysql-test/suite/binlog/t/binlog_mysqlbinlog_base64.test:
  the test requires binlog format=row. Since, it was placed in main
  suite earlier, it was only run with binlog format=stmt, and hence
  this test was always skipped by mtr.
mysql-test/suite/binlog/t/binlog_mysqlbinlog_row.test:
  the test requires binlog format=row. Since, it was placed in main
  suite earlier, it was only run with binlog format=stmt, and hence
  this test was always skipped by mtr.
mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_innodb.test:
  the test requires binlog format=row. Since, it was placed in main
  suite earlier, it was only run with binlog format=stmt, and hence
  this test was always skipped by mtr.
mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_myisam.test:
  the test requires binlog format=row. Since, it was placed in main
  suite earlier, it was only run with binlog format=stmt, and hence
  this test was always skipped by mtr.
mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_trans.test:
  the test requires binlog format=row. Since, it was placed in main
  suite earlier, it was only run with binlog format=stmt, and hence
  this test was always skipped by mtr.
2012-10-30 10:40:07 +05:30
Michael Widenius
620d14f8c3 Automatic merge 2012-09-22 17:11:40 +03:00
Michael Widenius
ae5bc05988 Fix for MDEV-533: Confusing error code when doing auto-increment insert for out-of-range values
create table t1 (a smallint primary key auto_increment);
insert into t1 values(32767);
insert into t1 values(NULL);
ERROR 1062 (23000): Duplicate entry '32767' for key 'PRIMARY

Now on always gets error HA_ERR_AUTOINC_RANGE=167 "Out of range value for column", independent of
store engine, SQL Mode or number of inserted rows. This is an unique error that is easier to test for in replication.

Another bug fix is that we now get an error when trying to insert a too big auto-generated value, even in non-strict mode.
Before one get insted the max column value inserted.
This patch also fixes some issues with inserting negative numbers in an auto-increment column.
Fixed the ER_DUP_ENTRY and HA_ERR_AUTOINC_ERANGE are compared the same between master and slave.
This ensures that replication works between an old server to a new slave for auto-increment overflow errors.
Added SQLSTATE errors for handler errors

Smaller bug fixes:
* Added warnings for duplicate key errors when using INSERT IGNORE
* Fixed bug when using --skip-log-bin followed by --log-bin, which did set log-bin to "0"
* Allow one to see how cmake is called by using --just-print --just-configure


BUILD/FINISH.sh:
  --just-print --just-configure now shows how cmake would be invoked. Good for understanding parameters to cmake.
cmake/configure.pl:
  --just-print --just-configure now shows how cmake would be invoked. Good for understanding parameters to cmake.
include/CMakeLists.txt:
  Added handler_state.h
include/handler_state.h:
  SQLSTATE for handler error messages.
  Required for HA_ERR_AUTOINC_ERANGE, but solves also some other cases.
mysql-test/extra/binlog_tests/binlog.test:
  Fixed old wrong behaviour
  Added more tests
mysql-test/extra/binlog_tests/binlog_insert_delayed.test:
  Reset binary log to only print what's necessary in show_binlog_events
mysql-test/extra/rpl_tests/rpl_auto_increment.test:
  Update to new error codes
mysql-test/extra/rpl_tests/rpl_insert_delayed.test:
  Ignore warnings as this depends on how the test is run
mysql-test/include/strict_autoinc.inc:
  On now gets an error on overflow
mysql-test/r/auto_increment.result:
  Update results after fixing error message
mysql-test/r/auto_increment_ranges_innodb.result:
  Test new behaviour
mysql-test/r/auto_increment_ranges_myisam.result:
  Test new behaviour
mysql-test/r/commit_1innodb.result:
  Added warnings for duplicate key error
mysql-test/r/create.result:
  Added warnings for duplicate key error
mysql-test/r/insert.result:
  Added warnings for duplicate key error
mysql-test/r/insert_select.result:
  Added warnings for duplicate key error
mysql-test/r/insert_update.result:
  Added warnings for duplicate key error
mysql-test/r/mix2_myisam.result:
  Added warnings for duplicate key error
mysql-test/r/myisam_mrr.result:
  Added warnings for duplicate key error
mysql-test/r/null_key.result:
  Added warnings for duplicate key error
mysql-test/r/replace.result:
  Update to new error codes
mysql-test/r/strict_autoinc_1myisam.result:
  Update to new error codes
mysql-test/r/strict_autoinc_2innodb.result:
  Update to new error codes
mysql-test/r/strict_autoinc_3heap.result:
  Update to new error codes
mysql-test/r/trigger.result:
  Added warnings for duplicate key error
mysql-test/r/xtradb_mrr.result:
  Added warnings for duplicate key error
mysql-test/suite/binlog/r/binlog_innodb_row.result:
  Updated result
mysql-test/suite/binlog/r/binlog_row_binlog.result:
  Out of range data for auto-increment is not inserted anymore
mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result:
  Updated result
mysql-test/suite/binlog/r/binlog_stm_binlog.result:
  Out of range data for auto-increment is not inserted anymore
mysql-test/suite/binlog/r/binlog_unsafe.result:
  Updated result
mysql-test/suite/innodb/r/innodb-autoinc.result:
  Update to new error codes
mysql-test/suite/innodb/r/innodb-lock.result:
  Updated results
mysql-test/suite/innodb/r/innodb.result:
  Updated results
mysql-test/suite/innodb/r/innodb_bug56947.result:
  Updated results
mysql-test/suite/innodb/r/innodb_mysql.result:
  Updated results
mysql-test/suite/innodb/t/innodb-autoinc.test:
  Update to new error codes
mysql-test/suite/maria/maria3.result:
  Updated result
mysql-test/suite/maria/mrr.result:
  Updated result
mysql-test/suite/optimizer_unfixed_bugs/r/bug43617.result:
  Updated result
mysql-test/suite/rpl/r/rpl_auto_increment.result:
  Update to new error codes
mysql-test/suite/rpl/r/rpl_insert_delayed,stmt.rdiff:
  Updated results
mysql-test/suite/rpl/r/rpl_loaddatalocal.result:
  Updated results
mysql-test/t/auto_increment.test:
  Update to new error codes
mysql-test/t/auto_increment_ranges.inc:
  Test new behaviour
mysql-test/t/auto_increment_ranges_innodb.test:
  Test new behaviour
mysql-test/t/auto_increment_ranges_myisam.test:
  Test new behaviour
mysql-test/t/replace.test:
  Update to new error codes
mysys/my_getopt.c:
  Fixed bug when using --skip-log-bin followed by --log-bin, which did set log-bin to "0"
sql/handler.cc:
  Ignore negative values for signed auto-increment columns
  Always give an error if we get an overflow for an auto-increment-column (instead of inserting the max value)
  Ensure that the row number is correct for the out-of-range-value error message.
  
  
  ******
  Fixed wrong printing of column namn for "Out of range value" errors
  Fixed that INSERT_ID is correctly replicated also for out-of-range autoincrement values
  Fixed that print_keydup_error() can also be used to generate warnings
  ******
  Return HA_ERR_AUTOINC_ERANGE (167) instead of ER_WARN_DATA_OUT_OF_RANGE for auto-increment overflow
sql/handler.h:
  Allow INSERT IGNORE to continue also after out-of-range inserts.
  Fixed that print_keydup_error() can also be used to generate warnings
sql/log_event.cc:
  Added DBUG_PRINT
  Fixed the ER_AUTOINC_READ_FAILED, ER_DUP_ENTRY and HA_ERR_AUTOINC_ERANGE are compared the same between master and slave.
  This ensures that replication works between an old server to a new slave for auto-increment overflow errors.
sql/sql_insert.cc:
  Add warnings for duplicate key errors when using INSERT IGNORE
sql/sql_state.c:
  Added handler errors
sql/sql_table.cc:
  Update call to print_keydup_error()
storage/innobase/handler/ha_innodb.cc:
  Fixed increment handling of auto-increment columns to be consistent with rest of MariaDB.
storage/xtradb/handler/ha_innodb.cc:
  Fixed increment handling of auto-increment columns to be consistent with rest of MariaDB.
2012-09-18 15:14:19 +03:00
unknown
0697ee265f MDEV-181: XID crash recovery across binlog boundaries
Keep track of how many pending XIDs (transactions that are prepared in
storage engine and written into binlog, but not yet durably committed
on disk in the engine) there are in each binlog.

When the count of one binlog drops to zero, write a new binlog checkpoint
event, telling which is the oldest binlog with pending XIDs.

When doing XA recovery after a crash, check the last binlog checkpoint
event, and scan all binlog files from that point onwards for XIDs that
must be committed if found in prepared state inside engine.

Remove the code in binlog rotation that waits for all prepared XIDs to
be committed before writing a new binlog file (this is no longer necessary
when recovery can scan multiple binlog files).
2012-06-22 11:46:28 +02:00
Sergei Golubchik
38e3ae155d mysql-5.5 merge 2012-01-16 20:16:35 +01:00
Bjorn Munch
ef97f0ae46 Followup test fix after 13055685:
Un-needed replace_result accidentally messed up a variable used
  *if* not running parallel.
  Removed the bogus --replace_result
2011-11-09 09:58:18 +01:00
Sergei Golubchik
76f0b94bb0 merge with 5.3
sql/sql_insert.cc:
  CREATE ... IF NOT EXISTS may do nothing, but
  it is still not a failure. don't forget to my_ok it.
  ******
  CREATE ... IF NOT EXISTS may do nothing, but
  it is still not a failure. don't forget to my_ok it.
sql/sql_table.cc:
  small cleanup
  ******
  small cleanup
2011-10-19 21:45:18 +02:00
Michael Widenius
f34be18938 Merge with MariaDB 5.2 2011-05-10 18:17:43 +03:00
unknown
014b8e7f43 Backport MySQL WL#2540 into MariaDB.
Patch backported:

bzr diff
'-rrevid:alfranio.correia@oracle.com-20101121143257-se3vpqus73l4mum0
..revid:luis.soares@oracle.com-20101124111752-9b8260bd1qak87hr'
--old=lp:mysql-server --new=lp:mysql-server
2011-05-03 14:01:11 +02:00
unknown
c677fea7d0 Merge MariaDB 5.2.5 release into MariaDB-5.2-rpl. 2011-04-01 15:07:10 +02:00
Jon Olav Hauglid
f94e7288e3 Bug #11765416 (former 58381)
FAILED DROP DATABASE CAN BREAK STATEMENT BASED REPLICATION

The first phase of DROP DATABASE is to delete the tables in the database.
If deletion of one or more of the tables fail (e.g. due to a FOREIGN KEY
constraint), DROP DATABASE will be aborted. However, some tables could
still have been deleted. The problem was that nothing would be written
to the binary log in this case, so any slaves would not delete these tables.
Therefore the master and the slaves would get out of sync.

This patch fixes the problem by making sure that DROP TABLE is written
to the binary log for the tables that were in fact deleted by the failed
DROP DATABASE statement.

Test case added to binlog.binlog_database.test.
2011-03-15 11:49:14 +01:00
Bjorn Munch
b027d10438 Upmerge 11762407 (54999) with additions 2011-02-23 12:54:58 +01:00
Bjorn Munch
8b3f956020 Bug #11762407 54999: MTR GLOBAL SUPPRESSION HIDES SQL THREAD EXECUTION UNEXPECTED ERRORS
Removed the global suppression, added lots of local ones to affected tests
Re-commit, now kept "Slave SQL" at start of patterns.
2011-02-23 10:31:37 +01:00
unknown
32379aeba9 Merge Percona patch MWL#47 into mariadb 5.2-percona.
This patch adds options to annotate the binlog (and the mysqlbinlog
output) with the original SQL query for queries that are logged
using row-based replication.
2011-01-10 14:53:09 +01:00
Luis Soares
3cecccffaf BUG#58416
Automerging bzr bundle from bug report into latest 
mysql-5.1-bugteam.
2010-12-07 14:26:20 +00:00
Alfranio Correia
b28d2c25a7 merge mysql-5.5-bugteam(local) --> mysql-5.5-bugteam 2010-12-03 01:06:56 +00:00
unknown
cd64b23fcf Bug #57666 Unclear warning with broken text in error log on INSERT DELAYED
It is not necessary to support INSERT DELAYED for a single value insert,
while we do not support that for multi-values insert when binlog is
enabled in SBR.

The lock_type is upgrade to TL_WRITE from TL_WRITE_DELAYED for
INSERT DELAYED for single value insert as multi-values insert
did when binlog is enabled. Then it's safe. And binlog it as
INSERT without DELAYED.

mysql-test/extra/binlog_tests/binlog_insert_delayed.test:
  Added test case for bug#57666.
mysql-test/suite/binlog/r/binlog_row_binlog.result:
  Updated for bug#57666
mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result:
  Updated for bug#57666
mysql-test/suite/binlog/r/binlog_stm_binlog.result:
  Updated for bug#57666
mysql-test/suite/rpl/r/rpl_stm_insert_delayed.result:
  Updated for bug#57666
sql/sql_insert.cc:
  Updated code for the following things:
  1. Upgrade the lock_type to TL_WRITE from TL_WRITE_DELAYED
  for INSERT DELAYED for single value insert as multi-values
  insert did when binlog is enabled.
  2. Clear code to not binlog INSERT DELAYED STMT in SBR.
  3. Get rid of privilege check for log_on.
2010-11-29 11:04:16 +08:00
unknown
d08be72f75 Manual merge 2010-11-28 18:06:02 +08:00
unknown
f225470b39 BUG#54903 BINLOG statement toggles session variables
When using BINLOG statement to execute rows log events, session variables
foreign_key_checks and unique_checks are changed temporarily.  As each rows
log event has their own special session environment and its own
foreign_key_checks and unique_checks can be different from current session
which executing the BINLOG statement. But these variables are not restored
correctly after BINLOG statement. This problem will cause that the following
statements fail or generate unexpected data.

In this patch, code is added to backup and restore these two variables.
So BINLOG statement will not affect current session's variables again.


mysql-test/extra/binlog_tests/binlog.test:
  Add test to verify this patch.
mysql-test/suite/binlog/r/binlog_row_binlog.result:
  Add test to verify this patch.
mysql-test/suite/binlog/r/binlog_stm_binlog.result:
  Add test to verify this patch.
sql/sql_binlog.cc:
  Add code to backup and restore thd->options.
2010-11-28 17:43:36 +08:00
Luis Soares
6ce0bd8aff BUG#58416: binlog.binlog_row_failure_mixing_engines fails on
win x86 debug_max

The windows MTR run exhibited a different test execution 
ordering (due to the fact that in these platforms MTR is invoked
with --parallel > 1). This uncovered a bug in the aforementioned
test case, which is triggered by the following conditions:

  1. server is not restarted between two different tests;
  2. the test before binlog.binlog_row_failure_mixing_engines
     issues flush logs;
  3. binlog.binlog_row_failure_mixing_engines uses binlog
     positions to limit the output of show_binlog_events;
  4. binlog.binlog_row_failure_mixing_engines does not state which
     binlog file to use, thence it uses a wrong binlog file with
     the correct position.

There are two possible fixes: 1. make sure that the test start 
from a clean slate - binlog wise; 2. in addition to the position, 
also state the binary log file before sourcing 
show_binlog_events.inc .

We go for fix #1, ie, deploy a RESET MASTER before the test is 
actually started.
2010-11-27 11:51:07 +00:00
Bjorn Munch
ef4458af07 Tests: many if/while expresissons simplified after 57276 2010-11-17 11:16:13 +01:00
Alfranio Correia
3f5a9c7ea0 BUG#57275 binlog_cache_size affects trx- and stmt-cache and gets twice the expected memory
After the WL#2687, the binlog_cache_size and max_binlog_cache_size affect both the
stmt-cache and the trx-cache. This means that the resource used is twice the amount
expected/defined by the user.
      
The binlog_cache_use is incremented when the stmt-cache or the trx-cache is used
and binlog_cache_disk_use is incremented when the disk space from the stmt-cache or the
trx-cache is used. This behavior does not allow to distinguish which cache may be harming
performance due to the extra disk accesses and needs to have its in-memory cache
increased.
      
To fix the problem, we introduced two new options and status variables related to the
stmt-cache:
      
  Options:
      
    . binlog_stmt_cache_size
    . max_binlog_stmt_cache_size
      
    Status Variables:
      
    . binlog_stmt_cache_use
    . binlog_stmt_cache_disk_use

So there are

  . binlog_cache_size that defines the size of the transactional cache for
  updates to transactional engines for the binary log.

  . binlog_stmt_cache_size that defines the size of the statement cache for
  updates to non-transactional engines for the binary log.

  . max_binlog_cache_size that sets the total size of the transactional
  cache.

  . max_binlog_stmt_cache_size that sets the total size of the statement
  cache.

  . binlog_cache_use that identifies the number of transactions that used the
  temporary transactional binary log cache.

  . binlog_cache_disk_use that identifies the number of transactions that used
  the temporary transactional binary log cache but that exceeded the value of
  binlog_cache_size.

  . binlog_stmt_cache_use that identifies the number of statements that used the
  temporary non-transactional binary log cache.

  . binlog_stmt_cache_disk_use that identifies the number of statements that used
  the temporary non-transactional binary log cache but that exceeded the value of
  binlog_stmt_cache_size.

include/my_sys.h:
  Updated message on disk_writes' usage.
mysql-test/extra/binlog_tests/binlog_cache_stat.test:
  Updated the test case and added code to check the new status variables
  binlog_stmt_cache_use and binlog_stmt_cache_disk_use.
mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test:
  Updated the test case to use the new system variables max_binlog_stmt_cache_size and binlog_stmt_cache_size.
mysql-test/r/mysqld--help-notwin.result:
  Updated the result file.
mysql-test/suite/binlog/r/binlog_mixed_cache_stat.result:
  Updated the result file.
mysql-test/suite/binlog/r/binlog_row_cache_stat.result:
  Updated the result file.
mysql-test/suite/binlog/r/binlog_stm_cache_stat.result:
  Updated the result file.
mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result:
  Update the result file.
mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result:
  Update the result file.
mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result:
  Updated the result file.
mysql-test/suite/sys_vars/inc/binlog_stmt_cache_size_basic.inc:
  Added a test case to check the binlog_stmt_cache_size.
mysql-test/suite/sys_vars/r/binlog_stmt_cache_size_basic_32.result:
  Updated the result file.
mysql-test/suite/sys_vars/r/binlog_stmt_cache_size_basic_64.result:
  Updated the result file.
mysql-test/suite/sys_vars/r/max_binlog_stmt_cache_size_basic.result:
  Updated the result file.
mysql-test/suite/sys_vars/t/binlog_stmt_cache_size_basic_32.test:
  Added a test case to check the binlog_stmt_cache_size.
mysql-test/suite/sys_vars/t/binlog_stmt_cache_size_basic_64.test:
  Added a test case to check the binlog_stmt_cache_size.
mysql-test/suite/sys_vars/t/max_binlog_cache_size_func-master.opt:
  Removed because there is no test case max_binlog_cache_size_func.
mysql-test/suite/sys_vars/t/max_binlog_stmt_cache_size_basic.test:
  Added a test case to check the system variable max_binlog_stmt_cache_size.
sql/log.cc:
  There two main changes in here:
  
    . Changed the set_write_error() as an error message is set according
    to the type of the cache.
  
    . Created the function set_binlog_cache_info where references to the
    appropriate status and system variables are set and the server can
    smoothly compute statistics and set the maximum size for each cache.
sql/log.h:
  Changed the signature of the function in order to identify the error message
  to be printed out as there is a different error code for each type of cache.
sql/mysqld.cc:
  Added new status variables binlog_stmt_cache_use and binlog_stmt_cache_disk_use.
sql/mysqld.h:
  Added new system variables max_binlog_stmt_cache_size and binlog_stmt_cache_size.
sql/share/errmsg-utf8.txt:
  Added new error message related to the statement cache.
sql/sys_vars.cc:
  Added new system variables max_binlog_stmt_cache_size and binlog_stmt_cache_size.
2010-11-05 17:42:37 +00:00
Alfranio Correia
2d84c1553c BUG#56343 binlog_cache_use status is bigger than expected
The binlog_cache_use is incremented twice when changes to a transactional table
are committed, i.e. TC_LOG_BINLOG::log_xid calls is called. The problem happens
because log_xid calls both binlog_flush_stmt_cache and binlog_flush_trx_cache
without checking if such caches are empty thus unintentionally increasing the
binlog_cache_use value twice.

Although not explicitly mentioned in the bug, the binlog_cache_disk_use presents
the same problem.

The binlog_cache_use and binlog_cache_disk_use are status variables that are
incremented when transactional (i.e. trx-cache) or non-transactional (i.e.
stmt-cache) changes are committed. They are used to compute the ratio between
the use of disk and memory while gathering updates for a transaction.

The problem reported is fixed by avoiding incrementing the binlog_cache_use
and binlog_cache_disk_use if a cache is empty. We also have decided to increment
both variables when a cache is truncated as the cache is used although its
content is discarded and is not written to the binary log.

In this patch, we take the opportunity to re-organize the code around the
function binlog_flush_trx_cache and binlog_flush_stmt_cache.

mysql-test/extra/binlog_tests/binlog_cache_stat.test:
  Updated the test case with comments and additional tests to check both
  transactional and non-transactional changes and what happens when a 
  is transaction either committed or aborted.
mysql-test/suite/binlog/r/binlog_innodb.result:
  Updated the result file.
mysql-test/suite/binlog/r/binlog_mixed_cache_stat.result:
  Updated the result file.
mysql-test/suite/binlog/r/binlog_row_cache_stat.result:
  Updated the result file.
mysql-test/suite/binlog/r/binlog_stm_cache_stat.result:
  Updated the result file.
mysql-test/suite/binlog/t/binlog_mixed_cache_stat.test:
  Updated the test case with a new source file.
mysql-test/suite/binlog/t/binlog_row_cache_stat.test:
  Updated the test case with a new source file.
mysql-test/suite/binlog/t/binlog_stm_cache_stat.test:
  Updated the test case with a new source file.
sql/log.cc:
  There are four changes in here:
  
    . Computed statistics on binlog_cache_use and binlog_cache_disk_use while
    resting the cache.
  
    . Refactored the code so binlog_flush_cache handles both the trx-cache and
    stmt-cache.
  
    . There are functions that encapsulate the calls to binlog_flush_cache and
    make easier to read the code.
  
    . binlog_commit_flush_stmt_cache is now taking into account the result:
    success or error.
sql/log_event.h:
  Guaranteed Xid_log_event is always classified as a transactional event.
2010-11-05 13:58:05 +00:00
Bjorn Munch
33e78dc233 merge from 5.5 2010-10-21 11:20:53 +02:00
Bjorn Munch
88d43dfcc8 upmerge and adapt follow-up to 55582 2010-10-21 09:37:10 +02:00
Alfranio Correia
8504580ced BUG#56343 binlog_cache_use status is bigger than expected
The binlog_cache_use is incremented twice when changes to a transactional table
are committed, i.e. TC_LOG_BINLOG::log_xid calls is called. The problem happens
because log_xid calls both binlog_flush_stmt_cache and binlog_flush_trx_cache
without checking if such caches are empty thus unintentionally increasing the
binlog_cache_use value twice.

To fix the problem we avoided incrementing the binlog_cache_use if the cache is
empty. We also decided to increment binlog_cache_use when the cache is truncated
as the cache is used although its content is discarded and is not written to the
binary log.

Note that binlog_cache_use is incremented for both types of cache, transactional
and non-transactional and that the behavior presented in this patch also applies
to the binlog_cache_disk_use.

Finally, we re-organized the code around the functions binlog_flush_trx_cache and
binlog_flush_stmt_cache.

mysql-test/extra/binlog_tests/binlog_cache_stat.test:
  Updated the test case with comments and additional tests to check both
  transactional and non-transactional changes and what happens when a 
  is transaction either committed or aborted.
mysql-test/suite/binlog/r/binlog_innodb.result:
  Updated the result file.
mysql-test/suite/binlog/r/binlog_mixed_cache_stat.result:
  Updated the result file.
mysql-test/suite/binlog/r/binlog_row_cache_stat.result:
  Updated the result file.
mysql-test/suite/binlog/r/binlog_stm_cache_stat.result:
  Updated the result file.
mysql-test/suite/binlog/t/binlog_mixed_cache_stat.test:
  Updated the test case with a new source file.
mysql-test/suite/binlog/t/binlog_row_cache_stat.test:
  Updated the test case with a new source file.
mysql-test/suite/binlog/t/binlog_stm_cache_stat.test:
  Updated the test case with a new source file.
sql/log_event.cc:
  Introduced debug information to check if Query_log_event("BEGIN"),
  Query_log_event("COMMIT") and Query_log_event("ROLLBACK").
sql/log_event.h:
  Guaranteed Xid_log_event is always classified as a transactional event.
2010-10-06 09:34:49 +01:00
unknown
89f3fec1e3 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.


mysql-test/extra/binlog_tests/binlog_insert_delayed.test:
  Updated the test file to test multi INSERT DELAYED statement
  is no longer causes an unsafe warning and binlogged as INSERT
  without DELAYED.
mysql-test/extra/rpl_tests/create_recursive_construct.inc:
  Updated for the patch of bug#54579.
mysql-test/suite/binlog/r/binlog_row_binlog.result:
  Updated for the patch of bug#54579.
mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result:
  Test result for BUG#54579.
mysql-test/suite/binlog/r/binlog_stm_binlog.result:
  Updated for the patch of bug#54579.
mysql-test/suite/binlog/r/binlog_unsafe.result:
  Updated for the patch of bug#54579.
mysql-test/suite/binlog/t/binlog_unsafe.test:
  Updated for the patch of bug#54579.
sql/sql_insert.cc:
  Added code to genetate a new query string for removing
  DELAYED keyword for multi INSERT DEALAYED statement.
sql/sql_yacc.yy:
  Added code to record the DELAYED keyword position and remove the setting
  of unsafe statement for INSERT DELAYED statement
2010-08-30 14:03:28 +08:00
Alfranio Correia
ac6026ce27 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
unknown
d0d8bbed5e 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
Andrei Elkin
b283ffcd53 merging for bug#54935 to trunk-bugfixing 2010-07-17 14:07:36 +03:00
Andrei Elkin
65ef0f4185 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
30e2c6f19b bug#54935
applying bundle made for next-mr-bugfixing to trunk-bugfixing branch of the bug
2010-07-16 21:25:00 +03:00
Luis Soares
e0ece40b64 BUG#54842: DROP TEMPORARY TABLE not binlogged after manual
switching binlog format to ROW

BUG 52616 fixed the case which the user would switch from STMT to
ROW binlog format, but the server would silently ignore it. After
that fix thd->is_current_stmt_binlog_format_row() reports correct
value at logging time and events are logged in ROW (as expected)
instead of STMT as they were previously and wrongly logged.

However, the fix was only partially complete, because on
disconnect, at THD cleanup, the implicit logging of temporary
tables is conditionally performed. If the binlog_format==ROW and
thd->is_current_stmt_binlog_format_row() is true then DROPs are
not logged. Given that the user can switch from STMT to ROW, this
is wrong because the server cannot tell, just by relying on the
ROW binlog format, that the tables have been dropped before. This
is effectively similar to the MIXED scenario when a switch from
STMT to ROW is triggered.

We fix this by removing this condition from
close_temporary_tables.

mysql-test/extra/binlog_tests/drop_temp_table.test:
  Added binlog test case.
mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result:
  Result changes because:
  - there is a missing drop on three temporary tables
  - it now contains results for the test added
mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result:
  Result now contains the implicit drop for the temporary table.
mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result:
  Result file changed because it now contains results for added
  test case.
mysql-test/suite/rpl/r/rpl_drop_temp.result:
  Result file changed because it now contains results for added
  test case.
mysql-test/suite/rpl/t/rpl_drop_temp.test:
  Added replication test case.
sql/sql_base.cc:
  Removed the condition that would make the server to skip
  logging implicit drops when ROW binary log format mode was 
  in use.
  Additionally, deployed DBUG_ENTER/RETURN macros.
2010-06-29 11:54:58 +01:00
Konstantin Osipov
cc6dabba37 Merge trunk-bugfixing -> trunk-runtime 2010-06-17 17:31:51 +04:00
Jon Olav Hauglid
142a162c66 manual merge from mysql-trunk-bugfixing
Conflicts:
Text conflict in mysql-test/r/archive.result
Contents conflict in mysql-test/r/innodb_bug38231.result
Text conflict in mysql-test/r/mdl_sync.result
Text conflict in mysql-test/suite/binlog/t/disabled.def
Text conflict in mysql-test/suite/rpl_ndb/r/rpl_ndb_binlog_format_errors.result
Text conflict in mysql-test/t/archive.test
Contents conflict in mysql-test/t/innodb_bug38231.test
Text conflict in mysql-test/t/mdl_sync.test
Text conflict in sql/sp_head.cc
Text conflict in sql/sql_show.cc
Text conflict in sql/table.cc
Text conflict in sql/table.h
2010-06-06 13:19:29 +02:00
unknown
71e534542b Manual merge 2010-05-26 22:34:25 +08:00
Davi Arnaut
4f18083b08 Bug#42643: InnoDB does not support replication of TRUNCATE TABLE
The problem was that TRUNCATE TABLE didn't take a exclusive
lock on a table if it resorted to truncating via delete of
all rows in the table. Specifically for InnoDB tables, this
could break proper isolation as InnoDB ends up aborting some
granted locks when truncating a table.

The solution is to take a exclusive metadata lock before
TRUNCATE TABLE can proceed. This guarantees that no other
transaction is using the table.

Incompatible change: Truncate via delete no longer fails
if sql_safe_updates is activated (this was a undocumented
side effect).

libmysqld/CMakeLists.txt:
  Add new files to the build list.
libmysqld/Makefile.am:
  Add new files to the build list.
mysql-test/extra/binlog_tests/binlog_truncate.test:
  Add test case for Bug#42643
mysql-test/include/mix1.inc:
  Update test case as TRUNCATE TABLE now grabs a exclusive lock.
  Ensure that TRUNCATE waits for granted locks on the table.
mysql-test/suite/binlog/t/binlog_truncate_innodb.test:
  As with other data modifying statements, TRUNCATE is still not
  possible in a transaction with isolation level READ COMMITTED
  or READ UNCOMMITED. It would be possible to implement so, but
  it is not worth the effort.
mysql-test/suite/binlog/t/binlog_truncate_myisam.test:
  Test under different binlog formats.
mysql-test/suite/binlog/t/disabled.def:
  Re-enable test case.
mysql-test/t/innodb_bug38231.test:
  Truncate no longer works with row-level locks.
mysql-test/t/mdl_sync.test:
  Ensure that a acquired lock is not given up due to a conflict.
mysql-test/t/partition_innodb_semi_consistent.test:
  End transaction as to release metadata locks.
mysql-test/t/truncate.test:
  A metadata lock is now taken before the object is verified.
sql/CMakeLists.txt:
  Add new files to the build list.
sql/Makefile.am:
  Add new files to the build list.
sql/datadict.cc:
  Introduce a new file specific for data dictionary operations.
sql/datadict.h:
  Add header file.
sql/sql_base.cc:
  Rename data dictionary function.
sql/sql_bitmap.h:
  Include dependency.
sql/sql_delete.cc:
  Move away from relying on mysql_delete() to delete all rows of
  a table. Thus, move any bits related to truncate to sql_truncate.cc
sql/sql_delete.h:
  Remove parameter.
sql/sql_parse.cc:
  Add protection against the global read lock -- a intention
  exclusive lock can be acquired in the truncate path.
sql/sql_show.cc:
  Add sync point for testing scenarios where a pending flush
  is ignored.
sql/sql_truncate.cc:
  Acquire a shared metadata lock before accessing table metadata.
  Upgrade the lock to a exclusive one if the table can be re-created.
  Rework binlog rules to better reflect the requirements.
sql/sql_yacc.yy:
  Set appropriate lock types for table to be truncated.
sql/table.h:
  Move to data dictionary header.
2010-05-25 17:01:38 -03:00
unknown
7e80f1c5dc Bug #49741 test files contain explicit references to bin/relay-log positions
Some of the test cases reference to binlog position and
these position numbers are written into result explicitly.
It is difficult to maintain if log event format changes. 

There are a couple of cases explicit position number appears, 
we handle them in different ways
A. 'CHANGE MASTER ...' with MASTER_LOG_POS or/and RELAY_LOG_POS options
   Use --replace_result to mask them.
B. 'SHOW BINLOG EVENT ...'
   Replaced by show_binlog_events.inc or wait_for_binlog_event.inc. 
   show_binlog_events.inc file's function is enhanced by given
   $binlog_file and $binlog_limit.
C. 'SHOW SLAVE STATUS', 'show_slave_status.inc' and 'show_slave_status2.inc'
   For the test cases just care a few items in the result of 'SHOW SLAVE STATUS',
   only the items related to each test case are showed.
   'show_slave_status.inc' is rebuild, only the given items in $status_items
   will be showed.
   'check_slave_is_running.inc' and 'check_slave_no_error.inc'
   and 'check_slave_param.inc' are auxiliary files helping
   to show running status and error information easily.


mysql-test/extra/binlog_tests/binlog.test:
  It only cares whether current binlog file index is changed, so it is ok
  with 'show_master_status.inc' instead of 'show mater status'.
mysql-test/extra/binlog_tests/blackhole.test:
  Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/extra/rpl_tests/rpl_deadlock.test:
  Use 'check_slave_is_running.inc' instead of 'show_slave_status2.inc'.
mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test:
  Use 'check_slave_is_running.inc' instead of 'show slave status' statement.
mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test:
  Use 'wait_for_slave_sql_error.inc' and 'ait_for_slave_sql_error_and_skip.inc' instead of 'show slave status'.
mysql-test/extra/rpl_tests/rpl_flsh_tbls.test:
  Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test:
  It is need now to give a error number, so use 'wait_for_slave_io_to_stop.inc'
  instead of 'wait_for_slave_io_error.inc'.
mysql-test/extra/rpl_tests/rpl_insert_delayed.test:
  Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/extra/rpl_tests/rpl_log.test:
  Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
  se 'check_slave_is_running.inc' instead of 'show slave status' statement.
mysql-test/extra/rpl_tests/rpl_max_relay_size.test:
  se 'check_slave_is_running.inc' instead of 'show slave status' statement.
mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test:
  Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/extra/rpl_tests/rpl_reset_slave.test:
  Use 'show_slave_status.inc' instead of 'show_slave_status2.inc' statement.
  Use 'check_slave_no_error.inc' to simplify the check that there is no error.
mysql-test/extra/rpl_tests/rpl_row_basic.test:
  Use 'check_slave_is_running.inc' to verify that Slave threads are running well.
  Use 'wait_for_slave_sql_error.inc' to wait the given sql thread error happening.
mysql-test/extra/rpl_tests/rpl_row_tabledefs.test:
  Use 'show_slave_error_status_and_skip.inc' instead of 'show slave status'.
mysql-test/include/check_slave_is_running.inc:
  To make sure both sql and io thread are running well. If not, the test will be aborted.
mysql-test/include/check_slave_no_error.inc:
  To make sure both sql and io thread have no error. If not, the test will be aborted.
mysql-test/include/get_relay_log_pos.inc:
  According to the position of a log event in master binlog file,
  find the peer position of a log event in relay log file.
mysql-test/include/rpl_stmt_seq.inc:
  Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/include/show_binlog_events.inc:
  Add two options $binlog_file and $binlog_limit for showing binlog events from different binlog files or/and given different limits on position or row number.
mysql-test/include/show_rpl_debug_info.inc:
  Add 'SELECT NOW()' in the debug information.
mysql-test/include/show_slave_status.inc:
  It's more clean and tidy Only the given columns of slave status are printed.
mysql-test/include/test_fieldsize.inc:
  Use 'wait_for_slave_sql_error.inc' to wait the given sql thread error happening.
  There is no need to print the result of 'show slave stutus'.
mysql-test/include/wait_for_binlog_event.inc:
  Use show_rpl_debug_info.inc instead of 'SHOW BINLOG EVENTS'.
mysql-test/include/wait_for_slave_io_error.inc:
  Add $slave_io_errno and $show_slave_io_error, it waits only a given error.
mysql-test/include/wait_for_slave_param.inc:
  Use die instead of exit.
mysql-test/include/wait_for_slave_sql_error.inc:
  Add $slave_sql_errno and $show_slave_sql_error, it waits only a given error.
mysql-test/include/wait_for_status_var.inc:
  Use die instead of exit.
mysql-test/r/flush_block_commit_notembedded.result:
  It checks whether somethings are binlogged, so we using 'show_binlog_event.inc' instead of 'show master status'.
mysql-test/r/multi_update.result:
  It checks whether somethings are binlogged, so we using 'show_binlog_event.inc' instead of 'show master status'.
mysql-test/suite/binlog/r/binlog_innodb.result:
  It checks whether somethings are binlogged, so we using 'show_binlog_event.inc' instead of 'show master status'.
mysql-test/suite/binlog/r/binlog_row_binlog.result:
  Position in the result of 'show master status' is replaced by '#'.
mysql-test/suite/binlog/r/binlog_stm_binlog.result:
  Position in the result of 'show master status' is replaced by '#'.
mysql-test/suite/binlog/t/binlog_innodb.test:
  It checks whether somethings are binlogged, so we use 'show_binlog_event.inc' instead of 'show master status'.
mysql-test/suite/binlog/t/binlog_stm_binlog.test:
  Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/bugs/r/rpl_bug36391.result:
  Position in the result of 'show master status' is replaced by '#'.
mysql-test/suite/bugs/t/rpl_bug12691.test:
  Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/bugs/t/rpl_bug36391.test:
  'show master status' is replaced by 'show_master_status.inc'.
  Position in the result of 'show master status' is replaced by '#'.
mysql-test/suite/engines/funcs/r/rpl_000015.result:
  It checks whether somethings are binlogged, 
  so we using 'show_binlog_event.inc' instead of 'show master status'.
mysql-test/suite/engines/funcs/t/rpl_000015.test:
  Use 'check_slave_is_running.inc' to verify that Slave threads are running well.
mysql-test/suite/engines/funcs/t/rpl_REDIRECT.test:
  Use 'query_vertical SHOW SLAVE STATUS' instead of 'show slave status'.
  There is no status columns in the result file, for no slave exists on master's server.
mysql-test/suite/engines/funcs/t/rpl_change_master.test:
  This test just care whether Read_Master_Log_Pos is equal to Exec_Master_Log_Pos after 'CHANGE MASTER ..'. So 'show slave status' is removed and just check the value of Read_Master_Log_Pos and Exec_Master_Log_Pos.
mysql-test/suite/engines/funcs/t/rpl_empty_master_crash.test:
  We doesn't really need the statement.
mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test:
  Just show Relay_Log_File, running status and error informations.
  Use 'check_slave_is_running.inc' to verify that Slave threads are running well.
mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test:
  Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/engines/funcs/t/rpl_log_pos.test:
  Mask the explicit positions in the result file.
  Use 'check_slave_no_error.inc' to simplify the check that there is no error.
  Use 'wait_for_slave_sql_error.inc' to wait the given sql thread error happening.
  There is no need to print the result of 'show slave stutus'.
mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test:
  Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/engines/funcs/t/rpl_row_drop.test:
  Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test:
  Use 'wait_for_slave_sql_error.inc' to wait the given sql thread error happening.
  There is no need to print the result of 'show slave stutus'.
mysql-test/suite/engines/funcs/t/rpl_row_until.test:
  Use 'check_slave_param.inc' to check whether SQL Thread stop at a right position, and use binlog position variables instead of explicit number in the 'CHANGE MASTER' statements.
  
  Mask the explicit binary log positions in the result file.
mysql-test/suite/engines/funcs/t/rpl_server_id1.test:
  Use 'wait_for_slave_sql_error.inc' to wait the given sql thread error happening.
  There is no need to print the result of 'show slave stutus'.
  Use 'check_slave_no_error.inc' to simplify the check that there is no error.
mysql-test/suite/engines/funcs/t/rpl_server_id2.test:
  It doesn't really need in this test.
mysql-test/suite/engines/funcs/t/rpl_slave_status.test:
  Use 'wait_for_slave_sql_error.inc' to wait the given sql thread error happening.
  There is no need to print the result of 'show slave stutus'.
mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test:
  Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/manual/t/rpl_replication_delay.test:
  Use 'show_slave_status.inc' instead of 'show slave status'.
mysql-test/suite/parts/t/rpl_partition.test:
  Use 'check_slave_is_running.inc' instead of 'show slave status' statement.
mysql-test/suite/rpl/include/rpl_mixed_ddl.inc:
  Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/rpl/include/rpl_mixed_dml.inc:
  Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/rpl/t/rpl_000015.test:
  Use 'show_slave_status.inc' instead of 'show_slave_status2.inc'.
mysql-test/suite/rpl/t/rpl_binlog_grant.test:
  Use 'wait_for_binlog_event.inc' instead of 'show binlog events' statement.
mysql-test/suite/rpl/t/rpl_bug33931.test:
  Use 'wait_for_slave_sql_error.inc' to wait the given sql thread error happening.
  There is no need to print the result of 'show slave stutus'.
mysql-test/suite/rpl/t/rpl_change_master.test:
  This test just care whether Read_Master_Log_Pos is equal to Exec_Master_Log_Pos after 'CHANGE MASTER ..'. So 'show slave status' is removed and just check the value of Read_Master_Log_Pos and Exec_Master_Log_Pos.
mysql-test/suite/rpl/t/rpl_critical_errors.test:
  Use 'wait_for_slave_sql_error.inc' to wait the given sql thread error happening.
  There is no need to print the result of 'show slave stutus'.
mysql-test/suite/rpl/t/rpl_dual_pos_advance.test:
  Mask the explicit position numbers in result file.
  It is restricted running on SBR, for it want to binlog 'set @a=1' statement.
mysql-test/suite/rpl/t/rpl_empty_master_crash.test:
  It doesn't need in this test.
mysql-test/suite/rpl/t/rpl_flushlog_loop.test:
  UUse 'check_slave_is_running.inc' and 'show_slave_status.inc' instead of 'show slave status' statement.
mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test:
  Use 'wait_for_slave_io_error.inc' to wait the given io thread error happening.
mysql-test/suite/rpl/t/rpl_grant.test:
  It doesn't need in this test.
mysql-test/suite/rpl/t/rpl_incident.test:
  Use 'check_slave_is_running.inc' instead of 'show slave status' statement.
mysql-test/suite/rpl/t/rpl_known_bugs_detection.test:
  Use 'wait_for_slave_sql_error.inc' to wait the given sql thread error happening.
  There is no need to print the result of 'show slave stutus'.
mysql-test/suite/rpl/t/rpl_loaddata_fatal.test:
  Use 'wait_for_slave_sql_error_and_skip.inc' to wait the given sql thread error happening and then skip the event. There is no need to print the result of 'show slave stutus'.
mysql-test/suite/rpl/t/rpl_log_pos.test:
  Use 'wait_for_slave_io_error.inc' to wait the given io thread error happening.
  There is no need to print the result of 'show slave status'.
mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test:
  Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/rpl/t/rpl_replicate_do.test:
  Use 'show_slave_status.inc' instead of 'show slave status'.
mysql-test/suite/rpl/t/rpl_rotate_logs.test:
  Use 'show_slave_status.inc' instead of 'show_slave_status2.inc'.
mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test:
  Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/rpl/t/rpl_row_create_table.test:
  Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/rpl/t/rpl_row_drop.test:
  Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/rpl/t/rpl_row_until.test:
  Use 'check_slave_param.inc' to check whether SQL Thread stop at a right position, and use binlog position variables instead of explicit number in the 'CHANGE MASTER' statements.
mysql-test/suite/rpl/t/rpl_skip_error.test:
  Use 'check_slave_is_running.inc' instead of 'show slave status' statement.
mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test:
  Use 'wait_for_slave_sql_error.inc' to wait the given sql thread error happening.
  There is no need to print the result of 'show slave status'.
mysql-test/suite/rpl/t/rpl_slave_skip.test:
  Use 'check_slave_param.inc' to check whether SQL Thread stop at a right position, and mask the explicit position number in the 'CHANGE MASTER' statements.
mysql-test/suite/rpl/t/rpl_sp.test:
  Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/rpl/t/rpl_ssl.test:
  Use 'show_slave_status.inc' instead of 'show slave status'.
mysql-test/suite/rpl/t/rpl_ssl1.test:
  Use 'show_slave_status.inc' instead of 'show slave status'.
mysql-test/suite/rpl/t/rpl_stm_until.test:
  Use 'check_slave_param.inc' to check whether SQL Thread stop at a right position, and use binlog position variables instead of explicit number in the 'CHANGE MASTER' statements.
mysql-test/suite/rpl/t/rpl_temporary_errors.test:
  Use 'check_slave_is_running.inc' instead of 'show slave status' statement.
mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test:
  Use 'wait_for_slave_sql_error.inc' to wait the given sql thread error happening.
  There is no need to print the result of 'show slave status'.
mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test:
  Use 'check_slave_is_running.inc' instead of 'show slave status' statement.
mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test:
  Use 'check_slave_is_running.inc' instead of 'show slave status' statement.
mysql-test/suite/rpl_ndb/t/rpl_ndb_idempotent.test:
  Use 'check_slave_is_running.inc' instead of 'show slave status' statement.
mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test:
  Mask master_log_pos and master_log_file
mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test:
  Use 'check_slave_is_running.inc' instead of 'show slave status' statement.
mysql-test/suite/rpl_ndb/t/rpl_truncate_7ndb.test:
  Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/t/alter_table-big.test:
  Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/t/create-big.test:
  Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/t/ctype_cp932_binlog_stm.test:
  Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/t/flush_block_commit_notembedded.test:
  It checks whether somethings are binlogged, 
  so we using 'show_binlog_event.inc' instead of 'show master status'.
mysql-test/t/multi_update.test:
  It checks whether somethings are binlogged, 
  so we using 'wait_binlog_event.inc' instead of 'show master status'.
mysql-test/t/sp_trans_log.test:
  Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
2010-05-24 21:54:08 +08:00
Alexey Kopytov
598cf5aec7 Manual merge of mysql-5.1-bugteam to mysql-trunk-merge.
Conflicts:

   conflict      Makefile.am
   conflict      mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result
   conflict      mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test
   conflict      sql/opt_sum.cc
   conflict      sql/set_var.cc
   conflict      sql/sql_base.cc
   conflict      sql/sql_priv.h
   conflict      sql/sql_show.cc
2010-05-24 00:41:18 +04:00
Andrei Elkin
efcc90b6eb Bug #50942 mix_innodb_myisam_side_effects.test is not deterministic
The test was used to fail because of 
 UPDATE t3,t4 SET t3.a=t4.a + bug27417(1);
did not prescribe the order of two row operations implied by the update.

Fixed with forcing the order with adding a where condition w/o
affecting the former bug fixes logics.

mysql-test/extra/binlog_tests/mix_innodb_myisam_side_effects.test:
  implemented the bug page suggestion to make a test deterministic.
mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result:
  results are updated and (!) corrected.
mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result:
  results are updated
2010-05-04 22:31:49 +03:00
Sven Sandberg
cf5ebc5821 BUG#50670: Slave stops with error code 1644
Clarified error messages related to unsafe statements:
 - avoid the internal technical term "row injection"
 - use 'binary log' instead of 'binlog'
 - avoid the word 'unsafeness'


mysql-test/extra/binlog_tests/blackhole.test:
  updated suppression pattern
mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test:
  updated suppression pattern
mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test:
  updated suppression pattern
mysql-test/extra/rpl_tests/rpl_insert_id.test:
  updated suppression pattern
mysql-test/extra/rpl_tests/rpl_loaddata.test:
  updated suppression pattern
mysql-test/extra/rpl_tests/rpl_mixing_engines.test:
  updated suppression pattern
mysql-test/extra/rpl_tests/rpl_start_stop_slave.test:
  updated suppression pattern
mysql-test/extra/rpl_tests/rpl_stm_000001.test:
  updated suppression pattern
mysql-test/extra/rpl_tests/rpl_stop_middle_group.test:
  updated suppression pattern
mysql-test/r/archive.result:
  updated result file
mysql-test/r/commit_1innodb.result:
  updated result file
mysql-test/r/ctype_cp932_binlog_stm.result:
  updated result file
mysql-test/r/partition_innodb_stmt.result:
  updated result file
mysql-test/suite/binlog/r/binlog_innodb.result:
  updated result file
mysql-test/suite/binlog/r/binlog_killed.result:
  updated result file
mysql-test/suite/binlog/r/binlog_multi_engine.result:
  updated result file
mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result:
  updated result file
mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result:
  updated result file
mysql-test/suite/binlog/r/binlog_stm_blackhole.result:
  updated result file
mysql-test/suite/binlog/r/binlog_stm_do_db.result:
  updated result file
mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result:
  updated result file
mysql-test/suite/binlog/r/binlog_stm_ps.result:
  updated result file
mysql-test/suite/binlog/r/binlog_stm_row.result:
  updated result file
mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result:
  updated result file
mysql-test/suite/binlog/r/binlog_unsafe.result:
  updated result file
mysql-test/suite/binlog/t/binlog_killed.test:
  updated suppression pattern
mysql-test/suite/binlog/t/binlog_multi_engine.test:
  updated suppression pattern
mysql-test/suite/binlog/t/binlog_statement_insert_delayed.test:
  updated suppression pattern
mysql-test/suite/binlog/t/binlog_stm_ps.test:
  updated suppression pattern
mysql-test/suite/binlog/t/binlog_stm_row.test:
  updated suppression pattern
mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test:
  updated suppression pattern
mysql-test/suite/binlog/t/binlog_tmp_table.test:
  updated suppression pattern
mysql-test/suite/binlog/t/binlog_unsafe.test:
  updated suppression pattern
mysql-test/suite/ndb/r/ndb_binlog_format.result:
  updated result file
mysql-test/suite/ndb/t/ndb_binlog_format.test:
  updated suppression pattern
mysql-test/suite/perfschema/r/binlog_stmt.result:
  updated result file
mysql-test/suite/perfschema/t/binlog_stmt.test:
  updated suppression pattern
mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result:
  updated result file
mysql-test/suite/rpl/r/rpl_blackhole.result:
  updated result file
mysql-test/suite/rpl/r/rpl_concurrency_error.result:
  updated result file
mysql-test/suite/rpl/r/rpl_get_lock.result:
  updated result file
mysql-test/suite/rpl/r/rpl_insert_id.result:
  updated result file
mysql-test/suite/rpl/r/rpl_insert_ignore.result:
  updated result file
mysql-test/suite/rpl/r/rpl_misc_functions.result:
  updated result file
mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result:
  updated result file
mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result:
  updated result file
mysql-test/suite/rpl/r/rpl_mysql_upgrade.result:
  updated result file
mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result:
  updated result file
mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result:
  updated result file
mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result:
  updated result file
mysql-test/suite/rpl/r/rpl_nondeterministic_functions.result:
  updated result file
mysql-test/suite/rpl/r/rpl_read_only.result:
  updated result file
mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result:
  updated result file
mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result:
  updated result file
mysql-test/suite/rpl/r/rpl_row_mixing_engines.result:
  updated result file
mysql-test/suite/rpl/r/rpl_slow_query_log.result:
  updated result file
mysql-test/suite/rpl/r/rpl_sp.result:
  updated result file
mysql-test/suite/rpl/r/rpl_stm_000001.result:
  updated result file
mysql-test/suite/rpl/r/rpl_stm_auto_increment_bug33029.result:
  updated result file
mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result:
  updated result file
mysql-test/suite/rpl/r/rpl_stm_loadfile.result:
  updated result file
mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result:
  updated result file
mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result:
  updated result file
mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result:
  updated result file
mysql-test/suite/rpl/r/rpl_temp_temporary.result:
  updated result file
mysql-test/suite/rpl/r/rpl_variables_stm.result:
  updated result file
mysql-test/suite/rpl/t/rpl000013.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_begin_commit_rollback.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_blackhole.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_concurrency_error.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_err_ignoredtable.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_get_lock.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_insert.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_insert_id.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_insert_ignore.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_invoked_features.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_misc_functions.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_mixed_bit_pk.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_mysql_upgrade.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_nondeterministic_functions.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_optimize.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_read_only.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_semi_sync.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_semi_sync_event.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_session_var.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_slow_query_log.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_sp.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_stm_auto_increment_bug33029.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_stm_found_rows.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_stm_insert_delayed.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_stm_loadfile.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_temp_table.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_temp_temporary.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_temporary.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_timezone.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_trigger.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_udf.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_user_variables.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_variables_stm.test:
  updated suppression pattern
mysql-test/suite/rpl/t/rpl_view_multi.test:
  updated suppression pattern
mysql-test/suite/rpl_ndb/r/rpl_ndb_binlog_format_errors.result:
  updated result file
mysql-test/suite/rpl_ndb/t/rpl_ndb_binlog_format_errors.test:
  updated suppression pattern
mysql-test/suite/rpl_ndb/t/rpl_ndb_stm_innodb.test:
  updated suppression pattern
mysql-test/suite/sys_vars/t/rpl_init_slave_func.test:
  updated suppression pattern
mysql-test/t/archive.test:
  updated suppression pattern
mysql-test/t/commit_1innodb.test:
  updated suppression pattern
mysql-test/t/create_select_tmp.test:
  updated suppression pattern
mysql-test/t/ctype_cp932_binlog_stm.test:
  updated suppression pattern
mysql-test/t/lock_sync.test:
  updated suppression pattern
mysql-test/t/mysqlbinlog.test:
  updated suppression pattern
mysql-test/t/mysqldump.test:
  updated suppression pattern
mysql-test/t/sp_trans.test:
  updated suppression pattern
sql/log_event.cc:
  Clarified error message.
sql/share/errmsg-utf8.txt:
  Clarified error messages.
2010-04-28 14:47:49 +02:00
Konstantin Osipov
e7b332ba83 Merge next-mr -> next-4284. 2010-02-05 01:08:08 +03:00
Alfranio Correia
5dcb0e447f merge mysql-5.1-rep+2-delivery1 --> mysql-5.1-rpl-merge
Conflicts:

Text conflict in .bzr-mysql/default.conf
Text conflict in mysql-test/extra/rpl_tests/rpl_loaddata.test
Text conflict in mysql-test/r/mysqlbinlog2.result
Text conflict in mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result
Text conflict in mysql-test/suite/binlog/r/binlog_unsafe.result
Text conflict in mysql-test/suite/rpl/r/rpl_insert_id.result
Text conflict in mysql-test/suite/rpl/r/rpl_loaddata.result
Text conflict in mysql-test/suite/rpl/r/rpl_stm_auto_increment_bug33029.result
Text conflict in mysql-test/suite/rpl/r/rpl_udf.result
Text conflict in mysql-test/suite/rpl/t/rpl_slow_query_log.test
Text conflict in sql/field.h
Text conflict in sql/log.cc
Text conflict in sql/log_event.cc
Text conflict in sql/log_event_old.cc
Text conflict in sql/mysql_priv.h
Text conflict in sql/share/errmsg.txt
Text conflict in sql/sp.cc
Text conflict in sql/sql_acl.cc
Text conflict in sql/sql_base.cc
Text conflict in sql/sql_class.h
Text conflict in sql/sql_db.cc
Text conflict in sql/sql_delete.cc
Text conflict in sql/sql_insert.cc
Text conflict in sql/sql_lex.cc
Text conflict in sql/sql_lex.h
Text conflict in sql/sql_load.cc
Text conflict in sql/sql_table.cc
Text conflict in sql/sql_update.cc
Text conflict in sql/sql_view.cc
Conflict adding files to storage/innobase.  Created directory.
Conflict because storage/innobase is not versioned, but has versioned children.  Versioned directory.
Conflict adding file storage/innobase.  Moved existing file to storage/innobase.moved.
Conflict adding files to storage/innobase/handler.  Created directory.
Conflict because storage/innobase/handler is not versioned, but has versioned children.  Versioned directory.
Contents conflict in storage/innobase/handler/ha_innodb.cc
2010-01-07 15:39:11 +00:00
Konstantin Osipov
a14bbee5ab Backport of revno ## 2617.31.1, 2617.31.3, 2617.31.4, 2617.31.5,
2617.31.12, 2617.31.15, 2617.31.15, 2617.31.16, 2617.43.1
- initial changeset that introduced the fix for 
Bug#989 and follow up fixes for all test suite failures
introduced in the initial changeset. 
------------------------------------------------------------
revno: 2617.31.1
committer: Davi Arnaut <Davi.Arnaut@Sun.COM>
branch nick: 4284-6.0
timestamp: Fri 2009-03-06 19:17:00 -0300
message:
Bug#989: If DROP TABLE while there's an active transaction, wrong binlog order
WL#4284: Transactional DDL locking

Currently the MySQL server does not keep metadata locks on
schema objects for the duration of a transaction, thus failing
to guarantee the integrity of the schema objects being used
during the transaction and to protect then from concurrent
DDL operations. This also poses a problem for replication as
a DDL operation might be replicated even thought there are
active transactions using the object being modified.

The solution is to defer the release of metadata locks until
a active transaction is either committed or rolled back. This
prevents other statements from modifying the table for the
entire duration of the transaction. This provides commitment
ordering for guaranteeing serializability across multiple
transactions.

- Incompatible change:

If MySQL's metadata locking system encounters a lock conflict,
the usual schema is to use the try and back-off technique to
avoid deadlocks -- this schema consists in releasing all locks
and trying to acquire them all in one go.

But in a transactional context this algorithm can't be utilized
as its not possible to release locks acquired during the course
of the transaction without breaking the transaction commitments.
To avoid deadlocks in this case, the ER_LOCK_DEADLOCK will be
returned if a lock conflict is encountered during a transaction.

Let's consider an example:

A transaction has two statements that modify table t1, then table
t2, and then commits. The first statement of the transaction will
acquire a shared metadata lock on table t1, and it will be kept
utill COMMIT to ensure serializability.

At the moment when the second statement attempts to acquire a
shared metadata lock on t2, a concurrent ALTER or DROP statement
might have locked t2 exclusively. The prescription of the current
locking protocol is that the acquirer of the shared lock backs off
-- gives up all his current locks and retries. This implies that
the entire multi-statement transaction has to be rolled back.

- Incompatible change:

FLUSH commands such as FLUSH PRIVILEGES and FLUSH TABLES WITH READ
LOCK won't cause locked tables to be implicitly unlocked anymore.


mysql-test/extra/binlog_tests/drop_table.test:
  Add test case for Bug#989.
mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test:
  Fix test case to reflect the fact that transactions now hold
  metadata locks for the duration of a transaction.
mysql-test/include/mix1.inc:
  Fix test case to reflect the fact that transactions now hold
  metadata locks for the duration of a transaction.
mysql-test/include/mix2.inc:
  Fix test case to reflect the fact that transactions now hold
  metadata locks for the duration of a transaction.
mysql-test/r/flush_block_commit.result:
  Update test case result (WL#4284).
mysql-test/r/flush_block_commit_notembedded.result:
  Update test case result (WL#4284).
mysql-test/r/innodb.result:
  Update test case result (WL#4284).
mysql-test/r/innodb_mysql.result:
  Update test case result (WL#4284).
mysql-test/r/lock.result:
  Add test case result for an effect of WL#4284/Bug#989
  (all locks should be released when a connection terminates).
mysql-test/r/mix2_myisam.result:
  Update test case result (effects of WL#4284/Bug#989).
mysql-test/r/not_embedded_server.result:
  Update test case result (effects of WL#4284/Bug#989).
  Add a test case for interaction of WL#4284 and FLUSH PRIVILEGES.
mysql-test/r/partition_innodb_semi_consistent.result:
  Update test case result (effects of WL#4284/Bug#989).
mysql-test/r/partition_sync.result:
  Temporarily disable the test case for Bug#43867,
  which will be fixed by a subsequent backport.
mysql-test/r/ps.result:
  Add a test case for effect of PREPARE on transactional
  locks: we take a savepoint at beginning of PREAPRE
  and release it at the end. Thus PREPARE does not 
  accumulate metadata locks (Bug#989/WL#4284).
mysql-test/r/read_only_innodb.result:
  Update test case result (effects of WL#4284/Bug#989).
mysql-test/suite/binlog/r/binlog_row_drop_tbl.result:
  Add a test case result (WL#4284/Bug#989).
mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result:
  Update test case result (effects of WL#4284/Bug#989).
mysql-test/suite/binlog/r/binlog_stm_drop_tbl.result:
  Add a test case result (WL#4284/Bug#989).
mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result:
  Update test case result (effects of WL#4284/Bug#989).
mysql-test/suite/binlog/r/binlog_unsafe.result:
  A side effect of Bug#989 -- slightly different table map ids.
mysql-test/suite/binlog/t/binlog_row_drop_tbl.test:
  Add a test case for WL#4284/Bug#989.
mysql-test/suite/binlog/t/binlog_stm_drop_tbl.test:
  Add a test case for WL#4284/Bug#989.
mysql-test/suite/binlog/t/binlog_stm_row.test:
  Update to the new state name. This
  is actually a follow up to another patch for WL#4284, 
  that changes Locked thread state to Table lock.
mysql-test/suite/ndb/r/ndb_index_ordered.result:
  Remove result for disabled part of the test case.
mysql-test/suite/ndb/t/disabled.def:
  Temporarily disable a test case (Bug#45621).
mysql-test/suite/ndb/t/ndb_index_ordered.test:
  Disable a part of a test case (needs update to
  reflect semantics of Bug#989).
mysql-test/suite/rpl/t/disabled.def:
  Disable tests made meaningless by transactional metadata
  locking.
mysql-test/suite/sys_vars/r/autocommit_func.result:
  Add a commit (Bug#989).
mysql-test/suite/sys_vars/t/autocommit_func.test:
  Add a commit (Bug#989).
mysql-test/t/flush_block_commit.test:
  Fix test case to reflect the fact that transactions now hold
  metadata locks for the duration of a transaction.
mysql-test/t/flush_block_commit_notembedded.test:
  Fix test case to reflect the fact that transactions now hold
  metadata locks for the duration of a transaction.
  Add a test case for transaction-scope locks and the global
  read lock (Bug#989/WL#4284).
mysql-test/t/innodb.test:
  Fix test case to reflect the fact that transactions now hold
  metadata locks for the duration of a transaction
  (effects of Bug#989/WL#4284).
mysql-test/t/lock.test:
  Add a test case for Bug#989/WL#4284.
mysql-test/t/not_embedded_server.test:
  Add a test case for Bug#989/WL#4284.
mysql-test/t/partition_innodb_semi_consistent.test:
  Replace TRUNCATE with DELETE, to not issue
  an implicit commit of a transaction, and not depend
  on metadata locks.
mysql-test/t/partition_sync.test:
  Temporarily disable the test case for Bug#43867,
  which needs a fix to be backported from 6.0.
mysql-test/t/ps.test:
  Add a test case for semantics of PREPARE and transaction-scope
  locks: metadata locks on tables used in PREPARE are enclosed into a
  temporary savepoint, taken at the beginning of PREPARE,
  and released at the end. Thus PREPARE does not effect
  what locks a transaction owns.
mysql-test/t/read_only_innodb.test:
  Fix test case to reflect the fact that transactions now hold
  metadata locks for the duration of a transaction 
  (Bug#989/WL#4284).
  
  Wait for the read_only statement to actually flush tables before
  sending other concurrent statements that depend on its state.
mysql-test/t/xa.test:
  Fix test case to reflect the fact that transactions now hold
  metadata locks for the duration of a transaction 
  (Bug#989/WL#4284).
sql/ha_ndbcluster_binlog.cc:
  Backport bits of changes of ha_ndbcluster_binlog.cc
  from 6.0, to fix the failing binlog test suite with
  WL#4284. WL#4284 implementation does not work
  with 5.1 implementation of ndbcluster binlog index.
sql/log_event.cc:
  Release metadata locks after issuing a commit.
sql/mdl.cc:
  Style changes (WL#4284).
sql/mysql_priv.h:
  Rename parameter to match the name used in the definition (WL#4284).
sql/rpl_injector.cc:
  Release metadata locks on commit (WL#4284).
sql/rpl_rli.cc:
  Remove assert made meaningless, metadata locks are released
  at the end of the transaction.
sql/set_var.cc:
  Close tables and release locks if autocommit mode is set.
sql/slave.cc:
  Release metadata locks after a rollback.
sql/sql_acl.cc:
  Don't implicitly unlock locked tables. Issue a implicit commit
  at the end and unlock tables.
sql/sql_base.cc:
  Defer the release of metadata locks when closing tables
  if not required to.
  Issue a deadlock error if the locking protocol requires
  that a transaction re-acquire its locks.
  
  Release metadata locks when closing tables for reopen.
sql/sql_class.cc:
  Release metadata locks if the thread is killed.
sql/sql_parse.cc:
  Release metadata locks after implicitly committing a active
  transaction, or after explicit commits or rollbacks.
sql/sql_plugin.cc:
  
  Allocate MDL request on the stack as the use of the table
  is contained within the function. It will be removed from
  the context once close_thread_tables is called at the end
  of the function.
sql/sql_prepare.cc:
  The problem is that the prepare phase of the CREATE TABLE
  statement takes a exclusive metadata lock lock and this can
  cause a self-deadlock the thread already holds a shared lock
  on the table being that should be created.
  
  The solution is to make the prepare phase take a shared
  metadata lock when preparing a CREATE TABLE statement. The
  execution of the statement will still acquire a exclusive
  lock, but won't cause any problem as it issues a implicit
  commit.
  
  After some discussions with stakeholders it has been decided that
  metadata locks acquired during a PREPARE statement must be released
  once the statement is prepared even if it is prepared within a multi
  statement transaction.
sql/sql_servers.cc:
  Don't implicitly unlock locked tables. Issue a implicit commit
  at the end and unlock tables.
sql/sql_table.cc:
  Close table and release metadata locks after a admin operation.
sql/table.h:
  The problem is that the prepare phase of the CREATE TABLE
  statement takes a exclusive metadata lock lock and this can
  cause a self-deadlock the thread already holds a shared lock
  on the table being that should be created.
  
  The solution is to make the prepare phase take a shared
  metadata lock when preparing a CREATE TABLE statement. The
  execution of the statement will still acquire a exclusive
  lock, but won't cause any problem as it issues a implicit
  commit.
sql/transaction.cc:
  Release metadata locks after the implicitly committed due
  to a new transaction being started. Also, release metadata
  locks acquired after a savepoint if the transaction is rolled
  back to the save point.
  
  The problem is that in some cases transaction-long metadata locks
  could be released before the transaction was committed. This could
  happen when a active transaction was ended by a "START TRANSACTION"
  or "BEGIN" statement, in which case the metadata locks would be
  released before the actual commit of the active transaction.
  
  The solution is to defer the release of metadata locks to after the
  transaction has been implicitly committed. No test case is provided
  as the effort to provide one is too disproportional to the size of
  the fix.
2009-12-05 02:02:48 +03:00
Andrei Elkin
184d7b0250 mergin 5.1 -> rep+2 -> rep+3. create_table_from_dump issue will be merged on the next step 2009-11-30 20:20:26 +02:00