mariadb/mysys
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
..
.cvsignore
array.c Fix for a few assorted compiler warnings. 2009-08-28 12:06:59 -03:00
base64.c fixed compilation warnings. addendum to the fix for bug 29125 2009-03-20 16:27:53 +02:00
ChangeLog
charset-def.c Merge maint1.mysql.com:/data/localhome/tsmith/bk/maint/50 2007-06-21 20:55:37 +02:00
charset.c Bug #51976 LDML collations issue 2010-03-22 16:27:59 +04:00
checksum.c Bug#29125 Windows Server X64: so many compiler warnings 2009-02-13 11:41:47 -05:00
CMakeLists.txt Bug#47857 strip_sp function in mysys/mf_strip.c never used and cause name clash 2009-10-06 13:04:51 +02:00
default.c Recommit of Bug#49447. 2010-02-04 13:39:42 +01:00
default_modify.c Bug#29125 Windows Server X64: so many compiler warnings 2009-02-13 11:41:47 -05:00
errors.c Fix for bug#48451: my_seek and my_tell ignore MY_WME flag 2010-12-09 12:59:12 +03:00
hash.c Additional fix for bug #45613: handle failures from my_hash_insert 2009-11-23 17:32:10 +02:00
list.c WL#3817: Simplify string / memory area types and make things more consistent (first part) 2007-05-10 12:59:39 +03:00
make-ccc
make-conf.c
Makefile.am - Added/updated copyright headers 2010-12-28 19:57:23 +01:00
md5.c Bug #42434: license of mysys MD5 implementation is not GPL-compatible 2009-03-09 20:57:03 +02:00
mf_arr_appstr.c Bug #20748: Configuration files should not be read more than once 2007-11-07 15:23:50 -07:00
mf_brkhant.c
mf_cache.c WL#3817: Simplify string / memory area types and make things more consistent (first part) 2007-05-10 12:59:39 +03:00
mf_dirname.c WL#3817: Simplify string / memory area types and make things more consistent (first part) 2007-05-10 12:59:39 +03:00
mf_fn_ext.c WL#3817: Simplify string / memory area types and make things more consistent (first part) 2007-05-10 12:59:39 +03:00
mf_format.c BUG#43949 Initialization of slave produces a warning message in Valgrind 2009-04-19 02:21:33 +01:00
mf_getdate.c Merge from 5.0-bugteam 2009-05-13 08:48:00 -07:00
mf_iocache.c Bug#45288: pb2 returns a lot of compilation warnings on linux 2010-07-20 15:07:36 -03:00
mf_iocache2.c Bug#29125 Windows Server X64: so many compiler warnings 2009-02-10 17:47:54 -05:00
mf_keycache.c Bug#58057: 5.1 libmysql/libmysql.c unused variable/compile failure 2010-11-10 19:14:47 -02:00
mf_keycaches.c WL#3817: Simplify string / memory area types and make things more consistent (first part) 2007-05-10 12:59:39 +03:00
mf_loadpath.c Bug#53445: Build with -Wall and fix warnings that it generates 2010-07-02 15:30:47 -03:00
mf_pack.c Merge 2010-12-29 00:47:05 +01:00
mf_path.c Slow query log to file now displays queries with microsecond precission 2007-07-30 11:33:50 +03:00
mf_qsort.c Fix for bug #31207: Test "join_nested" shows different strategy on IA64 2007-10-17 20:08:58 +04:00
mf_qsort2.c
mf_radix.c WL#3817: Simplify string / memory area types and make things more consistent (first part) 2007-05-10 12:59:39 +03:00
mf_same.c WL#3817: Simplify string / memory area types and make things more consistent (first part) 2007-05-10 12:59:39 +03:00
mf_sort.c Merge polly.(none):/home/kaa/src/maint/mysql-5.0-maint 2007-10-18 14:32:43 +04:00
mf_soundex.c WL#3817: Simplify string / memory area types and make things more consistent (first part) 2007-05-10 12:59:39 +03:00
mf_tempdir.c Bug#29125 Windows Server X64: so many compiler warnings 2009-02-13 11:41:47 -05:00
mf_tempfile.c Moved a lot of old bug fixes and safe cleanups from Maria 5.1 tree to 5.1 2007-10-11 18:07:40 +03:00
mf_unixpath.c WL#3817: Simplify string / memory area types and make things more consistent (first part) 2007-05-10 12:59:39 +03:00
mf_util.c
mf_wcomp.c
mf_wfile.c Bug#42733: Type-punning warnings when compiling MySQL -- 2010-06-10 17:16:43 -03:00
mulalloc.c WL#3817: Simplify string / memory area types and make things more consistent (first part) 2007-05-10 12:59:39 +03:00
my_access.c
my_aes.c
my_alarm.c
my_alloc.c Bug #42064: low memory crash when importing hex strings, in 2010-05-21 15:23:48 +04:00
my_append.c Bug#29125 Windows Server X64: so many compiler warnings 2009-02-13 11:41:47 -05:00
my_bit.c Moved a lot of old bug fixes and safe cleanups from Maria 5.1 tree to 5.1 2007-10-11 18:07:40 +03:00
my_bitmap.c Bug #11752069 (former bug 43152) 2011-02-16 16:26:19 +01:00
my_chsize.c WL#3817: Simplify string / memory area types and make things more consistent (first part) 2007-05-10 12:59:39 +03:00
my_clock.c
my_compress.c Bug#29125 Windows Server X64: so many compiler warnings 2009-02-13 11:41:47 -05:00
my_conio.c Bug#29125 Windows Server X64: so many compiler warnings 2009-02-13 11:41:47 -05:00
my_copy.c Bug#45288: pb2 returns a lot of compilation warnings on linux 2010-07-20 15:07:36 -03:00
my_crc32.c
my_create.c Merge a88-113-38-195.elisa-laajakaista.fi:/home/my/bk/mysql-5.1-main 2008-03-13 23:35:52 +02:00
my_delete.c Merge a88-113-38-195.elisa-laajakaista.fi:/home/my/bk/mysql-5.1-main 2007-12-07 22:27:48 +02:00
my_div.c WL#3817: Simplify string / memory area types and make things more consistent (first part) 2007-05-10 12:59:39 +03:00
my_dup.c Fixed compiler warnings. 2007-03-22 20:32:07 +02:00
my_error.c Fix indentation. tab -> spaces 2009-03-17 15:43:00 -04:00
my_file.c Bug #47095: Can't open_files_limit really be larger than 65535? 2010-04-09 14:47:18 +03:00
my_fopen.c Updating header copyright/README in source for 2011 2011-01-25 15:42:40 +01:00
my_fstream.c Merge BUG#22082 from 5.0-bugteam to 5.1-bugteam 2009-03-06 17:38:14 +08:00
my_gethostbyname.c Bug#45288: pb2 returns a lot of compilation warnings on linux 2010-10-19 11:49:31 -02:00
my_gethwaddr.c Bug#45288: pb2 returns a lot of compilation warnings 2010-10-20 11:40:04 -02:00
my_getncpus.c Bug#58057: 5.1 libmysql/libmysql.c unused variable/compile failure 2010-11-10 19:14:47 -02:00
my_getopt.c Bug#45288: pb2 returns a lot of compilation warnings on linux 2010-09-24 19:13:51 -03:00
my_getpagesize.c
my_getsystime.c Updating header copyright/README in source for 2011 2011-01-25 15:42:40 +01:00
my_getwd.c On behalf of Kristofer : 2010-05-05 11:54:52 +03:00
my_handler.c Bug#53445: Build with -Wall and fix warnings that it generates 2010-07-02 15:30:47 -03:00
my_handler_errors.h merge 5.0-bugteam to 5.1-bugteam 2009-07-24 12:15:06 +05:30
my_init.c Bug #45058 init_available_charsets uses double checked locking 2010-02-26 15:30:14 +01:00
my_largepage.c Bug #43606: 4GB Limit on huge_pages shared memory set-up 2009-09-18 11:19:02 +04:00
my_lib.c - Added/updated copyright headers 2010-12-28 19:57:23 +01:00
my_libwrap.c
my_lock.c
my_lockmem.c WL#3817: Simplify string / memory area types and make things more consistent (first part) 2007-05-10 12:59:39 +03:00
my_malloc.c Bug #42064: low memory crash when importing hex strings, in 2010-05-21 15:23:48 +04:00
my_memmem.c WL#3817: Simplify string / memory area types and make things more consistent (first part) 2007-05-10 12:59:39 +03:00
my_messnc.c
my_mkdir.c
my_mmap.c
my_net.c
my_netware.c
my_new.cc Bug#43461: invalid comparison with string literal in default.c 2009-03-19 17:20:15 -03:00
my_once.c WL#3817: Simplify string / memory area types and make things more consistent (first part) 2007-05-10 12:59:39 +03:00
my_open.c Moved a lot of old bug fixes and safe cleanups from Maria 5.1 tree to 5.1 2007-10-11 18:07:40 +03:00
my_port.c
my_pread.c auto-merge 2009-03-17 16:29:24 -04:00
my_pthread.c my_pthread.c: 2007-07-30 20:40:49 +02:00
my_quick.c Bug#29125 Windows Server X64: so many compiler warnings 2009-02-13 11:41:47 -05:00
my_read.c Bug#29125 Windows Server X64: so many compiler warnings 2009-02-13 11:41:47 -05:00
my_realloc.c Moved a lot of old bug fixes and safe cleanups from Maria 5.1 tree to 5.1 2007-10-11 18:07:40 +03:00
my_redel.c Bug#45288: pb2 returns a lot of compilation warnings on linux 2010-07-20 15:07:36 -03:00
my_rename.c Moved a lot of old bug fixes and safe cleanups from Maria 5.1 tree to 5.1 2007-10-11 18:07:40 +03:00
my_seek.c Fix for bug#48451: my_seek and my_tell ignore MY_WME flag 2010-12-09 12:59:12 +03:00
my_sleep.c
my_static.c WL#4259 - Debug Sync Facility 2009-09-29 17:38:40 +02:00
my_static.h Bug#35616: memory overrun on 64-bit linux on setting large values for keybuffer-size 2008-08-19 15:56:41 +02:00
my_symlink.c Fix for bug#48451: my_seek and my_tell ignore MY_WME flag 2010-12-09 12:59:12 +03:00
my_symlink2.c Merge mysql.com:/home/svoj/devel/mysql/BUG32111/mysql-5.0-engines 2007-11-12 15:26:37 +04:00
my_sync.c Bug#45288: pb2 returns a lot of compilation warnings 2010-10-19 14:48:03 -02:00
my_thr_init.c merge mysql-5.0-bugteam to mysql-5.1-bugteam 2009-12-17 17:15:13 +05:30
my_vle.c WL#3817: Simplify string / memory area types and make things more consistent (first part) 2007-05-10 12:59:39 +03:00
my_wincond.c Automerg 2009-10-06 09:40:30 +02:00
my_windac.c WL#3817: Simplify string / memory area types and make things more consistent (first part) 2007-05-10 12:59:39 +03:00
my_winthread.c Bug #45058 init_available_charsets uses double checked locking 2009-12-12 19:11:25 +01:00
my_write.c Merge BUG#22082 from 5.0-bugteam to 5.1-bugteam 2009-03-06 17:38:14 +08:00
mysys_priv.h Slow query log to file now displays queries with microsecond precission 2007-07-30 11:33:50 +03:00
ptr_cmp.c WL#3817: Simplify string / memory area types and make things more consistent (first part) 2007-05-10 12:59:39 +03:00
queues.c Fix for server bug experienced in Maria (wrong "Truncated incorrect <var_name> 2008-02-18 23:29:39 +01:00
rijndael.c
safemalloc.c Bug#53445: Build with -Wall and fix warnings that it generates 2010-07-02 15:30:47 -03:00
sha1.c Bug #56427 : Replace copyright notice removed from SHA1 code 2010-10-05 17:03:04 +03:00
stacktrace.c Workaround a GCC warning about a pointer being cast to a larger 2010-11-30 21:07:55 -02:00
string.c Bug#29125 Windows Server X64: so many compiler warnings 2009-02-13 11:41:47 -05:00
test_charset.c Fix doxygen warnings. 2007-08-15 17:43:08 +04:00
test_dir.c
test_fn.c
test_xml.c
testhash.c WL#3817: Simplify string / memory area types and make things more consistent (first part) 2007-05-10 12:59:39 +03:00
thr_alarm.c Bug#54667: Unnecessary signal handler redefinition 2010-07-01 12:02:00 +04:00
thr_lock.c Bug#53445: Build with -Wall and fix warnings that it generates 2010-07-02 15:30:47 -03:00
thr_mutex.c Bug#45288: pb2 returns a lot of compilation warnings 2010-10-20 11:40:04 -02:00
thr_rwlock.c
tree.c WL#3817: Simplify string / memory area types and make things more consistent (first part) 2007-05-10 12:59:39 +03:00
trie.c WL#3817: Simplify string / memory area types and make things more consistent (first part) 2007-05-10 12:59:39 +03:00
typelib.c Use C comments in C code 2009-11-05 21:22:17 +01:00