#At file:///home/acorreia/workspace.sun/repository.mysql.new/bzrwork/bug-55377/mysql-next-mr-bugfixing.merge/ based on revid:sven.sandberg@stripped
3291 Alfranio Correia 2010-09-17 [merge]
merge mysql-trunk-bugfixing (local) --> mysql-trunk-bugfixing
modified:
mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test
mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result
mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result
mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result
mysql-test/suite/rpl/t/rpl_mixed_binlog_max_cache_size-master.opt
mysql-test/suite/rpl/t/rpl_row_binlog_max_cache_size-master.opt
mysql-test/suite/rpl/t/rpl_stm_binlog_max_cache_size-master.opt
sql/binlog.cc
sql/binlog.h
sql/mysqld.cc
sql/share/errmsg-utf8.txt
sql/sys_vars.cc
=== modified file 'mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test'
--- a/mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test 2010-06-30 20:56:21 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test 2010-09-06 16:21:15 +0000
@@ -1,11 +1,13 @@
########################################################################################
-# This test verifies if the binlog is not corrupted when the cache buffer is not
-# big enough to accommodate the changes and is divided in five steps:
+# This test does two things. First it verifies if the binlog is not corrupted when
+# the cache buffer is not big enough to accommodate the changes and is divided in
+# five steps:
#
# 1 - Single Statements:
-# 1.1 - Single statement on transactional table.
-# 1.2 - Single statement on non-transactional table.
-# 1.3 - Single statement on both transactional and non-transactional tables.
+# 1.1 - Single statement on transactional table.
+# 1.2 - Single statement on non-transactional table.
+# 1.3 - Single statement on both transactional and non-transactional tables.
+#
# In both 1.2 and 1.3, an incident event is logged to notify the user that the
# master and slave are diverging.
#
@@ -19,10 +21,14 @@
# table. In this case, a failure means that the statement does not get into
# the cache and an incident event is logged to notify the user that the master
# and slave are diverging.
-#
+#
+# Then it checks what happens when we try to set BINLOG_CACHE_SIZE to a value that
+# is greater than MAX_BINLOG_CACHE_SIZE and vice-versa. In both cases, We expect
+# that BINLOG_CACHE_SIZE will be set to MAX_BINLOG_CACHE_SIZE. (BUG#55377)
########################################################################################
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+call mtr.add_suppression("Option binlog_cache_size ");
CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb;
CREATE TABLE t2(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=MyIsam;
@@ -374,10 +380,29 @@ let $diff_statement= SELECT * FROM t1;
--source include/diff_master_slave.inc
--echo ########################################################################################
+--echo # CHECK MAX_BINLOG_CACHE_SIZE and BINLOG_CACHE_SIZE
+--echo ########################################################################################
+#
+# Checking what happens when we try to set BINLOG_CACHE_SIZE to a value that is
+# greater than MAX_BINLOG_CACHE_SIZE and vice-versa. In both cases, We expect
+# that BINLOG_CACHE_SIZE will be set to MAX_BINLOG_CACHE_SIZE. (BUG#55377)
+#
+connection master;
+
+SET @@GLOBAL.MAX_BINLOG_CACHE_SIZE= 8192;
+SHOW VARIABLES LIKE 'MAX_BINLOG_CACHE_SIZE';
+SHOW VARIABLES LIKE 'BINLOG_CACHE_SIZE';
+SET @@GLOBAL.BINLOG_CACHE_SIZE= 16384;
+SHOW VARIABLES LIKE 'MAX_BINLOG_CACHE_SIZE';
+SHOW VARIABLES LIKE 'BINLOG_CACHE_SIZE';
+SET @@GLOBAL.MAX_BINLOG_CACHE_SIZE= 4096;
+SHOW VARIABLES LIKE 'MAX_BINLOG_CACHE_SIZE';
+SHOW VARIABLES LIKE 'BINLOG_CACHE_SIZE';
+
+--echo ########################################################################################
--echo # CLEAN
--echo ########################################################################################
-connection master;
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
=== modified file 'mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result'
--- a/mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result 2010-08-30 06:38:09 +0000
+++ b/mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result 2010-09-17 11:02:46 +0000
@@ -5,6 +5,7 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+call mtr.add_suppression("Option binlog_cache_size ");
CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb;
CREATE TABLE t2(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=MyIsam;
CREATE TABLE t3(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb;
@@ -120,6 +121,34 @@ Got one of the listed errors
COMMIT;
source include/diff_master_slave.inc;
########################################################################################
+# CHECK MAX_BINLOG_CACHE_SIZE and BINLOG_CACHE_SIZE
+########################################################################################
+SET @@GLOBAL.MAX_BINLOG_CACHE_SIZE= 8192;
+SHOW VARIABLES LIKE 'MAX_BINLOG_CACHE_SIZE';
+Variable_name Value
+max_binlog_cache_size 8192
+SHOW VARIABLES LIKE 'BINLOG_CACHE_SIZE';
+Variable_name Value
+binlog_cache_size 4096
+SET @@GLOBAL.BINLOG_CACHE_SIZE= 16384;
+Warnings:
+Warning 1708 Option binlog_cache_size (16384) is greater than max_binlog_cache_size (8192); setting binlog_cache_size equal to max_binlog_cache_size.
+SHOW VARIABLES LIKE 'MAX_BINLOG_CACHE_SIZE';
+Variable_name Value
+max_binlog_cache_size 8192
+SHOW VARIABLES LIKE 'BINLOG_CACHE_SIZE';
+Variable_name Value
+binlog_cache_size 8192
+SET @@GLOBAL.MAX_BINLOG_CACHE_SIZE= 4096;
+Warnings:
+Warning 1708 Option binlog_cache_size (8192) is greater than max_binlog_cache_size (4096); setting binlog_cache_size equal to max_binlog_cache_size.
+SHOW VARIABLES LIKE 'MAX_BINLOG_CACHE_SIZE';
+Variable_name Value
+max_binlog_cache_size 4096
+SHOW VARIABLES LIKE 'BINLOG_CACHE_SIZE';
+Variable_name Value
+binlog_cache_size 4096
+########################################################################################
# CLEAN
########################################################################################
DROP TABLE t1;
=== modified file 'mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result'
--- a/mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result 2010-08-30 06:38:09 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result 2010-09-17 11:02:46 +0000
@@ -5,6 +5,7 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+call mtr.add_suppression("Option binlog_cache_size ");
CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb;
CREATE TABLE t2(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=MyIsam;
CREATE TABLE t3(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb;
@@ -123,6 +124,34 @@ Got one of the listed errors
COMMIT;
source include/diff_master_slave.inc;
########################################################################################
+# CHECK MAX_BINLOG_CACHE_SIZE and BINLOG_CACHE_SIZE
+########################################################################################
+SET @@GLOBAL.MAX_BINLOG_CACHE_SIZE= 8192;
+SHOW VARIABLES LIKE 'MAX_BINLOG_CACHE_SIZE';
+Variable_name Value
+max_binlog_cache_size 8192
+SHOW VARIABLES LIKE 'BINLOG_CACHE_SIZE';
+Variable_name Value
+binlog_cache_size 4096
+SET @@GLOBAL.BINLOG_CACHE_SIZE= 16384;
+Warnings:
+Warning 1708 Option binlog_cache_size (16384) is greater than max_binlog_cache_size (8192); setting binlog_cache_size equal to max_binlog_cache_size.
+SHOW VARIABLES LIKE 'MAX_BINLOG_CACHE_SIZE';
+Variable_name Value
+max_binlog_cache_size 8192
+SHOW VARIABLES LIKE 'BINLOG_CACHE_SIZE';
+Variable_name Value
+binlog_cache_size 8192
+SET @@GLOBAL.MAX_BINLOG_CACHE_SIZE= 4096;
+Warnings:
+Warning 1708 Option binlog_cache_size (8192) is greater than max_binlog_cache_size (4096); setting binlog_cache_size equal to max_binlog_cache_size.
+SHOW VARIABLES LIKE 'MAX_BINLOG_CACHE_SIZE';
+Variable_name Value
+max_binlog_cache_size 4096
+SHOW VARIABLES LIKE 'BINLOG_CACHE_SIZE';
+Variable_name Value
+binlog_cache_size 4096
+########################################################################################
# CLEAN
########################################################################################
DROP TABLE t1;
=== modified file 'mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result'
--- a/mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result 2010-08-30 06:38:09 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result 2010-09-17 11:02:46 +0000
@@ -5,6 +5,7 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
+call mtr.add_suppression("Option binlog_cache_size ");
CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb;
CREATE TABLE t2(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=MyIsam;
CREATE TABLE t3(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb;
@@ -120,6 +121,34 @@ Got one of the listed errors
COMMIT;
source include/diff_master_slave.inc;
########################################################################################
+# CHECK MAX_BINLOG_CACHE_SIZE and BINLOG_CACHE_SIZE
+########################################################################################
+SET @@GLOBAL.MAX_BINLOG_CACHE_SIZE= 8192;
+SHOW VARIABLES LIKE 'MAX_BINLOG_CACHE_SIZE';
+Variable_name Value
+max_binlog_cache_size 8192
+SHOW VARIABLES LIKE 'BINLOG_CACHE_SIZE';
+Variable_name Value
+binlog_cache_size 4096
+SET @@GLOBAL.BINLOG_CACHE_SIZE= 16384;
+Warnings:
+Warning 1708 Option binlog_cache_size (16384) is greater than max_binlog_cache_size (8192); setting binlog_cache_size equal to max_binlog_cache_size.
+SHOW VARIABLES LIKE 'MAX_BINLOG_CACHE_SIZE';
+Variable_name Value
+max_binlog_cache_size 8192
+SHOW VARIABLES LIKE 'BINLOG_CACHE_SIZE';
+Variable_name Value
+binlog_cache_size 8192
+SET @@GLOBAL.MAX_BINLOG_CACHE_SIZE= 4096;
+Warnings:
+Warning 1708 Option binlog_cache_size (8192) is greater than max_binlog_cache_size (4096); setting binlog_cache_size equal to max_binlog_cache_size.
+SHOW VARIABLES LIKE 'MAX_BINLOG_CACHE_SIZE';
+Variable_name Value
+max_binlog_cache_size 4096
+SHOW VARIABLES LIKE 'BINLOG_CACHE_SIZE';
+Variable_name Value
+binlog_cache_size 4096
+########################################################################################
# CLEAN
########################################################################################
DROP TABLE t1;
=== modified file 'mysql-test/suite/rpl/t/rpl_mixed_binlog_max_cache_size-master.opt'
--- a/mysql-test/suite/rpl/t/rpl_mixed_binlog_max_cache_size-master.opt 2009-11-03 19:02:56 +0000
+++ b/mysql-test/suite/rpl/t/rpl_mixed_binlog_max_cache_size-master.opt 2010-09-06 16:21:15 +0000
@@ -1 +1 @@
---binlog_cache_size=4096 --max_binlog_cache_size=7680
+--binlog_cache_size=15360 --max_binlog_cache_size=7680 --default-storage-engine=MyISAM
=== modified file 'mysql-test/suite/rpl/t/rpl_row_binlog_max_cache_size-master.opt'
--- a/mysql-test/suite/rpl/t/rpl_row_binlog_max_cache_size-master.opt 2010-06-17 20:51:35 +0000
+++ b/mysql-test/suite/rpl/t/rpl_row_binlog_max_cache_size-master.opt 2010-09-06 16:21:15 +0000
@@ -1 +1 @@
---binlog_cache_size=4096 --max_binlog_cache_size=7680 --default-storage-engine=MyISAM
+--binlog_cache_size=15360 --max_binlog_cache_size=7680 --default-storage-engine=MyISAM
=== modified file 'mysql-test/suite/rpl/t/rpl_stm_binlog_max_cache_size-master.opt'
--- a/mysql-test/suite/rpl/t/rpl_stm_binlog_max_cache_size-master.opt 2009-11-03 19:02:56 +0000
+++ b/mysql-test/suite/rpl/t/rpl_stm_binlog_max_cache_size-master.opt 2010-09-06 16:21:15 +0000
@@ -1 +1 @@
---binlog_cache_size=4096 --max_binlog_cache_size=7680
+--binlog_cache_size=15360 --max_binlog_cache_size=7680 --default-storage-engine=MyISAM
=== modified file 'sql/binlog.cc'
--- a/sql/binlog.cc 2010-09-04 00:24:29 +0000
+++ b/sql/binlog.cc 2010-09-17 11:02:46 +0000
@@ -242,6 +242,32 @@ private:
binlog_cache_mngr(const binlog_cache_mngr& info);
};
+/**
+ Checks if the BINLOG_CACHE_SIZE's value is greater than MAX_BINLOG_CACHE_SIZE.
+ If this happens, the BINLOG_CACHE_SIZE is set to MAX_BINLOG_CACHE_SIZE.
+*/
+void check_binlog_cache_size(THD *thd)
+{
+ if (binlog_cache_size > max_binlog_cache_size)
+ {
+ if (thd)
+ {
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_BINLOG_CACHE_SIZE_GREATER_THAN_MAX,
+ ER(ER_BINLOG_CACHE_SIZE_GREATER_THAN_MAX),
+ (ulong) binlog_cache_size,
+ (ulong) max_binlog_cache_size);
+ }
+ else
+ {
+ sql_print_warning(ER_DEFAULT(ER_BINLOG_CACHE_SIZE_GREATER_THAN_MAX),
+ (ulong) binlog_cache_size,
+ (ulong) max_binlog_cache_size);
+ }
+ binlog_cache_size= max_binlog_cache_size;
+ }
+}
+
/*
Save position of binary log transaction cache.
=== modified file 'sql/binlog.h'
--- a/sql/binlog.h 2010-08-26 14:29:22 +0000
+++ b/sql/binlog.h 2010-09-06 16:21:15 +0000
@@ -260,5 +260,6 @@ int check_binlog_magic(IO_CACHE* log, co
bool purge_master_logs(THD* thd, const char* to_log);
bool purge_master_logs_before_date(THD* thd, time_t purge_time);
bool show_binlog_events(THD *thd, MYSQL_BIN_LOG *binary_log);
+void check_binlog_cache_size(THD *thd);
#endif /* BINLOG_H_INCLUDED */
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2010-09-14 22:13:37 +0000
+++ b/sql/mysqld.cc 2010-09-17 11:02:46 +0000
@@ -4674,6 +4674,8 @@ int mysqld_main(int argc, char **argv)
if (opt_bootstrap) /* If running with bootstrap, do not start replication. */
opt_skip_slave_start= 1;
+ check_binlog_cache_size(NULL);
+
binlog_unsafe_map_init();
/*
init_slave() must be called after the thread keys are created.
=== modified file 'sql/share/errmsg-utf8.txt'
--- a/sql/share/errmsg-utf8.txt 2010-09-09 10:58:40 +0000
+++ b/sql/share/errmsg-utf8.txt 2010-09-17 11:02:46 +0000
@@ -6389,3 +6389,6 @@ ER_ROW_DOES_NOT_MATCH_PARTITION
swe "Hittade rad som inte passar i partitionen"
ER_WARN_INDEX_NOT_APPLICABLE
eng "Cannot use %-.64s access on index '%-.64s' due to type or collation conversion on field '%-.64s'"
+
+ER_BINLOG_CACHE_SIZE_GREATER_THAN_MAX
+ eng "Option binlog_cache_size (%lu) is greater than max_binlog_cache_size (%lu); setting binlog_cache_size equal to max_binlog_cache_size."
=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc 2010-09-01 13:13:01 +0000
+++ b/sql/sys_vars.cc 2010-09-17 11:02:46 +0000
@@ -235,6 +235,12 @@ static Sys_var_charptr Sys_basedir(
READ_ONLY GLOBAL_VAR(mysql_home_ptr), CMD_LINE(REQUIRED_ARG, 'b'),
IN_FS_CHARSET, DEFAULT(0));
+static bool fix_binlog_cache_size(sys_var *self, THD *thd, enum_var_type type)
+{
+ check_binlog_cache_size(thd);
+ return false;
+}
+
static Sys_var_ulong Sys_binlog_cache_size(
"binlog_cache_size", "The size of the cache to "
"hold the SQL statements for the binary log during a "
@@ -242,7 +248,9 @@ static Sys_var_ulong Sys_binlog_cache_si
"transactions you can increase this to get more performance",
GLOBAL_VAR(binlog_cache_size),
CMD_LINE(REQUIRED_ARG),
- VALID_RANGE(IO_SIZE, ULONG_MAX), DEFAULT(32768), BLOCK_SIZE(IO_SIZE));
+ VALID_RANGE(IO_SIZE, ULONG_MAX), DEFAULT(32768), BLOCK_SIZE(IO_SIZE),
+ NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
+ ON_UPDATE(fix_binlog_cache_size));
static bool check_has_super(sys_var *self, THD *thd, set_var *var)
{
@@ -1055,7 +1063,9 @@ static Sys_var_ulonglong Sys_max_binlog_
GLOBAL_VAR(max_binlog_cache_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(IO_SIZE, ULONGLONG_MAX),
DEFAULT((ULONGLONG_MAX/IO_SIZE)*IO_SIZE),
- BLOCK_SIZE(IO_SIZE));
+ BLOCK_SIZE(IO_SIZE),
+ NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
+ ON_UPDATE(fix_binlog_cache_size));
static bool fix_max_binlog_size(sys_var *self, THD *thd, enum_var_type type)
{
Attachment: [text/bzr-bundle] bzr/alfranio.correia@oracle.com-20100917110246-i6028k9te6ng0se6.bundle
| Thread |
|---|
| • bzr commit into mysql-next-mr-bugfixing branch (alfranio.correia:3291) | Alfranio Correia | 17 Sep |