Commit graph

3832 commits

Author SHA1 Message Date
Magnus Blåudd
8f8d051d67 Merge 2011-03-25 15:03:44 +01:00
Magnus Blåudd
0be575b7c8 Bug#60111 storage type for table not saved in .frm
- Add new "format section" in extra data segment with additional table and
   column properties. This was originally introduced in 5.1.20 based MySQL Cluster
 - Remove hardcoded STORAGE DISK for table and instead
   output the real storage format used. Keep both TABLESPACE
   and STORAGE inside same version guard.
 - Implement default version of handler::get_tablespace_name() since tablespace
   is now available in share and it's unnecessary for each handler  to implement.
   (the function could actually be removed totally now).
 - Add test for combinations of TABLESPACE  and STORAGE with CREATE TABLE
   and ALTER TABLE
 - Add test to show that 5.5 now can read a .frm file created by MySQL Cluster
   7.0.22. Although it does not yet show the column level attributes, they are read.
2011-03-04 09:41:29 +01:00
Tor Didriksen
ef19b3b6cf Bug #11792200 - DIVIDING LARGE NUMBERS CAUSES STACK CORRUPTIONS
This was a buffer overrun in do_div_mod(), overwriting the internal buffer
of auto variable 'tmp' in Item_func_int_div::val_int.
Result on windows: 'this' is set to zero, and crash.
Ran fine on other platforms (no valgrind warnings),
but this is undefined behaviour on any platform of course.

include/decimal.h:
  Add const qualifiers to function prototypes which are used by sql/my_decimal.h
mysql-test/r/func_math.result:
  New test case.
mysql-test/t/func_math.test:
  New test case.
sql/my_decimal.h:
  Remove several C-style casts:
   - some of the were up-casts, and thus un-necessary
   - some of them should have been const-casts, but it is better to make the
     underlying library functions in (decimal.[h|c]) const instead.
strings/decimal.c:
  Check for buffer overrun in do_div_mod()
  Add const qualifiers to functions which are used by sql/my_decimal.h
2011-03-03 15:25:41 +01:00
unknown
753c406994 Merge from mysql-5.5.10-release 2011-03-16 15:11:20 +01:00
Magne Mahre
c4715a8076 Bug#11765237 - 58179: CANNOT START MYSQLD WITH APP VERIFIER
Bug#11763065 - 55730: KILL_SERVER() CALLS SETEVENT ON A NULL 
               HANDLE, SMEM_EVENT_CONNECT_REQUEST
      
Application Verifier is a Microsoft tool used for
detecting certain classes of programming errors.
In particular, MS Windows OS resource usage is
monitored for wrong usage (handles, thread local
storage, critical sections, ...)
      
In MySQL 5.5.x, an error was introduced where an
object on thread local storage was used before the
TLS and the object was created.
      
The fix has been to move the mysys initialization
to an earlier stage in the boot process when built for
Windows.  For non-win builds, the init already happens
early.

Some un-tangling of calls to my_init(), my_basic_init()
and my_thread_global_init() was done.  There is no
longer a need to do init in steps, so the full my_init()
is called instead of my_init_basic().
      
In addition,  Bug#11763065 was fixed.  The event handle
'smem_event_connect_request' is only created if
'opt_enable_shared_memory' is set.  When killing the
server, an event was flagged on the handle
unconditionally.  Added a test, so it will only be
flagged if created.


include/my_pthread.h:
  my_thread_basic_global_init is no longer
  necessary, and the my_thread_basic_global_reinit 
  function is renamed to reflect that it now
  reinits mutexes and condvars originating from
  my_thread_global_init
mysys/my_thr_init.c:
  Reorganized code.
2011-03-01 13:03:31 +01:00
Magnus Blåudd
4846dac064 Remove last traces of HAVE_NDBCLUSTER_DB define - it has not had an effect in a long time and is just confusing.
At the same time backport the removal of OPT_NDB_CONNECTSTRING and OPT_NDBCLUSTER values from "enum options_client"
2011-02-21 11:15:29 +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
Guilhem Bichot
1756d087cd Fix for BUG#59894
"set optimizer_switch to e or d causes invalid memory writes/valgrind warnings":
due to prefix support, the argument "e" was overwritten with its full value
"engine_condition_pushdown", which caused a buffer overrun.
This was wrong usage of find_type(); other wrong usages are fixed here too.
Please start reading with the comment of typelib.c.

