Commit graph

225 commits

Author SHA1 Message Date
Sergei Golubchik
0117a92fed MDEV-419 ensure that all HAVE_XXX constants can be set by cmake
add missing checks to configure.cmake
remove dead code and unused HAVE_xxx constants from the sources
2012-07-31 19:29:07 +02:00
Michael Widenius
960f6600c8 Fixed compile warnings
Fixed some mtr test problems



dbug/tests.c:
  Fixed compiler warnings
mysql-test/r/handlersocket.result:
  Fixed that plugin_license is written
mysql-test/suite/innodb/t/innodb_bug60196.test:
  Force sorted results as it was sometimes different on windows
mysql-test/suite/rpl/t/rpl_heartbeat_basic.test:
  Prolong test as this failed on windows
mysql-test/t/handlersocket.test:
  Fixed that plugin_license is written
plugin/handler_socket/handlersocket/handlersocket.cpp:
  Use maria_declare_plugin
plugin/handler_socket/handlersocket/mysql_incl.hpp:
  Fixed compiler warning
plugin/handler_socket/libhsclient/auto_addrinfo.hpp:
  Fixed compiler warning
sql/handler.h:
  Fixed typo
sql/sql_plugin.cc:
  Fixed bug that caused plugin library name twice in error message
storage/maria/ma_checkpoint.c:
  Fixed compiler warning
storage/maria/ma_loghandler.c:
  Fixed compiler warning
unittest/mysys/base64-t.c:
  Fixed compiler warning
unittest/mysys/bitmap-t.c:
  Fixed compiler warning
unittest/mysys/my_malloc-t.c:
  Fixed compiler warning
2012-05-18 16:40:16 +03:00
Sergei Golubchik
20e706689d mysql-5.5.22 merge
mysql-test/suite/innodb/t/group_commit_crash.test:
  remove autoincrement to avoid rbr being used for insert ... select
mysql-test/suite/innodb/t/group_commit_crash_no_optimize_thread.test:
  remove autoincrement to avoid rbr being used for insert ... select
mysys/my_addr_resolve.c:
  a pointer to a buffer is returned to the caller -> the buffer cannot be on the stack
mysys/stacktrace.c:
  my_vsnprintf() is ok here, in 5.5
2012-03-28 01:04:46 +02:00
Sergei Golubchik
93cac96aa4 more MY_INIT(argv[0]) in unittests 2012-03-15 10:12:32 +01:00
Sergei Golubchik
262a2ab59d monty's cleanup of my_thr_init.c
and collateral changes
2012-03-13 13:29:44 +01:00
MySQL Build Team
7a35cb9150 Updated/added copyright headers 2012-02-16 10:48:16 +01:00
Kent Boortz
6a003dd8ef Updated/added copyright headers 2012-02-15 17:21:38 +01:00
Sergei Golubchik
4f435bddfd 5.3 merge 2012-01-13 15:50:02 +01:00
Karen Langford
dacaaf22a3 Fixes required to build on AIX 2012-01-11 18:40:29 +01:00
Michael Widenius
6d4224a31c Merge with 5.2.
no_error handling for select (used by INSERT ... SELECT) still needs to be fixed, but I will do that in a separate commit
2011-12-11 11:34:44 +02:00
Michael Widenius
6920457142 Merge with MariaDB 5.1 2011-11-24 18:48:58 +02:00
Sergei Golubchik
d2755a2c9c 5.3->5.5 merge 2011-11-22 18:04:38 +01:00
Michael Widenius
a8d03ab235 Initail merge with MySQL 5.1 (XtraDB still needs to be merged)
Fixed up copyright messages.
2011-11-21 19:13:14 +02:00
Sergei Golubchik
6edd76785c merge 2011-11-03 23:39:53 +01:00
Sergei Golubchik
0e007344ea mysql-5.5.18 merge 2011-11-03 19:17:05 +01:00
unknown
28e2777991 Fix gcc 4.6 warnings about assigned but not used variables.
Fixed my_gethwaddr.c to allow compilation on Mac OS X.
2011-10-27 15:22:52 +03:00
Sergei Golubchik
90b43902b0 compilation warnings on Windows 2011-11-02 12:55:46 +01:00
Sergei Golubchik
aeaa112edb fixes for windows 2011-10-21 23:07:13 +02:00
Sergei Golubchik
76f0b94bb0 merge with 5.3
sql/sql_insert.cc:
  CREATE ... IF NOT EXISTS may do nothing, but
  it is still not a failure. don't forget to my_ok it.
  ******
  CREATE ... IF NOT EXISTS may do nothing, but
  it is still not a failure. don't forget to my_ok it.
