summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Sandberg <sven.sandberg@sun.com>2009-08-19 13:38:30 +0200
committerSven Sandberg <sven.sandberg@sun.com>2009-08-19 13:38:30 +0200
commitbfb1de9c065b6e9fd6b9fecb1c2db2b4475d3135 (patch)
treea32ec4f15fa4dc27cd8b0aca8fc4bd785d22ff84
parentfa32b4f29618a43cd989e997bb4ff3079ffe914a (diff)
downloadmariadb-git-bfb1de9c065b6e9fd6b9fecb1c2db2b4475d3135.tar.gz
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
-rw-r--r--sql/item_create.cc10
-rw-r--r--sql/share/errmsg.txt20
-rw-r--r--sql/sql_class.cc29
-rw-r--r--sql/sql_lex.h2
-rw-r--r--sql/sql_yacc.yy4
5 files changed, 43 insertions, 22 deletions
diff --git a/sql/item_create.cc b/sql/item_create.cc
index c124128b3f8..09303e00ea6 100644
--- a/sql/item_create.cc
+++ b/sql/item_create.cc
@@ -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());
}
diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt
index 1f466dd3db6..1dbab075614 100644
--- a/sql/share/errmsg.txt
+++ b/sql/share/errmsg.txt
@@ -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"
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index c8661ab322e..6cd4fbb5e38 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -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);
}
}
/*
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 17ef4e7abd1..0ac4f526e5a 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -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
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index bf8479894f6..8dbb19a9cbd 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -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 ')'