Commit graph

26152 commits

Author SHA1 Message Date
Mayank Prasad
d2e36e4258 BUG #11760210: 52596: SSL_CIPHER_LIST NOT SET OR RETURNED FOR "SHOW STATUS LIKE 'SSL_CIPHER_LIST'"
Issue:
      SSL_CIPHER set to a specific CIPHER name was not getting picked up by SHOW STATUS Command.

Solution:
      If specific cipher name is specified, avoid overwriting of Cipher List with default Cipher names.


extra/yassl/src/yassl_int.cpp:
  If user specified Cipher name is there, avoid populating default
  cipher names' list.
mysql-test/r/ssl_cipher.result:
  Expected file for ssl_cipher.test test case
mysql-test/t/ssl_cipher-master.opt:
  Server option file for ssl_cipher.test test case.
mysql-test/t/ssl_cipher.test:
  Test case to verify that user specified SSL cipher name is shown in SHOW STATUS Command.
2011-03-11 16:16:34 +05:30
Bjorn Munch
782b44bc7f merge from 5.1 main 2011-03-11 10:07:34 +01:00
Mattias Jonsson
ba85e3cf54 Merge of Bug#11766232 - bug#59297 2011-03-09 18:12:23 +01:00
Bjorn Munch
037d9fae72 merge from 5.1 main 2011-03-08 18:52:56 +01:00
unknown
d2ac3542f2 Merge from mysql-5.1.56-release 2011-03-03 21:11:47 +01:00
Alexander Barkov
a1e9be8e8b Bug 11766519 - 59648: MY_STRTOLL10_MB2: ASSERTION `(*ENDPTR - S) % 2 == 0' FAILED.
Part 2. Function QUOTE() was not multi-byte safe.

  @ mysql-test/r/ctype_ucs.result
  @ mysql-test/t/ctype_ucs.test
  Adding tests

  @ sql/item_strfunc.cc
  Fixing Item_func_quote::val_str to be multi-byte safe.

  @ sql/item_strfunc.h
  Multiple size needed for quote characters to mbmaxlen
2011-03-03 18:39:26 +03:00
Alexander Barkov
1bc5e76efb BUG#11766519 (bug#59648): MY_STRTOLL10_MB2: ASSERTION `(*ENDPTR - S) % 2 == 0' FAILED
Problem: wrong character set pointer was passed to my_strtoll10_mb2,
which led to DBUG_ASSERT failure in some cases.

  @ mysql-test/r/func_encrypt_ucs2.result
  @ mysql-test/t/func_encrypt_ucs2.test
  @ mysql-test/r/ctype_ucs.result
  @ mysql-test/t/ctype_ucs.test
  Adding tests

  @ sql/item_func.cc
  "cs" initialization was wrong (res does not necessarily point to &str_value)

  @ sql/item_strfunc.cc
  Item_func_dec_encrypt::val_str() and Item_func_des_descrypt::val_str()
  did not set character set for tmp_value (the returned value),
  so the old value, which was previously copied from args[1]->val_str(),
  was incorrectly returned with tmp_value.
2011-03-03 15:04:04 +03:00
Vinay Fisrekar
845e36e1a9 Bug#11766165 - 59211: SELECT RETURNS DIFFERENT VALUE FOR MIN(YEAR) FUNCTION
Result File Correction For Bug Fix
2011-03-01 21:26:24 +05:30
Alexander Barkov
fd1e3b03ff Bug#11766725 (Bug#59901) EXTRACTVALUE STILL BROKEN AFTER FIX FOR BUG #44332
Problem: a byte behind the end of input string was read
in case of a broken XML not having a quote or doublequote
character closing a string value.

Fix: changing condition not to read behind the end of input string

  @ mysql-test/r/xml.result
  @ mysql-test/t/xml.test
  Adding tests

  @ strings/xml.c
  When checking if the closing quote/doublequote was found,
  using p->cur[0] us unsafe, as p->cur can point to the byte after the value.
  Comparing p->cur to p->beg instead.
2011-03-01 15:30:18 +03:00
Bjorn Munch
4a54e5adb1 Attempt at solving missing end of mtr output on Windows 2011-02-28 16:10:35 +01:00
Bjorn Munch
e58e15ff13 merge from 5.1 main 2011-02-24 15:07:51 +01:00
Bjorn Munch
8b3f956020 Bug #11762407 54999: MTR GLOBAL SUPPRESSION HIDES SQL THREAD EXECUTION UNEXPECTED ERRORS
Removed the global suppression, added lots of local ones to affected tests
Re-commit, now kept "Slave SQL" at start of patterns.
2011-02-23 10:31:37 +01:00
Nirbhay Choubey
f27a13cf09 Postfix for tests failing due to fix for bug#11766310. 2011-02-22 19:28:50 +05:30
Nirbhay Choubey
876502d743 Bug#11766310 : 59398: MYSQLDUMP 5.1 CAN'T HANDLE A DASH
("-") IN DATABASE NAMES IN ALTER DATABASE.

mysqldump did not quote database name in 'ALTER DATABASE'
statements in its output. This can further cause a failure
while loading if database name contains a hyphen '-'.

This happened as, while printing the 'ALTER DATABASE'
statements, the database name was not quoted.

Fixed by quoting the database name.


client/mysqldump.c:
  Bug#11766310 : 59398: MYSQLDUMP 5.1 CAN'T HANDLE A DASH
                 ("-") IN DATABASE NAMES IN ALTER DATABASE.
  
  Modified the print statement in order to print the quoted
  database name for 'ALTER DATABASE' statements.
