1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

mysql-5.5 merge

This commit is contained in:
Sergei Golubchik
2012-01-16 20:16:35 +01:00
321 changed files with 5432 additions and 3995 deletions

View File

@ -0,0 +1,42 @@
include/master-slave.inc
[connection master]
CREATE TABLE t1 (a INT);
FLUSH BINARY LOGS;
INSERT INTO t1 VALUES (1);
# Shutdown master
include/rpl_stop_server.inc [server_number=1]
# Move the master binlog files and the index file to a new place
# Restart master with log-bin option set to the new path
# Master has restarted successfully
# Create the master-bin.index file with the old format
# Shutdown master
include/rpl_stop_server.inc [server_number=1]
# Move back the master binlog files
# Remove the unneeded master-bin.index file
# Restart master with log-bin option set to default
# Master has restarted successfully
# stop slave
include/stop_slave.inc
include/rpl_stop_server.inc [server_number=2]
# relocate binlogs
# relocate relay logs
# Restart slave with options log-bin, relay-log set to the new paths
# Slave server has restarted successfully
include/start_slave.inc
include/stop_slave.inc
FLUSH LOGS;
INSERT INTO t1 VALUES (2);
INSERT INTO t1 VALUES (2);
INSERT INTO t1 VALUES (2);
INSERT INTO t1 VALUES (2);
FLUSH LOGS;
FLUSH LOGS;
include/start_slave.inc
include/diff_tables.inc [master:t1,slave:t1]
DROP TABLE t1;
include/stop_slave.inc
include/rpl_stop_server.inc [server_number=2]
# remove tmpdir
# restarted with previous slave settings
include/start_slave.inc
include/rpl_end.inc

View File

@ -11,7 +11,7 @@ reset slave;
start slave;
include/wait_for_slave_param.inc [Last_IO_Errno]
Last_IO_Errno = '1236'
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'binlog truncated in the middle of event; consider out of disk space on master; the last event was read from 'master-bin.000001' at 316, the last byte read was read from 'master-bin.000001' at 335.''
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'binlog truncated in the middle of event; consider out of disk space on master; the last event was read from './master-bin.000001' at 316, the last byte read was read from './master-bin.000001' at 335.''
reset master;
stop slave;
reset slave;

View File

@ -71,7 +71,7 @@ insert into t1 values (1) /* will not be applied on slave due to simulation */;
set @@global.debug_dbug='d,simulate_slave_unaware_checksum';
start slave;
include/wait_for_slave_io_error.inc [errno=1236]
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'Slave can not handle replication events with the checksum that master is configured to log; the last event was read from 'master-bin.000010' at 245, the last byte read was read from 'master-bin.000010' at 245.''
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'Slave can not handle replication events with the checksum that master is configured to log; the last event was read from './master-bin.000010' at 245, the last byte read was read from './master-bin.000010' at 245.''
select count(*) as zero from t1;
zero
0

View File

@ -0,0 +1,11 @@
include/master-slave.inc
[connection master]
call mtr.add_suppression(".*Invalid .* username when attempting to connect to the master server.*");
include/stop_slave.inc
CHANGE MASTER TO MASTER_USER= '', MASTER_PASSWORD= '';
START SLAVE;
include/wait_for_slave_io_error.inc [errno=1045, 1593]
include/stop_slave.inc
CHANGE MASTER TO MASTER_USER= 'root', MASTER_PASSWORD= '';
START SLAVE;
include/rpl_end.inc

View File

@ -1,6 +1,7 @@
call mtr.add_suppression("Unsafe statement written to the binary log using statement format");
include/master-slave.inc
[connection master]
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY AUTO_INCREMENT, b INT,
UNIQUE(b));
INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10;

View File

@ -11,7 +11,6 @@ include/stop_slave.inc
change master to master_log_pos=MASTER_LOG_POS;
start slave;
include/wait_for_slave_io_error.inc [errno=1236]
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master; the last event was read from 'master-bin.000001' at 247, the last byte read was read from 'master-bin.000001' at 266.''
include/stop_slave_sql.inc
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB

View File

