1
0
mirror of https://github.com/MariaDB/server.git synced 2025-09-02 09:41:40 +03:00

merged fix for bug#37373 into 5.1-rpl

This commit is contained in:
Sven Sandberg
2008-07-07 18:24:04 +02:00
320 changed files with 18458 additions and 8807 deletions

View File

@@ -1,3 +0,0 @@
1|master only
2|master only
3|master only

View File

@@ -1,3 +0,0 @@
10|line A
20|line B
30|line C

View File

@@ -51,9 +51,8 @@ DELETE FROM t2 WHERE a = 2;
--echo
--echo ******************** LOAD DATA INFILE ********************
--copy_file suite/rpl/data/rpl_mixed.dat $MYSQLTEST_VARDIR/tmp/rpl_mixed.dat
LOAD DATA INFILE '../../tmp/rpl_mixed.dat' INTO TABLE t1 FIELDS TERMINATED BY '|' ;
--remove_file $MYSQLTEST_VARDIR/tmp/rpl_mixed.dat
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/std_data/rpl_mixed.dat' INTO TABLE t1 FIELDS TERMINATED BY '|' ;
SELECT * FROM t1 ORDER BY a;
--source suite/rpl/include/rpl_mixed_check_select.inc
--source suite/rpl/include/rpl_mixed_clear_tables.inc
@@ -329,6 +328,7 @@ DROP VIEW v2;
--echo ******************** SHOW BINLOG EVENTS ********************
--replace_column 2 # 5 #
--replace_regex /Server ver: .+/Server ver: #/ /table_id: [0-9]+/table_id: #/ /COMMIT.+xid=[0-9]+.+/#/ /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
show binlog events from 1;
sync_slave_with_master;
# as we're using UUID we don't SELECT but use "diff" like in rpl_row_UUID

View File

@@ -103,7 +103,7 @@ DELETE FROM t1;
DELETE FROM t2;
******************** LOAD DATA INFILE ********************
LOAD DATA INFILE '../../tmp/rpl_mixed.dat' INTO TABLE t1 FIELDS TERMINATED BY '|' ;
LOAD DATA INFILE 'MYSQLTEST_VARDIR/std_data/rpl_mixed.dat' INTO TABLE t1 FIELDS TERMINATED BY '|' ;
SELECT * FROM t1 ORDER BY a;
a b
10 line A
@@ -884,7 +884,7 @@ master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t2
master-bin.000001 # Xid 1 # #
master-bin.000001 # Query 1 # use `test_rpl`; BEGIN
master-bin.000001 # Begin_load_query 1 # ;file_id=#;block_len=#
master-bin.000001 # Execute_load_query 1 # use `test_rpl`; LOAD DATA INFILE '../../tmp/rpl_mixed.dat' INTO TABLE t1 FIELDS TERMINATED BY '|' ;file_id=#
master-bin.000001 # Execute_load_query 1 # use `test_rpl`; LOAD DATA INFILE 'MYSQLTEST_VARDIR/std_data/rpl_mixed.dat' INTO TABLE t1 FIELDS TERMINATED BY '|' ;file_id=#
master-bin.000001 # Xid 1 # #
master-bin.000001 # Query 1 # use `test_rpl`; BEGIN
master-bin.000001 # Query 1 # use `test_rpl`; DELETE FROM t1

View File

@@ -440,4 +440,14 @@ Last_SQL_Error
0
SELECT COUNT(*) FROM t1 ORDER BY c1,c2;
COUNT(*) 0
**** Test for BUG#37076 ****
**** On Master ****
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a TIMESTAMP, b DATETIME, c DATE);
INSERT INTO t1 VALUES(
'2005-11-14 01:01:01', '2005-11-14 01:01:02', '2005-11-14');
**** On Slave ****
SELECT * FROM t1;
a b c
2005-11-14 01:01:01 2005-11-14 01:01:02 2005-11-14
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8;

View File

@@ -440,4 +440,14 @@ Last_SQL_Error
0
SELECT COUNT(*) FROM t1 ORDER BY c1,c2;
COUNT(*) 0
**** Test for BUG#37076 ****
**** On Master ****
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a TIMESTAMP, b DATETIME, c DATE);
INSERT INTO t1 VALUES(
'2005-11-14 01:01:01', '2005-11-14 01:01:02', '2005-11-14');
**** On Slave ****
SELECT * FROM t1;
a b c
2005-11-14 01:01:01 2005-11-14 01:01:02 2005-11-14
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8;

View File