client/mysqldump.c:
  A bug: find_type() expects a bitmap as 3rd argument
  (each bit is a flag controlling a behaviour of the function);
  here it was instead passed the length of the string to search!
  That could give random behaviour of find_type()
  depending on the string.
  We rather need to pass a correct flag to find_type().
  The correct flag is FIND_TYPE_BASIC (0).
  Flag 8 is not needed as buff cannot have a comma (see how buff is filled).
  Flag 1 looks like a superfluous restriction.
  Flag 4 is not user-friendly (why use
  --compatible=2 rather than --compatible=mysql40 ?, and
  we probably not commit to "2" always meaning "mysql40"
  until the end of times).
include/mysql.h.pp:
  This isn't a problematic API change as we go from char* to const char*:
  existing code will run unchanged.
include/typelib.h:
  named constants. Not an enum to not significantly change
  the declaration of find_type() which would be an API change
  (typelib.h is included in mysql.h).
mysql-test/r/mysqldump.result:
  correct result (see the two requested modes in SQL_MODE)
mysql-test/suite/sys_vars/t/optimizer_switch_basic.test:
  test for BUG#59894. The second SET used to crash.
mysql-test/t/mysqldump.test:
  we had no test for multiple modes in --compatible, which is
  supported according to --help
mysys/typelib.c:
  Fix for BUG#59894. parse_name() is asked to match "e" with a row
  of the TYPELIB (the TYPELIB lists permitted flags of optimizer_switch;
  and comes from optimizer_switch_names[] of sys_vars.cc).
  find_type() is capable of supporting prefixes, but if it is not
  passed flag 2 in third argument, it will overwrite its first
  argument (the string to search for) with the complete name,
  here overwriting "e" with "engine_condition_pushdown". But
  as this "e" was a buffer allocated in an Item, it was not big
  enough to host the longer name, thus the crash.
  We don't need to know the complete flag's name; the output used
  from find_type() is just the flag's number (== function's return
  code). So we can pass flag 2 to find_type() in parse_name().
  After doing this fix and the other fixes in this patch, all usages
  of find_type() were using flag 2; in most usages the string to search for,
  is not guaranteed to be long enough to host the complete name
  (it is either directly from argv, or from alloc_root/my_malloc
  done in an earlier call).
  Thus, flag 2 is here made implicit: callers need not pass it anymore,
  it is always automatically turned on.
  This allows to eliminate an oddity: parse_name() took a const char**,
  and then removed "const" before calling find_type(), which could
  theoretically modify the pointed data, thus lying on constness.
  Last, constants for find_type() are now named.
sql-common/client.c:
  Two bugs:
  1) The enum was not in sync with the array (due to a bad porting of WL 1054;
  the extra OPT_ values are about options present in 5.1 and deleted in 5.5);
  added a compile_time_assert() to make sure this doesn't happen again
  2) find_type() was writing past the end of opt_arg; as opt_arg was allocated
  with alloc_root() with no extra space, this was an overrun; it could be seen
  when
  ** building with -DWITH_VALGRIND -DHAVE_purify -DEXTRA_DEBUG
  ** making execution go through the faulty code; this faulty
  code is executed only if the client asks to read a configuration
  file like this:
    mysql_options(mysql, MYSQL_READ_DEFAULT_FILE, "/tmp/cnf.cnf");
  so by adding such line to the start of mysql_client_test.c::client_connect(),
  we could see the valgrind warning:
  ==30548== Invalid write of size 1
  ==30548==    at 0x4C2624C: strcpy (mc_replace_strmem.c:303)
  ==30548==    by 0x48DC29: find_type (typelib.c:120)
  ==30548==    by 0x465686: mysql_read_default_options (client.c:1344)
  ==30548==    by 0x46830F: mysql_real_connect (client.c:2971)
  ==30548==    by 0x409339: client_connect (mysql_client_test.c:331)
  ==30548==    by 0x463A7F: main (mysql_client_test.c:19902)
  ==30548==  Address 0x61875ad is 0 bytes after a block of size 29 alloc'd
  ==30548==    at 0x4C25153: malloc (vg_replace_malloc.c:195)
  ==30548==    by 0x49BFF1: my_malloc (my_malloc.c:38)
  ==30548==    by 0x49C65C: alloc_root (my_alloc.c:166)
  ==30548==    by 0x48EF97: handle_default_option (default.c:381)
  ==30548==    by 0x49068C: search_default_file_with_ext (default.c:992)
  ==30548==    by 0x48F929: search_default_file (default.c:670)
  ==30548==    by 0x48EDC4: my_search_option_files (default.c:312)
  ==30548==    by 0x48F4B1: my_load_defaults (default.c:576)
  ==30548==    by 0x46517A: mysql_read_default_options (client.c:1207)
  ==30548==    by 0x46830F: mysql_real_connect (client.c:2971)
  ==30548==    by 0x409339: client_connect (mysql_client_test.c:331)
  ==30548==    by 0x463A7F: main (mysql_client_test.c:19902)
  This is fixed by having find_type() not overwrite anymore.
