[Commits] Rev 3134: FIX for LP bug#956079 in file:///home/bell/maria/bzr/work-maria-5.2-lpb956079/

sanja at montyprogram.com sanja at montyprogram.com
Wed Apr 4 16:34:15 EEST 2012


At file:///home/bell/maria/bzr/work-maria-5.2-lpb956079/

------------------------------------------------------------
revno: 3134
revision-id: sanja at montyprogram.com-20120404133414-6767r3zs4mq64xee
parent: monty at askmonty.org-20120404105024-6ycxifkzdewzf7nh
committer: sanja at montyprogram.com
branch nick: work-maria-5.2-lpb956079
timestamp: Wed 2012-04-04 16:34:14 +0300
message:
  FIX for LP bug#956079
  
  Always set all callbacks for page cache.
-------------- next part --------------
=== modified file 'storage/maria/ma_loghandler.c'
--- a/storage/maria/ma_loghandler.c	2011-11-30 20:57:18 +0000
+++ b/storage/maria/ma_loghandler.c	2012-04-04 13:34:14 +0000
@@ -9091,7 +9091,10 @@ static void dump_datapage(uchar *buffer,
     }
     tfile.number= file;
     tfile.handler.file= handler;
-    pagecache_file_init(tfile.handler, NULL, NULL, NULL, NULL, NULL);
+    pagecache_file_init(tfile.handler, &translog_dummy_callback,
+                        &translog_dummy_callback,
+                        &translog_dummy_write_failure,
+                        &translog_dummy_callback, NULL);
     tfile.was_recovered= 0;
     tfile.is_sync= 1;
     if (translog_check_sector_protection(buffer, &tfile))

=== modified file 'storage/maria/ma_open.c'
--- a/storage/maria/ma_open.c	2012-03-28 10:49:07 +0000
+++ b/storage/maria/ma_open.c	2012-04-04 13:34:14 +0000
@@ -1759,22 +1759,24 @@ void _ma_set_data_pagecache_callbacks(PA
 {
   file->callback_data= (uchar*) share;
   file->flush_log_callback= &maria_flush_log_for_page_none; /* Do nothing */
+  file->write_fail= &maria_page_write_failure;
 
   if (share->temporary)
-  {
-    file->read_callback=  &maria_page_crc_check_none;
-    file->write_callback= &maria_page_filler_set_none;
-  }
+    pagecache_file_init(*file, &maria_page_crc_check_none,
+                        &maria_page_filler_set_none,
+                        &maria_page_write_failure,
+                        &maria_flush_log_for_page_none,
+                        (uchar*) share);
   else
-  {
-    file->read_callback=  &maria_page_crc_check_data;
-    if (share->options & HA_OPTION_PAGE_CHECKSUM)
-      file->write_callback= &maria_page_crc_set_normal;
-    else
-      file->write_callback= &maria_page_filler_set_normal;
-    if (share->now_transactional)
-      file->flush_log_callback= maria_flush_log_for_page;
-  }
+    pagecache_file_init(*file, &maria_page_crc_check_data,
+                        ((share->options & HA_OPTION_PAGE_CHECKSUM) ?
+                         &maria_page_crc_set_normal :
+                         &maria_page_filler_set_normal),
+                        &maria_page_write_failure,
+                        (share->now_transactional ?
+                         &maria_flush_log_for_page :
+                         &maria_flush_log_for_page_none),
+                        (uchar*) share);
 }
 
 
@@ -1794,21 +1796,21 @@ void _ma_set_index_pagecache_callbacks(P
   file->write_fail= maria_page_write_failure;
 
   if (share->temporary)
-  {
-    file->read_callback=  &maria_page_crc_check_none;
-    file->write_callback= &maria_page_filler_set_none;
-  }
+    pagecache_file_init(*file, &maria_page_crc_check_none,
+                        &maria_page_filler_set_none,
+                        &maria_page_write_failure,
+                        &maria_flush_log_for_page_none,
+                        (uchar*) share);
   else
-  {
-    file->read_callback=  &maria_page_crc_check_index;
-    if (share->options & HA_OPTION_PAGE_CHECKSUM)
-      file->write_callback= &maria_page_crc_set_index;
-    else
-      file->write_callback= &maria_page_filler_set_normal;
-
-    if (share->now_transactional)
-      file->flush_log_callback= maria_flush_log_for_page;
-  }
+    pagecache_file_init(*file, &maria_page_crc_check_index,
+                        ((share->options & HA_OPTION_PAGE_CHECKSUM) ?
+                         &maria_page_crc_set_index :
+                         &maria_page_filler_set_normal),
+                        &maria_page_write_failure,
+                        (share->now_transactional ?
+                         &maria_flush_log_for_page :
+                         &maria_flush_log_for_page_none),
+                        (uchar*) share);
 }
 
 

=== modified file 'storage/maria/ma_pagecache.c'
--- a/storage/maria/ma_pagecache.c	2011-08-10 19:44:39 +0000
+++ b/storage/maria/ma_pagecache.c	2012-04-04 13:34:14 +0000
@@ -633,7 +633,6 @@ static my_bool pagecache_fwrite(PAGECACH
 {
   DBUG_ENTER("pagecache_fwrite");
   DBUG_ASSERT(type != PAGECACHE_READ_UNKNOWN_PAGE);
-
 #ifdef EXTRA_DEBUG_BITMAP
   /*
     This code is very good when debugging changes in bitmaps or dirty lists
@@ -654,6 +653,10 @@ static my_bool pagecache_fwrite(PAGECACH
   }
 #endif
 
+  /*
+    Here all callbacks of block->hash_link->file should be set to non 0
+  */
+
   /* Todo: Integrate this with write_callback so we have only one callback */
   if ((*filedesc->flush_log_callback)(buffer, pageno, filedesc->callback_data))
     DBUG_RETURN(1);
@@ -2791,6 +2794,9 @@ static void read_block(PAGECACHE *pageca
     else
     {
       block->status|= PCBLOCK_READ;
+      /*
+        Here all callbacks of block->hash_link->file should be set to non 0
+      */
       if ((*block->hash_link->file.read_callback)(block->buffer,
                                                   block->hash_link->pageno,
                                                   block->hash_link->
@@ -4279,6 +4285,9 @@ no_key_cache:
                                    pageno,
                                    pagecache->readwrite_flags) != 0)))
         goto end;
+      /*
+        Here all callbacks of block->hash_link->file should be set to non 0
+      */
       if ((file->read_callback)(page_buffer, pageno, file->callback_data))
       {
         DBUG_PRINT("error", ("read callback problem"));

=== modified file 'storage/maria/ma_pagecache.h'
--- a/storage/maria/ma_pagecache.h	2011-02-28 17:39:30 +0000
+++ b/storage/maria/ma_pagecache.h	2012-04-04 13:34:14 +0000
@@ -271,6 +271,10 @@ extern void pagecache_set_write_on_delet
     (F).read_callback= (RC); (F).write_callback= (WC); \
     (F).write_fail= (WF); \
     (F).flush_log_callback= (GLC); (F).callback_data= (uchar*)(D); \
+    DBUG_ASSERT((F).read_callback); \
+    DBUG_ASSERT((F).write_callback); \
+    DBUG_ASSERT((F).write_fail); \
+    DBUG_ASSERT((F).flush_log_callback); \
   } while(0)
 
 #define flush_pagecache_blocks(A,B,C)                   \



More information about the commits mailing list