mirror of
https://github.com/MariaDB/server.git
synced 2026-05-15 03:17:20 +02:00
merged 5.1 main to 5.1-rpl
manually resolved conflicts: Text conflict in client/mysqltest.c Contents conflict in mysql-test/include/have_bug25714.inc Text conflict in mysql-test/include/have_ndbapi_examples.inc Text conflict in mysql-test/mysql-test-run.pl Text conflict in mysql-test/suite/parts/inc/partition_check_drop.inc Text conflict in mysql-test/suite/parts/inc/partition_layout.inc Text conflict in mysql-test/suite/parts/inc/partition_layout_check1.inc Text conflict in mysql-test/suite/parts/inc/partition_layout_check2.inc Text conflict in mysql-test/suite/parts/r/partition_alter1_1_2_myisam.result Text conflict in mysql-test/suite/parts/r/partition_alter1_1_myisam.result Text conflict in mysql-test/suite/parts/r/partition_alter1_2_myisam.result Text conflict in mysql-test/suite/parts/r/partition_alter2_myisam.result Text conflict in mysql-test/suite/parts/r/partition_alter3_innodb.result Text conflict in mysql-test/suite/parts/r/partition_alter3_myisam.result Text conflict in mysql-test/suite/parts/r/partition_basic_innodb.result Text conflict in mysql-test/suite/parts/r/partition_basic_myisam.result Text conflict in mysql-test/suite/parts/r/partition_basic_symlink_myisam.result Text conflict in mysql-test/suite/parts/r/partition_engine_myisam.result Text conflict in mysql-test/suite/parts/r/partition_syntax_myisam.result Text conflict in mysql-test/suite/rpl_ndb/t/disabled.def Text conflict in mysql-test/t/disabled.def
This commit is contained in:
commit
73e253370b
505 changed files with 15687 additions and 16147 deletions
|
|
@ -1,51 +1,15 @@
|
|||
|
||||
#
|
||||
# This test is executed twice for each test case if mysql-test-run is passed
|
||||
# the flag --check-testcase.
|
||||
# Before every testcase it's run with mysqltest in record mode and will
|
||||
# thus produce an output file
|
||||
# that can be compared to output from after the tescase.
|
||||
# In that way it's possible to check that a testcase does not have
|
||||
# the flag --check-testcase. Before every testcase it is run with mysqltest
|
||||
# in record mode and will thus produce an output file that can be compared
|
||||
# to output from after the tescase.
|
||||
# In that way its possible to check that a testcase does not have
|
||||
# any unwanted side affects.
|
||||
#
|
||||
|
||||
#
|
||||
# Dump all global variables
|
||||
#
|
||||
show global variables;
|
||||
|
||||
#
|
||||
# Dump all databases
|
||||
#
|
||||
show databases;
|
||||
|
||||
#
|
||||
# Dump the "test" database, all it's tables and their data
|
||||
#
|
||||
--exec $MYSQL_DUMP --skip-comments --skip-lock-tables test
|
||||
|
||||
#
|
||||
# Dump the "mysql" database and it's tables
|
||||
# Select data separately to add "order by"
|
||||
#
|
||||
--exec $MYSQL_DUMP --skip-comments --skip-lock-tables --no-data mysql
|
||||
use mysql;
|
||||
select * from columns_priv;
|
||||
select * from db order by host, db, user;
|
||||
select * from func;
|
||||
select * from help_category;
|
||||
select * from help_keyword;
|
||||
select * from help_relation;
|
||||
select * from help_relation;
|
||||
select * from host;
|
||||
select * from proc;
|
||||
select * from procs_priv;
|
||||
select * from tables_priv;
|
||||
select * from time_zone;
|
||||
select * from time_zone_leap_second;
|
||||
select * from time_zone_name;
|
||||
select * from time_zone_transition;
|
||||
select * from time_zone_transition_type;
|
||||
select * from user;
|
||||
--disable_query_log
|
||||
call mtr.check_testcase();
|
||||
--enable_query_log
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
12
mysql-test/include/check-warnings.test
Normal file
12
mysql-test/include/check-warnings.test
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
#
|
||||
# This test is executed once after each test to check the servers
|
||||
# for unexpected warnings found in the servers error log
|
||||
#
|
||||
--disable_query_log
|
||||
call mtr.check_warnings(@result);
|
||||
if (`select @result = 0`){
|
||||
skip OK;
|
||||
}
|
||||
echo Found warnings;
|
||||
--enable_query_log
|
||||
130
mysql-test/include/circular_rpl_for_4_hosts_init.inc
Normal file
130
mysql-test/include/circular_rpl_for_4_hosts_init.inc
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
#############################################################
|
||||
#
|
||||
# Author: Serge Kozlov <skozlov@mysql.com>
|
||||
# Date: 03/11/2008
|
||||
# Purpose: Set up circular replication based on schema
|
||||
# A->B->C->D->A
|
||||
#
|
||||
# Notes:
|
||||
# 1. --slave-num=3 must be added to *-master.opt file
|
||||
# 2. Even the test uses new names for servers but file names
|
||||
# of log files are still old:
|
||||
# master_a -> master.[log|err]
|
||||
# master_b -> slave.[log|err]
|
||||
# master_c -> slave1.[log|err]
|
||||
# master_d -> slave2.[log|err]
|
||||
#
|
||||
#############################################################
|
||||
--source include/master-slave.inc
|
||||
|
||||
#
|
||||
# Set up circular ring by schema A->B->C->D->A
|
||||
#
|
||||
|
||||
--connection slave
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
|
||||
# master a
|
||||
--connection master
|
||||
--disconnect master
|
||||
connect (master_a,127.0.0.1,root,,test,$MASTER_MYPORT,);
|
||||
RESET MASTER;
|
||||
--disable_warnings
|
||||
STOP SLAVE;
|
||||
--enable_warnings
|
||||
RESET SLAVE;
|
||||
SET auto_increment_increment = 4;
|
||||
SET auto_increment_offset = 1;
|
||||
let $_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
|
||||
|
||||
# master b
|
||||
--connection slave
|
||||
--disconnect slave
|
||||
connect (master_b,127.0.0.1,root,,test,$SLAVE_MYPORT,);
|
||||
RESET MASTER;
|
||||
RESET SLAVE;
|
||||
--replace_result $MASTER_MYPORT MASTER_A_PORT $_binlog_file MASTER_A_LOG_FILE
|
||||
--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$MASTER_MYPORT,master_user='root',MASTER_LOG_FILE='$_binlog_file'
|
||||
SET auto_increment_increment = 4;
|
||||
SET auto_increment_offset = 2;
|
||||
let $_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
|
||||
|
||||
# master c
|
||||
--connection slave1
|
||||
--disconnect slave1
|
||||
connect (master_c,127.0.0.1,root,,test,$SLAVE_MYPORT1,);
|
||||
RESET MASTER;
|
||||
--disable_warnings
|
||||
STOP SLAVE;
|
||||
--enable_warnings
|
||||
RESET SLAVE;
|
||||
--replace_result $SLAVE_MYPORT MASTER_B_PORT $_binlog_file MASTER_B_LOG_FILE
|
||||
--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SLAVE_MYPORT,master_user='root',MASTER_LOG_FILE='$_binlog_file'
|
||||
SET auto_increment_increment = 4;
|
||||
SET auto_increment_offset = 3;
|
||||
let $_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
|
||||
|
||||
# master d
|
||||
connect (master_d,127.0.0.1,root,,test,$SLAVE_MYPORT2,);
|
||||
RESET MASTER;
|
||||
--disable_warnings
|
||||
STOP SLAVE;
|
||||
--enable_warnings
|
||||
RESET SLAVE;
|
||||
--replace_result $SLAVE_MYPORT1 MASTER_C_PORT $_binlog_file MASTER_C_LOG_FILE
|
||||
--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SLAVE_MYPORT1,master_user='root',MASTER_LOG_FILE='$_binlog_file'
|
||||
SET auto_increment_increment = 4;
|
||||
SET auto_increment_offset = 4;
|
||||
let $_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
|
||||
|
||||
# master a
|
||||
--connection master_a
|
||||
--replace_result $SLAVE_MYPORT2 MASTER_D_PORT $_binlog_file MASTER_D_LOG_FILE
|
||||
--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SLAVE_MYPORT2,master_user='root',MASTER_LOG_FILE='$_binlog_file'
|
||||
|
||||
|
||||
|
||||
# Check server_ids: they should be different
|
||||
--connection master_a
|
||||
let $_id_a= query_get_value(SHOW VARIABLES LIKE 'server_id', Value, 1);
|
||||
SHOW VARIABLES LIKE 'auto_increment_%';
|
||||
--connection master_b
|
||||
let $_id_b= query_get_value(SHOW VARIABLES LIKE 'server_id', Value, 1);
|
||||
SHOW VARIABLES LIKE 'auto_increment_%';
|
||||
--connection master_c
|
||||
let $_id_c= query_get_value(SHOW VARIABLES LIKE 'server_id', Value, 1);
|
||||
SHOW VARIABLES LIKE 'auto_increment_%';
|
||||
--connection master_d
|
||||
let $_id_d= query_get_value(SHOW VARIABLES LIKE 'server_id', Value, 1);
|
||||
SHOW VARIABLES LIKE 'auto_increment_%';
|
||||
--connection master_a
|
||||
let $_compared_ids= (($_id_a <> $_id_b) AND ($_id_a <> $_id_c) AND ($_id_a <> $_id_d) AND ($_id_b <> $_id_c) AND ($_id_b <> $_id_d) AND ($_id_c <> $_id_d)) AS a;
|
||||
let $_compared_ids_result= query_get_value(SELECT $_compared_ids, a, 1);
|
||||
--echo $_compared_ids_result
|
||||
|
||||
# Start ring
|
||||
--connection master_a
|
||||
connect(slave,127.0.0.1,root,,test,$MASTER_MYPORT);
|
||||
START SLAVE;
|
||||
--source include/wait_for_slave_to_start.inc
|
||||
--disconnect slave
|
||||
|
||||
--connection master_b
|
||||
connect(slave,127.0.0.1,root,,test,$SLAVE_MYPORT1);
|
||||
START SLAVE;
|
||||
--source include/wait_for_slave_to_start.inc
|
||||
--disconnect slave
|
||||
|
||||
--connection master_c
|
||||
connect(slave,127.0.0.1,root,,test,$SLAVE_MYPORT);
|
||||
START SLAVE;
|
||||
--source include/wait_for_slave_to_start.inc
|
||||
--disconnect slave
|
||||
|
||||
--connection master_d
|
||||
connect(slave,127.0.0.1,root,,test,$SLAVE_MYPORT2);
|
||||
START SLAVE;
|
||||
--source include/wait_for_slave_to_start.inc
|
||||
--disconnect slave
|
||||
|
||||
23
mysql-test/include/circular_rpl_for_4_hosts_sync.inc
Normal file
23
mysql-test/include/circular_rpl_for_4_hosts_sync.inc
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#############################################################
|
||||
#
|
||||
# Author: Serge Kozlov <skozlov@mysql.com>
|
||||
# Date: 03/11/2008
|
||||
# Purpose: Sync all hosts for circular replication based on
|
||||
# schema A->B->C->D->A
|
||||
#
|
||||
# Notes: see include/circular_rpl_for_4_hosts_init.inc
|
||||
#
|
||||
#############################################################
|
||||
|
||||
# Make the full loop of sync
|
||||
--connection master_a
|
||||
--disable_query_log
|
||||
--sync_slave_with_master master_b
|
||||
--sync_slave_with_master master_c
|
||||
--sync_slave_with_master master_d
|
||||
--sync_slave_with_master master_a
|
||||
--sync_slave_with_master master_b
|
||||
--sync_slave_with_master master_c
|
||||
--save_master_pos
|
||||
--connection master_a
|
||||
--enable_query_log
|
||||
|
|
@ -267,7 +267,7 @@ select * from t2;
|
|||
insert into t2 (a) values (1026);
|
||||
--replace_result $MYSQLTEST_VARDIR ..
|
||||
--error ER_DUP_ENTRY
|
||||
eval load data infile "../std_data_ln/words.dat" into table t1 (a) set a:=f2(26);
|
||||
eval load data infile "../../std_data/words.dat" into table t1 (a) set a:=f2(26);
|
||||
|
||||
select * from t2;
|
||||
rollback;
|
||||
|
|
|
|||
25
mysql-test/include/default_my.cnf
Normal file
25
mysql-test/include/default_my.cnf
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# Use default setting for mysqld processes
|
||||
!include default_mysqld.cnf
|
||||
|
||||
[mysqld.1]
|
||||
|
||||
# Run the master.sh script before starting this process
|
||||
#!run-master-sh
|
||||
|
||||
log-bin= master-bin
|
||||
|
||||
|
||||
[mysqlbinlog]
|
||||
disable-force-if-open
|
||||
|
||||
# mysql_fix_privilege_tables.sh does not read from [client] so it
|
||||
# need its own section
|
||||
[mysql_fix_privilege_tables]
|
||||
socket= @client.socket
|
||||
port= @client.port
|
||||
user= @client.user
|
||||
password= @client.password
|
||||
|
||||
[ENV]
|
||||
MASTER_MYPORT= @mysqld.1.port
|
||||
MASTER_MYSOCK= @mysqld.1.socket
|
||||
21
mysql-test/include/default_mysqld.cnf
Normal file
21
mysql-test/include/default_mysqld.cnf
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# Default values that applies to all MySQL Servers
|
||||
[mysqld]
|
||||
open-files-limit= 1024
|
||||
local-infile
|
||||
default-character-set= latin1
|
||||
|
||||
# Increase default connect_timeout to avoid intermittent
|
||||
# disconnects when test servers are put under load see BUG#28359
|
||||
connect-timeout= 60
|
||||
|
||||
log-bin-trust-function-creators=1
|
||||
key_buffer_size= 1M
|
||||
sort_buffer= 256K
|
||||
max_heap_table_size= 1M
|
||||
|
||||
loose-innodb_data_file_path= ibdata1:10M:autoextend
|
||||
|
||||
slave-net-timeout=120
|
||||
|
||||
log-bin=mysqld-bin
|
||||
|
||||
27
mysql-test/include/default_ndbd.cnf
Normal file
27
mysql-test/include/default_ndbd.cnf
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
|
||||
[cluster_config]
|
||||
MaxNoOfSavedMessages= 1000
|
||||
MaxNoOfConcurrentTransactions= 64
|
||||
MaxNoOfConcurrentOperations= 10000
|
||||
DataMemory= 20M
|
||||
IndexMemory= 1M
|
||||
Diskless= 0
|
||||
TimeBetweenWatchDogCheck= 30000
|
||||
MaxNoOfOrderedIndexes= 32
|
||||
MaxNoOfAttributes= 2048
|
||||
TimeBetweenGlobalCheckpoints= 500
|
||||
NoOfFragmentLogFiles= 4
|
||||
FragmentLogFileSize= 12M
|
||||
DiskPageBufferMemory= 4M
|
||||
|
||||
# O_DIRECT has issues on 2.4 whach have not been handled, Bug #29612
|
||||
#ODirect= 1
|
||||
# the following parametes just function as a small regression
|
||||
# test that the parameter exists
|
||||
InitialNoOfOpenFiles= 27
|
||||
|
||||
# Increase timeouts for slow test-machines
|
||||
HeartbeatIntervalDbDb= 30000
|
||||
HeartbeatIntervalDbApi= 30000
|
||||
|
||||
#TransactionDeadlockDetectionTimeout= 7500
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
--source include/have_log_bin.inc
|
||||
--source include/not_embedded.inc
|
||||
--source ./include/have_federated_db.inc
|
||||
|
||||
source ./include/master-slave.inc;
|
||||
|
||||
# remote table creation
|
||||
|
||||
# We have to sync with master, to ensure slave had time to start properly
|
||||
# before we stop it. If not, we get errors about UNIX_TIMESTAMP() in the log.
|
||||
connection master;
|
||||
sync_slave_with_master;
|
||||
|
||||
connection slave;
|
||||
#--replicate-ignore-db=federated
|
||||
stop slave;
|
||||
|
||||
--disable_warnings
|
||||
# at this point, we are connected to master
|
||||
DROP DATABASE IF EXISTS federated;
|
||||
--enable_warnings
|
||||
CREATE DATABASE federated;
|
||||
|
||||
connection master;
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS federated;
|
||||
--enable_warnings
|
||||
CREATE DATABASE federated;
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
connection master;
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
DROP DATABASE IF EXISTS federated;
|
||||
|
||||
connection slave;
|
||||
DROP TABLE IF EXISTS federated.t1;
|
||||
DROP DATABASE IF EXISTS federated;
|
||||
--enable_warnings
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
disable_query_log;
|
||||
--require r/true.require
|
||||
select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'blackhole';
|
||||
enable_query_log;
|
||||
if (!`SELECT count(*) FROM information_schema.engines WHERE
|
||||
(support = 'YES' OR support = 'DEFAULT') AND
|
||||
engine = 'blackhole'`){
|
||||
skip Need blackhole engine;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
#
|
||||
# Check if the variable MYSQL_BUG25714 is set
|
||||
#
|
||||
--require r/have_bug25714.require
|
||||
disable_query_log;
|
||||
eval select LENGTH('$MYSQL_BUG25714') > 0 as 'have_bug25714_exe';
|
||||
enable_query_log;
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
disable_query_log;
|
||||
--require r/true.require
|
||||
select (support = 'YES' or support = 'DEFAULT') as `TRUE` from information_schema.engines where engine = 'federated';
|
||||
enable_query_log;
|
||||
|
|
@ -1,3 +1,11 @@
|
|||
# ==== Purpose ====
|
||||
#
|
||||
# Ensure that the server is running with binlogging on
|
||||
#
|
||||
# ==== Usage ====
|
||||
#
|
||||
# source include/have_log_bin.inc;
|
||||
|
||||
-- require r/have_log_bin.require
|
||||
disable_query_log;
|
||||
show variables like 'log_bin';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
--require r/have_ndbapi_examples.require
|
||||
disable_query_log;
|
||||
eval select LENGTH('$MY_NDB_EXAMPLES_BINARY') > 0 as 'have_ndb_example';
|
||||
eval select LENGTH('$NDB_EXAMPLES_BINARY') > 0 as 'have_ndb_example';
|
||||
enable_query_log;
|
||||
|
|
|
|||
|
|
@ -7,16 +7,20 @@ eval SET SESSION STORAGE_ENGINE = $engine_type;
|
|||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
let $load_file= $MYSQLTEST_VARDIR/std_data/loaddata2.dat;
|
||||
|
||||
# NDB does not support the create option 'Binlog of table with BLOB attribute and no PK'
|
||||
# So use a dummy PK here.
|
||||
create table t1 (id int unsigned not null auto_increment primary key, a text, b text);
|
||||
start transaction;
|
||||
load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''' (a, b);
|
||||
--replace_result $load_file LOAD_FILE
|
||||
eval load data infile '$load_file' into table t1 fields terminated by ',' enclosed by '''' (a, b);
|
||||
commit;
|
||||
select count(*) from t1;
|
||||
truncate table t1;
|
||||
start transaction;
|
||||
load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''' (a, b);
|
||||
--replace_result $load_file LOAD_FILE
|
||||
eval load data infile '$load_file' into table t1 fields terminated by ',' enclosed by '''' (a, b);
|
||||
rollback;
|
||||
select count(*) from t1;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,13 @@
|
|||
# Reset the master and the slave to start fresh.
|
||||
#
|
||||
# It is necessary to execute RESET MASTER and RESET SLAVE on both
|
||||
# master and slave since the replication setup might be circular.
|
||||
#
|
||||
# Since we expect STOP SLAVE to produce a warning as the slave is
|
||||
# stopped (the server was started with skip-slave-start), we disable
|
||||
# warnings when doing STOP SLAVE.
|
||||
|
||||
connection slave;
|
||||
#we expect STOP SLAVE to produce a warning as the slave is stopped
|
||||
#(the server was started with skip-slave-start)
|
||||
--disable_warnings
|
||||
stop slave;
|
||||
source include/wait_for_slave_to_stop.inc;
|
||||
|
|
@ -13,11 +20,17 @@ use test;
|
|||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
--enable_warnings
|
||||
reset master;
|
||||
--disable_query_log
|
||||
reset slave;
|
||||
--enable_query_log
|
||||
connection slave;
|
||||
reset slave;
|
||||
# Clean up old test tables
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
--enable_warnings
|
||||
--disable_query_log
|
||||
reset master;
|
||||
--enable_query_log
|
||||
start slave;
|
||||
source include/wait_for_slave_to_start.inc;
|
||||
|
|
|
|||
|
|
@ -623,7 +623,8 @@ DROP TABLE t1,t2,t3;
|
|||
#
|
||||
|
||||
create table t1 (a int) engine=innodb;
|
||||
copy_file $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/bug29807.frm;
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
copy_file $MYSQLD_DATADIR/test/t1.frm $MYSQLD_DATADIR/test/bug29807.frm;
|
||||
--error 1146
|
||||
select * from bug29807;
|
||||
drop table t1;
|
||||
|
|
|
|||
59
mysql-test/include/mtr_check.sql
Normal file
59
mysql-test/include/mtr_check.sql
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
delimiter ||;
|
||||
|
||||
use mtr||
|
||||
|
||||
--
|
||||
-- Procedure used to check if server has been properly
|
||||
-- restored after testcase has been run
|
||||
--
|
||||
CREATE DEFINER=root@localhost PROCEDURE check_testcase()
|
||||
BEGIN
|
||||
|
||||
-- Dump all global variables except those
|
||||
-- that are supposed to change
|
||||
SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
|
||||
WHERE variable_name != 'timestamp';
|
||||
|
||||
-- Dump all databases, there should be none
|
||||
-- except those that was created during bootstrap
|
||||
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA;
|
||||
|
||||
-- The test database should not contain any tables
|
||||
SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES
|
||||
WHERE table_schema='test';
|
||||
|
||||
-- Show "mysql" database, tables and columns
|
||||
SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql
|
||||
FROM INFORMATION_SCHEMA.TABLES
|
||||
WHERE table_schema='mysql' AND table_name != 'ndb_apply_status'
|
||||
ORDER BY tables_in_mysql;
|
||||
SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql,
|
||||
column_name, ordinal_position, column_default, is_nullable,
|
||||
data_type, character_maximum_length, character_octet_length,
|
||||
numeric_precision, numeric_scale, character_set_name,
|
||||
collation_name, column_type, column_key, extra, column_comment
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE table_schema='mysql' AND table_name != 'ndb_apply_status'
|
||||
ORDER BY columns_in_mysql;
|
||||
|
||||
-- Checksum system tables to make sure they have been properly
|
||||
-- restored after test
|
||||
checksum table
|
||||
mysql.columns_priv,
|
||||
mysql.db,
|
||||
mysql.func,
|
||||
mysql.help_category,
|
||||
mysql.help_keyword,
|
||||
mysql.help_relation,
|
||||
mysql.host,
|
||||
mysql.proc,
|
||||
mysql.procs_priv,
|
||||
mysql.tables_priv,
|
||||
mysql.time_zone,
|
||||
mysql.time_zone_leap_second,
|
||||
mysql.time_zone_name,
|
||||
mysql.time_zone_transition,
|
||||
mysql.time_zone_transition_type,
|
||||
mysql.user;
|
||||
|
||||
END||
|
||||
306
mysql-test/include/mtr_warnings.sql
Normal file
306
mysql-test/include/mtr_warnings.sql
Normal file
|
|
@ -0,0 +1,306 @@
|
|||
delimiter ||;
|
||||
|
||||
use mtr||
|
||||
|
||||
--
|
||||
-- Load table with the patterns that are considered
|
||||
-- as suspicious and should be examined further
|
||||
--
|
||||
CREATE TABLE suspicious_patterns (
|
||||
pattern VARCHAR(255)
|
||||
)||
|
||||
|
||||
|
||||
--
|
||||
-- Declare a trigger that makes sure
|
||||
-- no invalid patterns can be inserted
|
||||
-- into suspicious_patterns
|
||||
--
|
||||
/*!50002
|
||||
CREATE DEFINER=root@localhost TRIGGER sp_insert
|
||||
BEFORE INSERT ON suspicious_patterns
|
||||
FOR EACH ROW BEGIN
|
||||
DECLARE dummy INT;
|
||||
SELECT "" REGEXP NEW.pattern INTO dummy;
|
||||
END
|
||||
*/||
|
||||
|
||||
|
||||
--
|
||||
-- Insert patterns for the lines we should check
|
||||
--
|
||||
INSERT INTO suspicious_patterns VALUES
|
||||
("^Warning:|mysqld: Warning|\\[Warning\\]"),
|
||||
("^Error:|\\[ERROR\\]"),
|
||||
("^==.* at 0x"),
|
||||
("InnoDB: Warning"),
|
||||
("^safe_mutex:|allocated at line"),
|
||||
("missing DBUG_RETURN"),
|
||||
("Attempting backtrace"),
|
||||
("Assertion .* failed")||
|
||||
|
||||
|
||||
--
|
||||
-- Create table where testcases can insert patterns to
|
||||
-- be supressed
|
||||
--
|
||||
CREATE TABLE test_supressions (
|
||||
pattern VARCHAR(255)
|
||||
)||
|
||||
|
||||
|
||||
--
|
||||
-- Declare a trigger that makes sure
|
||||
-- no invalid patterns can be inserted
|
||||
-- into test_supressions
|
||||
--
|
||||
/*!50002
|
||||
CREATE DEFINER=root@localhost TRIGGER ts_insert
|
||||
BEFORE INSERT ON test_supressions
|
||||
FOR EACH ROW BEGIN
|
||||
DECLARE dummy INT;
|
||||
SELECT "" REGEXP NEW.pattern INTO dummy;
|
||||
END
|
||||
*/||
|
||||
|
||||
|
||||
--
|
||||
-- Load table with patterns that will be supressed globally(always)
|
||||
--
|
||||
CREATE TABLE global_supressions (
|
||||
pattern VARCHAR(255)
|
||||
)||
|
||||
|
||||
|
||||
-- Declare a trigger that makes sure
|
||||
-- no invalid patterns can be inserted
|
||||
-- into global_supressions
|
||||
--
|
||||
/*!50002
|
||||
CREATE DEFINER=root@localhost TRIGGER gs_insert
|
||||
BEFORE INSERT ON global_supressions
|
||||
FOR EACH ROW BEGIN
|
||||
DECLARE dummy INT;
|
||||
SELECT "" REGEXP NEW.pattern INTO dummy;
|
||||
END
|
||||
*/||
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Insert patterns that should always be supressed
|
||||
--
|
||||
INSERT INTO global_supressions VALUES
|
||||
("'SELECT UNIX_TIMESTAMP\\(\\)' failed on master"),
|
||||
("Aborted connection"),
|
||||
("Client requested master to start replication from impossible position"),
|
||||
("Could not find first log file name in binary log"),
|
||||
("Enabling keys got errno"),
|
||||
("Error reading master configuration"),
|
||||
("Error reading packet"),
|
||||
("Event Scheduler"),
|
||||
("Failed to open log"),
|
||||
("Failed to open the existing master info file"),
|
||||
("Forcing shutdown of [0-9]* plugins"),
|
||||
|
||||
/*
|
||||
Due to timing issues, it might be that this warning
|
||||
is printed when the server shuts down and the
|
||||
computer is loaded.
|
||||
*/
|
||||
|
||||
("Got error [0-9]* when reading table"),
|
||||
("Incorrect definition of table"),
|
||||
("Incorrect information in file"),
|
||||
("InnoDB: Warning: we did not need to do crash recovery"),
|
||||
("Invalid \\(old\\?\\) table or database name"),
|
||||
("Lock wait timeout exceeded"),
|
||||
("Log entry on master is longer than max_allowed_packet"),
|
||||
("unknown option '--loose-"),
|
||||
("unknown variable 'loose-"),
|
||||
("You have forced lower_case_table_names to 0 through a command-line option"),
|
||||
("Setting lower_case_table_names=2"),
|
||||
("NDB Binlog:"),
|
||||
("NDB: failed to setup table"),
|
||||
("NDB: only row based binary logging"),
|
||||
("Neither --relay-log nor --relay-log-index were used"),
|
||||
("Query partially completed"),
|
||||
("Slave I.O thread aborted while waiting for relay log"),
|
||||
("Slave SQL thread is stopped because UNTIL condition"),
|
||||
("Slave SQL thread retried transaction"),
|
||||
("Slave \\(additional info\\)"),
|
||||
("Slave: .*Duplicate column name"),
|
||||
("Slave: .*master may suffer from"),
|
||||
("Slave: According to the master's version"),
|
||||
("Slave: Column [0-9]* type mismatch"),
|
||||
("Slave: Error .* doesn't exist"),
|
||||
("Slave: Error .*Deadlock found"),
|
||||
("Slave: Error .*Unknown table"),
|
||||
("Slave: Error in Write_rows event: "),
|
||||
("Slave: Field .* of table .* has no default value"),
|
||||
("Slave: Field .* doesn't have a default value"),
|
||||
("Slave: Query caused different errors on master and slave"),
|
||||
("Slave: Table .* doesn't exist"),
|
||||
("Slave: Table width mismatch"),
|
||||
("Slave: The incident LOST_EVENTS occured on the master"),
|
||||
("Slave: Unknown error.* 1105"),
|
||||
("Slave: Can't drop database.* database doesn't exist"),
|
||||
("Slave SQL:.*(Error_code: \[\[:digit:\]\]+|Query:.*)"),
|
||||
("Sort aborted"),
|
||||
("Time-out in NDB"),
|
||||
("Warning:\s+One can only use the --user.*root"),
|
||||
("Warning:\s+Setting lower_case_table_names=2"),
|
||||
("Warning:\s+Table:.* on (delete|rename)"),
|
||||
("You have an error in your SQL syntax"),
|
||||
("deprecated"),
|
||||
("description of time zone"),
|
||||
("equal MySQL server ids"),
|
||||
("error .*connecting to master"),
|
||||
("error reading log entry"),
|
||||
("lower_case_table_names is set"),
|
||||
("skip-name-resolve mode"),
|
||||
("slave SQL thread aborted"),
|
||||
("Slave: .*Duplicate entry"),
|
||||
|
||||
/*
|
||||
Special case, made as specific as possible, for:
|
||||
Bug #28436: Incorrect position in SHOW BINLOG EVENTS causes
|
||||
server coredump
|
||||
*/
|
||||
|
||||
("Error in Log_event::read_log_event\\\(\\\): 'Sanity check failed', data_len: 258, event_type: 49"),
|
||||
|
||||
("Statement is not safe to log in statement format"),
|
||||
|
||||
/* test case for Bug#bug29807 copies a stray frm into database */
|
||||
("InnoDB: Error: table `test`.`bug29807` does not exist in the InnoDB internal"),
|
||||
("Cannot find or open table test\/bug29807 from"),
|
||||
|
||||
/* innodb foreign key tests that fail in ALTER or RENAME produce this */
|
||||
("InnoDB: Error: in ALTER TABLE `test`.`t[12]`"),
|
||||
("InnoDB: Error: in RENAME TABLE table `test`.`t1`"),
|
||||
("InnoDB: Error: table `test`.`t[12]` does not exist in the InnoDB internal"),
|
||||
|
||||
/* Test case for Bug#14233 produces the following warnings: */
|
||||
("Stored routine 'test'.'bug14233_1': invalid value in column mysql.proc"),
|
||||
("Stored routine 'test'.'bug14233_2': invalid value in column mysql.proc"),
|
||||
("Stored routine 'test'.'bug14233_3': invalid value in column mysql.proc"),
|
||||
|
||||
/*
|
||||
BUG#32080 - Excessive warnings on Solaris: setrlimit could not
|
||||
change the size of core files
|
||||
*/
|
||||
("setrlimit could not change the size of core files to 'infinity'"),
|
||||
|
||||
/*
|
||||
rpl_extrColmaster_*.test, the slave thread produces warnings
|
||||
when it get updates to a table that has more columns on the
|
||||
master
|
||||
*/
|
||||
("Slave: Unknown column 'c7' in 't15' Error_code: 1054"),
|
||||
("Slave: Can't DROP 'c7'.* 1091"),
|
||||
("Slave: Key column 'c6'.* 1072"),
|
||||
|
||||
/* Test case for Bug#31590 in order_by.test produces the following error */
|
||||
("Out of sort memory; increase server sort buffer size"),
|
||||
|
||||
/* Special case for Bug #26402 in show_check.test
|
||||
- Question marks are not valid file name parts on Windows. Ignore
|
||||
this error message.
|
||||
*/
|
||||
("Can't find file: '.\\\\test\\\\\\?{8}.frm'"),
|
||||
|
||||
("THE_LAST_SUPPRESSION")||
|
||||
|
||||
|
||||
--
|
||||
-- Procedure that uses the above created tables to check
|
||||
-- the servers error log for warnings
|
||||
--
|
||||
CREATE DEFINER=root@localhost PROCEDURE check_warnings(OUT result INT)
|
||||
BEGIN
|
||||
|
||||
-- Don't write these queries to binlog
|
||||
SET SQL_LOG_BIN=0;
|
||||
--
|
||||
-- Load the server .err file into "error_log" table
|
||||
--
|
||||
CREATE TEMPORARY TABLE error_log (
|
||||
row INT AUTO_INCREMENT PRIMARY KEY,
|
||||
line mediumtext NULL
|
||||
);
|
||||
|
||||
SELECT variable_value INTO @log_error
|
||||
FROM information_schema.global_variables
|
||||
WHERE variable_name='LOG_ERROR';
|
||||
|
||||
SET @@session.max_allowed_packet= 1024*1024*1024;
|
||||
SET @text= load_file(@log_error);
|
||||
-- select @text;
|
||||
|
||||
WHILE LOCATE('\n', @text) DO
|
||||
INSERT error_log (line)
|
||||
VALUES (
|
||||
SUBSTR(@text, 1, LOCATE('\n', @text)-1)
|
||||
);
|
||||
SET @text= SUBSTR(@text FROM LOCATE('\n', @text)+1);
|
||||
END WHILE;
|
||||
|
||||
-- select * from error_log;
|
||||
|
||||
--
|
||||
-- Remove all lines belonging to previous tests
|
||||
--
|
||||
SELECT COALESCE(MAX(row),0) INTO @max_row
|
||||
FROM error_log
|
||||
WHERE line REGEXP "^CURRENT_TEST:";
|
||||
DELETE FROM error_log WHERE row < @max_row;
|
||||
|
||||
CREATE TEMPORARY TABLE suspect_lines AS
|
||||
SELECT DISTINCT el.line, 0 as "supressed"
|
||||
FROM error_log el, suspicious_patterns ep
|
||||
WHERE el.line REGEXP ep.pattern;
|
||||
|
||||
-- Mark lines that are supressed by global supressions
|
||||
UPDATE suspect_lines sl, global_supressions gs
|
||||
SET supressed=1
|
||||
WHERE sl.line REGEXP gs.pattern;
|
||||
|
||||
-- Mark lines that are supressed by test specific supressions
|
||||
UPDATE suspect_lines sl, test_supressions ts
|
||||
SET supressed=2
|
||||
WHERE sl.line REGEXP ts.pattern;
|
||||
|
||||
SELECT COUNT(*) INTO @num_warnings FROM suspect_lines
|
||||
WHERE supressed=0;
|
||||
|
||||
IF @num_warnings > 0 THEN
|
||||
SELECT @log_error;
|
||||
SELECT line as log_error
|
||||
FROM suspect_lines WHERE supressed=0;
|
||||
SELECT * FROM test_supressions;
|
||||
-- Return 2 -> check failed
|
||||
SELECT 2 INTO result;
|
||||
ELSE
|
||||
-- Return 0 -> OK
|
||||
SELECT 0 INTO RESULT;
|
||||
END IF;
|
||||
|
||||
-- Cleanup for next test
|
||||
TRUNCATE test_supressions;
|
||||
|
||||
END||
|
||||
|
||||
--
|
||||
-- Declare a procedure testcases can use to insert test
|
||||
-- specific supressions
|
||||
--
|
||||
/*!50001
|
||||
CREATE DEFINER=root@localhost
|
||||
PROCEDURE add_supression(pattern VARCHAR(255))
|
||||
BEGIN
|
||||
INSERT INTO test_supressions (pattern) VALUES (pattern);
|
||||
END
|
||||
*/||
|
||||
|
||||
|
||||
|
|
@ -2,23 +2,21 @@
|
|||
# By JBM 2006-02-16 So that the code is not repeated #
|
||||
# in test cases and can be reused. #
|
||||
######################################################
|
||||
--exec $NDB_MGM --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -e "start backup" >> $NDB_TOOLS_OUTPUT
|
||||
--exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "start backup" >> $NDB_TOOLS_OUTPUT
|
||||
|
||||
# there is no neat way to find the backupid, this is a hack to find it...
|
||||
let $dump_file= $MYSQLTEST_VARDIR/tmp/tmp.dat;
|
||||
--exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="$NDB_CONNECTSTRING" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $dump_file
|
||||
|
||||
--exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $MYSQLTEST_VARDIR/tmp.dat
|
||||
CREATE TEMPORARY TABLE test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
|
||||
|
||||
CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
|
||||
|
||||
DELETE FROM test.backup_info;
|
||||
|
||||
LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
|
||||
|
||||
--replace_column 1 <the_backup_id>
|
||||
|
||||
SELECT @the_backup_id:=backup_id FROM test.backup_info;
|
||||
|
||||
let the_backup_id=`select @the_backup_id`;
|
||||
--replace_result $dump_file DUMP_FILE
|
||||
eval LOAD DATA INFILE '$dump_file' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
|
||||
|
||||
# Load backup id into environment variable
|
||||
let the_backup_id=`SELECT backup_id from test.backup_info`;
|
||||
DROP TABLE test.backup_info;
|
||||
|
||||
remove_file $dump_file;
|
||||
|
||||
|
||||
|
|
|
|||
136
mysql-test/include/ndb_master-slave_2ch.inc
Normal file
136
mysql-test/include/ndb_master-slave_2ch.inc
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
#############################################################
|
||||
# Author: Serge Kozlov <skozlov@mysql.com>
|
||||
# Date: 03/17/2008
|
||||
# Purpose: Set up circular cluster replication where each
|
||||
# cluster has two mysqlds and replication directions are
|
||||
# following:
|
||||
# master ---> slave
|
||||
# / \
|
||||
# cluster A cluster B
|
||||
# \ /
|
||||
# master1 <--- slave1
|
||||
#############################################################
|
||||
|
||||
--source include/have_log_bin.inc
|
||||
|
||||
# Make connections to mysqlds
|
||||
|
||||
connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
|
||||
connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT1,);
|
||||
connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,);
|
||||
connect (slave1,127.0.0.1,root,,test,$SLAVE_MYPORT1,);
|
||||
|
||||
# Check that all mysqld compiled with ndb support
|
||||
|
||||
--connection master
|
||||
--disable_query_log
|
||||
--require r/true.require
|
||||
SELECT (support = 'YES' or support = 'DEFAULT') AS `TRUE` FROM information_schema.engines WHERE engine = 'ndbcluster';
|
||||
--source include/ndb_not_readonly.inc
|
||||
--enable_query_log
|
||||
|
||||
--connection master1
|
||||
--disable_query_log
|
||||
--require r/true.require
|
||||
SELECT (support = 'YES' or support = 'DEFAULT') AS `TRUE` FROM information_schema.engines WHERE engine = 'ndbcluster';
|
||||
--source include/ndb_not_readonly.inc
|
||||
--enable_query_log
|
||||
|
||||
--connection slave
|
||||
--disable_query_log
|
||||
--require r/true.require
|
||||
SELECT (support = 'YES' or support = 'DEFAULT') AS `TRUE` FROM information_schema.engines WHERE engine = 'ndbcluster';
|
||||
--source include/ndb_not_readonly.inc
|
||||
--enable_query_log
|
||||
|
||||
--connection slave1
|
||||
--disable_query_log
|
||||
--require r/true.require
|
||||
SELECT (support = 'YES' or support = 'DEFAULT') AS `TRUE` FROM information_schema.engines WHERE engine = 'ndbcluster';
|
||||
--source include/ndb_not_readonly.inc
|
||||
--enable_query_log
|
||||
|
||||
# Stop slaves
|
||||
|
||||
--connection master
|
||||
--disable_warnings
|
||||
STOP SLAVE;
|
||||
--wait_for_slave_to_stop
|
||||
--enable_warnings
|
||||
|
||||
--connection master1
|
||||
--disable_warnings
|
||||
STOP SLAVE;
|
||||
--wait_for_slave_to_stop
|
||||
--enable_warnings
|
||||
|
||||
--connection slave
|
||||
--disable_warnings
|
||||
STOP SLAVE;
|
||||
--wait_for_slave_to_stop
|
||||
--enable_warnings
|
||||
|
||||
--connection slave1
|
||||
--disable_warnings
|
||||
STOP SLAVE;
|
||||
--wait_for_slave_to_stop
|
||||
--enable_warnings
|
||||
|
||||
# Reset masters
|
||||
|
||||
--connection master
|
||||
--disable_warnings
|
||||
--disable_query_log
|
||||
USE test;
|
||||
--enable_query_log
|
||||
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
--enable_warnings
|
||||
RESET MASTER;
|
||||
|
||||
--connection master1
|
||||
--disable_warnings
|
||||
--disable_query_log
|
||||
USE test;
|
||||
--enable_query_log
|
||||
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
--enable_warnings
|
||||
RESET MASTER;
|
||||
|
||||
--connection slave
|
||||
--disable_warnings
|
||||
--disable_query_log
|
||||
USE test;
|
||||
--enable_query_log
|
||||
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
--enable_warnings
|
||||
RESET MASTER;
|
||||
|
||||
--connection slave1
|
||||
--disable_warnings
|
||||
--disable_query_log
|
||||
USE test;
|
||||
--enable_query_log
|
||||
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
--enable_warnings
|
||||
RESET MASTER;
|
||||
|
||||
# Start slaves
|
||||
|
||||
--connection slave
|
||||
RESET SLAVE;
|
||||
--replace_result $MASTER_MYPORT MASTER_MYPORT
|
||||
--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$MASTER_MYPORT,master_user='root'
|
||||
START SLAVE;
|
||||
--source include/wait_for_slave_to_start.inc
|
||||
|
||||
--connection master1
|
||||
RESET SLAVE;
|
||||
--replace_result $SLAVE_MYPORT1 SLAVE_MYPORT1
|
||||
--eval CHANGE MASTER TO master_host='127.0.0.1',master_port=$SLAVE_MYPORT1,master_user='root'
|
||||
START SLAVE;
|
||||
--source include/wait_for_slave_to_start.inc
|
||||
|
||||
|
||||
# Set the default connection to 'master' (cluster A)
|
||||
connection master;
|
||||
|
||||
|
|
@ -17,7 +17,7 @@ while ($mysql_errno)
|
|||
{
|
||||
if (!$counter)
|
||||
{
|
||||
die("Failed while waiting for mysqld to come out of readonly mode");
|
||||
die Failed while waiting for mysqld to come out of readonly mode;
|
||||
}
|
||||
dec $counter;
|
||||
--sleep 0.1
|
||||
|
|
|
|||
|
|
@ -3,6 +3,6 @@
|
|||
# in test cases and can be reused. #
|
||||
######################################################
|
||||
|
||||
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
|
||||
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
|
||||
|
||||
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -p 8 -b $the_backup_id -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
|
||||
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -p 8 -b $the_backup_id -n 2 -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
# in test cases and can be reused. #
|
||||
######################################################
|
||||
|
||||
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
|
||||
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
|
||||
|
||||
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="localhost:$NDBCLUSTER_PORT_SLAVE" -p 8 -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
|
||||
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -p 8 -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
--echo **** Resetting master and slave ****
|
||||
connection slave;
|
||||
STOP SLAVE;
|
||||
source include/wait_for_slave_to_stop.inc;
|
||||
source include/stop_slave.inc;
|
||||
RESET SLAVE;
|
||||
connection master;
|
||||
RESET MASTER;
|
||||
connection slave;
|
||||
START SLAVE;
|
||||
source include/wait_for_slave_to_start.inc;
|
||||
source include/start_slave.inc;
|
||||
|
|
|
|||
20
mysql-test/include/restart_mysqld.inc
Normal file
20
mysql-test/include/restart_mysqld.inc
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
|
||||
# Write file to make mysql-test-run.pl expect crash and restart
|
||||
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||
restart
|
||||
EOF
|
||||
|
||||
# Send shutdown to the connected server and give
|
||||
# it 10 seconds to die before zapping it
|
||||
shutdown_server 10;
|
||||
|
||||
|
||||
# Turn on reconnect
|
||||
--enable_reconnect
|
||||
|
||||
# Call script that will poll the server waiting for it to be back online again
|
||||
--source include/wait_until_connected_again.inc
|
||||
|
||||
# Turn off reconnect again
|
||||
--disable_reconnect
|
||||
|
||||
|
|
@ -62,7 +62,9 @@ SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name
|
|||
DROP EVENT IF EXISTS test.slave_once;
|
||||
--enable_warnings
|
||||
|
||||
CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE DO
|
||||
# Create an event on slave and check its state. An event shouldn't be executed
|
||||
# so set start time in 1 hour.
|
||||
CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO
|
||||
INSERT IGNORE INTO t1(id, c) VALUES (3, 'from slave_once');
|
||||
|
||||
--echo "Checking event status on the slave for originator value = slave's server_id"
|
||||
|
|
@ -81,8 +83,11 @@ connection master;
|
|||
DROP EVENT IF EXISTS test.justonce;
|
||||
--enable_warnings
|
||||
|
||||
# Create an event on master and check its state on slave. An event shouldn't be executed
|
||||
# so set start time in 1 hour. Check that changes of event statement replicated to slave
|
||||
|
||||
--echo "Creating event test.er on the master"
|
||||
CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND DO
|
||||
CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO
|
||||
INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er');
|
||||
|
||||
--echo "Checking event status on the master"
|
||||
|
|
@ -95,7 +100,7 @@ SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND
|
|||
|
||||
connection master;
|
||||
--echo "Altering event test.er on the master"
|
||||
ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO
|
||||
ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO
|
||||
INSERT IGNORE INTO t1(id, c) VALUES (5, 'from alter er');
|
||||
|
||||
--echo "Checking event status on the master"
|
||||
|
|
@ -123,8 +128,11 @@ SELECT db, name, status, originator FROM mysql.event WHERE db = 'test';
|
|||
# test the DISABLE ON SLAVE for setting event SLAVESIDE_DISABLED as status
|
||||
# on CREATE EVENT
|
||||
|
||||
# Create an event on slave and check its status. An event shouldn't be executed
|
||||
# so set start time in 1 hour.
|
||||
|
||||
--echo "Creating event test.slave_terminate on the slave"
|
||||
CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND DO
|
||||
CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO
|
||||
INSERT IGNORE INTO t1(id, c) VALUES (6, 'from slave_terminate');
|
||||
|
||||
--echo "Checking event status on the slave"
|
||||
|
|
|
|||
21
mysql-test/include/start_slave.inc
Normal file
21
mysql-test/include/start_slave.inc
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# ==== Purpose ====
|
||||
#
|
||||
# Issues START SLAVE on the current connection. Then waits until both
|
||||
# the IO and SQL threads have started, or until a timeout is reached.
|
||||
#
|
||||
# Please use this instead of 'START SLAVE', to reduce the risk of test
|
||||
# case bugs.
|
||||
#
|
||||
# ==== Usage ====
|
||||
#
|
||||
# source include/wait_for_slave_to_start.inc;
|
||||
#
|
||||
# Parameters to this macro are $slave_timeout and
|
||||
# $slave_keep_connection. See wait_for_slave_param.inc for
|
||||
# descriptions.
|
||||
|
||||
--disable_query_log
|
||||
START SLAVE;
|
||||
--enable_query_log
|
||||
--echo include/start_slave.inc
|
||||
source include/wait_for_slave_to_start.inc;
|
||||
21
mysql-test/include/stop_slave.inc
Normal file
21
mysql-test/include/stop_slave.inc
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# ==== Purpose ====
|
||||
#
|
||||
# Issues STOP SLAVE on the current connection. Then waits until both
|
||||
# the IO and SQL threads have stopped, or until a timeout is reached.
|
||||
#
|
||||
# Please use this instead of 'STOP SLAVE', to reduce the risk of test
|
||||
# case bugs.
|
||||
#
|
||||
# ==== Usage ====
|
||||
#
|
||||
# source include/wait_for_slave_to_start.inc;
|
||||
#
|
||||
# Parameters to this macro are $slave_timeout and
|
||||
# $slave_keep_connection. See wait_for_slave_param.inc for
|
||||
# descriptions.
|
||||
|
||||
--disable_query_log
|
||||
STOP SLAVE;
|
||||
--enable_query_log
|
||||
--echo include/stop_slave.inc
|
||||
source include/wait_for_slave_to_stop.inc;
|
||||
36
mysql-test/include/sync_slave_io_with_master.inc
Normal file
36
mysql-test/include/sync_slave_io_with_master.inc
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
# ==== Purpose ====
|
||||
#
|
||||
# Waits until the slave IO thread has been synced, i.e., all events
|
||||
# have been copied over to slave. Does not care if the SQL thread is
|
||||
# in sync.
|
||||
#
|
||||
#
|
||||
# ==== Usage ====
|
||||
#
|
||||
# source include/sync_slave_io_with_master.inc;
|
||||
#
|
||||
# Syncs to the current position on master, as found by SHOW MASTER
|
||||
# STATUS.
|
||||
#
|
||||
# Must be called on the master. Will change connection to the slave.
|
||||
#
|
||||
# Parameters to this macro are $slave_timeout and
|
||||
# $slave_keep_connection. See wait_for_slave_param.inc for
|
||||
# descriptions.
|
||||
|
||||
let $_master_file= query_get_value("SHOW MASTER STATUS", File, 1);
|
||||
let $_master_pos= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
|
||||
connection slave;
|
||||
|
||||
let $slave_error_message= Failed while waiting for slave IO thread to sync;
|
||||
|
||||
let $slave_param= Master_Log_File;
|
||||
let $slave_param_value= $_master_file;
|
||||
source include/wait_for_slave_param.inc;
|
||||
|
||||
let $slave_param= Read_Master_Log_Pos;
|
||||
let $slave_param_value= $_master_pos;
|
||||
source include/wait_for_slave_param.inc;
|
||||
|
||||
let $slave_error_message= ;
|
||||
|
|
@ -19,12 +19,6 @@
|
|||
# #
|
||||
###################################################################
|
||||
|
||||
--disable_query_log
|
||||
eval set @USE_RUNNING_SERVER= '$USE_RUNNING_SERVER';
|
||||
--require r/testdb_only.require
|
||||
SELECT 'use extern server'
|
||||
AS "Variable_name ",
|
||||
IF(@USE_RUNNING_SERVER= '1','YES',
|
||||
IF(@USE_RUNNING_SERVER= '0','NO','UNEXPECTED'))
|
||||
AS "Value" ;
|
||||
--enable_query_log
|
||||
if ($USE_RUNNING_SERVER){
|
||||
skip Not with extern server;
|
||||
}
|
||||
|
|
|
|||
19
mysql-test/include/wait_for_slave_io_to_start.inc
Normal file
19
mysql-test/include/wait_for_slave_io_to_start.inc
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# ==== Purpose ====
|
||||
#
|
||||
# Waits until the IO thread of the current connection has started and
|
||||
# connected to the master (i.e., until SHOW SLAVE STATUS returns Yes
|
||||
# in the Slave_IO_Running field), or until a timeout is reached.
|
||||
#
|
||||
# ==== Usage ====
|
||||
#
|
||||
# source include/wait_for_slave_io_to_start.inc;
|
||||
#
|
||||
# Parameters to this macro are $slave_timeout and
|
||||
# $slave_keep_connection. See wait_for_slave_param.inc for
|
||||
# descriptions.
|
||||
|
||||
let $slave_param= Slave_IO_Running;
|
||||
let $slave_param_value= Yes;
|
||||
let $slave_error_message= Failed while waiting for slave IO thread to start;
|
||||
source include/wait_for_slave_param.inc;
|
||||
let $slave_error_message= ;
|
||||
|
|
@ -1,33 +1,18 @@
|
|||
###################################################
|
||||
#Author: Jeb
|
||||
#Date: 2007-06-11
|
||||
#Purpose: used for io errors on the slave. If Slave gets an io
|
||||
# error, the io trhead should stop
|
||||
#Details:
|
||||
# 1) Fill in and setup variables
|
||||
# 2) loop through looking for
|
||||
# sql threads to stop
|
||||
# 3) If loops too long die.
|
||||
####################################################
|
||||
connection slave;
|
||||
let $my_show= SHOW SLAVE STATUS;
|
||||
let $sql_running= Slave_IO_Running;
|
||||
let $row_number= 1;
|
||||
let $run= 1;
|
||||
let $counter= 300;
|
||||
|
||||
while ($run)
|
||||
{
|
||||
let $io_result= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, $row_number);
|
||||
if (`SELECT '$io_result' = 'No'`){
|
||||
let $run= 0;
|
||||
}
|
||||
sleep 0.1;
|
||||
if (!$counter){
|
||||
--echo "Failed while waiting for slave IO thread to stop"
|
||||
query_vertical SHOW SLAVE STATUS;
|
||||
exit;
|
||||
}
|
||||
dec $counter;
|
||||
}
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Waits until the IO thread of the current connection has stopped, or
|
||||
# until a timeout is reached.
|
||||
#
|
||||
# ==== Usage ====
|
||||
#
|
||||
# source include/wait_for_slave_io_to_stop.inc;
|
||||
#
|
||||
# Parameters to this macro are $slave_timeout and
|
||||
# $slave_keep_connection. See wait_for_slave_param.inc for
|
||||
# descriptions.
|
||||
|
||||
let $slave_param= Slave_IO_Running;
|
||||
let $slave_param_value= No;
|
||||
let $slave_error_message= Failed while waiting for slave IO thread to stop;
|
||||
source include/wait_for_slave_param.inc;
|
||||
let $slave_error_message= ;
|
||||
|
|
|
|||
|
|
@ -1,26 +1,94 @@
|
|||
# include/wait_for_slave_param.inc
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# SUMMARY
|
||||
# Waits until SHOW SLAVE STATUS has returned a specified value, or
|
||||
# until a timeout is reached.
|
||||
#
|
||||
# Waits until SHOW SLAVE STATUS has returned a spicified value.
|
||||
# ==== Usage ====
|
||||
#
|
||||
# USAGE
|
||||
# let $slave_param= Slave_SQL_Running;
|
||||
# let $slave_param_value= No;
|
||||
# --source include/slave_wait_param.inc
|
||||
#
|
||||
# let $slave_param= Slave_SQL_Running;
|
||||
# let $slave_param_value= No;
|
||||
# --source include/slave_wait_param.inc
|
||||
# Parameters:
|
||||
#
|
||||
# $slave_param, $slave_param_value
|
||||
# This macro will wait until the column of the output of SHOW SLAVE
|
||||
# STATUS named $slave_param gets the value $slave_param_value. See
|
||||
# the example above.
|
||||
#
|
||||
# $slave_param_comparison
|
||||
# By default, this file waits until $slave_param becomes equal to
|
||||
# $slave_param_value. If you want to wait until $slave_param
|
||||
# becomes *unequal* to $slave_param_value, set this parameter to the
|
||||
# string '!=', like this:
|
||||
# let $slave_param_comparison= !=;
|
||||
#
|
||||
# $slave_timeout
|
||||
# The default timeout is 5 minutes. You can change the timeout by
|
||||
# setting $slave_timeout. The unit is tenths of seconds.
|
||||
#
|
||||
# $slave_keep_connection
|
||||
# If the timeout is reached, debug info is given by calling SHOW
|
||||
# SLAVE STATUS, SHOW PROCESSLIST, and SHOW BINLOG EVENTS. By
|
||||
# default (assuming the current connection is slave), a 'connection
|
||||
# master' is then issued, and the same information is printed again
|
||||
# on the master host. You can avoid switching to master (and thus
|
||||
# suppress debug info on master too) by setting
|
||||
# $slave_keep_connection to 1.
|
||||
#
|
||||
# $slave_error_message
|
||||
# If set, this is printed when a timeout occurs. This is primarily
|
||||
# intended to be used by other wait_for_slave_* macros, to indicate
|
||||
# what the purpose of the wait was. (A very similar error message is
|
||||
# given by default, but the wait_for_slave_* macros use this to give
|
||||
# an error message identical to that in previous versions, so that
|
||||
# errors are easier searchable in the pushbuild history.)
|
||||
|
||||
let $slave_wait_param_counter= 300;
|
||||
let $slave_value= query_get_value("SHOW SLAVE STATUS", $slave_param, 1);
|
||||
while (`select "$slave_value" != "$slave_param_value"`)
|
||||
let $_slave_timeout_counter= $slave_timeout;
|
||||
if (!$_slave_timeout_counter)
|
||||
{
|
||||
dec $slave_wait_param_counter;
|
||||
if (!$slave_wait_param_counter)
|
||||
let $_slave_timeout_counter= 3000;
|
||||
}
|
||||
|
||||
let $_slave_param_comparison= $slave_param_comparison;
|
||||
if (`SELECT '$_slave_param_comparison' = ''`)
|
||||
{
|
||||
let $_slave_param_comparison= =;
|
||||
}
|
||||
|
||||
let $_show_slave_status_value= query_get_value("SHOW SLAVE STATUS", $slave_param, 1);
|
||||
while (`SELECT NOT('$_show_slave_status_value' $_slave_param_comparison '$slave_param_value')`)
|
||||
{
|
||||
if (!$_slave_timeout_counter)
|
||||
{
|
||||
--echo ERROR: failed while waiting for slave parameter $slave_param: $slave_param_value
|
||||
query_vertical show slave status;
|
||||
--echo **** ERROR: failed while waiting for slave parameter $slave_param $_slave_param_comparison $slave_param_value ****
|
||||
if (`SELECT '$slave_error_message' != ''`)
|
||||
{
|
||||
--echo Message: $slave_error_message
|
||||
}
|
||||
--echo Note: the following output may have changed since the failure was detected
|
||||
--echo **** Showing SLAVE STATUS, PROCESSLIST, and BINLOG EVENTS on slave ****
|
||||
query_vertical SHOW SLAVE STATUS;
|
||||
SHOW PROCESSLIST;
|
||||
let $binlog_name= query_get_value("SHOW MASTER STATUS", File, 1);
|
||||
eval SHOW BINLOG EVENTS IN '$binlog_name';
|
||||
if (!$slave_keep_connection) {
|
||||
let $master_binlog_name_io= query_get_value("SHOW SLAVE STATUS", Master_Log_File, 1);
|
||||
let $master_binlog_name_sql= query_get_value("SHOW SLAVE STATUS", Relay_Master_Log_File, 1);
|
||||
--echo **** Showing MASTER STATUS, PROCESSLIST, and BINLOG EVENTS on master ****
|
||||
--echo [on master]
|
||||
connection master;
|
||||
query_vertical SHOW MASTER STATUS;
|
||||
SHOW PROCESSLIST;
|
||||
eval SHOW BINLOG EVENTS IN '$master_binlog_name_sql';
|
||||
if (`SELECT '$master_binlog_name_io' != '$master_binlog_name_sql'`)
|
||||
{
|
||||
eval SHOW BINLOG EVENTS IN '$master_binlog_name_io';
|
||||
}
|
||||
}
|
||||
exit;
|
||||
}
|
||||
dec $_slave_timeout_counter;
|
||||
sleep 0.1;
|
||||
let $slave_value= query_get_value("SHOW SLAVE STATUS", $slave_param, 1);
|
||||
let $_show_slave_status_value= query_get_value("SHOW SLAVE STATUS", $slave_param, 1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,33 +1,23 @@
|
|||
###################################################
|
||||
#Author: Sven
|
||||
#Date: 2007-10-09
|
||||
#Purpose: Wait until the slave has an error in the
|
||||
# sql thread, as indicated by
|
||||
# "SHOW SLAVE STATUS", or at most 30
|
||||
# seconds.
|
||||
#Details:
|
||||
# 1) Fill in and setup variables
|
||||
# 2) loop, looking for sql error on slave
|
||||
# 3) If it loops too long, die.
|
||||
####################################################
|
||||
connection slave;
|
||||
let $row_number= 1;
|
||||
let $run= 1;
|
||||
let $counter= 300;
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Waits until the SQL thread of the current connection has got an
|
||||
# error, or until a timeout is reached.
|
||||
#
|
||||
# ==== Usage ====
|
||||
#
|
||||
# source include/wait_for_slave_sql_error.inc;
|
||||
#
|
||||
# Parameters to this macro are $slave_timeout and
|
||||
# $slave_keep_connection. See wait_for_slave_param.inc for
|
||||
# descriptions.
|
||||
|
||||
while ($run)
|
||||
{
|
||||
let $sql_result= query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, $row_number);
|
||||
let $run= `SELECT '$sql_result' = '0'`;
|
||||
if ($run) {
|
||||
real_sleep 0.1;
|
||||
if (!$counter){
|
||||
--echo "Failed while waiting for slave to produce an error in its sql thread"
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT
|
||||
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
|
||||
query_vertical SHOW SLAVE STATUS;
|
||||
exit;
|
||||
}
|
||||
dec $counter;
|
||||
}
|
||||
}
|
||||
let $old_slave_param_comparison= $slave_param_comparison;
|
||||
|
||||
let $slave_param= Last_SQL_Errno;
|
||||
let $slave_param_comparison= !=;
|
||||
let $slave_param_value= 0;
|
||||
let $slave_error_message= Failed while waiting for slave to produce an error in its sql thread;
|
||||
source include/wait_for_slave_param.inc;
|
||||
let $slave_error_message= ;
|
||||
|
||||
let $slave_param_comparison= $old_slave_param_comparison;
|
||||
|
|
|
|||
|
|
@ -1,31 +1,17 @@
|
|||
###################################################
|
||||
#Author: Mats (based on file written by Jeb)
|
||||
#Date: 2008-05-06
|
||||
#Purpose: To wait for slave SQL thread to start
|
||||
#Details:
|
||||
# 1) Fill in and setup variables
|
||||
# 2) loop through looking for both
|
||||
# io and sql threads to start
|
||||
# 3) If loops too long die.
|
||||
####################################################
|
||||
connection slave;
|
||||
let $row_number= 1;
|
||||
let $run= 1;
|
||||
let $counter= 300;
|
||||
|
||||
while ($run)
|
||||
{
|
||||
let $sql_result= query_get_value("SHOW SLAVE STATUS", Slave_SQL_Running, $row_number);
|
||||
if (`SELECT '$sql_result' = 'Yes'`){
|
||||
let $run= 0;
|
||||
}
|
||||
sleep 0.1;
|
||||
if (!$counter){
|
||||
--echo "Failed while waiting for slave SQL to start"
|
||||
query_vertical SHOW SLAVE STATUS;
|
||||
exit;
|
||||
}
|
||||
dec $counter;
|
||||
}
|
||||
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Waits the SQL thread of the current connection has started, or until
|
||||
# a timeout is reached.
|
||||
#
|
||||
# ==== Usage ====
|
||||
#
|
||||
# source include/wait_for_slave_sql_to_start.inc;
|
||||
#
|
||||
# Parameters to this macro are $slave_timeout and
|
||||
# $slave_keep_connection. See wait_for_slave_param.inc for
|
||||
# descriptions.
|
||||
|
||||
let $slave_param= Slave_SQL_Running;
|
||||
let $slave_param_value= Yes;
|
||||
let $slave_error_message= Failed while waiting for slave SQL to start;
|
||||
source include/wait_for_slave_param.inc;
|
||||
|
|
|
|||
|
|
@ -1,33 +1,18 @@
|
|||
###################################################
|
||||
#Author: Jeb
|
||||
#Date: 2007-06-11
|
||||
#Purpose: used for SQL errors on the slave. If Slave gets a sql
|
||||
# error, the SQL trhead should stop
|
||||
#Details:
|
||||
# 1) Fill in and setup variables
|
||||
# 2) loop through looking for
|
||||
# sql threads to stop
|
||||
# 3) If loops too long die.
|
||||
####################################################
|
||||
if (!$keep_connection)
|
||||
{
|
||||
connection slave;
|
||||
}
|
||||
let $row_number= 1;
|
||||
let $run= 1;
|
||||
let $counter= 300;
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Waits the SQL thread of the current connection has stopped, or until
|
||||
# a timeout is reached.
|
||||
#
|
||||
# ==== Usage ====
|
||||
#
|
||||
# source include/wait_for_slave_sql_to_stop.inc;
|
||||
#
|
||||
# Parameters to this macro are $slave_timeout and
|
||||
# $slave_keep_connection. See wait_for_slave_param.inc for
|
||||
# descriptions.
|
||||
|
||||
while ($run)
|
||||
{
|
||||
let $sql_result= query_get_value("SHOW SLAVE STATUS", Slave_SQL_Running, $row_number);
|
||||
if (`SELECT '$sql_result' = 'No'`){
|
||||
let $run= 0;
|
||||
}
|
||||
sleep 0.1;
|
||||
if (!$counter){
|
||||
--echo "Failed while waiting for slave SQL thread to stop"
|
||||
query_vertical SHOW SLAVE STATUS;
|
||||
exit;
|
||||
}
|
||||
dec $counter;
|
||||
}
|
||||
let $slave_param= Slave_SQL_Running;
|
||||
let $slave_param_value= No;
|
||||
let $slave_error_message= Failed while waiting for slave SQL thread to stop;
|
||||
source include/wait_for_slave_param.inc;
|
||||
let $slave_error_message= ;
|
||||
|
|
|
|||
|
|
@ -1,35 +1,24 @@
|
|||
###################################################
|
||||
#Author: Jeb
|
||||
#Date: 2007-06-11
|
||||
#Purpose: To wait a brief time for slave to start
|
||||
#Details:
|
||||
# 1) Fill in and setup variables
|
||||
# 2) loop through looking for both
|
||||
# io and sql threads to start
|
||||
# 3) If loops too long die.
|
||||
####################################################
|
||||
connection slave;
|
||||
let $row_number= 1;
|
||||
let $run= 1;
|
||||
let $counter= 300;
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Waits until both the IO and SQL threads of the current connection
|
||||
# have started, or until a timeout is reached.
|
||||
#
|
||||
# ==== Usage ====
|
||||
#
|
||||
# source include/wait_for_slave_to_start.inc;
|
||||
#
|
||||
# Parameters to this macro are $slave_timeout and
|
||||
# $slave_keep_connection. See wait_for_slave_param.inc for
|
||||
# descriptions.
|
||||
|
||||
while ($run)
|
||||
{
|
||||
let $io_result= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, $row_number);
|
||||
if (`SELECT '$io_result' = 'Yes'`){
|
||||
let $slave_error_message= Failed while waiting for slave to start;
|
||||
|
||||
let $sql_result= query_get_value("SHOW SLAVE STATUS", Slave_SQL_Running, $row_number);
|
||||
if (`SELECT '$sql_result' = 'Yes'`){
|
||||
let $run= 0;
|
||||
}
|
||||
}
|
||||
sleep 0.1;
|
||||
if (!$counter){
|
||||
--echo "Failed while waiting for slave to start"
|
||||
query_vertical SHOW SLAVE STATUS;
|
||||
exit;
|
||||
}
|
||||
dec $counter;
|
||||
}
|
||||
let $slave_param= Slave_IO_Running;
|
||||
let $slave_param_value= Yes;
|
||||
source include/wait_for_slave_param.inc;
|
||||
|
||||
let $slave_param= Slave_SQL_Running;
|
||||
let $slave_param_value= Yes;
|
||||
source include/wait_for_slave_param.inc;
|
||||
|
||||
let $slave_error_message= ;
|
||||
|
|
|
|||
|
|
@ -1,39 +1,24 @@
|
|||
###################################################
|
||||
#Author: Jeb
|
||||
#Date: 2007-06-11
|
||||
#Purpose: To replace the mysqltest.c executable
|
||||
# wait_for_slave_to_stop function and
|
||||
# return this to the test language.
|
||||
#Details:
|
||||
# 1) Fill in and setup variables
|
||||
# 2) loop through looking for both
|
||||
# io and sql threads to stop
|
||||
# 3) If loops too long die.
|
||||
####################################################
|
||||
connection slave;
|
||||
let $row_number= 1;
|
||||
let $run= 1;
|
||||
let $counter= 300;
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Waits until both the IO and SQL threads of the current connection
|
||||
# have stopped, or until a timeout is reached.
|
||||
#
|
||||
# ==== Usage ====
|
||||
#
|
||||
# source include/wait_for_slave_to_stop.inc;
|
||||
#
|
||||
# Parameters to this macro are $slave_timeout and
|
||||
# $slave_keep_connection. See wait_for_slave_param.inc for
|
||||
# descriptions.
|
||||
|
||||
while ($run)
|
||||
{
|
||||
let $io_result= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, $row_number);
|
||||
if (`SELECT '$io_result' = 'No'`){
|
||||
let $slave_error_message= Failed while waiting for slave to stop;
|
||||
|
||||
let $sql_result= query_get_value("SHOW SLAVE STATUS", Slave_SQL_Running, $row_number);
|
||||
if (`SELECT '$sql_result' = 'No'`){
|
||||
let $run= 0;
|
||||
}
|
||||
}
|
||||
sleep 0.1;
|
||||
if (!$counter){
|
||||
--echo "Failed while waiting for slave to stop"
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT
|
||||
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
|
||||
query_vertical SHOW SLAVE STATUS;
|
||||
exit;
|
||||
}
|
||||
dec $counter;
|
||||
}
|
||||
let $slave_param= Slave_IO_Running;
|
||||
let $slave_param_value= No;
|
||||
source include/wait_for_slave_param.inc;
|
||||
|
||||
let $slave_param= Slave_SQL_Running;
|
||||
let $slave_param_value= No;
|
||||
source include/wait_for_slave_param.inc;
|
||||
|
||||
let $slave_error_message= ;
|
||||
|
|
|
|||
|
|
@ -1,51 +0,0 @@
|
|||
# include/wait_show_pattern.inc
|
||||
#
|
||||
# SUMMARY
|
||||
#
|
||||
# Waits until output produced by SHOW statement which particular type is
|
||||
# specified as parameter matches certain pattern or maximum time reached.
|
||||
#
|
||||
# NOTES
|
||||
#
|
||||
# Only the first row produced by the parameter statement is checked.
|
||||
#
|
||||
# USAGE
|
||||
#
|
||||
# let $show_type= <Tail of SHOW statement>;
|
||||
# let $show_pattern= 'Pattern to be used for LIKE matching';
|
||||
# --source wait_show_pattern.inc
|
||||
#
|
||||
# EXAMPLES
|
||||
#
|
||||
# alter_table-big.test, wait_slave_status.inc
|
||||
#
|
||||
# SEE ALSO
|
||||
#
|
||||
# wait_slave_status.inc, wait_condition.inc (>=5.1)
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
--disable_query_log
|
||||
|
||||
# We accept to wait maximum 30 seconds (0.2 sec/loop).
|
||||
let $wait_counter= 150;
|
||||
while ($wait_counter)
|
||||
{
|
||||
let $result= `SHOW $show_type`;
|
||||
let $success= `SELECT '$result' LIKE $show_pattern`;
|
||||
if ($success)
|
||||
{
|
||||
let $wait_counter= 0;
|
||||
}
|
||||
if (!$success)
|
||||
{
|
||||
real_sleep 0.2;
|
||||
dec $wait_counter;
|
||||
}
|
||||
}
|
||||
if (!$success)
|
||||
{
|
||||
echo Timeout in wait_show_pattern.inc \$show_type= $show_type \$show_pattern= $show_pattern (\$result= '$result');
|
||||
}
|
||||
|
||||
--enable_query_log
|
||||
|
|
@ -1,129 +0,0 @@
|
|||
# include/wait_slave_status.inc
|
||||
#
|
||||
# Created by Matthias Leich
|
||||
#
|
||||
# SUMMARY
|
||||
#
|
||||
# Waits until slave has reached certain state or maximum time reached.
|
||||
#
|
||||
# (This script will not work, when the SHOW command delivers more than one
|
||||
# result record, because only the first record will be caught.)
|
||||
#
|
||||
# USAGE
|
||||
#
|
||||
# Set $result_pattern in test file and source this file:
|
||||
#
|
||||
# let $result_pattern= <pattern used for LIKE on the result of
|
||||
# SHOW STATUS SLAVE>
|
||||
# --include wait_slave_status.inc
|
||||
#
|
||||
# EXAMPLE
|
||||
#
|
||||
# The script rpl_until.test:
|
||||
# ...
|
||||
# --replace_result $MASTER_MYPORT MASTER_MYPORT
|
||||
# --replace_column 1 # 9 # 23 # 33 #
|
||||
# --vertical_results show slave status;
|
||||
#
|
||||
# outputs
|
||||
# show slave status;
|
||||
# Slave_IO_State #
|
||||
# Master_Host 127.0.0.1
|
||||
# Master_User root
|
||||
# Master_Port MASTER_MYPORT
|
||||
# Connect_Retry 1
|
||||
# Master_Log_File master-bin.000001
|
||||
# Read_Master_Log_Pos 776
|
||||
# Relay_Log_File slave-relay-bin.000004
|
||||
# Relay_Log_Pos #
|
||||
# Relay_Master_Log_File master-bin.000001
|
||||
# Slave_IO_Running Yes
|
||||
# Slave_SQL_Running No
|
||||
# Replicate_Do_DB
|
||||
# Replicate_Ignore_DB
|
||||
# Replicate_Do_Table
|
||||
# Replicate_Ignore_Table
|
||||
# Replicate_Wild_Do_Table
|
||||
# Replicate_Wild_Ignore_Table
|
||||
# Last_Errno 0
|
||||
# Last_Error
|
||||
# Skip_Counter 0
|
||||
# Exec_Master_Log_Pos 319
|
||||
# Relay_Log_Space #
|
||||
# Until_Condition Master
|
||||
# Until_Log_File master-bin.000001
|
||||
# Until_Log_Pos 319
|
||||
# Master_SSL_Allowed No
|
||||
# Master_SSL_CA_File
|
||||
# Master_SSL_CA_Path
|
||||
# Master_SSL_Cert
|
||||
# Master_SSL_Cipher
|
||||
# Master_SSL_Key
|
||||
# Seconds_Behind_Master #
|
||||
#
|
||||
# The main problem with the "show slave status;" in rpl_until is, that
|
||||
# depending on the total test engine power and the current load caused by
|
||||
# other processes, the expected slave status might be not reached though
|
||||
# it will happen in maybe some seconds.
|
||||
#
|
||||
# The typical problem with rpl_until is that Slave_IO_Running is "No"
|
||||
# instead of "Yes".
|
||||
#
|
||||
# The expected result follows the LIKE pattern:
|
||||
#
|
||||
# let $result_pattern= '%127.0.0.1%root%1%master-bin.000001%776%slave-relay-bin.000004%master-bin.000001%Yes%No%0%0%319%Master%master-bin.000001%319%No%';
|
||||
#
|
||||
# The Slave_IO_Running value is the "Yes" just after the "master-bin.000001".
|
||||
#
|
||||
# How to get this pattern ?
|
||||
#
|
||||
# Any lines "--replace_result ..." and "--replace_colum ..." just before
|
||||
# the SHOW TABLE STATUS and of course the expected result itself
|
||||
# show us columns where the content must be unified, because it is non
|
||||
# deterministic or it depends on the current test environment.
|
||||
#
|
||||
# Unfortunately "--replace_result ..." and "--replace_colum ..." do not
|
||||
# affect the result of our assignment let $my_val= `SHOW SLAVE STATUS`;
|
||||
# Therefore such content must be covered by '%'.
|
||||
#
|
||||
# Please be careful. A more simple pattern might be dangerous, because we
|
||||
# might get "wrong" matches. Example: There might be several "Yes" and "No"
|
||||
# within one result row.
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
# We do not want to print the auxiliary commands, because they are not of
|
||||
# interest and their amount will vary depending how fast we get the
|
||||
# desired state.
|
||||
--disable_query_log
|
||||
|
||||
# The protocol should show
|
||||
# - the setting of $result_pattern and
|
||||
# - that this file is sourced ,
|
||||
# because this increases the chance to use the protocol as replay script.
|
||||
eval SELECT "let \$result_pattern= $result_pattern ;" AS "";
|
||||
SELECT '--source include/wait_slave_status.inc' AS "";
|
||||
|
||||
let $show_type= SLAVE STATUS;
|
||||
let $show_pattern= $result_pattern;
|
||||
--enable_query_log
|
||||
|
||||
--source include/wait_show_pattern.inc
|
||||
|
||||
if (!$success)
|
||||
{
|
||||
let $message= ! Attention: Timeout in wait_slave_status.inc.
|
||||
| Possible reasons with decreasing probability:
|
||||
| - The LIKE pattern is wrong, because the
|
||||
| testcase was altered or the layout of the
|
||||
| SHOW SLAVE STATUS result set changed.
|
||||
| - There is a new bug within the replication.
|
||||
| - We met an extreme testing environment and timeout is
|
||||
| too small.;
|
||||
--source include/show_msg80.inc
|
||||
--echo DEBUG INFO START (wait_slave_status.inc):
|
||||
--echo $result_pattern
|
||||
--vertical_results
|
||||
show slave status;
|
||||
--echo DEBUG INFO END
|
||||
}
|
||||
|
|
@ -4,9 +4,13 @@
|
|||
--disable_result_log
|
||||
--disable_query_log
|
||||
let $counter= 500;
|
||||
let $mysql_errno= 9999;
|
||||
while ($mysql_errno)
|
||||
{
|
||||
--error 0,2002,2006
|
||||
# Strangely enough, the server might return "Too many connections"
|
||||
# while being shutdown, thus 1040 is an "allowed" error
|
||||
# See BUG#36228
|
||||
--error 0,1040,1053,2002,2003,2006,2013
|
||||
show status;
|
||||
|
||||
dec $counter;
|
||||
|
|
|
|||
21
mysql-test/include/wait_until_disconnected.inc
Normal file
21
mysql-test/include/wait_until_disconnected.inc
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#
|
||||
# Include this script to wait until the connection to the
|
||||
# server has been dropped
|
||||
--disable_result_log
|
||||
--disable_query_log
|
||||
let $counter= 500;
|
||||
let $mysql_errno= 9999;
|
||||
while (!$mysql_errno)
|
||||
{
|
||||
--error 0,1053,2002,2006
|
||||
show status;
|
||||
|
||||
dec $counter;
|
||||
if (!$counter)
|
||||
{
|
||||
--die Server failed to dissapear
|
||||
}
|
||||
--sleep 0.1
|
||||
}
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
Loading…
Add table
Add a link
Reference in a new issue