List:Internals« Previous MessageNext Message »
From:jonas.oreland Date:May 26 2005 8:38am
Subject:bk commit into 5.1 tree (joreland:1.1885)
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.1885 05/05/26 10:38:31 joreland@stripped +4 -0
  wl1445 - ndb - events
    Impl. simple/stupid handling of "out of buffer"
    1) Stop buffering
    2) release all buffers
    3) reenable buffering
  
    Node failure inbetween will cause inconsistent stream.

  storage/ndb/src/kernel/blocks/suma/SumaInit.cpp
    1.19 05/05/26 10:38:27 joreland@stripped +1 -0
    Out of buffer release

  storage/ndb/src/kernel/blocks/suma/Suma.hpp
    1.18 05/05/26 10:38:27 joreland@stripped +4 -1
    Out of buffer release

  storage/ndb/src/kernel/blocks/suma/Suma.cpp
    1.40 05/05/26 10:38:27 joreland@stripped +84 -9
    Out of buffer release

  storage/ndb/include/kernel/signaldata/SumaImpl.hpp
    1.12 05/05/26 10:38:27 joreland@stripped +1 -0
    Out of buffer release

# 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.11/storage/ndb/include/kernel/signaldata/SumaImpl.hpp	Mon May 23 15:53:01 2005
+++ 1.12/storage/ndb/include/kernel/signaldata/SumaImpl.hpp	Thu May 26 10:38:27 2005
@@ -518,6 +518,7 @@
   {
     RESEND_BUCKET = 1
     ,RELEASE_GCI = 2
+    ,OUT_OF_BUFFER_RELEASE = 3
   };
 };
 

--- 1.39/storage/ndb/src/kernel/blocks/suma/Suma.cpp	Tue May 24 15:44:27 2005
+++ 1.40/storage/ndb/src/kernel/blocks/suma/Suma.cpp	Thu May 26 10:38:27 2005
@@ -452,10 +452,12 @@
 		  signal->theData[3],
 		  signal->theData[4]);
     return;
+  case SumaContinueB::OUT_OF_BUFFER_RELEASE:
+    out_of_buffer_release(signal, signal->theData[1]);
+    return;
   }
 }
 
-
 /*****************************************************************************
  * 
  * Node state handling
@@ -2993,7 +2995,6 @@
   f_bufferLock = 0;
   b_bufferLock = 0;
 
-
   Uint32 bucket= hashValue % c_no_of_buckets;
   m_max_seen_gci = (gci > m_max_seen_gci ? gci : m_max_seen_gci);
   if(m_active_buckets.get(bucket) || 
@@ -3035,7 +3036,7 @@
   {
     Uint32* dst;
     Uint32 sz = f_trigBufferSize + b_trigBufferSize + 2;
-    if((dst = get_buffer_ptr(bucket, gci, sz)))
+    if((dst = get_buffer_ptr(signal, bucket, gci, sz)))
     {
       * dst++ = tabPtr.i;
       * dst++ = (event << 16) | f_trigBufferSize;
@@ -3161,12 +3162,15 @@
     if(c_buckets[i].m_buffer_tail != RNIL)
     {
       Uint32* dst;
-      if((dst= get_buffer_ptr(i, gci, 0)) == 0)
-      {
-	ndbrequire(false);
-      }
+      get_buffer_ptr(signal, i, gci, 0);
     }
   }
+
+  if(gci == m_out_of_buffer_gci)
+  {
+    infoEvent("Reenable event buffer");
+    m_out_of_buffer_gci = 0;
+  }
 }
 
 void
@@ -4000,7 +4004,7 @@
 }
 
 Uint32*
-Suma::get_buffer_ptr(Uint32 buck, Uint32 gci, Uint32 sz)
+Suma::get_buffer_ptr(Signal* signal, Uint32 buck, Uint32 gci, Uint32 sz)
 {
   sz += 1; // len
   Bucket* bucket= c_buckets+buck;
@@ -4042,7 +4046,11 @@
     Uint32 next;
     if(unlikely((next= seize_page()) == RNIL))
     {
-      ndbrequire(false);
+      /**
+       * Out of buffer
+       */
+      out_of_buffer(signal);
+      return 0;
     }
     
     if(likely(pos.m_page_id != RNIL))
@@ -4068,9 +4076,69 @@
   }
 }
 
