3866 Marko Mäkelä 2012-04-07 [merge]
Merge mysql-trunk-wl5545 to mysql-5.6-labs-april-2012.
modified:
mysql-test/suite/innodb/r/innodb-index-online.result
mysql-test/suite/innodb/t/innodb-index-online.test
storage/innobase/handler/handler0alter.cc
3865 Yasufumi Kinoshita 2012-04-07
Fix for Bug#13798956: fix for flush_neighbors behavior to flush only contiguous pages
modified:
storage/innobase/buf/buf0flu.cc
=== modified file 'mysql-test/suite/innodb/r/innodb-index-online.result'
--- a/mysql-test/suite/innodb/r/innodb-index-online.result revid:yasufumi.kinoshita@strippedm-20120407065441-d53jyqlnq3ibv8x2
+++ b/mysql-test/suite/innodb/r/innodb-index-online.result revid:marko.makela@oracle.com-20120407140653-uwc8m0vjr6d2c2o3
@@ -57,6 +57,10 @@ COMMIT;
ALTER TABLE t1 ADD UNIQUE INDEX(c2);
ERROR 23000: Duplicate entry '4' for key 'c2'
DELETE FROM t1 WHERE c1=7;
+ALTER TABLE t1 ADD FOREIGN KEY(c2) REFERENCES t1(c2), ALGORITHM=INPLACE;
+ERROR 42000: This version of MySQL doesn't yet support 'ALTER TABLE t1 ADD FOREIGN KEY(c2) REFERENCES t1(c2), ALGORITHM=INPLACE'
+ALTER TABLE t1 ADD UNIQUE INDEX(c2), LOCK=EXCLUSIVE, ALGORITHM=INPLACE;
+DROP INDEX c2 ON t1;
ALTER TABLE t1 ADD UNIQUE INDEX(c2);
SET DEBUG_SYNC='now WAIT_FOR scanned';
SELECT name,count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem='ddl';
=== modified file 'mysql-test/suite/innodb/t/innodb-index-online.test'
--- a/mysql-test/suite/innodb/t/innodb-index-online.test revid:yasufumi.kinoshita@oracle.com-20120407065441-d53jyqlnq3ibv8x2
+++ b/mysql-test/suite/innodb/t/innodb-index-online.test revid:marko.makela@oracle.com-20120407140653-uwc8m0vjr6d2c2o3
@@ -76,6 +76,13 @@ ALTER TABLE t1 ADD UNIQUE INDEX(c2);
connection default;
DELETE FROM t1 WHERE c1=7;
connection con1;
+# ADD FOREIGN KEY is not supported in-place
+--error ER_NOT_SUPPORTED_YET
+ALTER TABLE t1 ADD FOREIGN KEY(c2) REFERENCES t1(c2), ALGORITHM=INPLACE;
+# The previous DEBUG_SYNC should be ignored, because an exclusive lock
+# has been requested and the online log is not being allocated.
+ALTER TABLE t1 ADD UNIQUE INDEX(c2), LOCK=EXCLUSIVE, ALGORITHM=INPLACE;
+DROP INDEX c2 ON t1;
# Now the previous DEBUG_SYNC should kick in.
--send
ALTER TABLE t1 ADD UNIQUE INDEX(c2);
=== modified file 'storage/innobase/handler/handler0alter.cc'
--- a/storage/innobase/handler/handler0alter.cc revid:yasufumi.kinoshita@stripped441-d53jyqlnq3ibv8x2
+++ b/storage/innobase/handler/handler0alter.cc revid:marko.makela@strippeduwc8m0vjr6d2c2o3
@@ -1428,6 +1428,9 @@ prepare_inplace_alter_table_dict(
the data dictionary will be locked in crash recovery. */
trx_set_dict_operation(trx, TRX_DICT_OP_INDEX);
+ const bool exclusive = ha_alter_info->alter_info->requested_lock
+ == Alter_info::ALTER_TABLE_LOCK_EXCLUSIVE;
+
/* Acquire a lock on the table before creating any indexes. */
if (new_clustered) {
error = row_merge_lock_table(
@@ -1658,7 +1661,7 @@ col_fail:
requested, allocate a modification log. If the table
will be exclusively locked anyway, the modification
log is unnecessary. */
- if (!num_fts_index
+ if (!exclusive && !num_fts_index
&& !(ha_alter_info->handler_flags
& ~INNOBASE_ONLINE_OPERATIONS)) {
DBUG_EXECUTE_IF("innodb_OOM_prepare_inplace_alter",
@@ -1772,7 +1775,7 @@ error_handling:
add_index, add_key_nums, n_add_index,
drop_index, n_drop_index,
drop_foreign, n_drop_foreign,
- !new_clustered && !num_fts_index,
+ !exclusive && !new_clustered && !num_fts_index,
heap, trx, indexed_table);
DBUG_RETURN(false);
case DB_TABLESPACE_EXISTS:
@@ -2112,11 +2115,14 @@ index_needed:
if (!(ha_alter_info->handler_flags & INNOBASE_INPLACE_CREATE)) {
if (heap) {
+ const bool exclusive
+ = ha_alter_info->alter_info->requested_lock
+ == Alter_info::ALTER_TABLE_LOCK_EXCLUSIVE;
ha_alter_info->handler_ctx
= new ha_innobase_inplace_ctx(
NULL, NULL, 0,
drop_index, n_drop_index,
- drop_fk, n_drop_fk, true,
+ drop_fk, n_drop_fk, !exclusive,
heap, NULL, indexed_table);
}
No bundle (reason: useless for push emails).| Thread |
|---|
| • bzr push into mysql-trunk-wl5522 branch (marko.makela:3865 to 3866) | marko.makela | 10 Apr |