sql/sql_help.cc:
  cast not needed anymore.
sql/table.cc:
  cast not needed anymore.
2011-02-11 15:00:09 +01:00
Georgi Kodinov
4e523ad68d weave merge from mysql-5.1 to mysql-5.5
Resolved an innodb conflict thanks to vasil.
2011-02-08 17:47:33 +02:00
unknown
17fe23e46c Merge from mysql-5.1.55-release 2011-02-08 12:52:33 +01:00
Georgi Kodinov
fe145b0900 merge 2011-02-02 20:13:28 +02:00
Georgi Kodinov
72ae1d65dd merge to 5.1. 2011-02-02 19:05:28 +02:00
Georgi Kodinov
a70c34bf0f Fixes for Bug #55755 and Bug #52315 part 2
Bug #55755 : Date STD variable signness breaks server on FreeBSD and OpenBSD

* Added a check to configure on the size of time_t
* Created a macro to check for a valid time_t that is safe to use with datetime 
  functions and store in TIMESTAMP columns.
* Used the macro consistently instead of the ad-hoc checks introduced by 52315
* Fixed compliation warnings on platforms where the size of time_t is smaller than
  the size of a long (e.g. OpenBSD 4.8 64 amd64).

Bug #52315: utc_date() crashes when system time > year 2037

* Added a correct check for the timestamp range instead of just variable size check to
SET TIMESTAMP.
* Added overflow checking before converting to time_t. 
* Using a correct localized error message in this case instead of the generic error.
* Added a test suite.
* fixed the checks so that they check for unsigned time_t as well. Used the checks 
  consistently across the source code.
* fixed the original test case to expect the new error code.
2011-02-02 18:51:35 +02:00
Tor Didriksen
c711ce6726 Bug #36022 please log more information about "Sort aborted" queries
Write an additional warning message to the server log, 
explaining why a sort operation is aborted.

The output in mysqld.err will look something like:
110127 15:07:54 [ERROR] mysqld: Sort aborted: Out of memory (Needed 24 bytes)
110127 15:07:54 [ERROR] mysqld: Out of sort memory, consider increasing server sort buffer size
110127 15:07:54 [ERROR] mysqld: Sort aborted: Out of sort memory, consider increasing server sort buffer size
110127 15:07:54 [ERROR] mysqld: Sort aborted: Incorrect number of arguments for FUNCTION test.f1; expected 0, got 1

If --log-warn=2 is enabled, we output information about host/user/query as well.


include/my_sys.h:
  Update comment for ME_NOREFRESH
mysql-test/include/mtr_warnings.sql:
  Remove global filtering of "Out of sort memory", let each individual test set it instead.
mysql-test/r/filesort_debug.result:
  New test case.
mysql-test/r/order_by.result:
  Ignore "Out of memory" for this test.
mysql-test/t/filesort_debug.test:
  New test case.
mysql-test/t/order_by.test:
  Ignore "Out of memory" for this test.
sql/filesort.cc:
  Output an explanation using the error message from the THD Diagnostics_area.
sql/protocol.cc:
  Do not DBUG_RETURN(function_call_with DBUG_RETURN)
  as it messes up the call stack in the debug output.
sql/share/errmsg-utf8.txt:
  Change error message for "Out of sort memory"
sql/unireg.h:
  Remove unused/confusing ERRMAPP macro.
