Commit 76f14be1 authored by Monty's avatar Monty

Ensure that tests and programs can restore variables

- --default-character-set can now be disabled in mysqldump
- --skip-resolve can be be disabled in mysqld
- mysql_client_test now resets global variables it changes
- mtr couldn't handle [mysqldump] in config files (wrong regexp used)
parent 2d89a70f
...@@ -967,6 +967,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -967,6 +967,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
exit(1); exit(1);
} }
break; break;
case (int) OPT_DEFAULT_CHARSET:
if (default_charset == disabled_my_option)
default_charset= (char *)mysql_universal_client_charset;
break;
} }
return 0; return 0;
} }
......
...@@ -311,7 +311,7 @@ sub post_check_client_groups { ...@@ -311,7 +311,7 @@ sub post_check_client_groups {
$first_mysqld->name()); $first_mysqld->name());
# Then generate [client.<suffix>] for each [mysqld.<suffix>] # Then generate [client.<suffix>] for each [mysqld.<suffix>]
foreach my $mysqld ( $config->like('mysqld.') ) { foreach my $mysqld ( $config->like('mysqld\.') ) {
$self->post_check_client_group($config, $self->post_check_client_group($config,
'client'.$mysqld->after('mysqld'), 'client'.$mysqld->after('mysqld'),
$mysqld->name()) $mysqld->name())
...@@ -333,7 +333,7 @@ sub post_check_embedded_group { ...@@ -333,7 +333,7 @@ sub post_check_embedded_group {
my $mysqld= $config->group('mysqld') or my $mysqld= $config->group('mysqld') or
croak "Can't run with embedded, config has no default mysqld section"; croak "Can't run with embedded, config has no default mysqld section";
my $first_mysqld= $config->first_like('mysqld.') or my $first_mysqld= $config->first_like('mysqld\.') or
croak "Can't run with embedded, config has no mysqld"; croak "Can't run with embedded, config has no mysqld";
my %no_copy = map { $_ => 1 } my %no_copy = map { $_ => 1 }
...@@ -457,7 +457,7 @@ sub new_config { ...@@ -457,7 +457,7 @@ sub new_config {
} }
$self->run_section_rules($config, $self->run_section_rules($config,
'mysqld.', 'mysqld\.',
@mysqld_rules); @mysqld_rules);
# [mysqlbinlog] need additional settings # [mysqlbinlog] need additional settings
......
...@@ -9254,8 +9254,10 @@ mysqld_get_one_option(int optid, const struct my_option *opt, char *argument) ...@@ -9254,8 +9254,10 @@ mysqld_get_one_option(int optid, const struct my_option *opt, char *argument)
opt_specialflag|= SPECIAL_NO_HOST_CACHE; opt_specialflag|= SPECIAL_NO_HOST_CACHE;
break; break;
case (int) OPT_SKIP_RESOLVE: case (int) OPT_SKIP_RESOLVE:
opt_skip_name_resolve= 1; if ((opt_skip_name_resolve= (argument != disabled_my_option)))
opt_specialflag|=SPECIAL_NO_RESOLVE; opt_specialflag|= SPECIAL_NO_RESOLVE;
else
opt_specialflag&= ~SPECIAL_NO_RESOLVE;
break; break;
case (int) OPT_WANT_CORE: case (int) OPT_WANT_CORE:
test_flags |= TEST_CORE_ON_SIGNAL; test_flags |= TEST_CORE_ON_SIGNAL;
......
...@@ -2341,6 +2341,12 @@ static void test_ps_query_cache() ...@@ -2341,6 +2341,12 @@ static void test_ps_query_cache()
"(2, 'hh', 'hh'), (1, 'ii', 'ii'), (2, 'ii', 'ii')"); "(2, 'hh', 'hh'), (1, 'ii', 'ii'), (2, 'ii', 'ii')");
myquery(rc); myquery(rc);
rc= mysql_query(mysql,
"set @save_query_cache_type="
"@@global.query_cache_type,"
"@save_query_cache_size="
"@@global.query_cache_size");
myquery(rc);
rc= mysql_query(lmysql, "set global query_cache_type=ON"); rc= mysql_query(lmysql, "set global query_cache_type=ON");
myquery(rc); myquery(rc);
rc= mysql_query(lmysql, "set local query_cache_type=ON"); rc= mysql_query(lmysql, "set local query_cache_type=ON");
...@@ -2497,9 +2503,9 @@ static void test_ps_query_cache() ...@@ -2497,9 +2503,9 @@ static void test_ps_query_cache()
if (lmysql != mysql) if (lmysql != mysql)
mysql_close(lmysql); mysql_close(lmysql);
rc= mysql_query(mysql, "set global query_cache_size=default"); rc= mysql_query(mysql, "set global query_cache_size=@save_query_cache_size");
myquery(rc); myquery(rc);
rc= mysql_query(mysql, "set global query_cache_type=default"); rc= mysql_query(mysql, "set global query_cache_type=@save_query_cache_type");
myquery(rc); myquery(rc);
} }
...@@ -13364,6 +13370,12 @@ static void test_open_cursor_prepared_statement_query_cache() ...@@ -13364,6 +13370,12 @@ static void test_open_cursor_prepared_statement_query_cache()
return; return;
} }
rc= mysql_query(mysql,
"set @save_query_cache_type="
"@@global.query_cache_type,"
"@save_query_cache_size="
"@@global.query_cache_size");
myquery(rc);
rc= mysql_query(mysql, "set global query_cache_type=ON"); rc= mysql_query(mysql, "set global query_cache_type=ON");
myquery(rc); myquery(rc);
rc= mysql_query(mysql, "set local query_cache_type=ON"); rc= mysql_query(mysql, "set local query_cache_type=ON");
...@@ -13390,9 +13402,9 @@ static void test_open_cursor_prepared_statement_query_cache() ...@@ -13390,9 +13402,9 @@ static void test_open_cursor_prepared_statement_query_cache()
check_execute(stmt, rc); check_execute(stmt, rc);
mysql_stmt_close(stmt); mysql_stmt_close(stmt);
rc= mysql_query(mysql, "set global query_cache_type=default"); rc= mysql_query(mysql, "set global query_cache_type=@save_query_cache_type");
myquery(rc); myquery(rc);
rc= mysql_query(mysql, "set global query_cache_size=default"); rc= mysql_query(mysql, "set global query_cache_size=@save_query_cache_size");
myquery(rc); myquery(rc);
} }
...@@ -18177,6 +18189,12 @@ static void test_bug36326() ...@@ -18177,6 +18189,12 @@ static void test_bug36326()
myquery(rc); myquery(rc);
rc= mysql_query(mysql, "INSERT INTO t1 VALUES (1)"); rc= mysql_query(mysql, "INSERT INTO t1 VALUES (1)");
myquery(rc); myquery(rc);
rc= mysql_query(mysql,
"set @save_query_cache_type="
"@@global.query_cache_type,"
"@save_query_cache_size="
"@@global.query_cache_size");
myquery(rc);
rc= mysql_query(mysql, "SET GLOBAL query_cache_type = 1"); rc= mysql_query(mysql, "SET GLOBAL query_cache_type = 1");
myquery(rc); myquery(rc);
rc= mysql_query(mysql, "SET LOCAL query_cache_type = 1"); rc= mysql_query(mysql, "SET LOCAL query_cache_type = 1");
...@@ -18204,8 +18222,8 @@ static void test_bug36326() ...@@ -18204,8 +18222,8 @@ static void test_bug36326()
DIE_UNLESS(rc == 1); DIE_UNLESS(rc == 1);
rc= mysql_query(mysql, "DROP TABLE t1"); rc= mysql_query(mysql, "DROP TABLE t1");
myquery(rc); myquery(rc);
rc= mysql_query(mysql, "SET GLOBAL query_cache_size = default"); rc= mysql_query(mysql, "SET GLOBAL query_cache_size = @save_query_cache_size");
rc= mysql_query(mysql, "SET GLOBAL query_cache_type = default"); rc= mysql_query(mysql, "SET GLOBAL query_cache_type = @save_query_cache_type");
myquery(rc); myquery(rc);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
......
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