Commit graph

67122 commits

Author SHA1 Message Date
Magne Mahre
653f14c265 Bug#56452 Assertion failed: thd->transaction.stmt.is_empty() ||
thd->in_sub_stmt
      
In a precursor patch for Bug#52044 
(revid:bzr/kostja@stripped), a
number of reorganizations of code was made. In addition some
assertions were added to ensure the correct transactional state.
      
The reorganization had a small glitch so statements that was
active in the query cache was not followed by a
statement commit/rollback (this code was removed). A section
in the trans_commit_stmt/trans_rollback_stmt code is to
clear the thd->transaction.stmt list of affected storage
engines.  When a new statement is initiated, an assert
introduced by the 523044 patch checks if this list is cleared.
When the query cache is accessed, this list may be populated,
and since it's not committed it will not be cleared.
      
This fix adds explicit statement commit or rollback for
statements that is contained in the query cache.
2010-10-06 11:01:24 +02:00
Jon Olav Hauglid
e53e16a885 Bug #57002 Assert in upgrade_shared_lock_to_exclusive()
for ALTER TABLE + MERGE tables

The patch for Bug#56292 changed how metadata locks are taken for MERGE
tables. After the patch, locking the MERGE table will also lock the
children tables with the same metadata lock type. This means that 
LOCK TABLES on a MERGE table also will implicitly do LOCK TABLES on
the children tables.

A consequence of this change, is that it is possible to do LOCK TABLES
on a child table both explicitly and implicitly with the same statement
and that these two locks can be of different strength. For example,
LOCK TABLES child READ, merge WRITE.

In LOCK TABLES mode, we are not allowed to take new locks and each
statement must therefore try to find an existing TABLE instance with
a suitable lock. The code that searched for a suitable TABLE instance,
only considered table level locks. If a child table was locked twice,
it was therefore possible for this code to find a TABLE instance with
suitable table level locks but without suitable metadata lock.

This problem caused the assert in upgrade_shared_lock_to_exclusive()
to be triggered as it tried to upgrade a MDL_SHARED lock to
EXCLUSIVE. The problem was a regression caused by the patch for
Bug#56292.

This patch fixes the problem by partially reverting the changes
done by Bug#56292. Now, the children tables will only use the
same metadata lock as the MERGE table for MDL_SHARED_NO_WRITE
when not in locked tables mode. This means that LOCK TABLE
on a MERGE table will not implicitly lock the children tables.
This still fixes the original problem in Bug#56292 without
causing a regression.

Test case added to merge.test.
2010-10-06 09:56:29 +02:00
Jon Olav Hauglid
998eeea6f2 Merge from mysql-5.5-bugteam to mysql-5.5-runtime. 2010-10-04 16:19:11 +02:00
Davi Arnaut
40ee088f68 Bug#57210: remove pstack
Quoting from the bug report:

The pstack library has been included in MySQL since version
4.0.0. It's useless and should be removed.

Details: According to its own documentation, pstack only works
on Linux on x86 in 32 bit mode and requires LinuxThreads and a
statically linked binary. It doesn't really support any Linux
from 2003 or later and doesn't work on any other OS.
2010-10-04 08:52:59 -03:00
Vasil Dimov
a39f21a97e Merge mysql-5.5-innodb -> mysql-5.5-bugteam 2010-10-04 14:58:52 +03:00
Vasil Dimov
654b3e60c8 Merge mysql-5.5-bugteam -> mysql-5.5-innodb 2010-10-04 14:53:20 +03:00
Vasil Dimov
f3f1db2a45 Merge mysql-5.5-innodb from bk-internal to my local tree 2010-10-04 13:46:41 +03:00
Vasil Dimov
1852090266 Merge mysql-5.5-innodb from bk-internal to my local tree 2010-10-04 13:46:41 +03:00
Vasil Dimov
97bce13658 Merge mysql-5.5-bugteam -> mysql-5.5-innodb 2010-10-04 13:39:38 +03:00
Marko Mäkelä
24b1a89712 Merge Bug#56716 from 5.1 2010-10-04 13:38:05 +03:00
Vladislav Vaintroub
f6e5cf3ef4 merge 2010-10-04 13:41:10 +02:00
Vladislav Vaintroub
c38aa1b0e2 merge2 2010-10-04 13:36:37 +02:00
Vasil Dimov
2af35a2c0b Merge mysql-5.1-bugteam -> mysql-5.5-bugteam
(null merge of innodb-only changes)
2010-10-04 14:31:40 +03:00
Vasil Dimov
d9f88e64f1 Merge mysql-5.1-innodb -> mysql-5.1-bugteam 2010-10-04 14:26:56 +03:00
Vladislav Vaintroub
367bfa4106 A follow-up to the patch for bug #56405 "Deadlock in the MDL deadlock
detector". This patch addresses performance regression in OLTP_RO/MyISAM
test on Windows introduced by the fix for bug #56405. Thus it makes
original patch acceptable as a solution for bug #56585 "Slowdown of
readonly sysbench benchmarks (e.g point_select) on Windows 5.5".

