[Commits] Rev 3012: Fixed bug in Maria page cache that caused assert if block->request != 0 in free_block() in lp:maria/5.1

Michael Widenius monty at askmonty.org
Wed Jan 12 01:50:56 EET 2011


At lp:maria/5.1

------------------------------------------------------------
revno: 3012
revision-id: monty at askmonty.org-20110111235056-ieelvtywtrz6xjf8
parent: monty at askmonty.org-20110111234834-sa6nr6ml6g2adh61
committer: Michael Widenius <monty at askmonty.org>
branch nick: maria-5.1
timestamp: Wed 2011-01-12 01:50:56 +0200
message:
  Fixed bug in Maria page cache that caused assert if block->request != 0 in free_block()
-------------- next part --------------
=== modified file 'storage/maria/ma_pagecache.c'
--- a/storage/maria/ma_pagecache.c	2010-12-04 11:15:16 +0000
+++ b/storage/maria/ma_pagecache.c	2011-01-11 23:50:56 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2008 MySQL AB
+/* Copyright (C) 2000-2008 MySQL AB, 2008-2011 Monty Program Ab
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -4187,6 +4187,7 @@ static void free_block(PAGECACHE *pageca
   DBUG_ASSERT(block->rlocks == 0);
   DBUG_ASSERT(block->rlocks_queue == 0);
   DBUG_ASSERT(block->pins == 0);
+  DBUG_ASSERT((block->status & ~(PCBLOCK_ERROR | PCBLOCK_READ | PCBLOCK_IN_FLUSH | PCBLOCK_CHANGED | PCBLOCK_REASSIGNED)) == 0);
   block->status= 0;
 #ifndef DBUG_OFF
   block->type= PAGECACHE_EMPTY_PAGE;
@@ -4515,6 +4516,7 @@ static int flush_pagecache_blocks_int(PA
           KEYCACHE_DBUG_ASSERT(count<= pagecache->blocks_used);
         }
       }
+      count++;    /* Allocate one extra for easy end-of-buffer test */
       /* Allocate a new buffer only if its bigger than the one we have */
       if (count > FLUSH_CACHE &&
           !(cache=
@@ -4552,22 +4554,24 @@ static int flush_pagecache_blocks_int(PA
         DBUG_ASSERT(filter_res == FLUSH_FILTER_OK);
       }
       {
+        DBUG_ASSERT(!(block->status & PCBLOCK_IN_FLUSH));
         /*
-           Mark the block with BLOCK_IN_FLUSH in order not to let
-           other threads to use it for new pages and interfere with
-           our sequence of flushing dirty file pages
+          We care only for the blocks for which flushing was not
+          initiated by other threads as a result of page swapping
         */
-        block->status|= PCBLOCK_IN_FLUSH;
-
         if (! (block->status & PCBLOCK_IN_SWITCH))
         {
-          /*
-            We care only for the blocks for which flushing was not
-            initiated by other threads as a result of page swapping
+          /*
+            Mark the block with BLOCK_IN_FLUSH in order not to let
+            other threads to use it for new pages and interfere with
+            our sequence of flushing dirty file pages
           */
+          block->status|= PCBLOCK_IN_FLUSH;
+
           reg_requests(pagecache, block, 1);
           if (type != FLUSH_IGNORE_CHANGED)
           {
+            *pos++= block;
             /* It's not a temporary file */
             if (pos == end)
             {
@@ -4587,7 +4591,6 @@ static int flush_pagecache_blocks_int(PA
               */
               goto restart;
             }
-            *pos++= block;
           }
           else
           {



More information about the commits mailing list