Skip to content
This repository has been archived by the owner on Oct 11, 2018. It is now read-only.

Commit

Permalink
Add basic suite of innodb stress tests
Browse files Browse the repository at this point in the history
Summary:
Feature: Stress Tests

This is a port of all stress, bigstress, and hugestress tests to 5.6.

This is a complete port, except:

Removed all *_gc.test.  These tested a group commit mechanism that
is not in 5.6, and will never be ported to it.

This can stress test secondary indexes as well, but this is disabled.

Removed extra innodb_file_format_check.   It is no longer needed in 5.6.

Updated results files (partly with --record, partly manually).

Commit every 100 inserts while populating the tables.

Properly restart the master in innodb_stress.inc

Verify secondary index count after all stress test runs.

Removed use of vars we've not (yet) ported.  These included:
	innodb_zlib_wrap
	innodb_log_compressed_pages
	innodb_background_checkpoint
	innodb_prepare_commit_mutex
	innodb_prefix_index_cluster_optimization

Updated and verified changes to all results files.

Test Plan:
Ran all the non-huge tests, and one huge test, myself, so far so good.
Jenkins nightlies will start hammering these after this is pushed.

Reviewers: flamingcow, pivanof, jeremycole, andrew-ford, inaam-rana

Reviewed By: pivanof

CC: jtolmer, MarkCallaghan

Differential Revision: https://reviews.facebook.net/D15759
  • Loading branch information
steaphangreene committed Mar 25, 2014
1 parent bbda2dd commit 8b6adf6
Show file tree
Hide file tree
Showing 100 changed files with 2,363 additions and 1 deletion.
27 changes: 27 additions & 0 deletions mysql-test/include/wait_for_slave_to_sync_with_master.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#
# Similar to sync_slave_with_master but supports a configurable timeout
# let $slave_sync_timeout = 300;
# source include/wait_for_slave_to_sync_with_master;
#

connection slave;
stop slave;
start slave;

connection master;

let $file = query_get_value(SHOW MASTER STATUS, File, 1);
let $pos = query_get_value(SHOW MASTER STATUS, Position, 1);

connection slave;
--disable_result_log
--disable_query_log
eval select master_pos_wait("$file", $pos, $slave_sync_timeout);
--enable_result_log
--enable_query_log

connection master;
sync_slave_with_master;

connection master;

2 changes: 1 addition & 1 deletion mysql-test/mysql-test-run.pl
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ END

# If you add a new suite, please check TEST_DIRS in Makefile.am.
#
my $DEFAULT_SUITES= "main,sys_vars,binlog,federated,rpl,innodb,innodb_fts,innodb_zip,perfschema,funcs_1,opt_trace,parts,auth_sec";
my $DEFAULT_SUITES= "main,sys_vars,binlog,federated,rpl,innodb,innodb_fts,innodb_zip,perfschema,funcs_1,opt_trace,parts,auth_sec,innodb_stress";
my $opt_suites;

our $opt_verbose= 0; # Verbose output, enable with --verbose
Expand Down
164 changes: 164 additions & 0 deletions mysql-test/suite/innodb_stress/include/innodb_stress.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
# Populate a table with 1000 records. Allow the replica to sync with the master.
# Run concurrent threads that run OLTP transactions on master.
# Kill the master database server at random points.
# Check the table against the replica.
# Reinvoke the threads.

# create the directory for temporary log files.
--exec mkdir -p $MYSQL_TMP_DIR/load_generator

if ($fake_changes)
{
--exec mkdir -p $MYSQL_TMP_DIR/load_generator_slave
}

--connection master

# since this test generates lot of errors in log, suppress checking errors
call mtr.add_suppression(".*");

--sync_slave_with_master

--connection master
--let $pid_file = `SELECT @@pid_file`
--let $crash_num = 0
--let $master_host = 127.0.0.1
--let $table = test
--let $user = root
--let $checksum = 0
--let $secondary_index_checks = 0