mysql-test/r/mysqldump.result:
  Added a test case for bug#11766310.
mysql-test/t/mysqldump.test:
  Added a test case for bug#11766310.
2011-02-21 12:37:24 +05:30
Vasil Dimov
4b7a924732 Merge mysql-5.1-innodb -> mysql-5.1 2011-02-18 14:57:11 +02:00
Martin Hansson
61b256177b Bug#11766675 - 59839: Aggregation followed by subquery yields wrong result
The loop that was looping over subqueries' references to outer field used a
local boolean variable to tell whether the field was grouped or not. But the
implementor failed to reset the variable after each iteration. Thus a field
that was not directly aggregated appeared to be.

Fixed by resetting the variable upon each new iteration.
2011-02-18 11:50:06 +01:00
Marko Mäkelä
c83889d9d6 Allow 30 seconds for slow shutdown in the Bug #60049 test. 2011-02-17 22:25:33 +02:00
Vasil Dimov
a27d85aa46 Fix the non-determinism in innodb_information_schema.test
Thanks to Kristian Nielsen for finding out the root cause for the
failure, see: https://bugs.launchpad.net/maria/+bug/677407
2011-02-17 19:09:53 +02:00
Vasil Dimov
cc7b3de9fc Merge mysql-5.1 from bk-internal into my local repo 2011-02-17 14:07:39 +02:00
Vasil Dimov
0bbaf6e8a7 Merge mysql-5.1-innodb -> mysql-5.1 2011-02-17 13:56:05 +02:00
Magne Mahre
6503226743 Bug#48053 String::c_ptr has a race and/or does an invalid
memory reference

There are two issues present here.
  1) There is a possibility that we test a byte beyond the
     allocated buffer

  2) We compare a byte that might never have been
     initalized to see if it's 0.

The first issue is not triggered by existing code, but an
ASSERT has been added to safe-guard against introducing
new code that triggers it.

The second issue is what triggers the Valgrind warnings
reported in the bug report. A buffer is allocated in
class String to hold the value. This buffer is populated
by the character data constituting the string, but is not
zero-terminated in most cases.  Testing if it is indeed
zero-terminated means that we check a byte that has never
been explicitly set, thus causing Valgrind to trigger.

Note that issue 2 is not a serious problem.  The variable
is read, and if it's not zero, we will set it to zero.
There are no further consequences.

Note that this patch does not fix the underlying problems
with issue 1, as it is deemed too risky to fix at this
point (as noted in the bug report).  As discussed in
the report, the c_ptr() method should probably be
replaced, but this requires a thorough analysis of the
~200 calls to the method.


sql/set_var.cc:
  These two cases have been reported to fail
  with Valgrind.
2011-02-17 12:43:53 +01:00
Marko Mäkelä
61449541fb Disable the Bug #60049 test on embedded, as it requires server restart. 2011-02-17 09:45:07 +02:00
Bjorn Munch
ee2f9d868c Simple fix of suppress pattern in test insert_select 2011-02-16 21:43:12 +01:00
Marko Mäkelä
6459e2c3e1 Make the implicit unpack parameter explicit in the Bug #60049 test. 2011-02-16 15:34:16 +02:00
Dmitry Lenev
9c89cca5e3 Fix for bug#11766714 (former bug @59888) "debug assertion when
attempt to create spatial index on char > 31 bytes".

Attempt to create spatial index on char field with length
greater than 31 byte led to assertion failure on server
compiled with safemutex support.

The problem occurred in mi_create() function which was called
to create a new version of table being altered. This function
failed since it detected an attempt to create a spatial key
on non-binary column and tried to return an error.
On its error path it tried to unlock THR_LOCK_myisam mutex
which has not been not locked at this point. Indeed such an
incorrect behavior was caught by safemutex wrapper and caused
assertion failure.

This patch fixes the problem by ensuring that mi_create()
doesn't releases THR_LOCK_myisam mutex on error path if it was
not acquired.

mysql-test/r/gis.result:
  Added test for bug @59888 "debug assertion when attempt to
  create spatial index on char > 31 bytes".
mysql-test/t/gis.test:
  Added test for bug @59888 "debug assertion when attempt to
  create spatial index on char > 31 bytes".
storage/myisam/mi_create.c:
  Changed mi_create() not to release THR_LOCK_myisam mutex on
  error path if it was not acquired.
2011-02-15 14:03:05 +03:00
Marko Mäkelä
cb884043b6 Add a test for suspected Bug#60049. 2011-02-15 12:12:27 +02:00
Marko Mäkelä
0efaef7d46 Bug#59307 Valgrind: uninitialized value in rw_lock_set_writer_id_and_recursion_flag()
rw_lock_create_func(): Initialize lock->writer_thread, so that Valgrind
will not complain even when Valgrind instrumentation is not enabled.
Flag lock->writer_thread uninitialized, so that Valgrind can complain
when it is used uninitialized.

