Commit graph

68594 commits

Author SHA1 Message Date
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
Dmitry Lenev
901226b66a Fix for bug #11765505 - "58480: LARGE_TESTS.LOCK_TABLES_BIG
IS FAILING".

The problem was that large_tests.lock_tables_big test was
failing due to exceeding open files limit on platforms where
this limit was set too low (this test simultaneously opens
approx. 6000 files).

This patch solves this issue by ensuring that this test is
skipped on such platforms.
2011-03-01 14:47:04 +03:00
Serge Kozlov
507e4fa718 Bug#54820. Remove test cases from experimental 2011-02-27 23:23:44 +03:00
Tor Didriksen
69b8293759 Bug #11747102 30771: LOG MORE INFO ABOUT THREADS KILL'D AND SORT ABORTED MESSAGES
mysql-test/r/filesort_debug.result:
  New test case.
mysql-test/t/filesort_debug.test:
  New test case.
sql/filesort.cc:
  thd->killed does not imply thd->is_error(), so test for that separately.
2011-02-24 08:00:12 +01:00
Vasil Dimov
19372f1094 Merge mysql-5.5-innodb -> mysql-5.5 2011-02-23 19:33:41 +02:00
Vasil Dimov
9f699b39f8 Fix the failing sys_vars.all_vars on behalf of Sunny 2011-02-23 16:39:54 +02:00
Jon Olav Hauglid
0c9dde5c70 Bug #11752069 (former bug 43152)
Assertion `bitmap_is_set_all(&table->s->all_set)' failed in
handler::ha_reset

Post-push fix for unit test compilation error on Windows.
2011-02-23 14:50:59 +01:00
Sunny Bains
f91ce0413b Revert the max value of innodb_purge_batch_size to 5000. 2011-02-23 17:56:37 +11:00
Sunny Bains
e9678ae8e7 Add ut0bh.h and ut0bh.c. 2011-02-23 17:48:15 +11:00
Sunny Bains
c08a820d14 Remove ut0bh.h and ut0bh.c and re-add so that we can sync the file ids with
the trunk.
2011-02-23 17:44:11 +11:00
Sunny Bains
da66465afd Add ut0bh.ic. 2011-02-23 07:24:34 +11:00
Sunny Bains
cfcd6eadef Remove ut0bh.ic from 5.5 and then re-add so that the file ids are the same
in 5.5 and trunk. First we remove the file in the commit.
2011-02-23 07:14:49 +11:00
Nirbhay Choubey
07e3056777 Merging from mysql-5.1. 2011-02-22 19:32:49 +05:30
Nirbhay Choubey
f27a13cf09 Postfix for tests failing due to fix for bug#11766310. 2011-02-22 19:28:50 +05:30
Sunny Bains
a5cd4872ba Add files that were missed in bug# 11798085 commit. 2011-02-22 20:17:02 +11:00
Sunny Bains
b3c9cc6f21 Bug #11766227: InnoDB purge lag much worse for 5.5.8 versus 5.1
Bug #11766501: Multiple RBS break the get rseg with mininum trx_t::no code during purge
      
Bug# 59291 changes:
      
Main problem is that truncating the UNDO log at the completion of every
trx_purge() call is expensive as the number of rollback segments is increased.
We truncate after a configurable amount of pages. The innodb_purge_batch_size
parameter is used to control when InnoDB does the actual truncate. The truncate
is done once after 128 (or TRX_SYS_N_RSEGS iterations). In other words we
truncate after purge 128 * innodb_purge_batch_size. The smaller the batch
size the quicker we truncate.
      
Introduce a new parameter that allows how many rollback segments to use for
storing REDO information. This is really step 1 in allowing complete control
to the user over rollback space management.
      
New parameters:
    i) innodb_rollback_segments = number of rollback_segments to use
       (default is now 128) dynamic parameter, can be changed anytime.
       Currently there is little benefit in changing it from the default.
      
Optimisations in the patch.
      
    i. Change the O(n) behaviour of trx_rseg_get_on_id() to O(log n)
       Backported from 5.6. Refactor some of the binary heap code.
       Create a new include/ut0bh.ic file.
      
    ii. Avoid truncating the rollback segments after every purge.
      
Related changes that were moved to a separate patch:
      
    i. Purge should not do any flushing, only wait for space to be free so that
       it only does purging of records unless it is held up by a long running
       transaction that is preventing it from progressing.
      
   ii. Give the purge thread preference over transactions when acquiring the
       rseg->mutex during commit. This to avoid purge blocking unnecessarily
       when getting the next rollback segment to purge.
      
Bug #11766501 changes:
      
Add the rseg to the min binary heap under the cover of the kernel mutex and
the binary heap mutex. This ensures the ordering of the min binary heap.
      
The two changes have to be committed together because they share the same
that fixes both issues.
      
rb://567 Approved by: Inaam Rana.
2011-02-22 16:04:08 +11:00
Jorgen Loland
d1d166875a BUG#11762751: UPDATE STATEMENT THROWS AN ERROR, BUT STILL
UPDATES THE TABLE ENTRIES (formerly 55385)
BUG#11764529: MULTI UPDATE+INNODB REPORTS ER_KEY_NOT_FOUND 
              IF A TABLE IS UPDATED TWICE (formerly 57373)
            
If multiple-table update updates a row through two aliases and
the first update physically moves the row, the second update will
fail to locate the row. This results in different errors
depending on storage engine:
  * MyISAM: Got error 134 from storage engine
  * InnoDB: Can't find record in 'tbl'
None of these errors accurately describe the problem. 
      
Furthermore, since MyISAM is non-transactional, the update
executed first will be performed while the second will not.
In addition, for two equal multiple-table update statements,
one could succeed and the other fail based on whether or not
the record actually moved or not. This was inconsistent.
      
Two update operations may physically move a row:
  1) Update of a column in a clustered primary key
  2) Update of a column used to calculate which partition the 
     row belongs to
           
BUG#11764529 is about case 1) above, BUG#11762751 was about case 2).
      
The fix for these bugs is to return with an error if multiple-table 
update is about to:
  a) Update a table through multiple aliases, and
  b) Perform an update that may physically more the row 
     in at least one of these aliases
    
This avoids 
  * partial updates as described for MyISAM above,
  * provides the same error message that describes the actual problem
    for all SEs
  * inconsistent behavior where a statement fails or succeeds based on
    e.g. the partitioning algorithm of the table.

mysql-test/r/multi_update.result:
  Add test for bug#57373
mysql-test/r/multi_update_innodb.result:
  Add test for bug#57373
mysql-test/r/partition.result:
  Add test for bug#55385
mysql-test/t/multi_update.test:
  Add test for bug#57373
mysql-test/t/multi_update_innodb.test:
  Add test for bug#57373
mysql-test/t/partition.test:
  Add test for bug#55385
sql/handler.cc:
  Translate handler error HA_ERR_RECORD_DELETED to server error
sql/share/errmsg-utf8.txt:
  New error message for multi-table update where the same table is updated multiple times.
sql/sql_update.cc:
  Add function unsafe_key_update()
2011-02-21 16:49:03 +01:00
Magnus Blåudd
08e4eba428 Merge 2011-02-21 12:47:27 +01:00
Jon Olav Hauglid
f7a0b45f5a Bug #11754461 CANNOT ALTER TABLE WHEN KEY PREFIX TOO LONG
The problem was that doing ALTER TABLE on a table which had a key
on a TEXT/BLOB column with a prefix longer than the maximum number
of characteres in this column (as per the character set), by mistake,
caused an error (Error 1170 - ER_BLOB_KEY_WITHOUT_LENGTH).

This bug not repeatable in 5.5.

This patch adds a regression test to alter_table.test and
contains no code changes.
2011-02-21 12:30:08 +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
Sergey Vojtovich
95b4ff0081 Merge. 2011-02-21 11:17:56 +03:00
Nirbhay Choubey
a5f20712a0 Merge of fix for bug#11766310 from mysql-5.1 -> mysql-5.5. 2011-02-21 12:42:27 +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
Alexander Barkov
b7d30e274d Merging from 5.1 2011-02-18 17:19:55 +03:00
Alexander Barkov
e2e6eb8f6d A post-fix for b58036. 2011-02-18 17:17:37 +03:00
Alexander Barkov
7a7c958283 Null-merging Bug#11765108 (Bug#58036) from 5.1. 2011-02-18 16:24:03 +03:00
Alexander Barkov
5f55c23208 Bug#11765108 (Bug#58036) client utf32, utf16, ucs2 should be disallowed, they crash server
A separate fix for 5.1 (as 5.1 and 5.5 have seriously
differged in the related pieces of the code).
A patch for 5.5 was approved earlier.

Problem: ucs2 was correctly disallowed in "SET NAMES" only,
while mysql_real_connect() and mysql_change_user() still allowed
to use ucs2, which made server crash.

Fix: disallow ucs2 in mysql_real_connect() and mysql_change_user().

  @ sql/sql_priv.h
    - changing return type for thd_init_client_charset() to bool,
      to return errors to the caller

  @ sql/sql_var.cc
    - using new function

  @ sql/sql_connect.cc
    - thd_client_charset_init:
      in case of unsupported client character set send error and return true;
      in case of success return false
    - check_connection:
      Return error if character set initialization failed

  @ sql/sql_parse.cc
    - check charset in the very beginnig of the CMD_CHANGE_USER handling code

  @ tests/mysql_client_test.c
    - adding tests
2011-02-18 16:12:36 +03:00
Vasil Dimov
7dc0bbb23f Merge mysql-5.1 -> mysql-5.5 (empty) 2011-02-18 14:59:19 +02:00
Vasil Dimov
6a435e05d3 Merge mysql-5.5-innodb -> mysql-5.5 2011-02-18 14:57:50 +02:00
Vasil Dimov
4b7a924732 Merge mysql-5.1-innodb -> mysql-5.1 2011-02-18 14:57:11 +02:00
Martin Hansson
4d7042ce23 Merge of fix for Bug#11766675. 2011-02-18 11:55:24 +01: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
Alexander Barkov
f4beb92940 Bug#11765108 (Bug#58036) client utf32, utf16, ucs2 should be disallowed, they crash server
Problem: ucs2 was correctly disallowed in "SET NAMES" only,
while mysql_real_connect() and mysql_change_user() still allowed
to use ucs2, which made server crash.

Fix: disallow ucs2 in mysql_real_connect() and mysql_change_user().

  @ sql/set_var.cc
    Using new function.

  @ sql/sql_acl.cc
    - Return error if character set initialization failed
    - Getting rid of pointer aliasing:
      Initialize user_name to NULL, to avoid double free().

  @ sql/sql_connect.cc
    - in case of unsupported client character set send error and return true
    - in case of success return false

  @ sql/sql_connect.h
    - changing return type for thd_init_client_charset() to bool,
      to return errors to the caller

  @ sql/sql_parse.h
    - introducing a new function, to reuse in all places where we need
    to check client character set.

  @ tests/mysql_client_test.c
    Adding test
2011-02-18 12:46:55 +03:00
Sergey Vojtovich
659ff29394 BUG#11766720 - setting storage engine to null segfaults mysqld
MONTHNAME(0) claims that it is about to return NOT NULL
value, whereas it actually returns NULL.

As a result storage_engine variable (which cannot be NULL)
protection was bypassed and NULL value was accepted, causing
server crash.

Fixed MONTHNAME(0) to report valid NULL flag.

mysql-test/r/func_time.result:
  A test case for BUG#11766720.
mysql-test/t/func_time.test:
  A test case for BUG#11766720.
sql/item_timefunc.cc:
  MONTHNAME(0) must report NULL, as opposed to base class
  MONTH(0) which is NOT NULL.
  
  Fixed Item_func_monthname to inherit from Item_str_func
  instead of Item_func_month.
sql/item_timefunc.h:
  MONTHNAME(0) must report NULL, as opposed to base class
  MONTH(0) which is NOT NULL.
  
  Fixed Item_func_monthname to inherit from Item_str_func
  instead of Item_func_month.
2011-02-18 11:10:30 +03:00
Alexander Barkov
0db53b19b7 Bug#60101 COALESCE with cp1251 tables causes [Err] 1267 - Illegal mix of collations
Problem:
  IF() did not copy collation derivation and repertoire from
  an argument if the opposite argument was NULL:
    IF(cond, res1, NULL)
    IF(cond, NULL, res2)
  only CHARSET_INFO pointer was copied.
  This resulted in illegal mix of collations error.

Fix:
  copy all collation parameters from the non-NULL argument:
  CHARSET_INFO pointer, derivation, repertoire.
2011-02-18 10:32:40 +03:00
Marko Mäkelä
be59ca8275 Merge mysql-5.1-innodb to mysql-5.5-innodb. 2011-02-17 22:27:56 +02: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
c0ec353277 Merge mysql-5.1-innodb -> mysql-5.5-innodb 2011-02-17 19:14:41 +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
1715327630 Merge mysql-5.1 -> mysql-5.5 (empty) 2011-02-17 14:09:31 +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
70b9a5fa6b Merge mysql-5.5 from bk-internal into my local repo 2011-02-17 14:06:32 +02:00
Vasil Dimov
9562d5e6e5 Merge mysql-5.1 -> mysql-5.5 (empty) 2011-02-17 14:00:27 +02:00
Vasil Dimov
0047afa3b2 Merge mysql-5.5-innodb -> mysql-5.5 2011-02-17 13:57:26 +02:00
Vasil Dimov
0bbaf6e8a7 Merge mysql-5.1-innodb -> mysql-5.1 2011-02-17 13:56:05 +02:00
Magne Mahre
5a47bc87c8 Merge from 5.1 2011-02-17 12:53:09 +01: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ä
5c96991a6f Merge mysql-5.1-innodb to mysql-5.5-innodb. 2011-02-17 09:48:01 +02: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
Tor Didriksen
2152cd958d Disable this test when running 'mtr --mem'
With --mem if fails with
+UNEXPECTED ERROR NUMBER: 1290

In var/log/mysqld.2.err we have:
[ERROR] LOAD DATA INFILE in the slave SQL Thread can only read from --slave-load-tmpdir. Please, report a bug.
[ERROR] Slave SQL: Error 'The MySQL server is running with the --slave-load-tmpdir option so it cannot execute this statement' on query. Default database: 'test'. Query: 'LOAD DATA INFILE '../../tmp/SQL_LOAD-2-1-1.data' INTO  TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (`a`, `b`)', Error_code: 1290

getcwd() in the server yields something like: /dev/shm/var_auto_iv5Q/mysqld.2/data
2011-02-17 08:27:24 +01:00