sql/sql_table.cc:
  small cleanup
  ******
  small cleanup
2011-10-19 21:45:18 +02:00
unknown
255c04aed8 Compiler warning about assigned but not used variables fixed. 2011-10-18 13:44:12 +03:00
Jon Olav Hauglid
c01c37a7ef Bug#13030056 62533: UNITTEST/MYSYS/MY_ATOMIC-T.C DOES NOT
COMPILE ON MACOSX LION

The problem was that on optimized builds, the wrong code was generated
for my_atomic_add64 if a variable argument was optimized away as a
constant.

This patch fixes the problem by making the variable volatile.

Another workaround is to specify architecture explicitly using e.g.
CFLAGS/CXXFLAGS= "-m64".

No test case added.
2011-10-03 09:31:55 +02:00
Sergei Golubchik
3b31fbb5a9 portability fix: avoid anonymous structs and unions in C 2011-09-22 11:04:00 +02:00
Sergei Golubchik
2853f6bfbb unit test fixes for ctest 2011-07-16 09:09:01 +02:00
Davi Arnaut
71e0ff64f0 Bug#12727287: Maintainer mode compilation fails with gcc 4.6
GCC 4.6 has new -Wunused-but-set-variable flag, which is enabled
by -Wall, that causes GCC to emit a warning whenever a local variable
is assigned to, but otherwise unused (aside from its declaration).

Since the maintainer mode uses -Wall and -Werror, source code which
triggers these warnings will be rejected. That is, these warnings
become hard errors.

The solution is to fix the code which triggers these specific warnings.
In most of the cases, this is a welcome cleanup as code which triggers
this warning is probably dead anyway.

dbug/dbug.c:
  Unused but set.
libmysqld/lib_sql.cc:
  Length is not necessary as the converted error message is always
  null-terminated.
sql/item_func.cc:
  Make get_var_with_binlog private to this compilation unit.
  If a error was raised, do not attempt to evaluate the user
  variable as the statement execution will be interrupted
  anyway.
sql/mysqld.cc:
  Use a void expression to silence the warning. Avoids the use of
  macros that would make the code more unreadable than it already is.
sql/protocol.cc:
  Length is not necessary as the converted error message is always
  null-terminated. Remove unnecessary casts and assignment.
sql/sql_class.h:
  Function is only used in a single compilation unit.
sql/sql_load.cc:
  Only use the variable outside of EMBEDDED_LIBRARY.
storage/innobase/btr/btr0cur.c:
  Do not retrieve field, only the record length is being used.
storage/perfschema/pfs.cc:
  Use a void expression to silence the warning.
tests/mysql_client_test.c:
  Unused but set.
unittest/mysys/lf-t.c:
  Unused but set.
2011-07-07 08:22:43 -03:00
Kent Boortz
027b5f1ed4 Updated/added copyright headers 2011-07-03 17:47:37 +02:00
Sergei Golubchik
9809f05199 5.5-merge 2011-07-02 22:08:51 +02:00
Kent Boortz
68f00a5686 Updated/added copyright headers 2011-06-30 17:37:13 +02:00
Michael Widenius
f197991f41 Merge with 5.1-microseconds
A lot of small fixes and new test cases.

client/mysqlbinlog.cc:
  Cast removed
client/mysqltest.cc:
  Added missing DBUG_RETURN
include/my_pthread.h:
  set_timespec_time_nsec() now only takes one argument
mysql-test/t/date_formats.test:
  Remove --disable_ps_protocl as now also ps supports microseconds
mysys/my_uuid.c:
  Changed to use my_interval_timer() instead of my_getsystime()
mysys/waiting_threads.c:
  Changed to use my_hrtime()
sql/field.h:
  Added bool special_const_compare() for fields that may convert values before compare (like year)
sql/field_conv.cc:
  Added test to get optimal copying of identical temporal values.
sql/item.cc:
  Return that item_int is equal if it's positive, even if unsigned flag is different.
  Fixed Item_cache_str::save_in_field() to have identical null check as other similar functions
  Added proper NULL check to Item_cache_int::save_in_field()
