List:Commits« Previous MessageNext Message »
From:Magnus Blåudd Date:February 9 2011 11:15am
Subject:bzr commit into mysql-5.5-telco-7.0 branch (magnus.blaudd:3197)
View as plain text  
#At file:///home/msvensson/mysql/5.5-telco-7.0-run-query/ based on revid:magnus.blaudd@strippedtwes7p4ebntmrvw

 3197 Magnus Blåudd	2011-02-09
      ndb
       - Use the new Ndb_local_connection class to truncate mysql.ndb_binlog_index
         table in 'ndbcluster_reset_logs'
       - Remove old unimplemented mysql_truncate_table wrapper from glue

    modified:
      sql/ha_ndbcluster_binlog.cc
      sql/ha_ndbcluster_glue.h
=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc	2011-02-09 07:58:07 +0000
+++ b/sql/ha_ndbcluster_binlog.cc	2011-02-09 11:15:47 +0000
@@ -21,6 +21,7 @@
 #ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
 #include "ha_ndbcluster.h"
 #include "ha_ndbcluster_connection.h"
+#include "ndb_local_connection.h"
 
 #include "rpl_injector.h"
 #include "rpl_filter.h"
@@ -54,8 +55,6 @@ bool ndb_log_empty_epochs(void);
 #include "ha_ndbcluster_tables.h"
 #define NDB_APPLY_TABLE_FILE "./" NDB_REP_DB "/" NDB_APPLY_TABLE
 #define NDB_SCHEMA_TABLE_FILE "./" NDB_REP_DB "/" NDB_SCHEMA_TABLE
-static char repdb[]= NDB_REP_DB;
-static char reptable[]= NDB_REP_TABLE;
 
 /*
   Timeout for syncing schema events between
@@ -602,33 +601,18 @@ static int ndbcluster_reset_logs(THD *th
   ndbcluster_binlog_wait(thd);
 
   /*
-    Could use run_query() here, but it is actually wrong,
-    see comment in run_query()
+    Truncate mysql.ndb_binlog_index table, if table does not
+    exist ignore the error as it is a "consistent" behavior
   */
-  TABLE_LIST table;
-  bzero((char*) &table, sizeof(table));
-  table.db= repdb;
-  table.alias= table.table_name= reptable;
-  mysql_truncate_table(thd, &table);
-
-  /*
-    Calling function only expects and handles error cases,
-    so reset state if not an error as not to hit asserts
-    in upper layers
-  */
-  while (thd_stmt_da(thd)->is_error())
+  Ndb_local_connection mysqld(thd);
+  const bool ignore_no_such_table = true;
+  if(mysqld.truncate_table(STRING_WITH_LEN("mysql"),
+                           STRING_WITH_LEN("ndb_binlog_index"),
+                           ignore_no_such_table))
   {
-    if (thd_stmt_da(thd)->sql_errno() == ER_NO_SUCH_TABLE)
-    {
-      /*
-        If table does not exist ignore the error as it
-        is a consistant behavior
-      */
-      break;
-    }
+    // Failed to truncate table
     DBUG_RETURN(1);
   }
-  thd_stmt_da(thd)->reset_diagnostics_area();
   DBUG_RETURN(0);
 }
 

=== modified file 'sql/ha_ndbcluster_glue.h'
--- a/sql/ha_ndbcluster_glue.h	2011-02-04 09:45:35 +0000
+++ b/sql/ha_ndbcluster_glue.h	2011-02-09 11:15:47 +0000
@@ -38,7 +38,6 @@
 #include "transaction.h"
 #include "sql_test.h"       // print_where
 #include "sql_parse.h"      // mysql_parse
-#include "sql_truncate.h"   // mysql_truncate_table
 #include "key.h"            // key_restore
 #else
 #include "mysql_priv.h"
@@ -295,19 +294,6 @@ uint partition_info_num_subparts(const p
 #endif
 }
 
-/*  mysql_truncate_table emulation */
-static inline
-bool mysql_truncate_table(THD *thd, TABLE_LIST *table_ref)
-{
-#if MYSQL_VERSION_ID < 50500
-  return mysql_truncate(thd, table_ref, 0);
-#else
-  /* mysql_truncate support removed in 5.5.7 */
-  abort();
-  return false;
-#endif
-}
-
 #if MYSQL_VERSION_ID >= 50600
 
 /* New multi range read interface replaced original mrr */

Attachment: [text/bzr-bundle] bzr/magnus.blaudd@oracle.com-20110209111547-u1mqwirwb5h954bs.bundle
Thread
bzr commit into mysql-5.5-telco-7.0 branch (magnus.blaudd:3197) Magnus Blåudd9 Feb