List:Commits« Previous MessageNext Message »
From:tomas Date:September 6 2007 10:05pm
Subject:bk commit into 5.1 tree (tomas:1.2604) BUG#30877
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of tomas. When tomas does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-09-06 22:05:46+02:00, tomas@stripped +6 -0
  Bug #30877  	cluster: trailing event cannot be removed, and hence replication cannot be
setup

  sql/ha_ndbcluster_binlog.cc@stripped, 2007-09-06 22:05:43+02:00,
tomas@stripped +1 -1
    Bug #30877  	cluster: trailing event cannot be removed, and hence replication cannot
be setup

  storage/ndb/include/ndbapi/NdbDictionary.hpp@stripped, 2007-09-06 22:05:43+02:00,
tomas@stripped +1 -1
    Bug #30877  	cluster: trailing event cannot be removed, and hence replication cannot
be setup

  storage/ndb/src/ndbapi/NdbDictionary.cpp@stripped, 2007-09-06 22:05:43+02:00,
tomas@stripped +2 -2
    Bug #30877  	cluster: trailing event cannot be removed, and hence replication cannot
be setup

  storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp@stripped, 2007-09-06 22:05:43+02:00,
tomas@stripped +51 -23
    Bug #30877  	cluster: trailing event cannot be removed, and hence replication cannot
be setup

  storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp@stripped, 2007-09-06 22:05:43+02:00,
tomas@stripped +1 -1
    Bug #30877  	cluster: trailing event cannot be removed, and hence replication cannot
be setup

  storage/ndb/tools/restore/consumer_restore.cpp@stripped, 2007-09-06 22:05:43+02:00,
tomas@stripped +1 -1
    Bug #30877  	cluster: trailing event cannot be removed, and hence replication cannot
be setup

