Skip to content

Commit

Permalink
Merge pull request #1657 from laurynas-biveinis/bug1683993-5.5
Browse files Browse the repository at this point in the history
Fix bug 1683993 (Test main.rpl_slow_query_log is unstable)
  • Loading branch information
laurynas-biveinis authored Apr 20, 2017
2 parents 7723f8c + 20d7167 commit 83f0f82
Showing 1 changed file with 7 additions and 30 deletions.
37 changes: 7 additions & 30 deletions mysql-test/suite/rpl/t/rpl_slow_query_log.test
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@
# ii) On slave, set long_query_time to a small value.
# ii) start slave so that long_query_time variable is picked by sql thread
# iii) On master, do one short time query and one long time query, on slave
# and check that slow query is logged to slow query log but fast query
# is not.
# iv) On slave, check that slow queries go into the slow log and fast dont,
# when issued through a regular client connection
# v) On slave, check that slow queries go into the slow log and fast dont
# when we use SET TIMESTAMP= 1 on a regular client connection.
# and check that slow query is logged to slow query log
# iv) On slave, check that slow queries go into the slow log, when issued
# through a regular client connection
# v) On slave, check that slow queries go into the slow log when we use
# SET TIMESTAMP= 1 on a regular client connection.
# vi) check that when setting slow_query_log= OFF in a connection 'extra2'
# prevents logging slow queries in a connection 'extra'
#
Expand Down Expand Up @@ -53,7 +52,7 @@ connection master;
CREATE TABLE t1 (a int, b int);

# test:
# check that slave logs the slow query to the slow log, but not the fast one.
# check that slave logs the slow query to the slow log

let $slow_query= INSERT INTO t1 values(1, sleep(3));
let $fast_query= INSERT INTO t1 values(1, 1);
Expand All @@ -64,15 +63,8 @@ eval $slow_query;
--enable_warnings
sync_slave_with_master;

let $found_fast_query= `SELECT count(*) = 1 FROM mysql.slow_log WHERE sql_text like '$fast_query'`;
let $found_slow_query= `SELECT count(*) = 1 FROM mysql.slow_log WHERE sql_text like '$slow_query'`;

if ($found_fast_query)
{
SELECT * FROM mysql.slow_log;
die "Assertion failed! Fast query FOUND in slow query log. Bailing out!";
}

if (!$found_slow_query)
{
SELECT * FROM mysql.slow_log;
Expand All @@ -84,7 +76,6 @@ TRUNCATE mysql.slow_log;

# test:
# when using direct connections to the slave, check that slow query is logged
# but not the fast one.

connect(extra,127.0.0.1,root,,test,$SLAVE_MYPORT);
connection extra;
Expand All @@ -95,15 +86,8 @@ let $slow_query= SELECT 1, sleep(3);
eval $slow_query;
eval $fast_query;

let $found_fast_query= `SELECT count(*) = 1 FROM mysql.slow_log WHERE sql_text like '$fast_query'`;
let $found_slow_query= `SELECT count(*) = 1 FROM mysql.slow_log WHERE sql_text like '$slow_query'`;

if ($found_fast_query)
{
SELECT * FROM mysql.slow_log;
die "Assertion failed! Fast query FOUND in slow query log. Bailing out!";
}

if (!$found_slow_query)
{
SELECT * FROM mysql.slow_log;
Expand All @@ -113,7 +97,7 @@ TRUNCATE mysql.slow_log;

# test:
# when using direct connections to the slave, check that when setting timestamp to 1 the
# slow query is logged but the fast one is not.
# slow query is logged.

let $fast_query= SELECT 2;
let $slow_query= SELECT 2, sleep(3);
Expand All @@ -122,15 +106,8 @@ SET TIMESTAMP= 1;
eval $slow_query;
eval $fast_query;

let $found_fast_query= `SELECT count(*) = 1 FROM mysql.slow_log WHERE sql_text like '$fast_query'`;
let $found_slow_query= `SELECT count(*) = 1 FROM mysql.slow_log WHERE sql_text like '$slow_query'`;

if ($found_fast_query)
{
SELECT * FROM mysql.slow_log;
die "Assertion failed! Fast query FOUND in slow query log. Bailing out!";
}

if (!$found_slow_query)
{
SELECT * FROM mysql.slow_log;
Expand Down

0 comments on commit 83f0f82

Please sign in to comment.