1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Manual merge of mysql-5.1-bugteam into mysql-trunk-merge.

Conflicts:

Text conflict in .bzr-mysql/default.conf
Text conflict in mysql-test/suite/rpl/r/rpl_slow_query_log.result
Text conflict in mysql-test/suite/rpl/t/rpl_slow_query_log.test
Conflict adding files to server-tools.  Created directory.
Conflict because server-tools is not versioned, but has versioned children.  Versioned directory.
Conflict adding files to server-tools/instance-manager.  Created directory.
Conflict because server-tools/instance-manager is not versioned, but has versioned children.  Versioned directory.
Contents conflict in server-tools/instance-manager/options.cc
Text conflict in sql/mysqld.cc
This commit is contained in:
Alexey Kopytov
2010-02-09 12:59:38 +05:00
37 changed files with 958 additions and 270 deletions

View File

@@ -4,6 +4,7 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
CALL mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
include/stop_slave.inc
SET @old_log_output= @@log_output;
SET GLOBAL log_output= 'TABLE';
@@ -45,3 +46,46 @@ include/stop_slave.inc
SET GLOBAL long_query_time= @old_long_query_time;
SET GLOBAL log_output= @old_log_output;
include/start_slave.inc
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
SET @old_log_output= @@log_output;
SET GLOBAL log_output= 'TABLE';
SET GLOBAL long_query_time= 2;
SET @old_long_query_time= @@long_query_time;
SET SESSION long_query_time= 2;
TRUNCATE mysql.slow_log;
include/stop_slave.inc
SET @old_log_output= @@log_output;
SET GLOBAL log_output= 'TABLE';
SET @old_long_query_time= @@long_query_time;
SET GLOBAL long_query_time= 2;
TRUNCATE mysql.slow_log;
include/start_slave.inc
CREATE TABLE t1 (a int, b int);
********************************************************************
**** INSERT one row that exceeds long_query_time
**** Outcome: query ends up in both master and slave slow log
********************************************************************
INSERT INTO t1 values(1, sleep(3));
### Assertion is good. Both Master and Slave exhibit the
### same number of queries in slow log: 1
TRUNCATE mysql.slow_log;
TRUNCATE mysql.slow_log;
********************************************************************
**** Now do inserts again, but first add an index to the table.
**** Outcome: Note that the slave contains the same one entry (as
**** the master does) whereas before the patch it did not.
********************************************************************
ALTER TABLE t1 ADD INDEX id1(a);
INSERT INTO t1 values(1, sleep(3));
### Assertion is good. Both Master and Slave exhibit the
### same number of queries in slow log: 1
SET @@global.log_output= @old_log_output;
SET @@global.long_query_time= @old_long_query_time;
DROP TABLE t1;
SET @@global.log_output= @old_log_output;
SET @@global.long_query_time= @old_long_query_time;

View File

@@ -4,6 +4,7 @@
# if the path of the load data file is a symbolic link.
#
--source include/master-slave.inc
--source include/not_windows.inc
--source include/have_binlog_format_statement.inc
create table t1(a int not null auto_increment, b int, primary key(a) );

View File

@@ -28,6 +28,8 @@
source include/master-slave.inc;
source include/have_binlog_format_statement.inc;
CALL mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
# Prepare slave for different long_query_time we need to stop the slave
# and restart it as long_query_time variable is dynamic and, after
@@ -189,3 +191,119 @@ source include/start_slave.inc;
disconnect extra;
disconnect extra2;
#
# BUG#50620: Adding an index to a table prevents slave from logging into slow log
#
-- source include/master-slave-reset.inc
-- connection master
SET @old_log_output= @@log_output;
SET GLOBAL log_output= 'TABLE';
SET GLOBAL long_query_time= 2;
SET @old_long_query_time= @@long_query_time;
SET SESSION long_query_time= 2;
TRUNCATE mysql.slow_log;
-- connection slave
-- source include/stop_slave.inc
SET @old_log_output= @@log_output;
SET GLOBAL log_output= 'TABLE';
SET @old_long_query_time= @@long_query_time;
SET GLOBAL long_query_time= 2;
TRUNCATE mysql.slow_log;
-- source include/start_slave.inc
let $slow_query= INSERT INTO t1 values(1, sleep(3));
-- connection master
CREATE TABLE t1 (a int, b int);
-- echo ********************************************************************
-- echo **** INSERT one row that exceeds long_query_time
-- echo **** Outcome: query ends up in both master and slave slow log
-- echo ********************************************************************
-- disable_warnings
-- eval $slow_query
-- enable_warnings
let $master_slow_query= `SELECT count(*) = 1 FROM mysql.slow_log WHERE sql_text like '$slow_query'`;
-- sync_slave_with_master
let $slave_slow_query= `SELECT count(*) = 1 FROM mysql.slow_log WHERE sql_text like '$slow_query'`;
if (`SELECT $master_slow_query != $slave_slow_query`)
{
-- connection master
-- echo ***********************************************
-- echo ** DUMPING MASTER SLOW LOG CONTENTS
-- echo ***********************************************
SELECT * FROM mysql.slow_log;
-- connection slave
-- echo ***********************************************
-- echo ** DUMPING SLAVE SLOW LOG CONTENTS
-- echo ***********************************************
SELECT * FROM mysql.slow_log;
-- die "Assertion failed! Master and slave slow log contents differ. Bailing out!"
}
if (`SELECT $master_slow_query = $slave_slow_query`)
{
-- echo ### Assertion is good. Both Master and Slave exhibit the
-- echo ### same number of queries in slow log: $master_slow_query
}
TRUNCATE mysql.slow_log;
-- connection master
TRUNCATE mysql.slow_log;
-- echo ********************************************************************
-- echo **** Now do inserts again, but first add an index to the table.
-- echo **** Outcome: Note that the slave contains the same one entry (as
-- echo **** the master does) whereas before the patch it did not.
-- echo ********************************************************************
ALTER TABLE t1 ADD INDEX id1(a);
-- disable_warnings
-- eval $slow_query
-- enable_warnings
let $master_slow_query= `SELECT count(*) = 1 FROM mysql.slow_log WHERE sql_text like '$slow_query'`;
-- sync_slave_with_master
let $slave_slow_query= `SELECT count(*) = 1 FROM mysql.slow_log WHERE sql_text like '$slow_query'`;
if (`SELECT $master_slow_query != $slave_slow_query`)
{
-- connection master
-- echo ***********************************************
-- echo ** DUMPING MASTER SLOW LOG CONTENTS
-- echo ***********************************************
SELECT * FROM mysql.slow_log;
-- connection slave
-- echo ***********************************************
-- echo ** DUMPING SLAVE SLOW LOG CONTENTS
-- echo ***********************************************
SELECT * FROM mysql.slow_log;
-- die "Assertion failed! Master and slave slow log contents differ. Bailing out!"
}
if (`SELECT $master_slow_query = $slave_slow_query`)
{
-- echo ### Assertion is good. Both Master and Slave exhibit the
-- echo ### same number of queries in slow log: $master_slow_query
}
-- connection master
SET @@global.log_output= @old_log_output;
SET @@global.long_query_time= @old_long_query_time;
DROP TABLE t1;
-- sync_slave_with_master
SET @@global.log_output= @old_log_output;
SET @@global.long_query_time= @old_long_query_time;