List:Internals« Previous MessageNext Message »
From:jonas.oreland Date:July 12 2005 2:03pm
Subject:bk commit into 5.1 tree (joreland:1.1939)
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.1939 05/07/12 14:03:32 joreland@stripped +9 -0
  ndb diskdata -
    handle dropped table during undo excution
    add page types to pages
    improve page printer

  storage/ndb/src/kernel/blocks/tsman.cpp
    1.36 05/07/12 14:03:28 joreland@stripped +1 -0
    init page type

  storage/ndb/src/kernel/blocks/print_file.cpp
    1.9 05/07/12 14:03:28 joreland@stripped +32 -8
    improve printer

  storage/ndb/src/kernel/blocks/lgman.cpp
    1.47 05/07/12 14:03:28 joreland@stripped +2 -1
    init page type

  storage/ndb/src/kernel/blocks/diskpage.hpp
    1.22 05/07/12 14:03:27 joreland@stripped +9 -0
    enum for page types

  storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp
    1.12 05/07/12 14:03:27 joreland@stripped +1 -0
    printer for fix page

  storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp
    1.8 05/07/12 14:03:27 joreland@stripped +35 -1
    printer for fix page

  storage/ndb/src/kernel/blocks/dbtup/DbtupFixAlloc.cpp
    1.17 05/07/12 14:03:27 joreland@stripped +1 -0
    init page type

  storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp
    1.25 05/07/12 14:03:27 joreland@stripped +40 -26
    handle dropped table during undo excution

  storage/ndb/src/kernel/blocks/Makefile.am
    1.10 05/07/12 14:03:27 joreland@stripped +1 -1
    fix printer

# 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.(none)
# Root:	/home/jonas/src/mysql-5.1-ndb-dd

--- 1.24/storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp	2005-07-11 21:22:28 +02:00
+++ 1.25/storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp	2005-07-12 14:03:27 +02:00
@@ -984,37 +984,51 @@
     Uint32 fragId = pageP->m_fragment_id;
     
     f_undo.m_table_ptr.i= tableId;
-    ptrCheckGuard(f_undo.m_table_ptr, cnoOfTablerec, tablerec);
-    
-    getFragmentrec(f_undo.m_fragment_ptr, fragId, f_undo.m_table_ptr.p);
-    
-    if(!f_undo.m_fragment_ptr.p->m_undo_complete)
+    if(tableId < cnoOfTablerec)
     {
-      f_undo.m_page_ptr.i = page_id;
-      f_undo.m_page_ptr.p = pageP;
-      
-      ndbout_c("applying %lld", f_undo.m_lsn);
-      /**
-       * Apply undo record
-       */
-      switch(f_undo.m_type){
-      case File_formats::Undofile::UNDO_TUP_ALLOC:
-	disk_restart_undo_alloc(&f_undo);
-	break;
-      case File_formats::Undofile::UNDO_TUP_UPDATE:
-	disk_restart_undo_update(&f_undo);
-	break;
-      case File_formats::Undofile::UNDO_TUP_FREE:
-	disk_restart_undo_free(&f_undo);
-	break;
-      default:
-	ndbrequire(false);
+      ptrCheckGuard(f_undo.m_table_ptr, cnoOfTablerec, tablerec);
+
+      if(f_undo.m_table_ptr.p->tableStatus == DEFINED)
+      {
+	getFragmentrec(f_undo.m_fragment_ptr, fragId, f_undo.m_table_ptr.p);
+	
+        if(!f_undo.m_fragment_ptr.p->m_undo_complete)
+	{
+	  f_undo.m_page_ptr.i = page_id;
+	  f_undo.m_page_ptr.p = pageP;
+	  
+	  ndbout_c("applying %lld", f_undo.m_lsn);
+	  /**
+	   * Apply undo record
+	   */
+	  switch(f_undo.m_type){
+	  case File_formats::Undofile::UNDO_TUP_ALLOC:
+	    disk_restart_undo_alloc(&f_undo);
+	    break;
+	  case File_formats::Undofile::UNDO_TUP_UPDATE:
+	    disk_restart_undo_update(&f_undo);
+	    break;
+	  case File_formats::Undofile::UNDO_TUP_FREE:
+	    disk_restart_undo_free(&f_undo);
+	    break;
+	  default:
+	    ndbrequire(false);
+	  }
+	  lsn = f_undo.m_lsn - 1; // make sure undo isn't run again...
+	}
+	else
+	{
+	  ndbout_c("lsn %lld frag undo complete", f_undo.m_lsn);
+	}
+      }
+      else
+      {
+	ndbout_c("lsn %lld table not defined", f_undo.m_lsn);
       }
-      lsn = f_undo.m_lsn;
     }
     else
     {
-      ndbout_c("lsn %lld frag undo complete", f_undo.m_lsn);
+      ndbout_c("lsn %lld no such table", f_undo.m_lsn);
     }
   }
   else

