List:Commits« Previous MessageNext Message »
From:Sven Sandberg Date:August 19 2009 11:38am
Subject:bzr commit into mysql-5.1-bugteam branch (sven.sandberg:3030) Bug#39934
View as plain text  
#At file:///home/sven/bzr/b39934-mats-slave_row_engine/5.1-bugteam/ based on revid:sven.sandberg@stripped

 3030 Sven Sandberg	2009-08-19
      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

    modified:
      sql/item_create.cc
      sql/share/errmsg.txt
      sql/sql_class.cc
      sql/sql_lex.h
      sql/sql_yacc.yy
=== modified file 'sql/item_create.cc'
--- a/sql/item_create.cc	2009-07-22 16:16:17 +0000
+++ b/sql/item_create.cc	2009-08-19 11:38:30 +0000
@@ -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());
 }

=== modified file 'sql/share/errmsg.txt'
--- a/sql/share/errmsg.txt	2009-07-14 19:31:19 +0000
+++ b/sql/share/errmsg.txt	2009-08-19 11:38:30 +0000
@@ -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"

=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc	2009-07-22 20:14:20 +0000
+++ b/sql/sql_class.cc	2009-08-19 11:38:30 +0000
@@ -3942,7 +3942,8 @@ show_query_type(THD::enum_binlog_query_t
 /**
   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);
     }
   }
   /*

=== modified file 'sql/sql_lex.h'
--- a/sql/sql_lex.h	2009-07-22 16:16:17 +0000
+++ b/sql/sql_lex.h	2009-08-19 11:38:30 +0000
@@ -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

=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy	2009-07-22 16:16:17 +0000
+++ b/sql/sql_yacc.yy	2009-08-19 11:38:30 +0000
@@ -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 ')'


Attachment: [text/bzr-bundle] bzr/sven.sandberg@sun.com-20090819113830-nrzvq7i23ujutl2o.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (sven.sandberg:3030) Bug#39934Sven Sandberg19 Aug