sql/item_cmpfunc.cc:
  Don't call convert_constant_item() if there is nothing that is worth converting.
  Simplified test when years should be converted
sql/item_sum.cc:
  Mark cache values in Item_sum_hybrid as not constants to ensure they are not replaced by other cache values in compare_datetime()
sql/item_timefunc.cc:
  Changed sec_to_time() to take a my_decimal argument to ensure we don't loose any sub seconds.
  Added Item_temporal_func::get_time() (This simplifies some things)
sql/mysql_priv.h:
  Added Lazy_string_decimal()
sql/mysqld.cc:
  Added my_decimal constants max_seconds_for_time_type, time_second_part_factor
sql/table.cc:
  Changed expr_arena to be of type CONVENTIONAL_EXECUTION to ensure that we don't loose any items that are created by fix_fields()
sql/tztime.cc:
  TIME_to_gmt_sec() now sets *in_dst_time_gap in case of errors
  This is needed to be able to detect if timestamp is 0
storage/maria/lockman.c:
  Changed from my_getsystime() to set_timespec_time_nsec()
storage/maria/ma_loghandler.c:
  Changed from my_getsystime() to my_hrtime()
storage/maria/ma_recovery.c:
  Changed from my_getsystime() to mmicrosecond_interval_timer()
storage/maria/unittest/trnman-t.c:
  Changed from my_getsystime() to mmicrosecond_interval_timer()
storage/xtradb/handler/ha_innodb.cc:
  Added support for new time,datetime and timestamp
unittest/mysys/thr_template.c:
  my_getsystime() -> my_interval_timer()
unittest/mysys/waiting_threads-t.c:
  my_getsystime() -> my_interval_timer()
2011-05-28 05:11:32 +03:00
Kent Boortz
789aa8c485 Updated/added copyright headers 2011-07-04 01:25:49 +02:00
Kent Boortz
02e07e3b51 Updated/added copyright headers 2011-06-30 17:46:53 +02:00
Michael Widenius
f458e198c0 Merge with 5.2 2011-05-16 14:05:45 +03:00
Marc Alff
d343f5e372 Bug#12552516 LF_HASH REQUIRES MY_THREAD_INIT()
Before this fix, a thread instrumented for the performance schema,
that would perform file io operations, could crash inside the LF_HASH
implementation, in cases when my_thread_init is not called.

The crash itself has not been reported in 5.5 but similar crashes have
been found in 5.6-based development branches, using LF_HASH for
more instrumentation.

The possibility of a crash in 5.5 is confirmed by code analysis.

The problem is that, when my_thread_init() is not called,
which can happen for threads in storage engines or thirs party code,
my_thread_var is NULL.

Using my_thread_var->stacks_ends_here in mysys/lf_alloc-pin.c is unsafe.

Given that my_thread_var is used:
- only for stacks_ends_here
- only on platform with HAVE_ALLOCA
- only when there is enough room on the stack
and given that the LF_HASH implementation has a fallback
algorythm implemented already when using alloca is not possible,
using my_thread_var->stacks_ends_here is in fact not a strict requirement,
and can be relaxed.

The fix is to:
- test explicitly if my_thread_var is NULL, to account for cases
  when my_thread_init() is not used by the calling thread.
- not use alloca in this case, and rely on the fall back code already in place.
  so that the LF_HASH can be supported even without my_thread_init().

The implementation of mysys/lf_alloc-pin.c has been fixed to support this new usage.
The units tests in unittest/mysys/lf-t.c have been adjusted accordingly.
2011-05-13 18:04:49 +02:00
Michael Widenius
5933619ceb Made test-unit run in parlallel. This was achived by having all aria tests that uses temporary files to create the temporary file in an unique tempdirectory.
aria_chk now returns 1 if one got any warnings during check and 2 if one got errors.
lp:728919 maria_chk should fail on all detected corruptions

mysql-test/lib/My/SafeProcess.pm:
  Removed ^M lines from the file
storage/maria/ma_check.c:
  Fixed indentation
storage/maria/maria_chk.c:
  aria_chk now returns 1 if one got any warnings during check and 2 if one got errors.
storage/maria/unittest/ma_control_file-t.c:
  Use unique sub directory for test results
