List:Commits« Previous MessageNext Message »
From:jonas Date:February 3 2006 2:30pm
Subject:bk commit into 5.1 tree (jonas:1.2131)
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.2131 06/02/03 15:30:24 jonas@stripped +4 -0
  ndb dd
    Fix a copule of dd bugs
      typo in lgman, potential run-time crash
      inconsistency in tup, potentially causing crash after SR

  storage/ndb/test/ndbapi/test_event.cpp
    1.17 06/02/03 15:30:21 jonas@stripped +2 -2
    Fix test_event

  storage/ndb/src/kernel/blocks/lgman.cpp
    1.8 06/02/03 15:30:21 jonas@stripped +49 -39
    Fix a couple of asserts
    Fix a typo causing unpredictable crash "&= ~x" was "&= x"

  storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp
    1.10 06/02/03 15:30:21 jonas@stripped +30 -8
    Fix so that extentPtr.p->m_free_space is updated after page is written first time
      plus a number of new asserts

  storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp
    1.37 06/02/03 15:30:21 jonas@stripped +1 -1
    Fix so that extentPtr.p->m_free_space is updated after page is written first time
      plus a number of new asserts

# 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-new

--- 1.9/storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp	2006-02-02 12:23:19 +01:00
+++ 1.10/storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp	2006-02-03 15:30:21 +01:00
@@ -231,6 +231,16 @@
 Dbtup::update_extent_pos(Disk_alloc_info& alloc, 
 			 Ptr<Extent_info> extentPtr)
 {
+#ifdef VM_TRACE
+  Uint32 min_free = 0;
+  for(Uint32 i = 0; i<MAX_FREE_LIST; i++)
+  {
+    Uint32 sum = alloc.calc_page_free_space(i);
+    min_free += sum * extentPtr.p->m_free_page_count[i];
+  }
+  ddassert(extentPtr.p->m_free_space >= min_free);
+#endif
+  
   Uint32 old = extentPtr.p->m_free_matrix_pos;
   if (old != RNIL)
   {
@@ -252,7 +262,7 @@
 }
 
 void
-Dbtup::restart_setup_page(Ptr<Page> pagePtr)
+Dbtup::restart_setup_page(Disk_alloc_info& alloc, Ptr<Page> pagePtr)
 {
   /**
    * Link to extent, clear uncommitted_used_space
@@ -266,7 +276,18 @@
   Ptr<Extent_info> extentPtr;
   ndbrequire(c_extent_hash.find(extentPtr, key));
   pagePtr.p->m_extent_info_ptr = extentPtr.i;
-}  
+
+  Uint32 idx = pagePtr.p->list_index & ~0x8000;
+  Uint32 estimated = alloc.calc_page_free_space(idx);
+  Uint32 real_free = pagePtr.p->free_space;
+
+  ddassert(real_free >= estimated);
+  if (real_free != estimated)
+  {
+    extentPtr.p->m_free_space += (real_free - estimated);
+    update_extent_pos(alloc, extentPtr);
+  }
+}
 
 
 /**
@@ -608,7 +629,7 @@
 
   if (unlikely(pagePtr.p->m_restart_seq != globalData.m_restart_seq))
   {
-    restart_setup_page(pagePtr);
+    restart_setup_page(fragPtr.p->m_disk_alloc_info, pagePtr);
   }
 
   disk_page_prealloc_callback_common(signal, req, fragPtr, pagePtr);
@@ -746,11 +767,6 @@
     return ;
   }
   
-  if (unlikely(pagePtr.p->m_restart_seq != globalData.m_restart_seq))
-  {
-    restart_setup_page(pagePtr);
-  }
-  
   Local_key key;
   key.m_page_no = pagePtr.p->m_page_no;
   key.m_file_no = pagePtr.p->m_file_no;
@@ -772,6 +788,12 @@
   getFragmentrec(fragPtr, pagePtr.p->m_fragment_id, tabPtr.p);
   
   Disk_alloc_info& alloc= fragPtr.p->m_disk_alloc_info;
+
+  if (unlikely(pagePtr.p->m_restart_seq != globalData.m_restart_seq))
+  {
+    restart_setup_page(alloc, pagePtr);
+  }
+  
   Tablespace_client tsman(0, c_tsman,
 			  fragPtr.p->fragTableId,
 			  fragPtr.p->fragmentId,

--- 1.7/storage/ndb/src/kernel/blocks/lgman.cpp	2006-02-03 10:53:38 +01:00
+++ 1.8/storage/ndb/src/kernel/blocks/lgman.cpp	2006-02-03 15:30:21 +01:00
@@ -1087,7 +1087,7 @@
        * Update free space with extra NOOP
        */
       ndbrequire(ptr.p->m_free_file_words >= free);
-      ndbrequire(ptr.p->m_free_buffer_words >= free);
+      ndbrequire(ptr.p->m_free_buffer_words > free);
       ptr.p->m_free_file_words -= free;
       ptr.p->m_free_buffer_words -= free;
       
@@ -1171,7 +1171,7 @@
   {
 next:
     // fits this page wo/ problem
-    ndbrequire(total_free >= sz);
+    ndbrequire(total_free > sz);
     ptr.p->m_free_buffer_words = total_free - sz;
     ptr.p->m_pos[PRODUCER].m_current_pos.m_idx = pos + sz;
     return ((File_formats::Undofile::Undo_page*)page)->m_data + pos;
@@ -1340,7 +1340,7 @@
 	
 	Uint32 free= File_formats::UNDO_PAGE_WORDS - pos.m_idx;
 
-	ndbout_c("force flush %d", free);
+	ndbout_c("force flush %d %d", pos.m_idx, ptr.p->m_free_buffer_words);
 	
 	ndbrequire(pos.m_idx); // don't flush empty page...
 	Uint64 lsn= ptr.p->m_last_lsn - 1;
@@ -1355,7 +1355,7 @@
 	 * Update free space with extra NOOP
 	 */
 	ndbrequire(ptr.p->m_free_file_words >= free);
-	ndbrequire(ptr.p->m_free_buffer_words >= free);
+	ndbrequire(ptr.p->m_free_buffer_words > free);
 	ptr.p->m_free_file_words -= free;
 	ptr.p->m_free_buffer_words -= free;
 	
@@ -1486,7 +1486,7 @@
 
   if(list.isEmpty())
   {
-    ptr.p->m_state &= (Uint32)Logfile_group::LG_WAITERS_THREAD;
+    ptr.p->m_state &= ~(Uint32)Logfile_group::LG_WAITERS_THREAD;
     return;
   }
   
@@ -1661,23 +1661,26 @@
   {
     Uint32 tot= 0;
     Uint64 lsn = 0;
-    LocalDLFifoList<Undofile> files(m_file_pool, lg_ptr.p->m_files);
-    while(cnt && ! (ptr.p->m_state & Undofile::FS_OUTSTANDING))
     {
-      Uint32 state= ptr.p->m_state;
-      Uint32 pages= ptr.p->m_online.m_outstanding;
-      ndbrequire(pages);
-      ptr.p->m_online.m_outstanding= 0;
-      ptr.p->m_state &= ~(Uint32)Undofile::FS_MOVE_NEXT;
-      tot += pages;
-      cnt--;
-      
-      lsn = ptr.p->m_online.m_lsn;
-
-      if((state & Undofile::FS_MOVE_NEXT) && !files.next(ptr))
-	files.first(ptr);
+      LocalDLFifoList<Undofile> files(m_file_pool, lg_ptr.p->m_files);
+      while(cnt && ! (ptr.p->m_state & Undofile::FS_OUTSTANDING))
+      {
+	Uint32 state= ptr.p->m_state;
+	Uint32 pages= ptr.p->m_online.m_outstanding;
+	ndbrequire(pages);
+	ptr.p->m_online.m_outstanding= 0;
+	ptr.p->m_state &= ~(Uint32)Undofile::FS_MOVE_NEXT;
+	tot += pages;
+	cnt--;
+	
+	lsn = ptr.p->m_online.m_lsn;
+	
+	if((state & Undofile::FS_MOVE_NEXT) && !files.next(ptr))
+	  files.first(ptr);
+      }
     }
     
+    ndbassert(tot);
     lg_ptr.p->m_outstanding_fs = cnt;
     lg_ptr.p->m_free_buffer_words += (tot * File_formats::UNDO_PAGE_WORDS);
     lg_ptr.p->m_next_reply_ptr_i = ptr.i;
@@ -1693,6 +1696,10 @@
       process_log_buffer_waiters(signal, lg_ptr);
     }
   }
+  else
+  {
+    ndbout_c("miss matched writes");
+  }
   
   return;
 }
@@ -3004,29 +3011,32 @@
 void 
 Lgman::validate_logfile_group(Ptr<Logfile_group> ptr, const char * heading)
 {
-  if (ptr.p->m_file_pos[HEAD].m_ptr_i == RNIL)
-    return;
-
-  Uint32 pages = compute_free_file_pages(ptr);
-
-  Uint32 group_pages = 
-    ((ptr.p->m_free_file_words + File_formats::UNDO_PAGE_WORDS - 1)/ File_formats::UNDO_PAGE_WORDS) ;
-  Uint32 last = ptr.p->m_free_file_words % File_formats::UNDO_PAGE_WORDS;
-  
-  if(! (pages >= group_pages))
+  do 
   {
-    ndbout << heading << " Tail: " << ptr.p->m_file_pos[TAIL] 
-	   << " Head: " << ptr.p->m_file_pos[HEAD] 
-	   << " free: " << group_pages << "(" << last << ")" 
-	   << " found: " << pages;
-    for(Uint32 i = 0; i<3; i++)
+    if (ptr.p->m_file_pos[HEAD].m_ptr_i == RNIL)
+      break;
+    
+    Uint32 pages = compute_free_file_pages(ptr);
+    
+    Uint32 group_pages = 
+      ((ptr.p->m_free_file_words + File_formats::UNDO_PAGE_WORDS - 1)/ File_formats::UNDO_PAGE_WORDS) ;
+    Uint32 last = ptr.p->m_free_file_words % File_formats::UNDO_PAGE_WORDS;
+    
+    if(! (pages >= group_pages))
     {
-      ndbout << " - " << ptr.p->m_tail_pos[i];
+      ndbout << heading << " Tail: " << ptr.p->m_file_pos[TAIL] 
+	     << " Head: " << ptr.p->m_file_pos[HEAD] 
+	     << " free: " << group_pages << "(" << last << ")" 
+	     << " found: " << pages;
+      for(Uint32 i = 0; i<3; i++)
+      {
+	ndbout << " - " << ptr.p->m_tail_pos[i];
+      }
+      ndbout << endl;
+      
+      ndbrequire(pages >= group_pages);
     }
-    ndbout << endl;
-
-    ndbrequire(pages >= group_pages);
-  }
+  } while(0);
 }
 #endif
 