@ -0,0 +1,30 @@
include/master-slave.inc
[connection master]
show binary logs;
Log_name File_size
master-bin.000001 #
create table t1 (f text) engine=innodb;
SET DEBUG_SYNC = 'at_purge_logs_before_date WAIT_FOR rotated';
insert into t1 set f=repeat('a', 4096);
*** there must be two logs in the list ***
show binary logs;
Log_name File_size
master-bin.000001 #
master-bin.000002 #
insert into t1 set f=repeat('b', 4096);
*** there must be three logs in the list ***
show binary logs;
Log_name File_size
master-bin.000001 #
master-bin.000002 #
master-bin.000003 #
SET DEBUG_SYNC = 'now SIGNAL rotated';
SET DEBUG_SYNC = 'RESET';
SET DEBUG_SYNC = 'RESET';
SET DEBUG_SYNC = 'at_purge_logs_before_date WAIT_FOR rotated';
insert into t1 set f=repeat('b', 4096);
SET DEBUG_SYNC = 'now SIGNAL rotated';
SET DEBUG_SYNC = 'RESET';
SET DEBUG_SYNC = 'RESET';
drop table t1;
include/rpl_end.inc

View File

@ -0,0 +1,18 @@
include/master-slave.inc
[connection master]
include/stop_slave.inc
SET GLOBAL log_warnings = 2;
SET GLOBAL debug_dbug="d,inject_long_find_row_note";
include/start_slave.inc
CREATE TABLE t1 (c1 INT);
INSERT INTO t1 VALUES (1), (2);
UPDATE t1 SET c1= 1000 WHERE c1=2;
DELETE FROM t1;
DROP TABLE t1;
# Check if any note related to long DELETE_ROWS and UPDATE_ROWS appears in the error log
Occurrences: update=1, delete=1
include/stop_slave.inc
SET GLOBAL debug_dbug = '';
SET GLOBAL log_warnings = 1;
include/start_slave.inc
include/rpl_end.inc

View File