2011-02-02 12:54:49 +01:00
Karen Langford
de3c4428b8 Updating header copyright/README in source for 2011 2011-01-25 15:42:40 +01:00
Davi Arnaut
844d6ed4b2 Bug#51023: Mysql server crashes on SIGHUP and destroys InnoDB files
WIN32 compilation fixes: define ETIMEDOUT only if not available and
fix typos and add a missing parameter.
2011-01-07 17:28:06 -02:00
Davi Arnaut
998065c3a6 Bug#51023: Mysql server crashes on SIGHUP and destroys InnoDB files
From a user perspective, the problem is that a FLUSH LOGS or SIGHUP
signal could end up associating the stdout and stderr to random
files. In the case of this bug report, the streams would end up
associated to InnoDB ibd files.

The freopen(3) function is not thread-safe on FreeBSD. What this
means is that if another thread calls open(2) during freopen()
is executing that another thread's fd returned by open(2) may get
re-associated with the file being passed to freopen(3). See FreeBSD
PR number 79887 for reference:

  http://www.freebsd.org/cgi/query-pr.cgi?pr=79887

This problem is worked around by substituting a internal hook within
the FILE structure. This avoids the loss of atomicity by not having
the original fd closed before its duplicated.

Patch based on the original work by Vasil Dimov.

include/my_sys.h:
  Export my_freopen.
mysys/my_fopen.c:
  Add a my_freopen abstraction to workaround bugs in specific OSes.
  Add a prototype for getosreldate() as older FreeBSD versions did
  not define one.
sql/log.cc:
  Move freopen abstraction code over to mysys.
  The streams are now only reopened for writing.
2011-01-07 16:33:36 -02:00
He Zhenxing
c5aa3313aa BUG#57953 my_load_defaults return junk argument ----args-separator---- to caller
After fix of bug#25192, load_defaults() will add an args separator
to distinguish options loaded from configure files from that provided
in the command line. One problem of this is that the args separator
would be added no matter the application need it or not.

Fixed the problem by adding an option:
  bool my_getopt_use_args_separator;
to control whether the separator will be added or not. And also
added functions:
  bool my_getopt_is_args_separator(const char* arg);
to check if the argument is the separator or not.
2011-01-17 15:44:37 +08:00
Magne Mahre
8ede0759c3 Remove configuration preprocessor symbols 'THREAD'
and 'THREAD_SAFE_CLIENT'.
  
As of MySQL 5.5, we no longer support non-threaded
builds.   This patch removes all references to the
obsolete THREAD and THREAD_SAFE_CLIENT preprocessor
symbols.  These were used to distinguish between
threaded and non-threaded builds.
2011-01-11 10:07:37 +01:00
Vasil Dimov
42982791dc Merge mysql-5.5-innodb -> mysql-5.5 2011-01-08 17:00:48 +02:00
Davi Arnaut
d4ffbd3ee0 Merge of mysql-5.1 into mysql-5.5. 2011-01-07 17:30:52 -02:00
Vasil Dimov
a44cf8a6dd Merge mysql-5.5 -> mysql-5.5-innodb 2011-01-07 13:49:06 +02:00
Mikael Ronstrom
ee46dc0f23 merge 2011-01-03 15:59:04 +01:00
Kent Boortz
be6c3fd8aa Merge 2010-12-29 01:26:31 +01:00
Kent Boortz
4acfdb9df1 Merge 2010-12-29 00:47:05 +01:00
Kent Boortz
85323eda8a - Added/updated copyright headers
- Removed files specific to compiling on OS/2
- Removed files specific to SCO Unix packaging
- Removed "libmysqld/copyright", text is included in documentation
- Removed LaTeX headers for NDB Doxygen documentation
- Removed obsolete NDB files
- Removed "mkisofs" binaries
- Removed the "cvs2cl.pl" script
- Changed a few GPL texts to use "program" instead of "library"
2010-12-28 19:57:23 +01:00
Vasil Dimov
57c910ff6c Merge mysql-5.5-bugteam -> mysql-5.5-innodb 2010-12-27 19:24:05 +02:00
Tor Didriksen
029a5df870 Bug #58699 cannot build with gcc dbg on solaris
cmake/os/SunOS.cmake:
  Remove TARGET_OS_SOLARIS
config.h.cmake:
  Remove TARGET_OS_SOLARIS
  Add PTHREAD_ONCE_INITIALIZER
configure.cmake:
  Add function for testing whether we need { PTHREAD_ONCE_INIT } rather than PTHREAD_ONCE_INIT