@@ -4,56 +4,18 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
create table t1 (a int not null primary key);
insert into t1 values (1);
create table t2 (a int);
insert into t2 values (1);
update t1, t2 set t1.a = 0 where t1.a = t2.a;
show tables;
Tables_in_test
t1
select * from t1;
a
0
drop table t1;
insert into t1 values (1);
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos 1153
Relay_Log_File #
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 1146
Last_Error Error 'Table 'test.t1' doesn't exist' on opening tables
Skip_Counter 0
Exec_Master_Log_Pos 941
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 1146
Last_SQL_Error Error 'Table 'test.t1' doesn't exist' on opening tables
drop table t1, t2;
==== Setup table on master but not on slave ====
[on master]
CREATE TABLE t1 (a INT);
[on slave]
DROP TABLE t1;
==== Modify table on master ====
[on master]
INSERT INTO t1 VALUES (1);
==== Verify error on slave ====
[on slave]
Last_SQL_Error = Error 'Table 'test.t1' doesn't exist' on opening tables
==== Clean up ====
STOP SLAVE;
[on master]
DROP TABLE t1;

View File

@@ -344,7 +344,7 @@ CREATE TABLE t10 (a INT, b VARCHAR(20)) ENGINE=myisam;
STOP SLAVE;
*** On Master ***
SET SESSION BINLOG_FORMAT=STATEMENT;
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/rpl_bug28618.dat' INTO TABLE t10 FIELDS TERMINATED BY '|';
LOAD DATA INFILE 'MYSQLTEST_VARDIR/std_data/rpl_bug28618.dat' INTO TABLE t10 FIELDS TERMINATED BY '|';
SELECT * FROM t10 ORDER BY a;
a b
1 master only

View File

@@ -4,59 +4,32 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
==== Create new replication user ====
[on master]
GRANT REPLICATION SLAVE ON *.* TO rpl@127.0.0.1 IDENTIFIED BY 'rpl';
[on slave]
STOP SLAVE;
CHANGE MASTER TO master_user='rpl',master_password='rpl';
CHANGE MASTER TO master_user='rpl', master_password='rpl';
START SLAVE;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (n int);
==== Do replication as new user ====
[on master]
CREATE TABLE t1 (n INT);
INSERT INTO t1 VALUES (1);
[on slave]
SELECT * FROM t1;
n
1
DELETE FROM mysql.user WHERE user='rpl';
==== Delete new replication user ====
[on master]
DROP USER rpl@127.0.0.1;
FLUSH PRIVILEGES;
[on slave]
==== Restart slave without privileges =====
STOP SLAVE;
START SLAVE;
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User rpl
Master_Port MASTER_MYPORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running No
Slave_SQL_Running Yes
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 #
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master NULL
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
==== Verify that Slave_IO_Running = No ====
Slave_IO_Running = No (should be No)
==== Cleanup (Note that slave IO thread is not running) ====
DROP TABLE t1;
DELETE FROM mysql.user WHERE user='rpl';
[on master]
DROP TABLE t1;

View File

@@ -12,4 +12,4 @@
rpl_redirect : Failure is sporadic and and the test is superfluous (mats)
rpl_innodb_bug28430 : Failure on Solaris Bug #36793
rpl_server_id1 : Bug #36818 rpl_server_id1 fails expecting slave has stopped (azundris)

View File

@@ -1 +0,0 @@
--replicate-ignore-table=test.t2

View File

@@ -1,33 +1,43 @@
# Test to see what slave says when master is updating a table it does
# not have
# ==== Purpose ====
#
# Verify that slave gives an error message if master updates a table
# that slave does not have.
#
# ==== Method ====
#
# Create a table on master, wait till it's on slave, remove it from
# slave. Then update the table on master.
--source include/have_binlog_format_row.inc
source include/master-slave.inc;
connection master;
create table t1 (a int not null primary key);
insert into t1 values (1);
create table t2 (a int);
insert into t2 values (1);
update t1, t2 set t1.a = 0 where t1.a = t2.a;
--echo ==== Setup table on master but not on slave ====
--echo [on master]
CREATE TABLE t1 (a INT);
--echo [on slave]
sync_slave_with_master;
# t2 should not have been replicated
# t1 should have been properly updated
show tables;
select * from t1;
drop table t1;
DROP TABLE t1;
--echo ==== Modify table on master ====
--echo [on master]
connection master;
insert into t1 values (1);
INSERT INTO t1 VALUES (1);
--echo ==== Verify error on slave ====
--echo [on slave]
connection slave;
# slave should have stopped because can't find table t1
--source include/wait_for_slave_sql_to_stop.inc
# see if we have a good error message:
--replace_column 7 #
source include/show_slave_status.inc;
let $err= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
--echo Last_SQL_Error = $err
# cleanup
--echo ==== Clean up ====
STOP SLAVE;
source include/wait_for_slave_to_stop.inc;
--echo [on master]
connection master;
drop table t1, t2;
DROP TABLE t1;

