mariadb/mysql-test/suite
Sujatha Sivakumar 1b74f2e3da Bug#17942050:KILL OF TRUNCATE TABLE WILL LEAD TO BINARY LOG
WRITTEN WHILE ROWS REMAINS

Problem:
========
When truncate table fails while using transactional based
engines even though the operation errors out we still
continue and log it to binlog. Because of this master has
data but the truncate will be written to binary log which
will cause inconsistency.

Analysis:
========
Truncate table can happen either through drop and create of
table or by deleting rows. In the second case the existing
code is written in such a way that even if an error occurs
the truncate statement will always be binlogged. Which is not
correct.

Binlogging of TRUNCATE TABLE statement should check whether
truncate is executed "transactionally or not". If the table
is transaction based we log the TRUNCATE TABLE only on
successful completion.

If table is non transactional there are possibilities that on
error we could have partial changes done hence in such cases
we do log in spite of errors as some of the lines might have
been removed, so the statement has to be sent to slave.

Fix:
===
Using table handler whether truncate table is being executed
in transaction based mode or not is identified and statement
is binlogged accordingly.

mysql-test/suite/binlog/r/binlog_truncate_kill.result:
  Added test case to test the fix for Bug#17942050.
mysql-test/suite/binlog/t/binlog_truncate_kill.test:
  Added test case to test the fix for Bug#17942050.
sql/sql_truncate.cc:
  Check if truncation is successful or not and retun appropriate
  return values so that binlogging can be done based on that.
sql/sql_truncate.h:
  Added a new enum.
2014-04-15 15:17:25 +05:30
..
binlog Bug#17942050:KILL OF TRUNCATE TABLE WILL LEAD TO BINARY LOG 2014-04-15 15:17:25 +05:30
engines Bug#16274455: CAN NOT ACESS PARTITIONED TABLES WHEN 2013-02-14 17:03:49 +01:00
federated Bug #12876932 - INCORRECT SELECT RESULT ON FEDERATED TABLE 2012-07-26 15:29:19 +05:30
funcs_1 local merge. 2013-03-22 20:16:53 +05:30
funcs_2 Changed to Oracle bug numbers 2011-05-24 12:08:13 +05:30
innodb Bug #18010711 UNIQUE PREFIX INDEX ON BINARY COLUMN: 2014-02-17 13:45:34 +05:30
innodb_zip BUG#16321920 : CREATE A SEPARATE INNODB_ZIP TEST SUITE 2013-11-29 15:13:47 +05:30
jp WL#2360 Performance schema 2010-01-11 18:47:27 -07:00
large_tests BUG#11877618: rpl_slave_net_timeout fails in rpl_sync.inc (at sync_slave_with_master) 2011-03-17 11:31:42 +01:00
manual BUG#49978: Replication tests don't clean up replication state at the end 2010-12-19 18:07:28 +01:00
parts Bug#16274455: CAN NOT ACESS PARTITIONED TABLES WHEN 2013-02-14 17:03:49 +01:00
perfschema Bug#16060864 SEGMENTATION FAULT IN PERFORMANCE_SCHEMA WITH HISTORY SIZE 0 2013-01-02 11:00:55 +01:00
perfschema_stress Updated/added copyright header. Added line "use is subject to license terms" 2014-02-17 18:19:04 +05:30
rpl BUG#18506556. Added sync slave with master for clean-up 2014-04-04 10:42:25 +04:00
stress Bug #11751927 42960: MTR2: NO MORE --STRESS PARAMETERS 2011-09-15 12:34:32 +02:00
sys_vars Bug#17075846 - UNQUOTED FILE NAMES FOR VARIABLE VALUES ARE 2014-02-12 14:33:56 +05:30