Commit graph

65886 commits

Author SHA1 Message Date
Kristofer Pettersson
0ffa3863c7 Bug#52107 Comment in sql/net_serv.cc still makes "GPL protocol" claim
Removed misleading comments.
2010-05-26 17:13:02 +02:00
a19c5a6608 Manual merge 2010-05-26 22:34:25 +08:00
Tor Didriksen
d8536dfbdd Bug #53445 Build with -Wall and fix warnings that it generates
Add -Wall to gcc/g++
Fix most warnings reported in dbg and opt mode.
2010-05-26 16:12:23 +02:00
Dmitry Lenev
c070e5a1ed Fix for bug #51263 "Deadlock between transactional
SELECT and ALTER TABLE ...  REBUILD PARTITION".

ALTER TABLE on InnoDB table (including partitioned tables)
acquired exclusive locks on rows of table being altered.
In cases when there was concurrent transaction which did
locking reads from this table this sometimes led to a
deadlock which was not detected by MDL subsystem nor by
InnoDB engine (and was reported only after exceeding
innodb_lock_wait_timeout).

This problem stemmed from the fact that ALTER TABLE acquired
TL_WRITE_ALLOW_READ lock on table being altered. This lock
was interpreted as a write lock and thus for table being
altered handler::external_lock() method was called with
F_WRLCK as an argument. As result InnoDB engine treated
ALTER TABLE as an operation which is going to change data
and acquired LOCK_X locks on rows being read from old
version of table.

In case when there was a transaction which already acquired
SR metadata lock on table and some LOCK_S locks on its rows
(e.g. by using it in subquery of DML statement) concurrent
ALTER TABLE was blocked at the moment when it tried to
acquire LOCK_X lock before reading one of these rows.
The transaction's attempt to acquire SW metadata lock on
table being altered led to deadlock, since it had to wait
for ALTER TABLE to release SNW lock. This deadlock was not
detected and got resolved only after timeout expiring
because waiting were happening in two different subsystems.

Similar deadlocks could have occured in other situations.
This patch tries to solve the problem by changing ALTER TABLE
implementation to use TL_READ_NO_INSERT lock instead of
TL_WRITE_ALLOW_READ. After this step handler::external_lock()
is called with F_RDLCK as an argument and InnoDB engine
correctly interprets ALTER TABLE as operation which only
reads data from original version of table. Thanks to this
ALTER TABLE acquires only LOCK_S locks on rows it reads.
This, in its turn, causes inter-subsystem deadlocks to go
away, as all potential lock conflicts and thus deadlocks will
be limited to metadata locking subsystem:

- When ALTER TABLE reads rows from table being altered it
  can't encounter any locks which conflict with LOCK_S row
  locks. There should be no concurrent transactions holding
  LOCK_X row locks. Such a transaction should have been
  acquired SW metadata lock on table first which would have
  conflicted with ALTER's SNW lock.
- Vice versa, when DML which runs concurrently with ALTER
  TABLE tries to lock row it should be requesting only LOCK_S
  lock which is compatible with locks acquired by ALTER,
  as otherwise such DML must own an SW metadata lock on table
  which would be incompatible with ALTER's SNW lock.
2010-05-26 16:18:08 +04:00
Alexander Nozdrin
33e9d05c08 Ignore files auto-generated for each build by CMake-build-scripts. 2010-05-26 14:34:41 +04:00
Alexander Nozdrin
34c7685b24 Patch for Bug#53937 (Junk make-ccc files included in MySQL Server bzr repo).
Remove make-ccc files.
2010-05-26 14:20:14 +04:00
Mattias Jonsson
b3259e93ea pre push fix of test results 2010-05-26 09:56:55 +02:00
Jimmy Yang
1ecfadf83b Update ChangeLog for bug fix regarding 53582. 2010-05-25 22:38:14 -07:00
Jimmy Yang
0aed1f061e Fix Bug #53592 in plugin code, "crash replacing duplicates into table
after fast alter table added unique key". Look up MySQL index number should
go through index translation table.

rb://347, approved by Marko
2010-05-25 22:31:27 -07:00
Jimmy Yang
00dfb12b92 Check in the support for Information Schema System Table Views. Users
can now view the content of InnoDB System Tables through following
information schema tables:

information_schema.INNODB_SYS_TABLES
information_schema.INNODB_SYS_INDEXES
information_schema.INNODB_SYS_COUMNS
information_schema.INNODB_SYS_FIELDS
information_schema.INNODB_SYS_FOREIGN
information_schema.INNODB_SYS_FOREIGN_COLS
information_schema.INNODB_SYS_TABLESTATS

rb://330 Approved by Marko
2010-05-25 18:44:33 -07:00
Davi Arnaut
3c279d9a5a Bug#42643: InnoDB does not support replication of TRUNCATE TABLE
The problem was that TRUNCATE TABLE didn't take a exclusive
lock on a table if it resorted to truncating via delete of
all rows in the table. Specifically for InnoDB tables, this
could break proper isolation as InnoDB ends up aborting some
granted locks when truncating a table.

The solution is to take a exclusive metadata lock before
TRUNCATE TABLE can proceed. This guarantees that no other
transaction is using the table.

Incompatible change: Truncate via delete no longer fails
if sql_safe_updates is activated (this was a undocumented
side effect).
2010-05-25 17:01:38 -03:00
Ramil Kalimullin
442e0f01f2 Manual merge. 2010-05-25 22:30:08 +04:00
Mattias Jonsson
2e1ade56f8 merge 2010-05-25 17:41:11 +02:00
Mattias Jonsson
e596ae0795 merge 2010-05-25 17:26:48 +02:00
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
427436d4b8 merge 2010-05-25 15:45:01 +02: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
Jonathan Perkin
6ed71b7d1e Pull in time.h for localtime_r. 2010-05-25 14:37:35 +01: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
Dmitry Lenev
a3c080be7a Pre-requisite patch for bug #51263 "Deadlock between
transactional SELECT and ALTER TABLE ... REBUILD PARTITION".

