Commit d83b69f7 authored by Sven Sandberg's avatar Sven Sandberg

post-push fixes for BUG#39934

Removed hard-coded error messages. All messages are now in
errmsg.txt
Also renamed enumeration value BINLOG_STMT_UNSAFE_FUNCTION to
BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION to make the naming consistent
with BINLOG_STMT_UNSAFE_SYSTEM_VARIABLE.
parent 3f6c13ba
......@@ -3365,7 +3365,7 @@ Item*
Create_func_found_rows::create(THD *thd)
{
DBUG_ENTER("Create_func_found_rows::create");
thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_FUNCTION);
thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION);
thd->lex->safe_to_cache_query= 0;
DBUG_RETURN(new (thd->mem_root) Item_func_found_rows());
}
......@@ -3794,7 +3794,7 @@ Item*
Create_func_load_file::create(THD *thd, Item *arg1)
{
DBUG_ENTER("Create_func_load_file::create");
thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_FUNCTION);
thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION);
thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
DBUG_RETURN(new (thd->mem_root) Item_load_file(arg1));
}
......@@ -4264,7 +4264,7 @@ Item*
Create_func_row_count::create(THD *thd)
{
DBUG_ENTER("Create_func_row_count::create");
thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_FUNCTION);
thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION);
thd->lex->safe_to_cache_query= 0;
DBUG_RETURN(new (thd->mem_root) Item_func_row_count());
}
......@@ -4574,7 +4574,7 @@ Item*
Create_func_uuid::create(THD *thd)
{
DBUG_ENTER("Create_func_uuid::create");
thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_FUNCTION);
thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION);
thd->lex->safe_to_cache_query= 0;
DBUG_RETURN(new (thd->mem_root) Item_func_uuid());
}
......@@ -4586,7 +4586,7 @@ Item*
Create_func_uuid_short::create(THD *thd)
{
DBUG_ENTER("Create_func_uuid_short::create");
thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_FUNCTION);
thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION);
thd->lex->safe_to_cache_query= 0;
DBUG_RETURN(new (thd->mem_root) Item_func_uuid_short());
}
......
......@@ -6215,3 +6215,23 @@ ER_BINLOG_ROW_INJECTION_AND_STMT_MODE
eng "Cannot execute row injection: binlogging impossible since BINLOG_FORMAT = STATEMENT."
ER_BINLOG_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE
eng "Cannot execute statement: binlogging impossible since more than one engine is involved and at least one engine is self-logging."
ER_BINLOG_UNSAFE_LIMIT
eng "Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted."
ER_BINLOG_UNSAFE_INSERT_DELAYED
eng "Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted."
ER_BINLOG_UNSAFE_SYSTEM_TABLE
eng "Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave."
ER_BINLOG_UNSAFE_TWO_AUTOINC_COLUMNS
eng "Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave."
ER_BINLOG_UNSAFE_UDF
eng "Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave."
ER_BINLOG_UNSAFE_SYSTEM_VARIABLE
eng "Statement uses a system variable whose value may differ on slave."
ER_BINLOG_UNSAFE_SYSTEM_FUNCTION
eng "Statement uses a system function whose value may differ on slave."
ER_BINLOG_UNSAFE_WARNING_SHORT
eng "%s Reason: %s"
ER_BINLOG_UNSAFE_WARNING_LONG
eng "%s Reason: %s Statement: %s"
......@@ -3942,7 +3942,8 @@ show_query_type(THD::enum_binlog_query_type qtype)
/**
Auxiliary method used by @c binlog_query() to raise warnings.
@param err An ER_BINLOG_UNSAFE_* constant; the warning to print.
The type of warning and the type of unsafeness is stored in
THD::binlog_unsafe_warning_flags.
*/
void THD::issue_unsafe_warnings()
{
......@@ -3958,15 +3959,15 @@ void THD::issue_unsafe_warnings()
@note The order of the elements of this array must correspond to
the order of elements in enum_binlog_stmt_unsafe.
*/
static const char *explanations[LEX::BINLOG_STMT_UNSAFE_COUNT] =
static const int explanations[LEX::BINLOG_STMT_UNSAFE_COUNT] =
{
"Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.",
"Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.",
"Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.",
"Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.",
"Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.",
"Statement uses a system variable whose value may differ on slave.",
"Statement uses a system function whose value may differ on slave."
ER_BINLOG_UNSAFE_LIMIT,
ER_BINLOG_UNSAFE_INSERT_DELAYED,
ER_BINLOG_UNSAFE_SYSTEM_TABLE,
ER_BINLOG_UNSAFE_TWO_AUTOINC_COLUMNS,
ER_BINLOG_UNSAFE_UDF,
ER_BINLOG_UNSAFE_SYSTEM_VARIABLE,
ER_BINLOG_UNSAFE_SYSTEM_FUNCTION
};
uint32 flags= binlog_unsafe_warning_flags;
/* No warnings (yet) for this statement. */
......@@ -3977,7 +3978,7 @@ void THD::issue_unsafe_warnings()
uint32 unsafe_type_flags= flags >> BINLOG_STMT_WARNING_COUNT;
DBUG_ASSERT((unsafe_type_flags & LEX::BINLOG_STMT_UNSAFE_ALL_FLAGS) != 0);
/*
Clear (1) bits above BINLOG_STMT_UNSAFE_COUNT; (2) bits for
Clear: (1) bits above BINLOG_STMT_UNSAFE_COUNT; (2) bits for
warnings that have been printed already.
*/
unsafe_type_flags &= (LEX::BINLOG_STMT_UNSAFE_ALL_FLAGS ^
......@@ -4010,10 +4011,10 @@ void THD::issue_unsafe_warnings()
if ((unsafe_type_flags & (1 << unsafe_type)) != 0)
{
push_warning_printf(this, MYSQL_ERROR::WARN_LEVEL_NOTE, err,
"%s Reason: %s",
ER(err), explanations[unsafe_type]);
sql_print_warning("%s Reason: %s Statement: %s",
ER(err), explanations[unsafe_type], query);
ER(ER_BINLOG_UNSAFE_WARNING_SHORT),
ER(err), ER(explanations[unsafe_type]));
sql_print_warning(ER(ER_BINLOG_UNSAFE_WARNING_LONG),
ER(err), ER(explanations[unsafe_type]), query);
}
}
/*
......
......@@ -1087,7 +1087,7 @@ public:
/**
Using some functions is unsafe (e.g., UUID).
*/
BINLOG_STMT_UNSAFE_FUNCTION,
BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION,
/* The last element of this enumeration type. */
BINLOG_STMT_UNSAFE_COUNT
......
......@@ -7213,7 +7213,7 @@ function_call_keyword:
$$= new (YYTHD->mem_root) Item_func_current_user(Lex->current_context());
if ($$ == NULL)
MYSQL_YYABORT;
Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_FUNCTION);
Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION);
Lex->safe_to_cache_query= 0;
}
| DATE_SYM '(' expr ')'
......@@ -7368,7 +7368,7 @@ function_call_keyword:
$$= new (YYTHD->mem_root) Item_func_user();
if ($$ == NULL)
MYSQL_YYABORT;
Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_FUNCTION);
Lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION);
Lex->safe_to_cache_query=0;
}
| YEAR_SYM '(' expr ')'
......
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