include/my_pthread.h:
  Use PTHREAD_ONCE_INITIALIZER if set by cmake.
include/mysql/psi/mysql_file.h:
  Include my_global.h first, to get correct platform definitions.
mysys/ptr_cmp.c:
  Hide the unused static functions in #ifdef's on solaris.
  Use __sun (defined by both gcc and SunPro cc) rather than TARGET_OS_SOLARIS
sql/my_decimal.cc:
  Include my_global.h first, to get correct platform definitions.
sql/mysqld.cc:
  Fix signed/unsigned comparison warning.
sql/sql_audit.h:
  Include my_global.h first, to get correct platform definitions.
sql/sql_plugin.h:
  Include my_global.h first, to get correct platform definitions.
sql/sql_show.cc:
  Fix: warning: cast from pointer to integer of different size
sql/sys_vars.h:
  Use reinterpret_cast rather than c-style cast.
storage/perfschema/pfs_instr.cc:
  Include my_global.h first, to get correct platform definitions.
2010-12-21 13:00:26 +01:00
Jonathan Perkin
30cfda089f bug#51925: 5.5 installed header file layout is incorrect
The 'mysql' include sub-directory was copied directly into
include/ rather than retaining its own directory.

Fix this, and update mysql_config which needs additional
logic to detect the correct prefix for includes.
2010-12-17 23:08:43 +00:00
Mikael Ronstrom
247ecb7597 BUG#59013, make partition handler not miss HA_STATUS_NO_LOCK, add HA_STATUS_VARIABLE_EXTRA to remove InnoDB bottleneck 2010-12-17 21:58:40 +01:00
Tor Didriksen
fda6290041 Bug #58426 Crashing tests not failing as they are supposed to on Solaris 10 debug
On this platform we seem to get lots of other signals
while waiting for SIGKILL to be delivered.

Solution: use sigsuspend(<all signals blocked>)



dbug/dbug.c:
  New function _db_suicide_() which does kill(myself, -9) and then waits forever.
include/my_dbug.h:
  Let DBUG_SUICE wait forever until the KILL signal is delivered, and process dies.
2010-12-13 17:13:01 +01:00
Vasil Dimov
5bc314e5c5 Merge mysql-5.5-bugteam -> mysql-5.5-innodb 2010-12-12 11:23:51 +02:00
Ramil Kalimullin
d740bd50a9 Manual merge with mysql-5.1-bugteam. 2010-12-09 13:49:11 +03:00
Ramil Kalimullin
0137e02899 Fix for bug#48451: my_seek and my_tell ignore MY_WME flag
my_seek() and my_tell() functions now honour MY_WME flag.


include/mysys_err.h:
  Fix for bug#48451: my_seek and my_tell ignore MY_WME flag
    - EE_CANT_SEEK added, used in my_seek() and my_tell() functions.
mysys/errors.c:
  Fix for bug#48451: my_seek and my_tell ignore MY_WME flag
    - EE_CANT_SEEK added, used in my_seek() and my_tell() functions.
mysys/my_seek.c:
  Fix for bug#48451: my_seek and my_tell ignore MY_WME flag
    - my_seek() and my_tell() handle MY_WME flag.
mysys/my_symlink.c:
  Fix for bug#48451: my_seek and my_tell ignore MY_WME flag
    - __attribute__((unused)) removed, as myf MyFlags is
  actually used in the my_realpath() function.
storage/myisam/ha_myisam.cc:
  Fix for bug#48451: my_seek and my_tell ignore MY_WME flag
    - check my_seek() result.
2010-12-09 12:59:12 +03:00
Sergey Vojtovich
9a3e46c520 WL#5571 - Audit interface: MYSQL_AUDIT_GENERAL_STATUS event
include/mysql/plugin_audit.h:
  Connection auditing class.
include/mysql/plugin_audit.h.pp:
  Connection auditing class.
sql/mysqld.cc:
  Notify disconnect to auditing.
sql/sql_audit.cc:
  Connection class event dispatcher.
sql/sql_audit.h:
  mysql_audit_notify() is not available in embedded.
sql/sql_connect.cc:
  Notify connect to auditing.
sql/sql_parse.cc:
  Notify user change to auditing.
