List:Commits« Previous MessageNext Message »
From:Pekka Nousiainen Date:November 26 2009 7:25pm
Subject:bzr commit into mysql-5.1-telco-6.2 branch (pekka:3043) Bug#48910
View as plain text  
#At file:///export/space/pekka/ndb/version/my51-bug48910/ based on revid:pekka@stripped

 3043 Pekka Nousiainen	2009-11-26
      bug#48910 06_pgman.diff
      Fix bug#48910 by using hot page count in lirs_reference().
      The bug could also deplete hot pages, making LIRS into LRU.

    modified:
      storage/ndb/src/kernel/blocks/pgman.cpp
=== modified file 'storage/ndb/src/kernel/blocks/pgman.cpp'
--- a/storage/ndb/src/kernel/blocks/pgman.cpp	2009-11-26 19:24:32 +0000
+++ b/storage/ndb/src/kernel/blocks/pgman.cpp	2009-11-26 19:25:10 +0000
@@ -122,6 +122,7 @@ Pgman::execREAD_CONFIG_REQ(Signal* signa
     m_param.m_max_pages = page_buffer;
     m_page_entry_pool.setSize(m_param.m_lirs_stack_mult * page_buffer);
     m_param.m_max_hot_pages = (page_buffer * 9) / 10;
+    ndbrequire(m_param.m_max_hot_pages >= 1);
   }
 
   Pool_context pc;
@@ -644,8 +645,10 @@ Pgman::lirs_reference(Ptr<Page_entry> pt
   Page_state state = ptr.p->m_state;
   ndbrequire(! (state & Page_entry::LOCKED));
 
-  // even non-LIRS cache pages are counted on l.h.s.
-  if (m_stats.m_num_pages >= m_param.m_max_hot_pages)
+  ndbrequire(m_stats.m_num_hot_pages <= m_param.m_max_hot_pages);
+
+  // LIRS kicks in when we have max hot pages
+  if (m_stats.m_num_hot_pages == m_param.m_max_hot_pages)
   {
     if (state & Page_entry::HOT)
     {
@@ -687,6 +690,12 @@ Pgman::lirs_reference(Ptr<Page_entry> pt
       jam();
       pl_stack.add(ptr);
       state |= Page_entry::ONSTACK;
+      /*
+       * bug#48910.  Using hot page count (not total page count)
+       * guarantees that stack is not empty here.  Therefore the new
+       * entry (added to top) is not at bottom and need not be hot.
+       */
+      ndbrequire(pl_stack.hasPrev(ptr));
       if (state & Page_entry::ONQUEUE)
       {
         jam();
@@ -710,8 +719,8 @@ Pgman::lirs_reference(Ptr<Page_entry> pt
   else
   {
 #ifdef VM_TRACE
-    debugOut << "PGMAN: filling up initial hot pages: "
-             << m_stats.m_num_pages << " of "
+    debugOut << "PGMAN: filling up hot pages: "
+             << m_stats.m_num_hot_pages << "/"
              << m_param.m_max_hot_pages << endl;
 #endif
     jam();


Attachment: [text/bzr-bundle] bzr/pekka@mysql.com-20091126192510-3ayn11khkeugirei.bundle
Thread
bzr commit into mysql-5.1-telco-6.2 branch (pekka:3043) Bug#48910Pekka Nousiainen26 Nov