summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2011-07-11 20:33:39 +0200
committerSergei Golubchik <sergii@pisem.net>2011-07-11 20:33:39 +0200
commit20056897002575c3e81b7ce08b171cadc906bebc (patch)
treecb18f8724ef53af207bd0d7d826ea8ed02b8d796
parente44fefc7b395279b9682321f952490ab9d1d01f0 (diff)
downloadmariadb-git-20056897002575c3e81b7ce08b171cadc906bebc.tar.gz
sys_vars changes and cleanups
-rw-r--r--sql/mysqld.cc6
-rw-r--r--sql/scheduler.cc4
-rw-r--r--sql/set_var.cc8
-rw-r--r--sql/set_var.h9
-rw-r--r--sql/sql_plugin.cc2
-rw-r--r--sql/sys_vars.cc124
-rw-r--r--sql/sys_vars.h76
7 files changed, 91 insertions, 138 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 3d586a7b0ae..e1b52a300f1 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -6180,6 +6180,10 @@ struct my_option my_long_options[]=
option if compiled with valgrind support.
*/
IF_VALGRIND(0,1), 0, 0, 0, 0, 0},
+ {"sync_sys", 0,
+ "Enable/disable system sync calls. Should only be turned off when running "
+ "tests or debugging!!",
+ &opt_sync, &opt_sync, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"sysdate-is-now", 0,
"Non-default option to alias SYSDATE() to NOW() to make it safe-replicable. "
"Since 5.0, SYSDATE() returns a `dynamic' value different for different "
@@ -7496,7 +7500,7 @@ static int get_options(int *argc_ptr, char ***argv_ptr)
opt < my_long_options + array_elements(my_long_options) - 1;
opt++)
insert_dynamic(&all_options, (uchar*) opt);
- sys_var_add_options(&all_options, sys_var::PARSE_NORMAL);
+ sys_var_add_options(&all_options, 0);
add_terminator(&all_options);
/* Skip unknown options so that they may be processed later by plugins */
diff --git a/sql/scheduler.cc b/sql/scheduler.cc
index df1fc68dddc..43d80137bac 100644
--- a/sql/scheduler.cc
+++ b/sql/scheduler.cc
@@ -60,13 +60,13 @@ static void scheduler_wait_lock_end(void) {
static void scheduler_wait_sync_begin(void) {
THD *thd=current_thd;
- scheduler_functions *func= thd->scheduler;
+ scheduler_functions *func= thd ? thd->scheduler : thread_scheduler;
MYSQL_CALLBACK(func, thd_wait_begin, (thd, THD_WAIT_TABLE_LOCK));
}
static void scheduler_wait_sync_end(void) {
THD *thd=current_thd;
- scheduler_functions *func= thd->scheduler;
+ scheduler_functions *func= thd ? thd->scheduler : thread_scheduler;
MYSQL_CALLBACK(func, thd_wait_end, (thd));
}
};
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 8e48e0213f0..45b630a3ba9 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -137,7 +137,6 @@ void sys_var_end()
@param deprecated_version if not 0 - when this variable will go away
@param substitute if not 0 - what one should use instead when this
deprecated variable
- @param parse_flag either PARSE_EARLY or PARSE_NORMAL
*/
sys_var::sys_var(sys_var_chain *chain, const char *name_arg,
const char *comment, int flags_arg, ptrdiff_t off,
@@ -146,11 +145,10 @@ sys_var::sys_var(sys_var_chain *chain, const char *name_arg,
PolyLock *lock, enum binlog_status_enum binlog_status_arg,
on_check_function on_check_func,
on_update_function on_update_func,
- uint deprecated_version, const char *substitute,
- int parse_flag) :
+ uint deprecated_version, const char *substitute) :
next(0),
binlog_status(binlog_status_arg),
- flags(flags_arg), m_parse_flag(parse_flag), show_val_type(show_val_type_arg),
+ flags(flags_arg), show_val_type(show_val_type_arg),
guard(lock), offset(off), on_check(on_check_func), on_update(on_update_func),
is_os_charset(FALSE)
{
@@ -163,7 +161,7 @@ sys_var::sys_var(sys_var_chain *chain, const char *name_arg,
in the first (PARSE_EARLY) stage.
See handle_options() for details.
*/
- DBUG_ASSERT(parse_flag == PARSE_NORMAL || getopt_id <= 0 || getopt_id >= 255);
+ DBUG_ASSERT(!(flags & PARSE_EARLY) || getopt_id <= 0 || getopt_id >= 255);
name.str= name_arg; // ER_NO_DEFAULT relies on 0-termination of name_arg
name.length= strlen(name_arg); // and so does this.
diff --git a/sql/set_var.h b/sql/set_var.h
index acfc1d54aa4..af96fabe3dc 100644
--- a/sql/set_var.h
+++ b/sql/set_var.h
@@ -59,9 +59,7 @@ public:
sys_var *next;
LEX_CSTRING name;
enum flag_enum { GLOBAL, SESSION, ONLY_SESSION, SCOPE_MASK=1023,
- READONLY=1024, ALLOCATED=2048 };
- static const int PARSE_EARLY= 1;
- static const int PARSE_NORMAL= 2;
+ READONLY=1024, ALLOCATED=2048, PARSE_EARLY=4096 };
/**
Enumeration type to indicate for a system variable whether
it will be written to the binlog or not.
@@ -74,7 +72,6 @@ protected:
typedef bool (*on_update_function)(sys_var *self, THD *thd, enum_var_type type);
int flags; ///< or'ed flag_enum values
- int m_parse_flag; ///< either PARSE_EARLY or PARSE_NORMAL.
const SHOW_TYPE show_val_type; ///< what value_ptr() returns for sql_show.cc
my_option option; ///< min, max, default values are stored here
PolyLock *guard; ///< *second* lock that protects the variable
@@ -90,7 +87,7 @@ public:
enum get_opt_arg_type getopt_arg_type, SHOW_TYPE show_val_type_arg,
longlong def_val, PolyLock *lock, enum binlog_status_enum binlog_status_arg,
on_check_function on_check_func, on_update_function on_update_func,
- uint deprecated_version, const char *substitute, int parse_flag);
+ uint deprecated_version, const char *substitute);
virtual ~sys_var() {}
@@ -133,7 +130,7 @@ public:
}
bool register_option(DYNAMIC_ARRAY *array, int parse_flags)
{
- return (option.id != -1) && (m_parse_flag & parse_flags) &&
+ return (option.id != -1) && ((flags & PARSE_EARLY) == parse_flags) &&
insert_dynamic(array, (uchar*)&option);
}
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index eb7fa3222e5..5e46a5ebf82 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -243,7 +243,7 @@ public:
(plugin_var_arg->flags & PLUGIN_VAR_THDLOCAL ? SESSION : GLOBAL) |
(plugin_var_arg->flags & PLUGIN_VAR_READONLY ? READONLY : 0),
0, -1, NO_ARG, pluginvar_show_type(plugin_var_arg), 0, 0,
- VARIABLE_NOT_IN_BINLOG, 0, 0, 0, 0, PARSE_NORMAL),
+ VARIABLE_NOT_IN_BINLOG, 0, 0, 0, 0),
plugin_var(plugin_var_arg), orig_pluginvar_name(plugin_var_arg->name)
{ plugin_var->name= name_arg; }
sys_var_pluginvar *cast_pluginvar() { return this; }
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index ba86a06847a..8126ae091f2 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -61,136 +61,117 @@
#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
-#define PFS_TRAILING_PROPERTIES \
- NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(NULL), ON_UPDATE(NULL), \
- 0, NULL, sys_var::PARSE_EARLY
-
static Sys_var_mybool Sys_pfs_enabled(
"performance_schema",
"Enable the performance schema.",
- READ_ONLY GLOBAL_VAR(pfs_param.m_enabled),
- CMD_LINE(OPT_ARG), DEFAULT(FALSE),
- PFS_TRAILING_PROPERTIES);
+ PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_enabled),
+ CMD_LINE(OPT_ARG), DEFAULT(FALSE));
static Sys_var_ulong Sys_pfs_events_waits_history_long_size(
"performance_schema_events_waits_history_long_size",
"Number of rows in EVENTS_WAITS_HISTORY_LONG.",
- READ_ONLY GLOBAL_VAR(pfs_param.m_events_waits_history_long_sizing),
+ PARSED_EARLY READ_ONLY
+ GLOBAL_VAR(pfs_param.m_events_waits_history_long_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024*1024),
- DEFAULT(PFS_WAITS_HISTORY_LONG_SIZE),
- BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
+ DEFAULT(PFS_WAITS_HISTORY_LONG_SIZE), BLOCK_SIZE(1));
static Sys_var_ulong Sys_pfs_events_waits_history_size(
"performance_schema_events_waits_history_size",
"Number of rows per thread in EVENTS_WAITS_HISTORY.",
- READ_ONLY GLOBAL_VAR(pfs_param.m_events_waits_history_sizing),
+ PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_events_waits_history_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024),
- DEFAULT(PFS_WAITS_HISTORY_SIZE),
- BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
+ DEFAULT(PFS_WAITS_HISTORY_SIZE), BLOCK_SIZE(1));
static Sys_var_ulong Sys_pfs_max_cond_classes(
"performance_schema_max_cond_classes",
"Maximum number of condition instruments.",
- READ_ONLY GLOBAL_VAR(pfs_param.m_cond_class_sizing),
+ PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_cond_class_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 256),
- DEFAULT(PFS_MAX_COND_CLASS),
- BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
+ DEFAULT(PFS_MAX_COND_CLASS), BLOCK_SIZE(1));
static Sys_var_ulong Sys_pfs_max_cond_instances(
"performance_schema_max_cond_instances",
"Maximum number of instrumented condition objects.",
- READ_ONLY GLOBAL_VAR(pfs_param.m_cond_sizing),
+ PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_cond_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024*1024),
- DEFAULT(PFS_MAX_COND),
- BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
+ DEFAULT(PFS_MAX_COND), BLOCK_SIZE(1));
static Sys_var_ulong Sys_pfs_max_file_classes(
"performance_schema_max_file_classes",
"Maximum number of file instruments.",
- READ_ONLY GLOBAL_VAR(pfs_param.m_file_class_sizing),
+ PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_file_class_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 256),
- DEFAULT(PFS_MAX_FILE_CLASS),
- BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
+ DEFAULT(PFS_MAX_FILE_CLASS), BLOCK_SIZE(1));
static Sys_var_ulong Sys_pfs_max_file_handles(
"performance_schema_max_file_handles",
"Maximum number of opened instrumented files.",
- READ_ONLY GLOBAL_VAR(pfs_param.m_file_handle_sizing),
+ PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_file_handle_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024*1024),
- DEFAULT(PFS_MAX_FILE_HANDLE),
- BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
+ DEFAULT(PFS_MAX_FILE_HANDLE), BLOCK_SIZE(1));
static Sys_var_ulong Sys_pfs_max_file_instances(
"performance_schema_max_file_instances",
"Maximum number of instrumented files.",
- READ_ONLY GLOBAL_VAR(pfs_param.m_file_sizing),
+ PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_file_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024*1024),
- DEFAULT(PFS_MAX_FILE),
- BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
+ DEFAULT(PFS_MAX_FILE), BLOCK_SIZE(1));
static Sys_var_ulong Sys_pfs_max_mutex_classes(
"performance_schema_max_mutex_classes",
"Maximum number of mutex instruments.",
- READ_ONLY GLOBAL_VAR(pfs_param.m_mutex_class_sizing),
+ PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_mutex_class_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 256),
- DEFAULT(PFS_MAX_MUTEX_CLASS),
- BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
+ DEFAULT(PFS_MAX_MUTEX_CLASS), BLOCK_SIZE(1));
static Sys_var_ulong Sys_pfs_max_mutex_instances(
"performance_schema_max_mutex_instances",
"Maximum number of instrumented MUTEX objects.",
- READ_ONLY GLOBAL_VAR(pfs_param.m_mutex_sizing),
+ PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_mutex_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 100*1024*1024),
- DEFAULT(PFS_MAX_MUTEX),
- BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
+ DEFAULT(PFS_MAX_MUTEX), BLOCK_SIZE(1));
static Sys_var_ulong Sys_pfs_max_rwlock_classes(
"performance_schema_max_rwlock_classes",
"Maximum number of rwlock instruments.",
- READ_ONLY GLOBAL_VAR(pfs_param.m_rwlock_class_sizing),
+ PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_rwlock_class_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 256),
- DEFAULT(PFS_MAX_RWLOCK_CLASS),
- BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
+ DEFAULT(PFS_MAX_RWLOCK_CLASS), BLOCK_SIZE(1));
static Sys_var_ulong Sys_pfs_max_rwlock_instances(
"performance_schema_max_rwlock_instances",
"Maximum number of instrumented RWLOCK objects.",
- READ_ONLY GLOBAL_VAR(pfs_param.m_rwlock_sizing),
+ PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_rwlock_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 100*1024*1024),
- DEFAULT(PFS_MAX_RWLOCK),
- BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
+ DEFAULT(PFS_MAX_RWLOCK), BLOCK_SIZE(1));
static Sys_var_ulong Sys_pfs_max_table_handles(
"performance_schema_max_table_handles",
"Maximum number of opened instrumented tables.",
- READ_ONLY GLOBAL_VAR(pfs_param.m_table_sizing),
+ PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_table_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024*1024),
- DEFAULT(PFS_MAX_TABLE),
- BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
+ DEFAULT(PFS_MAX_TABLE), BLOCK_SIZE(1));
static Sys_var_ulong Sys_pfs_max_table_instances(
"performance_schema_max_table_instances",
"Maximum number of instrumented tables.",
- READ_ONLY GLOBAL_VAR(pfs_param.m_table_share_sizing),
+ PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_table_share_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024*1024),
- DEFAULT(PFS_MAX_TABLE_SHARE),
- BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
+ DEFAULT(PFS_MAX_TABLE_SHARE), BLOCK_SIZE(1));
static Sys_var_ulong Sys_pfs_max_thread_classes(
"performance_schema_max_thread_classes",
"Maximum number of thread instruments.",
- READ_ONLY GLOBAL_VAR(pfs_param.m_thread_class_sizing),
+ PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_thread_class_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 256),
- DEFAULT(PFS_MAX_THREAD_CLASS),
- BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
+ DEFAULT(PFS_MAX_THREAD_CLASS), BLOCK_SIZE(1));
static Sys_var_ulong Sys_pfs_max_thread_instances(
"performance_schema_max_thread_instances",
"Maximum number of instrumented threads.",
- READ_ONLY GLOBAL_VAR(pfs_param.m_thread_sizing),
+ PARSED_EARLY READ_ONLY GLOBAL_VAR(pfs_param.m_thread_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 1024*1024),
- DEFAULT(PFS_MAX_THREAD),
- BLOCK_SIZE(1), PFS_TRAILING_PROPERTIES);
+ DEFAULT(PFS_MAX_THREAD), BLOCK_SIZE(1));
#endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
@@ -1029,8 +1010,7 @@ static bool session_readonly(sys_var *self, THD *thd, set_var *var)
return true;
}
-static bool
-check_max_allowed_packet(sys_var *self, THD *thd, set_var *var)
+static bool check_max_allowed_packet(sys_var *self, THD *thd, set_var *var)
{
longlong val;
if (session_readonly(self, thd, var))
@@ -1285,8 +1265,7 @@ static Sys_var_mybool Sys_named_pipe(
#endif
-static bool
-check_net_buffer_length(sys_var *self, THD *thd, set_var *var)
+static bool check_net_buffer_length(sys_var *self, THD *thd, set_var *var)
{
longlong val;
if (session_readonly(self, thd, var))
@@ -1894,7 +1873,7 @@ static Sys_var_enum Slave_exec_mode(
"between the master and the slave",
GLOBAL_VAR(slave_exec_mode_options), CMD_LINE(REQUIRED_ARG),
slave_exec_mode_names, DEFAULT(SLAVE_EXEC_MODE_STRICT));
-const char *slave_type_conversions_name[]= {"ALL_LOSSY", "ALL_NON_LOSSY", 0};
+static const char *slave_type_conversions_name[]= {"ALL_LOSSY", "ALL_NON_LOSSY", 0};
static Sys_var_set Slave_type_conversions(
"slave_type_conversions",
"Set of slave type conversions that are enabled. Legal values are:"
@@ -2128,32 +2107,6 @@ static bool check_tx_isolation(sys_var *self, THD *thd, set_var *var)
return FALSE;
}
-
-bool Sys_var_tx_isolation::session_update(THD *thd, set_var *var)
-{
- if (var->type == OPT_SESSION && Sys_var_enum::session_update(thd, var))
- return TRUE;
- if (var->type == OPT_DEFAULT || !thd->in_active_multi_stmt_transaction())
- {
- /*
- Update the isolation level of the next transaction.
- I.e. if one did:
- COMMIT;
- SET SESSION ISOLATION LEVEL ...
- BEGIN; <-- this transaction has the new isolation
- Note, that in case of:
- COMMIT;
- SET TRANSACTION ISOLATION LEVEL ...
- SET SESSION ISOLATION LEVEL ...
- BEGIN; <-- the session isolation level is used, not the
- result of SET TRANSACTION statement.
- */
- thd->tx_isolation= (enum_tx_isolation) var->save_result.ulonglong_value;
- }
- return FALSE;
-}
-
-
// NO_CMD_LINE - different name of the option
static Sys_var_tx_isolation Sys_tx_isolation(
"tx_isolation", "Default transaction isolation level",
@@ -3324,11 +3277,6 @@ static Sys_var_ulong Sys_mrr_buffer_size(
SESSION_VAR(mrr_buff_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(IO_SIZE*2, INT_MAX32), DEFAULT(256*1024), BLOCK_SIZE(1));
-/* {"sync_sys", OPT_SYNC,
- "Enable/disable system sync calls. Should only be turned off when running "
- "tests or debugging!!",
- &opt_sync, &opt_sync, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},*/
-
static Sys_var_ulong Sys_rowid_merge_buff_size(
"rowid_merge_buff_size",
"The size of the buffers used [NOT] IN evaluation via partial matching",
diff --git a/sql/sys_vars.h b/sql/sys_vars.h
index 348fede994b..943b26fa5c4 100644
--- a/sql/sys_vars.h
+++ b/sql/sys_vars.h
@@ -53,6 +53,7 @@
#define READ_ONLY sys_var::READONLY+
// this means that Sys_var_charptr initial value was malloc()ed
#define PREALLOCATED sys_var::ALLOCATED+
+#define PARSED_EARLY sys_var::PARSE_EARLY+
/*
Sys_var_bit meaning is reversed, like in
@@foreign_key_checks <-> OPTION_NO_FOREIGN_KEY_CHECKS
@@ -109,12 +110,10 @@ public:
enum binlog_status_enum binlog_status_arg=VARIABLE_NOT_IN_BINLOG,
on_check_function on_check_func=0,
on_update_function on_update_func=0,
- uint deprecated_version=0, const char *substitute=0,
- int parse_flag= PARSE_NORMAL)
+ uint deprecated_version=0, const char *substitute=0)
: sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id,
getopt.arg_type, SHOWT, def_val, lock, binlog_status_arg,
- on_check_func, on_update_func, deprecated_version,
- substitute, parse_flag)
+ on_check_func, on_update_func, deprecated_version, substitute)
{
option.var_type= ARGT;
option.min_value= min_val;
@@ -197,11 +196,11 @@ public:
ulonglong def_val, PolyLock *lock,
enum binlog_status_enum binlog_status_arg,
on_check_function on_check_func, on_update_function on_update_func,
- uint deprecated_version, const char *substitute, int parse_flag= PARSE_NORMAL)
+ uint deprecated_version, const char *substitute)
: sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id,
getopt.arg_type, show_val_type_arg, def_val, lock,
binlog_status_arg, on_check_func,
- on_update_func, deprecated_version, substitute, parse_flag)
+ on_update_func, deprecated_version, substitute)
{
for (typelib.count= 0; values[typelib.count]; typelib.count++) /*no-op */;
typelib.name="";
@@ -311,12 +310,11 @@ public:
enum binlog_status_enum binlog_status_arg=VARIABLE_NOT_IN_BINLOG,
on_check_function on_check_func=0,
on_update_function on_update_func=0,
- uint deprecated_version=0, const char *substitute=0,
- int parse_flag= PARSE_NORMAL)
+ uint deprecated_version=0, const char *substitute=0)
: Sys_var_typelib(name_arg, comment, flag_args, off, getopt,
SHOW_MY_BOOL, bool_values, def_val, lock,
binlog_status_arg, on_check_func, on_update_func,
- deprecated_version, substitute, parse_flag)
+ deprecated_version, substitute)
{
option.var_type= GET_BOOL;
global_var(my_bool)= def_val;
@@ -367,12 +365,11 @@ public:
enum binlog_status_enum binlog_status_arg=VARIABLE_NOT_IN_BINLOG,
on_check_function on_check_func=0,
on_update_function on_update_func=0,
- uint deprecated_version=0, const char *substitute=0,
- int parse_flag= PARSE_NORMAL)
+ uint deprecated_version=0, const char *substitute=0)
: sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id,
getopt.arg_type, SHOW_CHAR_PTR, (intptr)def_val,
lock, binlog_status_arg, on_check_func, on_update_func,
- deprecated_version, substitute, parse_flag)
+ deprecated_version, substitute)
{
is_os_charset= is_os_charset_arg == IN_FS_CHARSET;
/*
@@ -461,7 +458,7 @@ public:
: sys_var(&all_sys_vars, name_arg, comment,
sys_var::READONLY+sys_var::ONLY_SESSION, 0, -1,
NO_ARG, SHOW_CHAR, 0, NULL, VARIABLE_NOT_IN_BINLOG,
- NULL, NULL, 0, NULL, PARSE_NORMAL)
+ NULL, NULL, 0, NULL)
{
is_os_charset= is_os_charset_arg == IN_FS_CHARSET;
option.var_type= GET_STR;
@@ -574,12 +571,11 @@ public:
enum binlog_status_enum binlog_status_arg=VARIABLE_NOT_IN_BINLOG,
on_check_function on_check_func=0,
on_update_function on_update_func=0,
- uint deprecated_version=0, const char *substitute=0,
- int parse_flag= PARSE_NORMAL)
+ uint deprecated_version=0, const char *substitute=0)
: sys_var(&all_sys_vars, name_arg, comment, flag_args, 0, getopt.id,
getopt.arg_type, SHOW_CHAR, (intptr)def_val,
lock, binlog_status_arg, on_check_func, on_update_func,
- deprecated_version, substitute, parse_flag)
+ deprecated_version, substitute)
{ option.var_type= GET_NO_ARG; }
bool do_check(THD *thd, set_var *var)
{
@@ -819,12 +815,11 @@ public:
enum binlog_status_enum binlog_status_arg=VARIABLE_NOT_IN_BINLOG,
on_check_function on_check_func=0,
on_update_function on_update_func=0,
- uint deprecated_version=0, const char *substitute=0,
- int parse_flag= PARSE_NORMAL)
+ uint deprecated_version=0, const char *substitute=0)
: sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id,
getopt.arg_type, SHOW_DOUBLE, (longlong) double2ulonglong(def_val),
lock, binlog_status_arg, on_check_func, on_update_func,
- deprecated_version, substitute, parse_flag)
+ deprecated_version, substitute)
{
option.var_type= GET_DOUBLE;
option.min_value= (longlong) double2ulonglong(min_val);
@@ -1142,12 +1137,11 @@ public:
enum binlog_status_enum binlog_status_arg=VARIABLE_NOT_IN_BINLOG,
on_check_function on_check_func=0,
on_update_function on_update_func=0,
- uint deprecated_version=0, const char *substitute=0,
- int parse_flag= PARSE_NORMAL)
+ uint deprecated_version=0, const char *substitute=0)
: sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id,
getopt.arg_type, SHOW_CHAR, (intptr)def_val,
lock, binlog_status_arg, on_check_func, on_update_func,
- deprecated_version, substitute, parse_flag),
+ deprecated_version, substitute),
plugin_type(plugin_type_arg)
{
option.var_type= GET_STR;
@@ -1256,12 +1250,11 @@ public:
enum binlog_status_enum binlog_status_arg=VARIABLE_NOT_IN_BINLOG,
on_check_function on_check_func=0,
on_update_function on_update_func=0,
- uint deprecated_version=0, const char *substitute=0,
- int parse_flag= PARSE_NORMAL)
+ uint deprecated_version=0, const char *substitute=0)
: sys_var(&all_sys_vars, name_arg, comment, flag_args, 0, getopt.id,
getopt.arg_type, SHOW_CHAR, (intptr)def_val,
lock, binlog_status_arg, on_check_func, on_update_func,
- deprecated_version, substitute, parse_flag)
+ deprecated_version, substitute)
{
DBUG_ASSERT(scope() == ONLY_SESSION);
option.var_type= GET_NO_ARG;
@@ -1475,12 +1468,11 @@ public:
enum binlog_status_enum binlog_status_arg=VARIABLE_NOT_IN_BINLOG,
on_check_function on_check_func=0,
on_update_function on_update_func=0,
- uint deprecated_version=0, const char *substitute=0,
- int parse_flag= PARSE_NORMAL)
+ uint deprecated_version=0, const char *substitute=0)
: sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id,
getopt.arg_type, SHOW_CHAR, 0,
lock, binlog_status_arg, on_check_func, on_update_func,
- deprecated_version, substitute, parse_flag)
+ deprecated_version, substitute)
{
DBUG_ASSERT(scope() == GLOBAL);
DBUG_ASSERT(getopt.id == -1);
@@ -1544,12 +1536,11 @@ public:
enum binlog_status_enum binlog_status_arg=VARIABLE_NOT_IN_BINLOG,
on_check_function on_check_func=0,
on_update_function on_update_func=0,
- uint deprecated_version=0, const char *substitute=0,
- int parse_flag= PARSE_NORMAL)
+ uint deprecated_version=0, const char *substitute=0)
: sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id,
getopt.arg_type, SHOW_CHAR, (intptr)def_val,
lock, binlog_status_arg, on_check_func, on_update_func,
- deprecated_version, substitute, parse_flag),
+ deprecated_version, substitute),
name_offset(name_off)
{
option.var_type= GET_STR;
@@ -1617,12 +1608,11 @@ public:
enum binlog_status_enum binlog_status_arg=VARIABLE_NOT_IN_BINLOG,
on_check_function on_check_func=0,
on_update_function on_update_func=0,
- uint deprecated_version=0, const char *substitute=0,
- int parse_flag= PARSE_NORMAL)
+ uint deprecated_version=0, const char *substitute=0)
: sys_var(&all_sys_vars, name_arg, comment, flag_args, off, getopt.id,
getopt.arg_type, SHOW_CHAR, (intptr)def_val,
lock, binlog_status_arg, on_check_func, on_update_func,
- deprecated_version, substitute, parse_flag)
+ deprecated_version, substitute)
{
DBUG_ASSERT(getopt.id == -1);
DBUG_ASSERT(size == sizeof(Time_zone *));
@@ -1684,7 +1674,16 @@ public:
{ return type != STRING_RESULT; }
};
+/**
+ Special implementation for transaction isolation, that
+ distingushes between
+
+ SET GLOBAL TRANSACTION ISOLATION (stored in global_system_variables)
+ SET SESSION TRANSACTION ISOLATION (stored in thd->variables)
+ SET TRANSACTION ISOLATION (stored in thd->tx_isolation)
+ where the last statement sets isolation level for the next transaction only
+*/
class Sys_var_tx_isolation: public Sys_var_enum
{
public:
@@ -1697,7 +1696,14 @@ public:
:Sys_var_enum(name_arg, comment, flag_args, off, size, getopt,
values, def_val, lock, binlog_status_arg, on_check_func)
{}
- virtual bool session_update(THD *thd, set_var *var);
+ bool session_update(THD *thd, set_var *var)
+ {
+ if (var->type == OPT_SESSION && Sys_var_enum::session_update(thd, var))
+ return TRUE;
+ if (var->type == OPT_DEFAULT || !thd->in_active_multi_stmt_transaction())
+ thd->tx_isolation= (enum_tx_isolation) var->save_result.ulonglong_value;
+ return FALSE;
+ }
};
/****************************************************************************