2010-12-14 17:34:23 +03:00
Tor Didriksen
8d311a8551 Automerge 5.1-bugteam => 5.5-bugteam 2010-12-13 17:13:31 +01:00
Tor Didriksen
0611bf2203 Bug #58426 Crashing tests not failing as they are supposed to on Solaris 10 debug
On this platform we seem to get lots of other signals
while waiting for SIGKILL to be delivered.

Solution: use sigsuspend(<all signals blocked>)



dbug/dbug.c:
  New function _db_suicide_() which does kill(myself, -9) and then waits forever.
include/my_dbug.h:
  Let DBUG_SUICE wait forever until the KILL signal is delivered, and process dies.
2010-12-13 12:19:30 +01:00
Vasil Dimov
7a8ca24d31 Merge mysql-5.5-bugteam -> mysql-5.5-innodb 2010-12-05 21:17:01 +02:00
Alfranio Correia
b28d2c25a7 merge mysql-5.5-bugteam(local) --> mysql-5.5-bugteam 2010-12-03 01:06:56 +00:00
Mats Kindahl
8c937b86b2 Bug #58246: INSTALL PLUGIN not secure & crashable
Adding symbol FN_DIRSEP to Windows as well.
2010-12-02 09:18:47 +01:00
Mats Kindahl
65faf729cd Merging patch for BUG#58246 into mysql-5.5-bugteam. 2010-12-01 23:15:14 +01:00
Mats Kindahl
9c87ae9ba7 Merging patch for BUG#58246 with mysql-5.1-bugteam. 2010-12-01 20:33:31 +01:00
Mats Kindahl
fc9f3efaec BUG#58246: INSTALL PLUGIN not secure & crashable
When installing plugins, there is a missing check
for slash (/) in the path on Windows. Note that on
Windows, both / and \ can be used to separate
directories.

This patch fixes the issue by:
- Adding a FN_DIRSEP symbol for all platforms
  consisting of a string of legal directory
  separators.
- Adding a charset-aware version of strcspn().
- Adding a check_valid_path() function that uses
  my_strcspn() to check if any FN_DIRSEP character
  is in the supplied string.
- Using the check_valid_path() function in
  sql_plugin.cc and sql_udf.cc (which means
  replacing the existing test there).

include/config-netware.h:
  Adding FN_DIRSEP
  ******
  Adding FN_DIRSEP
include/config-win.h:
  Adding FN_DIRSEP
  ******
  Adding FN_DIRSEP
include/m_ctype.h:
  Adding my_strspn() and my_strcspn().
  
  ******
  Adding my_strspn() and my_strcspn().
include/my_global.h:
  Adding FN_DIRSEP
  ******
  Adding FN_DIRSEP
mysql-test/t/plugin_not_embedded.test:
  Adding test that file names containing / is
  disallowed on *all* platforms.
  ******
  Adding test that file names containing / is
  disallowed on *all* platforms.
sql/sql_plugin.cc:
  Introducing check_if_path() function for
  checking if filename is a path to include
  / on Windows.
  ******
  Introducing check_if_path() function for
  checking if filename is a path to include
  / on Windows.
sql/sql_udf.cc:
  Switching to use check_if_path() function.
  ******
  Switching to use check_if_path() function.
strings/my_strchr.c:
  Adding my_strspn() and my_strcspn().
  ******
  Adding my_strspn() and my_strcspn().
2010-12-01 13:54:50 +01:00
Davi Arnaut
cfe8acb198 Bug#56760: my_atomics failures on osx10.5-x86-64bit
The problem was due to a misuse of GCC asm constraints used to
implement a atomic load. On x86_64, the load was implemented
as a cmpxchg which implicitly uses the eax register as a
source and destination operand, yet the dummy value used for
comparison wasn't being properly loaded into eax (and other
problems).

The core problem is that cmpxchg is unnecessary as a load
on x86_64 as there are other simpler instructions such
as xadd. Even though, such instructions are only used to
have a memory barrier as load and stores are atomic by
definition. Hence, the solution is to explicitly issue the
required CPU and compiler barriers.

include/atomic/x86-gcc.h:
  Issue a synchronizing instruction before loading the value.
  Afterwards, issue a compiler barrier to prevent reordering.
