List:Internals« Previous MessageNext Message »
From:jonas.oreland Date:May 26 2005 7:01am
Subject:bk commit into 5.1 tree (joreland:1.1884)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of jonas. When jonas 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
  1.1884 05/05/26 09:01:52 joreland@stripped +1 -0
  ndb -
  Fix cluster failure wrt Events

  storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp
    1.54 05/05/26 09:01:47 joreland@stripped +88 -9
    Fix cluster failure wrt Events

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	joreland
# Host:	eel.ndb.mysql.com.ndb.mysql.com
# Root:	/home/jonas/src/mysql-5.1-wl2325

--- 1.53/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp	Wed May 25 18:18:07 2005
+++ 1.54/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp	Thu May 26 09:01:47 2005
@@ -939,7 +939,6 @@
 NdbEventBuffer::reportClusterFailed(NdbEventOperationImpl *op)
 {
   DBUG_ENTER("NdbEventBuffer::reportClusterFailed");
-  abort();
   DBUG_VOID_RETURN;
 }
 
@@ -947,17 +946,97 @@
 NdbEventBuffer::completeClusterFailed()
 {
   DBUG_ENTER("NdbEventBuffer::completeClusterFailed");
-  abort();
-#if 0
-  if (m_received_data_gci)
+
+  SubTableData data;
+  LinearSectionPtr ptr[3];
+  bzero(&data, sizeof(data));
+  bzero(ptr, sizeof(ptr));
+
+  data.tableId = ~0;
+  data.operation = NdbDictionary::Event::_TE_CLUSTER_FAILURE;
+  data.logType = SubTableData::LOG;
+
+  /**
+   * Find min not completed GCI
+   */
+  Uint32 sz= m_active_gci.size();
+  Uint64 gci= ~0;
+  Gci_container* bucket = 0;
+  Gci_container* array = m_active_gci.getBase();
+  for(Uint32 i = 0; i<sz; i++)
   {
-    // all event operations have received cluster failure
-    // set m_latestGCI to the corresponding gci to indicate complete
-    m_latestGCI= m_received_data_gci;
-    NdbCondition_Signal(p_cond);
-    DBUG_PRINT("exit",("m_latestGCI: %lld", m_latestGCI));
+    if(array[i].m_gcp_complete_rep_count && array[i].m_gci < gci)
+    {
+      bucket= array + i;
+      gci = bucket->m_gci;
+    }
   }
+
+  if(bucket == 0)
+  {
+    /**
+     * Did not find any not completed GCI's
+     *   lets fake one...
+     */
+    gci = m_latestGCI > m_waitGCI ? m_latestGCI + 1 : m_waitGCI;
+    bucket = array + ( gci & ACTIVE_GCI_MASK );
+    bucket->m_gcp_complete_rep_count = 1;
+  }
+  
+  const Uint32 cnt= bucket->m_gcp_complete_rep_count;
+
+  /**
+   * Release all GCI's
+   */
+  for(Uint32 i = 0; i<sz; i++)
+  {
+    Gci_container* tmp = array + i;
+    if(tmp->m_head)
+    {
+      tmp->m_tail->m_next = m_free_data;
+      m_free_data= tmp->m_head;
+
+#ifdef VM_TRACE
+      m_free_data_count += tmp->m_event_count;
+#else
+      m_free_data_count++;
+      EventBufData* loop= tmp->m_head;
+      while(loop != tmp->m_tail)
+      {
+	m_free_data_count++;
+	loop = loop->m_next;
+      }
 #endif
+    }
+    bzero(tmp, sizeof(Gci_container));
+  }
+  
+  bucket->m_gci = gci;
+  bucket->m_gcp_complete_rep_count = cnt;
+  
+  data.gci = gci;
+  
+  /**
+   * Insert this event for each operation
+   */
+  NdbEventOperation* op= 0;
+  while((op = m_ndb->getEventOperation(op)))
+  {
+    NdbEventOperationImpl* impl= &op->m_impl;
+    data.senderData = impl->m_oid;
+    insertDataL(impl, &data, ptr); 
+  }
+  
+  /**
+   * And finally complete this GCI
+   */
+  latestGCI(gci, cnt);
+
+  /**
+   * And reset m_latestGCI
+   */
+  m_latestGCI = 0;  
+
   DBUG_VOID_RETURN;
 }
 
Thread
bk commit into 5.1 tree (joreland:1.1884)jonas.oreland26 May