mariadb/storage/innobase
Davi Arnaut 5f911fa874 Bug#49938: Failing assertion: inode or deadlock in fsp/fsp0fsp.c
Bug#54678: InnoDB, TRUNCATE, ALTER, I_S SELECT, crash or deadlock

- Incompatible change: truncate no longer resorts to a row by
row delete if the storage engine does not support the truncate
method. Consequently, the count of affected rows does not, in
any case, reflect the actual number of rows.

- Incompatible change: it is no longer possible to truncate a
table that participates as a parent in a foreign key constraint,
unless it is a self-referencing constraint (both parent and child
are in the same table). To work around this incompatible change
and still be able to truncate such tables, disable foreign checks
with SET foreign_key_checks=0 before truncate. Alternatively, if
foreign key checks are necessary, please use a DELETE statement
without a WHERE condition.

Problem description:

The problem was that for storage engines that do not support
truncate table via a external drop and recreate, such as InnoDB
which implements truncate via a internal drop and recreate, the
delete_all_rows method could be invoked with a shared metadata
lock, causing problems if the engine needed exclusive access
to some internal metadata. This problem originated with the
fact that there is no truncate specific handler method, which
ended up leading to a abuse of the delete_all_rows method that
is primarily used for delete operations without a condition.

Solution:

The solution is to introduce a truncate handler method that is
invoked when the engine does not support truncation via a table
drop and recreate. This method is invoked under a exclusive
metadata lock, so that there is only a single instance of the
table when the method is invoked.

Also, the method is not invoked and a error is thrown if
the table is a parent in a non-self-referencing foreign key
relationship. This was necessary to avoid inconsistency as
some integrity checks are bypassed. This is inline with the
fact that truncate is primarily a DDL operation that was
designed to quickly remove all data from a table.
2010-10-06 11:34:28 -03:00
..
btr Merge mysql-5.5-innodb -> mysql-5.5-bugteam 2010-10-01 16:36:35 +03:00
buf (buf0flu.c:136) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 2010-09-20 18:45:40 +03:00
data Bug#52199 utf32: mbminlen=4, mbmaxlen=4, type->mbminlen=0, type->mbmaxlen=4 2010-06-29 14:32:48 +03:00
dict (dict0dict.c:4458) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 2010-09-20 18:47:15 +03:00
dyn Renamed storage/innodb_plugin to storage/innobase, so that 1) it's the same 2009-08-07 12:16:00 +02:00
eval Remove redundant variable 2010-09-20 18:48:38 +03:00
fil Bug#54728: Replace the dulint struct with a 64-bit integer. 2010-06-23 14:06:59 +03:00
fsp Bug#54728: Replace the dulint struct with a 64-bit integer. 2010-06-23 14:06:59 +03:00
fut Renamed storage/innodb_plugin to storage/innobase, so that 1) it's the same 2009-08-07 12:16:00 +02:00
ha Currently we do a full validation of AHI whenever check tables is 2010-08-05 11:09:05 -04:00
handler Bug#49938: Failing assertion: inode or deadlock in fsp/fsp0fsp.c 2010-10-06 11:34:28 -03:00
ibuf (ibuf0ibuf.c:1300) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 2010-09-20 18:51:11 +03:00
include Merge mysql-5.5-innodb -> mysql-5.5-bugteam 2010-10-01 16:36:35 +03:00
lock Bug#54728: Replace the dulint struct with a 64-bit integer. 2010-06-23 14:06:59 +03:00
log (log0recv.c:2905) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 2010-09-20 18:55:54 +03:00
mach mach_ull_parse_compressed(): Move to .ic file to silence a GCC warning 2010-06-24 09:08:42 +03:00
mem Fix bug #52546, crash on shutdown of plugin with innodb_use_sys_malloc=0. 2010-05-17 01:57:42 -07:00
mtr Remove code that was added during the flush list mutex refactoring. We cannot 2010-07-22 14:46:12 +10:00
mysql-test/patches Move InnoDB tests from storage/innobase/mysql-test/ (where they were ignored) 2010-04-14 14:14:48 +03:00
os (os0file.c:1485) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 2010-09-20 19:00:28 +03:00
page Bug#54728: Replace the dulint struct with a 64-bit integer. 2010-06-23 14:06:59 +03:00
pars Bug#54728: Replace the dulint struct with a 64-bit integer. 2010-06-23 14:06:59 +03:00
que (que0que.c:1286) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 2010-09-20 19:01:14 +03:00
read Bug#54728: Replace the dulint struct with a 64-bit integer. 2010-06-23 14:06:59 +03:00
rem Merge from mysql-5.1-innodb: 2010-05-11 19:18:28 +03:00
row Bug#49938: Failing assertion: inode or deadlock in fsp/fsp0fsp.c 2010-10-06 11:34:28 -03:00
srv This patch comes from Michael: See bug#56933. 2010-09-24 08:37:09 +10:00
sync Bug#54583 InnoDB: Assertion failure sync/sync0sync.c:1226 2010-07-22 09:16:19 +10:00
thr Import branches/innodb+ from SVN on top of storage/innobase. 2010-04-12 18:20:41 +03:00
trx (trx0undo.c:1873) Bug#55227 Fix compiler warnings in innodb with gcc 4.6 2010-09-20 19:40:44 +03:00
usr Merge Innodb Plugin 1.0.6 from mysql-5.1-bugteam storage/innodb_plugin to mysql-trunk-merge. 2009-12-02 19:30:50 +05:30
ut Remove ut0auxconf.h. 2010-09-09 14:27:52 +03:00
CMakeLists.txt Enable UNIV_DEBUG when WITH_DEBUG is defined 2010-09-09 13:06:43 +03:00
compile-innodb Invoke make with -j$(nproc) for better parallelism. 2010-09-09 13:50:06 +03:00
COPYING.Google Renamed storage/innodb_plugin to storage/innobase, so that 1) it's the same 2009-08-07 12:16:00 +02:00
COPYING.Percona Renamed storage/innodb_plugin to storage/innobase, so that 1) it's the same 2009-08-07 12:16:00 +02:00
Doxyfile Remove ut0auxconf.h. 2010-09-09 14:27:52 +03:00
ha_innodb.def Renamed storage/innodb_plugin to storage/innobase, so that 1) it's the same 2009-08-07 12:16:00 +02:00
Makefile.am Remove ut0auxconf.h. 2010-09-09 14:27:52 +03:00
plug.in Bug #55547 InnoDB is not included when configuring by default 2010-08-18 10:14:55 +02:00