rw_lock_set_writer_id_and_recursion_flag(): Revert the bogus Valgrind
instrumentation that was pushed in the first attempt to fix this bug.
2011-02-15 10:51:33 +02:00
Georgi Kodinov
6b1b898ef6 weave merge mysql-5.1->mysql-5.1-security 2011-02-09 10:30:44 +02:00
Vasil Dimov
aa7a928502 Merge mysql-5.1-innodb -> mysql-5.1 2011-02-08 19:26:42 +02:00
unknown
17fe23e46c Merge from mysql-5.1.55-release 2011-02-08 12:52:33 +01:00
John H. Embretsen
994132add6 Fix for Bug#59837 - mysqlhotcopy fails with wrong error (11) on specific platforms:
Test failed on a certain Linux platform in automated environment. It turns out that this platform has an old version of Perl modules DBI and DBD::mysql installed, as well as the OS itself being relatively old.
Allowing error code 11 to be returned from mysqlhotcopy on expected error seems harmless and will make the test pass also with older libraries.
2011-02-08 10:51:09 +01:00
Anitha Gopi
38fb61ec94 Removed the collections for mysql-5.1-bugteam. Removed 1st from weekly. This is part of default suites 2011-02-08 12:18:11 +05:30
Anitha Gopi
12c68dbf16 Removed the collections for mysql-5.1-bugteam. Removed 1st from weekly. This is part of default suites 2011-02-08 11:30:35 +05:30
Bjorn Munch
285c7d0425 merge 47141,59979 2011-02-08 00:02:45 +01:00
Vasil Dimov
fe40394908 Backport the fix for Bug#59875 Valgrind warning in buf0buddy.c from 5.5
This warning also happens in 5.1 with a slightly different codepath.
2011-02-07 16:45:37 +02:00
Dmitry Lenev
f74fd118cf Merged fix for bug #36544 "DROP USER does not remove stored
function privileges" into 5.5 tree. Did after-merge fixes.
2011-02-07 15:06:22 +03:00
Bjorn Munch
114ac525f2 Bug #59979 Add mtr option to run debug server, but without turning on debug
Added --debug-server and use $opt_debug_server where appropriate
Let --debug imply --debug-server
When merging to 5.5, must adapt fix for 59148
Oops, set debug => debug-server too late, fixed
2011-02-07 12:42:21 +01:00
Dmitry Lenev
b169b8d853 Fix for bug#36544 "DROP USER does not remove stored function
privileges".

The first problem was that DROP USER didn't properly remove privileges 
on stored functions from in-memory structures. So the dropped user
could have called stored functions on which he had privileges before
being dropped while his connection was still around.
Even worse if a new user with the same name was created he would
inherit privileges on stored functions from the dropped user.
Similar thing happened with old user name and function privileges
during RENAME USER.

This problem stemmed from the fact that the handle_grant_data() function
which handled DROP/RENAME USER didn't take any measures to update
in-memory hash with information about function privileges after
updating them on disk.

This patch solves this problem by adding code doing just that.

The second problem was that RENAME USER didn't properly update in-memory
structures describing table-level privileges and privileges on stored 
procedures. As result such privileges could have been lost after a rename
(i.e. not associated with the new name of user) and inherited by a new
user with the same name as the old name of the original user.

This problem was caused by code handling RENAME USER in
handle_grant_struct() which [sic!]:
a) tried to update wrong (tables) hash when updating stored procedure
   privileges for new user name.
b) passed wrong arguments to function performing the hash update and
   didn't take into account the way in which such update could have
   changed the order of the hash elements.

This patch solves this problem by ensuring that a) the correct hash
is updated, b) correct arguments are used for the hash_update()
function and c) we take into account possible changes in the order
of hash elements.

mysql-test/r/grant.result:
  Added test coverage for bug#36544 "DROP USER does not remove stored
  function privileges".
mysql-test/suite/funcs_1/r/innodb_storedproc_06.result:
  Since after fixing bug#36544 "DROP USER does not remove stored function
  privileges" in-memory structures are correctly updated by DROP USER,
  DROP FUNCTION performed after DROP USER for its definer no longer
  produces unwarranted warning/error messages.
mysql-test/suite/funcs_1/r/memory_storedproc_06.result:
  Since after fixing bug#36544 "DROP USER does not remove stored function
  privileges" in-memory structures are correctly updated by DROP USER,
  DROP FUNCTION performed after DROP USER for its definer no longer
  produces unwarranted warning/error messages.
mysql-test/suite/funcs_1/r/myisam_storedproc_06.result:
  Since after fixing bug#36544 "DROP USER does not remove stored function
  privileges" in-memory structures are correctly updated by DROP USER,
  DROP FUNCTION performed after DROP USER for its definer no longer
  produces unwarranted warning/error messages.
mysql-test/t/grant.test:
  Added test coverage for bug#36544 "DROP USER does not remove stored
  function privileges".
sql/sql_acl.cc:
  Changed handle_grant_data() to also update hash with function 
  privileges. This allows DROP/RENAME USER correctly keep this 
  in-memory structure up-to-date.
  
  To do this extended handle_grant_struct() to support updating of this
  hash. In addition fixed code in this function which is responsible for 
  handling of column and routine hashes during RENAME USER, ensured that
  we correctly update these hashes after changing user name and that we
  don't skip elements while iterating through the hash and doing updates.
2011-02-07 14:01:19 +03:00
Ole John Aske
221ce9223d Fix for bug#59308: Incorrect result for SELECT DISTINCT <col>... ORDER BY <col> DESC.
Also fix bug#59110: Memory leak of QUICK_SELECT_I allocated memory.
Includes Jørgen Lølands review comments.
      
Root cause of these bugs are that test_if_skip_sort_order() decided to
revert the 'skip_sort_order' descision (and use filesort) after the
query plan has been updated to reflect a 'skip' of the sort order.
      
This might happen in 'check_reverse_order:' if we have a 
select->quick which could not be made descending by appending 
a QUICK_SELECT_DESC. ().
      
