List:Commits« Previous MessageNext Message »
From:Jon Olav Hauglid Date:February 16 2011 5:30pm
Subject:bzr push into mysql-5.1 branch (jon.hauglid:3592 to 3593) Bug#11752069
View as plain text  
 3593 Jon Olav Hauglid	2011-02-16
      Followup to Bug #11752069 (former bug 43152)
      Assertion `bitmap_is_set_all(&table->s->all_set)' failed in
      This followup fixes the compilation warning
        'test_bit' may be used uninitialized in this function
      introduced by the previous patch.

 3592 Jon Olav Hauglid	2011-02-16
      Bug #11752069 (former bug 43152)
      Assertion `bitmap_is_set_all(&table->s->all_set)' failed in
      This assertion could be triggered if two connections simultaneously
      executed two bitmap test functions on the same bitmap. For example,
      the assertion could be triggered if one connection executed UPDATE
      while a second connection executed SELECT on the same table.
      Even if bitmap test functions have read-only semantics and have
      const bitmaps as parameter, several of them modified the internal
      state of the bitmap. With interleaved execution of two such functions
      it was possible for one function to modify the state of the same
      bitmap that the other function had just modified. This lead to an
      inconsistent state and could trigger the assert.
      Internally the bitmap uses 32 bit words for storage. Since bitmaps
      can contain any number of bits, the last word in the bitmap may
      not be fully used. A 32 bit mask is maintained where a bit is set
      if the corresponding bit in the last bitmap word is unused.
      The problem was that several test functions applied this mask to
      the last word. Sometimes the mask was negated and used to zero out
      the remainder of the last word and sometimes the mask was used as-is
      to fill the remainder of the last word with 1's. This meant that if
      a function first used the negated mask and another function then
      used the mask as-is (or vice-versa), the first function would then
      get the wrong result.
      This patch fixes the problem by changing the implementation of
      9 bitmap functions that modified the bitmap state even if the 
      bitmap was declared const. These functions now preserve the
      internal state of the bitmap. This makes it possible for
      two connections to concurrently execute two of these functions
      on the same bitmap without issues.
      The patch also removes dead testing code from my_bitmap.c.
      These tests have already been moved to unittest/mysys/bitmap-t.c.
      Existing test coverage of my_bitmap has been extended.
      No MTR test case added as this would require adding several sync
      points to the bitmap functions. The patch has been tested with
      a non-deterministic test case posted on the bug report.
     @ include/my_bit.h
        Removed my_count_bits_ushort() which is not needed anymore.
        Added my_count_bits_uint32().
     @ unittest/mysys/bitmap-t.c
        Extended test coverage of my_bitmap.

=== modified file 'unittest/mysys/bitmap-t.c'
--- a/unittest/mysys/bitmap-t.c	2011-02-16 15:26:19 +0000
+++ b/unittest/mysys/bitmap-t.c	2011-02-16 17:19:10 +0000
@@ -253,7 +253,7 @@ error2:
 my_bool test_get_first_bit(MY_BITMAP *map, uint bitsize)
-  uint i, test_bit;
+  uint i, test_bit= 0;
   uint no_loops= bitsize > 128 ? 128 : bitsize;

No bundle (reason: useless for push emails).
bzr push into mysql-5.1 branch (jon.hauglid:3592 to 3593) Bug#11752069Jon Olav Hauglid16 Feb