1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

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.
This commit is contained in:
Konstantin Osipov
2010-11-12 15:56:21 +03:00
parent 936bec8e2c
commit 4749b88494
10 changed files with 70 additions and 27 deletions

View File

@ -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 }
};