List:Internals« Previous MessageNext Message »
From:jonas Date:August 25 2005 7:29am
Subject:bk commit into 5.1 tree (jonas:1.1971)
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.1971 05/08/25 09:29:08 jonas@eel.(none) +3 -0
  ndb diskdata
    fix some drop table / SR bugs

  storage/ndb/src/kernel/blocks/tsman.cpp
    1.42 05/08/25 09:29:04 jonas@eel.(none) +14 -6
    Check for table not defined during scanning of extent headers

  storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp
    1.28 05/08/25 09:29:04 jonas@eel.(none) +38 -29
    Check table status when during UNDO execution

  storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp
    1.78 05/08/25 09:29:04 jonas@eel.(none) +2 -2
    Return 0 if ok
          -1 if not ok (table not defined)

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

--- 1.27/storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp	2005-08-24 18:50:25 +02:00
+++ 1.28/storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp	2005-08-25 09:29:04 +02:00
@@ -1039,7 +1039,7 @@
   return lsn;
 }
   
-void
+int
 Dbtup::disk_restart_alloc_extent(Uint32 tableId, Uint32 fragId, 
 				 const Local_key* key, Uint32 pages)
 {
@@ -1047,32 +1047,38 @@
   FragrecordPtr fragPtr;
   tabPtr.i = tableId;
   ptrCheckGuard(tabPtr, cnoOfTablerec, tablerec);
-  getFragmentrec(fragPtr, fragId, tabPtr.p);
-  Disk_alloc_info& alloc= fragPtr.p->m_disk_alloc_info;
-  
-  Ptr<Extent_info> ext;
-  ndbrequire(c_extent_pool.seize(ext));
-  
-  ext.p->m_key = *key;
-  ndbout << "allocated " << pages << " pages: " << ext.p->m_key << endl;
-  bzero(ext.p->m_free_page_count, sizeof(ext.p->m_free_page_count));
-  ext.p->m_free_space= alloc.m_page_free_bits_map[0] * pages; 
-  ext.p->m_free_page_count[0]= pages; // All pages are "free"-est
-  
-  if (alloc.m_curr_extent_info_ptr_i != RNIL)
+  if (tabPtr.p->tableStatus == DEFINED)
   {
-    Ptr<Extent_info> old;
-    c_extent_pool.getPtr(old, alloc.m_curr_extent_info_ptr_i);
-    ndbassert(old.p->m_free_matrix_pos == RNIL);
-    Uint32 pos= alloc.calc_extent_pos(old.p);
-    Extent_list new_list(c_extent_pool, alloc.m_free_extents[pos]);
-    new_list.add(old);
-    old.p->m_free_matrix_pos= pos;
+    getFragmentrec(fragPtr, fragId, tabPtr.p);
+    Disk_alloc_info& alloc= fragPtr.p->m_disk_alloc_info;
+    
+    Ptr<Extent_info> ext;
+    ndbrequire(c_extent_pool.seize(ext));
+    
+    ext.p->m_key = *key;
+    ndbout << "allocated " << pages << " pages: " << ext.p->m_key << endl;
+    bzero(ext.p->m_free_page_count, sizeof(ext.p->m_free_page_count));
+    ext.p->m_free_space= alloc.m_page_free_bits_map[0] * pages; 
+    ext.p->m_free_page_count[0]= pages; // All pages are "free"-est
+    
+    if (alloc.m_curr_extent_info_ptr_i != RNIL)
+    {
+      Ptr<Extent_info> old;
+      c_extent_pool.getPtr(old, alloc.m_curr_extent_info_ptr_i);
+      ndbassert(old.p->m_free_matrix_pos == RNIL);
+      Uint32 pos= alloc.calc_extent_pos(old.p);
+      Extent_list new_list(c_extent_pool, alloc.m_free_extents[pos]);
+      new_list.add(old);
+      old.p->m_free_matrix_pos= pos;
+    }
+    
+    alloc.m_curr_extent_info_ptr_i = ext.i;
+    ext.p->m_free_matrix_pos = RNIL;
+    c_extent_hash.add(ext);
+    return 0;
   }
-  
-  alloc.m_curr_extent_info_ptr_i = ext.i;
-  ext.p->m_free_matrix_pos = RNIL;
-  c_extent_hash.add(ext);
+
+  return -1;
 }
 
 void
@@ -1220,10 +1226,13 @@
   tabPtr.i= tableId;
   ptrCheckGuard(tabPtr, cnoOfTablerec, tablerec);
   
-  FragrecordPtr fragPtr;
-  getFragmentrec(fragPtr, fragId, tabPtr.p);
-  
-  fragPtr.p->m_undo_complete = true;
+  if (tabPtr.p->tableStatus == DEFINED)
+  {
+    FragrecordPtr fragPtr;
+    getFragmentrec(fragPtr, fragId, tabPtr.p);
+    
+    fragPtr.p->m_undo_complete = true;
+  }
 }
 
 void

--- 1.41/storage/ndb/src/kernel/blocks/tsman.cpp	2005-08-24 18:50:25 +02:00
+++ 1.42/storage/ndb/src/kernel/blocks/tsman.cpp	2005-08-25 09:29:04 +02:00
@@ -895,7 +895,7 @@
     preq.m_page.m_page_no = page_no;
     preq.m_page.m_file_no = ptr.p->m_file_no;
     
-    int flags = 0;
+    int flags = Page_cache_client::DIRTY_REQ;
     int real_page_id = m_page_cache_client.get_page(signal, preq, flags);
     ndbrequire(real_page_id > 0);
 
@@ -930,12 +930,20 @@
 	key.m_page_no = 
 	  pages + 1 + size * (page_no * per_page + extent_no - per_page);
 	key.m_page_idx = page_no * per_page + extent_no;
-	tup->disk_restart_alloc_extent(tableId, fragmentId, &key, size);
-	for(Uint32 i = 0; i<size; i++, key.m_page_no++)
+	if(!tup->disk_restart_alloc_extent(tableId, fragmentId, &key, size))
 	{
-	  Uint32 bits= header->get_free_bits(i) & ~(1 << (SZ - 1));
-	  header->update_free_bits(i, bits);
-	  tup->disk_restart_page_bits(tableId, fragmentId, &key, 0, bits);
+	  for(Uint32 i = 0; i<size; i++, key.m_page_no++)
+	  {
+	    Uint32 bits= header->get_free_bits(i) & ~(1 << (SZ - 1));
+	    header->update_free_bits(i, bits);
+	    tup->disk_restart_page_bits(tableId, fragmentId, &key, 0, bits);
+	  }
+	}
+	else
+	{
+	  header->m_table = RNIL;
+	  header->m_next_free_extent = firstFree;
+	  firstFree = page_no * per_page + extent_no;
 	}
       }
     }

--- 1.77/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp	2005-08-24 18:50:25 +02:00
+++ 1.78/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp	2005-08-25 09:29:04 +02:00
@@ -2517,8 +2517,8 @@
 
   void disk_page_unmap_callback(Uint32 page_id);
   
-  void disk_restart_alloc_extent(Uint32 tableId, Uint32 fragId, 
-				 const Local_key* key, Uint32 pages);
+  int disk_restart_alloc_extent(Uint32 tableId, Uint32 fragId, 
+				const Local_key* key, Uint32 pages);
   void disk_restart_page_bits(Uint32 tableId, Uint32 fragId,
 			      const Local_key*, Uint32 old_bits, Uint32 bits);
   void disk_restart_undo(Signal* signal, Uint64 lsn,
Thread
bk commit into 5.1 tree (jonas:1.1971)jonas25 Aug