Commit graph

67154 commits

Author SHA1 Message Date
Alexey Kopytov
d72c594739 Manual merge from mysql-5.1-bugteam into mysql-5.5-bugteam.
conflicts:
   conflict      dbug/dbug.c
   conflict      sql/sql_load.cc
2010-10-02 00:12:27 +04:00
Alexey Kopytov
00677a802b Automerge. 2010-10-01 23:56:55 +04:00
Mattias Jonsson
e33e27a664 Minor update of test to pass both with and without --ps-protocol 2010-10-01 21:32:40 +02:00
Mattias Jonsson
de54fc659e merge 2010-10-01 18:52:59 +02:00
Mattias Jonsson
38627075f9 merge 2010-10-01 18:36:53 +02:00
Mattias Jonsson
36e0ca0d7e merge 2010-10-01 18:29:40 +02:00
Mattias Jonsson
29acd77643 minor test result update after merge 2010-10-01 18:10:45 +02:00
Mattias Jonsson
ed4424a893 merge 2010-10-01 16:06:10 +02:00
Mattias Jonsson
20606cec59 Manual merge into mysql-5.5-bugteam 2010-10-01 15:59:07 +02:00
Bjorn Munch
ad1824eed0 upmerge 20304 2010-10-01 15:55:49 +02:00
Mattias Jonsson
3c555b6c18 merge 2010-10-01 15:41:27 +02:00
Vasil Dimov
1f1c2e22eb Merge mysql-5.5-innodb -> mysql-5.5-bugteam 2010-10-01 16:36:35 +03:00
Mattias Jonsson
fbb49d80eb merge 2010-10-01 15:32:03 +02:00
Mattias Jonsson
53fe2b31f2 removed a comment according to the review 2010-10-01 15:30:16 +02:00
Mattias Jonsson
9aa7484cfe merge 2010-10-01 15:25:13 +02:00
Vasil Dimov
ddc653bea0 Null merge mysql-5.1-bugteam -> mysql-5.5-bugteam
This is a null merge because it only contains InnoDB changes that
originated in mysql-5.1-innodb and have been manually ported into
mysql-5.5-innodb.
2010-10-01 15:59:59 +03:00
Vasil Dimov
4a9b4ed0dd Merge mysql-5.1-innodb -> mysql-5.1-bugteam 2010-10-01 15:39:44 +03:00
Mattias Jonsson
acc1b32675 Manual merge of bug#51851 from mysql-5.1-bugteam into mysql-5.5-bugteam 2010-10-01 14:16:00 +02:00
Vasil Dimov
75fc5b6a33 Fix a potential bug when using __sync_lock_test_and_set()
This is a manual merge from mysql-5.1-innodb of:

  revision-id: vasil.dimov@oracle.com-20100930102618-s9f9ytbytr3eqw9h
  committer: Vasil Dimov <vasil.dimov@oracle.com>
  timestamp: Thu 2010-09-30 13:26:18 +0300
  message:
    Fix a potential bug when using __sync_lock_test_and_set()

    TYPE __sync_lock_test_and_set (TYPE *ptr, TYPE value, ...)

    it is not documented what happens if the two arguments are of different
    type like it was before: the first one was lock_word_t (byte) and the
    second one was 1 or 0 (int).

    Approved by:	Marko (via IRC)
2010-10-01 14:51:00 +03:00
Mattias Jonsson
cfcf51b719 merge 2010-10-01 13:39:49 +02:00
Mattias Jonsson
814fbc5b6f Bug#51851: Server with SBR locks mutex twice on
LOAD DATA into partitioned MyISAM table

Problem was that both partitioning and myisam
used the same table_share->mutex for different protections
(auto inc and repair).

Solved by adding a specific mutex for the partitioning
auto_increment.

Also adding destroying the ha_data structure in
free_table_share (which is to be propagated
into 5.5).

This is a 5.1 ONLY patch, already fixed in 5.5+.
2010-10-01 13:39:04 +02:00
Mattias Jonsson
1b5f84db5b Bug#56172: Server crashes in ha_partition::reset on
REBUILD PARTITION under LOCK TABLE

Collapsed patch including updates from the reviews.

In case of failure in ALTER ... PARTITION under LOCK TABLE
the server could crash, due to it had modified the locked
table object, which was not reverted in case of failure,
resulting in a bad table definition used after the failed
command.

Solved by instead of altering the locked table object and
its partition_info struct, creating an internal temporary
intermediate table object used for altering,
just like the non partitioned mysql_alter_table.
So if an error occur before the alter operation is complete,
the original table is not modified at all.
But if the alter operation have succeeded so far that it
must be completed as whole,
the table is properly closed and reopened.
(The completion on failure is done by the ddl_log.)