if ($do_checksum)
{
# populate the table and store its checksum before any load.
let $exec =
python suite/innodb_stress/t/load_generator.py $pid_file $kill_db_after
$num_records 0 0 $user $master_host $MASTER_MYPORT
$table 0 $max_rows $MYSQL_TMP_DIR/load_generator 0 0 0;
exec $exec;
let $checksum=query_get_value(CHECKSUM TABLE t1, Checksum, 1);
# Master needs to be restarted to start with an empty buffer pool so
# that logical read ahead gets used.
let rpl_server_number = 1;
source include/rpl_restart_server.inc;
connection slave;
# Start slave to avoid I/O thread retry errors
disable_warnings;
source include/start_slave.inc;
enable_warnings;
let $num_records = 0;
}

while ($num_crashes)
{
connection master;
exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
if ($crash_num)
{
let $num_records = 0; # do not populate the table except for the first run.
}

if ($use_blob)
{
let $exec =
python suite/innodb_stress/t/load_generator.py $pid_file $kill_db_after
$num_records $num_workers $num_transactions $user $master_host $MASTER_MYPORT
$table 1 $max_rows $MYSQL_TMP_DIR/load_generator 0 $checksum $secondary_index_checks;
}
if (!$use_blob)
{
let $exec =
python suite/innodb_stress/t/load_generator.py $pid_file $kill_db_after
$num_records $num_workers $num_transactions $user $master_host $MASTER_MYPORT
$table 0 $max_rows $MYSQL_TMP_DIR/load_generator 0 $checksum $secondary_index_checks;
}

exec $exec;

if ($do_crash)
{
--echo Wait for 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;
connection slave;
source include/wait_until_connected_again.inc;
connection master;
}

--echo Checksum master
let $master_checksum = query_get_value(CHECKSUM TABLE t1, Checksum, 1);

# if sync_slave_with_master had a configurable timeout this would not be needed
let $slave_sync_timeout = 7200;
--source include/wait_for_slave_to_sync_with_master.inc

connection slave;
if ($fake_changes)
{
--echo applying fake updates to the slave
let $slave_pid_file = `SELECT @@pid_file`;
let $slave_exec =
python suite/innodb_stress/t/load_generator.py $slave_pid_file $kill_db_after
0 $num_workers $num_transactions $user $master_host $SLAVE_MYPORT
$table 0 $max_rows $MYSQL_TMP_DIR/load_generator_slave 1 $checksum $secondary_index_checks;
exec $slave_exec;
}
--echo Checksum slave
let $slave_checksum=query_get_value(CHECKSUM TABLE t1, Checksum, 1);
let $not_same = `SELECT $master_checksum-$slave_checksum`;
if ($not_same)
{
let $msg =
The checksums of table t1 for master and slave do not match for $crash_num th
crash. This may happen if there is a corrupt recovery log or a bug in crash
recovery. You can take a look at the logs in $MYSQL_TMP_DIR/load_generator to see the
queries issued before the crash.;
echo $msg;

connection master;
eval select * into outfile '$MYSQLTEST_VARDIR/tmp/master_all' from t1 order by id;
eval select id into outfile '$MYSQLTEST_VARDIR/tmp/master_id' from t1 order by id;
show master status;

connection slave;
eval select * into outfile '$MYSQLTEST_VARDIR/tmp/slave_all' from t1 order by id;
eval select id into outfile '$MYSQLTEST_VARDIR/tmp/slave_id' from t1 order by id;
show slave status;

die;
}
dec $num_crashes;
inc $crash_num;
}

# final cleanup
--connection master

let $primary=`select count(*) from t1 use index (primary)`;
let $secondary=`select count(*) from t1 use index (msg_i)`;
if ($primary != $secondary)
{
--echo Secondary index inconsistent! $primary != $secondary
--die
}

DROP TABLE t1;

# if sync_slave_with_master had a configurable timeout this would not be needed
let $slave_sync_timeout = 7200;
--source include/wait_for_slave_to_sync_with_master.inc

--connection slave
--source include/stop_slave.inc
# For stress tests sometimes the replication thread can not connect to master
# temporarily. This is either because the master crashed and it is recovering
# or the master is too busy and could not service the slave's requests.
# mtr's internal check requires that there be no errors in slave status.
# restarting replication clears the errors.
--source include/start_slave.inc
--source include/stop_slave.inc

connection master;