@ -0,0 +1,209 @@
# ==== Purpose ====
#
# Test that server can work fine after moving binlog or relay log
# files to another directory and setting binlog or relay log paths to
# the new path.
#
# ==== Method ====
#
# Start replication, and then shutdown the master, move the binary
# logs and the log index file to a another directory and then restart
# the server with option to set the new binlog directory. After master
# restarted successfully, do the similar on slave to check the relay
# log of slave.
#
# ==== Reference ====
#
# BUG#12133 master.index file keeps mysqld from starting if bin log has been moved
# BUG#42576 Relay logs in relay-log.info&localhost-relay-bin.index not processed after move
source include/master-slave.inc;
# There is no need to run this test case on all binlog format
source include/have_binlog_format_row.inc;
# Since this test relies heavily on filesystem operations (like
# moving files around, backslashes and so forth) we avoid messing
# around with windows access violations for not cluttering the
# test case any further. It is prepared to support windows, but
# it is not 100% compliant.
--source include/not_windows.inc
connection master;
--let $master_datadir= `select @@datadir`
connection slave;
--let $slave_datadir= `select @@datadir`
connection master;
--let $dirname= `select uuid()`
--let $tmpdir= $MYSQLTEST_VARDIR/tmp/$dirname
--mkdir $tmpdir
CREATE TABLE t1 (a INT);
# flush to generate one more binlog file.
FLUSH BINARY LOGS;
INSERT INTO t1 VALUES (1);
sync_slave_with_master;
#
# Test on master
#
connection master;
--echo # Shutdown master
--let $rpl_server_number=1
source include/rpl_stop_server.inc;
--echo # Move the master binlog files and the index file to a new place
--move_file $master_datadir/master-bin.000001 $tmpdir/master-bin.000001
--move_file $master_datadir/master-bin.000002 $tmpdir/master-bin.000002
--move_file $master_datadir/master-bin.index $tmpdir/master-bin.index
--echo # Restart master with log-bin option set to the new path
--let $rpl_server_parameters=--log-bin=$tmpdir/master-bin
--let $keep_include_silent=1
source include/rpl_start_server.inc;
--let $keep_include_silent=0
--echo # Master has restarted successfully
#
# Test master can handle old format with directory path in index file
#
--let $is_windows= `select convert(@@version_compile_os using latin1) in ('Win32', 'Win64', 'Windows')`
# write_var_to_file.inc will call SELECT INTO DUMPFILE, which has to be
# done before shutdown the server
--echo # Create the master-bin.index file with the old format
--let $write_to_file= $master_datadir/master-bin.index
if ($is_windows)
{
--let $write_var= .\\\\master-bin.000001\n.\\\\master-bin.000002\n.\\\\master-bin.000003\n
}
if (!$is_windows)
{
--let $write_var= ./master-bin.000001\n./master-bin.000002\n./master-bin.000003\n
}
--disable_query_log
source include/write_var_to_file.inc;
--enable_query_log
--echo # Shutdown master
--let $rpl_server_number=1
source include/rpl_stop_server.inc;
--echo # Move back the master binlog files
--move_file $tmpdir/master-bin.000001 $master_datadir/master-bin.000001
--move_file $tmpdir/master-bin.000002 $master_datadir/master-bin.000002
--move_file $tmpdir/master-bin.000003 $master_datadir/master-bin.000003
--echo # Remove the unneeded master-bin.index file
--remove_file $tmpdir/master-bin.index
--echo # Restart master with log-bin option set to default
--let $rpl_server_parameters=--log-bin=$master_datadir/master-bin
--let $keep_include_silent=1
source include/rpl_start_server.inc;
--let $keep_include_silent=0
--echo # Master has restarted successfully
connection slave;
--echo # stop slave
--source include/stop_slave.inc
--let $rpl_server_number= 2
--source include/rpl_stop_server.inc
# switch to master because the slave has been shutdown
# and relocate_binlogs requires a running server to do
# SQL operations
--connection master
--let $relocate_disable_query_log= 1
--let $relocate_is_windows= $is_windows
--let $relocate_from=$slave_datadir
--let $relocate_into=$tmpdir
--echo # relocate binlogs
--let $relocate_index_file=$slave_datadir/slave-bin.index
--source include/relocate_binlogs.inc
--echo # relocate relay logs
--let $relocate_index_file=$slave_datadir/slave-relay-bin.index
--source include/relocate_binlogs.inc
--echo # Restart slave with options log-bin, relay-log set to the new paths
--let $rpl_server_parameters=--log-bin=$tmpdir/slave-bin --relay-log=$tmpdir/slave-relay-bin --relay-log-index=$tmpdir/slave-relay-bin.index
--let $keep_include_silent=1
--let $rpl_server_number= 2
source include/rpl_start_server.inc;
--let $keep_include_silent=0
--connection slave
--echo # Slave server has restarted successfully
--source include/start_slave.inc
--source include/stop_slave.inc
connection master;
FLUSH LOGS;
INSERT INTO t1 VALUES (2);
INSERT INTO t1 VALUES (2);
INSERT INTO t1 VALUES (2);
INSERT INTO t1 VALUES (2);
FLUSH LOGS;
connection slave;
FLUSH LOGS;
--source include/start_slave.inc
connection master;
sync_slave_with_master;
--let $diff_tables= master:t1,slave:t1
source include/diff_tables.inc;
connection master;
DROP TABLE t1;
--sync_slave_with_master
--source include/stop_slave.inc
--let $rpl_server_number= 2
--source include/rpl_stop_server.inc
--connection master
--let $relocate_from=$tmpdir
--let $relocate_into=$slave_datadir
--let $relocate_recreate_index= 1
# binlogs
--let $relocate_index_file=$tmpdir/slave-bin.index
--source include/relocate_binlogs.inc
# relay logs
# since the complete fix for the relocation of logs is
# done in BUG#13428851 it does not help here to try
# to start the slave as it would fail (relay-log.info is
# tainted with the full path in the RELAY_LOG_FILE position).
# Instead, we reset the slave and let the test clean up.
--let $relocate_fix_relay_log_info= $slave_datadir/relay-log.info
--let $relocate_index_file=$tmpdir/slave-relay-bin.index
--source include/relocate_binlogs.inc
--echo # remove tmpdir
--remove_files_wildcard $tmpdir *
--rmdir $tmpdir
--echo # restarted with previous slave settings
--let $rpl_server_parameters=--log-bin=$slave_datadir/slave-bin --relay-log=$slave_datadir/slave-relay-bin --relay-log-index=$slave_datadir/slave-relay-bin.index
--let $keep_include_silent=1
--let $rpl_server_number= 2
--source include/rpl_start_server.inc
--let $keep_include_silent=0
--connection slave
# The slave will restart if we have fixed the relay-log.info
# correctly
--source include/start_slave.inc
--connection master
--source include/rpl_end.inc

View File

@ -14,6 +14,11 @@
--source include/master-slave.inc
--source include/have_binlog_format_mixed.inc
#
# Bug#13050593 swallows `\' from Last_IO_Error
# todo: uncomment the filter once the bug is fixed.
#
--source include/not_windows.inc
call mtr.add_suppression("Error in Log_event::read_log_event()");

View File