The original 'save_quick' was then restored after the QEP has been modified,
which caused:
      
  - An incorrect 'precomputed_group_by= TRUE' may have been set, 
    and not reverted, as part of the already modifified QEP (Bug#59308)
  - A 'select->quick' might have been created which we fail to delete (bug#59110).
      
This fix is a refactorication of test_if_skip_sort_order() where all logic
related to modification of QEP (controlled by argument 'bool no_changes'), is
moved to the end of test_if_skip_sort_order(), and done after *all* 'test_if_skip'
checks has been performed - including the 'check_reverse_order:' checks.
      
The refactorication above contains now intentional changes to the logic which 
has been moved to the end of the function.
      
Furthermore, a smaller part of the fix address the handling of the 
select->quick objects which may already exists when we call 
'test_if_skip_sort_order()' (save_quick) -and
new select->quick's created during test_if_skip_sort_order():
      
  - Before new select->quick may be created by calling ::test_quick_select(), we
    set 'select->quick= 0' to avoid that ::test_quick_select() prematurely
    delete the save_quick's. (After this call we may have both a 'save_quick' 
    and 'select->quick')
      
  - All returns from ::test_if_skip_sort_order() where we may have both a
    'save_quick' and a 'select->quick' has been changed to goto's to the
    exit points 'skiped_sort_order:' or 'need_filesort:' where we
    decide which of the QUICK_SELECT's to keep, and delete the other.
2011-02-07 10:36:21 +01:00
Vasil Dimov
165ed4f1a8 Use fun:* instead of obj:*/libz.so* because when the bundled zlib is
used (--with-zlib-dir=bundled) then there is no libz.so involved.
2011-02-07 11:13:54 +02:00
Vinay Fisrekar
e29b40f86f Bug#59955 - engines/funcs/ps_string_not_null test needs better cleanup
Correcting clean up command at the start of test.
2011-02-07 11:10:35 +05:30
Dmitry Shulga
980868eb4e Fixed bug#57450 - mysql client enter in an infinite loop
if the standard input is a directory.

The problem is that mysql monitor try to read from stdin without
checking input source type.

The solution is to stop reading data from standard input if a call
to read(2) failed.

A new test case was added into mysql.test.

client/my_readline.h:
  Data members error and truncated was added to LINE_BUFFER structure.
  These data members used instead of out parameters in functions
  batch_readline, intern_read_line.
client/mysql.cc:
  read_and_execute() was modified: set status.exit_status to 1
  when the error occured while reading the next command line in
  non-interactive mode. Also the value of the truncated attribute
  of structure LINE_BUFF is taken into account only for non-iteractive mode.
client/readline.cc:
  intern_read_line() was modified: cancel reading from input if
  fill_buffer() returns -1, e.g. if call to read failed.
  batch_readline was modified: set the error data member of LINE_BUFFER
  structure to value of my_errno when system error happened during call
  to my_read/my_realloc.
mysql-test/t/mysql.test:
  Test for bug#57450 was added.
2011-02-05 11:02:00 +06:00
Luis Soares
7c8c7c27b5 BUG#59147: Automerged bzr bundle form bug report into mysql-5.1 . 2011-02-04 14:57:51 +00:00
Bjorn Munch
bb3e48c29a merge from 5.1 main 2011-02-04 12:37:01 +01:00
Bjorn Munch
cd51cbf1e5 Bug #47141 "mysqltest" breaks because it tries to act on a debug option which is disabled
Replace --debug with --loose-debug to prevent failure exit
Update: added workaround for 50627, skip all debugging of mysqlbinlog
2011-02-04 12:33:45 +01:00
Vasil Dimov
5082c4d1de Fix Bug#59874 Valgrind warning in InnoDB compression code
Add suppressions for a bogus valgrind warnings.
2011-02-04 12:46:47 +02:00
Dmitry Shulga
378091e434 Fixed bug#58026 - massive recursion and crash in regular expression
handling.

The problem was that parsing of nested regular expression involved
recursive calls. Such recursion didn't take into account the amount of
available stack space, which ended up leading to stack overflow crashes.

mysql-test/t/not_embedded_server.test:
  Added test for bug#58026.
regex/my_regex.h:
  added pointer to function as last argument of my_regex_init() for check
  enough memory in stack.
regex/regcomp.c:
  p_ere() was modified: added call to function for check enough memory
  in stack. Function for check available stack space specified by
  global variable my_regex_enough_mem_in_stack. This variable set to
  NULL for embedded mysqld and to a pointer to function
  check_enough_stack_size otherwise.
regex/reginit.c:
  my_regex_init was modified: pass a pointer to a function for check
  enough memory in stack space. Reset this pointer to NULL in my_regex_end.
sql/mysqld.cc:
  Added function check_enough_stack_size() for check enough memory in stack.
  Passed this function as second argument to my_regex_init. For embedded 
  mysqld passed NULL as second argument.
2011-02-04 10:47:46 +06:00
Luis Soares
cb10771fd8 BUG#59147: rpl_circular_for_4_hosts fails sporadically
There is one part of the test case that needs to break
and re-establish the circular topology. For this the test
stops the slave threads on a couple of servers and restarts
them with START SLAVE. However, no check is done on the
status of the IO or SQL threads before proceeding with
the subsequent commands.
      
Because rpl_only_running_threads is set to 1 this can lead
to silently not syncing all slave threads as expected, 
ultimately resulting in unexpected results (and consequently
on a failing test run).
      
We fix this by replacing the START SLAVE instructions with
calls to --source include/start_slave.inc, which will wait
for the slave threads to be running (show 'Yes' in 
Slave_IO|SQL_Running fields of SHOW SLAVE STATUS) before 
proceeding. Additionally, we change rpl_sync.inc to make the
IO thread report that it is running when its running status
is any other than 'No'.
2011-02-03 16:09:33 +00:00
Georgi Kodinov
a265fde655 merge 2011-02-02 20:13:11 +02:00
Georgi Kodinov
0a8419dfdd Bug #52315 part 2 addendum : reset back the timestamp 2011-02-02 20:10:57 +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
Dmitry Lenev
e805a0fd9d Fix for bug #58650 "Failing assertion: primary_key_no == -1 ||
primary_key_no == 0".

Attempt to create InnoDB table with non-nullable column of
geometry type having an unique key with length 12 on it and
with some other candidate key led to server crash due to
assertion failure in both non-debug and debug builds.

The problem was that such a non-candidate key could have
been sorted as the first key in table/.FRM, before any legit
candidate keys. This resulted in assertion failure in InnoDB
engine which assumes that primary key should either be the
first key in table/.FRM or should not exist at all.

The reason behind such an incorrect sorting was an wrong
value of Create_field::key_length member for geometry field
(which was set to its pack_length == 12) which confused code
in mysql_prepare_create_table(), so it would skip marking
such key as a key with partial segments.

This patch fixes the problem by ensuring that this member
gets the same value of Create_field::key_length member as 
for other blob fields (from which geometry field class is
inherited), and as result unique keys on geometry fields
are correctly marked as having partial segments.


mysql-test/include/gis_keys.inc:
  Added test case for bug #58650 "Failing assertion:
  primary_key_no == -1 || primary_key_no == 0".
mysql-test/r/gis.result:
  Added test case for bug #58650 "Failing assertion:
  primary_key_no == -1 || primary_key_no == 0".
mysql-test/suite/innodb/r/innodb_gis.result:
  Added test case for bug #58650 "Failing assertion:
  primary_key_no == -1 || primary_key_no == 0".
mysql-test/suite/innodb_plugin/r/innodb_gis.result:
  Added test case for bug #58650 "Failing assertion:
  primary_key_no == -1 || primary_key_no == 0".
sql/field.cc:
  Changed Create_field::create_length_to_internal_length() to
  correctly set Create_field::key_length member for geometry
  fields. Similar to the blob types key_length for such fields
  should be the same as length and not field's packed length
  (which is always 12 for geometry).
  
  As result of this change code handling table creation now
  always correctly identifies btree/unique keys on geometry
  fields as partial keys, so such keys can't be erroneously
  treated as candidate keys and sorted in keys array in .FRM
  before legit candidate keys.
  
  This fixes bug #58650 "Failing assertion: primary_key_no ==
  -1 || primary_key_no == 0" in which incorrect candidate key
  sorting led to assertion failure in InnoDB code.
2011-02-02 16:17:48 +03:00
Ole John Aske
59269b1da1 Fix for bug#57030: ('BETWEEN' evaluation is incorrect')
Root cause for this bug is that the optimizer try to detect&
optimize the special case:
      
'<field>  BETWEEN c1 AND c1' and handle this as the condition '<field>  = c1'
            
This was implemented inside add_key_field(.. *field, *value[]...)
which assumed field to refer key Field, and value[] to refer a [low...high]
constant pair. value[0] and value[1] was then compared for equality.
            
In a 'normal' BETWEEN condition of the form '<field>  BETWEEN val1 and val2' the
BETWEEN operation is represented with an argementlist containing the
values [<field>, val1, val2] - add_key_field() is then called with
parameters field=<field>, *value=val1.
            
However, if the BETWEEN predicate specified:
            
 1)  '<const1>  BETWEEN<const2>  AND<field>
            