2010-11-30 21:19:49 -02:00
Davi Arnaut
e1e81ceb83 Merge of mysql-5.1-bugteam into mysql-5.5-bugteam. 2010-11-30 17:06:53 -02:00
Vasil Dimov
9939a12445 Merge mysql-5.5-bugteam -> mysql-5.5-innodb 2010-11-29 09:08:23 +02:00
Davi Arnaut
d5e928959e Bug#51817: incorrect assumption: thd->query at 0x2ab2a8360360 is an invalid pointer
The problem is that the logic which checks if a pointer is
valid relies on a poor heuristic based on the start and end
addresses of the data segment and heap.

Apart from miscalculating the heap bounds, this approach also
suffers from the fact that memory can come from places other
than the heap. See Bug#58528 for a more detailed explanation.

On Linux, the solution is to access the process's memory
through /proc/self/task/<tid>/mem, which allows for retrieving
the contents of pages within the virtual address space of
the calling process. If a address range is not mapped, a
input/output error is returned.

client/mysqltest.cc:
  Use new interface to my_safe_print_str.
include/my_stacktrace.h:
  Drop name from my_safe_print_str.
mysys/stacktrace.c:
  Access the process's memory through a file descriptor and
  dump the contents of the memory range. The file descriptor
  offset is equivalent to a offset into the address space.
  
  Do not print the name of the variable associated with the
  address. It can be better accomplished at a higher level.
sql/mysqld.cc:
  Put the variable dumping information within its own newline block.
  Use symbolic names which better convey information to the user.
2010-11-26 19:59:10 -02:00
Alexander Barkov
e3dee8a7fd Bug#57737 Character sets: search fails with like, contraction, index
Problem: LIKE over an indexed column optimized away good results,
because my_like_range_utf32/utf16 returned wrong ranges for contractions.
Contraction related code was missing in my_like_range_utf32/utf16,
but did exist in my_like_range_ucs2/utf8.
It was forgotten in utf32/utf16 versions (during mysql-6.0 push/revert mess).

Fix:
The patch removes individual functions my_like_range_ucs2,
my_like_range_utf16, my_like_range_utf32 and introduces a single function
my_like_range_generic() instead. The new function handles contractions
correctly. It can handle any character set with cs->min_sort_char and
cs->max_sort_char represented in Unicode code points.

added:
  @ mysql-test/include/ctype_czech.inc
  @ mysql-test/include/ctype_like_ignorable.inc
  @ mysql-test/r/ctype_like_range.result
  @ mysql-test/t/ctype_like_range.test
  Adding tests


modified:

  @ include/m_ctype.h
  - Adding helper functions for contractions.
  - Prototypes: removing ucs2,utf16,utf32 functions, adding generic function.
  @ mysql-test/r/ctype_uca.result
  @ mysql-test/r/ctype_utf16_uca.result
  @ mysql-test/r/ctype_utf32_uca.result
  @ mysql-test/t/ctype_uca.test
  @ mysql-test/t/ctype_utf16_uca.test
  @ mysql-test/t/ctype_utf32_uca.test
  - Adding tests.

  @ strings/ctype-mb.c
  - Pad function did not put the last character.
  - Implementing my_like_range_generic() - an universal replacement
    for three separate functions
    my_like_range_ucs2(), my_like_range_utf16() and my_like_range_utf32(),
    with correct contraction handling.

  @ strings/ctype-ucs2.c
  - my_fill_mb2 did not put the high byte, as previously
    it was used to put only characters in ASCII range.
    Now it puts high byte as well
    (needed to pupulate cs->max_sort_char correctly).
  - Adding DBUG_ASSERT()
  - Removing character set specific functions:
    my_like_range_ucs2(), my_like_range_utf16() and my_like_range_utf32().
  - Using my_like_range_generic() instead of the old functions.

  @ strings/ctype-uca.c
  - Using generic function instead of the old character set specific ones.

  @ sql/item_create.cc
  @ sql/item_strfunc.cc
  @ sql/item_strfunc.h
  - Adding SQL functions LIKE_RANGE_MIN and LIKE_RANGE_MAX,
    available only in debug build to make sure like_range()
    works correctly for all character sets and collations.
2010-11-26 13:44:39 +03:00
Vasil Dimov
d5787a3c59 Fix Bug#57739 Scary messages in error log
Silence a warning about old table name when InnoDB tests whether the
format has changed using a nonexistent table name.

Reviewed by:	bar@mysql.com, marko.makela@oracle.com
2010-11-22 16:08:51 +02:00