--- 1.36/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp	2006-02-02 12:23:19 +01:00
+++ 1.37/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp	2006-02-03 15:30:21 +01:00
@@ -2632,7 +2632,7 @@
   void undo_createtable_callback(Signal* signal, Uint32 opPtrI, Uint32 unused);
 
   void disk_page_set_dirty(Ptr<Page>);
-  void restart_setup_page(Ptr<Page>);
+  void restart_setup_page(Disk_alloc_info&, Ptr<Page>);
   void update_extent_pos(Disk_alloc_info&, Ptr<Extent_info>);
   
   /**

--- 1.16/storage/ndb/test/ndbapi/test_event.cpp	2006-01-17 08:37:33 +01:00
+++ 1.17/storage/ndb/test/ndbapi/test_event.cpp	2006-02-03 15:30:21 +01:00
@@ -990,9 +990,9 @@
     while ((pOp= ndb->nextEvent()))
     {
       char buf[1024];
-      sprintf(buf, "%s_SHADOW", pOp->getTable()->getName());
+      sprintf(buf, "%s_SHADOW", pOp->getEvent()->getTable()->getName());
       const NdbDictionary::Table *table= dict->getTable(buf);
-
+      
       if (table == 0)
       {
 	g_err << "unable to find table " << buf << endl;
Thread
bk commit into 5.1 tree (jonas:1.2131)jonas3 Feb