diff options
author | Konstantin Osipov <kostja@sun.com> | 2010-11-12 15:56:21 +0300 |
---|---|---|
committer | Konstantin Osipov <kostja@sun.com> | 2010-11-12 15:56:21 +0300 |
commit | 4749b884942f464febbb8221b4a73f5b85e98090 (patch) | |
tree | 47b1a5ab7416e5cc83776aa9a0543a058f35d724 /tests | |
parent | 936bec8e2cf0362e0cf8902ab1f7ea8141b880cc (diff) | |
download | mariadb-git-4749b884942f464febbb8221b4a73f5b85e98090.tar.gz |
Implement a fix for Bug#57058 -- send SERVER_QUERY_WAS_SLOW over
network when a query was slow.
When a query is slow, sent a special flag to the client
indicating this fact.
Add a test case.
Implement review comments.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/mysql_client_test.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index b85a6c587e4..3d709720727 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -19061,7 +19061,7 @@ static void test_bug49972() my_bool is_null; DBUG_ENTER("test_bug49972"); - myheader("test_49972"); + myheader("test_bug49972"); rc= mysql_query(mysql, "DROP FUNCTION IF EXISTS f1"); myquery(rc); @@ -19148,6 +19148,45 @@ static void test_bug49972() DBUG_VOID_RETURN; } + +/** + Bug#57058 SERVER_QUERY_WAS_SLOW not wired up. +*/ + +static void test_bug57058() +{ + MYSQL_RES *res; + int rc; + + DBUG_ENTER("test_bug57058"); + myheader("test_bug57058"); + + rc= mysql_query(mysql, "set @@session.long_query_time=0.1"); + myquery(rc); + + DIE_UNLESS(!(mysql->server_status & SERVER_QUERY_WAS_SLOW)); + + rc= mysql_query(mysql, "select sleep(1)"); + myquery(rc); + + /* + Important: the flag is sent in the last EOF packet of + the query, the one which ends the result. Read the + result to see the "slow" status. + */ + res= mysql_store_result(mysql); + + DIE_UNLESS(mysql->server_status & SERVER_QUERY_WAS_SLOW); + + mysql_free_result(res); + + rc= mysql_query(mysql, "set @@session.long_query_time=default"); + myquery(rc); + + DBUG_VOID_RETURN; +} + + /* Read and parse arguments and MySQL options from my.cnf */ @@ -19481,6 +19520,7 @@ static struct my_tests_st my_tests[]= { { "test_bug42373", test_bug42373 }, { "test_bug54041", test_bug54041 }, { "test_bug47485", test_bug47485 }, + { "test_bug57058", test_bug57058 }, { 0, 0 } }; |