Commit graph

62716 commits

Author SHA1 Message Date
Alexey Kopytov
8fabbdd789 Bug #53830: !table || (!table->read_set ||
bitmap_is_set(table->read_set, field_index))

UPDATE on an InnoDB table modifying the same index that is used
to satisfy the WHERE condition could trigger a debug assertion
under some circumstances.

Since for engines with the HA_PRIMARY_KEY_IN_READ_INDEX flag
set results of an index scan on a secondary index are appended
by the primary key value, if a query involves only columns from
the primary key and a secondary index, the latter is considered
to be covering.

That tricks mysql_update() to mark for reading only columns
from the secondary index when it does an index scan to retrieve
rows to update in case a part of that key is also being
updated. However, there may be other columns in WHERE that are
part of the primary key, but not the secondary one.

What we actually want to do in this case is to add index
columns to the existing WHERE columns bitmap rather than
replace it.
2010-05-25 18:43:45 +04:00
Vasil Dimov
5ae998292c Merge mysql-5.1-innodb from bk-internal into my local tree 2010-05-25 17:21:33 +03:00
Ramil Kalimullin
422621a43f Automerge. 2010-05-25 18:07:47 +04:00
Ramil Kalimullin
edfea7d590 Fix for bug #53907: Table dump command can be abused to dump arbitrary tables.
Problem: one with SELECT privilege on some table may dump other table
performing COM_TABLE_DUMP command due to missed check of the table name.

Fix: check the table name.
2010-05-25 17:56:23 +04:00
Mattias Jonsson
ff36f028c3 Bug#49161: Out of memory; restart server and try again (needed 2 bytes)
Problem was reporting wrong error

Fixed by adding a new error which better explain the problem.
2010-05-25 15:41:00 +02:00
Davi Arnaut
5f5e23fea9 Bug#53908: compile failure with embedded enabled
This fixes a recently introduced regression, where a variable is
not defined for the embedded server. Although the embedded server
is not supported in 5.0, make it at least compile.
2010-05-25 10:36:48 -03:00
Jonathan Perkin
baa8f0127b bug#49968: Properly define HAVE_ERRNO_AS_DEFINE for the appropriate
OpenBSD releases.

Apply patch from Brad Smith, thanks!
2010-05-25 14:27:52 +01:00
Marko Mäkelä
34b126a238 row_search_for_mysql(): Add assertions to track down Bug #53627. 2010-05-25 15:53:52 +03:00
Marko Mäkelä
10b06978fe Suppress bogus Valgrind warnings about buf_buddy_relocate()
accessing uninitialized memory in Valgrind-instrumented builds.
2010-05-25 15:37:48 +03:00
Vasil Dimov
f67c8ebeea Merge mysql-5.1 into mysql-5.1-innodb
(this changeset does not introduce any changes)
2010-05-25 12:45:17 +03:00
Vasil Dimov
f27f15987f Merge mysql-5.1-innodb from bk-internal into my local tree 2010-05-25 12:14:57 +03:00
Vasil Dimov
c28e99a5a4 Fix comments on row_merge_write()
This is a port of
vasil.dimov@oracle.com-20100521175337-c1b1lqxgizqegb0w and
vasil.dimov@oracle.com-20100521180951-mef23h24k023xuwq
from mysql-trunk-innodb
2010-05-25 11:01:03 +03:00
69c9dbabe6 Postfix BUG#49741 2010-05-25 11:39:45 +08:00
cc05440836 Bug #49741 test files contain explicit references to bin/relay-log positions
Some of the test cases reference to binlog position and
these position numbers are written into result explicitly.
It is difficult to maintain if log event format changes. 

There are a couple of cases explicit position number appears, 
we handle them in different ways
A. 'CHANGE MASTER ...' with MASTER_LOG_POS or/and RELAY_LOG_POS options
   Use --replace_result to mask them.
B. 'SHOW BINLOG EVENT ...'
   Replaced by show_binlog_events.inc or wait_for_binlog_event.inc. 
   show_binlog_events.inc file's function is enhanced by given
   $binlog_file and $binlog_limit.
C. 'SHOW SLAVE STATUS', 'show_slave_status.inc' and 'show_slave_status2.inc'
   For the test cases just care a few items in the result of 'SHOW SLAVE STATUS',
   only the items related to each test case are showed.
   'show_slave_status.inc' is rebuild, only the given items in $status_items
   will be showed.
   'check_slave_is_running.inc' and 'check_slave_no_error.inc'
   and 'check_slave_param.inc' are auxiliary files helping
   to show running status and error information easily.
