Commit 33dde6eb authored by unknown's avatar unknown

Patch for bug 28386 enabled table logging for all tests in

mysql_client_test causing a severe slowdown and increase
in memory usage, especially for test cases with long queries.

The solution is to enable the general log only in tests that
actually need the general log and disable it during the
execution of all other tests.


tests/mysql_client_test.c:
  Selectively enable and disable the general log.
parent 28cd75fe
...@@ -13233,6 +13233,40 @@ static void test_bug15518() ...@@ -13233,6 +13233,40 @@ static void test_bug15518()
} }
static void disable_general_log()
{
int rc;
rc= mysql_query(mysql, "set @@global.general_log=off");
myquery(rc);
}
static void enable_general_log(int truncate)
{
int rc;
rc= mysql_query(mysql, "set @save_global_general_log=@@global.general_log");
myquery(rc);
rc= mysql_query(mysql, "set @@global.general_log=on");
myquery(rc);
if (truncate)
{
rc= mysql_query(mysql, "truncate mysql.general_log");
myquery(rc);
}
}
static void restore_general_log()
{
int rc;
rc= mysql_query(mysql, "set @@global.general_log=@save_global_general_log");
myquery(rc);
}
static void test_view_sp_list_fields() static void test_view_sp_list_fields()
{ {
int rc; int rc;
...@@ -15397,6 +15431,8 @@ static void test_bug17667() ...@@ -15397,6 +15431,8 @@ static void test_bug17667()
return; return;
} }
enable_general_log(1);
for (statement_cursor= statements; statement_cursor->buffer != NULL; for (statement_cursor= statements; statement_cursor->buffer != NULL;
statement_cursor++) statement_cursor++)
{ {
...@@ -15475,6 +15511,8 @@ static void test_bug17667() ...@@ -15475,6 +15511,8 @@ static void test_bug17667()
statement_cursor->buffer); statement_cursor->buffer);
} }
restore_general_log();
if (!opt_silent) if (!opt_silent)
printf("success. All queries found intact in the log.\n"); printf("success. All queries found intact in the log.\n");
...@@ -17301,14 +17339,7 @@ static void test_bug28386() ...@@ -17301,14 +17339,7 @@ static void test_bug28386()
} }
mysql_free_result(result); mysql_free_result(result);
rc= mysql_query(mysql, "set @save_global_general_log=@@global.general_log"); enable_general_log(1);
myquery(rc);
rc= mysql_query(mysql, "set @@global.general_log=on");
myquery(rc);
rc= mysql_query(mysql, "truncate mysql.general_log");
myquery(rc);
stmt= mysql_simple_prepare(mysql, "SELECT ?"); stmt= mysql_simple_prepare(mysql, "SELECT ?");
check_stmt(stmt); check_stmt(stmt);
...@@ -17347,8 +17378,7 @@ static void test_bug28386() ...@@ -17347,8 +17378,7 @@ static void test_bug28386()
mysql_free_result(result); mysql_free_result(result);
rc= mysql_query(mysql, "set @@global.general_log=@save_global_general_log"); restore_general_log();
myquery(rc);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -17429,7 +17459,8 @@ and you are welcome to modify and redistribute it under the GPL license\n"); ...@@ -17429,7 +17459,8 @@ and you are welcome to modify and redistribute it under the GPL license\n");
static struct my_tests_st my_tests[]= { static struct my_tests_st my_tests[]= {
{ "test_view_sp_list_fields", test_view_sp_list_fields}, { "disable_general_log", disable_general_log },
{ "test_view_sp_list_fields", test_view_sp_list_fields },
{ "client_query", client_query }, { "client_query", client_query },
{ "test_prepare_insert_update", test_prepare_insert_update}, { "test_prepare_insert_update", test_prepare_insert_update},
#if NOT_YET_WORKING #if NOT_YET_WORKING
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment