mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Manual merge from mysql-trunk-merge.
Conflicts: - mysql-test/extra/rpl_tests/rpl_mixing_engines.inc - sql/log.cc - sql/mysqld.cc - sql/set_var.cc - sql/sql_class.h
This commit is contained in:
@ -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
|
||||||
|
1392
mysql-test/suite/rpl/r/rpl_stm_binlog_direct.result
Normal file
1392
mysql-test/suite/rpl/r/rpl_stm_binlog_direct.result
Normal file
File diff suppressed because it is too large
Load Diff
1
mysql-test/suite/rpl/t/rpl_stm_binlog_direct-master.opt
Normal file
1
mysql-test/suite/rpl/t/rpl_stm_binlog_direct-master.opt
Normal file
@ -0,0 +1 @@
|
|||||||
|
--binlog-direct-non-transactional-updates
|
230
mysql-test/suite/rpl/t/rpl_stm_binlog_direct.test
Normal file
230
mysql-test/suite/rpl/t/rpl_stm_binlog_direct.test
Normal file
@ -0,0 +1,230 @@
|
|||||||
|
################################################################################
|
||||||
|
# This test case checks if the option "binlog-direct-non-transactional-updates"
|
||||||
|
# makes non-transactional changes in the statement format to be written to the
|
||||||
|
# binary log as soon as the statement commits.
|
||||||
|
#
|
||||||
|
# In what follows, we use the include file rpl_mixing_engines.inc to generate
|
||||||
|
# sql commands from a format string. The format string consists of a sequence of
|
||||||
|
# 'codes' separated by spaces. Before it set of commands, we paste the expected
|
||||||
|
# sequence in the binary log. The following codes exist:
|
||||||
|
#
|
||||||
|
# - Define the scope of a transaction:
|
||||||
|
# B - Begin.
|
||||||
|
# C - Commit.
|
||||||
|
# R - Rollback.
|
||||||
|
#
|
||||||
|
# - Change only T-Tables:
|
||||||
|
# T - Updates a T-Table.
|
||||||
|
# T-trig - Updates T-Tables through a trigger.
|
||||||
|
# T-func - Updates T-Tables through a function.
|
||||||
|
# T-proc - Updates T-Tables through a procedure.
|
||||||
|
# eT - Fails while updating the first tuple in a T-Table.
|
||||||
|
# Te - Fails while updating an n-tuple (n > 1) in a T-Table.
|
||||||
|
# Te-trig - Fails while updating an n-tuple (n > 1) in a T-Table.
|
||||||
|
# Te-func - Fails while updating an n-tuple (n > 1) in a T-Table.
|
||||||
|
#
|
||||||
|
# - Change only N-Tables
|
||||||
|
# N - Updates a N-Table.
|
||||||
|
# N-trig - Updates N-Tables through a trigger.
|
||||||
|
# N-func - Updates N-Tables through a function.
|
||||||
|
# N-proc - Updates N-Tables through a procedure.
|
||||||
|
# eN - Fails while updating the first tuple in a N-Table.
|
||||||
|
# Ne - Fails while updating an n-tuple (n > 1) in a N-Table.
|
||||||
|
# Ne-trig - Fails while updating an n-tuple (n > 1) in a N-Table.
|
||||||
|
# Ne-func - Fails while updating an n-tuple (n > 1) in a N-Table.
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
--source include/have_binlog_format_statement.inc
|
||||||
|
--source include/master-slave.inc
|
||||||
|
--source include/have_innodb.inc
|
||||||
|
|
||||||
|
set @@session.binlog_direct_non_transactional_updates= TRUE;
|
||||||
|
|
||||||
|
--echo #########################################################################
|
||||||
|
--echo # CONFIGURATION
|
||||||
|
--echo #########################################################################
|
||||||
|
|
||||||
|
--let $engine_type= Innodb
|
||||||
|
SET @commands= 'configure';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
--echo #########################################################################
|
||||||
|
--echo # 1 - BINLOG ORDER
|
||||||
|
--echo #########################################################################
|
||||||
|
connection master;
|
||||||
|
|
||||||
|
--echo
|
||||||
|
--echo
|
||||||
|
--echo
|
||||||
|
--echo
|
||||||
|
--echo #
|
||||||
|
--echo #3) Generates in the binlog what follows:
|
||||||
|
--echo # --> STMT "N B T C" entries, format S.
|
||||||
|
--echo #
|
||||||
|
SET @commands= 'B T N C';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
SET @commands= 'B T N-trig C';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
SET @commands= 'B T N-func C';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
SET @commands= 'B T N-proc C';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
SET @commands= 'B T-trig N C';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
SET @commands= 'B T-trig N-trig C';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
SET @commands= 'B T-trig N-func C';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
SET @commands= 'B T-trig N-proc C';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
SET @commands= 'B T-func N C';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
SET @commands= 'B T-func N-trig C';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
SET @commands= 'B T-func N-func C';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
SET @commands= 'B T-func N-proc C';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
SET @commands= 'B T-proc N C';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
SET @commands= 'B T-proc N-trig C';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
SET @commands= 'B T-proc N-func C';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
SET @commands= 'B T-proc N-proc C';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
|
||||||
|
--echo
|
||||||
|
--echo
|
||||||
|
--echo
|
||||||
|
--echo
|
||||||
|
--echo #
|
||||||
|
--echo #3.e) Generates in the binlog what follows if T-* fails:
|
||||||
|
--echo # --> STMT "N" entry, format S.
|
||||||
|
--echo # Otherwise, what follows if N-* fails and a N-Table is changed:
|
||||||
|
--echo # --> STMT "N B T C" entries, format S.
|
||||||
|
--echo #
|
||||||
|
SET @commands= 'B eT N C';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
SET @commands= 'B Te N C';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
SET @commands= 'B T eN C';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
SET @commands= 'B T Ne C';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
|
||||||
|
--echo
|
||||||
|
--echo
|
||||||
|
--echo
|
||||||
|
--echo
|
||||||
|
--echo #
|
||||||
|
--echo #4) Generates in the binlog what follows:
|
||||||
|
--echo # --> STMT "N B T R" entries, format S.
|
||||||
|
--echo #
|
||||||
|
SET @commands= 'B T N R';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
SET @commands= 'B T N-trig R';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
SET @commands= 'B T N-func R';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
SET @commands= 'B T N-proc R';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
SET @commands= 'B T-trig N R';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
SET @commands= 'B T-trig N-trig R';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
SET @commands= 'B T-trig N-func R';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
SET @commands= 'B T-trig N-proc R';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
SET @commands= 'B T-func N R';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
SET @commands= 'B T-func N-trig R';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
SET @commands= 'B T-func N-func R';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
SET @commands= 'B T-func N-proc R';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
SET @commands= 'B T-proc N R';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
SET @commands= 'B T-proc N-trig R';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
SET @commands= 'B T-proc N-func R';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
SET @commands= 'B T-proc N-proc R';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
|
||||||
|
--echo
|
||||||
|
--echo
|
||||||
|
--echo
|
||||||
|
--echo
|
||||||
|
--echo #
|
||||||
|
--echo #4.e) Generates in the binlog what follows if T* fails:
|
||||||
|
--echo # --> STMT "B N C" entry, format S.
|
||||||
|
--echo # Otherwise, what follows if N* fails and a N-Table is changed:
|
||||||
|
--echo # --> STMT "N" entries, format S.
|
||||||
|
--echo #
|
||||||
|
SET @commands= 'B eT N R';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
SET @commands= 'B Te N R';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
SET @commands= 'B T eN R';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
SET @commands= 'B T Ne R';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
||||||
|
|
||||||
|
|
||||||
|
--echo ###################################################################################
|
||||||
|
--echo # CHECK CONSISTENCY
|
||||||
|
--echo ###################################################################################
|
||||||
|
connection master;
|
||||||
|
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_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
|
||||||
|
|
||||||
|
--echo ###################################################################################
|
||||||
|
--echo # CLEAN
|
||||||
|
--echo ###################################################################################
|
||||||
|
SET @commands= 'clean';
|
||||||
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
@ -374,6 +374,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,17 @@ 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 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);
|
||||||
|
|
||||||
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!",
|
||||||
|
Reference in New Issue
Block a user