diff -Nrup a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc
--- a/sql/ha_ndbcluster_binlog.cc	2007-09-06 10:27:29 +02:00
+++ b/sql/ha_ndbcluster_binlog.cc	2007-09-06 22:05:43 +02:00
@@ -2980,7 +2980,7 @@ ndbcluster_create_event(Ndb *ndb, const 
       trailing event from before; an error, but try to correct it
     */
     if (dict->getNdbError().code == NDB_INVALID_SCHEMA_OBJECT &&
-        dict->dropEvent(my_event.getName()))
+        dict->dropEvent(my_event.getName(), 1))
     {
       if (push_warning > 1)
         push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
diff -Nrup a/storage/ndb/include/ndbapi/NdbDictionary.hpp
b/storage/ndb/include/ndbapi/NdbDictionary.hpp
--- a/storage/ndb/include/ndbapi/NdbDictionary.hpp	2007-07-12 12:01:52 +02:00
+++ b/storage/ndb/include/ndbapi/NdbDictionary.hpp	2007-09-06 22:05:43 +02:00
@@ -1845,7 +1845,7 @@ public:
      * @param eventName  Name of event to drop.
      * @return 0 if successful otherwise -1.
      */
-    int dropEvent(const char * eventName);
+    int dropEvent(const char * eventName, int force= 0);
     
     /**
      * Get event with given name.
diff -Nrup a/storage/ndb/src/ndbapi/NdbDictionary.cpp
b/storage/ndb/src/ndbapi/NdbDictionary.cpp
--- a/storage/ndb/src/ndbapi/NdbDictionary.cpp	2007-07-12 12:01:52 +02:00
+++ b/storage/ndb/src/ndbapi/NdbDictionary.cpp	2007-09-06 22:05:43 +02:00
@@ -1814,9 +1814,9 @@ NdbDictionary::Dictionary::createEvent(c
 }
 
 int 
-NdbDictionary::Dictionary::dropEvent(const char * eventName)
+NdbDictionary::Dictionary::dropEvent(const char * eventName, int force)
 {
-  return m_impl.dropEvent(eventName);
+  return m_impl.dropEvent(eventName, force);
 }
 
 const NdbDictionary::Event *
diff -Nrup a/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp
b/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp
--- a/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp	2007-08-20 18:09:42 +02:00
+++ b/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp	2007-09-06 22:05:43 +02:00
@@ -3660,7 +3660,7 @@ NdbDictionaryImpl::createEvent(NdbEventI
   // Create blob events
   if (evnt.m_mergeEvents && createBlobEvents(evnt) != 0) {
     int save_code = m_error.code;
-    (void)dropEvent(evnt.m_name.c_str());
+    (void)dropEvent(evnt.m_name.c_str(), 0);
     m_error.code = save_code;
     ERR_RETURN(getNdbError(), -1);
   }
@@ -4130,17 +4130,28 @@ NdbDictInterface::execSUB_START_REF(NdbA
  * Drop event
  */
 int 
-NdbDictionaryImpl::dropEvent(const char * eventName)
+NdbDictionaryImpl::dropEvent(const char * eventName, int force)
 {
   DBUG_ENTER("NdbDictionaryImpl::dropEvent");
-  DBUG_PRINT("info", ("name=%s", eventName));
+  DBUG_PRINT("enter", ("name:%s  force: %d", eventName, force));
 
-  NdbEventImpl *evnt = getEvent(eventName); // allocated
-  if (evnt == NULL) {
-    if (m_error.code != 723 && // no such table
-        m_error.code != 241)   // invalid table
-      DBUG_RETURN(-1);
-    DBUG_PRINT("info", ("no table err=%d, drop by name alone", m_error.code));
+  NdbEventImpl *evnt = NULL;
+  if (!force)
+  {
+    evnt = getEvent(eventName); // allocated
+    if (evnt == NULL)
+    {
+      if (m_error.code != 723 && // no such table
+          m_error.code != 241)   // invalid table
+      {
+        DBUG_PRINT("info", ("no table err=%d", m_error.code));
+        DBUG_RETURN(-1);
+      }
+      DBUG_PRINT("info", ("no table err=%d, drop by name alone", m_error.code));   
+    }
+  }
+  if (evnt == NULL)
+  {
     evnt = new NdbEventImpl();
     evnt->setName(eventName);
   }
@@ -4178,20 +4189,37 @@ NdbDictionaryImpl::dropBlobEvents(const 
       (void)dropEvent(*blob_evnt);
       delete blob_evnt;
     }
-  } else {
-    // loop over MAX_ATTRIBUTES_IN_TABLE ...
-    Uint32 i;
-    DBUG_PRINT("info", ("missing table definition, looping over "
-                        "MAX_ATTRIBUTES_IN_TABLE(%d)",
-                        MAX_ATTRIBUTES_IN_TABLE));
-    for (i = 0; i < MAX_ATTRIBUTES_IN_TABLE; i++) {
-      char bename[MAX_TAB_NAME_SIZE];
-      // XXX should get name from NdbBlob
-      sprintf(bename, "NDB$BLOBEVENT_%s_%u", evnt.getName(), i);
-      NdbEventImpl* bevnt = new NdbEventImpl();
-      bevnt->setName(bename);
-      (void)m_receiver.dropEvent(*bevnt);
-      delete bevnt;
+  }
+  else
+  {
+    DBUG_PRINT("info", ("no table definition, listing events"));
+    char bename[MAX_TAB_NAME_SIZE];
+    int val;
+    // XXX should get name from NdbBlob
+    sprintf(bename, "NDB$BLOBEVENT_%s_%s", evnt.getName(), "%d");
+    List list;
+    if (listEvents(list))
+      DBUG_RETURN(-1);
+    for (unsigned i = 0; i < list.count; i++)
+    {
+      NdbDictionary::Dictionary::List::Element& elt = list.elements[i];
+      switch (elt.type)
+      {
+      case NdbDictionary::Object::TableEvent:
+        if (sscanf(elt.name, bename, &val) == 1)
+        {
+          DBUG_PRINT("info", ("found blob event %s, removing...", elt.name));
+          NdbEventImpl* bevnt = new NdbEventImpl();
+          bevnt->setName(elt.name);
+          (void)m_receiver.dropEvent(*bevnt);
+          delete bevnt;
+        }
+        else
+          DBUG_PRINT("info", ("found event %s, skipping...", elt.name));
+        break;
+      default:
+        break;
+      }
     }
   }
   DBUG_RETURN(0);
diff -Nrup a/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp
b/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp
--- a/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp	2007-08-28 15:56:06 +02:00
+++ b/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp	2007-09-06 22:05:43 +02:00
@@ -628,7 +628,7 @@ public:
 
   int createEvent(NdbEventImpl &);
   int createBlobEvents(NdbEventImpl &);
-  int dropEvent(const char * eventName);
+  int dropEvent(const char * eventName, int force);
   int dropEvent(const NdbEventImpl &);
   int dropBlobEvents(const NdbEventImpl &);
   int listEvents(List& list);
diff -Nrup a/storage/ndb/tools/restore/consumer_restore.cpp
b/storage/ndb/tools/restore/consumer_restore.cpp
--- a/storage/ndb/tools/restore/consumer_restore.cpp	2007-09-05 15:22:20 +02:00
+++ b/storage/ndb/tools/restore/consumer_restore.cpp	2007-09-06 22:05:43 +02:00
@@ -1061,7 +1061,7 @@ BackupRestore::table(const TableS & tabl
 	{
 	  info << "Event for table " << table.getTableName()
 	       << " already exists, removing.\n";
-	  if (!dict->dropEvent(my_event.getName()))
+	  if (!dict->dropEvent(my_event.getName(), 1))
 	    continue;
 	}
 	err << "Create table event for " << table.getTableName() << " failed:
"
Thread
bk commit into 5.1 tree (tomas:1.2604) BUG#30877tomas6 Sep