Skip to content

Commit 1347d35

Browse files
author
viswanatham
committed
A new testcases Innodb stress are being added
1 parent 13a93f9 commit 1347d35

100 files changed

Lines changed: 2529 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#
2+
# Similar to sync_slave_with_master but supports a configurable timeout
3+
# let $slave_sync_timeout = 300;
4+
# source include/wait_for_slave_to_sync_with_master;
5+
#
6+
7+
connection slave;
8+
stop slave;
9+
start slave;
10+
11+
connection master;
12+
13+
let $file = query_get_value(SHOW MASTER STATUS, File, 1);
14+
let $pos = query_get_value(SHOW MASTER STATUS, Position, 1);
15+
16+
connection slave;
17+
--disable_result_log
18+
--disable_query_log
19+
eval select master_pos_wait("$file", $pos, $slave_sync_timeout);
20+
--enable_result_log
21+
--enable_query_log
22+
23+
connection master;
24+
sync_slave_with_master;
25+
26+
connection master;
27+
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
# Populate a table with 1000 records. Allow the replica to sync with the master.
2+
# Run concurrent threads that run OLTP transactions on master.
3+
# Kill the master database server at random points.
4+
# Check the table against the replica.
5+
# Reinvoke the threads.
6+
7+
8+
--connection master
9+
#--let $innodb_index_cluster_optimization_save_master = `SELECT @@innodb_prefix_index_cluster_optimization`
10+
11+
--connection slave
12+
#--let $innodb_index_cluster_optimization_save_slave = `SELECT @@innodb_prefix_index_cluster_optimization`
13+
14+
# create the directory for temporary log files.
15+
--exec mkdir -p $MYSQL_TMP_DIR/load_generator
16+
17+
if ($fake_changes)
18+
{
19+
--exec mkdir -p $MYSQL_TMP_DIR/load_generator_slave
20+
}
21+
22+
--connection master
23+
24+
# since this test generates lot of errors in log, suppress checking errors
25+
call mtr.add_suppression(".*");
26+
27+
--sync_slave_with_master
28+
29+
--connection master
30+
--let $pid_file = `SELECT @@pid_file`
31+
--let $crash_num = 0
32+
--let $master_host = 127.0.0.1
33+
--let $table = test
34+
--let $user = root
35+
--let $checksum = 0
36+
--let $secondary_index_checks = 0
37+
38+
if ($do_checksum)
39+
{
40+
# populate the table and store its checksum before any load.
41+
let $exec =
42+
python $MYSQL_BASEDIR/mysql-test/suite/innodb_stress/t/load_generator.py $pid_file $kill_db_after
43+
$num_records 0 0 $user $master_host $MASTER_MYPORT
44+
$table 0 $max_rows $MYSQL_TMP_DIR/load_generator 0 0 0;
45+
exec $exec;
46+
let $checksum=query_get_value(CHECKSUM TABLE t1, Checksum, 1);
47+
# Master needs to be restarted to start with an empty buffer pool so
48+
# that logical read ahead gets used.
49+
let rpl_server_number = 1;
50+
source include/rpl_restart_server.inc;
51+
connection slave;
52+
# Start slave to avoid I/O thread retry errors
53+
disable_warnings;
54+
source include/start_slave.inc;
55+
enable_warnings;
56+
let $num_records = 0;
57+
}
58+
59+
while ($num_crashes)
60+
{
61+
connection master;
62+
exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
63+
if ($crash_num)
64+
{
65+
let $num_records = 0; # do not populate the table except for the first run.
66+
}
67+
68+
if ($use_blob)
69+
{
70+
let $exec =
71+
python $MYSQL_BASEDIR/mysql-test/suite/innodb_stress/t/load_generator.py $pid_file $kill_db_after
72+
$num_records $num_workers $num_transactions $user $master_host $MASTER_MYPORT
73+
$table 1 $max_rows $MYSQL_TMP_DIR/load_generator 0 $checksum $secondary_index_checks;
74+
}
75+
if (!$use_blob)
76+
{
77+
let $exec =
78+
python $MYSQL_BASEDIR/mysql-test/suite/innodb_stress/t/load_generator.py $pid_file $kill_db_after
79+
$num_records $num_workers $num_transactions $user $master_host $MASTER_MYPORT
80+
$table 0 $max_rows $MYSQL_TMP_DIR/load_generator 0 $checksum $secondary_index_checks;
81+
}
82+
83+
exec $exec;
84+
85+
if ($do_crash)
86+
{
87+
--echo Wait for reconnect
88+
enable_reconnect;
89+
# Call script that will poll the server waiting for it to be back online again
90+
source include/wait_until_connected_again.inc;
91+
connection slave;
92+
source include/wait_until_connected_again.inc;
93+
connection master;
94+
}
95+
96+
--echo Checksum master
97+
let $master_checksum = query_get_value(CHECKSUM TABLE t1, Checksum, 1);
98+
99+
# if sync_slave_with_master had a configurable timeout this would not be needed
100+
let $slave_sync_timeout = 7200;
101+
--source include/wait_for_slave_to_sync_with_master.inc
102+
103+
connection slave;
104+
if ($fake_changes)
105+
{
106+
--echo applying fake updates to the slave
107+
let $slave_pid_file = `SELECT @@pid_file`;
108+
let $slave_exec =
109+
python $MYSQL_BASEDIR/mysql-test/suite/innodb_stress/t/load_generator.py $slave_pid_file $kill_db_after
110+
0 $num_workers $num_transactions $user $master_host $SLAVE_MYPORT
111+
$table 0 $max_rows $MYSQL_TMP_DIR/load_generator_slave 1 $checksum $secondary_index_checks;
112+
exec $slave_exec;
113+
}
114+
--echo Checksum slave
115+
let $slave_checksum=query_get_value(CHECKSUM TABLE t1, Checksum, 1);
116+
let $not_same = `SELECT $master_checksum-$slave_checksum`;
117+
if ($not_same)
118+
{
119+
let $msg =
120+
The checksums of table t1 for master and slave do not match for $crash_num th
121+
crash. This may happen if there is a corrupt recovery log or a bug in crash
122+
recovery. You can take a look at the logs in $MYSQL_TMP_DIR/load_generator to see the
123+
queries issued before the crash.;
124+
echo $msg;
125+
126+
connection master;
127+
eval select * into outfile '$MYSQLTEST_VARDIR/tmp/master_all' from t1 order by id;
128+
eval select id into outfile '$MYSQLTEST_VARDIR/tmp/master_id' from t1 order by id;
129+
show master status;
130+
131+
connection slave;
132+
eval select * into outfile '$MYSQLTEST_VARDIR/tmp/slave_all' from t1 order by id;
133+
eval select id into outfile '$MYSQLTEST_VARDIR/tmp/slave_id' from t1 order by id;
134+
show slave status;
135+
136+
die;
137+
}
138+
dec $num_crashes;
139+
inc $crash_num;
140+
}
141+
142+
# final cleanup
143+
--connection master
144+
145+
let $primary=`select count(*) from t1 use index (primary)`;
146+
let $secondary=`select count(*) from t1 use index (msg_i)`;
147+
if ($primary != $secondary)
148+
{
149+
--echo Secondary index inconsistent! $primary != $secondary
150+
--die
151+
}
152+
153+
DROP TABLE t1;
154+
155+
# if sync_slave_with_master had a configurable timeout this would not be needed
156+
let $slave_sync_timeout = 7200;
157+
--source include/wait_for_slave_to_sync_with_master.inc
158+
159+
--connection slave
160+
--source include/stop_slave.inc
161+
# For stress tests sometimes the replication thread can not connect to master
162+
# temporarily. This is either because the master crashed and it is recovering
163+
# or the master is too busy and could not service the slave's requests.
164+
# mtr's internal check requires that there be no errors in slave status.
165+
# restarting replication clears the errors.
166+
--source include/start_slave.inc
167+
--source include/stop_slave.inc
168+
169+
connection master;
170+
171+
# --exec rm -rf $MYSQL_TMP_DIR/load_generator
172+
173+
--connection slave
174+
# Restore the value of variable on slave
175+
--disable_query_log
176+
#eval SET GLOBAL innodb_prefix_index_cluster_optimization = $innodb_index_cluster_optimization_save_slave;
177+
--enable_query_log
178+
179+
--connection master
180+
# Restore the value of variable on master
181+
--disable_query_log
182+
#eval SET GLOBAL innodb_prefix_index_cluster_optimization = $innodb_index_cluster_optimization_save_master;
183+
--enable_query_log
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
include/master-slave.inc
2+
Warnings:
3+
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
4+
Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
5+
[connection master]
6+
SET GLOBAL innodb_file_format=Barracuda;
7+
DROP TABLE IF EXISTS t1;
8+
CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY,
9+
msg_prefix VARCHAR(255),
10+
msg VARCHAR(255),
11+
msg_length int,
12+
msg_checksum varchar(128),
13+
KEY msg_i(msg_prefix))
14+
ENGINE=INNODB
15+
ROW_FORMAT=COMPRESSED
16+
KEY_BLOCK_SIZE=1;
17+
call mtr.add_suppression(".*");
18+
Checksum master
19+
stop slave;
20+
start slave;
21+
Checksum slave
22+
DROP TABLE t1;
23+
stop slave;
24+
start slave;
25+
include/stop_slave.inc
26+
include/start_slave.inc
27+
include/stop_slave.inc
28+
SET GLOBAL innodb_file_format=Default;
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
include/master-slave.inc
2+
Warnings:
3+
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
4+
Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
5+
[connection master]
6+
SET GLOBAL innodb_file_format=Barracuda;
7+
DROP TABLE IF EXISTS t1;
8+
CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY,
9+
msg_prefix VARCHAR(255),
10+
msg longtext,
11+
msg_length int,
12+
msg_checksum varchar(128),
13+
KEY msg_i(msg_prefix))
14+
ENGINE=INNODB
15+
ROW_FORMAT=COMPRESSED
16+
KEY_BLOCK_SIZE=1;
17+
call mtr.add_suppression(".*");
18+
Checksum master
19+
stop slave;
20+
start slave;
21+
Checksum slave
22+
DROP TABLE t1;
23+
stop slave;
24+
start slave;
25+
include/stop_slave.inc
26+
include/start_slave.inc
27+
include/stop_slave.inc
28+
SET GLOBAL innodb_file_format=Default;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
include/master-slave.inc
2+
Warnings:
3+
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
4+
Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
5+
[connection master]
6+
SET GLOBAL innodb_file_format=Barracuda;
7+
DROP TABLE IF EXISTS t1;
8+
CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY,
9+
msg_prefix VARCHAR(255),
10+
msg longtext,
11+
msg_length int,
12+
msg_checksum varchar(128),
13+
KEY msg_i(msg_prefix))
14+
ENGINE=INNODB;
15+
call mtr.add_suppression(".*");
16+
Checksum master
17+
stop slave;
18+
start slave;
19+
Checksum slave
20+
DROP TABLE t1;
21+
stop slave;
22+
start slave;
23+
include/stop_slave.inc
24+
include/start_slave.inc
25+
include/stop_slave.inc
26+
SET GLOBAL innodb_file_format=Default;
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
include/master-slave.inc
2+
Warnings:
3+
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
4+
Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
5+
[connection master]
6+
SET GLOBAL innodb_file_format=Barracuda;
7+
DROP TABLE IF EXISTS t1;
8+
CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY,
9+
msg_prefix VARCHAR(255),
10+
msg VARCHAR(255),
11+
msg_length int,
12+
msg_checksum varchar(128),
13+
KEY msg_i(msg_prefix))
14+
ENGINE=INNODB
15+
ROW_FORMAT=COMPRESSED
16+
KEY_BLOCK_SIZE=1;
17+
call mtr.add_suppression(".*");
18+
Wait for reconnect
19+
Checksum master
20+
stop slave;
21+
start slave;
22+
Checksum slave
23+
Wait for reconnect
24+
Checksum master
25+
stop slave;
26+
start slave;
27+
Checksum slave
28+
DROP TABLE t1;
29+
stop slave;
30+
start slave;
31+
include/stop_slave.inc
32+
include/start_slave.inc
33+
include/stop_slave.inc
34+
SET GLOBAL innodb_file_format=Default;
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
include/master-slave.inc
2+
Warnings:
3+
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
4+
Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
5+
[connection master]
6+
SET GLOBAL innodb_file_format=Barracuda;
7+
DROP TABLE IF EXISTS t1;
8+
CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY,
9+
msg_prefix VARCHAR(255),
10+
msg longtext,
11+
msg_length int,
12+
msg_checksum varchar(128),
13+
KEY msg_i(msg_prefix))
14+
ENGINE=INNODB
15+
ROW_FORMAT=COMPRESSED
16+
KEY_BLOCK_SIZE=1;
17+
call mtr.add_suppression(".*");
18+
Wait for reconnect
19+
Checksum master
20+
stop slave;
21+
start slave;
22+
Checksum slave
23+
Wait for reconnect
24+
Checksum master
25+
stop slave;
26+
start slave;
27+
Checksum slave
28+
DROP TABLE t1;
29+
stop slave;
30+
start slave;
31+
include/stop_slave.inc
32+
include/start_slave.inc
33+
include/stop_slave.inc
34+
SET GLOBAL innodb_file_format=Default;
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
include/master-slave.inc
2+
Warnings:
3+
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
4+
Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
5+
[connection master]
6+
SET GLOBAL innodb_file_format=Barracuda;
7+
DROP TABLE IF EXISTS t1;
8+
CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY,
9+
msg_prefix VARCHAR(255),
10+
msg longtext,
11+
msg_length int,
12+
msg_checksum varchar(128),
13+
KEY msg_i(msg_prefix))
14+
ENGINE=INNODB;
15+
call mtr.add_suppression(".*");
16+
Wait for reconnect
17+
Checksum master
18+
stop slave;
19+
start slave;
20+
Checksum slave
21+
Wait for reconnect
22+
Checksum master
23+
stop slave;
24+
start slave;
25+
Checksum slave
26+
DROP TABLE t1;
27+
stop slave;
28+
start slave;
29+
include/stop_slave.inc
30+
include/start_slave.inc
31+
include/stop_slave.inc
32+
SET GLOBAL innodb_file_format=Default;

0 commit comments

Comments
 (0)