--- 1.7/storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp	2005-04-30 13:42:57 +02:00
+++ 1.8/storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp	2005-07-12 14:03:27 +02:00
@@ -31,7 +31,7 @@
     assert(startTuple < DATA_WORDS);
     Uint32 next = m_data[startTuple] & 0xFFFF;
     next_free_index = endTuple + (next << 16);
-    assert(free_space > 0);
+    assert(free_space);
     free_space --;
     return startTuple;
   } else {
@@ -61,10 +61,12 @@
   m_data[freePageOffset + 1] = Dbtup::Tuple_header::FREE;
   
   if (endOfList == 0xFFFF) {
+    assert(free_space == 0);
     assert(startOfList == 0xFFFF);
     next_free_index = (freePageOffset << 16) + freePageOffset;
   } else {
     next_free_index = (freePageOffset << 16) + endOfList;
+    assert(free_space);
   }//if
   return ++free_space;
 }
@@ -76,6 +78,7 @@
   high_index= 1;
   insert_pos= 0;
   next_free_index= 0xFFFF;
+  m_page_header.m_page_type = File_formats::PT_Tup_varsize_page;
 }
 
 Uint32
@@ -252,6 +255,37 @@
     out << next << " " << flush;
     next= * (page.m_data+page.DATA_WORDS-next);
   }
+  out << "]";
+  return out;
+}
+
+NdbOut&
+operator<< (NdbOut& out, const Tup_fixsize_page& page)
+{
+  out << "[ Fixpage " << &page 
+      << ": frag_page: " << page.frag_page_id 
+      << " page_no: " << page.m_page_no 
+      << " file_no: " << page.m_file_no
+      << " table: " << page.m_table_id
+      << " fragment: " << page.m_fragment_id 
+      << " uncommitted_used_space: " << page.uncommitted_used_space 
+      << " free: " << page.free_space;
+  
+  out << " free list: " << hex << page.next_free_index << " "
<< flush;
+  Uint32 startTuple = page.next_free_index >> 16;
+  
+#if 0
+  Uint32 cnt = 0;
+  Uint32 next= startTuple;
+  while((next & 0xFFFF) != 0xFFFF)
+  {
+    cnt++;
+    out << dec << "(" << (next & 0xFFFF) << " " << hex
<< next << ") " << flush;
+    assert(page.m_data[(next & 0xFFFF) + 1] == Dbtup::Tuple_header::FREE);
+    next= * (page.m_data + ( next & 0xFFFF ));
+  }
+  assert(cnt == page.free_space);
+#endif
   out << "]";
   return out;
 }

--- 1.11/storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp	2005-04-30 13:42:57 +02:00
+++ 1.12/storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp	2005-07-12 14:03:27 +02:00
@@ -219,5 +219,6 @@
 };
 
 NdbOut& operator<< (NdbOut& out, const Tup_varsize_page& page);
+NdbOut& operator<< (NdbOut& out, const Tup_fixsize_page& page);
 
 #endif

--- 1.21/storage/ndb/src/kernel/blocks/diskpage.hpp	2005-07-11 21:22:28 +02:00
+++ 1.22/storage/ndb/src/kernel/blocks/diskpage.hpp	2005-07-12 14:03:27 +02:00
@@ -37,6 +37,15 @@
     Uint32 m_page_type;
   };
 
+  enum Page_type 
+  {
+    PT_Unallocated        = 0x0,
+    PT_Extent_page        = 0x1,
+    PT_Tup_fixsize_page   = 0x2,
+    PT_Tup_varsize_page   = 0x3,
+    PT_Undopage           = 0x4
+  };
+
   struct Zero_page_header
   {
     char   m_magic[8];

--- 1.46/storage/ndb/src/kernel/blocks/lgman.cpp	2005-07-12 08:31:19 +02:00
+++ 1.47/storage/ndb/src/kernel/blocks/lgman.cpp	2005-07-12 14:03:28 +02:00
@@ -422,6 +422,7 @@
       (File_formats::Undofile::Undo_page*)page_ptr.p;
     page->m_page_header.m_page_lsn_hi = 0;
     page->m_page_header.m_page_lsn_lo = 0;
+    page->m_page_header.m_page_type = File_formats::PT_Undopage;
     page->m_words_used = 0;
   }
 }
@@ -752,7 +753,7 @@
       signal->theData[0] = LgmanContinueB::FORCE_LOG_SYNC;
       signal->theData[1] = ptr.i;
       signal->theData[2] = lsn >> 32;