2010-05-24 21:54:08 +08:00
Marko Mäkelä
1a892fa206 Document the Bug #53578 fix. 2010-05-24 14:43:49 +03:00
Marko Mäkelä
b7a2474416 Bug#53578: assert on invalid page access, in fil_io()
Store the max_space_id in the data dictionary header in order to avoid
space_id reuse.

DICT_HDR_MIX_ID: Renamed to DICT_HDR_MAX_SPACE_ID, DICT_HDR_MIX_ID_LOW.

dict_hdr_get_new_id(): Return table_id, index_id, space_id or a subset of them.

fil_system_t: Add ibool space_id_reuse_warned.

fil_create_new_single_table_tablespace(): Get the space_id from the caller.

fil_space_create(): Issue a warning if the fil_system->max_assigned_id
is exceeded.

fil_assign_new_space_id(): Return TRUE/FALSE and take a pointer to the
space_id as a parameter. Make the function public.

fil_init(): Initialize all fil_system fields by mem_zalloc(). Remove
explicit initializations of certain fields to 0 or NULL.
2010-05-24 14:04:39 +03:00
Mattias Jonsson
ca0aa95c6d merge 2010-05-23 18:08:33 +02:00
Gleb Shchepa
6e34b8b0ce Bug #53804: serious flaws in the alter database .. upgrade
data directory name command

The check_db_name function has been modified to validate tails of
#mysql50#-prefixed database names for compliance with MySQL 5.0
database name encoding rules (the check_table_name function call
has been reused).
2010-05-21 22:47:32 +04:00
Mattias Jonsson
ae171f1e40 merge into mysql-5.1-bugteam 2010-05-21 14:18:14 +02:00
Sven Sandberg
836bb54c26 BUG#52987: mysqldump fails if umask=0077
Problem: The test case mysqldump reads a file that must
be world-readable. The test did not force the file to be
world-readable, so if the tree was branched with a umask
of 0077, the test would fail.
Fix: chmod the file.
2010-05-20 17:38:01 +02:00
Vasil Dimov
ffa35ab37b Merge mysql-5.1-innodb from bk-internal into my local tree 2010-05-20 16:31:57 +03:00
Vasil Dimov
0f913e0324 Disable main.ps_3innodb for valgrind tests since it results in known
failures, that are described in

Bug#38999 valgrind warnings for update statement in function compare_record()

At the time I am adding this the failures are:

main.ps_3innodb                          [ fail ]  Found warnings/errors in server log file!
        Test ended at 2010-05-20 01:17:34