mysql-test/suite/parts/inc/partition_fail.inc:
  Added tests under LOCK TABLE
mysql-test/suite/parts/r/partition_debug_innodb.result:
  Updated results
mysql-test/suite/parts/r/partition_debug_myisam.result:
  Updated results
mysql-test/suite/parts/r/partition_special_innodb.result:
  updated result
mysql-test/suite/parts/t/partition_special_innodb.test:
  changing comment, since this patch also fixes this.
sql/sql_partition.cc:
  Added TODO, to use DBUG_SUICIDE() instead of abort()
  to avoid core-files on expected crashes.
  Removed unused arguments to fast_end_partition.
  Opening a intermediate table in prep_alter_part_table, instead of altering
  (a possible locked) normally opened table.
  That way we do not have to do anything more than close
  the intermediate table on error,
  leaving the ordinary table opened and locked.
  Also making sure that the intermediate table are
  closed/destroyed on failure. If no error occur
  it is later destroyed in the end of fast_alter_partition_table.
  Added ha_external_lock to make sure MyISAM flushed the index file
  after copying the partitions.
  This also leads to removal of the special close and removal from
  the table cache for other instances of the table.
sql/sql_partition.h:
  Changed the arguments for prep_alter_part_table and
  fast_alter_partition_table to use an intermediate table
  instead of altering a (possibly locked) normal table.
sql/sql_table.cc:
  Using an intermediate table created in prep_alter_part_table
  to be used in fast_alter_partition_table, also closing/destroying
  it on failure.