@ -0,0 +1,24 @@
--source include/not_embedded.inc
--source include/master-slave.inc
--source include/have_binlog_format_mixed.inc
#
# BUG#13427949: CHANGE MASTER TO USER='' (EMPTY USER) CAUSES ERRORS ON VALGRING
#
--connection slave
call mtr.add_suppression(".*Invalid .* username when attempting to connect to the master server.*");
# Assert that we disallow empty users and that no problem
--source include/stop_slave.inc
CHANGE MASTER TO MASTER_USER= '', MASTER_PASSWORD= '';
START SLAVE;
--let $slave_io_errno= 1045, 1593
--source include/wait_for_slave_io_error.inc
--source include/stop_slave.inc
CHANGE MASTER TO MASTER_USER= 'root', MASTER_PASSWORD= '';
START SLAVE;
--source include/rpl_end.inc

View File

@ -17,6 +17,7 @@
# working when expected.
--source include/master-slave.inc
--source include/have_binlog_format_mixed.inc
connection slave;
STOP SLAVE;

View File

@ -1,7 +1,3 @@
# Copyright (C) 2009 SUN Microsystems
# All rights reserved. Use is subject to license terms.
# Author: Horst Hunger
# Nov. 19, 2009
# Test of ipv6 format, especially "change master host=..."
# Options: --skip-name-resolve, master: --bind-address=::, slave: --bind-address=0.0.0.0
# (see corresponding cnf file)

View File

@ -1,7 +1,3 @@
# Copyright (C) 2009 SUN Microsystems
# All rights reserved. Use is subject to license terms.
# Author: Horst Hunger
# Nov. 19, 2009
# Test of ipv6 format, especially "change master host=..."
# Options: --skip-name-resolve, master: --bind-address=0.0.0.0, slave: --bind-address=::
# (see corresponding cnf file)

View File

@ -1,7 +1,3 @@
# Copyright (C) 2009 SUN Microsystems
# All rights reserved. Use is subject to license terms.
# Author: Horst Hunger
# Nov. 19, 2009
# Test of ipv4 (127.0.0.1) in ipv6 format, especially "change master host=..."
# Options: --skip-name-resolve, --bind-address=0.0.0.0 (see corresponding cnf file)
# for master and slave

View File

@ -1,7 +1,3 @@
# Copyright (C) 2009 SUN Microsystems
# All rights reserved. Use is subject to license terms.
# Author: Horst Hunger
# Nov. 19, 2009
# Test of ipv6 format, especially "change master host=..."
# Options: --skip-name-resolve, --bind-address=:: (see corresponding cnf file)
# for master and slave.

View File

@ -10,6 +10,8 @@ source include/have_debug.inc;
source include/have_binlog_checksum_off.inc;
source include/master-slave.inc;
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
# Currently only statement-based-specific bugs are here
-- source include/have_binlog_format_statement.inc

View File

@ -30,7 +30,12 @@ let $wrong_log_pos= `SELECT $read_pos+2`;
eval change master to master_log_pos=$wrong_log_pos;
start slave;
let $slave_io_errno= 1236;
let $show_slave_io_error= 1;
#
# Win and Unix path is printed differently: BUG#13055685. So
# show_slave_io_error is made 0 until the bug fixes provide necessary
# facilities
#
let $show_slave_io_error= 0;
source include/wait_for_slave_io_error.inc;
source include/stop_slave_sql.inc;
--enable_warnings

View File

