Hi, Sanja! On Oct 29, sanja@mariadb.com wrote:
--- mysql-test/r/set_statement.result | 14 ++++++++++++++ mysql-test/r/set_statement_profiling.result | 4 ++++ mysql-test/t/set_statement.test | 18 ++++++++++++++++++ mysql-test/t/set_statement_profiling.test | 9 +++++++++
Did you put set_statement_debug.test in a separate commit? That's good.
sql/set_var.h | 4 +++- sql/share/errmsg-utf8.txt | 2 ++ sql/sql_parse.cc | 5 +++++ sql/sys_vars.cc | 20 +++++++++++--------- sql/sys_vars.h | 1 + 9 files changed, 67 insertions(+), 10 deletions(-)
diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index bb42807..1633169 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -7113,3 +7113,5 @@ ER_STATEMENT_TIMEOUT 70100 eng "Query execution was interrupted (max_statement_time exceeded)" ER_SUBQUERIES_NOT_SUPPORTED 42000 eng "%s does not support subqueries or stored functions." +ER_SET_STATEMENT_NOT_SUPPORTED 42000 + eng "Variable '%s' is not supported in SET STATEMENT."
Use the text eng "The system variable %.200s cannot be set in SET STATEMENT."
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 6252e89..fd77e5f 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -997,7 +997,7 @@ static bool check_master_connection(sys_var *self, THD *thd, set_var *var) static Sys_var_session_lexstring Sys_default_master_connection( "default_master_connection", "Master connection to use for all slave variables and slave commands", - SESSION_ONLY(default_master_connection), + NO_SET_STMT SESSION_ONLY(default_master_connection),
Why should this be prohibited? I'd rather have it supported. Use case: setting many connection variables for a single master, like in SET STATEMENT default_master_connection=foobar SET max_relay_log_size=10000000, sql_slave_skip_counter=5; Admittedly, this use case, while valid, isn't a strong argument at the moment - we don't have many per-master variables yet. When we'll have more, this will become more important. So, if fixing default_master_connection is not easy - keep it NO_SET_STMT, it can be enabled later. Why, exactly, does it fail?
NO_CMD_LINE, IN_SYSTEM_CHARSET, DEFAULT(""), MAX_CONNECTION_NAME, ON_CHECK(check_master_connection)); #endif @@ -3527,12 +3528,12 @@ static Sys_var_bit Sys_unique_checks( #ifdef ENABLED_PROFILING static Sys_var_bit Sys_profiling( "profiling", "profiling", - SESSION_VAR(option_bits), NO_CMD_LINE, OPTION_PROFILING, + NO_SET_STMT SESSION_VAR(option_bits), NO_CMD_LINE, OPTION_PROFILING,
Why should this be prohibited? I'd rather have it supported. Use case: one usually needs to profile a single statement, not everything.
DEFAULT(FALSE));
static Sys_var_ulong Sys_profiling_history_size( "profiling_history_size", "Limit of query profiling memory", - SESSION_VAR(profiling_history_size), CMD_LINE(REQUIRED_ARG), + NO_SET_STMT SESSION_VAR(profiling_history_size), CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, 100), DEFAULT(15), BLOCK_SIZE(1)); #endif
@@ -3566,7 +3567,8 @@ static bool check_skip_replication(sys_var *self, THD *thd, set_var *var)
static Sys_var_bit Sys_skip_replication( "skip_replication", "skip_replication", - SESSION_ONLY(option_bits), NO_CMD_LINE, OPTION_SKIP_REPLICATION, + NO_SET_STMT SESSION_ONLY(option_bits), + NO_CMD_LINE, OPTION_SKIP_REPLICATION,
Why should this be prohibited? I'd rather have it supported. Use case: skip replication of a single statement. A generic version of FLUSH NO_WRITE_TO_BINLOG TABLE REPAIR NO_WRITE_TO_BINLOG TABLE ANALYZE NO_WRITE_TO_BINLOG TABLE OPTIMIZE NO_WRITE_TO_BINLOG TABLE and all ALTER TABLE ... PARTITION variants: ALTER TABLE ... REBUILD PARTITION NO_WRITE_TO_BINLOG ALTER TABLE ... OPTIMIZE PARTITION NO_WRITE_TO_BINLOG ALTER TABLE ... ANALYZE PARTITION NO_WRITE_TO_BINLOG ALTER TABLE ... REPAIR PARTITION NO_WRITE_TO_BINLOG ALTER TABLE ... COALESCE PARTITION NO_WRITE_TO_BINLOG ALTER TABLE ... ADD PARTITION NO_WRITE_TO_BINLOG ALTER TABLE ... REORGANIZE PARTITION NO_WRITE_TO_BINLOG
DEFAULT(FALSE), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_skip_replication));
@@ -3688,7 +3690,7 @@ static ulonglong read_rand_seed(THD *thd) static Sys_var_session_special Sys_rand_seed1( "rand_seed1", "Sets the internal state of the RAND() " "generator for replication purposes", - sys_var::ONLY_SESSION, NO_CMD_LINE, + NO_SET_STMT sys_var::ONLY_SESSION, NO_CMD_LINE, VALID_RANGE(0, ULONG_MAX), BLOCK_SIZE(1), NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(0), ON_UPDATE(update_rand_seed1), ON_READ(read_rand_seed)); @@ -3706,7 +3708,7 @@ static bool update_rand_seed2(THD *thd, set_var *var) static Sys_var_session_special Sys_rand_seed2( "rand_seed2", "Sets the internal state of the RAND() " "generator for replication purposes", - sys_var::ONLY_SESSION, NO_CMD_LINE, + NO_SET_STMT sys_var::ONLY_SESSION, NO_CMD_LINE, VALID_RANGE(0, ULONG_MAX), BLOCK_SIZE(1), NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(0), ON_UPDATE(update_rand_seed2), ON_READ(read_rand_seed));
I'd rather fix rand_seed1/rand_seed2 variables not to be special anymore. Like, move them to SV structure, remove special behavior and so on. Regards, Sergei