View File

@@ -10,6 +10,7 @@ reset master;
# replicate ourselves
stop slave;
source include/wait_for_slave_to_stop.inc;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval change master to master_port=$SLAVE_MYPORT;
start slave;

View File

@@ -286,10 +286,9 @@ source include/wait_for_slave_to_stop.inc;
--echo *** On Master ***
connection master;
SET SESSION BINLOG_FORMAT=STATEMENT;
exec cp ./suite/rpl/data/rpl_bug28618.dat $MYSQLTEST_VARDIR/tmp/;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/rpl_bug28618.dat' INTO TABLE t10 FIELDS TERMINATED BY '|';
remove_file $MYSQLTEST_VARDIR/tmp/rpl_bug28618.dat;
eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/std_data/rpl_bug28618.dat' INTO TABLE t10 FIELDS TERMINATED BY '|';
SELECT * FROM t10 ORDER BY a;

View File

@@ -1,62 +1,72 @@
############################################################################
# Test case for BUG#10780
# ==== Purpose ====
#
# REQUIREMENT
# A slave without replication privileges should have Slave_IO_Running = No
############################################################################
# Verify that a slave without replication privileges has
# Slave_IO_Running = No
#
# ==== Method ====
#
# We do the following steps:
# - Create a new replication user on master
# - Connect to slave and start replication as this user.
# - Verify that slave can replicate well, by creating a table and
# inserting a row into it.
# - Delete the user from the master.
# - Stop and start the slave (this should fail).
# - Check the Slave_IO_Running column of SHOW SLAVE STATUS.
#
# ==== Related bugs ====
#
# BUG#10780: slave can't connect to master - IO and SQL threads running
--source include/master-slave.inc
# 1. Create new replication user
--connection master
--echo ==== Create new replication user ====
--echo [on master]
connection master;
GRANT REPLICATION SLAVE ON *.* TO rpl@127.0.0.1 IDENTIFIED BY 'rpl';
--connection slave
--echo [on slave]
sync_slave_with_master;
STOP SLAVE;
--source include/wait_for_slave_to_stop.inc
CHANGE MASTER TO master_user='rpl',master_password='rpl';
source include/wait_for_slave_to_stop.inc;
CHANGE MASTER TO master_user='rpl', master_password='rpl';
START SLAVE;
--source include/wait_for_slave_to_start.inc
source include/wait_for_slave_to_start.inc;
# 2. Do replication as new user
--connection master
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1 (n int);
--echo ==== Do replication as new user ====
--echo [on master]
connection master;
CREATE TABLE t1 (n INT);
INSERT INTO t1 VALUES (1);
--sync_slave_with_master
--echo [on slave]
sync_slave_with_master;
SELECT * FROM t1;
# 3. Delete new replication user
--connection master
DELETE FROM mysql.user WHERE user='rpl';
--echo ==== Delete new replication user ====
--echo [on master]
connection master;
DROP USER rpl@127.0.0.1;
FLUSH PRIVILEGES;
--connection slave
# 4. Restart slave without privileges
--echo [on slave]
sync_slave_with_master;
--echo ==== Restart slave without privileges =====
# (slave.err will contain access denied error for this START SLAVE command)
STOP SLAVE;
--source include/wait_for_slave_to_stop.inc
source include/wait_for_slave_to_stop.inc;
START SLAVE;
--let $slave_param= Slave_SQL_Running
--let $slave_param_value= Yes
--source include/wait_for_slave_param.inc
source include/wait_for_slave_sql_to_start.inc;
# 5. Make sure Slave_IO_Running = No
--replace_result $MASTER_MYPORT MASTER_MYPORT
# Column 1 is replaced, since the output can be either
# "Connecting to master" or "Waiting for master update"
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 35 # 36 #
query_vertical SHOW SLAVE STATUS;
--echo ==== Verify that Slave_IO_Running = No ====
let $result= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, 1);
--echo Slave_IO_Running = $result (should be No)
# Cleanup (Note that slave IO thread is not running)
--connection slave
--echo ==== Cleanup (Note that slave IO thread is not running) ====
DROP TABLE t1;
DELETE FROM mysql.user WHERE user='rpl';
# cleanup: slave io thread has been stopped "irrecoverably"
# so we clean up mess manually
--connection master
--echo [on master]
connection master;
DROP TABLE t1;
# End of 4.1 tests