the 'field' and 'value' arguments to add_key_field() had to be swapped.
This was implemented by trying to cheat add_key_field() to handle it like:
            
 2) '<const1>  GE<const2>  AND<const1>  LE<field>'
            
As we didn't really replace the BETWEEN operation with 'ge' and 'le',
add_key_field() still handled it as a 'BETWEEN' and compared the (swapped)
arguments<const1>  and<const2>  for equality. If they was equal, the
condition 1) was incorrectly 'optimized' to:
            
 3) '<field>  EQ <const1>'
            
This fix moves this optimization of '<field>  BETWEEN c1 AND c1' into
add_key_fields() which then calls add_key_equal_fields() to collect 
key equality / comparison for the key fields in the BETWEEN condition.
2011-02-01 13:20:16 +01:00
Alfranio Correia
2d2f80e07e Post-fix for BUG#59338. 2011-01-31 14:31:33 +00:00
Alfranio Correia
54c58cea3b merge mysql-5.1 (local) --> mysql-5.1 2011-01-31 10:11:01 +00:00
Alfranio Correia
ee36bd7f46 merge mysql-5.1 (local) --> mysql-5.1 2011-01-31 10:08:58 +00:00
Sandeep Doddaballapur
f6258063c6 automerge 2011-01-31 11:21:30 +05:30
Vasil Dimov
6f8c6da4b5 Merge mysql-5.1-innodb -> mysql-5.1 2011-01-30 18:41:58 +02:00
John H. Embretsen
26528be711 Fix for Bug#56817 - mysqlhotcopy tests fail when DBI and DBD-mysql perl modules are not found
Third updated patch - this version also includes copyright notice in added Perl script.
This patch implements a check for such modules at runtime. If modules are not found or unable to load, the test is skipped with 
the following message:
            
            [ skipped ]  Test needs Perl modules DBI and DBD::mysql
            
