File: rpl_stm_000001.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (156 lines) | stat: -rw-r--r-- 5,282 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# Requires binlog_format=statement format since query involving
# get_lock() is logged in row format if binlog_format=mixed or row.
-- source include/have_binlog_format_statement.inc
--source include/set_privilege_checks_user_as_system_user.inc
-- source include/master-slave.inc
-- source include/force_myisam_default.inc
-- source include/have_myisam.inc

CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
call mtr.add_suppression("The replica coordinator and worker threads are stopped, possibly leaving data in inconsistent state");

--let $engine_type= myisam

# Store the time of password_last_changed column from mysql.user table
# to restore it back later.
let $date_to_restore_root=`SELECT password_last_changed from mysql.user where host='localhost' and user='root'`;
let $date_to_restore_sys=`SELECT password_last_changed from mysql.user where host='localhost' and user='mysql.sys'`;

# Load some data into t1
create table t1 (word char(20) not null);
load data infile '../../std_data/words.dat' into table t1;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
eval load data local infile '$MYSQL_TEST_DIR/std_data/words.dat' into table t1;
select * from t1 limit 10;

#
# Test slave with wrong password
#
--source include/sync_slave_sql_with_master.inc
stop slave;
connection master;
set password for root@"localhost" = 'foo';
connection slave;
start slave;
connection master;
#
# Give slave time to do at last one failed connect retry
# This one must be short so that the slave will not stop retrying
sleep 2;
set password for root@"localhost" = '';
# Give slave time to connect (will retry every second)
sleep 2;

create table t3(n int);
insert into t3 values(1),(2);
--source include/sync_slave_sql_with_master.inc
select * from t3;
select sum(length(word)) from t1;
connection master;
drop table t1,t3;
--source include/sync_slave_sql_with_master.inc

# Test if the slave SQL thread can be more than 16K behind the slave
# I/O thread (> IO_SIZE)

connection master;
# we'll use table-level locking to delay slave SQL thread
eval create table t1 (n int) engine=$engine_type;
--source include/sync_slave_sql_with_master.inc
connection master;
reset master;
connection slave;
stop slave;
reset slave;

connection master;
let $1=100;
# Generate 16K of relay log
--let $pos= query_get_value(SHOW MASTER STATUS, Position, 1)
disable_query_log;
while ($1)
{
 eval insert into t1 values($1);
 dec $1;
}
enable_query_log;

--let $assert_text= We should have generated greater than 16 KB relay log
--let $assert_cond= [SHOW MASTER STATUS, Position, 1] - $pos > 16384
--source include/assert.inc

# Try to cause a large relay log lag on the slave by locking t1
connection slave;
lock tables t1 read;
start slave;
connection master;
--source include/sync_slave_io_with_master.inc
unlock tables;

#test handling of aborted connection in the middle of update

connection master;
create table t2(id int);
insert into t2 values(connection_id());

connection master1;
# Avoid generating result
create temporary table t3(n int);
--disable_warnings
insert into t3 select get_lock('crash_lock%20C', 1) from t2;
--enable_warnings

connection master;
send update t1 set n = n + if(n > 50, 1, get_lock('crash_lock%20C', 100));
connection master1;
let $wait_condition=
  select count(*) > 0 from information_schema.processlist
  where state = "User lock" and info like "update t1%";
--source include/wait_condition.inc
select (@id := id) - id from t2;
kill @id;
drop table t2;
drop temporary table if exists t3;
connection master;
# The get_lock function causes warning for unsafe statement.
--disable_warnings
--error 1317,2013
reap;
--enable_warnings
connection slave;
# The SQL slave thread should now have stopped because the query was killed on
# the master (so it has a non-zero error code in the binlog).
# The slave should report ER_ERROR_ON_SOURCE and the error message should 
# contain the actual error code received from master 1053 = ER_SERVER_SHUTDOWN
--let $slave_sql_errno= convert_error(ER_ERROR_ON_SOURCE)
###--source include/wait_for_slave_sql_error_and_skip.inc
--source include/wait_for_slave_sql_error.inc
SET GLOBAL SQL_REPLICA_SKIP_COUNTER=1;
source include/start_slave.inc;

select count(*) from t1;
connection master1;
drop table t1;
create table t1 (n int);
insert into t1 values(3456);
create user 'blafasel2'@'10.10.10.%' identified by 'blafasel2';
select select_priv,user from mysql.user where user = _binary'blafasel2';
update mysql.user set Select_priv = "Y" where User= _binary"blafasel2";
select select_priv,user from mysql.user where user = _binary'blafasel2';
--source include/sync_slave_sql_with_master.inc
select n from t1;
select select_priv,user from mysql.user where user = _binary'blafasel2';
connection master1;
drop table t1;
delete from mysql.user where user="blafasel2";

--disable_query_log ONCE
--eval UPDATE mysql.user SET password_last_changed = '$date_to_restore_root' WHERE user='root'
--disable_query_log ONCE
--eval UPDATE mysql.user SET password_last_changed = '$date_to_restore_sys' WHERE user='mysql.sys'
--echo # mysql.user table restored to original values.

--source include/sync_slave_sql_with_master.inc

# End of 4.1 tests
--source include/rpl_end.inc