summaryrefslogtreecommitdiff
path: root/mysys
Commit message (Collapse)AuthorAgeFilesLines
* Bug #42144: plugin_load failsGeorgi Kodinov2010-08-041-5/+5
| | | | | | | | | | | | Reverted the ulong->uint diff Re-applied the first diff. The original commit message follows: enum plugin system variables are ulong internally, not int. On systems where long is not the same as an int it causes problems. Fixed by correct typecasting. Removed the test from the experimental list.
* Bug #42144: plugin_load failsGeorgi Kodinov2010-08-031-10/+14
| | | | | | | | | | The enum system variables were handled inconsistently as ints, unsigned int and unsigned long on various places. This caused problems on platforms on which sizeof(int) != sizeof(long). Fixed by homogenizing the type of the enum variables to unsigned int, since it's size compatible with the C enum type. Removed the test from the experimental list.
* Bug#45288: pb2 returns a lot of compilation warnings on linuxDavi Arnaut2010-07-301-1/+3
| | | Fix compiler warnings.
* Bug#45288: pb2 returns a lot of compilation warnings on linuxDavi Arnaut2010-07-204-14/+47
| | | | | | Fix warnings flagged by the new warning option -Wunused-but-set-variable that was added to GCC 4.6 and that is enabled by -Wunused and -Wall. The option causes a warning whenever a local variable is assigned to but is later unused. It also warns about meaningless pointer dereferences.
* Bug#22320: my_atomic-t unit test failsDavi Arnaut2010-07-052-47/+1
| | | | | The atomic operations implementation on 5.1 has a few problems, which might cause tests to abort randomly. Since no code in 5.1 uses atomic operations, simply remove the code.
* Bug#53445: Build with -Wall and fix warnings that it generatesDavi Arnaut2010-07-028-24/+18
| | | | | | | | | | | | | | | | Apart strict-aliasing warnings, fix the remaining warnings generated by GCC 4.4.4 -Wall and -Wextra flags. One major source of warnings was the in-house function my_bcmp which (unconventionally) took pointers to unsigned characters as the byte sequences to be compared. Since my_bcmp and bcmp are deprecated functions whose only difference with memcmp is the return value, every use of the function is replaced with memcmp as the special return value wasn't actually being used by any caller. There were also various other warnings, mostly due to type mismatches, missing return values, missing prototypes, dead code (unreachable) and ignored return values.
* Bug#54667: Unnecessary signal handler redefinitionAlexey Kopytov2010-07-011-5/+5
| | | | | | | POSIX requires that a signal handler defined with sigaction() is not reset on delivering a signal unless SA_NODEFER or SA_RESETHAND is set. It is therefore unnecessary to redefine the handler on signal delivery on platforms where sigaction() is used without those flags.
* Manual merge from the bugfix tree.Alexey Kopytov2010-06-113-1/+34
|\ | | | | | | | | conflicts: conflict sql/sql_parse.cc
| * Bug #42064: low memory crash when importing hex strings, inAlexey Kopytov2010-05-213-1/+34
| | | | | | | | | | | | | | | | | | | | | | Item_hex_string::Item_hex_string The status of memory allocation in the Lex_input_stream (called from the Parser_state constructor) was not checked which led to a parser crash in case of the out-of-memory error. The solution is to introduce new init() member function in Parser_state and Lex_input_stream so that status of memory allocation can be returned to the caller.
* | Bug#42733: Type-punning warnings when compiling MySQL --Davi Arnaut2010-06-102-20/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | strict aliasing violations. Essentially, the problem is that large parts of the server were developed in simpler times (last decades, pre C99 standard) when strict aliasing and compilers supporting such optimizations were rare to non-existent. Thus, when compiling the server with a modern compiler that uses strict aliasing rules to perform optimizations, there are several places in the code that might trigger undefined behavior. As evinced by some recent bugs, GCC does a somewhat good of job misoptimizing such code, but on the other hand also gives warnings about suspicious code. One problem is that the warnings aren't always accurate, yet we can't afford to just shut them off as we might miss real cases. False-positive cases are aggravated mostly by casts that are likely to trigger undefined behavior. The solution is to start a cleanup process focused on fixing and reducing the amount of strict-aliasing related warnings produced by GCC and others compilers. A good deal of noise reduction can be achieved by just removing useless casts that are product of historical cruft and are likely to trigger undefined behavior if dereferenced.
* | Bug#53593: Add some instrumentation to improve Valgrind sensitivityMarko Mäkelä2010-05-201-0/+5
|/ | | | | | | | | | | | | | | | | | | | | | | | | | BUILD/*: Add valgrind_configs=--with-valgrind. BUILD/*: Remove -USAFEMALLOC from valgrind_flags. configure.in: Add AC_ARG_WITH(valgrind) and HAVE_VALGRIND. include/my_sys.h: Define a number of MEM_ wrappers for VALGRIND_ functions. include/my_sys.h: Make TRASH do MEM_UNDEFINED(). include/m_string.h: Remove unused macro bzero_if_purify(A,B). _mymalloc(): Declare MEM_UNDEFINED() on the allocated memory. _myfree(): Declare MEM_NOACCESS() on the freed memory. storage/innobase/include/univ.i: Enable UNIV_DEBUG_VALGRIND based on HAVE_VALGRIND rather than HAVE_purify. Possible things to do: * In my_global.h, remove the defined(HAVE_purify) condition from the _WIN32 uint3korr(). * In my_global.h *int*korr(), use | instead of + in order to keep the Valgrind V bits accurate * Consider replacing HAVE_purify with HAVE_VALGRIND * Use VALGRIND_CREATE_BLOCK, VALGRIND_DISCARD in mem_root and similar places
* On behalf of Kristofer :Georgi Kodinov2010-05-052-5/+13
| | | | | | | | | | | | | Bug#53417 my_getwd() makes assumptions on the buffer sizes which not always hold true The mysys library contains many functions for rewriting file paths. Most of these functions makes implicit assumptions on the buffer sizes they write to. If a path is put in my_realpath() it will propagate to my_getwd() which assumes that the buffer holding the path name is greater than 2. This is not true in cases. In the special case where a VARBIN_ITEM is passed as argument to the LOAD_FILE function this can lead to a crash. This patch fixes the issue by introduce more safe guards agaist buffer overruns.
* Bug #47095: Can't open_files_limit really be larger than 65535?Georgi Kodinov2010-04-091-1/+1
| | | | | | | | | | | | | | | | | | | Several problems addressed: 1. The maximum value for --open_files_limit on non-windows boxes is now raised to UINT_MAX (the maximum possible without significant changes in the code). The maximum value on windows is kept to be 2048 due to a known limitation (bug 24509). 2. mysqld_safe now supports --open_files_limit=xx in addition to --open-files-limit=xx 3. mysqld_safe always passes through --open[_-]files[_-]limit to the underlying mysqld. It used to pass it through only if it the user running the script has access to the root directory or there was an --user argument specified. 4. Fixed a prototype in my_file.c to match its counterpart in the other #ifdef branch.
* Bug #51893: crash with certain characters given to load_file Georgi Kodinov2010-03-231-0/+3
| | | | | | | | function on windows When making sure that the directory path ends up with a slash/backslash we need to check for the correct length of the buffer and trim at the appropriate location so we don't write past the end of the buffer.
* Bug #51976 LDML collations issue Alexander Barkov2010-03-221-0/+2
| | | | | | | | | | | | | | Problem: caseup_multiply and casedn_multiply members were not initialized for a dynamic collation, so UPPER() and LOWER() functions returned empty strings. Fix: initializing the members properly. Adding tests: mysql-test/r/ctype_ldml.result mysql-test/t/ctype_ldml.test Applying the fix: mysys/charset.c
* Workaround the pthread_once_t static initialization. Per theDavi Arnaut2010-02-261-1/+2
| | | | | POSIX standard, reinitialization of a pthread_once is a gray area, but it is needed to support subsequent initializations of the client library.
* Bug #45058 init_available_charsets uses double checked lockingStaale Smedseng2010-02-262-0/+6
| | | | | | | | | | | A client doing multiple mysql_library_init() and mysql_library_end() calls over the lifetime of the process may experience lost character set data, potentially even a SIGSEGV. This patch reinstates the reloading of character set data when a mysql_library_init() is done after a mysql_library_end().
* Recommit of Bug#49447.Staale Smedseng2010-02-041-4/+4
|
* WL#5154 Remove deprecated 4.1 featuresMagne Mahre2010-01-211-0/+9
| | | | | | | | | | | Several items said to be deprecated in the 4.1 manual have never been removed. This worklog adds deprecation warnings when these items are used, and warns the user that the items will be removed in MySQL 5.6. A couple of previously deprecation decision have been reversed (see single file comments)
* Manual merge.Davi Arnaut2009-12-182-3/+3
|\
| * Bug#48983: Bad strmake calls (length one too long)Davi Arnaut2009-12-172-3/+3
| | | | | | | | | | | | | | | | The problem is a somewhat common misusage of the strmake function. The strmake(dst, src, len) function writes at most /len/ bytes to the string pointed to by src, not including the trailing null byte. Hence, if /len/ is the exact length of the destination buffer, a one byte buffer overflow can occur if the length of the source string is equal to or greater than /len/.
* | merge mysql-5.0-bugteam to mysql-5.1-bugteamSatya B2009-12-171-1/+5
|\ \ | |/
| * Fix for Bug#37408 - Compressed MyISAM files should not require/use mmap()Satya B2009-12-171-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When compressed myisam files are opened, they are always memory mapped sometimes causing memory swapping problems. When we mmap the myisam compressed tables of size greater than the memory available, the kswapd0 process utilization is very high consuming 30-40% of the cpu. This happens only with linux kernels older than 2.6.9 With newer linux kernels, we don't have this problem of high cpu consumption and this option may not be required. The option 'myisam_mmap_size' is added to limit the amount of memory used for memory mapping of myisam files. This option is not dynamic. The default value on 32 bit system is 4294967295 bytes and on 64 bit system it is 18446744073709547520 bytes. Note: Testcase only tests the option variable. The actual bug has be to tested manually.
* | Bug#49134 5.1 server segfaults with 2byte collation fileAlexander Barkov2009-12-151-1/+2
| | | | | | | | | | | | | | | | | | | | Problem: add_collation did not check that cs->number is smaller than the number of elements in the array all_charsets[], so server could crash when loading an Index.xml file with a collation ID greater the number of elements (for example when downgrading from 5.5). Fix: adding a condition to check that cs->number is not out of valid range.
* | Bug #45058 init_available_charsets uses double checked lockingStaale Smedseng2009-12-123-53/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As documented in the bug report, the double checked locking pattern has inherent issues, and cannot guarantee correct initialization. This patch replaces the logic in init_available_charsets() with the use of pthread_once(3). A wrapper function, my_pthread_once(), is introduced and is used in lieu of direct calls to init_available_charsets(). Related defines MY_PTHREAD_ONCE_* are also introduced. For the Windows platform, the implementation in lp:sysbench is ported. For single-thread use, a simple define calls the function and sets the pthread_once control variable. Charset initialization is modified to use my_pthread_once().
* | Merge from 5.0Staale Smedseng2009-12-061-1/+20
|\ \ | |/
* | Move DBG_* macros to after the variable declaration section in aKent Boortz2009-11-251-2/+2
| | | | | | | | block, might expand to function calls (Bug#48331)
* | Additional fix for bug #45613: handle failures from my_hash_insertGeorgi Kodinov2009-11-231-1/+0
| | | | | | | | | | | | | | Testing for presence of stuff in a hash inside the function that's filling in the hash creates chicken-and-egg type of problems. This results in test suite failures in mysql-pe in debug mode and adds bad initialization dependency in 5.1. Fixed by removing the debug code.
* | mergeKristofer Pettersson2009-11-201-0/+1
|\ \
| * | Bug#45613 handle failures from my_hash_insertKristofer Pettersson2009-11-201-0/+1
| | | | | | | | | | | | | | | | | | | | | Not all my_hash_insert() calls are checked for return value. This patch adds appropriate checks and failure responses where needed.
* | | mergeGeorgi Kodinov2009-11-201-1/+1
|\ \ \
| * | | Use C comments in C codetimothy.smith@sun.com2009-11-051-1/+1
| | | |
* | | | Bug#46043 mysqld --skip-innodb does not skip InnoDBKristofer Pettersson2009-11-091-11/+11
|/ / / | | | | | | | | | The prefix --skip- didn't work on 64 bit big endian machines because of how the value pointer was casted.
* | | Bug#46586: When using the plugin interface the type "set" for options caused ↵Tatiana A. Nurnberg2009-10-272-2/+7
|/ / | | | | | | | | | | | | | | | | a crash. "What do you mean, there's a bug? There isn't even code!" There was some token code for plug-in variables of the SET type, but clearly this never worked, or was subject to massive bit rot since. Bug-fixes ... fail-safes ... tests -- fais au mieux, mon chou!
* | Upmerge a Windows compile fix from 5.0 to 5.1.Joerg Bruehe2009-10-161-1/+1
|\ \ | |/
| * Compile fix for Windows:Joerg Bruehe2009-10-161-1/+1
| | | | | | | | Use "#ifdef", not plain "#if".
* | Upmerge (automerge) into 5.1Joerg Bruehe2009-10-091-0/+4
|\ \ | |/
| * Fix bug#47923 New "mf_keycache.c" requires thread supportJoerg Bruehe2009-10-081-0/+4
| | | | | | | | | | The bug is a compilation issue: Function "find_key_block()" had thread operations which were not guarded by "#if THREAD", add that now.
| * Bug#47768 pthread_cond_timedwait() is broken on windowsKristofer Pettersson2009-10-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The pthread_cond_wait implementations for windows might dead lock in some rare circumstances. 1) One thread (I) enter a timed wait and at a point in time ends up after mutex unlock and before WaitForMultipleObjects(...) 2) Another thread (II) enters pthread_cond_broadcast. Grabs the mutex and discovers one waiter. It set the broadcast event and closes the broadcast gate then unlocks the mutex. 3) A third thread (III) issues a pthread_cond_signal. It grabs the mutex, discovers one waiter, sets the signal event then unlock the mutex. 4) The first threads (I) enters WaitForMultipleObjects and finds out that the signal object is in a signalled state and exits the wait. 5) Thread (I) grabs the mutex and checks result status. The number of waiters is decreased and becomes equal to 0. The event returned was a signal event so the broadcast gate isn't opened. The mutex is released. 6) Thread (II) issues a new broadcast. The mutex is acquired but the number of waiters are 0 hence the broadcast gate remains closed. 7) Thread (I) enters the wait again but is blocked by the broadcast gate. This fix resolves the above issue by always resetting broadcast gate when there are no more waiters in th queue.
| * Merge bug#42850 to 5.0Magnus Blåudd2009-09-281-3/+4
| |\
* | | Bug#47857 strip_sp function in mysys/mf_strip.c never used and cause name clashMagnus Blåudd2009-10-063-47/+2
| | | | | | | | | - Remove mf_strip.c and the declaration of 'strip_sp'
* | | AutomergKristofer Pettersson2009-10-064-4/+41
|\ \ \
| * \ \ automergeGeorgi Kodinov2009-10-041-2/+10
| |\ \ \
| | * | | Fix bug#46980Joerg Bruehe2009-09-171-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Option "--without-server" still not working in 5.1 The general approach is to make sure that source files which require thread support are only compiled if the build really needs thread support, which means when the server is built or a thread-safe client library. This required several changes: - Make sure the subdirectories "storage/" and "plugin/" are only processed if the server is built, not ifclient-only. - Make the compilation of some modules which inherently require threading depend on thread supportin the build. - Separate the handling of threading in "configure.in" from that of server issues, threading is also needed in a non-server build of a thread-safe client library. Also, "libdbug" must get built even in a client-only build, so "dbug/" must be in the list of client directories. In addition, calls to thread functions in source files which can be built without thread support must use the wrapper functions which handle the non-threaded build. So the modules "client/mysqlimport.c" and "client/mysqlslap.c" must call "my_thread_end()" only via "mysql_thread_end()".
| * | | | auto-mergeIngo Struewing2009-10-012-0/+30
| |\ \ \ \ |/ / / / /
| * | | | WL#4259 - Debug Sync FacilityIngo Struewing2009-09-292-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Backport from 6.0 to 5.1. Only those sync points are included, which are used in debug_sync.test. The Debug Sync Facility allows to place synchronization points in the code: open_tables(...) DEBUG_SYNC(thd, "after_open_tables"); lock_tables(...) When activated, a sync point can - Send a signal and/or - Wait for a signal Nomenclature: - signal: A value of a global variable that persists until overwritten by a new signal. The global variable can also be seen as a "signal post" or "flag mast". Then the signal is what is attached to the "signal post" or "flag mast". - send a signal: Assign the value (the signal) to the global variable ("set a flag") and broadcast a global condition to wake those waiting for a signal. - wait for a signal: Loop over waiting for the global condition until the global value matches the wait-for signal. Please find more information in the top comment in debug_sync.cc or in the worklog entry.
* | | | | Merge bug#42850 to 5.1Magnus Blåudd2009-09-281-3/+4
|\ \ \ \ \ | |/ / / / |/| | | |
| * | | | Merge bug#42850 to 5.0Magnus Blåudd2009-09-281-3/+4
| |\ \ \ \ | | |_|/ / | |/| | / | | | |/ | | |/|
| | * | Bug#42850 race condition in my_thr_init.cMagnus Blåudd2009-09-241-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | - Create the "dummy" thread joinable and wait for it to exit before continuing in 'my_thread_global_init' - This way we know that the pthread library is initialized by one thread only
| * | | fixed compilation warningsGeorgi Kodinov2009-09-241-1/+1
| | | |