Checks are done via a helper Perl script which looks for the module in a runtime environment that is as similar to that of the 
mysqlhotcopy script as possible (thus not intended for Windows environments at this time).
The helper script tells mysql-test about the result by writing information to a temporary file that is later read by mysql-test.
See comments in added files (have_dbi_dbd-mysql.inc and checkDBI_DBD-mysql.pl) for details.
The patch also removes the mysqlhotcopy tests from the list of disabled tests.
2011-01-29 12:38:36 +01:00
Alfranio Correia
8ce9b99246 BUG#59338 Inconsistency in binlog for statements that don't change any rows STATEMENT SBR
In SBR, if a statement does not fail, it is always written to the binary
log, regardless if rows are changed or not. If there is a failure, a
statement is only written to the binary log if a non-transactional (.e.g.
MyIsam) engine is updated.

INSERT ON DUPLICATE KEY UPDATE and INSERT IGNORE were not following the
rule above and were not written to the binary log, if then engine was
Innodb.

mysql-test/extra/rpl_tests/rpl_insert_duplicate.test:
  Added test case.
mysql-test/extra/rpl_tests/rpl_insert_ignore.test:
  Updated test case.
mysql-test/include/commit.inc:
  Updated test case as the calls to the binary log have changed
  for INSERT ON DUPLICATE and INSERT IGNORE.
mysql-test/r/commit_1innodb.result:
  Updated result file.
mysql-test/suite/rpl/r/rpl_insert_duplicate.result:
  Added test case.
mysql-test/suite/rpl/r/rpl_insert_ignore.result:
  Updated result file.
mysql-test/suite/rpl/t/rpl_insert_duplicate.test:
  Added test case.
mysql-test/suite/rpl/t/rpl_insert_ignore.test:
  Improved test case.
2011-01-28 12:09:15 +00:00
Sergey Vojtovich
7a3d113d9d Merge. 2011-01-28 14:51:28 +03:00
Sergey Vojtovich
e8ffaf4ae7 Merge. 2011-01-28 14:46:10 +03:00
Alfranio Correia
235e10d987 BUG#55675 rpl.rpl_log_pos fails sporadically with error binlog truncated in the middle
There are two calls to read_log_event() on master in mysql_binlog_send().
Each call reads 19 bytes in this test case and the error of the second
read_log_event() is reported to the slave.

The second read_log_event() starts from position 94 (75 + 19) to 113
(75 + 19 + 19). Usually, there are two events in the binary log:

    . 0   - 3   - Header
    . 4   - 105 - Format Descriptor Event
    . 106 - 304 - Query Event

and both reads fail because operations are reading from invalid positions
as expected.

However, mysql_binlog_send() does not use the same IO_CACHE that is used to
write into binary log (i.e. mysql_bin_log.log_file) for the hot binary log.
It opens the binary log file directly by calling open_binlog() and creates a
separated IO_CACHE. So there is a possibly that after a master has flushed
the binary log file, the content has been cached by the filesystem, and has
not updated the disk file. If this happens, then a slave will only see part
of the file, and thus the second read_log_event() will report event truncated
error.

To fix the problem, if the first read_log_event() has failed, we ensure that
the second one will try to read from the same position.
2011-01-28 01:25:26 +00:00
Mattias Jonsson
0f96fc1159 merge 2011-01-27 23:39:17 +01:00
John H. Embretsen
9c2370c25a Merge two patches for bug 56895 into tip of mysql-5.1 branch. 2011-01-27 12:38:13 +01:00
Horst.Hunger
479a91da4e due to merge. 2011-01-27 08:59:45 +01:00
Horst.Hunger
308f8e326a Merge of results of the review done in 5.1-bugteam to 5.1. 2011-01-27 08:56:59 +01:00
Sandeep Doddaballapur
ec807c5fba 2011-01-27 11:37:55 +05:30
Mattias Jonsson
ec5e43da33 merge 2011-01-26 16:50:21 +01:00
Ramil Kalimullin
7083cb0bd9 Bug #47811 : remove the non-default alignment specification.
Fix backported from to 5.0.
"Remove the alignment option, let valgrind use its default"


mysql-test/mysql-test-run-shell.sh:
  Bug #47811 : remove the non-default alignment specification.
    - backport from 5.1
     "Remove the alignment option, let valgrind use its default"
mysql-test/mysql-test-run.pl:
  Bug #47811 : remove the non-default alignment specification.
    - backport from 5.1
     "Remove the alignment option, let valgrind use its default"
2011-01-26 15:49:09 +03:00
Alfranio Correia
e5a18c760f Disabled rpl_row_until and rpl_stm_until due to BUG#59543. 2011-01-26 12:37:24 +00:00
Bjorn Munch
e95a3a8f32 merge from 5.1 main 2011-01-25 13:07:23 +01:00
Sandeep Doddaballapur
a9d18719f6 2011-01-25 12:14:28 +05:30
Mattias Jonsson
e24398ee42 Bug#59297: Can't find record in 'tablename' on update inner join
Regression introduced in bug#52455. Problem was that the
fixed function did not set the last used partition variable, resulting
in wrong partition used when storing the position of the newly
retrieved row.

Fixed by setting the last used partition in ha_partition::index_read_idx_map.
2011-01-24 13:41:44 +01:00
Vasil Dimov
cad4ba1955 Merge mysql-5.1 -> mysql-5.1-innodb 2011-01-24 09:40:37 +02:00
Bjorn Munch
d43a3b38da Bug #59063 rpl_migration_crash_safe fails on Windows
Race condition may occur: mtr sees the .expect file but it's empty
Fix: wait and try again if file is empty
Addendum: try again if line isn't 'wait' or 'restart'
Also added verbose printout of extra restart options
2011-01-21 13:57:21 +01:00
Martin Hansson
03db0de64f Bug#59173: Failure to handle DATE(TIME) values where Year, Month or Day is
ZERO
      