The goal of this patch is to decouple type of metadata
lock acquired for table by open_tables() from type of
table-level lock to be acquired on it.

To achieve this we change approach to how we determine what
type of metadata lock should be acquired on table to be open.
Now instead of inferring it at open_tables() time from flags
and type of table-level lock we rely on that type of metadata
lock is properly set at parsing time and is not changed
further.
2010-05-25 16:35:01 +04: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
Mattias Jonsson
39d9765297 post push fix 2010-05-25 11:34:36 +02:00
Vasil Dimov
f27f15987f Merge mysql-5.1-innodb from bk-internal into my local tree 2010-05-25 12:14:57 +03:00
Kent Boortz
3dec34f4f7 configure.cmake
- Reverted a faulty change of MY_SEARCH_LIBS
 - Added the proper change for MY_SEARCH_LIBS and HAVE_<libname>
2010-05-25 10:14:07 +02: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
Vasil Dimov
7d50be10d2 (second attempt) Disable the tests on embedded windows that fail due to
Bug #53947 InnoDB: Assertion failure in thread 4224 in file
.\sync\sync0sync.c line 324

This changeset should be reverted once the bug is fixed.
2010-05-25 10:36:06 +03:00
Vasil Dimov
c44ff04954 Revert a changeset since it does not disable the tests:
------------------------------------------------------------
  revno: 3116
  revision-id: vasil.dimov@oracle.com-20100524182209-sk114oipf1vhjbv5
  parent: vasil.dimov@oracle.com-20100524175802-twmwb29vvaehe6b8
  committer: Vasil Dimov <vasil.dimov@oracle.com>
  branch nick: mysql-trunk-innodb
  timestamp: Mon 2010-05-24 21:22:09 +0300
  message:
    Disable the tests on embedded windows that fail due to
    
    Bug #53947 InnoDB: Assertion failure in thread 4224 in file
    .\sync\sync0sync.c line 324
    
    This changeset should be reverted once the bug is fixed.
2010-05-25 10:29:36 +03:00
Mattias Jonsson
2b846b39c1 merge 2010-05-25 08:35:48 +02:00
69c9dbabe6 Postfix BUG#49741 2010-05-25 11:39:45 +08:00
Mattias Jonsson
b0ecceb95b merge 2010-05-24 23:21:08 +02:00
Alexander Nozdrin
f54464035a Fix for Bug#53925 (valgrind failures in rpl.rpl_get_master_version_and_clock
in mysql-trunk-merge).

There were two problems:
  - a mistake during merge of a patch for Bug 52629 from 5.1;
  - MTR treated auxilary output of newer valgrind as an error.

The fixes are:
  - Fix merge error;
  - Teach MTR to skip 'HEAP summary' section of valgrind output.
2010-05-24 22:57:25 +04:00
Vasil Dimov
080a0aaba9 Merge a changeset from mysql-5.1-innodb:
------------------------------------------------------------
  revno: 3477
  revision-id: vasil.dimov@oracle.com-20100520132735-a120y85kqmhp7hxi
  parent: vasil.dimov@oracle.com-20100520125403-3u9ydcfu8vz8spls
  committer: Vasil Dimov <vasil.dimov@oracle.com>
  branch nick: mysql-5.1-innodb
  timestamp: Thu 2010-05-20 16:27:35 +0300
  message:
    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-24 21:27:25 +03:00
Vasil Dimov
9f42efeb78 Disable the tests on embedded windows that fail due to
Bug #53947 InnoDB: Assertion failure in thread 4224 in file
.\sync\sync0sync.c line 324

This changeset should be reverted once the bug is fixed.
2010-05-24 21:22:09 +03:00
Vasil Dimov
d064f00aa7 Merge mysql-trunk-innodb from bk-internal into my local tree 2010-05-24 20:58:02 +03:00
Alexey Kopytov
71929d76d0 Fixed an incorrectly merged .result file. 2010-05-24 18:13:00 +04: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
Mattias Jonsson
d7e7afd403 Merge of bug#51851.
Also moved HA_DATA_PARTITION from ha_partition.cc to table.h.
2010-05-24 14:51:59 +02:00
Marko Mäkelä
42eff81005 Merge a change from mysql-5.1-innodb:
------------------------------------------------------------
revno: 3479
revision-id: marko.makela@oracle.com-20100524110439-fazi70rlmt07tzd9
parent: vasil.dimov@oracle.com-20100520133157-42uk5q3pp0vsinac
committer: Marko Mäkelä <marko.makela@oracle.com>
branch nick: 5.1-innodb
timestamp: Mon 2010-05-24 14:04:39 +0300
message:
  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:45:24 +03: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
Alexey Kopytov
b69a31fad5 Manual merge of mysql-5.1-bugteam to mysql-trunk-merge.
Conflicts:

   conflict      Makefile.am
   conflict      mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result
   conflict      mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test
   conflict      sql/opt_sum.cc
   conflict      sql/set_var.cc
   conflict      sql/sql_base.cc
   conflict      sql/sql_priv.h
   conflict      sql/sql_show.cc
2010-05-24 00:41:18 +04:00
Vasil Dimov
9c6b7b19d1 Fix function decoration in Performance Schema code 2010-05-23 23:11:31 +03:00
Mattias Jonsson
ca0aa95c6d merge 2010-05-23 18:08:33 +02:00
Calvin Sun
dde975afb9 mysql-trunk-innodb: fix compile errors on Windows with UNIV_DEBUG defined. 2010-05-21 16:30:09 -05:00