3867 Marko Mäkelä 2012-05-25
prepare_inplace_alter_table_dict(): Do not acquire lock on the new table.
We skip all record locking when populating the indexes.
The table locking on the target (rebuilt) table is unnecessary too.
modified:
storage/innobase/handler/handler0alter.cc
3866 Marko Mäkelä 2012-05-25
WL#6255 preparation: Add LOCK=SHARED to main.innodb_mysql_sync.test
so that it will pass when ADD PRIMARY KEY can be done online.
modified:
mysql-test/r/innodb_mysql_sync.result
mysql-test/t/innodb_mysql_sync.test
3865 Marko Mäkelä 2012-05-25
Bug#14117641 (possible fix) and a WL#6255 optimization
Allow the non-online InnoDB in-place DDL operations with LOCK=SHARED.
prepare_inplace_alter_table_dict(): When creating indexes and
an online operation has not been requested, acquire S-lock on the table.
Previously, we acquired an X-lock, and only when the table was being rebuilt.
Failure to lock the table might explain Bug#14117641 if there was a
foreign key CASCADE or SET NULL constraint referencing the table.
modified:
mysql-test/r/innodb_mysql_sync.result
mysql-test/suite/innodb/r/innodb-alter.result
mysql-test/suite/innodb/t/innodb-alter.test
mysql-test/t/innodb_mysql_sync.test
storage/innobase/handler/handler0alter.cc
=== modified file 'mysql-test/r/innodb_mysql_sync.result'
--- a/mysql-test/r/innodb_mysql_sync.result revid:marko.makela@stripped3924-23jckoyd4n0wkpu8
+++ b/mysql-test/r/innodb_mysql_sync.result revid:marko.makela@strippeduq4h5gytikr02
@@ -119,7 +119,7 @@ DROP DATABASE db1;
CREATE TABLE t1(a INT NOT NULL, b INT NOT NULL) engine=innodb;
SET DEBUG_SYNC= "alter_table_inplace_after_lock_downgrade SIGNAL manage WAIT_FOR query";
# Sending:
-ALTER TABLE t1 ADD UNIQUE INDEX(a);
+ALTER TABLE t1 ADD UNIQUE INDEX(a), LOCK=SHARED;
# Connection con1
SET DEBUG_SYNC= "now WAIT_FOR manage";
USE test;
@@ -139,7 +139,7 @@ SET DEBUG_SYNC= "now SIGNAL query";
ALTER TABLE t1 DROP INDEX a;
SET DEBUG_SYNC= "alter_table_inplace_after_lock_downgrade SIGNAL manage WAIT_FOR query";
# Sending:
-ALTER TABLE t1 ADD PRIMARY KEY (a);
+ALTER TABLE t1 ADD PRIMARY KEY (a), LOCK=SHARED;
# Connection con1
SET DEBUG_SYNC= "now WAIT_FOR manage";
SELECT * FROM t1;
=== modified file 'mysql-test/t/innodb_mysql_sync.test'
--- a/mysql-test/t/innodb_mysql_sync.test revid:marko.makela@strippedom-20120525113924-23jckoyd4n0wkpu8
+++ b/mysql-test/t/innodb_mysql_sync.test revid:marko.makela@stripped5200045-mv7uq4h5gytikr02
@@ -191,7 +191,7 @@ DROP DATABASE db1;
CREATE TABLE t1(a INT NOT NULL, b INT NOT NULL) engine=innodb;
SET DEBUG_SYNC= "alter_table_inplace_after_lock_downgrade SIGNAL manage WAIT_FOR query";
--echo # Sending:
---send ALTER TABLE t1 ADD UNIQUE INDEX(a)
+--send ALTER TABLE t1 ADD UNIQUE INDEX(a), LOCK=SHARED
--echo # Connection con1
connection con1;
@@ -227,7 +227,7 @@ connection default;
ALTER TABLE t1 DROP INDEX a;
SET DEBUG_SYNC= "alter_table_inplace_after_lock_downgrade SIGNAL manage WAIT_FOR query";
--echo # Sending:
---send ALTER TABLE t1 ADD PRIMARY KEY (a)
+--send ALTER TABLE t1 ADD PRIMARY KEY (a), LOCK=SHARED
--echo # Connection con1
connection con1;
=== modified file 'storage/innobase/handler/handler0alter.cc'
--- a/storage/innobase/handler/handler0alter.cc revid:marko.makela@stripped113924-23jckoyd4n0wkpu8
+++ b/storage/innobase/handler/handler0alter.cc revid:marko.makela@stripped45-mv7uq4h5gytikr02
@@ -1785,14 +1785,6 @@ op_ok:
ut_a(trx->lock.n_active_thrs == 0);
- if (new_clustered) {
- /* A clustered index is to be built. Acquire a shared
- table lock also on the table that is being created. */
- DBUG_ASSERT(indexed_table != user_table);
-
- error = row_merge_lock_table(user_trx, indexed_table, LOCK_S);
- }
-
error_handling:
/* After an error, remove all those index definitions from the
dictionary which were defined. */
No bundle (reason: useless for push emails).| Thread |
|---|
| • bzr push into mysql-trunk-wl6255 branch (marko.makela:3865 to 3867) | marko.makela | 25 May |