summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorunknown <davi@mysql.com/endora.local>2008-03-24 22:39:48 -0300
committerunknown <davi@mysql.com/endora.local>2008-03-24 22:39:48 -0300
commit33dde6ebfade2b9a8072058b20beaef501ca45bf (patch)
tree07b3a73f5082fb563d01d5537e1ff6107604d0f1 /tests
parent28cd75fec42e327950056617c7dea8ae4d2f6395 (diff)
downloadmariadb-git-33dde6ebfade2b9a8072058b20beaef501ca45bf.tar.gz
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.
Diffstat (limited to 'tests')
-rw-r--r--tests/mysql_client_test.c53
1 files changed, 42 insertions, 11 deletions
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index 02faf88a6e7..0df2d4ed4a5 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -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()
{
int rc;
@@ -15397,6 +15431,8 @@ static void test_bug17667()
return;
}
+ enable_general_log(1);
+
for (statement_cursor= statements; statement_cursor->buffer != NULL;
statement_cursor++)
{
@@ -15475,6 +15511,8 @@ static void test_bug17667()
statement_cursor->buffer);
}
+ restore_general_log();
+
if (!opt_silent)
printf("success. All queries found intact in the log.\n");
@@ -17301,14 +17339,7 @@ static void test_bug28386()
}
mysql_free_result(result);
- 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);
-
- rc= mysql_query(mysql, "truncate mysql.general_log");
- myquery(rc);
+ enable_general_log(1);
stmt= mysql_simple_prepare(mysql, "SELECT ?");
check_stmt(stmt);
@@ -17347,8 +17378,7 @@ static void test_bug28386()
mysql_free_result(result);
- rc= mysql_query(mysql, "set @@global.general_log=@save_global_general_log");
- myquery(rc);
+ restore_general_log();
DBUG_VOID_RETURN;
}
@@ -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[]= {
- { "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 },
{ "test_prepare_insert_update", test_prepare_insert_update},
#if NOT_YET_WORKING