mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Portability fixes.
Improve mysql-test to be more robust. Fix that GRANT doesn't delete SSL options Change innobase_flush_log_at_trx_commit to uint. Don't rotate logs if we read a rotate log entry from the master.
This commit is contained in:
@ -742,6 +742,8 @@ start_master()
|
||||
$RM -f $MASTER_MYDDIR/log.*
|
||||
# Remove stale binary logs
|
||||
$RM -f $MYSQL_TEST_DIR/var/log/master-bin.*
|
||||
# Remove old master.info files
|
||||
$RM -f $MYSQL_TEST_DIR/var/master-data/master.info
|
||||
|
||||
#run master initialization shell script if one exists
|
||||
|
||||
@ -858,8 +860,9 @@ start_slave()
|
||||
slave_pid=$SLAVE_MYPID
|
||||
slave_sock="$SLAVE_MYSOCK"
|
||||
fi
|
||||
# Remove stale binary logs
|
||||
$RM -f $MYSQL_TEST_DIR/var/log/$slave_ident-bin.*
|
||||
# Remove stale binary logs and old master.info files
|
||||
$RM -f $MYSQL_TEST_DIR/var/log/$slave_ident-*bin.*
|
||||
$RM -f $MYSQL_TEST_DIR/$slave_datadir/master.info
|
||||
|
||||
#run slave initialization shell script if one exists
|
||||
if [ -f "$slave_init_script" ] ;
|
||||
@ -1089,8 +1092,8 @@ run_testcase ()
|
||||
start_master
|
||||
fi
|
||||
fi
|
||||
do_slave_restart=0
|
||||
|
||||
do_slave_restart=0
|
||||
if [ -f $slave_opt_file ] ;
|
||||
then
|
||||
EXTRA_SLAVE_OPT=`$CAT $slave_opt_file | $SED -e "s;\\$MYSQL_TEST_DIR;$MYSQL_TEST_DIR;"`
|
||||
|
@ -7,6 +7,9 @@ Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3-SHA'
|
||||
GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
|
||||
grant delete on mysqltest.* to mysqltest_1@localhost;
|
||||
select * from mysql.user where user="mysqltest_1";
|
||||
Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections
|
||||
localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N SPECIFIED EDH-RSA-DES-CBC3-SHA 0 0 0
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3-SHA'
|
||||
|
@ -987,7 +987,7 @@ create table t1 (id int unsigned not null auto_increment, code tinyint unsigned
|
||||
BEGIN;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
|
||||
SELECT @@tx_isolation,@@global.tx_isolation;
|
||||
@@tx_isolation @@tx_isolation
|
||||
@@tx_isolation @@global.tx_isolation
|
||||
SERIALIZABLE READ-COMMITTED
|
||||
insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David');
|
||||
select id, code, name from t1 order by id;
|
||||
|
@ -108,3 +108,9 @@ OPTIMIZE TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize status OK
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255), KEY t1 (a, b, c));
|
||||
Specified key was too long. Max key length is 500
|
||||
CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255));
|
||||
ALTER TABLE t1 ADD INDEX t1 (a, b, c);
|
||||
Specified key was too long. Max key length is 500
|
||||
DROP TABLE t1;
|
||||
|
17
mysql-test/r/rpl_flush_log_loop.result
Normal file
17
mysql-test/r/rpl_flush_log_loop.result
Normal file
@ -0,0 +1,17 @@
|
||||
slave stop;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
slave start;
|
||||
change master to master_host='127.0.0.1',master_user='root',
|
||||
master_password='',master_port=9306;
|
||||
slave start;
|
||||
slave stop;
|
||||
change master to master_host='127.0.0.1',master_user='root',
|
||||
master_password='',master_port=9307;
|
||||
slave start;
|
||||
flush logs;
|
||||
show slave status;
|
||||
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
|
||||
127.0.0.1 root 9307 60 slave-bin.001 79 mashka-relay-bin.001 119 slave-bin.001 Yes Yes 0 0 79 119
|
@ -8,7 +8,6 @@ slave stop;
|
||||
reset master;
|
||||
reset slave;
|
||||
reset master;
|
||||
drop table if exists t1;
|
||||
create table t1(n int not null auto_increment primary key);
|
||||
insert into t1 values (NULL);
|
||||
drop table t1;
|
||||
@ -37,6 +36,9 @@ show binlog events from 79 limit 2,1;
|
||||
Log_name Pos Event_type Server_id Orig_log_pos Info
|
||||
master-bin.001 200 Query 1 200 use test; insert into t1 values (NULL)
|
||||
flush logs;
|
||||
slave start;
|
||||
flush logs;
|
||||
slave stop;
|
||||
create table t1 (n int);
|
||||
insert into t1 values (1);
|
||||
drop table t1;
|
||||
@ -52,7 +54,6 @@ master-bin.001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=81
|
||||
master-bin.001 556 Exec_load 1 556 ;file_id=1
|
||||
master-bin.001 579 Query 1 579 use test; drop table t1
|
||||
master-bin.001 627 Rotate 1 627 master-bin.002;pos=4
|
||||
master-bin.001 668 Stop 1 668
|
||||
show binlog events in 'master-bin.002';
|
||||
Log_name Pos Event_type Server_id Orig_log_pos Info
|
||||
master-bin.002 4 Query 1 4 use test; create table t1 (n int)
|
||||
@ -68,32 +69,24 @@ Log_name
|
||||
slave-bin.001
|
||||
slave-bin.002
|
||||
show binlog events in 'slave-bin.001' from 4;
|
||||
Log_name Pos Event_type Server_id Orig_log_pos Info
|
||||
slave-bin.001 4 Start 2 4 Server ver: VERSION, Binlog ver: 3
|
||||
slave-bin.001 79 Query 1 79 use test; create table t1(n int not null auto_increment primary key)
|
||||
slave-bin.001 172 Intvar 1 200 INSERT_ID=1
|
||||
slave-bin.001 200 Query 1 200 use test; insert into t1 values (NULL)
|
||||
slave-bin.001 263 Query 1 263 use test; drop table t1
|
||||
slave-bin.001 311 Query 1 311 use test; create table t1 (word char(20) not null)
|
||||
slave-bin.001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=81
|
||||
slave-bin.001 565 Exec_load 1 556 ;file_id=1
|
||||
slave-bin.001 588 Query 1 579 use test; drop table t1
|
||||
slave-bin.001 636 Rotate 2 636 slave-bin.002;pos=4
|
||||
show binlog events in 'slave-bin.002' from 4;
|
||||
Log_name Pos Event_type Server_id Orig_log_pos Info
|
||||
slave-bin.002 4 Slave 2 627 host=127.0.0.1,port=MASTER_PORT,log=master-bin.002,pos=4
|
||||
slave-bin.002 57 Query 1 4 use test; create table t1 (n int)
|
||||
slave-bin.002 115 Query 1 62 use test; insert into t1 values (1)
|
||||
slave-bin.002 175 Query 1 122 use test; drop table t1
|
||||
slave-bin.002 4 Query 1 4 use test; create table t1 (n int)
|
||||
slave-bin.002 62 Query 1 62 use test; insert into t1 values (1)
|
||||
slave-bin.002 122 Query 1 122 use test; drop table t1
|
||||
show slave status;
|
||||
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
|
||||
127.0.0.1 root MASTER_PORT 1 master-bin.002 170 slave-relay-bin.002 916 master-bin.002 Yes Yes 0 0 170 920
|
||||
show new master for slave with master_log_file='master-bin.001' and
|
||||
master_log_pos=4 and master_server_id=1;
|
||||
Log_name Log_pos
|
||||
slave-bin.001 132
|
||||
show new master for slave with master_log_file='master-bin.001' and
|
||||
master_log_pos=79 and master_server_id=1;
|
||||
Log_name Log_pos
|
||||
slave-bin.001 225
|
||||
show new master for slave with master_log_file='master-bin.001' and
|
||||
master_log_pos=311 and master_server_id=1;
|
||||
Log_name Log_pos
|
||||
slave-bin.001 439
|
||||
show new master for slave with master_log_file='master-bin.002' and
|
||||
master_log_pos=4 and master_server_id=1;
|
||||
Log_name Log_pos
|
||||
slave-bin.002 57
|
||||
show new master for slave with master_log_file='master-bin.002' and
|
||||
master_log_pos=122 and master_server_id=1;
|
||||
Log_name Log_pos
|
||||
slave-bin.002 223
|
||||
127.0.0.1 root MASTER_PORT 1 master-bin.002 170 slave-relay-bin.002 957 master-bin.002 Yes Yes 0 0 170 961
|
||||
show binlog events in 'slave-bin.005' from 4;
|
||||
Error when executing command SHOW BINLOG EVENTS: Could not find target log
|
||||
|
@ -1,37 +0,0 @@
|
||||
slave stop;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
slave start;
|
||||
drop table if exists t1;
|
||||
create table t1 ( n int);
|
||||
insert into t1 values (1),(2),(3),(4);
|
||||
insert into t1 values(5);
|
||||
select * from t1;
|
||||
n
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
select * from t1;
|
||||
n
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
select * from t1;
|
||||
n
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
select * from t1;
|
||||
n
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
drop table t1;
|
43
mysql-test/r/rpl_redirect.result
Normal file
43
mysql-test/r/rpl_redirect.result
Normal file
@ -0,0 +1,43 @@
|
||||
slave stop;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
slave start;
|
||||
SHOW SLAVE STATUS;
|
||||
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
|
||||
SHOW SLAVE HOSTS;
|
||||
Server_id Host Port Rpl_recovery_rank Master_id
|
||||
2 127.0.0.1 SLAVE_PORT 2 1
|
||||
drop table if exists t1;
|
||||
create table t1 ( n int);
|
||||
insert into t1 values (1),(2),(3),(4);
|
||||
insert into t1 values(5);
|
||||
select * from t1;
|
||||
n
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
select * from t1;
|
||||
n
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
select * from t1;
|
||||
n
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
select * from t1;
|
||||
n
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
drop table t1;
|
||||
drop table t1;
|
@ -2,12 +2,10 @@ slave start;
|
||||
Could not initialize master info structure, check permisions on master.info
|
||||
slave start;
|
||||
Could not initialize master info structure, check permisions on master.info
|
||||
change master to master_host='127.0.0.1',master_port=MASTER_PORT,
|
||||
master_user='root';
|
||||
change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root';
|
||||
Could not initialize master info
|
||||
reset slave;
|
||||
change master to master_host='127.0.0.1',master_port=MASTER_PORT,
|
||||
master_user='root';
|
||||
change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root';
|
||||
reset master;
|
||||
slave start;
|
||||
drop table if exists t1, t2, t3, t4;
|
||||
|
@ -65,7 +65,7 @@ Variable_name Value
|
||||
max_join_size 4294967295
|
||||
set @@max_join_size=1000, @@global.max_join_size=2000;
|
||||
select @@local.max_join_size, @@global.max_join_size;
|
||||
@@max_join_size @@max_join_size
|
||||
@@session.max_join_size @@global.max_join_size
|
||||
1000 2000
|
||||
select @@identity, length(@@version)>0;
|
||||
@@identity length(@@version)>0
|
||||
|
@ -8,6 +8,7 @@ flush privileges;
|
||||
grant select on mysqltest.* to mysqltest_1@localhost require cipher "EDH-RSA-DES-CBC3-SHA";
|
||||
show grants for mysqltest_1@localhost;
|
||||
grant delete on mysqltest.* to mysqltest_1@localhost;
|
||||
select * from mysql.user where user="mysqltest_1";
|
||||
show grants for mysqltest_1@localhost;
|
||||
revoke delete on mysqltest.* from mysqltest_1@localhost;
|
||||
show grants for mysqltest_1@localhost;
|
||||
|
@ -104,3 +104,13 @@ INSERT INTO t1 VALUES (1), (2), (3);
|
||||
OPTIMIZE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Test of creating table with too long key
|
||||
#
|
||||
|
||||
--error 1071
|
||||
CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255), KEY t1 (a, b, c));
|
||||
CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255));
|
||||
--error 1071
|
||||
ALTER TABLE t1 ADD INDEX t1 (a, b, c);
|
||||
DROP TABLE t1;
|
||||
|
1
mysql-test/t/rpl_flush_log_loop-master.opt
Normal file
1
mysql-test/t/rpl_flush_log_loop-master.opt
Normal file
@ -0,0 +1 @@
|
||||
-O max_binlog_size=1M
|
1
mysql-test/t/rpl_flush_log_loop-slave.opt
Normal file
1
mysql-test/t/rpl_flush_log_loop-slave.opt
Normal file
@ -0,0 +1 @@
|
||||
-O max_binlog_size=1M
|
17
mysql-test/t/rpl_flush_log_loop.test
Normal file
17
mysql-test/t/rpl_flush_log_loop.test
Normal file
@ -0,0 +1,17 @@
|
||||
# Testing if "flush logs" command bouncing resulting in logs created in a loop
|
||||
# in case of bi-directional replication
|
||||
|
||||
source include/master-slave.inc
|
||||
|
||||
connection slave;
|
||||
eval change master to master_host='127.0.0.1',master_user='root',
|
||||
master_password='',master_port=$MASTER_MYPORT;
|
||||
slave start;
|
||||
connection master;
|
||||
slave stop;
|
||||
eval change master to master_host='127.0.0.1',master_user='root',
|
||||
master_password='',master_port=$SLAVE_MYPORT;
|
||||
slave start;
|
||||
flush logs;
|
||||
sleep 5;
|
||||
show slave status;
|
@ -9,7 +9,6 @@ let $VERSION=`select version()`;
|
||||
|
||||
connection master;
|
||||
reset master;
|
||||
drop table if exists t1;
|
||||
create table t1(n int not null auto_increment primary key);
|
||||
insert into t1 values (NULL);
|
||||
drop table t1;
|
||||
@ -22,6 +21,19 @@ show binlog events from 79 limit 1;
|
||||
show binlog events from 79 limit 2;
|
||||
show binlog events from 79 limit 2,1;
|
||||
flush logs;
|
||||
|
||||
# Sync slave and force it to start on another binary log
|
||||
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
slave start;
|
||||
sync_with_master;
|
||||
flush logs;
|
||||
slave stop;
|
||||
connection master;
|
||||
|
||||
# Create some entries for second log
|
||||
|
||||
create table t1 (n int);
|
||||
insert into t1 values (1);
|
||||
drop table t1;
|
||||
@ -35,23 +47,19 @@ slave start;
|
||||
sync_with_master;
|
||||
show master logs;
|
||||
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT $VERSION VERSION
|
||||
# We can't compare binlog from slave as the result differ between
|
||||
# machines based on where the LOAD DATA file is stored.
|
||||
disable_result_log;
|
||||
|
||||
show binlog events in 'slave-bin.001' from 4;
|
||||
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT $VERSION VERSION
|
||||
enable_result_log;
|
||||
show binlog events in 'slave-bin.002' from 4;
|
||||
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
|
||||
show slave status;
|
||||
show new master for slave with master_log_file='master-bin.001' and
|
||||
master_log_pos=4 and master_server_id=1;
|
||||
show new master for slave with master_log_file='master-bin.001' and
|
||||
master_log_pos=79 and master_server_id=1;
|
||||
show new master for slave with master_log_file='master-bin.001' and
|
||||
master_log_pos=311 and master_server_id=1;
|
||||
show new master for slave with master_log_file='master-bin.002' and
|
||||
master_log_pos=4 and master_server_id=1;
|
||||
show new master for slave with master_log_file='master-bin.002' and
|
||||
master_log_pos=122 and master_server_id=1;
|
||||
|
||||
# Need to recode the following
|
||||
|
||||
#show new master for slave with master_log_file='master-bin.001' and master_log_pos=4 and master_server_id=1;
|
||||
#show new master for slave with master_log_file='master-bin.001' and master_log_pos=79 and master_server_id=1;
|
||||
#show new master for slave with master_log_file='master-bin.001' and master_log_pos=311 and master_server_id=1;
|
||||
#show new master for slave with master_log_file='master-bin.002' and master_log_pos=4 and master_server_id=1;
|
||||
#show new master for slave with master_log_file='master-bin.002' and master_log_pos=122 and master_server_id=1;
|
||||
|
||||
--error 1220
|
||||
show binlog events in 'slave-bin.005' from 4;
|
||||
|
@ -13,7 +13,7 @@ insert into t1 values(NULL);
|
||||
insert into t1 values(NULL);
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sleep 1; # there is no way around this sleep - we have to wait until
|
||||
sleep 3; # there is no way around this sleep - we have to wait until
|
||||
# the slave tries to run the query, fails and aborts slave thread
|
||||
delete from t1 where n = 2;
|
||||
slave start;
|
||||
|
@ -1,3 +1,7 @@
|
||||
#
|
||||
# Test of automatic redirection of queries to master/slave.
|
||||
#
|
||||
|
||||
source include/master-slave.inc;
|
||||
|
||||
#first, make sure the slave has had enough time to register
|
||||
@ -7,6 +11,10 @@ sync_with_master;
|
||||
|
||||
#discover slaves
|
||||
connection master;
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT
|
||||
SHOW SLAVE STATUS;
|
||||
--replace_result $SLAVE_MYPORT SLAVE_PORT
|
||||
SHOW SLAVE HOSTS;
|
||||
rpl_probe;
|
||||
|
||||
#turn on master/slave query direction auto-magic
|
||||
@ -16,11 +24,12 @@ create table t1 ( n int);
|
||||
insert into t1 values (1),(2),(3),(4);
|
||||
disable_rpl_parse;
|
||||
save_master_pos;
|
||||
enable_rpl_parse;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
insert into t1 values(5);
|
||||
connection master;
|
||||
enable_rpl_parse;
|
||||
# The first of the queries will be sent to the slave, the second to the master.
|
||||
select * from t1;
|
||||
select * from t1;
|
||||
disable_rpl_parse;
|
||||
@ -28,3 +37,5 @@ select * from t1;
|
||||
connection slave;
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
connection master;
|
||||
drop table t1;
|
@ -20,12 +20,11 @@ system chmod 600 var/slave-data/master.info;
|
||||
--error 1201
|
||||
slave start;
|
||||
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
|
||||
!eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT,
|
||||
master_user='root';
|
||||
# Will get error 13 on Unix systems becasue file is not readable
|
||||
!eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root';
|
||||
reset slave;
|
||||
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
|
||||
eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT,
|
||||
master_user='root';
|
||||
eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root';
|
||||
connection master;
|
||||
reset master;
|
||||
connection slave;
|
||||
|
Reference in New Issue
Block a user