List:Commits« Previous MessageNext Message »
From:Magnus Blåudd Date:January 31 2011 4:01pm
Subject:bzr commit into mysql-trunk branch (magnus.blaudd:3580) Bug#59844
View as plain text  
#At file:///home/msvensson/mysql/trunk-bug59844/ based on revid:jon.hauglid@strippedfc9h

 3580 Magnus Blåudd	2011-01-31
      Bug#59844	Return value of ndb binlog functions are not checked
       - verbatim patch from MySQL Cluster 7.0
       - looks like simply returning 1 if ha_reset_logs fails is no longer
        ok though, and error message should have been saved in
        stmt_da. Could be similar problem in the other place.

    modified:
      sql/binlog.cc
      sql/handler.cc
      sql/handler.h
      sql/rpl_slave.cc
=== modified file 'sql/binlog.cc'
--- a/sql/binlog.cc	2010-12-17 02:01:32 +0000
+++ b/sql/binlog.cc	2011-01-31 16:01:03 +0000
@@ -2130,7 +2130,11 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd)
   const char* save_name;
   DBUG_ENTER("reset_logs");
 
-  ha_reset_logs(thd);
+  if (ha_reset_logs(thd))
+  {
+    DBUG_RETURN(1);
+  }
+
   /*
     We need to get both locks to be sure that no one is trying to
     write to the index log file.

=== modified file 'sql/handler.cc'
--- a/sql/handler.cc	2011-01-21 10:50:31 +0000
+++ b/sql/handler.cc	2011-01-31 16:01:03 +0000
@@ -4231,27 +4231,28 @@ static my_bool binlog_func_foreach(THD *
 {
   hton_list_st hton_list;
   uint i, sz;
+  int res= 0;
 
   hton_list.sz= 0;
   plugin_foreach(thd, binlog_func_list,
                  MYSQL_STORAGE_ENGINE_PLUGIN, &hton_list);
 
   for (i= 0, sz= hton_list.sz; i < sz ; i++)
-    hton_list.hton[i]->binlog_func(hton_list.hton[i], thd, bfn->fn, bfn->arg);
-  return FALSE;
+    res |= hton_list.hton[i]->binlog_func(hton_list.hton[i], thd,
+                                          bfn->fn, bfn->arg);
+  return res != 0;
 }
 
 int ha_reset_logs(THD *thd)
 {
   binlog_func_st bfn= {BFN_RESET_LOGS, 0};
-  binlog_func_foreach(thd, &bfn);
-  return 0;
+  return binlog_func_foreach(thd, &bfn);
 }
 
-void ha_reset_slave(THD* thd)
+int ha_reset_slave(THD* thd)
 {
   binlog_func_st bfn= {BFN_RESET_SLAVE, 0};
-  binlog_func_foreach(thd, &bfn);
+  return binlog_func_foreach(thd, &bfn);
 }
 
 void ha_binlog_wait(THD* thd)
@@ -4263,15 +4264,13 @@ void ha_binlog_wait(THD* thd)
 int ha_binlog_end(THD* thd)
 {
   binlog_func_st bfn= {BFN_BINLOG_END, 0};
-  binlog_func_foreach(thd, &bfn);
-  return 0;
+  return binlog_func_foreach(thd, &bfn);
 }
 
 int ha_binlog_index_purge_file(THD *thd, const char *file)
 {
   binlog_func_st bfn= {BFN_BINLOG_PURGE_FILE, (void *)file};
-  binlog_func_foreach(thd, &bfn);
-  return 0;
+  return binlog_func_foreach(thd, &bfn);
 }
 
 struct binlog_log_query_st

=== modified file 'sql/handler.h'
--- a/sql/handler.h	2011-01-26 21:12:56 +0000
+++ b/sql/handler.h	2011-01-31 16:01:03 +0000
@@ -2607,7 +2607,7 @@ void trans_register_ha(THD *thd, bool al
 #ifdef HAVE_NDB_BINLOG
 int ha_reset_logs(THD *thd);
 int ha_binlog_index_purge_file(THD *thd, const char *file);
-void ha_reset_slave(THD *thd);
+int ha_reset_slave(THD *thd);
 void ha_binlog_log_query(THD *thd, handlerton *db_type,
                          enum_binlog_command binlog_command,
                          const char *query, uint query_length,
@@ -2615,12 +2615,13 @@ void ha_binlog_log_query(THD *thd, handl
 void ha_binlog_wait(THD *thd);
 int ha_binlog_end(THD *thd);
 #else
-#define ha_reset_logs(a) do {} while (0)
-#define ha_binlog_index_purge_file(a,b) do {} while (0)
-#define ha_reset_slave(a) do {} while (0)
+static inline int ha_int_dummy(void) { return 0; }
+#define ha_reset_logs(a) ha_int_dummy()
+#define ha_binlog_index_purge_file(a,b) ha_int_dummy()
+#define ha_reset_slave(a) ha_int_dummy()
 #define ha_binlog_log_query(a,b,c,d,e,f,g) do {} while (0)
 #define ha_binlog_wait(a) do {} while (0)
-#define ha_binlog_end(a)  do {} while (0)
+#define ha_binlog_end(a) ha_int_dummy()
 #endif
 
 const char *get_canonical_filename(handler *file, const char *path,

=== modified file 'sql/rpl_slave.cc'
--- a/sql/rpl_slave.cc	2011-01-24 03:58:22 +0000
+++ b/sql/rpl_slave.cc	2011-01-31 16:01:03 +0000
@@ -5789,7 +5789,8 @@ int reset_slave(THD *thd, Master_info* m
     goto err;
   }
 
-  ha_reset_slave(thd);
+  if ((error= ha_reset_slave(thd)))
+      goto err;
 
   // delete relay logs, clear relay log coordinates
   if ((error= mi->rli->purge_relay_logs(thd,

Attachment: [text/bzr-bundle] bzr/magnus.blaudd@oracle.com-20110131160103-67mw2wbqbsh4pqa9.bundle
Thread
bzr commit into mysql-trunk branch (magnus.blaudd:3580) Bug#59844Magnus Blåudd31 Jan