-      signal->theData[2] = lsn & 0xFFFFFFFF;
+      signal->theData[3] = lsn & 0xFFFFFFFF;
       m_lgman->sendSignalWithDelay(m_lgman->reference(), 
 				   GSN_CONTINUEB, signal, 10, 4);
     }

--- 1.8/storage/ndb/src/kernel/blocks/print_file.cpp	2005-04-30 13:42:59 +02:00
+++ 1.9/storage/ndb/src/kernel/blocks/print_file.cpp	2005-07-12 14:03:28 +02:00
@@ -20,12 +20,17 @@
 #include <UtilBuffer.hpp>
 #include "diskpage.hpp"
 #include <ndb_limits.h>
+#include <dbtup/tuppage.hpp>
 
-void print_usage(const char*);
-int print_zero_page(int, void *, Uint32 sz);
-int print_extent_page(int, void*, Uint32 sz);
-int print_undo_page(int, void*, Uint32 sz);
-int print_data_page(int, void*, Uint32 sz);
+static void print_usage(const char*);
+static int print_zero_page(int, void *, Uint32 sz);
+static int print_extent_page(int, void*, Uint32 sz);
+static int print_undo_page(int, void*, Uint32 sz);
+static int print_data_page(int, void*, Uint32 sz);
+static bool print_page(int page_no) 
+{ 
+  return false;
+}
 
 int g_verbosity = 1;
 int g_page_size = File_formats::PAGE_SIZE;
@@ -216,9 +221,28 @@
   ndbout << "Data page: " << count
 	 << ", lsn = [ " 
 	 << page->m_page_header.m_page_lsn_hi << " " 
-	 << page->m_page_header.m_page_lsn_lo << "]" 
-	 << endl;
-  
+	 << page->m_page_header.m_page_lsn_lo << "]" ;
+
+  if(g_verbosity > 1 || print_page(count))
+  {
+    switch(page->m_page_header.m_page_type){
+    case File_formats::PT_Unallocated:
+      break;
+    case File_formats::PT_Tup_fixsize_page:
+      ndbout << " fix ";
+      if(g_verbosity > 2 || print_page(count))
+	ndbout << (* (Tup_fixsize_page*)page);
+      break;
+    case File_formats::PT_Tup_varsize_page:
+      ndbout << " var ";
+      if(g_verbosity > 2 || print_page(count))
+	ndbout << endl << (* (Tup_varsize_page*)page);
+      break;
+    default:
+      ndbout << " unknown page type: %d" <<
page->m_page_header.m_page_type;
+    }
+  }
+  ndbout << endl;
   return 0;
 }
 

--- 1.35/storage/ndb/src/kernel/blocks/tsman.cpp	2005-07-11 14:47:50 +02:00
+++ 1.36/storage/ndb/src/kernel/blocks/tsman.cpp	2005-07-12 14:03:28 +02:00
@@ -481,6 +481,7 @@
       (File_formats::Datafile::Extent_page*)page_ptr.p;
     page->m_page_header.m_page_lsn_hi = 0;
     page->m_page_header.m_page_lsn_lo = 0;
+    page->m_page_header.m_page_type = File_formats::PT_Unallocated;
     
     for(Uint32 i = 0; i<per_page; i++)
     {

--- 1.16/storage/ndb/src/kernel/blocks/dbtup/DbtupFixAlloc.cpp	2005-04-29 16:30:26 +02:00
+++ 1.17/storage/ndb/src/kernel/blocks/dbtup/DbtupFixAlloc.cpp	2005-07-12 14:03:27 +02:00
@@ -142,6 +142,7 @@
   Uint32 startOfList = 0;
   regPagePtr->next_free_index= (startOfList << 16) + endOfList;
   regPagePtr->free_space= cnt;
+  regPagePtr->m_page_header.m_page_type = File_formats::PT_Tup_fixsize_page;
 }//Dbtup::convertThPage()
 
 Uint32

--- 1.9/storage/ndb/src/kernel/blocks/Makefile.am	2005-04-30 15:44:20 +02:00
+++ 1.10/storage/ndb/src/kernel/blocks/Makefile.am	2005-07-12 14:03:27 +02:00
@@ -22,7 +22,7 @@
 libblocks_a_SOURCES = tsman.cpp lgman.cpp pgman.cpp diskpage.cpp restore.cpp
 
 ndbtools_PROGRAMS = ndb_print_file
-ndb_print_file_SOURCES = print_file.cpp diskpage.cpp
+ndb_print_file_SOURCES = print_file.cpp diskpage.cpp dbtup/tuppage.cpp
 ndb_print_file_LDFLAGS = @ndb_bin_am_ldflags@ \
   $(top_builddir)/storage/ndb/src/libndbclient.la \
          $(top_builddir)/dbug/libdbug.a \
Thread
bk commit into 5.1 tree (joreland:1.1939)jonas.oreland12 Jul