storage/maria/unittest/ma_maria_log_cleanup.c:
  Added help function create_tmpdir()
storage/maria/unittest/ma_pagecache_consist.c:
  Use unique sub directory for test results
storage/maria/unittest/ma_pagecache_rwconsist.c:
  Use unique sub directory for test results
storage/maria/unittest/ma_pagecache_rwconsist2.c:
  Use unique sub directory for test results
storage/maria/unittest/ma_pagecache_single.c:
  Use unique sub directory for test results
storage/maria/unittest/ma_test_all-t:
  Use unique sub directory for test results
storage/maria/unittest/ma_test_loghandler-t.c:
  Use unique sub directory for test results
storage/maria/unittest/ma_test_loghandler_first_lsn-t.c:
  Use unique sub directory for test results
  remove delete of files that are already deleted by maria_log_remove()
storage/maria/unittest/ma_test_loghandler_max_lsn-t.c:
  Use unique sub directory for test results
storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
  Use unique sub directory for test results
storage/maria/unittest/ma_test_loghandler_multithread-t.c:
  Use unique sub directory for test results
storage/maria/unittest/ma_test_loghandler_noflush-t.c:
  Use unique sub directory for test results
  remove delete of files that are already deleted by maria_log_remove()
storage/maria/unittest/ma_test_loghandler_nologs-t.c:
  Use unique sub directory for test results
storage/maria/unittest/ma_test_loghandler_pagecache-t.c:
  Use unique sub directory for test results
  remove delete of files that are already deleted by maria_log_remove()
storage/maria/unittest/ma_test_loghandler_purge-t.c:
  Use unique sub directory for test results
support-files/compiler_warnings.supp:
  Supress some warnings
unittest/unit.pl:
  Run 4 unittests in parallel
2011-05-13 16:22:05 +03:00
Michael Widenius
f09f1c7c7d Merge with dynamic column code 2011-05-12 14:30:34 +03:00
Michael Widenius
5ab92b1f85 Adding support for Dynamic columns (WL#34):
- COLUMN_CREATE(column_nr, value, [column_nr,value]...)
- COLUMN_ADD(blob,column_nr, value, column_nr,value]...)
- COLUMN_DELETE(blob, column_nr, column_nr...)
- COLUMN_EXISTS(blob, column_nr)
- COLUMN_LIST(blob, column_nr)
- COLUMN_GET(string, column_nr AS type)

Added cast(X as DOUBLE) and cast(x as INT)
Better warning and error messages for wrong cast's
Created some sub functions to simplify and reuse code.
Added a lot of conversation functions with error/warnings for what went wrong.
Fixed some issues when casting time to datetime.
Added functions to dynamic strings and Strings to allow one to move a string buffer from dynamic strings to String (to save malloc+ copy)
Added dynamic columns library to libmysqlclient


include/Makefile.am:
  Added ma_dyncol.h
include/decimal.h:
  Added 'const' to arguments for some functions.
include/my_sys.h:
  Added dynstr_reassociate()
include/my_time.h:
  Added TIME_SUBSECOND_RANGE
  Added double_to_datetime()
  Added flag argument to str_to_time()
libmysql/CMakeLists.txt:
  Added mysys/ma_dyncol.c
libmysql/Makefile.shared:
  Added ma_dyncol
libmysql/libmysql.c:
  Added argument to str_to_time()
mysql-test/r/bigint.result:
  Better error messages
mysql-test/r/cast.result:
  Better warning and error messages
  A lot of new cast() tests
mysql-test/r/func_math.result:
  Better warning messages
mysql-test/r/func_str.result:
  Better warning messages
mysql-test/r/func_time.result:
  Better warning messages
mysql-test/r/sp-vars.result:
  Better warning messages
mysql-test/r/strict.result:
  Better warning messages
  New test result
mysql-test/r/type_newdecimal.result:
  Better warning messages
mysql-test/r/warnings.result:
  Better warning messages
mysql-test/suite/funcs_1/r/innodb_func_view.result:
  Updated results after better cast warnings
mysql-test/suite/funcs_1/r/memory_func_view.result:
  Updated results after better cast warnings
mysql-test/suite/funcs_1/r/myisam_func_view.result:
  Updated results after better cast warnings
mysql-test/suite/optimizer_unfixed_bugs/t/bug43448.test:
  Added begin...commit to speed up test.