line
==31559== Thread 11:
==31559== Conditional jump or move depends on uninitialised value(s)
==31559==    at 0x75C5BD: compare_record(st_table*) (sql_update.cc:35)
==31559==    by 0x744732: write_record(THD*, st_table*, st_copy_info*) (sql_insert.cc:1486)
==31559==    by 0x74A0D7: mysql_insert(THD*, TABLE_LIST*, List<Item>&, List<List<Item> >&, List<Item>&, List<Item>&, enum_duplicates, bool) (sql_insert.cc:835)
==31559==    by 0x6A79B4: mysql_execute_command(THD*) (sql_parse.cc:3198)
==31559==    by 0x754998: Prepared_statement::execute(String*, bool) (sql_prepare.cc:3583)
==31559==    by 0x754C4F: Prepared_statement::execute_loop(String*, bool, unsigned char*, unsigned char*) (sql_prepare.cc:3258)
==31559==    by 0x754F33: mysql_sql_stmt_execute(THD*) (sql_prepare.cc:2529)
==31559==    by 0x6A5028: mysql_execute_command(THD*) (sql_parse.cc:2272)
==31559==    by 0x6ADAE8: mysql_parse(THD*, char const*, unsigned, char const**) (sql_parse.cc:5986)
==31559==    by 0x6AF3A4: dispatch_command(enum_server_command, THD*, char*, unsigned) (sql_parse.cc:1233)
==31559==    by 0x6B0800: do_command(THD*) (sql_parse.cc:874)
==31559==    by 0x69CB46: handle_one_connection (sql_connect.cc:1134)
==31559==    by 0x33EDA062F6: start_thread (in /lib64/libpthread-2.5.so)
==31559==    by 0x33ECED1B6C: clone (in /lib64/libc-2.5.so)
==31559== Conditional jump or move depends on uninitialised value(s)
==31559==    at 0x75C5D0: compare_record(st_table*) (sql_update.cc:35)
==31559==    by 0x744732: write_record(THD*, st_table*, st_copy_info*) (sql_insert.cc:1486)
==31559==    by 0x74A0D7: mysql_insert(THD*, TABLE_LIST*, List<Item>&, List<List<Item> >&, List<Item>&, List<Item>&, enum_duplicates, bool) (sql_insert.cc:835)
==31559==    by 0x6A79B4: mysql_execute_command(THD*) (sql_parse.cc:3198)
==31559==    by 0x754998: Prepared_statement::execute(String*, bool) (sql_prepare.cc:3583)
==31559==    by 0x754C4F: Prepared_statement::execute_loop(String*, bool, unsigned char*, unsigned char*) (sql_prepare.cc:3258)
==31559==    by 0x754F33: mysql_sql_stmt_execute(THD*) (sql_prepare.cc:2529)
==31559==    by 0x6A5028: mysql_execute_command(THD*) (sql_parse.cc:2272)
==31559==    by 0x6ADAE8: mysql_parse(THD*, char const*, unsigned, char const**) (sql_parse.cc:5986)
==31559==    by 0x6AF3A4: dispatch_command(enum_server_command, THD*, char*, unsigned) (sql_parse.cc:1233)
==31559==    by 0x6B0800: do_command(THD*) (sql_parse.cc:874)
==31559==    by 0x69CB46: handle_one_connection (sql_connect.cc:1134)
==31559==    by 0x33EDA062F6: start_thread (in /lib64/libpthread-2.5.so)
==31559==    by 0x33ECED1B6C: clone (in /lib64/libc-2.5.so)
^ Found warnings in /export/home4/pb2/test/sb_3-1827397-1274300957.87/mysql-5.1.48-linux-x86_64-test/mysql-test/var-n_mix/log/mysqld.1.err
2010-05-20 16:27:35 +03:00
Marko Mäkelä
8ca5398ccd buf_LRU_free_block(): Correct an error in the comment. 2010-05-20 16:07:34 +03:00
Vasil Dimov
88725725b6 Merge mysql-5.1-innodb from bk-internal into my local tree 2010-05-20 15:54:03 +03:00
Marko Mäkelä
5fc862d6c9 Bug#53593: Add some instrumentation to improve Valgrind sensitivity
BUILD/*: Add valgrind_configs=--with-valgrind.
BUILD/*: Remove -USAFEMALLOC from valgrind_flags.

configure.in: Add AC_ARG_WITH(valgrind) and HAVE_VALGRIND.

include/my_sys.h: Define a number of MEM_ wrappers for VALGRIND_ functions.
include/my_sys.h: Make TRASH do MEM_UNDEFINED().

include/m_string.h: Remove unused macro bzero_if_purify(A,B).

_mymalloc(): Declare MEM_UNDEFINED() on the allocated memory.

_myfree(): Declare MEM_NOACCESS() on the freed memory.

storage/innobase/include/univ.i: Enable UNIV_DEBUG_VALGRIND based on
HAVE_VALGRIND rather than HAVE_purify.

Possible things to do:
 * In my_global.h, remove the defined(HAVE_purify) condition
   from the _WIN32 uint3korr().
 * In my_global.h *int*korr(), use | instead of +
   in order to keep the Valgrind V bits accurate
 * Consider replacing HAVE_purify with HAVE_VALGRIND
 * Use VALGRIND_CREATE_BLOCK, VALGRIND_DISCARD in mem_root and similar places
2010-05-20 13:40:42 +03:00
Vasil Dimov
497ff20f59 Merge from mysql-trunk-innodb into mysql-5.1-innodb/storage/innodb_plugin:
------------------------------------------------------------
  revno: 3094
  revision-id: vasil.dimov@oracle.com-20100513074652-0cvlhgkesgbb2bfh
  parent: vasil.dimov@oracle.com-20100512173700-byf8xntxjur1hqov
  committer: Vasil Dimov <vasil.dimov@oracle.com>
  branch nick: mysql-trunk-innodb
  timestamp: Thu 2010-05-13 10:46:52 +0300
  message:
    Followup to Bug#51920, fix binlog.binlog_killed
    
    This is a followup to the fix of
    
    Bug#51920 Innodb connections in row lock wait ignore KILL until lock wait
    timeout
    
    in that fix (rb://279) the behavior was changed to honor when a trx is
    interrupted during lock wait, but the returned error code was still
    "lock wait timeout" when it should be "interrupted".
    
    This change fixes the non-deterministically failing test binlog.binlog_killed,
    that failed like this:
    
    binlog.binlog_killed 'stmt'              [ fail ]
            Test ended at 2010-05-12 11:39:08
    
    CURRENT_TEST: binlog.binlog_killed
    mysqltest: At line 208: query 'reap' failed with wrong errno 1205: 'Lock wait timeout exceeded; try restarting transaction', instead of 0...
    
    Approved by:	Sunny Bains (rb://344)
  ------------------------------------------------------------
2010-05-20 10:50:07 +03:00
Vasil Dimov
8a03ef7911 Merge from mysql-trunk-innodb into mysql-5.1-innodb/storage/innobase:
------------------------------------------------------------
  revno: 3094
  revision-id: vasil.dimov@oracle.com-20100513074652-0cvlhgkesgbb2bfh
  parent: vasil.dimov@oracle.com-20100512173700-byf8xntxjur1hqov
  committer: Vasil Dimov <vasil.dimov@oracle.com>
  branch nick: mysql-trunk-innodb
  timestamp: Thu 2010-05-13 10:46:52 +0300
  message:
    Followup to Bug#51920, fix binlog.binlog_killed
    
    This is a followup to the fix of
    
    Bug#51920 Innodb connections in row lock wait ignore KILL until lock wait
    timeout
    
    in that fix (rb://279) the behavior was changed to honor when a trx is
    interrupted during lock wait, but the returned error code was still
    "lock wait timeout" when it should be "interrupted".
    
    This change fixes the non-deterministically failing test binlog.binlog_killed,
    that failed like this:
    
    binlog.binlog_killed 'stmt'              [ fail ]
            Test ended at 2010-05-12 11:39:08
    
    CURRENT_TEST: binlog.binlog_killed
    mysqltest: At line 208: query 'reap' failed with wrong errno 1205: 'Lock wait timeout exceeded; try restarting transaction', instead of 0...
    
    Approved by:	Sunny Bains (rb://344)
  ------------------------------------------------------------

This merge is non-trivial since it has to introduce the DB_INTERRUPTED
error code.

Also revert vasil.dimov@oracle.com-20100408165555-9rpjh24o0sa9ad5y
which adjusted the binlog.binlog_killed test to the new (wrong) behavior
2010-05-20 10:39:02 +03:00
Sergey Glukhov
7132ccd7ca Bug#52884 mysql-test-run does not work with --debug option
Server crashes on 64bit linux with 'double free or corruption'
message, on 32bit mysql-test-run silently fails on bootstrap
stage. The problem is that FreeState() is called twice
for init_settings struct in _db_end_ function.
The fix is to remove superfluous FreeState() call.
Additional fix:
fixed discrepancy of result file when
debug & valgrind options are enabled
for MTR.
2010-05-20 10:31:03 +04:00
Luis Soares
ce3194c1c8 BUG 53621: automerged bzr bundle from bug report. 2010-05-20 00:52:03 +01:00
Luis Soares
4ed6fc0457 BUG 52868: automerged bzr bundle from bug report. 2010-05-20 00:50:42 +01:00
Luis Soares
e7eb43a859 BUG 49522: automerged bzr bundle from bug report. 2010-05-20 00:49:18 +01:00
hery.ramilison@oracle.com
eb3ba6bae6 Merge from mysql-5.1.47-release 2010-05-20 01:33:57 +02:00
joerg.bruehe@sun.com
362495cf58 Merge from mysql-5.0.91-release 2010-05-19 20:02:53 +02:00
Tor Didriksen
a22c69b233 Backport from next-mr-bugfixing of tor.didriksen@sun.com-20100106140051-3j2iuag63eltsr2e
Bug #50087 Interval arithmetic for Event_queue_element is not portable.

Subtraction of two unsigned months yielded a (very large) positive value.
Conversion of this to a signed value was not necessarily well defined.
              
Solution: do the subtraction on signed values.
2010-05-19 11:18:59 +02:00
Marko Mäkelä
2bd4b5e2ab Make UNIV_DEBUG Valgrind friendly in the built-in InnoDB.
Use | instead of +, and mask out the dont-care bits in debug assertions.
2010-05-19 11:16:18 +03:00
Marko Mäkelä
973c59be48 Make UNIV_DEBUG Valgrind friendly. Use | instead of +,
and mask out the dont-care bits in debug assertions.
2010-05-19 11:07:43 +03:00
Marko Mäkelä
02a60e8676 Silence some more bogus Valgrind warnings on non-32-bit systems. (Bug #53307) 2010-05-19 11:01:52 +03:00
Marko Mäkelä
05339fe621 Add Valgrind checks to compressed BLOB access. 2010-05-19 10:58:43 +03:00
Marko Mäkelä
4d61acb187 Work around Bug #53750 in innodb.innodb_bug48024 2010-05-19 10:56:13 +03:00
Marko Mäkelä
45fbbe7c5b Work around Bug #53750 in innodb_bug48024.test 2010-05-18 16:06:58 +03:00
Sergey Glukhov
f512cb4eaf Bug#48729 SELECT ... FROM INFORMATION_SCHEMA.ROUTINES causes memory to grow
Analysis showed that in case of accessing I_S table
ROUTINES we perform unnecessary allocations
with get_field() function for every processed row that
in their turn causes significant memory growth.
the fix is to avoid use of get_field().
2010-05-18 13:28:21 +05:00
Andrei Elkin
f59684b86e pushing bug#50942 fixes to 5.1-bt 2010-05-16 20:03:32 +03:00
Alfranio Correia
8edccf1e41 BUG#49019 Mixing self-logging eng. and regular eng. does not switch to row in mixed
mode
      
Post-push fix after backporting the patch to 5.1-bugteam:

  1 - changed the name of some variables to be equivalent to pe.
  2 - fixed that patch to mark a statement as unsafe when both a
  self-logging eng. and regular eng. are accessed and one of them
  is updated.
2010-05-16 15:37:44 +01:00
Alfranio Correia
6400d6d54a BUG#50410: rpl_ndb tests should run with binlog_format=row
Post-fix: Updated a test case after the patch for BUG#50410,
because the patch makes ndb to run in the row format and as
such unsafe warning messages are not printed out.
2010-05-16 12:45:21 +01:00
Marko Mäkelä
d7ab161ec3 Document Bug #48024 and Bug #53644 in the ChangeLog 2010-05-14 16:10:50 +03:00
Marko Mäkelä
8b3820e250 Make the InnoDB FOREIGN KEY parser understand multi-statements. (Bug #48024)
Also make InnoDB thinks that /*/ only starts a comment. (Bug #53644).

This fixes the bugs in the InnoDB Plugin.

ha_innodb.h: Use trx_query_string() instead of trx_query() when
available (MySQL 5.1.42 or later).

innobase_get_stmt(): New function, to retrieve the currently running
SQL statement.

struct trx_struct: Remove mysql_query_str. Use innobase_get_stmt() instead.

dict_strip_comments(): Add and observe the parameter sql_length. Treat
/*/ as the start of a comment.

dict_create_foreign_constraints(), row_table_add_foreign_constraints():
Add the parameter sql_length.
2010-05-14 16:08:15 +03:00
Marko Mäkelä
b93e78929a Make the InnoDB FOREIGN KEY parser understand multi-statements. (Bug #48024)
Also make InnoDB thinks that /*/ only starts a comment. (Bug #53644).

struct trx_struct: Add mysql_query_len.

ha_innodb.cc: Use trx_query_string() instead of trx_query() and
initialize trx->mysql_query_len.

INNOBASE_COPY_STMT(thd, trx): New macro, to initialize
trx->mysql_query_str and trx->mysql_query_len.

dict_strip_comments(): Add and observe the parameter sql_length. Treat
/*/ as the start of a comment.

dict_create_foreign_constraints(), row_table_add_foreign_constraints():
Add the parameter sql_length.
2010-05-14 16:02:28 +03:00
Gleb Shchepa
09b6efcc76 Bug #53450: Crash / assertion "virtual int
ha_myisam::index_first(uchar*)") at assert.c:81

Single-table DELETE crash/assertion similar to single-table
UPDATE bug 14272.

Same resolution as for the bug 14272:
Don't run index scan when we should use quick select.
This could cause failures because there are table handlers (like federated)
that support quick select scanning but do not support index scanning.
2010-05-14 15:36:27 +04:00
Marko Mäkelä
679b983378 Remove unused code. 2010-05-14 13:51:26 +03:00
Luis Soares
a602950080 BUG#53621: check_testcase fails for rpl_do_grant in mysql-5.1-bugteam
MTR sporadically reported that rpl_do_grant does not
clean up after itself.

We fix this by backporting BUG 50984 fix. This deploys
missing synchronization between master and slave.

Additionally, it also fixes the check_testcase for
rpl_tmp_table_and_DDL.
2010-05-13 16:40:31 +01:00