2010-10-01 13:22:11 +02:00
Jon Olav Hauglid
029657be0e Merge from mysql-5.5-runtime to mysql-5.5-bugteam. 2010-10-01 11:23:43 +02:00
Bjorn Munch
abaa5c91b4 Bug #20304 mysqltest: reap with no preceding statement hangs forever
Added sanity check, similar to the one preventing send without reap
2010-10-01 11:00:18 +02:00
Bernt M. Johnsen
34d7180e0f Merge 2010-10-01 10:43:57 +02:00
Vasil Dimov
f7c8352193 Fix Bug#56340 innodb updates index stats too frequently after non-index updates
This is a manual merge from mysql-5.1-innodb of:

  revno: 3618
  revision-id: vasil.dimov@oracle.com-20100930124844-yglojy7c3vaji6dx
  parent: vasil.dimov@oracle.com-20100930102618-s9f9ytbytr3eqw9h
  committer: Vasil Dimov <vasil.dimov@oracle.com>
  branch nick: mysql-5.1-innodb
  timestamp: Thu 2010-09-30 15:48:44 +0300
  message:
    Fix Bug#56340 innodb updates index stats too frequently after non-index updates

    This is a simple optimization issue. All stats are related to only indexed
    columns, index size or number of rows in the whole table. UPDATEs that touch
    only non-indexed columns cannot affect stats and we can avoid calling the
    function row_update_statistics_if_needed() which may result in unnecessary I/O.

    Approved by:	Marko (rb://466)

In addition to the above message: we know that
row_update_cascade_for_mysql() (the other place where
row_update_statistics_if_needed is called) always updates indexed
columns (FK-related), so there is no need to add this cond there.
2010-10-01 10:34:21 +03:00
Mattias Jonsson
c485854945 Bug#55458: Partitioned MyISAM table gets crashed by multi-table update
Bug#57113: ha_partition::extra(ha_extra_function):
            Assertion `m_extra_cache' failed

Fix for bug#55458 included DBUG_ASSERTS causing
debug builds of the server to crash on
another multi-table update.

Removed the asserts since they where wrong.
(updated after testing the patch in 5.5).

mysql-test/r/partition.result:
  updated result
mysql-test/t/partition.test:
  Added test for bug#57113
sql/ha_partition.cc:
  Removed the assert for m_extra_cache when
  ::extra(HA_PREPARE_FOR_UPDATE) was called.
2010-09-30 15:57:33 +02:00
Bernt M. Johnsen
003a231565 Bug#56375 Ignore socket path since it may vary. Added some comments to
inline perl in the test.
2010-09-30 15:52:39 +02:00
Dmitry Lenev
476939cb45 Reverted a temporary workaround for bug #56405 "Deadlock
in the MDL deadlock detector".

It is no longer needed as a better fix for this bug has
been pushed.
2010-09-30 17:29:12 +04:00
Vasil Dimov
eaaea8eb7d Fix Bug#56340 innodb updates index stats too frequently after non-index updates
This is a simple optimization issue. All stats are related to only indexed
columns, index size or number of rows in the whole table. UPDATEs that touch
only non-indexed columns cannot affect stats and we can avoid calling the
function row_update_statistics_if_needed() which may result in unnecessary I/O.

Approved by:	Marko (rb://466)
2010-09-30 15:48:44 +03:00
Georgi Kodinov
3be2bf76eb merge 2010-09-30 14:06:50 +03:00
Bjorn Munch
c84973c7e0 upmerge 52828 2010-09-30 12:53:36 +02:00
Jon Olav Hauglid
bf55d1fcf0 Merge from mysql-5.5-bugteam to mysql-5.5-runtime 2010-09-30 12:43:43 +02:00
Bjorn Munch
be7b3c0040 Bug #52828 Tests that use perl fail when perl is not in path
Trying to run perl fails, just like it does when perl is started but fails
Trap the case that perl was not found/could not be started, and skip test
Also force a restart of servers since test may already have done something
mtr now also appends path of current perl to PATH to aid mysqltest
2010-09-30 12:42:37 +02:00
Vasil Dimov
51cdf59546 Fix a potential bug when using __sync_lock_test_and_set()
TYPE __sync_lock_test_and_set (TYPE *ptr, TYPE value, ...)

it is not documented what happens if the two arguments are of different
type like it was before: the first one was lock_word_t (byte) and the
second one was 1 or 0 (int).

Approved by:	Marko (via IRC)
2010-09-30 13:26:18 +03:00
Bjorn Munch
9ec4724866 Small test fix after 56753 2010-09-30 10:28:22 +02:00
Georgi Kodinov
32de99125a merge 2010-09-29 18:22:40 +03:00
Georgi Kodinov
6a0cfa23bd merge 2010-09-29 17:26:32 +03:00
Dmitry Lenev
0afd0a18fe A better fix for bug #56405 "Deadlock in the MDL deadlock
detector" that doesn't introduce bug #56715 "Concurrent
transactions + FLUSH result in sporadical unwarranted
deadlock errors".

Deadlock could have occurred when workload containing a mix
of DML, DDL and FLUSH TABLES statements affecting the same
set of tables was executed in a heavily concurrent environment.

This deadlock occurred when several connections tried to
perform deadlock detection in the metadata locking subsystem.
The first connection started traversing wait-for graph,
encountered a sub-graph representing a wait for flush, acquired
LOCK_open and dived into sub-graph inspection. Then it
encountered sub-graph corresponding to wait for metadata lock
and blocked while trying to acquire a rd-lock on
MDL_lock::m_rwlock, since some,other thread had a wr-lock on it.
When this wr-lock was released it could have happened (if there
was another pending wr-lock against this rwlock) that the rd-lock
from the first connection was left unsatisfied but at the same
time the new rd-lock request from the second connection sneaked
in and was satisfied (for this to be possible the second
rd-request should come exactly after the wr-lock is released but
before pending the wr-lock manages to grab rwlock, which is
possible both on Linux and in our own rwlock implementation).
If this second connection continued traversing the wait-for graph
and encountered a sub-graph representing a wait for flush it tried
to acquire LOCK_open and thus the deadlock was created.

The previous patch tried to workaround this problem by not
allowing the deadlock detector to lock LOCK_open mutex if
some other thread doing deadlock detection already owns it
and current search depth is greater than 0. Instead deadlock
was reported. As a result it has introduced bug #56715.

This patch solves this problem in a different way.
It introduces a new rw_pr_lock_t implementation to be used
by MDL subsystem instead of one based on Linux rwlocks or
our own rwlock implementation. This new implementation
never allows situation in which an rwlock is rd-locked and
there is a blocked pending rd-lock. Thus the situation which
has caused this bug becomes impossible with this implementation.

Due to fact that this implementation is optimized for
wr-lock/unlock scenario which is most common in the MDL
subsystem it doesn't introduce noticeable performance
regressions in sysbench tests. Moreover it significantly
improves situation for POINT_SELECT test when many
connections are used.

No test case is provided as this bug is very hard to repeat
in MTR environment but is repeatable with the help of RQG
tests.
This patch also doesn't include a test for bug #56715
"Concurrent transactions + FLUSH result in sporadical
unwarranted deadlock errors" as it takes too much time to
be run as part of normal test-suite runs.

config.h.cmake:
  We no longer need to check for presence of
  pthread_rwlockattr_setkind_np as we no longer
  use Linux-specific implementation of rw_pr_lock_t
  which uses this function.
configure.cmake:
  We no longer need to check for presence of
  pthread_rwlockattr_setkind_np as we no longer
  use Linux-specific implementation of rw_pr_lock_t
  which uses this function.
configure.in:
  We no longer need to check for presence of
  pthread_rwlockattr_setkind_np as we no longer
  use Linux-specific implementation of rw_pr_lock_t
  which uses this function.
include/my_pthread.h:
  Introduced new implementation of rw_pr_lock_t.
  Since it never allows situation in which rwlock is rd-locked
  and there is a blocked pending rd-lock it is not affected by
  bug #56405 "Deadlock in the MDL deadlock detector".
  This implementation is also optimized for wr-lock/unlock
  scenario which is most common in MDL subsystem. So it doesn't
  introduce noticiable performance regressions in sysbench tests
  (compared to old Linux-specific implementation). Moreover it
  significantly improves situation for POINT_SELECT test when
  many connections are used.
  As part of this change removed try-lock part of API for
  this type of lock. It is not used in our code and it would
  be hard to implement correctly within constraints of new
  implementation.
  Finally, removed support of preferring readers from
  my_rw_lock_t implementation as the only user of this
  feature was old rw_pr_lock_t implementation.
include/mysql/psi/mysql_thread.h:
  Removed try-lock part of prlock API.
  It is not used in our code and it would be hard
  to implement correctly within constraints of new
  prlock implementation.
mysys/thr_rwlock.c:
  Introduced new implementation of rw_pr_lock_t.
  Since it never allows situation in which rwlock is rd-locked
  and there is a blocked pending rd-lock it is not affected by
  bug #56405 "Deadlock in the MDL deadlock detector".
  This implementation is also optimized for wr-lock/unlock
  scenario which is most common in MDL subsystem. So it doesn't
  introduce noticiable performance regressions in sysbench tests
  (compared to old Linux-specific implementation). Moreover it
  significantly improves situation for POINT_SELECT test when
  many connections are used.
  Also removed support of preferring readers from
  my_rw_lock_t implementation as the only user of this
  feature was old rw_pr_lock_t implementation.
2010-09-29 16:09:07 +04:00
Bjorn Munch
71f9446308 merge from 5.5 2010-09-29 13:14:21 +02:00
Bjorn Munch
dae793978a merge from 5.1 2010-09-29 12:56:10 +02:00
Vladislav Vaintroub
36081eed3d Rename CMAKE_PARSE_ARGUMENTS macro to avoid name collision
with CMake 2.8.3 builtin macro
2010-09-29 11:42:35 +02:00
Jon Olav Hauglid
b72e7f05ff Followup to Bug#46165 server crash in dbug
This patch moves the regression test from variables.test to
variables_debug.test as the debug system variable is not 
available on release builds.
2010-09-29 10:07:56 +02:00
Alexander Nozdrin
7f552e4608 Empty merge from mysql-5.5. 2010-09-28 19:42:45 +04:00
Alexander Nozdrin
2a778dcdb9 Auto-merge from mysql-5.5-merge. 2010-09-28 19:34:59 +04:00
Alexander Nozdrin
94e726ae3d Auto-merge from mysql-5.5-merge. 2010-09-28 19:15:58 +04:00
Bjorn Munch
bd71a48649 upmerge 56125,56921 2010-09-28 16:00:11 +02:00
Bjorn Munch
9605bc63fc Bug #56125 MTR2 start-and-exit removes server tmpdir, server becomes not operational
This happens when creating new tmpdir due to too long socket path
Don't delete it if --start-and-exit, but warn user to do it.
2010-09-28 15:58:01 +02:00
Vasil Dimov
3de0aa061b Increment InnoDB Plugin version to 1.0.13.
InnoDB Plugin 1.0.12 has been released with MySQL 5.1.51.
2010-09-28 15:31:33 +03:00
Jon Olav Hauglid
7f80cffa52 Bug #46165 server crash in dbug
This crash occured if the same debug trace file was closed twice,
leading to the same memory being free'd twice. This could occur
if the "debug" server system variable refered to the same trace
file in both global and session scope.

Example of an order of events that would lead to a crash:
1) Enable debug tracing to a trace file (global scope)
2) Enable debug tracing to the same trace file (session scope)
3) Reset debug settings (global scope)
4) Reset debug settings (session scope)

This caused a crash because the trace file was, by mistake, closed
in 3), leading to the same memory being free'd twice when the file
was closed again in 4).

Internally, the debug settings are stored in a stack, with session
settings (if any) on top and the global settings below. Each connection
has its own stack. When a set of settings is changed, it must be 
determined if its debug trace file is to be closed. Before, this was done
by only checking below on the settings stack. So if the global settings
were changed, an existing debug trace file reference in session settings
would be missed. This caused the file to be closed even if it was in use,
leading to a crash later when it was closed again.

This patch fixes the problem by preventing the trace file from being shared
between global and session settings. If session debug settings are set without
specifying a new trace file, stderr is used for output. This is a change
in behaviour and should be reflected in the documentation.

Test case added to variables.test.
2010-09-28 11:07:58 +02:00