List:Internals« Previous MessageNext Message »
From:jonas.oreland Date:April 28 2005 3:34pm
Subject:bk commit into 5.1-ndb tree (joreland:1.1878)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1-ndb 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.1878 05/04/28 15:34:49 joreland@stripped +2 -0
  wl1870 - ndb diskdata
  Add flushing of page cache after undo completion
    so that I don't need to undo undo.
  
  This might have to be improved in later versions

  ndb/src/kernel/blocks/lgman.hpp
    1.31 05/04/28 15:34:46 joreland@stripped +2 -1
    Add flushing of page cache after undo completion

  ndb/src/kernel/blocks/lgman.cpp
    1.39 05/04/28 15:34:46 joreland@stripped +56 -1
    Add flushing of page cache after undo completion

# 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.hemma.oreland.se.ndb.mysql.com
# Root:	/home/jonas/src/mysql-5.1-ndb-dd

--- 1.38/ndb/src/kernel/blocks/lgman.cpp	Thu Apr 28 14:50:06 2005
+++ 1.39/ndb/src/kernel/blocks/lgman.cpp	Thu Apr 28 15:34:46 2005
@@ -78,7 +78,9 @@
   addRecSignal(GSN_LCP_FRAG_ORD, &Lgman::execLCP_FRAG_ORD);
   addRecSignal(GSN_SUB_GCP_COMPLETE_REP, &Lgman::execSUB_GCP_COMPLETE_REP);
   addRecSignal(GSN_START_RECREQ, &Lgman::execSTART_RECREQ);
-
+  
+  addRecSignal(GSN_END_LCP_CONF, &Lgman::execEND_LCP_CONF);
+  
   m_last_lsn = 0;
   m_logfile_group_pool.setSize(10);
   m_logfile_group_hash.setSize(10);
@@ -2223,6 +2225,59 @@
     return;
   }
   
+  infoEvent("Flushing page cache after undo completion");
+  g_eventLogger.info("Flushing page cache after undo completion");
+
+  /**
+   * Start flushing pages (local, LCP)
+   */
+  LcpFragOrd * ord = (LcpFragOrd *)signal->getDataPtr();
+  ord->lcpId = m_latest_lcp;
+  sendSignal(PGMAN_REF, GSN_LCP_FRAG_ORD, signal, 
+	     LcpFragOrd::SignalLength, JBB);
+  
+  EndLcpReq* req= (EndLcpReq*)signal->getDataPtr();
+  req->senderRef = reference();
+  sendSignal(PGMAN_REF, GSN_END_LCP_REQ, signal, 
+	     EndLcpReq::SignalLength, JBB);
+}
+
+void
+Lgman::execEND_LCP_CONF(Signal* signal)
+{
+  /**
+   * pgman has completed flushing all pages
+   *
+   *   insert "fake" LCP record preventing undo to be "rerun"
+   */
+  Uint32 undo[3];
+  undo[0] = m_latest_lcp;
+  undo[1] = (0 << 16) | 0;
+  undo[2] = (File_formats::Undofile::UNDO_LCP_FIRST << 16 ) 
+    | (sizeof(undo) >> 2);
+  
+  Ptr<Logfile_group> ptr;
+  ndbrequire(m_logfile_group_list.first(ptr));
+
+  Uint64 last_lsn= m_last_lsn;
+  if(ptr.p->m_last_lsn == last_lsn)
+  {
+    undo[2] |= File_formats::Undofile::UNDO_NEXT_LSN << 16;
+    Uint32 *dst= get_log_buffer(ptr, sizeof(undo) >> 2);
+    memcpy(dst, undo, sizeof(undo));
+  }
+  else
+  {
+    Uint32 *dst= get_log_buffer(ptr, (sizeof(undo) >> 2) + 2);      
+    * dst++ = last_lsn >> 32;
+    * dst++ = last_lsn & 0xFFFFFFFF;
+    memcpy(dst, undo, sizeof(undo));
+  }
+  m_last_lsn = ptr.p->m_last_lsn = last_lsn + 1;
+  
+  infoEvent("Flushing complete");
+  g_eventLogger.info("Flushing complete");
+
   signal->theData[0] = reference();
   sendSignal(DBLQH_REF, GSN_START_RECCONF, signal, 1, JBB);
 }

--- 1.30/ndb/src/kernel/blocks/lgman.hpp	Thu Apr 28 06:54:53 2005
+++ 1.31/ndb/src/kernel/blocks/lgman.hpp	Thu Apr 28 15:34:46 2005
@@ -58,8 +58,9 @@
 
   void execLCP_FRAG_ORD(Signal*);
   void execSUB_GCP_COMPLETE_REP(Signal*);
-
+  
   void execSTART_RECREQ(Signal*);
+  void execEND_LCP_CONF(Signal*);
 public:
   struct Log_buffer_waiter
   {
Thread
bk commit into 5.1-ndb tree (joreland:1.1878)jonas.oreland28 Apr