mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
BUG#46364 MyISAM transbuffer problems (NTM problem)
It is well-known that due to concurrency issues, a slave can become inconsistent when a transaction contains updates to both transaction and non-transactional tables. In a nutshell, the current code-base tries to preserve causality among the statements by writing non-transactional statements to the txn-cache which is flushed upon commit. However, modifications done to non-transactional tables on behalf of a transaction become immediately visible to other connections but may not immediately get into the binary log and therefore consistency may be broken. In general, it is impossible to automatically detect causality/dependency among statements by just analyzing the statements sent to the server. This happen because dependency may be hidden in the application code and it is necessary to know a priori all the statements processed in the context of a transaction such as in a procedure. Moreover, even for the few cases that we could automatically address in the server, the computation effort required could make the approach infeasible. So, in this patch we introduce the option - "--binlog-direct-non-transactional-updates" that can be used to bypass the current behavior in order to write directly to binary log statements that change non-transactional tables. Besides, it is used to enable the WL#2687 which is disabled by default. mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test: Changes the result set as the STMT mode behaves as both the ROW and MIXED modes and as such uses the non-trx-cache and takes longer to fill the trx-cache up and trigger an error. mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test: Changes the result set as the STMT mode behaves as both the ROW and MIXED modes and as such uses the non-trx-cache. It also fixes comments. mysql-test/extra/rpl_tests/rpl_mixing_engines.test: The STMT mode is unsafe when mixed-statements are executed thus making slaves to go out of sync. For that reason, it checks consistency if not in STMT mode. mysql-test/include/default_mysqld.cnf: Makes binlog-direct-non-transactional-updates "TRUE" by default in the test cases. mysql-test/r/mysqld--help-notwin.result: Updates the result file with the new option. mysql-test/r/mysqld--help-win.result: Updates the result file with the new option. mysql-test/suite/binlog/r/binlog_multi_engine.result: Updates the result file because non-trx-changes are written ahead of the transaction. mysql-test/suite/binlog/r/binlog_switch_inside_trans.result: Verifies if the user cannot change the opion binlog_direct_non_transactional_updates within a transaction or a procedure/function/trigger. mysql-test/suite/binlog/t/binlog_stm_mix_innodb_myisam-master.opt: Sets binlog_direct_non_transactional_updates to FALSE in order to avoid changing the test case and its result file. mysql-test/suite/binlog/t/binlog_switch_inside_trans.test: Verifies if the user cannot change the opion binlog_direct_non_transactional_updates within a transaction or a procedure/function/trigger. mysql-test/suite/ndb/r/ndb_binlog_format.result: Updates the result file because non-trx-changes are written ahead of the transaction. mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result: Sets binlog_direct_non_transactional_updates to FALSE in order to avoid changing the test case and its result file. mysql-test/suite/rpl/r/rpl_concurrency_error.result: Updates the result file because non-trx-changes are written ahead of the transaction mysql-test/suite/rpl/r/rpl_mixed_implicit_commit_binlog.result: Updates the result file because non-trx-changes are written ahead of the transaction. mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result: Updates the result file because non-trx-changes are written ahead of the transaction. mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result: Changes the result set as the STMT mode behaves as both the ROW and MIXED modes and as such uses the non-trx-cache and takes longer to fill the trx-cache up and trigger an error. mysql-test/suite/rpl/r/rpl_stm_implicit_commit_binlog.result: Updates the result file because non-trx-changes are written ahead of the transaction. mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result: Updates the result file because non-trx-changes are written ahead of the transaction. mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result: Sets binlog_direct_non_transactional_updates to FALSE in order to avoid changing the test case and its result file. mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result: Sets binlog_direct_non_transactional_updates to FALSE in order to avoid changing the test case and its result file. mysql-test/suite/rpl/t/rpl_begin_commit_rollback.test: Sets binlog_direct_non_transactional_updates to FALSE in order to avoid changing the test case and its result file. mysql-test/suite/rpl/t/rpl_stm_start_stop_slave.test: Sets binlog_direct_non_transactional_updates to FALSE in order to avoid changing the test case and its result file. mysql-test/suite/rpl/t/rpl_stm_stop_middle_group.test: Sets binlog_direct_non_transactional_updates to FALSE in order to avoid changing the test case and its result file. sql/log.cc: Verifies if changes should be written to either the trx-cache or non-trx-cache through the use of the function use_trans_cache(). It also organizes the code. sql/log.h: Changes the signature of some functions by adding the modifier "const" to the thd parameter. Specifically, the following functions are changed: bool trans_has_updated_trans_table(const THD* thd); bool stmt_has_updated_trans_table(const THD *thd); bool use_trans_cache(const THD*, bool is_transactional); sql/share/errmsg-utf8.txt: Creates error messages to report when an user tries to change the new option binlog_direct_non_transactional_updates within a transaction or a procedure/ function/trigger. sql/share/errmsg.txt: Creates error messages to report when an user tries to change the new option binlog_direct_non_transactional_updates within a transaction or a procedure/ function/trigger. sql/sql_class.h: Adds the new option binlog_direct_non_transactional_updates. sql/sys_vars.cc: Adds the new option binlog_direct_non_transactional_updates. support-files/my-small.cnf.sh: Adds binlog-direct-non-transactional-updates to the example file. By default the option is disabled.
This commit is contained in:
@ -344,30 +344,14 @@ BEGIN;
|
|||||||
--eval INSERT INTO t1 (a, data) VALUES (1, $data);
|
--eval INSERT INTO t1 (a, data) VALUES (1, $data);
|
||||||
--eval INSERT INTO t1 (a, data) VALUES (2, $data);
|
--eval INSERT INTO t1 (a, data) VALUES (2, $data);
|
||||||
--eval INSERT INTO t2 (a, data) VALUES (3, $data);
|
--eval INSERT INTO t2 (a, data) VALUES (3, $data);
|
||||||
if (`SELECT @@binlog_format = 'STATEMENT'`)
|
--eval INSERT INTO t1 (a, data) VALUES (4, $data);
|
||||||
{
|
|
||||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
|
||||||
--eval INSERT INTO t1 (a, data) VALUES (4, $data);
|
|
||||||
}
|
|
||||||
if (`SELECT @@binlog_format = 'ROW' || @@binlog_format = 'MIXED'`)
|
|
||||||
{
|
|
||||||
--eval INSERT INTO t1 (a, data) VALUES (4, $data);
|
|
||||||
}
|
|
||||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||||
--eval INSERT INTO t1 (a, data) VALUES (5, $data);
|
--eval INSERT INTO t1 (a, data) VALUES (5, $data);
|
||||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||||
--eval INSERT INTO t1 (a, data) VALUES (6, $data);
|
--eval INSERT INTO t1 (a, data) VALUES (6, $data);
|
||||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||||
--eval INSERT INTO t1 (a, data) VALUES (7, $data);
|
--eval INSERT INTO t1 (a, data) VALUES (7, $data);
|
||||||
if (`SELECT @@binlog_format = 'STATEMENT'`)
|
--eval UPDATE t2 SET data= CONCAT($data, $data);
|
||||||
{
|
|
||||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
|
||||||
--eval UPDATE t2 SET data= CONCAT($data, $data);
|
|
||||||
}
|
|
||||||
if (`SELECT @@binlog_format = 'ROW' || @@binlog_format = 'MIXED'`)
|
|
||||||
{
|
|
||||||
--eval UPDATE t2 SET data= CONCAT($data, $data);
|
|
||||||
}
|
|
||||||
--eval INSERT INTO t1 (a, data) VALUES (8, 's');
|
--eval INSERT INTO t1 (a, data) VALUES (8, 's');
|
||||||
--eval INSERT INTO t1 (a, data) VALUES (9, 's');
|
--eval INSERT INTO t1 (a, data) VALUES (9, 's');
|
||||||
--eval INSERT INTO t2 (a, data) VALUES (10, 's');
|
--eval INSERT INTO t2 (a, data) VALUES (10, 's');
|
||||||
@ -380,31 +364,12 @@ BEGIN;
|
|||||||
--eval INSERT INTO t1 (a, data) VALUES (15, $data);
|
--eval INSERT INTO t1 (a, data) VALUES (15, $data);
|
||||||
--eval INSERT INTO t1 (a, data) VALUES (16, $data);
|
--eval INSERT INTO t1 (a, data) VALUES (16, $data);
|
||||||
--eval INSERT INTO t2 (a, data) VALUES (17, $data);
|
--eval INSERT INTO t2 (a, data) VALUES (17, $data);
|
||||||
if (`SELECT @@binlog_format = 'STATEMENT'`)
|
--eval INSERT INTO t1 (a, data) VALUES (18, $data);
|
||||||
{
|
|
||||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
|
||||||
--eval INSERT INTO t1 (a, data) VALUES (18, $data);
|
|
||||||
}
|
|
||||||
if (`SELECT @@binlog_format = 'ROW' || @@binlog_format = 'MIXED'`)
|
|
||||||
{
|
|
||||||
--eval INSERT INTO t1 (a, data) VALUES (18, $data);
|
|
||||||
}
|
|
||||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||||
--eval INSERT INTO t1 (a, data) VALUES (19, $data);
|
--eval INSERT INTO t1 (a, data) VALUES (19, $data);
|
||||||
--enable_query_log
|
--enable_query_log
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
if (`SELECT @@binlog_format = 'STATEMENT'`)
|
|
||||||
{
|
|
||||||
connection slave;
|
|
||||||
--source include/wait_for_slave_sql_to_stop.inc
|
|
||||||
|
|
||||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
|
|
||||||
START SLAVE SQL_THREAD;
|
|
||||||
--source include/wait_for_slave_sql_to_start.inc
|
|
||||||
connection master;
|
|
||||||
}
|
|
||||||
|
|
||||||
let $diff_statement= SELECT * FROM t1;
|
let $diff_statement= SELECT * FROM t1;
|
||||||
--source include/diff_master_slave.inc
|
--source include/diff_master_slave.inc
|
||||||
|
|
||||||
|
@ -219,13 +219,12 @@ while (`SELECT $ddl_cases >= 1`)
|
|||||||
# in the binary log:
|
# in the binary log:
|
||||||
#
|
#
|
||||||
# 1: DDL EVENT which triggered the previous commmit.
|
# 1: DDL EVENT which triggered the previous commmit.
|
||||||
# 2: COMMIT
|
# 2: BEGIN
|
||||||
# 3: BEGIN
|
# 3: TABLE MAP EVENT
|
||||||
# 4: TABLE MAP EVENT
|
# 4: TABLE MAP EVENT (ndb_apply_status)
|
||||||
# 5: TABLE MAP EVENT (ndb_apply_status)
|
# 5: ROW EVENT
|
||||||
# 6: ROW EVENT
|
# 6: ROW EVENT
|
||||||
# 7: ROW EVENT
|
# 7: COMMIT
|
||||||
# 8: COMMIT
|
|
||||||
#
|
#
|
||||||
if (`SELECT '$engine' = 'NDB' && @@binlog_format != 'ROW'`)
|
if (`SELECT '$engine' = 'NDB' && @@binlog_format != 'ROW'`)
|
||||||
{
|
{
|
||||||
@ -362,8 +361,11 @@ while (`SELECT $ddl_cases >= 1`)
|
|||||||
# does not commit the current transaction.
|
# does not commit the current transaction.
|
||||||
#
|
#
|
||||||
# 1: BEGIN
|
# 1: BEGIN
|
||||||
# 2: INSERT
|
# 2: CREATE TEMPORARY
|
||||||
# 3: CREATE TEMPORARY
|
# 3: COMMIT
|
||||||
|
# 4: BEGIN
|
||||||
|
# 5: INSERT
|
||||||
|
# 6: COMMIT
|
||||||
#
|
#
|
||||||
# In RBR the transaction is not committed either and the statement is not
|
# In RBR the transaction is not committed either and the statement is not
|
||||||
# written to the binary log:
|
# written to the binary log:
|
||||||
@ -371,10 +373,11 @@ while (`SELECT $ddl_cases >= 1`)
|
|||||||
# 1: BEGIN
|
# 1: BEGIN
|
||||||
# 2: TABLE MAP EVENT
|
# 2: TABLE MAP EVENT
|
||||||
# 3: ROW EVENT
|
# 3: ROW EVENT
|
||||||
|
# 4: COMMIT
|
||||||
#
|
#
|
||||||
if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`)
|
if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'` )
|
||||||
{
|
{
|
||||||
let $commit_event_row_number= 4;
|
let $commit_event_row_number= 6;
|
||||||
}
|
}
|
||||||
#
|
#
|
||||||
# In NDB (RBR mode), the commit event is the sixth event
|
# In NDB (RBR mode), the commit event is the sixth event
|
||||||
@ -482,9 +485,14 @@ while (`SELECT $ddl_cases >= 1`)
|
|||||||
# In SBR and MIXED modes, the DDL statement is written to the binary log
|
# In SBR and MIXED modes, the DDL statement is written to the binary log
|
||||||
# but does not commit the current transaction:
|
# but does not commit the current transaction:
|
||||||
#
|
#
|
||||||
|
# In SBR, we have what follows:
|
||||||
|
#
|
||||||
# 1: BEGIN
|
# 1: BEGIN
|
||||||
# 2: INSERT
|
# 2: DROP TEMPORARY
|
||||||
# 3: DROP TEMPORARY
|
# 3: COMMIT
|
||||||
|
# 4: BEGIN
|
||||||
|
# 5: INSERT
|
||||||
|
# 6: COMMIT
|
||||||
#
|
#
|
||||||
# In RBR the transaction is not committed either and the statement is not
|
# In RBR the transaction is not committed either and the statement is not
|
||||||
# written to the binary log:
|
# written to the binary log:
|
||||||
@ -492,8 +500,13 @@ while (`SELECT $ddl_cases >= 1`)
|
|||||||
# 1: BEGIN
|
# 1: BEGIN
|
||||||
# 2: TABLE MAP EVENT
|
# 2: TABLE MAP EVENT
|
||||||
# 3: ROW EVENT
|
# 3: ROW EVENT
|
||||||
|
# 4: COMMIT
|
||||||
#
|
#
|
||||||
if (`select @@binlog_format = 'STATEMENT'`)
|
if (`select @@binlog_format = 'STATEMENT'`)
|
||||||
|
{
|
||||||
|
let $commit_event_row_number= 6;
|
||||||
|
}
|
||||||
|
if (`select @@binlog_format = 'ROW'`)
|
||||||
{
|
{
|
||||||
let $commit_event_row_number= 4;
|
let $commit_event_row_number= 4;
|
||||||
}
|
}
|
||||||
@ -503,6 +516,7 @@ while (`SELECT $ddl_cases >= 1`)
|
|||||||
# 2: TABLE MAP EVENT
|
# 2: TABLE MAP EVENT
|
||||||
# 3: ROW EVENT
|
# 3: ROW EVENT
|
||||||
# 4: DROP TEMPORARY table IF EXISTS
|
# 4: DROP TEMPORARY table IF EXISTS
|
||||||
|
# 5: COMMIT
|
||||||
#
|
#
|
||||||
if (`select @@binlog_format = 'MIXED'`)
|
if (`select @@binlog_format = 'MIXED'`)
|
||||||
{
|
{
|
||||||
|
@ -1767,7 +1767,10 @@ sync_slave_with_master;
|
|||||||
|
|
||||||
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/test-nmt-master.sql
|
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/test-nmt-master.sql
|
||||||
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/test-nmt-slave.sql
|
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/test-nmt-slave.sql
|
||||||
--diff_files $MYSQLTEST_VARDIR/tmp/test-nmt-master.sql $MYSQLTEST_VARDIR/tmp/test-nmt-slave.sql
|
if (`select @@session.binlog_format != 'STATEMENT'`)
|
||||||
|
{
|
||||||
|
--diff_files $MYSQLTEST_VARDIR/tmp/test-nmt-master.sql $MYSQLTEST_VARDIR/tmp/test-nmt-slave.sql
|
||||||
|
}
|
||||||
|
|
||||||
--echo ###################################################################################
|
--echo ###################################################################################
|
||||||
--echo # CLEAN
|
--echo # CLEAN
|
||||||
|
@ -44,3 +44,4 @@ log-bin=mysqld-bin
|
|||||||
# Run tests with the performance schema instrumentation
|
# Run tests with the performance schema instrumentation
|
||||||
loose-enable-performance-schema
|
loose-enable-performance-schema
|
||||||
|
|
||||||
|
binlog-direct-non-transactional-updates
|
||||||
|
@ -37,6 +37,14 @@ The following options may be given as the first argument:
|
|||||||
binary log during a transaction. If you often use big,
|
binary log during a transaction. If you often use big,
|
||||||
multi-statement transactions you can increase this to get
|
multi-statement transactions you can increase this to get
|
||||||
more performance
|
more performance
|
||||||
|
--binlog-direct-non-transactional-updates
|
||||||
|
Causes updates to non-transactional engines using
|
||||||
|
statement format to be written directly to binary log.
|
||||||
|
Before using this option make sure that there are no
|
||||||
|
dependencies between transactional and non-transactional
|
||||||
|
tables such as in the statement INSERT INTO t_myisam
|
||||||
|
SELECT * FROM t_innodb; otherwise, slaves may diverge
|
||||||
|
from the master.
|
||||||
--binlog-do-db=name Tells the master it should log updates for the specified
|
--binlog-do-db=name Tells the master it should log updates for the specified
|
||||||
database, and exclude all others not explicitly
|
database, and exclude all others not explicitly
|
||||||
mentioned.
|
mentioned.
|
||||||
@ -768,6 +776,7 @@ back-log 50
|
|||||||
big-tables FALSE
|
big-tables FALSE
|
||||||
bind-address (No default value)
|
bind-address (No default value)
|
||||||
binlog-cache-size 32768
|
binlog-cache-size 32768
|
||||||
|
binlog-direct-non-transactional-updates FALSE
|
||||||
binlog-format STATEMENT
|
binlog-format STATEMENT
|
||||||
binlog-row-event-max-size 1024
|
binlog-row-event-max-size 1024
|
||||||
blackhole ON
|
blackhole ON
|
||||||
|
@ -37,6 +37,14 @@ The following options may be given as the first argument:
|
|||||||
binary log during a transaction. If you often use big,
|
binary log during a transaction. If you often use big,
|
||||||
multi-statement transactions you can increase this to get
|
multi-statement transactions you can increase this to get
|
||||||
more performance
|
more performance
|
||||||
|
--binlog-direct-non-transactional-updates
|
||||||
|
Causes updates to non-transactional engines using
|
||||||
|
statement format to be written directly to binary log.
|
||||||
|
Before using this option make sure that there are no
|
||||||
|
dependencies between transactional and non-transactional
|
||||||
|
tables such as in the statement INSERT INTO t_myisam
|
||||||
|
SELECT * FROM t_innodb; otherwise, slaves may diverge
|
||||||
|
from the master.
|
||||||
--binlog-do-db=name Tells the master it should log updates for the specified
|
--binlog-do-db=name Tells the master it should log updates for the specified
|
||||||
database, and exclude all others not explicitly
|
database, and exclude all others not explicitly
|
||||||
mentioned.
|
mentioned.
|
||||||
@ -772,6 +780,7 @@ back-log 50
|
|||||||
big-tables FALSE
|
big-tables FALSE
|
||||||
bind-address (No default value)
|
bind-address (No default value)
|
||||||
binlog-cache-size 32768
|
binlog-cache-size 32768
|
||||||
|
binlog-direct-non-transactional-updates FALSE
|
||||||
binlog-format STATEMENT
|
binlog-format STATEMENT
|
||||||
binlog-row-event-max-size 1024
|
binlog-row-event-max-size 1024
|
||||||
blackhole ON
|
blackhole ON
|
||||||
|
@ -33,9 +33,11 @@ mysqld-bin.000001 # Query # # BEGIN
|
|||||||
mysqld-bin.000001 # Query # # use `test`; UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c
|
mysqld-bin.000001 # Query # # use `test`; UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c
|
||||||
mysqld-bin.000001 # Query # # COMMIT
|
mysqld-bin.000001 # Query # # COMMIT
|
||||||
mysqld-bin.000001 # Query # # BEGIN
|
mysqld-bin.000001 # Query # # BEGIN
|
||||||
|
mysqld-bin.000001 # Query # # use `test`; UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c
|
||||||
|
mysqld-bin.000001 # Query # # COMMIT
|
||||||
|
mysqld-bin.000001 # Query # # BEGIN
|
||||||
mysqld-bin.000001 # Query # # use `test`; INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2)
|
mysqld-bin.000001 # Query # # use `test`; INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2)
|
||||||
mysqld-bin.000001 # Query # # use `test`; UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f
|
mysqld-bin.000001 # Query # # use `test`; UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f
|
||||||
mysqld-bin.000001 # Query # # use `test`; UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c
|
|
||||||
mysqld-bin.000001 # Query # # COMMIT
|
mysqld-bin.000001 # Query # # COMMIT
|
||||||
mysqld-bin.000001 # Query # # BEGIN
|
mysqld-bin.000001 # Query # # BEGIN
|
||||||
mysqld-bin.000001 # Table_map # # table_id: # (test.t1n)
|
mysqld-bin.000001 # Table_map # # table_id: # (test.t1n)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
set @save_binlog_format= @@global.binlog_format;
|
set @save_binlog_format= @@global.binlog_format;
|
||||||
|
set @save_binlog_dirct= @@global.binlog_direct_non_transactional_updates;
|
||||||
create table t1 (a int) engine= myisam;
|
create table t1 (a int) engine= myisam;
|
||||||
create table t2 (a int) engine= innodb;
|
create table t2 (a int) engine= innodb;
|
||||||
SELECT @@session.binlog_format;
|
SELECT @@session.binlog_format;
|
||||||
@ -8,19 +9,27 @@ SET AUTOCOMMIT=1;
|
|||||||
# Test that the session variable 'binlog_format'
|
# Test that the session variable 'binlog_format'
|
||||||
# is writable outside a transaction.
|
# is writable outside a transaction.
|
||||||
set @@session.binlog_format= statement;
|
set @@session.binlog_format= statement;
|
||||||
|
set @@session.binlog_direct_non_transactional_updates= TRUE;
|
||||||
SELECT @@session.binlog_format;
|
SELECT @@session.binlog_format;
|
||||||
@@session.binlog_format
|
@@session.binlog_format
|
||||||
STATEMENT
|
STATEMENT
|
||||||
|
SELECT @@session.binlog_direct_non_transactional_updates;
|
||||||
|
@@session.binlog_direct_non_transactional_updates
|
||||||
|
1
|
||||||
begin;
|
begin;
|
||||||
# Test that the session variable 'binlog_format' is read-only
|
# Test that the session variable 'binlog_format' is read-only
|
||||||
# inside a transaction with no preceding updates.
|
# inside a transaction with no preceding updates.
|
||||||
set @@session.binlog_format= mixed;
|
set @@session.binlog_format= mixed;
|
||||||
ERROR HY000: Cannot modify @@session.binlog_format inside a transaction
|
ERROR HY000: Cannot modify @@session.binlog_format inside a transaction
|
||||||
|
set @@session.binlog_direct_non_transactional_updates= FALSE;
|
||||||
|
ERROR HY000: Cannot modify @@session.binlog_direct_non_transactional_updates inside a transaction
|
||||||
insert into t2 values (1);
|
insert into t2 values (1);
|
||||||
# Test that the session variable 'binlog_format' is read-only
|
# Test that the session variable 'binlog_format' is read-only
|
||||||
# inside a transaction with preceding transactional updates.
|
# inside a transaction with preceding transactional updates.
|
||||||
set @@session.binlog_format= row;
|
set @@session.binlog_format= row;
|
||||||
ERROR HY000: Cannot modify @@session.binlog_format inside a transaction
|
ERROR HY000: Cannot modify @@session.binlog_format inside a transaction
|
||||||
|
set @@session.binlog_direct_non_transactional_updates= FALSE;
|
||||||
|
ERROR HY000: Cannot modify @@session.binlog_direct_non_transactional_updates inside a transaction
|
||||||
commit;
|
commit;
|
||||||
begin;
|
begin;
|
||||||
insert into t1 values (2);
|
insert into t1 values (2);
|
||||||
@ -28,31 +37,47 @@ insert into t1 values (2);
|
|||||||
# inside a transaction with preceding non-transactional updates.
|
# inside a transaction with preceding non-transactional updates.
|
||||||
set @@session.binlog_format= statement;
|
set @@session.binlog_format= statement;
|
||||||
ERROR HY000: Cannot modify @@session.binlog_format inside a transaction
|
ERROR HY000: Cannot modify @@session.binlog_format inside a transaction
|
||||||
|
set @@session.binlog_direct_non_transactional_updates= FALSE;
|
||||||
|
ERROR HY000: Cannot modify @@session.binlog_direct_non_transactional_updates inside a transaction
|
||||||
commit;
|
commit;
|
||||||
# Test that the session variable 'binlog_format' is writable
|
# Test that the session variable 'binlog_format' is writable
|
||||||
# when AUTOCOMMIT=0, before a transaction has started.
|
# when AUTOCOMMIT=0, before a transaction has started.
|
||||||
set AUTOCOMMIT=0;
|
set AUTOCOMMIT=0;
|
||||||
set @@session.binlog_format= row;
|
set @@session.binlog_format= row;
|
||||||
|
set @@session.binlog_direct_non_transactional_updates= FALSE;
|
||||||
SELECT @@session.binlog_format;
|
SELECT @@session.binlog_format;
|
||||||
@@session.binlog_format
|
@@session.binlog_format
|
||||||
ROW
|
ROW
|
||||||
|
SELECT @@session.binlog_direct_non_transactional_updates;
|
||||||
|
@@session.binlog_direct_non_transactional_updates
|
||||||
|
0
|
||||||
insert into t1 values (4);
|
insert into t1 values (4);
|
||||||
# Test that the session variable 'binlog_format' is read-only inside an
|
# Test that the session variable 'binlog_format' is read-only inside an
|
||||||
# AUTOCOMMIT=0 transaction with preceding non-transactional updates.
|
# AUTOCOMMIT=0 transaction with preceding non-transactional updates.
|
||||||
set @@session.binlog_format= statement;
|
set @@session.binlog_format= statement;
|
||||||
ERROR HY000: Cannot modify @@session.binlog_format inside a transaction
|
ERROR HY000: Cannot modify @@session.binlog_format inside a transaction
|
||||||
|
set @@session.binlog_direct_non_transactional_updates= TRUE;
|
||||||
|
ERROR HY000: Cannot modify @@session.binlog_direct_non_transactional_updates inside a transaction
|
||||||
SELECT @@session.binlog_format;
|
SELECT @@session.binlog_format;
|
||||||
@@session.binlog_format
|
@@session.binlog_format
|
||||||
ROW
|
ROW
|
||||||
|
SELECT @@session.binlog_direct_non_transactional_updates;
|
||||||
|
@@session.binlog_direct_non_transactional_updates
|
||||||
|
0
|
||||||
commit;
|
commit;
|
||||||
insert into t2 values (5);
|
insert into t2 values (5);
|
||||||
# Test that the session variable 'binlog_format' is read-only inside an
|
# Test that the session variable 'binlog_format' is read-only inside an
|
||||||
# AUTOCOMMIT=0 transaction with preceding transactional updates.
|
# AUTOCOMMIT=0 transaction with preceding transactional updates.
|
||||||
set @@session.binlog_format= row;
|
set @@session.binlog_format= row;
|
||||||
ERROR HY000: Cannot modify @@session.binlog_format inside a transaction
|
ERROR HY000: Cannot modify @@session.binlog_format inside a transaction
|
||||||
|
set @@session.binlog_direct_non_transactional_updates= TRUE;
|
||||||
|
ERROR HY000: Cannot modify @@session.binlog_direct_non_transactional_updates inside a transaction
|
||||||
SELECT @@session.binlog_format;
|
SELECT @@session.binlog_format;
|
||||||
@@session.binlog_format
|
@@session.binlog_format
|
||||||
ROW
|
ROW
|
||||||
|
SELECT @@session.binlog_direct_non_transactional_updates;
|
||||||
|
@@session.binlog_direct_non_transactional_updates
|
||||||
|
0
|
||||||
commit;
|
commit;
|
||||||
begin;
|
begin;
|
||||||
insert into t2 values (6);
|
insert into t2 values (6);
|
||||||
@ -62,15 +87,20 @@ SELECT @@global.binlog_format;
|
|||||||
@@global.binlog_format
|
@@global.binlog_format
|
||||||
ROW
|
ROW
|
||||||
set @@global.binlog_format= statement;
|
set @@global.binlog_format= statement;
|
||||||
|
set @@global.binlog_direct_non_transactional_updates= TRUE;
|
||||||
SELECT @@global.binlog_format;
|
SELECT @@global.binlog_format;
|
||||||
@@global.binlog_format
|
@@global.binlog_format
|
||||||
STATEMENT
|
STATEMENT
|
||||||
|
SELECT @@global.binlog_direct_non_transactional_updates;
|
||||||
|
@@global.binlog_direct_non_transactional_updates
|
||||||
|
1
|
||||||
commit;
|
commit;
|
||||||
set @@global.binlog_format= @save_binlog_format;
|
set @@global.binlog_format= @save_binlog_format;
|
||||||
|
set @@global.binlog_direct_non_transactional_updates= @save_binlog_dirct;
|
||||||
create table t3(a int, b int) engine= innodb;
|
create table t3(a int, b int) engine= innodb;
|
||||||
create table t4(a int) engine= innodb;
|
create table t4(a int) engine= innodb;
|
||||||
create table t5(a int) engine= innodb;
|
create table t5(a int) engine= innodb;
|
||||||
create trigger tr2 after insert on t3 for each row begin
|
create trigger tr1 after insert on t3 for each row begin
|
||||||
insert into t4(a) values(1);
|
insert into t4(a) values(1);
|
||||||
set @@session.binlog_format= statement;
|
set @@session.binlog_format= statement;
|
||||||
insert into t4(a) values(2);
|
insert into t4(a) values(2);
|
||||||
@ -83,8 +113,27 @@ ERROR HY000: Cannot change the binary logging format inside a stored function or
|
|||||||
SELECT @@session.binlog_format;
|
SELECT @@session.binlog_format;
|
||||||
@@session.binlog_format
|
@@session.binlog_format
|
||||||
ROW
|
ROW
|
||||||
|
create table t6(a int, b int) engine= innodb;
|
||||||
|
create table t7(a int) engine= innodb;
|
||||||
|
create table t8(a int) engine= innodb;
|
||||||
|
create trigger tr2 after insert on t6 for each row begin
|
||||||
|
insert into t7(a) values(1);
|
||||||
|
set @@global.binlog_direct_non_transactional_updates= FALSE;
|
||||||
|
insert into t7(a) values(2);
|
||||||
|
insert into t8(a) values(3);
|
||||||
|
end |
|
||||||
|
# Test that the session variable 'binlog_format' is read-only
|
||||||
|
# in sub-statements.
|
||||||
|
insert into t6(a,b) values(1,1);
|
||||||
|
ERROR HY000: Cannot change the binlog direct flag inside a stored function or trigger
|
||||||
|
SELECT @@session.binlog_direct_non_transactional_updates;
|
||||||
|
@@session.binlog_direct_non_transactional_updates
|
||||||
|
0
|
||||||
drop table t1;
|
drop table t1;
|
||||||
drop table t2;
|
drop table t2;
|
||||||
drop table t3;
|
drop table t3;
|
||||||
drop table t4;
|
drop table t4;
|
||||||
drop table t5;
|
drop table t5;
|
||||||
|
drop table t6;
|
||||||
|
drop table t7;
|
||||||
|
drop table t8;
|
@ -1 +1 @@
|
|||||||
--innodb_lock_wait_timeout=2
|
--innodb_lock_wait_timeout=2 --binlog-direct-non-transactional-updates=FALSE
|
||||||
|
@ -8,6 +8,7 @@ source include/have_innodb.inc;
|
|||||||
source include/have_binlog_format_row.inc;
|
source include/have_binlog_format_row.inc;
|
||||||
|
|
||||||
set @save_binlog_format= @@global.binlog_format;
|
set @save_binlog_format= @@global.binlog_format;
|
||||||
|
set @save_binlog_dirct= @@global.binlog_direct_non_transactional_updates;
|
||||||
create table t1 (a int) engine= myisam;
|
create table t1 (a int) engine= myisam;
|
||||||
create table t2 (a int) engine= innodb;
|
create table t2 (a int) engine= innodb;
|
||||||
|
|
||||||
@ -16,19 +17,25 @@ SET AUTOCOMMIT=1;
|
|||||||
--echo # Test that the session variable 'binlog_format'
|
--echo # Test that the session variable 'binlog_format'
|
||||||
--echo # is writable outside a transaction.
|
--echo # is writable outside a transaction.
|
||||||
set @@session.binlog_format= statement;
|
set @@session.binlog_format= statement;
|
||||||
|
set @@session.binlog_direct_non_transactional_updates= TRUE;
|
||||||
SELECT @@session.binlog_format;
|
SELECT @@session.binlog_format;
|
||||||
|
SELECT @@session.binlog_direct_non_transactional_updates;
|
||||||
|
|
||||||
begin;
|
begin;
|
||||||
--echo # Test that the session variable 'binlog_format' is read-only
|
--echo # Test that the session variable 'binlog_format' is read-only
|
||||||
--echo # inside a transaction with no preceding updates.
|
--echo # inside a transaction with no preceding updates.
|
||||||
--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT
|
--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT
|
||||||
set @@session.binlog_format= mixed;
|
set @@session.binlog_format= mixed;
|
||||||
|
--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_DIRECT
|
||||||
|
set @@session.binlog_direct_non_transactional_updates= FALSE;
|
||||||
|
|
||||||
insert into t2 values (1);
|
insert into t2 values (1);
|
||||||
--echo # Test that the session variable 'binlog_format' is read-only
|
--echo # Test that the session variable 'binlog_format' is read-only
|
||||||
--echo # inside a transaction with preceding transactional updates.
|
--echo # inside a transaction with preceding transactional updates.
|
||||||
--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT
|
--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT
|
||||||
set @@session.binlog_format= row;
|
set @@session.binlog_format= row;
|
||||||
|
--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_DIRECT
|
||||||
|
set @@session.binlog_direct_non_transactional_updates= FALSE;
|
||||||
commit;
|
commit;
|
||||||
|
|
||||||
begin;
|
begin;
|
||||||
@ -37,20 +44,27 @@ begin;
|
|||||||
--echo # inside a transaction with preceding non-transactional updates.
|
--echo # inside a transaction with preceding non-transactional updates.
|
||||||
--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT
|
--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT
|
||||||
set @@session.binlog_format= statement;
|
set @@session.binlog_format= statement;
|
||||||
|
--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_DIRECT
|
||||||
|
set @@session.binlog_direct_non_transactional_updates= FALSE;
|
||||||
commit;
|
commit;
|
||||||
|
|
||||||
--echo # Test that the session variable 'binlog_format' is writable
|
--echo # Test that the session variable 'binlog_format' is writable
|
||||||
--echo # when AUTOCOMMIT=0, before a transaction has started.
|
--echo # when AUTOCOMMIT=0, before a transaction has started.
|
||||||
set AUTOCOMMIT=0;
|
set AUTOCOMMIT=0;
|
||||||
set @@session.binlog_format= row;
|
set @@session.binlog_format= row;
|
||||||
|
set @@session.binlog_direct_non_transactional_updates= FALSE;
|
||||||
SELECT @@session.binlog_format;
|
SELECT @@session.binlog_format;
|
||||||
|
SELECT @@session.binlog_direct_non_transactional_updates;
|
||||||
|
|
||||||
insert into t1 values (4);
|
insert into t1 values (4);
|
||||||
--echo # Test that the session variable 'binlog_format' is read-only inside an
|
--echo # Test that the session variable 'binlog_format' is read-only inside an
|
||||||
--echo # AUTOCOMMIT=0 transaction with preceding non-transactional updates.
|
--echo # AUTOCOMMIT=0 transaction with preceding non-transactional updates.
|
||||||
--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT
|
--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT
|
||||||
set @@session.binlog_format= statement;
|
set @@session.binlog_format= statement;
|
||||||
|
--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_DIRECT
|
||||||
|
set @@session.binlog_direct_non_transactional_updates= TRUE;
|
||||||
SELECT @@session.binlog_format;
|
SELECT @@session.binlog_format;
|
||||||
|
SELECT @@session.binlog_direct_non_transactional_updates;
|
||||||
commit;
|
commit;
|
||||||
|
|
||||||
insert into t2 values (5);
|
insert into t2 values (5);
|
||||||
@ -58,7 +72,10 @@ insert into t2 values (5);
|
|||||||
--echo # AUTOCOMMIT=0 transaction with preceding transactional updates.
|
--echo # AUTOCOMMIT=0 transaction with preceding transactional updates.
|
||||||
--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT
|
--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT
|
||||||
set @@session.binlog_format= row;
|
set @@session.binlog_format= row;
|
||||||
|
--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_DIRECT
|
||||||
|
set @@session.binlog_direct_non_transactional_updates= TRUE;
|
||||||
SELECT @@session.binlog_format;
|
SELECT @@session.binlog_format;
|
||||||
|
SELECT @@session.binlog_direct_non_transactional_updates;
|
||||||
commit;
|
commit;
|
||||||
|
|
||||||
begin;
|
begin;
|
||||||
@ -67,16 +84,19 @@ begin;
|
|||||||
--echo # inside a transaction.
|
--echo # inside a transaction.
|
||||||
SELECT @@global.binlog_format;
|
SELECT @@global.binlog_format;
|
||||||
set @@global.binlog_format= statement;
|
set @@global.binlog_format= statement;
|
||||||
|
set @@global.binlog_direct_non_transactional_updates= TRUE;
|
||||||
SELECT @@global.binlog_format;
|
SELECT @@global.binlog_format;
|
||||||
|
SELECT @@global.binlog_direct_non_transactional_updates;
|
||||||
commit;
|
commit;
|
||||||
|
|
||||||
set @@global.binlog_format= @save_binlog_format;
|
set @@global.binlog_format= @save_binlog_format;
|
||||||
|
set @@global.binlog_direct_non_transactional_updates= @save_binlog_dirct;
|
||||||
|
|
||||||
create table t3(a int, b int) engine= innodb;
|
create table t3(a int, b int) engine= innodb;
|
||||||
create table t4(a int) engine= innodb;
|
create table t4(a int) engine= innodb;
|
||||||
create table t5(a int) engine= innodb;
|
create table t5(a int) engine= innodb;
|
||||||
delimiter |;
|
delimiter |;
|
||||||
eval create trigger tr2 after insert on t3 for each row begin
|
eval create trigger tr1 after insert on t3 for each row begin
|
||||||
insert into t4(a) values(1);
|
insert into t4(a) values(1);
|
||||||
set @@session.binlog_format= statement;
|
set @@session.binlog_format= statement;
|
||||||
insert into t4(a) values(2);
|
insert into t4(a) values(2);
|
||||||
@ -90,9 +110,29 @@ delimiter ;|
|
|||||||
insert into t3(a,b) values(1,1);
|
insert into t3(a,b) values(1,1);
|
||||||
SELECT @@session.binlog_format;
|
SELECT @@session.binlog_format;
|
||||||
|
|
||||||
|
create table t6(a int, b int) engine= innodb;
|
||||||
|
create table t7(a int) engine= innodb;
|
||||||
|
create table t8(a int) engine= innodb;
|
||||||
|
delimiter |;
|
||||||
|
eval create trigger tr2 after insert on t6 for each row begin
|
||||||
|
insert into t7(a) values(1);
|
||||||
|
set @@global.binlog_direct_non_transactional_updates= FALSE;
|
||||||
|
insert into t7(a) values(2);
|
||||||
|
insert into t8(a) values(3);
|
||||||
|
end |
|
||||||
|
delimiter ;|
|
||||||
|
|
||||||
|
--echo # Test that the session variable 'binlog_format' is read-only
|
||||||
|
--echo # in sub-statements.
|
||||||
|
--error ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_DIRECT
|
||||||
|
insert into t6(a,b) values(1,1);
|
||||||
|
SELECT @@session.binlog_direct_non_transactional_updates;
|
||||||
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
drop table t2;
|
drop table t2;
|
||||||
drop table t3;
|
drop table t3;
|
||||||
drop table t4;
|
drop table t4;
|
||||||
drop table t5;
|
drop table t5;
|
||||||
|
drop table t6;
|
||||||
|
drop table t7;
|
||||||
|
drop table t8;
|
@ -29,9 +29,11 @@ mysqld-bin.000001 # Query # # BEGIN
|
|||||||
mysqld-bin.000001 # Query # # use `test`; UPDATE t1, t2 SET m = 2, b = 3 WHERE n = c
|
mysqld-bin.000001 # Query # # use `test`; UPDATE t1, t2 SET m = 2, b = 3 WHERE n = c
|
||||||
mysqld-bin.000001 # Query # # COMMIT
|
mysqld-bin.000001 # Query # # COMMIT
|
||||||
mysqld-bin.000001 # Query # # BEGIN
|
mysqld-bin.000001 # Query # # BEGIN
|
||||||
|
mysqld-bin.000001 # Query # # use `test`; UPDATE t3, t2 SET e = 2, b = 3 WHERE f = c
|
||||||
|
mysqld-bin.000001 # Query # # COMMIT
|
||||||
|
mysqld-bin.000001 # Query # # BEGIN
|
||||||
mysqld-bin.000001 # Query # # use `test`; INSERT INTO t3 VALUES (1,1), (1,2), (2,1), (2,2)
|
mysqld-bin.000001 # Query # # use `test`; INSERT INTO t3 VALUES (1,1), (1,2), (2,1), (2,2)
|
||||||
mysqld-bin.000001 # Query # # use `test`; UPDATE t1, t3 SET m = 2, e = 3 WHERE n = f
|
mysqld-bin.000001 # Query # # use `test`; UPDATE t1, t3 SET m = 2, e = 3 WHERE n = f
|
||||||
mysqld-bin.000001 # Query # # use `test`; UPDATE t3, t2 SET e = 2, b = 3 WHERE f = c
|
|
||||||
mysqld-bin.000001 # Query # # COMMIT
|
mysqld-bin.000001 # Query # # COMMIT
|
||||||
mysqld-bin.000001 # Query # # BEGIN
|
mysqld-bin.000001 # Query # # BEGIN
|
||||||
mysqld-bin.000001 # Table_map # # table_id: # (test.t3)
|
mysqld-bin.000001 # Table_map # # table_id: # (test.t3)
|
||||||
|
@ -6,6 +6,7 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
|||||||
start slave;
|
start slave;
|
||||||
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
|
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
|
||||||
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
|
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
|
||||||
|
SET @@session.binlog_direct_non_transactional_updates= FALSE;
|
||||||
DROP DATABASE IF EXISTS db1;
|
DROP DATABASE IF EXISTS db1;
|
||||||
CREATE DATABASE db1;
|
CREATE DATABASE db1;
|
||||||
use db1;
|
use db1;
|
||||||
|
@ -38,12 +38,14 @@ Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
|||||||
show binlog events from <binlog_start>;
|
show binlog events from <binlog_start>;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 # Query # # BEGIN
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Query # # use `test`; INSERT INTO n VALUES (now(),"brown")
|
||||||
|
master-bin.000001 # Query # # COMMIT
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
master-bin.000001 # Query # # use `test`; UPDATE t SET f = 'yellow 2' WHERE i = 3
|
master-bin.000001 # Query # # use `test`; UPDATE t SET f = 'yellow 2' WHERE i = 3
|
||||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
master-bin.000001 # Query # # BEGIN
|
master-bin.000001 # Query # # BEGIN
|
||||||
master-bin.000001 # Query # # use `test`; UPDATE t SET f = 'magenta 2' WHERE f = 'red'
|
master-bin.000001 # Query # # use `test`; UPDATE t SET f = 'magenta 2' WHERE f = 'red'
|
||||||
master-bin.000001 # Query # # use `test`; INSERT INTO t VALUES (5 + (2 * 10),"brown")
|
master-bin.000001 # Query # # use `test`; INSERT INTO t VALUES (5 + (2 * 10),"brown")
|
||||||
master-bin.000001 # Query # # use `test`; INSERT INTO n VALUES (now(),"brown")
|
|
||||||
master-bin.000001 # Query # # ROLLBACK
|
master-bin.000001 # Query # # ROLLBACK
|
||||||
SET AUTOCOMMIT = 1;
|
SET AUTOCOMMIT = 1;
|
||||||
BEGIN;
|
BEGIN;
|
||||||
@ -63,12 +65,14 @@ COMMIT;
|
|||||||
show binlog events from <binlog_start>;
|
show binlog events from <binlog_start>;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 # Query # # BEGIN
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Query # # use `test`; INSERT INTO n VALUES (now(),"brown")
|
||||||
|
master-bin.000001 # Query # # COMMIT
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
master-bin.000001 # Query # # use `test`; UPDATE t SET f = 'gray 2' WHERE i = 3
|
master-bin.000001 # Query # # use `test`; UPDATE t SET f = 'gray 2' WHERE i = 3
|
||||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
master-bin.000001 # Query # # BEGIN
|
master-bin.000001 # Query # # BEGIN
|
||||||
master-bin.000001 # Query # # use `test`; UPDATE t SET f = 'dark blue 2' WHERE f = 'red'
|
master-bin.000001 # Query # # use `test`; UPDATE t SET f = 'dark blue 2' WHERE f = 'red'
|
||||||
master-bin.000001 # Query # # use `test`; INSERT INTO t VALUES (6 + (2 * 10),"brown")
|
master-bin.000001 # Query # # use `test`; INSERT INTO t VALUES (6 + (2 * 10),"brown")
|
||||||
master-bin.000001 # Query # # use `test`; INSERT INTO n VALUES (now(),"brown")
|
|
||||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
SET AUTOCOMMIT = 0;
|
SET AUTOCOMMIT = 0;
|
||||||
UPDATE t SET f = 'yellow 1' WHERE i = 3;
|
UPDATE t SET f = 'yellow 1' WHERE i = 3;
|
||||||
@ -88,12 +92,14 @@ Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
|||||||
show binlog events from <binlog_start>;
|
show binlog events from <binlog_start>;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 # Query # # BEGIN
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Query # # use `test`; INSERT INTO n VALUES (now(),"brown")
|
||||||
|
master-bin.000001 # Query # # COMMIT
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
master-bin.000001 # Query # # use `test`; UPDATE t SET f = 'yellow 1' WHERE i = 3
|
master-bin.000001 # Query # # use `test`; UPDATE t SET f = 'yellow 1' WHERE i = 3
|
||||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
master-bin.000001 # Query # # BEGIN
|
master-bin.000001 # Query # # BEGIN
|
||||||
master-bin.000001 # Query # # use `test`; UPDATE t SET f = 'magenta 1' WHERE f = 'red'
|
master-bin.000001 # Query # # use `test`; UPDATE t SET f = 'magenta 1' WHERE f = 'red'
|
||||||
master-bin.000001 # Query # # use `test`; INSERT INTO t VALUES (5 + (1 * 10),"brown")
|
master-bin.000001 # Query # # use `test`; INSERT INTO t VALUES (5 + (1 * 10),"brown")
|
||||||
master-bin.000001 # Query # # use `test`; INSERT INTO n VALUES (now(),"brown")
|
|
||||||
master-bin.000001 # Query # # ROLLBACK
|
master-bin.000001 # Query # # ROLLBACK
|
||||||
SET AUTOCOMMIT = 0;
|
SET AUTOCOMMIT = 0;
|
||||||
UPDATE t SET f = 'gray 1' WHERE i = 3;
|
UPDATE t SET f = 'gray 1' WHERE i = 3;
|
||||||
@ -111,12 +117,14 @@ COMMIT;
|
|||||||
show binlog events from <binlog_start>;
|
show binlog events from <binlog_start>;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 # Query # # BEGIN
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Query # # use `test`; INSERT INTO n VALUES (now(),"brown")
|
||||||
|
master-bin.000001 # Query # # COMMIT
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
master-bin.000001 # Query # # use `test`; UPDATE t SET f = 'gray 1' WHERE i = 3
|
master-bin.000001 # Query # # use `test`; UPDATE t SET f = 'gray 1' WHERE i = 3
|
||||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
master-bin.000001 # Query # # BEGIN
|
master-bin.000001 # Query # # BEGIN
|
||||||
master-bin.000001 # Query # # use `test`; UPDATE t SET f = 'dark blue 1' WHERE f = 'red'
|
master-bin.000001 # Query # # use `test`; UPDATE t SET f = 'dark blue 1' WHERE f = 'red'
|
||||||
master-bin.000001 # Query # # use `test`; INSERT INTO t VALUES (6 + (1 * 10),"brown")
|
master-bin.000001 # Query # # use `test`; INSERT INTO t VALUES (6 + (1 * 10),"brown")
|
||||||
master-bin.000001 # Query # # use `test`; INSERT INTO n VALUES (now(),"brown")
|
|
||||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
source include/diff_master_slave.inc;
|
source include/diff_master_slave.inc;
|
||||||
source include/diff_master_slave.inc;
|
source include/diff_master_slave.inc;
|
||||||
|
@ -393,8 +393,10 @@ CREATE TEMPORARY TABLE tt_xx (a int);
|
|||||||
-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b-
|
-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b-
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 # Query # # BEGIN
|
master-bin.000001 # Query # # BEGIN
|
||||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(ddl_case) VALUES (11)
|
|
||||||
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_xx (a int)
|
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_xx (a int)
|
||||||
|
master-bin.000001 # Query # # COMMIT
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(ddl_case) VALUES (11)
|
||||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e-
|
-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e-
|
||||||
|
|
||||||
|
@ -11868,6 +11868,9 @@ Log_name Pos Event_type Server_id End_log_pos Info
|
|||||||
-b-b-b-b-b-b-b-b-b-b-b- >> CT << -b-b-b-b-b-b-b-b-b-b-b-
|
-b-b-b-b-b-b-b-b-b-b-b- >> CT << -b-b-b-b-b-b-b-b-b-b-b-
|
||||||
CREATE TEMPORARY TABLE tt_xx_11 (a int) engine=Innodb;;
|
CREATE TEMPORARY TABLE tt_xx_11 (a int) engine=Innodb;;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_xx_11 (a int) engine=Innodb
|
||||||
|
master-bin.000001 # Query # # COMMIT
|
||||||
-e-e-e-e-e-e-e-e-e-e-e- >> CT << -e-e-e-e-e-e-e-e-e-e-e-
|
-e-e-e-e-e-e-e-e-e-e-e- >> CT << -e-e-e-e-e-e-e-e-e-e-e-
|
||||||
-b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b-
|
-b-b-b-b-b-b-b-b-b-b-b- >> R << -b-b-b-b-b-b-b-b-b-b-b-
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
@ -11875,6 +11878,9 @@ Log_name Pos Event_type Server_id End_log_pos Info
|
|||||||
-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e-
|
-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e-
|
||||||
-b-b-b-b-b-b-b-b-b-b-b- >> B T CT R << -b-b-b-b-b-b-b-b-b-b-b-
|
-b-b-b-b-b-b-b-b-b-b-b- >> B T CT R << -b-b-b-b-b-b-b-b-b-b-b-
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_xx_11 (a int) engine=Innodb
|
||||||
|
master-bin.000001 # Query # # COMMIT
|
||||||
-e-e-e-e-e-e-e-e-e-e-e- >> B T CT R << -e-e-e-e-e-e-e-e-e-e-e-
|
-e-e-e-e-e-e-e-e-e-e-e- >> B T CT R << -e-e-e-e-e-e-e-e-e-e-e-
|
||||||
|
|
||||||
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
|
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
|
||||||
@ -11906,6 +11912,9 @@ Log_name Pos Event_type Server_id End_log_pos Info
|
|||||||
-b-b-b-b-b-b-b-b-b-b-b- >> CT << -b-b-b-b-b-b-b-b-b-b-b-
|
-b-b-b-b-b-b-b-b-b-b-b- >> CT << -b-b-b-b-b-b-b-b-b-b-b-
|
||||||
CREATE TEMPORARY TABLE tt_xx_12 (a int) engine=Innodb;;
|
CREATE TEMPORARY TABLE tt_xx_12 (a int) engine=Innodb;;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_xx_12 (a int) engine=Innodb
|
||||||
|
master-bin.000001 # Query # # COMMIT
|
||||||
-e-e-e-e-e-e-e-e-e-e-e- >> CT << -e-e-e-e-e-e-e-e-e-e-e-
|
-e-e-e-e-e-e-e-e-e-e-e- >> CT << -e-e-e-e-e-e-e-e-e-e-e-
|
||||||
-b-b-b-b-b-b-b-b-b-b-b- >> R1 << -b-b-b-b-b-b-b-b-b-b-b-
|
-b-b-b-b-b-b-b-b-b-b-b- >> R1 << -b-b-b-b-b-b-b-b-b-b-b-
|
||||||
ROLLBACK TO s1;
|
ROLLBACK TO s1;
|
||||||
@ -11919,6 +11928,9 @@ Log_name Pos Event_type Server_id End_log_pos Info
|
|||||||
-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e-
|
-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e-
|
||||||
-b-b-b-b-b-b-b-b-b-b-b- >> B T S1 T CT R1 R << -b-b-b-b-b-b-b-b-b-b-b-
|
-b-b-b-b-b-b-b-b-b-b-b- >> B T S1 T CT R1 R << -b-b-b-b-b-b-b-b-b-b-b-
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_xx_12 (a int) engine=Innodb
|
||||||
|
master-bin.000001 # Query # # COMMIT
|
||||||
-e-e-e-e-e-e-e-e-e-e-e- >> B T S1 T CT R1 R << -e-e-e-e-e-e-e-e-e-e-e-
|
-e-e-e-e-e-e-e-e-e-e-e- >> B T S1 T CT R1 R << -e-e-e-e-e-e-e-e-e-e-e-
|
||||||
|
|
||||||
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
|
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
|
||||||
@ -11942,6 +11954,9 @@ Log_name Pos Event_type Server_id End_log_pos Info
|
|||||||
-b-b-b-b-b-b-b-b-b-b-b- >> CT << -b-b-b-b-b-b-b-b-b-b-b-
|
-b-b-b-b-b-b-b-b-b-b-b- >> CT << -b-b-b-b-b-b-b-b-b-b-b-
|
||||||
CREATE TEMPORARY TABLE tt_xx_13 (a int) engine=Innodb;;
|
CREATE TEMPORARY TABLE tt_xx_13 (a int) engine=Innodb;;
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_xx_13 (a int) engine=Innodb
|
||||||
|
master-bin.000001 # Query # # COMMIT
|
||||||
-e-e-e-e-e-e-e-e-e-e-e- >> CT << -e-e-e-e-e-e-e-e-e-e-e-
|
-e-e-e-e-e-e-e-e-e-e-e- >> CT << -e-e-e-e-e-e-e-e-e-e-e-
|
||||||
-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
|
-b-b-b-b-b-b-b-b-b-b-b- >> T << -b-b-b-b-b-b-b-b-b-b-b-
|
||||||
INSERT INTO tt_1(trans_id, stmt_id) VALUES (355, 5);
|
INSERT INTO tt_1(trans_id, stmt_id) VALUES (355, 5);
|
||||||
@ -11953,6 +11968,9 @@ Log_name Pos Event_type Server_id End_log_pos Info
|
|||||||
-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e-
|
-e-e-e-e-e-e-e-e-e-e-e- >> R << -e-e-e-e-e-e-e-e-e-e-e-
|
||||||
-b-b-b-b-b-b-b-b-b-b-b- >> B T CT T R << -b-b-b-b-b-b-b-b-b-b-b-
|
-b-b-b-b-b-b-b-b-b-b-b- >> B T CT T R << -b-b-b-b-b-b-b-b-b-b-b-
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_xx_13 (a int) engine=Innodb
|
||||||
|
master-bin.000001 # Query # # COMMIT
|
||||||
-e-e-e-e-e-e-e-e-e-e-e- >> B T CT T R << -e-e-e-e-e-e-e-e-e-e-e-
|
-e-e-e-e-e-e-e-e-e-e-e- >> B T CT T R << -e-e-e-e-e-e-e-e-e-e-e-
|
||||||
|
|
||||||
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
|
-b-b-b-b-b-b-b-b-b-b-b- >> drop-CT << -b-b-b-b-b-b-b-b-b-b-b-
|
||||||
|
@ -130,8 +130,8 @@ Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = S
|
|||||||
Got one of the listed errors
|
Got one of the listed errors
|
||||||
Got one of the listed errors
|
Got one of the listed errors
|
||||||
Got one of the listed errors
|
Got one of the listed errors
|
||||||
Got one of the listed errors
|
Warnings:
|
||||||
Got one of the listed errors
|
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
|
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
|
||||||
COMMIT;
|
COMMIT;
|
||||||
@ -139,10 +139,7 @@ BEGIN;
|
|||||||
Warnings:
|
Warnings:
|
||||||
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
|
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
|
||||||
Got one of the listed errors
|
Got one of the listed errors
|
||||||
Got one of the listed errors
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
|
|
||||||
START SLAVE SQL_THREAD;
|
|
||||||
source include/diff_master_slave.inc;
|
source include/diff_master_slave.inc;
|
||||||
########################################################################################
|
########################################################################################
|
||||||
# CLEAN
|
# CLEAN
|
||||||
|
@ -393,8 +393,10 @@ CREATE TEMPORARY TABLE tt_xx (a int);
|
|||||||
-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b-
|
-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b-
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 # Query # # BEGIN
|
master-bin.000001 # Query # # BEGIN
|
||||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(ddl_case) VALUES (11)
|
|
||||||
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_xx (a int)
|
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE tt_xx (a int)
|
||||||
|
master-bin.000001 # Query # # COMMIT
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(ddl_case) VALUES (11)
|
||||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e-
|
-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e-
|
||||||
|
|
||||||
@ -429,8 +431,10 @@ DROP TEMPORARY TABLE IF EXISTS new_tt_xx;
|
|||||||
-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b-
|
-b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b-
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
Log_name Pos Event_type Server_id End_log_pos Info
|
||||||
master-bin.000001 # Query # # BEGIN
|
master-bin.000001 # Query # # BEGIN
|
||||||
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(ddl_case) VALUES (8)
|
|
||||||
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS new_tt_xx
|
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS new_tt_xx
|
||||||
|
master-bin.000001 # Query # # COMMIT
|
||||||
|
master-bin.000001 # Query # # BEGIN
|
||||||
|
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1(ddl_case) VALUES (8)
|
||||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||||
-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e-
|
-e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e-
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -4,6 +4,7 @@ reset master;
|
|||||||
reset slave;
|
reset slave;
|
||||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||||
start slave;
|
start slave;
|
||||||
|
SET @@session.binlog_direct_non_transactional_updates= FALSE;
|
||||||
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
|
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
|
||||||
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
|
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
|
||||||
create table t1(n int);
|
create table t1(n int);
|
||||||
|
@ -4,6 +4,7 @@ reset master;
|
|||||||
reset slave;
|
reset slave;
|
||||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||||
start slave;
|
start slave;
|
||||||
|
SET @@session.binlog_direct_non_transactional_updates= FALSE;
|
||||||
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
|
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
|
||||||
create table tm (a int auto_increment primary key) engine=myisam;
|
create table tm (a int auto_increment primary key) engine=myisam;
|
||||||
create table ti (a int auto_increment primary key) engine=innodb;
|
create table ti (a int auto_increment primary key) engine=innodb;
|
||||||
|
@ -8,6 +8,8 @@ call mtr.add_suppression("Unsafe statement binlogged in statement format since B
|
|||||||
connection master;
|
connection master;
|
||||||
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
|
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
|
||||||
|
|
||||||
|
SET @@session.binlog_direct_non_transactional_updates= FALSE;
|
||||||
|
|
||||||
disable_warnings;
|
disable_warnings;
|
||||||
DROP DATABASE IF EXISTS db1;
|
DROP DATABASE IF EXISTS db1;
|
||||||
enable_warnings;
|
enable_warnings;
|
||||||
|
@ -5,4 +5,5 @@
|
|||||||
--source include/have_binlog_format_statement.inc
|
--source include/have_binlog_format_statement.inc
|
||||||
--source include/have_innodb.inc
|
--source include/have_innodb.inc
|
||||||
|
|
||||||
|
SET @@session.binlog_direct_non_transactional_updates= FALSE;
|
||||||
--source ./extra/rpl_tests/rpl_start_stop_slave.test
|
--source ./extra/rpl_tests/rpl_start_stop_slave.test
|
||||||
|
@ -6,4 +6,5 @@
|
|||||||
-- source include/have_innodb.inc
|
-- source include/have_innodb.inc
|
||||||
-- source include/have_binlog_format_statement.inc
|
-- source include/have_binlog_format_statement.inc
|
||||||
|
|
||||||
|
SET @@session.binlog_direct_non_transactional_updates= FALSE;
|
||||||
-- source extra/rpl_tests/rpl_stop_middle_group.test
|
-- source extra/rpl_tests/rpl_stop_middle_group.test
|
||||||
|
@ -0,0 +1,76 @@
|
|||||||
|
SELECT @@GLOBAL.binlog_direct_non_transactional_updates;
|
||||||
|
@@GLOBAL.binlog_direct_non_transactional_updates
|
||||||
|
1
|
||||||
|
'#---------------------BS_STVARS_002_01----------------------#'
|
||||||
|
SET @start_value= @@global.binlog_direct_non_transactional_updates;
|
||||||
|
SELECT COUNT(@@GLOBAL.binlog_direct_non_transactional_updates);
|
||||||
|
COUNT(@@GLOBAL.binlog_direct_non_transactional_updates)
|
||||||
|
1
|
||||||
|
1 Expected
|
||||||
|
SELECT COUNT(@@SESSION.binlog_direct_non_transactional_updates);
|
||||||
|
COUNT(@@SESSION.binlog_direct_non_transactional_updates)
|
||||||
|
1
|
||||||
|
1 Expected
|
||||||
|
'#---------------------BS_STVARS_002_02----------------------#'
|
||||||
|
SET @@GLOBAL.binlog_direct_non_transactional_updates=TRUE;
|
||||||
|
SELECT @@GLOBAL.binlog_direct_non_transactional_updates;
|
||||||
|
@@GLOBAL.binlog_direct_non_transactional_updates
|
||||||
|
1
|
||||||
|
SET @@SESSION.binlog_direct_non_transactional_updates=TRUE;
|
||||||
|
SELECT @@SESSION.binlog_direct_non_transactional_updates;
|
||||||
|
@@SESSION.binlog_direct_non_transactional_updates
|
||||||
|
1
|
||||||
|
'#---------------------BS_STVARS_002_03----------------------#'
|
||||||
|
SELECT
|
||||||
|
IF(@@GLOBAL.binlog_direct_non_transactional_updates, "ON", "OFF") = VARIABLE_VALUE
|
||||||
|
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||||
|
WHERE VARIABLE_NAME='binlog_direct_non_transactional_updates';
|
||||||
|
IF(@@GLOBAL.binlog_direct_non_transactional_updates, "ON", "OFF") = VARIABLE_VALUE
|
||||||
|
1
|
||||||
|
1 Expected
|
||||||
|
SELECT COUNT(@@GLOBAL.binlog_direct_non_transactional_updates);
|
||||||
|
COUNT(@@GLOBAL.binlog_direct_non_transactional_updates)
|
||||||
|
1
|
||||||
|
1 Expected
|
||||||
|
SELECT COUNT(VARIABLE_VALUE)
|
||||||
|
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||||
|
WHERE VARIABLE_NAME='binlog_direct_non_transactional_updates';
|
||||||
|
COUNT(VARIABLE_VALUE)
|
||||||
|
1
|
||||||
|
1 Expected
|
||||||
|
'#---------------------BS_STVARS_002_04----------------------#'
|
||||||
|
SELECT
|
||||||
|
IF(@@SESSION.binlog_direct_non_transactional_updates, "ON", "OFF") = VARIABLE_VALUE
|
||||||
|
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
|
||||||
|
WHERE VARIABLE_NAME='binlog_direct_non_transactional_updates';
|
||||||
|
IF(@@SESSION.binlog_direct_non_transactional_updates, "ON", "OFF") = VARIABLE_VALUE
|
||||||
|
1
|
||||||
|
1 Expected
|
||||||
|
SELECT COUNT(@@SESSION.binlog_direct_non_transactional_updates);
|
||||||
|
COUNT(@@SESSION.binlog_direct_non_transactional_updates)
|
||||||
|
1
|
||||||
|
1 Expected
|
||||||
|
SELECT COUNT(VARIABLE_VALUE)
|
||||||
|
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
|
||||||
|
WHERE VARIABLE_NAME='binlog_direct_non_transactional_updates';
|
||||||
|
COUNT(VARIABLE_VALUE)
|
||||||
|
1
|
||||||
|
1 Expected
|
||||||
|
'#---------------------BS_STVARS_002_05----------------------#'
|
||||||
|
SELECT COUNT(@@binlog_direct_non_transactional_updates);
|
||||||
|
COUNT(@@binlog_direct_non_transactional_updates)
|
||||||
|
1
|
||||||
|
1 Expected
|
||||||
|
SELECT COUNT(@@local.binlog_direct_non_transactional_updates);
|
||||||
|
COUNT(@@local.binlog_direct_non_transactional_updates)
|
||||||
|
1
|
||||||
|
1 Expected
|
||||||
|
SELECT COUNT(@@SESSION.binlog_direct_non_transactional_updates);
|
||||||
|
COUNT(@@SESSION.binlog_direct_non_transactional_updates)
|
||||||
|
1
|
||||||
|
1 Expected
|
||||||
|
SELECT COUNT(@@GLOBAL.binlog_direct_non_transactional_updates);
|
||||||
|
COUNT(@@GLOBAL.binlog_direct_non_transactional_updates)
|
||||||
|
1
|
||||||
|
1 Expected
|
||||||
|
SET @@global.binlog_direct_non_transactional_updates= @start_value;
|
@ -0,0 +1,97 @@
|
|||||||
|
######### mysql-test\t\binlog_direct_non_transactional_updates.test ###########
|
||||||
|
# #
|
||||||
|
# Variable Name: binlog_direct_non_transactional_updates #
|
||||||
|
# Scope: Global & Session #
|
||||||
|
# Access Type: Static #
|
||||||
|
# Data Type: bool #
|
||||||
|
# #
|
||||||
|
# Description:Test Cases of Dynamic System Variable #
|
||||||
|
# binlog_direct_non_transactional_updates #
|
||||||
|
# that checks the behavior of this variable in the following ways #
|
||||||
|
# * Value Check #
|
||||||
|
# * Scope Check #
|
||||||
|
# #
|
||||||
|
# Reference: #
|
||||||
|
# http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html #
|
||||||
|
# #
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
SELECT @@GLOBAL.binlog_direct_non_transactional_updates;
|
||||||
|
|
||||||
|
--echo '#---------------------BS_STVARS_002_01----------------------#'
|
||||||
|
####################################################################
|
||||||
|
# Displaying default value #
|
||||||
|
####################################################################
|
||||||
|
SET @start_value= @@global.binlog_direct_non_transactional_updates;
|
||||||
|
|
||||||
|
SELECT COUNT(@@GLOBAL.binlog_direct_non_transactional_updates);
|
||||||
|
--echo 1 Expected
|
||||||
|
|
||||||
|
SELECT COUNT(@@SESSION.binlog_direct_non_transactional_updates);
|
||||||
|
--echo 1 Expected
|
||||||
|
|
||||||
|
--echo '#---------------------BS_STVARS_002_02----------------------#'
|
||||||
|
####################################################################
|
||||||
|
# Check if Value can set #
|
||||||
|
####################################################################
|
||||||
|
SET @@GLOBAL.binlog_direct_non_transactional_updates=TRUE;
|
||||||
|
SELECT @@GLOBAL.binlog_direct_non_transactional_updates;
|
||||||
|
|
||||||
|
SET @@SESSION.binlog_direct_non_transactional_updates=TRUE;
|
||||||
|
SELECT @@SESSION.binlog_direct_non_transactional_updates;
|
||||||
|
|
||||||
|
--echo '#---------------------BS_STVARS_002_03----------------------#'
|
||||||
|
#################################################################
|
||||||
|
# Check if the value in GLOBAL Table matches value in variable #
|
||||||
|
#################################################################
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
IF(@@GLOBAL.binlog_direct_non_transactional_updates, "ON", "OFF") = VARIABLE_VALUE
|
||||||
|
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||||
|
WHERE VARIABLE_NAME='binlog_direct_non_transactional_updates';
|
||||||
|
--echo 1 Expected
|
||||||
|
|
||||||
|
SELECT COUNT(@@GLOBAL.binlog_direct_non_transactional_updates);
|
||||||
|
--echo 1 Expected
|
||||||
|
|
||||||
|
SELECT COUNT(VARIABLE_VALUE)
|
||||||
|
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||||
|
WHERE VARIABLE_NAME='binlog_direct_non_transactional_updates';
|
||||||
|
--echo 1 Expected
|
||||||
|
|
||||||
|
|
||||||
|
--echo '#---------------------BS_STVARS_002_04----------------------#'
|
||||||
|
#################################################################
|
||||||
|
# Check if the value in SESSION Table matches value in variable #
|
||||||
|
#################################################################
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
IF(@@SESSION.binlog_direct_non_transactional_updates, "ON", "OFF") = VARIABLE_VALUE
|
||||||
|
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
|
||||||
|
WHERE VARIABLE_NAME='binlog_direct_non_transactional_updates';
|
||||||
|
--echo 1 Expected
|
||||||
|
|
||||||
|
SELECT COUNT(@@SESSION.binlog_direct_non_transactional_updates);
|
||||||
|
--echo 1 Expected
|
||||||
|
|
||||||
|
SELECT COUNT(VARIABLE_VALUE)
|
||||||
|
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
|
||||||
|
WHERE VARIABLE_NAME='binlog_direct_non_transactional_updates';
|
||||||
|
--echo 1 Expected
|
||||||
|
|
||||||
|
|
||||||
|
--echo '#---------------------BS_STVARS_002_05----------------------#'
|
||||||
|
################################################################################
|
||||||
|
# Check if binlog_format can be accessed with and without @@ sign #
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
SELECT COUNT(@@binlog_direct_non_transactional_updates);
|
||||||
|
--echo 1 Expected
|
||||||
|
SELECT COUNT(@@local.binlog_direct_non_transactional_updates);
|
||||||
|
--echo 1 Expected
|
||||||
|
SELECT COUNT(@@SESSION.binlog_direct_non_transactional_updates);
|
||||||
|
--echo 1 Expected
|
||||||
|
SELECT COUNT(@@GLOBAL.binlog_direct_non_transactional_updates);
|
||||||
|
--echo 1 Expected
|
||||||
|
|
||||||
|
SET @@global.binlog_direct_non_transactional_updates= @start_value;
|
150
sql/log.cc
150
sql/log.cc
@ -199,7 +199,7 @@ private:
|
|||||||
class binlog_cache_data
|
class binlog_cache_data
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
binlog_cache_data(): m_pending(0), before_stmt_pos (MY_OFF_T_UNDEF),
|
binlog_cache_data(): m_pending(0), before_stmt_pos(MY_OFF_T_UNDEF),
|
||||||
incident(FALSE)
|
incident(FALSE)
|
||||||
{
|
{
|
||||||
cache_log.end_of_file= max_binlog_cache_size;
|
cache_log.end_of_file= max_binlog_cache_size;
|
||||||
@ -1760,7 +1760,7 @@ static int binlog_rollback(handlerton *hton, THD *thd, bool all)
|
|||||||
binlog_flush_stmt_cache(thd, cache_mngr);
|
binlog_flush_stmt_cache(thd, cache_mngr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cache_mngr->trx_cache.empty())
|
if (cache_mngr->trx_cache.empty())
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
we're here because cache_log was flushed in MYSQL_BIN_LOG::log_xid()
|
we're here because cache_log was flushed in MYSQL_BIN_LOG::log_xid()
|
||||||
@ -1769,7 +1769,6 @@ static int binlog_rollback(handlerton *hton, THD *thd, bool all)
|
|||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (mysql_bin_log.check_write_error(thd))
|
if (mysql_bin_log.check_write_error(thd))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -1909,7 +1908,7 @@ static int binlog_savepoint_rollback(handlerton *hton, THD *thd, void *sv)
|
|||||||
non-transactional table. Otherwise, truncate the binlog cache starting
|
non-transactional table. Otherwise, truncate the binlog cache starting
|
||||||
from the SAVEPOINT command.
|
from the SAVEPOINT command.
|
||||||
*/
|
*/
|
||||||
if (unlikely(thd->transaction.all.modified_non_trans_table ||
|
if (unlikely(thd->transaction.all.modified_non_trans_table ||
|
||||||
(thd->variables.option_bits & OPTION_KEEP_LOG)))
|
(thd->variables.option_bits & OPTION_KEEP_LOG)))
|
||||||
{
|
{
|
||||||
int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED);
|
int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED);
|
||||||
@ -4191,6 +4190,66 @@ bool MYSQL_BIN_LOG::is_query_in_union(THD *thd, query_id_t query_id_param)
|
|||||||
query_id_param >= thd->binlog_evt_union.first_query_id);
|
query_id_param >= thd->binlog_evt_union.first_query_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function checks if a transactional talbe was updated by the
|
||||||
|
current transaction.
|
||||||
|
|
||||||
|
@param thd The client thread that executed the current statement.
|
||||||
|
@return
|
||||||
|
@c true if a transactional table was updated, @c false otherwise.
|
||||||
|
*/
|
||||||
|
bool
|
||||||
|
trans_has_updated_trans_table(const THD* thd)
|
||||||
|
{
|
||||||
|
binlog_cache_mngr *const cache_mngr=
|
||||||
|
(binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton);
|
||||||
|
|
||||||
|
return (cache_mngr ? my_b_tell (&cache_mngr->trx_cache.cache_log) : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function checks if a transactional talbe was updated by the
|
||||||
|
current statement.
|
||||||
|
|
||||||
|
@param thd The client thread that executed the current statement.
|
||||||
|
@return
|
||||||
|
@c true if a transactional table was updated, @c false otherwise.
|
||||||
|
*/
|
||||||
|
bool
|
||||||
|
stmt_has_updated_trans_table(const THD *thd)
|
||||||
|
{
|
||||||
|
Ha_trx_info *ha_info;
|
||||||
|
|
||||||
|
for (ha_info= thd->transaction.stmt.ha_list; ha_info; ha_info= ha_info->next())
|
||||||
|
{
|
||||||
|
if (ha_info->is_trx_read_write() && ha_info->ht() != binlog_hton)
|
||||||
|
return (TRUE);
|
||||||
|
}
|
||||||
|
return (FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function checks if either a trx-cache or a non-trx-cache should
|
||||||
|
be used. If @c bin_log_direct_non_trans_update is active, the cache
|
||||||
|
to be used depends on the flag @c is_transactional.
|
||||||
|
|
||||||
|
Otherswise, we use the trx-cache if either the @c is_transactional
|
||||||
|
is true or the trx-cache is not empty.
|
||||||
|
|
||||||
|
@param thd The client thread.
|
||||||
|
@param is_transactional The changes are related to a trx-table.
|
||||||
|
@return
|
||||||
|
@c true if a trx-cache should be used, @c false otherwise.
|
||||||
|
*/
|
||||||
|
bool use_trans_cache(const THD* thd, bool is_transactional)
|
||||||
|
{
|
||||||
|
binlog_cache_mngr *const cache_mngr=
|
||||||
|
(binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton);
|
||||||
|
|
||||||
|
return
|
||||||
|
(thd->variables.binlog_direct_non_trans_update ? is_transactional :
|
||||||
|
(cache_mngr->trx_cache.empty() && !is_transactional ? FALSE : TRUE));
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
These functions are placed in this file since they need access to
|
These functions are placed in this file since they need access to
|
||||||
@ -4223,44 +4282,6 @@ int THD::binlog_setup_trx_data()
|
|||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
This function checks if a transactional talbe was updated by the
|
|
||||||
current transaction.
|
|
||||||
|
|
||||||
@param thd The client thread that executed the current statement.
|
|
||||||
@return
|
|
||||||
@c true if a transactional table was updated, @false otherwise.
|
|
||||||
*/
|
|
||||||
bool
|
|
||||||
trans_has_updated_trans_table(THD* thd)
|
|
||||||
{
|
|
||||||
binlog_cache_mngr *const cache_mngr=
|
|
||||||
(binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton);
|
|
||||||
|
|
||||||
return (cache_mngr ? my_b_tell (&cache_mngr->trx_cache.cache_log) : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
This function checks if a transactional talbe was updated by the
|
|
||||||
current statement.
|
|
||||||
|
|
||||||
@param thd The client thread that executed the current statement.
|
|
||||||
@return
|
|
||||||
@c true if a transactional table was updated, @false otherwise.
|
|
||||||
*/
|
|
||||||
bool
|
|
||||||
stmt_has_updated_trans_table(THD *thd)
|
|
||||||
{
|
|
||||||
Ha_trx_info *ha_info;
|
|
||||||
|
|
||||||
for (ha_info= thd->transaction.stmt.ha_list; ha_info; ha_info= ha_info->next())
|
|
||||||
{
|
|
||||||
if (ha_info->is_trx_read_write() && ha_info->ht() != binlog_hton)
|
|
||||||
return (TRUE);
|
|
||||||
}
|
|
||||||
return (FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Function to start a statement and optionally a transaction for the
|
Function to start a statement and optionally a transaction for the
|
||||||
binary log.
|
binary log.
|
||||||
@ -4369,8 +4390,8 @@ int THD::binlog_write_table_map(TABLE *table, bool is_transactional)
|
|||||||
binlog_cache_mngr *const cache_mngr=
|
binlog_cache_mngr *const cache_mngr=
|
||||||
(binlog_cache_mngr*) thd_get_ha_data(this, binlog_hton);
|
(binlog_cache_mngr*) thd_get_ha_data(this, binlog_hton);
|
||||||
|
|
||||||
IO_CACHE *file= cache_mngr->get_binlog_cache_log(is_transactional);
|
IO_CACHE *file=
|
||||||
|
cache_mngr->get_binlog_cache_log(use_trans_cache(this, is_transactional));
|
||||||
if ((error= the_event.write(file)))
|
if ((error= the_event.write(file)))
|
||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
|
|
||||||
@ -4405,7 +4426,7 @@ THD::binlog_get_pending_rows_event(bool is_transactional) const
|
|||||||
if (cache_mngr)
|
if (cache_mngr)
|
||||||
{
|
{
|
||||||
binlog_cache_data *cache_data=
|
binlog_cache_data *cache_data=
|
||||||
cache_mngr->get_binlog_cache_data(is_transactional);
|
cache_mngr->get_binlog_cache_data(use_trans_cache(this, is_transactional));
|
||||||
|
|
||||||
rows= cache_data->pending();
|
rows= cache_data->pending();
|
||||||
}
|
}
|
||||||
@ -4434,7 +4455,7 @@ THD::binlog_set_pending_rows_event(Rows_log_event* ev, bool is_transactional)
|
|||||||
DBUG_ASSERT(cache_mngr);
|
DBUG_ASSERT(cache_mngr);
|
||||||
|
|
||||||
binlog_cache_data *cache_data=
|
binlog_cache_data *cache_data=
|
||||||
cache_mngr->get_binlog_cache_data(is_transactional);
|
cache_mngr->get_binlog_cache_data(use_trans_cache(this, is_transactional));
|
||||||
|
|
||||||
cache_data->set_pending(ev);
|
cache_data->set_pending(ev);
|
||||||
}
|
}
|
||||||
@ -4460,7 +4481,7 @@ MYSQL_BIN_LOG::remove_pending_rows_event(THD *thd, bool is_transactional)
|
|||||||
DBUG_ASSERT(cache_mngr);
|
DBUG_ASSERT(cache_mngr);
|
||||||
|
|
||||||
binlog_cache_data *cache_data=
|
binlog_cache_data *cache_data=
|
||||||
cache_mngr->get_binlog_cache_data(is_transactional);
|
cache_mngr->get_binlog_cache_data(use_trans_cache(thd, is_transactional));
|
||||||
|
|
||||||
if (Rows_log_event* pending= cache_data->pending())
|
if (Rows_log_event* pending= cache_data->pending())
|
||||||
{
|
{
|
||||||
@ -4497,7 +4518,7 @@ MYSQL_BIN_LOG::flush_and_set_pending_rows_event(THD *thd,
|
|||||||
DBUG_ASSERT(cache_mngr);
|
DBUG_ASSERT(cache_mngr);
|
||||||
|
|
||||||
binlog_cache_data *cache_data=
|
binlog_cache_data *cache_data=
|
||||||
cache_mngr->get_binlog_cache_data(is_transactional);
|
cache_mngr->get_binlog_cache_data(use_trans_cache(thd, is_transactional));
|
||||||
|
|
||||||
DBUG_PRINT("info", ("cache_mngr->pending(): 0x%lx", (long) cache_data->pending()));
|
DBUG_PRINT("info", ("cache_mngr->pending(): 0x%lx", (long) cache_data->pending()));
|
||||||
|
|
||||||
@ -4608,35 +4629,9 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info)
|
|||||||
binlog_cache_mngr *const cache_mngr=
|
binlog_cache_mngr *const cache_mngr=
|
||||||
(binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton);
|
(binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton);
|
||||||
|
|
||||||
/*
|
bool is_trans_cache= use_trans_cache(thd, event_info->use_trans_cache());
|
||||||
If we are about to use write rows, we just need to check the type of
|
file= cache_mngr->get_binlog_cache_log(is_trans_cache);
|
||||||
the event (either transactional or non-transactional) in order to
|
cache_data= cache_mngr->get_binlog_cache_data(is_trans_cache);
|
||||||
choose the cache.
|
|
||||||
*/
|
|
||||||
if (thd->is_current_stmt_binlog_format_row())
|
|
||||||
{
|
|
||||||
file= cache_mngr->get_binlog_cache_log(event_info->use_trans_cache());
|
|
||||||
cache_data= cache_mngr->get_binlog_cache_data(event_info->use_trans_cache());
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
However, if we are about to write statements we need to consider other
|
|
||||||
things. We use the non-transactional cache when:
|
|
||||||
|
|
||||||
. the transactional cache is empty which means that there were no
|
|
||||||
early statement on behalf of the transaction.
|
|
||||||
. the respective event is tagged as non-transactional.
|
|
||||||
*/
|
|
||||||
else if (cache_mngr->trx_cache.empty() &&
|
|
||||||
!event_info->use_trans_cache())
|
|
||||||
{
|
|
||||||
file= &cache_mngr->stmt_cache.cache_log;
|
|
||||||
cache_data= &cache_mngr->stmt_cache;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
file= &cache_mngr->trx_cache.cache_log;
|
|
||||||
cache_data= &cache_mngr->trx_cache;
|
|
||||||
}
|
|
||||||
|
|
||||||
thd->binlog_start_trans_and_stmt();
|
thd->binlog_start_trans_and_stmt();
|
||||||
}
|
}
|
||||||
@ -4898,7 +4893,6 @@ int MYSQL_BIN_LOG::write_cache(IO_CACHE *cache, bool lock_log, bool sync_log)
|
|||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if we only got a partial header in the last iteration,
|
if we only got a partial header in the last iteration,
|
||||||
get the other half now and process a full header.
|
get the other half now and process a full header.
|
||||||
|
@ -20,8 +20,9 @@ class Relay_log_info;
|
|||||||
|
|
||||||
class Format_description_log_event;
|
class Format_description_log_event;
|
||||||
|
|
||||||
bool trans_has_updated_trans_table(THD* thd);
|
bool trans_has_updated_trans_table(const THD* thd);
|
||||||
bool stmt_has_updated_trans_table(THD *thd);
|
bool stmt_has_updated_trans_table(const THD *thd);
|
||||||
|
bool use_trans_cache(const THD* thd, bool is_transactional);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Transaction Coordinator log - a base abstract class
|
Transaction Coordinator log - a base abstract class
|
||||||
|
@ -6311,3 +6311,8 @@ ER_WRONG_NATIVE_TABLE_STRUCTURE
|
|||||||
|
|
||||||
ER_WRONG_PERFSCHEMA_USAGE
|
ER_WRONG_PERFSCHEMA_USAGE
|
||||||
eng "Invalid performance_schema usage."
|
eng "Invalid performance_schema usage."
|
||||||
|
|
||||||
|
ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_DIRECT
|
||||||
|
eng "Cannot modify @@session.binlog_direct_non_transactional_updates inside a transaction"
|
||||||
|
ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_DIRECT
|
||||||
|
eng "Cannot change the binlog direct flag inside a stored function or trigger"
|
||||||
|
@ -6305,3 +6305,7 @@ ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT
|
|||||||
eng "The syntax '%s' is deprecated and will be removed in MySQL %s."
|
eng "The syntax '%s' is deprecated and will be removed in MySQL %s."
|
||||||
ger "Die Syntax '%s' ist veraltet und wird in MySQL %s entfernt."
|
ger "Die Syntax '%s' ist veraltet und wird in MySQL %s entfernt."
|
||||||
|
|
||||||
|
ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_DIRECT
|
||||||
|
eng "Cannot modify @@session.binlog_direct_non_transactional_updates inside a transaction"
|
||||||
|
ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_DIRECT
|
||||||
|
eng "Cannot change the binlog direct flag inside a stored function or trigger"
|
||||||
|
@ -373,6 +373,7 @@ typedef struct system_variables
|
|||||||
ulong group_concat_max_len;
|
ulong group_concat_max_len;
|
||||||
|
|
||||||
uint binlog_format; ///< binlog format for this thd (see enum_binlog_format)
|
uint binlog_format; ///< binlog format for this thd (see enum_binlog_format)
|
||||||
|
my_bool binlog_direct_non_trans_update;
|
||||||
uint completion_type;
|
uint completion_type;
|
||||||
uint query_cache_type;
|
uint query_cache_type;
|
||||||
uint tx_isolation;
|
uint tx_isolation;
|
||||||
|
@ -299,6 +299,48 @@ static Sys_var_enum Sys_binlog_format(
|
|||||||
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(binlog_format_check),
|
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(binlog_format_check),
|
||||||
ON_UPDATE(fix_binlog_format_after_update));
|
ON_UPDATE(fix_binlog_format_after_update));
|
||||||
|
|
||||||
|
static bool binlog_direct_check(sys_var *self, THD *thd, set_var *var)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
Makes the session variable 'binlog_direct_non_transactional_updates'
|
||||||
|
read-only inside a transaction.
|
||||||
|
*/
|
||||||
|
if (thd->active_transaction() && (var->type == OPT_SESSION))
|
||||||
|
{
|
||||||
|
my_error(ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_DIRECT, MYF(0));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
Makes the session variable 'binlog_direct_non_transactional_updates'
|
||||||
|
read-only if within a procedure, trigger or function.
|
||||||
|
*/
|
||||||
|
if (thd->in_sub_stmt)
|
||||||
|
{
|
||||||
|
my_error(ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_DIRECT, MYF(0));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (check_has_super(self, thd, var))
|
||||||
|
return true;
|
||||||
|
if (var->type == OPT_GLOBAL ||
|
||||||
|
(thd->variables.binlog_direct_non_trans_update ==
|
||||||
|
var->save_result.ulonglong_value))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Sys_var_mybool Sys_binlog_direct(
|
||||||
|
"binlog_direct_non_transactional_updates",
|
||||||
|
"Causes updates to non-transactional engines using statement format to "
|
||||||
|
"be written directly to binary log. Before using this option make sure "
|
||||||
|
"that there are no dependencies between transactional and "
|
||||||
|
"non-transactional tables such as in the statement INSERT INTO t_myisam "
|
||||||
|
"SELECT * FROM t_innodb; otherwise, slaves may diverge from the master.",
|
||||||
|
SESSION_VAR(binlog_direct_non_trans_update),
|
||||||
|
CMD_LINE(OPT_ARG), DEFAULT(FALSE),
|
||||||
|
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(binlog_direct_check));
|
||||||
|
|
||||||
static Sys_var_ulong Sys_bulk_insert_buff_size(
|
static Sys_var_ulong Sys_bulk_insert_buff_size(
|
||||||
"bulk_insert_buffer_size", "Size of tree cache used in bulk "
|
"bulk_insert_buffer_size", "Size of tree cache used in bulk "
|
||||||
"insert optimisation. Note that this is a limit per thread!",
|
"insert optimisation. Note that this is a limit per thread!",
|
||||||
|
@ -51,6 +51,13 @@ server-id = 1
|
|||||||
# binary logging format - mixed recommended
|
# binary logging format - mixed recommended
|
||||||
#binlog_format=mixed
|
#binlog_format=mixed
|
||||||
|
|
||||||
|
# Causes updates to non-transactional engines using statement format to be
|
||||||
|
# written directly to binary log. Before using this option make sure that
|
||||||
|
# there are no dependencies between transactional and non-transactional
|
||||||
|
# tables such as in the statement INSERT INTO t_myisam SELECT * FROM
|
||||||
|
# t_innodb; otherwise, slaves may diverge from the master.
|
||||||
|
#binlog_direct_non_transactional_updates=TRUE
|
||||||
|
|
||||||
# Uncomment the following if you are using InnoDB tables
|
# Uncomment the following if you are using InnoDB tables
|
||||||
#innodb_data_home_dir = @localstatedir@/
|
#innodb_data_home_dir = @localstatedir@/
|
||||||
#innodb_data_file_path = ibdata1:10M:autoextend
|
#innodb_data_file_path = ibdata1:10M:autoextend
|
||||||
|
Reference in New Issue
Block a user