With this patch, MySQL will use native Windows condition variables and 
reader-writer locks  if  they are supported by the OS.

This speeds up MyISAM and the effect comes mostly from using native
rwlocks. Native conditions improve scalability with higher number of 
concurrent users in other situations, e.g for prlocks.

Benchmark numbers for this patch as measured on Win2008R2 quad
core machine are attached to the bug report.
( direct link http://bugs.mysql.com/file.php?id=15883 )

Note that currently we require at least Windows7/WS2008R2 for 
reader-writer locks, even though native rwlock is available also on Vista.
Reason is that "trylock" APIs are missing on Vista, and trylock is used in
the server (in a single place in query cache).

While this patch could have been written differently, to enable the native
rwlock optimization also on Vista/WS2008 (e.g using native locks everywhere
but portable implementation in query cache), this would come at the 
expense of the code clarity, as it would introduce a new  "try-able" rwlock
type, to handle Vista case.

Another way to improve performance for the special case 
(OLTP_RO/MYISAM/Vista) would be to eliminate "trylock" usage from server,
 but this is outside of the scope here.


Native conditions variables are used beginning with Vista though the effect
of using condition variables alone is not measurable in this benchmark.
But when used together with native rwlocks on Win7, native conditions improve 
performance in high-concurrency OLTP_RO/MyISAM (128 and more sysbench 
users).
2010-10-04 13:03:11 +02:00
Marko Mäkelä
80961a0a25 Merge Bug#56716 from 5.1 2010-10-04 13:38:05 +03:00
Bjorn Munch
9ee0d56896 null upmerge 2010-10-04 12:08:36 +02:00
Marko Mäkelä
190ebda206 Bug#56716 InnoDB locks a record gap without locking the table
row_search_for_mysql(): Acquire an intention lock on the table
before locking the first record gap.
2010-10-04 13:06:41 +03:00
Marko Mäkelä
678bc90ed8 Bug#56716 InnoDB locks a record gap without locking the table
row_search_for_mysql(): Acquire an intention lock on the table
before locking the first record gap.
2010-10-04 13:05:21 +03:00
Bjorn Munch
0548d66df4 Follow-up to 54861, cannot assume pthread_t is integral type 2010-10-04 12:01:16 +02:00
Vasil Dimov
282eee8879 Merge mysql-5.1-bugteam -> mysql-5.1-innodb 2010-10-04 12:49:58 +03:00
Bjorn Munch
cd18aa3126 merge from 5.5-mtr 2010-10-04 10:40:28 +02:00
Jon Olav Hauglid
7a64d43ad0 Bug #51099 Assertion in mysql_multi_delete_prepare()
This assert was triggered if DELETE was done on a view that
referenced another view which in turn (directly or indirectly)
referenced more than one table.

Delete from a view referencing more than one table (a join view)
is not supported and is supposed to give ER_VIEW_DELETE_MERGE_VIEW
error. Before this error was reported from the multi table 
delete code, an assert verified that the view from the DELETE statement
had more than one underlying table. However, this assert did not take
into account that the view could refer to another view which in turn
referenced the actual tables.

This patch fixes the problem by adjusting the assert to take this
possibility into account. This problem was only noticeable on debug
builds of the server. On release builds, ER_VIEW_DELETE_MERGE_VIEW
was correctly reported.

Test case added to delete.test.
2010-10-04 10:25:04 +02:00
Bjorn Munch
c443ee4333 Small test fix after 56753 2010-10-03 19:39:28 +02:00
Bjorn Munch
64e189c37c merge from 5.1-mtr 2010-10-03 19:37:58 +02:00
Alexander Nozdrin
34388f5315 Auto-merge from mysql-5.5. 2010-10-02 22:17:21 +04:00
Alexander Nozdrin
4cce72a929 Auto-merge from mysql-5.5-stage (used to be mysql-5.5-bugfixing). 2010-10-02 22:08:31 +04:00
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