summaryrefslogtreecommitdiffstats
path: root/storage/rocksdb/mysql-test/rocksdb_stress/include/rocksdb_stress.inc
blob: 3838987bf88440374d5e7d829b4bc0b3ab976e31 (plain)
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
# Run the load generator to populate the table and generate concurrent
# updates.  After the load generator is complete, verify the tables on the
# master and the slave are consistent

--sync_slave_with_master

--connection master
--let $master_host = 127.0.0.1
let $MYSQL_BASEDIR = `SELECT @@BASEDIR`;

let $exec =
  python
  $MYSQL_BASEDIR/storage/rocksdb/mysql-test/rocksdb_stress/t/load_generator.py \
  -L $MYSQL_TMP_DIR/load_generator.log -H $master_host -t $table \
  -P $MASTER_MYPORT -n $num_records -m $max_records \
  -l $num_loaders -c $num_checkers -r $num_requests \
  -E $MYSQLTEST_VARDIR/tmp/mysqld.1.expect \
  -D $reap_delay;

exec $exec;

enable_reconnect;
source include/wait_until_connected_again.inc;

--let $master_checksum = query_get_value(CHECKSUM TABLE $table, 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
--let $slave_checksum = query_get_value(CHECKSUM TABLE $table, Checksum, 1)

let $not_same = `SELECT $master_checksum-$slave_checksum`;
if ($not_same)
{
  --die "The checksums of table $table for the master and slave do not match!"
}

# Cleanup
--connection master
--let $cleanup = DROP TABLE $table
eval $cleanup;

# 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