mysql-test/suite/parts/inc/part_supported_sql_funcs_delete.inc:
  Added begin...commit to speed up test.
mysql-test/suite/parts/inc/partition_supported_sql_funcs.inc:
  Added begin...commit to speed up test.
mysql-test/suite/parts/r/part_supported_sql_func_innodb.result:
  Added begin...commit to speed up test.
mysql-test/suite/parts/r/part_supported_sql_func_myisam.result:
  Added begin...commit to speed up test.
mysql-test/suite/parts/r/rpl_partition.result:
  Added begin...commit to speed up test.
mysql-test/suite/parts/t/part_supported_sql_func_innodb.test:
  Removed duplicated --big_test
mysql-test/suite/parts/t/rpl_partition.test:
  Added begin...commit to speed up test.
mysql-test/suite/pbxt/r/cast.result:
  Updated results after better cast warnings
mysql-test/suite/pbxt/r/func_str.result:
  Updated results after better cast warnings
mysql-test/suite/pbxt/r/type_newdecimal.result:
  Updated results after better cast warnings
mysql-test/suite/rpl/r/rpl_innodb_bug28430.result:
  Added begin...commit to speed up test.
mysql-test/suite/rpl/t/rpl_innodb_bug28430.test:
  Added begin...commit to speed up test.
mysql-test/suite/vcol/r/vcol_supported_sql_funcs_innodb.result:
  More warnings
mysql-test/suite/vcol/r/vcol_supported_sql_funcs_myisam.result:
  More warnings
mysql-test/t/cast.test:
  A lot of new cast() tests
mysql-test/t/strict.test:
  Added new test
mysys/CMakeLists.txt:
  Added ma_dyncol.c
mysys/Makefile.am:
  Added ma_dyncol.c
mysys/string.c:
  Added dynstr_reassociate() to move a buffer from dynamic_strings to some other allocator
sql-common/my_time.c:
  Added 'fuzzydate' flag to str_to_time()
  Added support for microseconds to my_time_to_str() and my_datetime_to_str()
  Reset second_parts in number_to_datetime()
  Added double_to_datetime()
sql/field.cc:
  Added double_to_longlong() and truncate_double() to simplify and reuse code
sql/field.h:
  New prototypes
sql/item.cc:
  Changed Item::get_date(MYSQL_TIME *ltime,uint fuzzydate) to be aware of type of argument.
  (Needed to make it microsecond safe and get better warnings).
  Updated call to str_to_time_with_warn()
sql/item.h:
  Added struct st_dyncall_create_def used by dynamic columns
  Added virtual bool dynamic_result() to tell if type of argument may change over calls.
sql/item_cmpfunc.cc:
  Added Item_func_dyncol_exists()
sql/item_cmpfunc.h:
  Added class Item_func_dyncol_exists
sql/item_create.cc:
  Added get_length_and_scale() to simplify other functions
  Simplified and extended create_func_cast()
  Added support for cast(X as double(X,Y))
  Added functions to create dynamic column functions.
sql/item_create.h:
  Added prototypes
sql/item_func.cc:
  Extended cast functions Item_func_signed() and Item_func_unsigned() to work with dynamic types
  Added Item_double_typecast()
sql/item_func.h:
  Added class Item_double_typecast()
sql/item_strfunc.cc:
  Added functions for COLUMN_CREATE(), COLUMN_ADD(), COLUMN_GET() and COLUMN_LIST()
sql/item_strfunc.h:
  Added classes for COLUMN_CREATE(), COLUMN_ADD(), COLUMN_GET() and COLUMN_LIST()
sql/item_timefunc.cc:
  Added flag argument to str_to_time_with_warn()
  Updated Item_char_typecast() to handle result type that may change between calls (for dynamic columns)
  Added Item_time_typecast::get_date() to ensure that we cast a datetime to time properly.
sql/item_timefunc.h:
  Added get_date() to Item_time_typecast() to allow proper results for casting time to datetime
sql/lex.h:
  Added new SQL function names
sql/my_decimal.cc:
  Added 'const' to some arguments.
  Better error message in case of errors (we now print out the wrong value)
  Added my_decimal2int()
sql/my_decimal.h:
  Moved some constants to my_decimal_limits.h
  Updated prototypes.
  Made my_decimal2int() a function as it's rather long (no reason to have it inline)
  Added decimal2my_decimal() function.
