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. sql/item_create.cc: Renamed BINLOG_STMT_UNSAFE_FUNCTION to BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION sql/share/errmsg.txt: Moved hard-coded strings from THD::issue_unsafe_warnings() to errmsg.txt. sql/sql_class.cc: - Moved error messages to errmsg.txt. - Updated comment above THD::issue_unsafe_warnings(). sql/sql_lex.h: Renamed BINLOG_STMT_UNSAFE_FUNCTION to BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION sql/sql_yacc.yy: Renamed BINLOG_STMT_UNSAFE_FUNCTION to BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION
This commit is contained in:
parent
fa32b4f296
commit
bfb1de9c06
@ -3365,7 +3365,7 @@ Item*
|
|||||||
Create_func_found_rows::create(THD *thd)
|
Create_func_found_rows::create(THD *thd)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("Create_func_found_rows::create");
|
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;
|
thd->lex->safe_to_cache_query= 0;
|
||||||
DBUG_RETURN(new (thd->mem_root) Item_func_found_rows());
|
DBUG_RETURN(new (thd->mem_root) Item_func_found_rows());
|
||||||
}
|
}
|
||||||
@ -3794,7 +3794,7 @@ Item*
|
|||||||
Create_func_load_file::create(THD *thd, Item *arg1)
|
Create_func_load_file::create(THD *thd, Item *arg1)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("Create_func_load_file::create");
|
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);
|
thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
|
||||||
DBUG_RETURN(new (thd->mem_root) Item_load_file(arg1));
|
DBUG_RETURN(new (thd->mem_root) Item_load_file(arg1));
|
||||||
}
|
}
|
||||||
@ -4264,7 +4264,7 @@ Item*
|
|||||||
Create_func_row_count::create(THD *thd)
|
Create_func_row_count::create(THD *thd)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("Create_func_row_count::create");
|
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;
|
thd->lex->safe_to_cache_query= 0;
|
||||||
DBUG_RETURN(new (thd->mem_root) Item_func_row_count());
|
DBUG_RETURN(new (thd->mem_root) Item_func_row_count());
|
||||||
}
|
}
|
||||||
@ -4574,7 +4574,7 @@ Item*
|
|||||||
Create_func_uuid::create(THD *thd)
|
Create_func_uuid::create(THD *thd)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("Create_func_uuid::create");
|
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;
|
thd->lex->safe_to_cache_query= 0;
|
||||||
DBUG_RETURN(new (thd->mem_root) Item_func_uuid());
|
DBUG_RETURN(new (thd->mem_root) Item_func_uuid());
|
||||||
}
|
}
|
||||||
@ -4586,7 +4586,7 @@ Item*
|
|||||||
Create_func_uuid_short::create(THD *thd)
|
Create_func_uuid_short::create(THD *thd)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("Create_func_uuid_short::create");
|
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;
|
thd->lex->safe_to_cache_query= 0;
|
||||||
DBUG_RETURN(new (thd->mem_root) Item_func_uuid_short());
|
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."
|
eng "Cannot execute row injection: binlogging impossible since BINLOG_FORMAT = STATEMENT."
|
||||||
ER_BINLOG_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE
|
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."
|
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.
|
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()
|
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
|
@note The order of the elements of this array must correspond to
|
||||||
the order of elements in enum_binlog_stmt_unsafe.
|
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.",
|
ER_BINLOG_UNSAFE_LIMIT,
|
||||||
"Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.",
|
ER_BINLOG_UNSAFE_INSERT_DELAYED,
|
||||||
"Statement uses the general_log or slow_log table. This is unsafe because system tables may differ on slave.",
|
ER_BINLOG_UNSAFE_SYSTEM_TABLE,
|
||||||
"Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.",
|
ER_BINLOG_UNSAFE_TWO_AUTOINC_COLUMNS,
|
||||||
"Statement uses a UDF. It cannot be determined if the UDF will return the same value on slave.",
|
ER_BINLOG_UNSAFE_UDF,
|
||||||
"Statement uses a system variable whose value may differ on slave.",
|
ER_BINLOG_UNSAFE_SYSTEM_VARIABLE,
|
||||||
"Statement uses a system function whose value may differ on slave."
|
ER_BINLOG_UNSAFE_SYSTEM_FUNCTION
|
||||||
};
|
};
|
||||||
uint32 flags= binlog_unsafe_warning_flags;
|
uint32 flags= binlog_unsafe_warning_flags;
|
||||||
/* No warnings (yet) for this statement. */
|
/* No warnings (yet) for this statement. */
|
||||||
@ -3977,7 +3978,7 @@ void THD::issue_unsafe_warnings()
|
|||||||
uint32 unsafe_type_flags= flags >> BINLOG_STMT_WARNING_COUNT;
|
uint32 unsafe_type_flags= flags >> BINLOG_STMT_WARNING_COUNT;
|
||||||
DBUG_ASSERT((unsafe_type_flags & LEX::BINLOG_STMT_UNSAFE_ALL_FLAGS) != 0);
|
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.
|
warnings that have been printed already.
|
||||||
*/
|
*/
|
||||||
unsafe_type_flags &= (LEX::BINLOG_STMT_UNSAFE_ALL_FLAGS ^
|
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)
|
if ((unsafe_type_flags & (1 << unsafe_type)) != 0)
|
||||||
{
|
{
|
||||||
push_warning_printf(this, MYSQL_ERROR::WARN_LEVEL_NOTE, err,
|
push_warning_printf(this, MYSQL_ERROR::WARN_LEVEL_NOTE, err,
|
||||||
"%s Reason: %s",
|
ER(ER_BINLOG_UNSAFE_WARNING_SHORT),
|
||||||
ER(err), explanations[unsafe_type]);
|
ER(err), ER(explanations[unsafe_type]));
|
||||||
sql_print_warning("%s Reason: %s Statement: %s",
|
sql_print_warning(ER(ER_BINLOG_UNSAFE_WARNING_LONG),
|
||||||
ER(err), explanations[unsafe_type], query);
|
ER(err), ER(explanations[unsafe_type]), query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -1087,7 +1087,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
Using some functions is unsafe (e.g., UUID).
|
Using some functions is unsafe (e.g., UUID).
|
||||||
*/
|
*/
|
||||||
BINLOG_STMT_UNSAFE_FUNCTION,
|
BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION,
|
||||||
|
|
||||||
/* The last element of this enumeration type. */
|
/* The last element of this enumeration type. */
|
||||||
BINLOG_STMT_UNSAFE_COUNT
|
BINLOG_STMT_UNSAFE_COUNT
|
||||||
|
@ -7213,7 +7213,7 @@ function_call_keyword:
|
|||||||
$$= new (YYTHD->mem_root) Item_func_current_user(Lex->current_context());
|
$$= new (YYTHD->mem_root) Item_func_current_user(Lex->current_context());
|
||||||
if ($$ == NULL)
|
if ($$ == NULL)
|
||||||
MYSQL_YYABORT;
|
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;
|
Lex->safe_to_cache_query= 0;
|
||||||
}
|
}
|
||||||
| DATE_SYM '(' expr ')'
|
| DATE_SYM '(' expr ')'
|
||||||
@ -7368,7 +7368,7 @@ function_call_keyword:
|
|||||||
$$= new (YYTHD->mem_root) Item_func_user();
|
$$= new (YYTHD->mem_root) Item_func_user();
|
||||||
if ($$ == NULL)
|
if ($$ == NULL)
|
||||||
MYSQL_YYABORT;
|
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;
|
Lex->safe_to_cache_query=0;
|
||||||
}
|
}
|
||||||
| YEAR_SYM '(' expr ')'
|
| YEAR_SYM '(' expr ')'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user