When dates are represented internally as strings, i.e. when a string constant
is compared to a date value, both values are converted to long integers,
ostensibly for fast comparisons. DATE typed integer values are converted to
DATETIME by multiplying by 1,000,000 (each digit pair representing hour,
minute and second, respectively). But the mechanism did not distuinguish
cached INTEGER values, already in correct format, from newly converted
strings.

Fixed by marking the INTEGER cache as being of DATETIME format.
2011-01-19 15:09:32 +01:00
Bjorn Munch
65d6cf7946 merge from 5.1 main 2011-01-19 11:19:54 +01:00
Mattias Jonsson
d33fbe44ff Bug#59418: parts suite have several failures with --embedded-server
The test were using external tools not available for embedded.

Fixed by rewriting the test to not rely on external tools like the mysql-client

Also fixed some non portable --exec commands and replaced #p# to #P# to pass
on windows.
2011-01-18 23:55:39 +01:00
Libing Song
77bc81b89c Bug#58546 test rpl_packet timeout failure sporadically on PB
rpl_packet got a timeout failure sporadically on PB when stopping
slave. The real reason of this bug is that STOP SLAVE stopped
IO thread first and then stopped SQL thread. It was
possible that IO thread stopped after replicating part of a
transaction which SQL thread was executing. SQL thread would
be hung if the transaction could not be rolled back safely.
            
After this patch, STOP SLAVE will stop SQL thread first and then stop IO
thread, which guarantees that IO thread will fetch the reset of the
events of the transaction that SQL thread is executing, so that SQL
thread can finish the transaction if it cannot be rolled back safely.
            
Added below auxiliary files to make the test code neater.
restart_slave_sql.inc
rpl_connection_master.inc
rpl_connection_slave.inc
rpl_connection_slave1.inc
2011-01-19 01:23:49 +08:00
Bjorn Munch
00a6d119ea Bug #59063 rpl_migration_crash_safe fails on Windows
Undoing the patch, it complicates the code but is not the solution

I do not beleive newline mismatch could be the cause of this failure
First, I cannot see how this could be a problem, mtr ignores the newline
  when reading the expect file, and the file is written and read on Windows.
Second, if this really was the problem it should have been deterministic:
  either the newline is correctly interepreted or it is not.
2011-01-18 12:25:07 +01:00
Bjorn Munch
96adf25850 oops forgot one file in last commit 2011-01-18 12:11:52 +01:00
Bjorn Munch
6579abf3bb Some more copyright fixes in mtr 2011-01-18 12:01:40 +01:00
Bjorn Munch
5a85609d6b Fixed copyright headers in mtr src files 2011-01-18 11:03:44 +01:00
Alexander Barkov
5574a2cd91 Bug#44332 my_xml_scan reads behind the end of buffer
Problem: the scanner function tested for strings "<![CDATA[" and
"-->" without checking input string boundaries, which led to valgrind's
"Conditional jump or move depends on uninitialised value(s)" error.

Fix: Adding boundary checking.

  @ mysql-test/r/xml.result
  @ mysql-test/t/xml.test
  Adding test

  @ strings/xml.c
  Adding a helper function my_xml_parser_prefix_cmp(),
  with input string boundary check.
2011-01-18 09:38:41 +03:00
Vinay Fisrekar
afa2ec12d0 BUG#58858 : sys_vars.innodb_max_dirty_pages_pct_func fails sporadically
Committing After latest merge.      
Modified check_pct procedure to check return value of wait condition instead 
of calling "dirty_pct".
   
Adding Review comments:
1) Added comment for success variable value
2) Procedure check_pct changed For Adding BOOLEAN input and SELECT QUERY Change
2011-01-18 09:24:52 +05:30
Alexander Barkov
6665ca25af Bug#58371 Assertion failed: !s.uses_buffer_owned_by(this) with format string function
Introduced by the fix for bug#44766.

Problem: it's not correct to use args[0]->str_value as a buffer,
because args[0] may need this buffer for its own purposes.

Fix: adding a new class member tmp_value to use as return value.

  @ mysql-test/r/ctype_many.result
  @ mysql-test/t/ctype_many.test
  Adding tests

  @ sql/item_strfunc.cc
  Changing code into traditional style:
  use "str" as a buffer for the argument and tmp_value for the result value.

  @ sql/item_strfunc.h
  Adding tmp_value
2011-01-17 15:11:33 +03:00
Alexander Barkov
a2850a2f53 Bug#59149 valgrind warnings with "like .. escape .." function
Problem: when processing a query like:
  SELECT '' LIKE '1' ESCAPE COUNT(1);
escape_item->val_str() was never executed and the "escape" class member
stayed initialized, which led to valgrind uninitialized memory error.
      
Note, a query with some tables in "FROM" clause
returns ER_WRONG_ARGUMENTS in the same situation:

   SELECT '' LIKE '1' ESCAPE COUNT(1) FROM t1;
   ERROR 1210 (HY000): Incorrect arguments to ESCAPE

Fix: disallowing using aggregate functions in ESCAPE clause,
even if there are no tables used. There is no much use of that anyway.
2011-01-17 12:30:22 +03:00
Nirbhay Choubey
208b677637 Bug#58221 : mysqladmin --sleep=x --count=x keeps looping
When mysqldadmin is run with sleep and count options,
it goes into an infinite loop and keeps executing the
specified command.

This happened because the statement, responsible for
decrementing the count value, was missing.

Fixed by adding a statement which will decrement the
count value for each iteration.


client/mysqladmin.cc:
  Bug#58221 : mysqladmin --sleep=x --count=x keeps looping
  
  Added a condition to check and decrement the count
  value stored in nr_iterations per iteration.