+void
+Suma::out_of_buffer(Signal* signal)
+{
+  if(m_out_of_buffer_gci)
+  {
+    return;
+  }
+  
+  m_out_of_buffer_gci = m_last_complete_gci - 1;
+  infoEvent("Out of event buffer: nodefailure will cause event failures");
+
+  signal->theData[0] = SumaContinueB::OUT_OF_BUFFER_RELEASE;
+  signal->theData[1] = 0;
+  sendSignal(SUMA_REF, GSN_CONTINUEB, signal, 2, JBB);
+}
+
+void
+Suma::out_of_buffer_release(Signal* signal, Uint32 buck)
+{
+  Bucket* bucket= c_buckets+buck;
+  Uint32 tail= bucket->m_buffer_tail;
+  
+  if(tail != RNIL)
+  {
+    Buffer_page* page= (Buffer_page*)(m_tup->page+tail);
+    bucket->m_buffer_tail = page->m_next_page;
+    free_page(tail, page);
+    signal->theData[0] = SumaContinueB::OUT_OF_BUFFER_RELEASE;
+    signal->theData[1] = buck;
+    sendSignal(SUMA_REF, GSN_CONTINUEB, signal, 2, JBB);
+    return;
+  }
+
+  /**
+   * Clear head
+   */
+  bucket->m_buffer_head.m_page_id = RNIL;
+  bucket->m_buffer_head.m_page_pos = Buffer_page::DATA_WORDS;
+  
+  buck++;
+  if(buck != c_no_of_buckets)
+  {
+    signal->theData[0] = SumaContinueB::OUT_OF_BUFFER_RELEASE;
+    signal->theData[1] = buck;
+    sendSignal(SUMA_REF, GSN_CONTINUEB, signal, 2, JBB);
+    return;
+  }
+
+  /**
+   * Finished will all release
+   *   prepare for inclusion
+   */
+  m_out_of_buffer_gci = m_max_seen_gci > m_last_complete_gci 
+    ? m_max_seen_gci + 1 : m_last_complete_gci + 1;
+}
+
 Uint32
 Suma::seize_page()
 {
+  if(unlikely(m_out_of_buffer_gci))
+  {
+    return RNIL;
+  }
 loop:
   Ptr<Page_chunk> ptr;
   Uint32 ref= m_first_free_page;
@@ -4194,6 +4262,13 @@
 Suma::start_resend(Signal* signal, Uint32 buck)
 {
   printf("start_resend(%d, ", buck);
+  
+  if(m_out_of_buffer_gci)
+  {
+    progError(__LINE__, ERR_SYSTEM_ERROR, 
+	      "Nodefailure while out of event buffer");
+    return;
+  }
   
   /**
    * Resend from m_max_acked_gci + 1 until max_gci + 1

--- 1.17/storage/ndb/src/kernel/blocks/suma/Suma.hpp	Tue May 24 15:44:27 2005
+++ 1.18/storage/ndb/src/kernel/blocks/suma/Suma.hpp	Thu May 26 10:38:27 2005
@@ -560,9 +560,11 @@
   
   class Dbtup* m_tup;
   void init_buffers();
-  Uint32* get_buffer_ptr(Uint32 buck, Uint32 gci, Uint32 sz);
+  Uint32* get_buffer_ptr(Signal*, Uint32 buck, Uint32 gci, Uint32 sz);
   Uint32 seize_page();
   void free_page(Uint32 page_id, Buffer_page* page);
+  void out_of_buffer(Signal*);
+  void out_of_buffer_release(Signal* signal, Uint32 buck);
 
   void start_resend(Signal*, Uint32 bucket);
   void resend_bucket(Signal*, Uint32 bucket, Uint32 gci, 
@@ -572,6 +574,7 @@
   Uint32 m_max_seen_gci;      // FIRE_TRIG_ORD
   Uint32 m_max_sent_gci;      // FIRE_TRIG_ORD -> send
   Uint32 m_last_complete_gci; // SUB_GCP_COMPLETE_REP
+  Uint32 m_out_of_buffer_gci;
   Uint32 m_gcp_complete_rep_count;
 
   struct Gcp_record 

--- 1.18/storage/ndb/src/kernel/blocks/suma/SumaInit.cpp	Wed May 25 18:18:07 2005
+++ 1.19/storage/ndb/src/kernel/blocks/suma/SumaInit.cpp	Thu May 26 10:38:27 2005
@@ -175,6 +175,7 @@
   m_max_sent_gci = 0;      // FIRE_TRIG_ORD -> send
   m_last_complete_gci = 0; // SUB_GCP_COMPLETE_REP
   m_gcp_complete_rep_count = 0;
+  m_out_of_buffer_gci = 0;
  
   c_startup.m_wait_handover= false; 
   c_failedApiNodes.clear();
Thread
bk commit into 5.1 tree (joreland:1.1885)jonas.oreland26 May