List:Commits« Previous MessageNext Message »
From:jonas Date:January 3 2006 10:03am
Subject:bk commit into 5.1 tree (jonas:1.1983)
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.1983 06/01/03 11:03:25 jonas@stripped +1 -0
  ndb dd -
    Fix LCP with logfile group wo/ files

  storage/ndb/src/kernel/blocks/lgman.cpp
    1.4 06/01/03 11:03:22 jonas@stripped +58 -53
    Fix LCP with logfile group wo/ files

# 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:	jonas
# Host:	perch.ndb.mysql.com
# Root:	/home/jonas/src/51-ndb

--- 1.3/storage/ndb/src/kernel/blocks/lgman.cpp	2006-01-02 15:05:54 +01:00
+++ 1.4/storage/ndb/src/kernel/blocks/lgman.cpp	2006-01-03 11:03:22 +01:00
@@ -1649,7 +1649,7 @@
     sendSignal(reference(), GSN_CONTINUEB, signal, 2, JBB);
   }
   
-  if(!ptr.isNull())
+  if(!ptr.isNull() && ptr.p->m_last_lsn)
   {
     Uint32 undo[3];
     undo[0] = lcp_id;
@@ -1687,24 +1687,26 @@
   
   while(!ptr.isNull())
   {
-    /**
-     * First LCP_FRAGORD for each LCP, sets tail pos
-     */
-    if(m_latest_lcp != lcp_id)
-    {
-      ptr.p->m_tail_pos[0] = ptr.p->m_tail_pos[1];
-      ptr.p->m_tail_pos[1] = ptr.p->m_tail_pos[2];
-      ptr.p->m_tail_pos[2] = ptr.p->m_file_pos[HEAD];
+    if (ptr.p->m_last_lsn)
+    {
+      /**
+       * First LCP_FRAGORD for each LCP, sets tail pos
+       */
+      if(m_latest_lcp != lcp_id)
+      {
+	ptr.p->m_tail_pos[0] = ptr.p->m_tail_pos[1];
+	ptr.p->m_tail_pos[1] = ptr.p->m_tail_pos[2];
+	ptr.p->m_tail_pos[2] = ptr.p->m_file_pos[HEAD];
+      }
+      
+      if(0)
+	ndbout_c
+	  ("execLCP_FRAG_ORD (%d %d) (%d %d) (%d %d) free pages: %d", 
+	   ptr.p->m_tail_pos[0].m_ptr_i, ptr.p->m_tail_pos[0].m_idx,
+	   ptr.p->m_tail_pos[1].m_ptr_i, ptr.p->m_tail_pos[1].m_idx,
+	   ptr.p->m_tail_pos[2].m_ptr_i, ptr.p->m_tail_pos[2].m_idx,
+	   (ptr.p->m_free_file_words / File_formats::UNDO_PAGE_WORDS));
     }
-    
-    if(0)
-      ndbout_c
-	("execLCP_FRAG_ORD (%d %d) (%d %d) (%d %d) free pages: %d", 
-	 ptr.p->m_tail_pos[0].m_ptr_i, ptr.p->m_tail_pos[0].m_idx,
-	 ptr.p->m_tail_pos[1].m_ptr_i, ptr.p->m_tail_pos[1].m_idx,
-	 ptr.p->m_tail_pos[2].m_ptr_i, ptr.p->m_tail_pos[2].m_idx,
-	 (ptr.p->m_free_file_words / File_formats::UNDO_PAGE_WORDS));
-    
     m_logfile_group_list.next(ptr);
   }
   
@@ -1762,47 +1764,50 @@
 void
 Lgman::cut_log_tail(Signal* signal, Ptr<Logfile_group> ptr)
 {
-  Buffer_idx tmp= ptr.p->m_tail_pos[0];
-  Buffer_idx tail= ptr.p->m_file_pos[TAIL];
-
-  Ptr<Undofile> filePtr;
-  m_file_pool.getPtr(filePtr, tail.m_ptr_i);
-  
   bool done= true;
-  if(!(tmp == tail))
+  if (likely(ptr.p->m_last_lsn))
   {
-    Uint32 free;
-    if(tmp.m_ptr_i == tail.m_ptr_i && tail.m_idx < tmp.m_idx)
-    {
-      free= tmp.m_idx - tail.m_idx; 
-      ptr.p->m_free_file_words += free * File_formats::UNDO_PAGE_WORDS;
-      ptr.p->m_file_pos[TAIL] = tmp;
-    }
-    else
+    Buffer_idx tmp= ptr.p->m_tail_pos[0];
+    Buffer_idx tail= ptr.p->m_file_pos[TAIL];
+    
+    Ptr<Undofile> filePtr;
+    m_file_pool.getPtr(filePtr, tail.m_ptr_i);
+    
+    if(!(tmp == tail))
     {
-      free= filePtr.p->m_file_size - tail.m_idx - 1;
-      ptr.p->m_free_file_words += free * File_formats::UNDO_PAGE_WORDS;
-      
-      Ptr<Undofile> next = filePtr;
-      LocalDLFifoList<Undofile> files(m_file_pool, ptr.p->m_files);
-      while(files.next(next) && (next.p->m_state & Undofile::FS_EMPTY))
-	ndbassert(next.i != filePtr.i);
-      if(next.isNull())
+      Uint32 free;
+      if(tmp.m_ptr_i == tail.m_ptr_i && tail.m_idx < tmp.m_idx)
+      {
+	free= tmp.m_idx - tail.m_idx; 
+	ptr.p->m_free_file_words += free * File_formats::UNDO_PAGE_WORDS;
+	ptr.p->m_file_pos[TAIL] = tmp;
+      }
+      else
       {
-	jam();
-	files.first(next);
-	while((next.p->m_state & Undofile::FS_EMPTY) && files.next(next))
+	free= filePtr.p->m_file_size - tail.m_idx - 1;
+	ptr.p->m_free_file_words += free * File_formats::UNDO_PAGE_WORDS;
+	
+	Ptr<Undofile> next = filePtr;
+	LocalDLFifoList<Undofile> files(m_file_pool, ptr.p->m_files);
+	while(files.next(next) && (next.p->m_state & Undofile::FS_EMPTY))
 	  ndbassert(next.i != filePtr.i);
+	if(next.isNull())
+	{
+	  jam();
+	  files.first(next);
+	  while((next.p->m_state & Undofile::FS_EMPTY) && files.next(next))
+	    ndbassert(next.i != filePtr.i);
+	}
+	
+	tmp.m_idx= 0;
+	tmp.m_ptr_i= next.i;
+	ptr.p->m_file_pos[TAIL] = tmp;
+	done= false;      
       }
-      
-      tmp.m_idx= 0;
-      tmp.m_ptr_i= next.i;
-      ptr.p->m_file_pos[TAIL] = tmp;
-      done= false;      
-    }
-  } 
-
-  validate_logfile_group(ptr, "cut log");
+    } 
+    
+    validate_logfile_group(ptr, "cut log");
+  }
   
   if (done)
   {
Thread
bk commit into 5.1 tree (jonas:1.1983)jonas3 Jan