mysql-test/r/mysqladmin.result:
  Added a testcase for Bug#58221.
mysql-test/t/mysqladmin.test:
  Added a testcase for Bug#58221.
2011-01-16 02:04:08 +05:30
unknown
12c6d1f355 BUG#49124 Security issue with /*!-versioned */ SQL statements on Slave
Backport to 5.0.

/*![:version:] Query Code */, where [:version:] is a sequence of 5 
digits representing the mysql server version(e.g /*!50200 ... */),
is a special comment that the query in it can be executed on those 
servers whose versions are larger than the version appearing in the 
comment. It leads to a security issue when slave's version is larger 
than master's. A malicious user can improve his privileges on slaves. 
Because slave SQL thread is running with SUPER privileges, so it can
execute queries that he/she does not have privileges on master.
      
This bug is fixed with the logic below: 
- To replace '!' with ' ' in the magic comments which are not applied on
  master. So they become common comments and will not be applied on slave.
      
- Example:
  'INSERT INTO t1 VALUES (1) /*!10000, (2)*/ /*!99999 ,(3)*/
   will be binlogged as
  'INSERT INTO t1 VALUES (1) /*!10000, (2)*/ /* 99999 ,(3)*/
2011-01-15 13:48:16 +08:00
Alexey Botchkov
335fcd91b3 Bug#52208 gis fails on some platforms (Solaris, HP-UX, Linux)
IA64 and some other arcitectures use different float rounding mode and
        i find no decent way to make it consistent.
        So the test changed to be insensitive to this.

per-file messages:
  mysql-test/t/gis.test
Bug#52208      gis fails on some platforms (Solaris, HP-UX, Linux)
        --replace_result added
2011-01-15 00:56:09 +04:00
Jimmy Yang
9cd4d49840 Fix Bug#30423 "InnoDBs treatment of NULL in index stats causes bad
"rows examined" estimates". This change implements "innodb_stats_method"
with options of "nulls_equal", "nulls_unequal" and "null_ignored".
      
rb://553 approved by Marko
2011-01-14 09:02:28 -08:00
John H. Embretsen
29484d7a66 Bug#56895 part 2 of 2: Backport of revid holyfoot@mysql.com-20100825135522-8wrjjmvh2u2t0qo6 from mysql-5.5.
Without this patch mysqlhotcopy tests would fail due to not finding the mysqlhotcopy tool in release-like builds.
With this patch the tests would either pass, or fail due to missing Perl modules (see 56817).
Text conflict in mysql-test/mysql-test-run.pl:
 - resolved by using logic from 5.5 to find mysqlhotcopy, the intention of this backport. Changed bindir to basedir.
2011-01-14 17:01:13 +01:00
Nirbhay Choubey
ab2d29ec6b Bug#13618 : mysqldump --xml omits comment on table field
When mysqldump tries to dump information in xml format,
the result does not contain field level comments.

In order to retrieve various informations for a field/column,
mysqldump currently uses 'show fields from <tab>' statement.
The attributes returned by the statement lacks the information
regarding field comments.

Fixed by changing the query to one that probes I_S to retrieve
required field informations, including the field comment.


client/mysqldump.c:
  Bug#13618 : mysqldump --xml omits comment on table field.
  
  Replaced the 'show fields' command by a statement that
  queries I_S, in order to retrieve information on all the
  attributes that 'show fields' returns along-with an additional
  column_comment information.
mysql-test/r/client_xml.result:
  Result modifications for bug#13618.
mysql-test/r/mysqldump.result:
  Result modifications for bug#13618.
mysql-test/t/mysqldump.test:
  Added a testcase for bug#13618.
2011-01-14 19:50:34 +05:30
John H. Embretsen
eb85bdfa6d Bug#56895 part 1 of 2: Backport of revid holyfoot@mysql.com-20100823084827-js10vjuil88je35r from mysql-5.5.
The purpose is to make MTR logic for mysqlhotcopy the same in 5.1 as in 5.5, making it easier to maintain and fix bugs such as 56817.
2011-01-14 14:50:39 +01:00
Sven Sandberg
faafae781a BUG#59063: rpl_migration_crash_safe fails on Windows
Backported the fix to 5.1.
Problem: the auxiliary test files rpl_start_server.inc and rpl_stop_server.inc
write a file that is later read by mtr. The bug was that the file was written
with platform-dependent newline terminators, i.e., \r\n on windows, whereas mtr
only understands \n.
Fix: write the file so that it uses \n on all platforms.


mysql-test/include/rpl_start_server.inc:
  Force test to use \n instead of platform-dependent newline terminator.
mysql-test/include/rpl_stop_server.inc:
  Force test to use \n instead of platform-dependent newline terminator.
2011-01-14 11:33:12 +01:00
Luis Soares
06e21d5cd9 Automerge from bug branch into latest mysql-5.1. 2011-01-13 11:41:00 +00:00
Martin Hansson
716b64cdb0 Bug#58165: "my_empty_string" gets modified and causes LOAD DATA to fail and
other crashes

Some string manipulating SQL functions use a shared string object intended to
contain an immutable empty string. This object was used by the SQL function
SUBSTRING_INDEX() to return an empty string when one argument was of the wrong
datatype. If the string object was then modified by the sql function INSERT(),
undefined behavior ensued.

Fixed by instead modifying the string object representing the function's
result value whenever string manipulating SQL functions return an empty
string.

Relevant code has also been documented.
2011-01-13 08:57:15 +01:00
Bjorn Munch
a581444c05 merge from 5.1-mtr 2011-01-12 23:29:53 +01:00