From da9c659c8196d1da63330fc7b1b6710217801a6f Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 5 Mar 2007 11:52:28 +0100 Subject: Bug#26464 - insert delayed + update + merge = corruption Using INSERT DELAYED on MERGE tables could lead to table corruptions. The manual lists a couple of storage engines, which can be used with INSERT DELAYED. MERGE is not in this list. The attempt to try it anyway has not been rejected yet. This bug was not detected earlier as it can work under special circumstances. Most notable is low concurrency. To be safe, this patch rejects any attempt to use INSERT DELAYED on MERGE tables. mysql-test/r/merge.result: Bug#26464 - insert delayed + update + merge = corruption Added test result. mysql-test/t/merge.test: Bug#26464 - insert delayed + update + merge = corruption Added test. sql/ha_myisammrg.h: Bug#26464 - insert delayed + update + merge = corruption Removed HA_CAN_INSERT_DELAYED flag from table_flags(). The insert delayed thread upgrades the lock from the first entry in MYSQL_LOCK::locks only. Hence it is incapable to handle MERGE tables, which have as many entries in this array as they have MyISAM sub-tables. --- mysql-test/r/merge.result | 5 +++++ mysql-test/t/merge.test | 9 +++++++++ 2 files changed, 14 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result index eb333cdadb7..33de735d714 100644 --- a/mysql-test/r/merge.result +++ b/mysql-test/r/merge.result @@ -801,3 +801,8 @@ CREATE TABLE tm1(a SMALLINT, b SMALLINT, KEY(a)) ENGINE=MERGE UNION=(t1); SELECT * FROM tm1; ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist DROP TABLE t1, tm1; +CREATE TABLE t1(c1 INT) ENGINE=MyISAM; +CREATE TABLE t2(c1 INT) ENGINE=MERGE UNION=(t1); +INSERT DELAYED INTO t2 VALUES(1); +ERROR HY000: Table storage engine for 't2' doesn't have this option +DROP TABLE t1, t2; diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test index 700a807e62c..f759d20dd80 100644 --- a/mysql-test/t/merge.test +++ b/mysql-test/t/merge.test @@ -428,4 +428,13 @@ CREATE TABLE tm1(a SMALLINT, b SMALLINT, KEY(a)) ENGINE=MERGE UNION=(t1); SELECT * FROM tm1; DROP TABLE t1, tm1; +# +# Bug#26464 - insert delayed + update + merge = corruption +# +CREATE TABLE t1(c1 INT) ENGINE=MyISAM; +CREATE TABLE t2(c1 INT) ENGINE=MERGE UNION=(t1); +--error 1031 +INSERT DELAYED INTO t2 VALUES(1); +DROP TABLE t1, t2; + # End of 4.1 tests -- cgit v1.2.1