mariadb/include
Jon Olav Hauglid 6ad0c9b16d Bug #11752069 (former bug 43152)
Assertion `bitmap_is_set_all(&table->s->all_set)' failed in
handler::ha_reset

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.
2011-02-16 16:26:19 +01:00
..
mysql
.cvsignore
base64.h
config-netware.h BUG#58246: INSTALL PLUGIN not secure & crashable 2010-12-01 13:54:50 +01:00
config-win.h merge to 5.1. 2011-02-02 19:05:28 +02:00
decimal.h
errmsg.h
ft_global.h
hash.h
heap.h
help_end.h
help_start.h
keycache.h
m_ctype.h BUG#58246: INSTALL PLUGIN not secure & crashable 2010-12-01 13:54:50 +01:00
m_string.h Bug#57994: Compiler flag change build error : my_redel.c 2010-11-20 12:29:51 -02:00
Makefile.am Merge 2010-12-29 00:47:05 +01:00
my_aes.h
my_alarm.h
my_alloc.h
my_attribute.h
my_base.h
my_bit.h Bug #11752069 (former bug 43152) 2011-02-16 16:26:19 +01:00
my_bitmap.h Bug #11752069 (former bug 43152) 2011-02-16 16:26:19 +01:00
my_compiler.h Bug#58057: 5.1 libmysql/libmysql.c unused variable/compile failure 2010-11-10 19:14:47 -02:00
my_dbug.h Bug #58426 Crashing tests not failing as they are supposed to on Solaris 10 debug 2010-12-13 17:13:01 +01:00
my_dir.h
my_getopt.h
my_global.h BUG#58246: INSTALL PLUGIN not secure & crashable 2010-12-01 13:54:50 +01:00
my_handler.h Merge 2010-12-29 00:47:05 +01:00
my_libwrap.h
my_list.h
my_md5.h
my_net.h
my_no_pthread.h
my_nosys.h
my_pthread.h Updating header copyright/README in source for 2011 2011-01-25 15:42:40 +01:00
my_stacktrace.h Bug#51817: incorrect assumption: thd->query at 0x2ab2a8360360 is an invalid pointer 2010-11-26 19:59:10 -02:00
my_sys.h Updating header copyright/README in source for 2011 2011-01-25 15:42:40 +01:00
my_time.h merge to 5.1. 2011-02-02 19:05:28 +02:00
my_tree.h
my_trie.h
my_uctype.h
my_user.h
my_vle.h
my_xml.h
myisam.h
myisammrg.h
myisampack.h
mysql.h
mysql.h.pp
mysql_com.h Merge 2010-12-29 00:47:05 +01:00
mysql_embed.h
mysql_time.h
mysql_version.h.in
mysys_err.h Fix for bug#48451: my_seek and my_tell ignore MY_WME flag 2010-12-09 12:59:12 +03:00
queues.h
rijndael.h
sha1.h
sql_common.h
sslopt-case.h
sslopt-longopts.h
sslopt-vars.h
t_ctype.h
thr_alarm.h
thr_lock.h
typelib.h
violite.h