sql/mysql_priv.h:
  Prototypes for new functions
sql/share/errmsg.txt:
  New error messages for wrong casts and dynamic columns
sql/sql_acl.cc:
  Fixed indentation
sql/sql_base.cc:
  Added dynamic_column_error_message()
sql/sql_string.h:
  Added reassociate() to move a buffer to be owned by String object.
sql/sql_yacc.yy:
  Added syntax for COLUMN_ functions.
sql/time.cc:
  Updated str_to_datetime_with_warn() flag argument to same type as other functions
  Added conversion flag to str_to_time_with_warn() (Similar to all datetime functions)
  Added conversion functions with warnings: double_to_datetime_with_warn() and decimal_to_datetime_with_warn()
strings/decimal.c:
  Added 'const' to arguments for some functions.
unittest/mysys/Makefile.am:
  Added test for dynamic columns code
2011-05-08 13:24:06 +03:00
Michael Widenius
28f708e1e3 Automatic merge with 5.1 2011-05-08 12:37:38 +03:00
Michael Widenius
6b8788e425 Reverted unittest/unit.pl back to Test::Harness as some of our build machines didn't support the new recommended TAP::Harness module
unittest/mytap/tap.c:
  Fixed output for some tests that didn't call plan()
2011-05-06 14:01:51 +03:00
Michael Widenius
d5caa00161 Improved 'make test-unit' time slightly
storage/maria/unittest/ma_test_loghandler-t.c:
  Don't sync during test
storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
  Don't sync during test
storage/maria/unittest/ma_test_loghandler_multithread-t.c:
  Don't sync during test
unittest/mysys/bitmap-t.c:
  Don't test all bit combinations (not needed)
unittest/mysys/thr_template.c:
  Remove sleep as old bug should be fixed nowadays
unittest/mysys/waiting_threads-t.c:
  Only run test with --big
unittest/mytap/tap.c:
  Print total time at end of test.
unittest/unit.pl:
  Use TAP::Harness instead of Test::Harness (recommended according to manual)
  Add times to tests.
2011-05-05 14:51:01 +03:00
Michael Widenius
547ef66609 Automatic merge with MariaDB 5.1 2011-05-03 19:11:39 +03:00
Michael Widenius
1be5462d59 Merge with MariaDB 5.1 2011-05-03 19:10:10 +03:00
Vladislav Vaintroub
e6926b06da Fix compile errors:
- from xtradb merge
- portability error in bitmap-t.c ( variable size  array in non-portable)
2011-05-02 23:03:26 +02:00
Michael Widenius
e415ba0fb2 Merge with MySQL 5.1.57/58
Moved some BSD string functions from Unireg
2011-05-02 20:58:45 +03:00
Bjorn Munch
7956313711 Fix non-portable test of %p in unit test my_vsnprintf 2011-03-02 10:16:34 +01:00
Michael Widenius
3358cdd504 Merge with 5.1 to get in changes from MySQL 5.1.55 2011-02-28 19:39:30 +02:00
Jon Olav Hauglid
0c9dde5c70 Bug #11752069 (former bug 43152)
Assertion `bitmap_is_set_all(&table->s->all_set)' failed in
handler::ha_reset

Post-push fix for unit test compilation error on Windows.
2011-02-23 14:50:59 +01:00
Jon Olav Hauglid
16e8d18206 Merge from mysql-5.1 to mysql-5.5
No conflicts
2011-02-16 18:24:38 +01:00
Jon Olav Hauglid
0e28aa2f1c Followup to Bug #11752069 (former bug 43152)
Assertion `bitmap_is_set_all(&table->s->all_set)' failed in
handler::ha_reset

This followup fixes the compilation warning
  'test_bit' may be used uninitialized in this function
introduced by the previous patch.
2011-02-16 18:19:10 +01:00
Jon Olav Hauglid
f65f016aee Merge from mysql-5.1 to mysql-5.5
Text conflict in include/my_bit.h
Text conflict in include/my_bitmap.h
Text conflict in mysys/my_bitmap.c
2011-02-16 16:33:02 +01:00
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
Michael Widenius
9c10b73b76 Enhanced tap to write out a message at which stage it was killed if it got a signal.
Added 'SIGINT' to list of tracked signals.
2011-02-12 14:09:44 +02:00