# --exec rm -rf $MYSQL_TMP_DIR/load_generator
26 changes: 26 additions & 0 deletions mysql-test/suite/innodb_stress/r/innodb_bigstress.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
include/master-slave.inc
Warnings:
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
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.
[connection master]
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY,
msg_prefix VARCHAR(255),
msg VARCHAR(255),
msg_length int,
msg_checksum varchar(128),
KEY msg_i(msg_prefix))
ENGINE=INNODB
ROW_FORMAT=COMPRESSED
KEY_BLOCK_SIZE=1;
call mtr.add_suppression(".*");
Checksum master
stop slave;
start slave;
Checksum slave
DROP TABLE t1;
stop slave;
start slave;
include/stop_slave.inc
include/start_slave.inc
include/stop_slave.inc
26 changes: 26 additions & 0 deletions mysql-test/suite/innodb_stress/r/innodb_bigstress_blob.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
include/master-slave.inc
Warnings:
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
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.
[connection master]
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY,
msg_prefix VARCHAR(255),
msg longtext,
msg_length int,
msg_checksum varchar(128),
KEY msg_i(msg_prefix))
ENGINE=INNODB
ROW_FORMAT=COMPRESSED
KEY_BLOCK_SIZE=1;
call mtr.add_suppression(".*");
Checksum master
stop slave;
start slave;
Checksum slave
DROP TABLE t1;
stop slave;
start slave;
include/stop_slave.inc
include/start_slave.inc
include/stop_slave.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
include/master-slave.inc
Warnings:
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
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.
[connection master]
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY,
msg_prefix VARCHAR(255),
msg longtext,
msg_length int,
msg_checksum varchar(128),
KEY msg_i(msg_prefix))
ENGINE=INNODB;
call mtr.add_suppression(".*");
Checksum master
stop slave;
start slave;
Checksum slave
DROP TABLE t1;
stop slave;
start slave;
include/stop_slave.inc
include/start_slave.inc
include/stop_slave.inc
32 changes: 32 additions & 0 deletions mysql-test/suite/innodb_stress/r/innodb_bigstress_crash.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
include/master-slave.inc
Warnings:
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
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.
[connection master]
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY,
msg_prefix VARCHAR(255),
msg VARCHAR(255),
msg_length int,
msg_checksum varchar(128),
KEY msg_i(msg_prefix))
ENGINE=INNODB
ROW_FORMAT=COMPRESSED
KEY_BLOCK_SIZE=1;
call mtr.add_suppression(".*");
Wait for reconnect
Checksum master
stop slave;
start slave;
Checksum slave
Wait for reconnect
Checksum master
stop slave;
start slave;
Checksum slave
DROP TABLE t1;
stop slave;
start slave;
include/stop_slave.inc
include/start_slave.inc
include/stop_slave.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
include/master-slave.inc
Warnings:
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
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.
[connection master]
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY,
msg_prefix VARCHAR(255),
msg longtext,
msg_length int,
msg_checksum varchar(128),
KEY msg_i(msg_prefix))
ENGINE=INNODB
ROW_FORMAT=COMPRESSED
KEY_BLOCK_SIZE=1;
call mtr.add_suppression(".*");
Wait for reconnect
Checksum master
stop slave;
start slave;
Checksum slave
Wait for reconnect
Checksum master
stop slave;
start slave;
Checksum slave
DROP TABLE t1;
stop slave;
start slave;
include/stop_slave.inc
include/start_slave.inc
include/stop_slave.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
include/master-slave.inc
Warnings:
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
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.
[connection master]
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY,
msg_prefix VARCHAR(255),
msg longtext,
msg_length int,
msg_checksum varchar(128),
KEY msg_i(msg_prefix))
ENGINE=INNODB;
call mtr.add_suppression(".*");
Wait for reconnect
Checksum master
stop slave;
start slave;
Checksum slave
Wait for reconnect
Checksum master
stop slave;
start slave;
Checksum slave
DROP TABLE t1;
stop slave;
start slave;
include/stop_slave.inc
include/start_slave.inc
include/stop_slave.inc
Loading

0 comments on commit 8b6adf6

Please sign in to comment.