List:Commits« Previous MessageNext Message »
From:jonas Date:January 11 2008 11:00am
Subject:bk commit into 5.1 tree (jonas:1.2836) BUG#33802
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@stripped, 2008-01-11 12:00:11+01:00, jonas@stripped +3 -0
  ndb - bug#33802
    full var-pages was not released at drop-table, as they were not on any free-list
    (introduced by page-release push)

  storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp@stripped, 2008-01-11 12:00:10+01:00, jonas@stripped +2 -1
    Add a extra "free"-list for full-pages

  storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp@stripped, 2008-01-11 12:00:10+01:00, jonas@stripped +4 -5
    also release full pages

  storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp@stripped, 2008-01-11 12:00:10+01:00, jonas@stripped +36 -19
    put full pages in MAX_FREE_LIST-index
    this means that all pages is now on a list

diff -Nrup a/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp b/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp
--- a/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp	2007-12-14 16:20:18 +01:00
+++ b/storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp	2008-01-11 12:00:10 +01:00
@@ -726,7 +726,8 @@ struct Fragrecord {
   Uint32 fragTableId;
   Uint32 fragmentId;
   Uint32 nextfreefrag;
-  DLList<Page>::Head free_var_page_array[MAX_FREE_LIST];
+  // +1 is as "full" pages are stored last
+  DLList<Page>::Head free_var_page_array[MAX_FREE_LIST+1]; 
   
   DLList<ScanOp>::Head m_scanList;
 
diff -Nrup a/storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp b/storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp	2007-12-23 13:52:21 +01:00
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp	2008-01-11 12:00:10 +01:00
@@ -138,7 +138,7 @@ void Dbtup::execTUPFRAGREQ(Signal* signa
   regFragPtr.p->m_free_page_id_list = FREE_PAGE_RNIL;
   ndbrequire(regFragPtr.p->m_page_map.isEmpty());
   regFragPtr.p->m_restore_lcp_id = RNIL;
-  for (Uint32 i = 0; i<MAX_FREE_LIST; i++)
+  for (Uint32 i = 0; i<MAX_FREE_LIST+1; i++)
     ndbrequire(regFragPtr.p->free_var_page_array[i].isEmpty());
 
   if (ERROR_INSERTED(4007) && regTabPtr.p->fragid[0] == fragId ||
@@ -1876,7 +1876,7 @@ Dbtup::drop_fragment_free_var_pages(Sign
   ptrCheckGuard(fragPtr, cnoOfFragrec, fragrecord);
   
   PagePtr pagePtr;
-  for (Uint32 i = 0; i<MAX_FREE_LIST; i++)
+  for (Uint32 i = 0; i<MAX_FREE_LIST+1; i++)
   {
     if (! fragPtr.p->free_var_page_array[i].isEmpty())
     {
@@ -1945,10 +1945,9 @@ Dbtup::drop_fragment_free_pages(Signal* 
   return;
 
 done:
-  for (i = 0; i<MAX_FREE_LIST; i++)
+  for (i = 0; i<MAX_FREE_LIST+1; i++)
   {
-    LocalDLList<Page> tmp(c_page_pool, fragPtr.p->free_var_page_array[i]);
-    tmp.remove();
+    ndbassert(fragPtr.p->free_var_page_array[i].isEmpty());
   }
   
   {
diff -Nrup a/storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp b/storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp	2007-12-14 16:20:18 +01:00
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp	2008-01-11 12:00:10 +01:00
@@ -277,9 +277,11 @@ Dbtup::move_var_part(Fragrecord* fragPtr
 
   PagePtr new_pagePtr;
   new_pagePtr.i = RNIL;
-  for (int i = new_index; i < MAX_FREE_LIST; i++) {
+  for (int i = new_index; i < MAX_FREE_LIST; i++) 
+  {
     jam();
-    if (!fragPtr->free_var_page_array[i].isEmpty()) {
+    if (!fragPtr->free_var_page_array[i].isEmpty()) 
+    {
       jam();
       /**
        * get first page from free page list,
@@ -292,7 +294,8 @@ Dbtup::move_var_part(Fragrecord* fragPtr
   /**
    * do not move varpart if new var part page is same as old
    */
-  if (new_pagePtr.i != RNIL && new_pagePtr.i != pagePtr.i) {
+  if (new_pagePtr.i != RNIL && new_pagePtr.i != pagePtr.i) 
+  {
     jam();
     c_page_pool.getPtr(new_pagePtr);
 
@@ -325,14 +328,17 @@ Dbtup::move_var_part(Fragrecord* fragPtr
     /**
      * if the old page is empty, then reclaim it to global page pool
      */
-    if (unlikely(pageP->free_space == Var_page::DATA_WORDS - 1)) {
+    if (unlikely(pageP->free_space == Var_page::DATA_WORDS - 1)) 
+    {
       jam();
       Uint32 idx = pageP->list_index;
       LocalDLList<Page> list(c_page_pool, fragPtr->free_var_page_array[idx]);
       list.remove(pagePtr);
       returnCommonArea(pagePtr.i, 1);
       fragPtr->noOfVarPages --;
-    } else {
+    } 
+    else 
+    {
       jam();
       /**
        * update the old page into new free list after free_record
@@ -358,16 +364,21 @@ Dbtup::get_alloc_page(Fragrecord* fragPt
   PagePtr pagePtr;
   
   start_index= calculate_free_list_impl(alloc_size);
-  if (start_index == (MAX_FREE_LIST - 1)) {
+  if (start_index == (MAX_FREE_LIST - 1)) 
+  {
     jam();
-  } else {
+  } 
+  else 
+  {
     jam();
     ndbrequire(start_index < (MAX_FREE_LIST - 1));
     start_index++;
   }
-  for (i= start_index; i < MAX_FREE_LIST; i++) {
+  for (i= start_index; i < MAX_FREE_LIST; i++) 
+  {
     jam();
-    if (!fragPtr->free_var_page_array[i].isEmpty()) {
+    if (!fragPtr->free_var_page_array[i].isEmpty()) 
+    {
       jam();
       return fragPtr->free_var_page_array[i].firstItem;
     }
@@ -422,29 +433,35 @@ void Dbtup::update_free_page_list(Fragre
   if ((free_space < c_min_list_size[list_index]) ||
       (free_space > c_max_list_size[list_index])) {
     Uint32 new_list_index= calculate_free_list_impl(free_space);
-    if (list_index != MAX_FREE_LIST) {
-      jam();
-      /*
-       * Only remove it from its list if it is in a list
+
+    {
+      /**
+       * Remove from free list
        */
       LocalDLList<Page> 
-	list(c_page_pool, fragPtr->free_var_page_array[list_index]);
+        list(c_page_pool, fragPtr->free_var_page_array[list_index]);
       list.remove(pagePtr);
     }
-    if (free_space < c_min_list_size[new_list_index]) {
+    if (free_space < c_min_list_size[new_list_index])
+    {
       /*
 	We have not sufficient amount of free space to put it into any
 	free list. Thus the page will not be available for new inserts.
 	This can only happen for the free list with least guaranteed 
 	free space.
+
+        Put in on MAX_FREE_LIST-list (i.e full pages)
       */
       jam();
       ndbrequire(new_list_index == 0);
-      pagePtr.p->list_index= MAX_FREE_LIST;
-    } else {
-      jam();
+      new_list_index = MAX_FREE_LIST;
+      ndbout_c("free_space: %u new_list_index: %u c_min_list_size: %u",
+               free_space, new_list_index, c_min_list_size[new_list_index]);
+    }
+
+    {
       LocalDLList<Page> list(c_page_pool, 
-			     fragPtr->free_var_page_array[new_list_index]);
+                             fragPtr->free_var_page_array[new_list_index]);
       list.add(pagePtr);
       pagePtr.p->list_index = new_list_index;
     }
Thread
bk commit into 5.1 tree (jonas:1.2836) BUG#33802jonas11 Jan