@ -60,6 +60,11 @@ call mtr.add_suppression('Got fatal error 1236 from master when reading data fro
connection slave;
# 1236 = ER_MASTER_FATAL_ERROR_READING_BINLOG
--let $slave_io_errno= 1236
#
# Win and Unix path is printed differently: BUG#13055685. So
# show_slave_io_error is made 0 until the bug fixes provide necessary
# facilities
#
--let $show_slave_io_error= 0
--source include/wait_for_slave_io_error.inc

View File

@ -0,0 +1 @@
--max-binlog-size=4k --expire-logs-days=1

View File

@ -0,0 +1,92 @@
#
# Bug#11763573 - 56299: MUTEX DEADLOCK WITH COM_BINLOG_DUMP, BINLOG PURGE, AND PROCESSLIST/KILL
#
source include/master-slave.inc;
source include/have_debug_sync.inc;
source include/have_binlog_format_row.inc;
source include/have_innodb.inc;
#
# Testing that execution of two concurrent INSERTing connections both
# triggering the binlog rotation is correct even though their execution
# is interleaved.
# The test makes the first connection to complete the rotation part
# and yields control to the second connection that rotates as well and
# gets first on purging. And the fact of interleaving does not create
# any issue.
#
connection master;
source include/show_binary_logs.inc;
create table t1 (f text) engine=innodb;
SET DEBUG_SYNC = 'at_purge_logs_before_date WAIT_FOR rotated';
send insert into t1 set f=repeat('a', 4096);
connection master1;
let $wait_condition=
SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE STATE like "debug sync point: at_purge_logs_before_date%";
--source include/wait_condition.inc
--echo *** there must be two logs in the list ***
source include/show_binary_logs.inc;
insert into t1 set f=repeat('b', 4096);
--echo *** there must be three logs in the list ***
source include/show_binary_logs.inc;
SET DEBUG_SYNC = 'now SIGNAL rotated';
SET DEBUG_SYNC = 'RESET';
# the first connection finally completes its INSERT
connection master;
reap;
SET DEBUG_SYNC = 'RESET';
sync_slave_with_master;
#
# Testing the reported deadlock involving DUMP, KILL and INSERT threads
#
connection master;
SET DEBUG_SYNC = 'at_purge_logs_before_date WAIT_FOR rotated';
send insert into t1 set f=repeat('b', 4096);
connection master1;
# make sure INSERT reaches waiting point
let $wait_condition=
SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE STATE like "debug sync point: at_purge_logs_before_date%";
--source include/wait_condition.inc
# find and kill DUMP thread
let $_tid= `select id from information_schema.processlist where command = 'Binlog Dump' limit 1`;
--disable_query_log
eval kill query $_tid;
--enable_query_log
#
# Now the proof is that the new DUMP thread has executed
# a critical section of the deadlock without any regression and is UP
#
let $wait_condition=
SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE command = 'Binlog Dump' and STATE like "Master has sent all binlog to slave%";
--source include/wait_condition.inc
SET DEBUG_SYNC = 'now SIGNAL rotated';
SET DEBUG_SYNC = 'RESET';
connection master;
reap;
SET DEBUG_SYNC = 'RESET';
drop table t1;
sync_slave_with_master;
--source include/rpl_end.inc

View File

@ -0,0 +1,62 @@
#
# Bug#11760927: 53375: RBR + NO PK => HIGH LOAD ON SLAVE (TABLE SCAN/CPU) => SLAVE FAILURE
#
--source include/master-slave.inc
--source include/have_binlog_format_row.inc
--source include/have_debug.inc
# SETUP
# - setup log_warnings and debug
--connection slave
--source include/stop_slave.inc
--let $debug_save= `SELECT @@GLOBAL.debug_dbug`
--let $log_warnings_save= `SELECT @@GLOBAL.log_warnings`
SET GLOBAL log_warnings = 2;
let $log_error_= `SELECT @@GLOBAL.log_error`;
if(!$log_error_)
{
# MySQL Server on windows is started with --console and thus
# does not know the location of its .err log, use default location
let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.2.err;
}
# Assign env variable LOG_ERROR
let LOG_ERROR=$log_error_;
# force printing the notes to the error log
SET GLOBAL debug_dbug="d,inject_long_find_row_note";
--source include/start_slave.inc
# test
--connection master
CREATE TABLE t1 (c1 INT);
--sync_slave_with_master
--connection master
INSERT INTO t1 VALUES (1), (2);
UPDATE t1 SET c1= 1000 WHERE c1=2;
DELETE FROM t1;
DROP TABLE t1;
--sync_slave_with_master
--echo # Check if any note related to long DELETE_ROWS and UPDATE_ROWS appears in the error log
perl;
use strict;
my $log_error= $ENV{'LOG_ERROR'} or die "LOG_ERROR not set";
open(FILE, "$log_error") or die("Unable to open $log_error: $!\n");
my $upd_count = () = grep(/The slave is applying a ROW event on behalf of an UPDATE statement on table t1 and is currently taking a considerable amount/g,<FILE>);
seek(FILE, 0, 0) or die "Can't seek to beginning of file: $!";
my $del_count = () = grep(/The slave is applying a ROW event on behalf of a DELETE statement on table t1 and is currently taking a considerable amount/g,<FILE>);
print "Occurrences: update=$upd_count, delete=$del_count\n";
close(FILE);
EOF
# cleanup
--source include/stop_slave.inc
--eval SET GLOBAL debug_dbug = '$debug_save'
--eval SET GLOBAL log_warnings = $log_warnings_save
--source include/start_slave.inc
--source include/rpl_end.inc

View File

@ -18,6 +18,7 @@
# executing events this time
source include/master-slave.inc;
source include/have_binlog_format_mixed.inc;
connection slave;