summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-11-21 18:59:30 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2017-11-21 18:59:30 +0200
commit366bb162fe8fad1ede6aec7c0d6166dff27fe07c (patch)
tree4551914298838b8d4cbfa6c9d19d57189981ec33
parent563f1d894bc8c2852f53be8503bce469ede4cbc0 (diff)
parent375caf99c494a4add7d48d5db3a3ec4b409a256e (diff)
downloadmariadb-git-366bb162fe8fad1ede6aec7c0d6166dff27fe07c.tar.gz
Merge 10.2 into bb-10.2-ext
-rw-r--r--mysql-test/suite/innodb/include/innodb_bulk_create_index.inc185
-rw-r--r--mysql-test/suite/innodb/include/innodb_bulk_create_index_debug.inc221
-rw-r--r--mysql-test/suite/innodb/r/innodb_bulk_create_index.result1037
-rw-r--r--mysql-test/suite/innodb/r/innodb_bulk_create_index_debug.result485
-rw-r--r--mysql-test/suite/innodb/r/innodb_bulk_create_index_flush.result54
-rw-r--r--mysql-test/suite/innodb/r/innodb_bulk_create_index_replication.result222
-rw-r--r--mysql-test/suite/innodb/r/innodb_bulk_create_index_small.result139
-rw-r--r--mysql-test/suite/innodb/r/truncate_restart.result13
-rw-r--r--mysql-test/suite/innodb/t/innodb_bulk_create_index.test46
-rw-r--r--mysql-test/suite/innodb/t/innodb_bulk_create_index_debug.test23
-rw-r--r--mysql-test/suite/innodb/t/innodb_bulk_create_index_flush.test75
-rw-r--r--mysql-test/suite/innodb/t/innodb_bulk_create_index_replication.test182
-rw-r--r--mysql-test/suite/innodb/t/innodb_bulk_create_index_small.test148
-rw-r--r--mysql-test/suite/innodb/t/truncate_restart.test18
-rw-r--r--storage/innobase/buf/buf0flu.cc8
-rw-r--r--storage/innobase/buf/buf0lru.cc122
-rw-r--r--storage/innobase/dict/dict0stats.cc5
-rw-r--r--storage/innobase/fil/fil0fil.cc5
-rw-r--r--storage/innobase/include/buf0flu.h11
-rw-r--r--storage/innobase/include/buf0lru.h8
-rw-r--r--storage/innobase/row/row0import.cc15
-rw-r--r--storage/innobase/row/row0merge.cc2
-rw-r--r--storage/innobase/row/row0quiesce.cc5
-rw-r--r--storage/innobase/srv/srv0start.cc11
24 files changed, 2942 insertions, 98 deletions
diff --git a/mysql-test/suite/innodb/include/innodb_bulk_create_index.inc b/mysql-test/suite/innodb/include/innodb_bulk_create_index.inc
new file mode 100644
index 00000000000..3c10517933f
--- /dev/null
+++ b/mysql-test/suite/innodb/include/innodb_bulk_create_index.inc
@@ -0,0 +1,185 @@
+#
+# wl#7277: InnoDB: Bulk Load for Create Index
+#
+
+# Create Insert Procedure
+DELIMITER |;
+CREATE PROCEDURE populate_t1(load_even INT)
+BEGIN
+ DECLARE i int DEFAULT 1;
+
+ START TRANSACTION;
+ WHILE (i <= 10000) DO
+ IF i%2 = 0 AND load_even = 1 THEN
+ INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+ END IF;
+ IF i%2 != 0 AND load_even != 1 THEN
+ INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+ END IF;
+ SET i = i + 1;
+ END WHILE;
+ COMMIT;
+END|
+DELIMITER ;|
+
+SELECT @@innodb_fill_factor;
+
+if ($row_format != 'COMPRESSED')
+{
+ eval CREATE TABLE t1(
+ class INT,
+ id INT,
+ title VARCHAR(100)
+ ) ENGINE=InnoDB ROW_FORMAT=$row_format;
+}
+
+if ($row_format == 'COMPRESSED')
+{
+ SET GLOBAL innodb_file_per_table=1;
+
+ eval CREATE TABLE t1(
+ class INT,
+ id INT,
+ title VARCHAR(100)
+ ) ENGINE=InnoDB ROW_FORMAT=$row_format KEY_BLOCK_SIZE=4;
+}
+
+-- disable_query_log
+# Load half records
+CALL populate_t1(1);
+-- enable_query_log
+
+SELECT COUNT(*) FROM t1;
+
+/* Create index. */
+CREATE INDEX idx_id ON t1(id);
+
+CREATE INDEX idx_title ON t1(title);
+
+/* Check table. */
+CHECK TABLE t1;
+
+/* Select by index. */
+EXPLAIN SELECT * FROM t1 WHERE id = 10;
+EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
+
+SELECT * FROM t1 WHERE id = 10;
+SELECT * FROM t1 WHERE title = 'a10';
+
+SELECT * FROM t1 WHERE id = 5000;
+SELECT * FROM t1 WHERE title = 'a5000';
+
+SELECT * FROM t1 WHERE id = 10000;
+SELECT * FROM t1 WHERE title = 'a10000';
+
+SELECT * FROM t1 WHERE id = 10010;
+SELECT * FROM t1 WHERE title = 'a10010';
+
+/*Insert/Update/Delete. */
+DELETE FROM t1 WHERE id < 4010 AND id > 3990;
+INSERT INTO t1 VALUES(4000, 4000, 'b4000');
+UPDATE t1 SET title = CONCAT('b', id) WHERE id < 3010 AND id > 2990;
+
+SELECT * FROM t1 WHERE id = 3000;
+SELECT * FROM t1 WHERE title = 'a3000';
+SELECT * FROM t1 WHERE title = 'b3000';
+
+SELECT * FROM t1 WHERE id = 4000;
+SELECT * FROM t1 WHERE title = 'a4000';
+SELECT * FROM t1 WHERE title = 'b4000';
+
+SELECT * FROM t1 WHERE id = 4001;
+SELECT * FROM t1 WHERE title = 'a4001';
+
+-- disable_query_log
+# Load half records (follow up load)
+CALL populate_t1(0);
+-- enable_query_log
+SELECT COUNT(*) FROM t1;
+
+
+/* Add column. */
+ALTER TABLE t1 ADD COLUMN content TEXT;
+
+CHECK TABLE t1;
+
+SELECT * FROM t1 WHERE id = 10;
+SELECT * FROM t1 WHERE title = 'a10';
+
+SELECT * FROM t1 WHERE id = 5000;
+SELECT * FROM t1 WHERE title = 'a5000';
+
+SELECT * FROM t1 WHERE id = 10000;
+SELECT * FROM t1 WHERE title = 'a10000';
+
+SELECT * FROM t1 WHERE id = 10010;
+SELECT * FROM t1 WHERE title = 'a10010';
+
+/* Drop column. */
+ALTER TABLE t1 DROP COLUMN content;
+
+CHECK TABLE t1;
+
+SELECT * FROM t1 WHERE id = 10;
+SELECT * FROM t1 WHERE title = 'a10';
+
+SELECT * FROM t1 WHERE id = 5000;
+SELECT * FROM t1 WHERE title = 'a5000';
+
+SELECT * FROM t1 WHERE id = 10000;
+SELECT * FROM t1 WHERE title = 'a10000';
+
+SELECT * FROM t1 WHERE id = 10010;
+SELECT * FROM t1 WHERE title = 'a10010';
+
+DROP TABLE t1;
+
+# Test Blob
+if ($row_format != 'COMPRESSED') {
+ eval CREATE TABLE t1(
+ a INT PRIMARY KEY,
+ b TEXT,
+ c TEXT) ENGINE=InnoDB ROW_FORMAT=$row_format;
+}
+
+if ($row_format == 'COMPRESSED') {
+ eval CREATE TABLE t1(
+ a INT PRIMARY KEY,
+ b BLOB,
+ c TEXT) ENGINE=InnoDB ROW_FORMAT=$row_format KEY_BLOCK_SIZE=4;
+}
+
+let $cnt= 5000;
+-- disable_query_log
+WHILE ($cnt>=4950)
+{
+EVAL INSERT INTO t1 VALUES
+ ($cnt, REPEAT(CONCAT('a', $cnt),2000), CONCAT('a', $cnt));
+dec $cnt;
+}
+-- enable_query_log
+ALTER TABLE t1 ADD INDEX `idx` (a,b(5));
+
+SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
+SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%';
+UPDATE t1 SET b = REPEAT(CONCAT('b',4975),2000) WHERE a=4975 AND b like 'a4975%';
+SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%';
+SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%';
+DELETE FROM t1 WHERE a=4975 AND b like 'b4975%';
+SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%';
+
+ALTER TABLE t1 DROP COLUMN c;
+
+CHECK TABLE t1;
+
+SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
+
+DROP TABLE t1;
+
+# Restore global variables
+if ($row_format == 'COMPRESSED')
+{
+ SET GLOBAL innodb_file_per_table=default;
+}
+
+DROP PROCEDURE populate_t1;
diff --git a/mysql-test/suite/innodb/include/innodb_bulk_create_index_debug.inc b/mysql-test/suite/innodb/include/innodb_bulk_create_index_debug.inc
new file mode 100644
index 00000000000..48de3a1962d
--- /dev/null
+++ b/mysql-test/suite/innodb/include/innodb_bulk_create_index_debug.inc
@@ -0,0 +1,221 @@
+#
+# wl#7277: InnoDB: Bulk Load for Create Index
+#
+
+# Not supported in embedded
+-- source include/not_embedded.inc
+
+# This test case needs to crash the server. Needs a debug server.
+-- source include/have_debug.inc
+
+# Don't test this under valgrind, memory leaks will occur.
+-- source include/not_valgrind.inc
+
+# Avoid CrashReporter popup on Mac
+-- source include/not_crashrep.inc
+
+-- source include/have_innodb.inc
+
+# Create Insert Procedure
+DELIMITER |;
+CREATE PROCEDURE populate_t1()
+BEGIN
+ DECLARE i int DEFAULT 1;
+
+ START TRANSACTION;
+ WHILE (i <= 10000) DO
+ INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+ SET i = i + 1;
+ END WHILE;
+ COMMIT;
+END|
+DELIMITER ;|
+
+# Test scenarios:
+# 1. Test restart;
+# 2. Test crash recovery.
+
+# Test Restart
+if ($row_format != 'COMPRESSED')
+{
+ eval CREATE TABLE t1(
+ class INT,
+ id INT,
+ title VARCHAR(100)
+ ) ENGINE=InnoDB ROW_FORMAT=$row_format;
+}
+
+if ($row_format == 'COMPRESSED')
+{
+ SET GLOBAL innodb_file_per_table=1;
+
+ eval CREATE TABLE t1(
+ class INT,
+ id INT,
+ title VARCHAR(100)
+ ) ENGINE=InnoDB ROW_FORMAT=$row_format KEY_BLOCK_SIZE=4;
+}
+
+-- disable_query_log
+CALL populate_t1();
+-- enable_query_log
+
+SELECT COUNT(*) FROM t1;
+
+CREATE INDEX idx_title ON t1(title);
+
+--source include/restart_mysqld.inc
+
+CHECK TABLE t1;
+
+SELECT * FROM t1 WHERE title = 'a10';
+
+SELECT * FROM t1 WHERE title = 'a5000';
+
+SELECT * FROM t1 WHERE title = 'a10000';
+
+SELECT * FROM t1 WHERE title = 'a10010';
+
+DROP TABLE t1;
+
+-- echo # Test Blob
+
+if ($row_format != 'COMPRESSED') {
+ eval CREATE TABLE t1(
+ a INT PRIMARY KEY,
+ b TEXT,
+ c TEXT) ENGINE=InnoDB ROW_FORMAT=$row_format;
+}
+
+if ($row_format == 'COMPRESSED') {
+ SET GLOBAL innodb_file_per_table=1;
+
+ eval CREATE TABLE t1(
+ a INT PRIMARY KEY,
+ b TEXT,
+ c TEXT) ENGINE=InnoDB ROW_FORMAT=$row_format KEY_BLOCK_SIZE=4;
+}
+
+INSERT INTO t1 VALUES
+ (1, REPEAT('a',10000), 'a'),
+ (2, REPEAT('b',20000), 'b'),
+ (3, REPEAT('c',40000), 'c'),
+ (4, REPEAT('d',60000), 'd');
+
+SELECT CHAR_LENGTH(b) FROM t1;
+
+ALTER TABLE t1 DROP COLUMN c;
+
+--source include/restart_mysqld.inc
+
+CHECK TABLE t1;
+
+SELECT CHAR_LENGTH(b) FROM t1;
+
+DROP TABLE t1;
+
+# Test Crash Recovery
+
+if ($row_format != 'COMPRESSED')
+{
+ eval CREATE TABLE t1(
+ class INT,
+ id INT,
+ title VARCHAR(100)
+ ) ENGINE=InnoDB ROW_FORMAT=$row_format;
+}
+
+if ($row_format == 'COMPRESSED')
+{
+ SET GLOBAL innodb_file_per_table=1;
+
+ eval CREATE TABLE t1(
+ class INT,
+ id INT,
+ title VARCHAR(100)
+ ) ENGINE=InnoDB ROW_FORMAT=$row_format KEY_BLOCK_SIZE=4;
+}
+
+-- disable_query_log
+CALL populate_t1();
+-- enable_query_log
+
+SET debug_dbug='+d,crash_commit_before';
+
+# Write file to make mysql-test-run.pl start up the server again
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+--error 2013
+CREATE INDEX idx_title ON t1(title);
+
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+--disable_reconnect
+
+SELECT COUNT(*) FROM t1;
+
+CHECK TABLE t1;
+
+EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
+
+SELECT * FROM t1 WHERE title = 'a10';
+
+SELECT * FROM t1 WHERE title = 'a5000';
+
+SELECT * FROM t1 WHERE title = 'a10000';
+
+SELECT * FROM t1 WHERE title = 'a10010';
+
+DROP TABLE t1;
+
+-- echo # Test Blob
+
+if ($row_format != 'COMPRESSED') {
+ eval CREATE TABLE t1(
+ a INT PRIMARY KEY,
+ b TEXT,
+ c TEXT) ENGINE=InnoDB ROW_FORMAT=$row_format;
+}
+
+if ($row_format == 'COMPRESSED') {
+ SET GLOBAL innodb_file_per_table=1;
+
+ eval CREATE TABLE t1(
+ a INT PRIMARY KEY,
+ b TEXT,
+ c TEXT) ENGINE=InnoDB ROW_FORMAT=$row_format KEY_BLOCK_SIZE=4;
+}
+
+INSERT INTO t1 VALUES
+ (1, REPEAT('a',10000), 'a'),
+ (2, REPEAT('b',20000), 'b'),
+ (3, REPEAT('c',40000), 'c'),
+ (4, REPEAT('d',60000), 'd');
+
+SELECT CHAR_LENGTH(b) FROM t1;
+
+SET debug_dbug='+d,crash_commit_before';
+
+# Write file to make mysql-test-run.pl start up the server again
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+--error 2013
+ALTER TABLE t1 DROP COLUMN c;
+
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+--disable_reconnect
+
+CHECK TABLE t1;
+
+SELECT CHAR_LENGTH(b) FROM t1;
+
+DROP TABLE t1;
+
+# Restore global variables
+if ($row_format == 'COMPRESSED')
+{
+ SET GLOBAL innodb_file_per_table=default;
+}
+
+DROP PROCEDURE populate_t1;
diff --git a/mysql-test/suite/innodb/r/innodb_bulk_create_index.result b/mysql-test/suite/innodb/r/innodb_bulk_create_index.result
new file mode 100644
index 00000000000..ec7ce044cb7
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_bulk_create_index.result
@@ -0,0 +1,1037 @@
+CREATE PROCEDURE populate_t1(load_even INT)
+BEGIN
+DECLARE i int DEFAULT 1;
+START TRANSACTION;
+WHILE (i <= 10000) DO
+IF i%2 = 0 AND load_even = 1 THEN
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+END IF;
+IF i%2 != 0 AND load_even != 1 THEN
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+END IF;
+SET i = i + 1;
+END WHILE;
+COMMIT;
+END|
+SELECT @@innodb_fill_factor;
+@@innodb_fill_factor
+100
+CREATE TABLE t1(
+class INT,
+id INT,
+title VARCHAR(100)
+) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5000
+/* Create index. */
+CREATE INDEX idx_id ON t1(id);
+CREATE INDEX idx_title ON t1(title);
+/* Check table. */
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+/* Select by index. */
+EXPLAIN SELECT * FROM t1 WHERE id = 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_id idx_id 5 const 1
+EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition
+SELECT * FROM t1 WHERE id = 10;
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE id = 5000;
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE id = 10000;
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE id = 10010;
+class id title
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+/*Insert/Update/Delete. */
+DELETE FROM t1 WHERE id < 4010 AND id > 3990;
+INSERT INTO t1 VALUES(4000, 4000, 'b4000');
+UPDATE t1 SET title = CONCAT('b', id) WHERE id < 3010 AND id > 2990;
+SELECT * FROM t1 WHERE id = 3000;
+class id title
+3000 3000 b3000
+SELECT * FROM t1 WHERE title = 'a3000';
+class id title
+SELECT * FROM t1 WHERE title = 'b3000';
+class id title
+3000 3000 b3000
+SELECT * FROM t1 WHERE id = 4000;
+class id title
+4000 4000 b4000
+SELECT * FROM t1 WHERE title = 'a4000';
+class id title
+SELECT * FROM t1 WHERE title = 'b4000';
+class id title
+4000 4000 b4000
+SELECT * FROM t1 WHERE id = 4001;
+class id title
+SELECT * FROM t1 WHERE title = 'a4001';
+class id title
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+9992
+/* Add column. */
+ALTER TABLE t1 ADD COLUMN content TEXT;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT * FROM t1 WHERE id = 10;
+class id title content
+10 10 a10 NULL
+SELECT * FROM t1 WHERE title = 'a10';
+class id title content
+10 10 a10 NULL
+SELECT * FROM t1 WHERE id = 5000;
+class id title content
+5000 5000 a5000 NULL
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title content
+5000 5000 a5000 NULL
+SELECT * FROM t1 WHERE id = 10000;
+class id title content
+10000 10000 a10000 NULL
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title content
+10000 10000 a10000 NULL
+SELECT * FROM t1 WHERE id = 10010;
+class id title content
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title content
+/* Drop column. */
+ALTER TABLE t1 DROP COLUMN content;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT * FROM t1 WHERE id = 10;
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE id = 5000;
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE id = 10000;
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE id = 10010;
+class id title
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+DROP TABLE t1;
+CREATE TABLE t1(
+a INT PRIMARY KEY,
+b TEXT,
+c TEXT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+ALTER TABLE t1 ADD INDEX `idx` (a,b(5));
+SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
+CHAR_LENGTH(b)
+10000
+SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%';
+b=REPEAT(CONCAT('a',4975),2000)
+1
+UPDATE t1 SET b = REPEAT(CONCAT('b',4975),2000) WHERE a=4975 AND b like 'a4975%';
+SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%';
+b=REPEAT(CONCAT('a',4975),2000)
+SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%';
+b=REPEAT(CONCAT('b',4975),2000)
+1
+DELETE FROM t1 WHERE a=4975 AND b like 'b4975%';
+SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%';
+b=REPEAT(CONCAT('b',4975),2000)
+ALTER TABLE t1 DROP COLUMN c;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
+CHAR_LENGTH(b)
+DROP TABLE t1;
+DROP PROCEDURE populate_t1;
+CREATE PROCEDURE populate_t1(load_even INT)
+BEGIN
+DECLARE i int DEFAULT 1;
+START TRANSACTION;
+WHILE (i <= 10000) DO
+IF i%2 = 0 AND load_even = 1 THEN
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+END IF;
+IF i%2 != 0 AND load_even != 1 THEN
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+END IF;
+SET i = i + 1;
+END WHILE;
+COMMIT;
+END|
+SELECT @@innodb_fill_factor;
+@@innodb_fill_factor
+100
+CREATE TABLE t1(
+class INT,
+id INT,
+title VARCHAR(100)
+) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5000
+/* Create index. */
+CREATE INDEX idx_id ON t1(id);
+CREATE INDEX idx_title ON t1(title);
+/* Check table. */
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+/* Select by index. */
+EXPLAIN SELECT * FROM t1 WHERE id = 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_id idx_id 5 const 1
+EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition
+SELECT * FROM t1 WHERE id = 10;
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE id = 5000;
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE id = 10000;
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE id = 10010;
+class id title
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+/*Insert/Update/Delete. */
+DELETE FROM t1 WHERE id < 4010 AND id > 3990;
+INSERT INTO t1 VALUES(4000, 4000, 'b4000');
+UPDATE t1 SET title = CONCAT('b', id) WHERE id < 3010 AND id > 2990;
+SELECT * FROM t1 WHERE id = 3000;
+class id title
+3000 3000 b3000
+SELECT * FROM t1 WHERE title = 'a3000';
+class id title
+SELECT * FROM t1 WHERE title = 'b3000';
+class id title
+3000 3000 b3000
+SELECT * FROM t1 WHERE id = 4000;
+class id title
+4000 4000 b4000
+SELECT * FROM t1 WHERE title = 'a4000';
+class id title
+SELECT * FROM t1 WHERE title = 'b4000';
+class id title
+4000 4000 b4000
+SELECT * FROM t1 WHERE id = 4001;
+class id title
+SELECT * FROM t1 WHERE title = 'a4001';
+class id title
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+9992
+/* Add column. */
+ALTER TABLE t1 ADD COLUMN content TEXT;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT * FROM t1 WHERE id = 10;
+class id title content
+10 10 a10 NULL
+SELECT * FROM t1 WHERE title = 'a10';
+class id title content
+10 10 a10 NULL
+SELECT * FROM t1 WHERE id = 5000;
+class id title content
+5000 5000 a5000 NULL
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title content
+5000 5000 a5000 NULL
+SELECT * FROM t1 WHERE id = 10000;
+class id title content
+10000 10000 a10000 NULL
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title content
+10000 10000 a10000 NULL
+SELECT * FROM t1 WHERE id = 10010;
+class id title content
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title content
+/* Drop column. */
+ALTER TABLE t1 DROP COLUMN content;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT * FROM t1 WHERE id = 10;
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE id = 5000;
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE id = 10000;
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE id = 10010;
+class id title
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+DROP TABLE t1;
+CREATE TABLE t1(
+a INT PRIMARY KEY,
+b TEXT,
+c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+ALTER TABLE t1 ADD INDEX `idx` (a,b(5));
+SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
+CHAR_LENGTH(b)
+10000
+SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%';
+b=REPEAT(CONCAT('a',4975),2000)
+1
+UPDATE t1 SET b = REPEAT(CONCAT('b',4975),2000) WHERE a=4975 AND b like 'a4975%';
+SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%';
+b=REPEAT(CONCAT('a',4975),2000)
+SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%';
+b=REPEAT(CONCAT('b',4975),2000)
+1
+DELETE FROM t1 WHERE a=4975 AND b like 'b4975%';
+SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%';
+b=REPEAT(CONCAT('b',4975),2000)
+ALTER TABLE t1 DROP COLUMN c;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
+CHAR_LENGTH(b)
+DROP TABLE t1;
+DROP PROCEDURE populate_t1;
+CREATE PROCEDURE populate_t1(load_even INT)
+BEGIN
+DECLARE i int DEFAULT 1;
+START TRANSACTION;
+WHILE (i <= 10000) DO
+IF i%2 = 0 AND load_even = 1 THEN
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+END IF;
+IF i%2 != 0 AND load_even != 1 THEN
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+END IF;
+SET i = i + 1;
+END WHILE;
+COMMIT;
+END|
+SELECT @@innodb_fill_factor;
+@@innodb_fill_factor
+100
+CREATE TABLE t1(
+class INT,
+id INT,
+title VARCHAR(100)
+) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5000
+/* Create index. */
+CREATE INDEX idx_id ON t1(id);
+CREATE INDEX idx_title ON t1(title);
+/* Check table. */
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+/* Select by index. */
+EXPLAIN SELECT * FROM t1 WHERE id = 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_id idx_id 5 const 1
+EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition
+SELECT * FROM t1 WHERE id = 10;
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE id = 5000;
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE id = 10000;
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE id = 10010;
+class id title
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+/*Insert/Update/Delete. */
+DELETE FROM t1 WHERE id < 4010 AND id > 3990;
+INSERT INTO t1 VALUES(4000, 4000, 'b4000');
+UPDATE t1 SET title = CONCAT('b', id) WHERE id < 3010 AND id > 2990;
+SELECT * FROM t1 WHERE id = 3000;
+class id title
+3000 3000 b3000
+SELECT * FROM t1 WHERE title = 'a3000';
+class id title
+SELECT * FROM t1 WHERE title = 'b3000';
+class id title
+3000 3000 b3000
+SELECT * FROM t1 WHERE id = 4000;
+class id title
+4000 4000 b4000
+SELECT * FROM t1 WHERE title = 'a4000';
+class id title
+SELECT * FROM t1 WHERE title = 'b4000';
+class id title
+4000 4000 b4000
+SELECT * FROM t1 WHERE id = 4001;
+class id title
+SELECT * FROM t1 WHERE title = 'a4001';
+class id title
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+9992
+/* Add column. */
+ALTER TABLE t1 ADD COLUMN content TEXT;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT * FROM t1 WHERE id = 10;
+class id title content
+10 10 a10 NULL
+SELECT * FROM t1 WHERE title = 'a10';
+class id title content
+10 10 a10 NULL
+SELECT * FROM t1 WHERE id = 5000;
+class id title content
+5000 5000 a5000 NULL
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title content
+5000 5000 a5000 NULL
+SELECT * FROM t1 WHERE id = 10000;
+class id title content
+10000 10000 a10000 NULL
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title content
+10000 10000 a10000 NULL
+SELECT * FROM t1 WHERE id = 10010;
+class id title content
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title content
+/* Drop column. */
+ALTER TABLE t1 DROP COLUMN content;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT * FROM t1 WHERE id = 10;
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE id = 5000;
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE id = 10000;
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE id = 10010;
+class id title
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+DROP TABLE t1;
+CREATE TABLE t1(
+a INT PRIMARY KEY,
+b TEXT,
+c TEXT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+ALTER TABLE t1 ADD INDEX `idx` (a,b(5));
+SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
+CHAR_LENGTH(b)
+10000
+SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%';
+b=REPEAT(CONCAT('a',4975),2000)
+1
+UPDATE t1 SET b = REPEAT(CONCAT('b',4975),2000) WHERE a=4975 AND b like 'a4975%';
+SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%';
+b=REPEAT(CONCAT('a',4975),2000)
+SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%';
+b=REPEAT(CONCAT('b',4975),2000)
+1
+DELETE FROM t1 WHERE a=4975 AND b like 'b4975%';
+SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%';
+b=REPEAT(CONCAT('b',4975),2000)
+ALTER TABLE t1 DROP COLUMN c;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
+CHAR_LENGTH(b)
+DROP TABLE t1;
+DROP PROCEDURE populate_t1;
+CREATE PROCEDURE populate_t1(load_even INT)
+BEGIN
+DECLARE i int DEFAULT 1;
+START TRANSACTION;
+WHILE (i <= 10000) DO
+IF i%2 = 0 AND load_even = 1 THEN
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+END IF;
+IF i%2 != 0 AND load_even != 1 THEN
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+END IF;
+SET i = i + 1;
+END WHILE;
+COMMIT;
+END|
+SELECT @@innodb_fill_factor;
+@@innodb_fill_factor
+100
+SET GLOBAL innodb_file_per_table=1;
+CREATE TABLE t1(
+class INT,
+id INT,
+title VARCHAR(100)
+) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5000
+/* Create index. */
+CREATE INDEX idx_id ON t1(id);
+CREATE INDEX idx_title ON t1(title);
+/* Check table. */
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+/* Select by index. */
+EXPLAIN SELECT * FROM t1 WHERE id = 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_id idx_id 5 const 1
+EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition
+SELECT * FROM t1 WHERE id = 10;
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE id = 5000;
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE id = 10000;
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE id = 10010;
+class id title
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+/*Insert/Update/Delete. */
+DELETE FROM t1 WHERE id < 4010 AND id > 3990;
+INSERT INTO t1 VALUES(4000, 4000, 'b4000');
+UPDATE t1 SET title = CONCAT('b', id) WHERE id < 3010 AND id > 2990;
+SELECT * FROM t1 WHERE id = 3000;
+class id title
+3000 3000 b3000
+SELECT * FROM t1 WHERE title = 'a3000';
+class id title
+SELECT * FROM t1 WHERE title = 'b3000';
+class id title
+3000 3000 b3000
+SELECT * FROM t1 WHERE id = 4000;
+class id title
+4000 4000 b4000
+SELECT * FROM t1 WHERE title = 'a4000';
+class id title
+SELECT * FROM t1 WHERE title = 'b4000';
+class id title
+4000 4000 b4000
+SELECT * FROM t1 WHERE id = 4001;
+class id title
+SELECT * FROM t1 WHERE title = 'a4001';
+class id title
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+9992
+/* Add column. */
+ALTER TABLE t1 ADD COLUMN content TEXT;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT * FROM t1 WHERE id = 10;
+class id title content
+10 10 a10 NULL
+SELECT * FROM t1 WHERE title = 'a10';
+class id title content
+10 10 a10 NULL
+SELECT * FROM t1 WHERE id = 5000;
+class id title content
+5000 5000 a5000 NULL
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title content
+5000 5000 a5000 NULL
+SELECT * FROM t1 WHERE id = 10000;
+class id title content
+10000 10000 a10000 NULL
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title content
+10000 10000 a10000 NULL
+SELECT * FROM t1 WHERE id = 10010;
+class id title content
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title content
+/* Drop column. */
+ALTER TABLE t1 DROP COLUMN content;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT * FROM t1 WHERE id = 10;
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE id = 5000;
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE id = 10000;
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE id = 10010;
+class id title
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+DROP TABLE t1;
+CREATE TABLE t1(
+a INT PRIMARY KEY,
+b BLOB,
+c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
+ALTER TABLE t1 ADD INDEX `idx` (a,b(5));
+SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
+CHAR_LENGTH(b)
+10000
+SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%';
+b=REPEAT(CONCAT('a',4975),2000)
+1
+UPDATE t1 SET b = REPEAT(CONCAT('b',4975),2000) WHERE a=4975 AND b like 'a4975%';
+SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%';
+b=REPEAT(CONCAT('a',4975),2000)
+SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%';
+b=REPEAT(CONCAT('b',4975),2000)
+1
+DELETE FROM t1 WHERE a=4975 AND b like 'b4975%';
+SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%';
+b=REPEAT(CONCAT('b',4975),2000)
+ALTER TABLE t1 DROP COLUMN c;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
+CHAR_LENGTH(b)
+DROP TABLE t1;
+SET GLOBAL innodb_file_per_table=default;
+DROP PROCEDURE populate_t1;
+SET GLOBAL innodb_fill_factor=10;
+CREATE PROCEDURE populate_t1(load_even INT)
+BEGIN
+DECLARE i int DEFAULT 1;
+START TRANSACTION;
+WHILE (i <= 10000) DO
+IF i%2 = 0 AND load_even = 1 THEN
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+END IF;
+IF i%2 != 0 AND load_even != 1 THEN
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+END IF;
+SET i = i + 1;
+END WHILE;
+COMMIT;
+END|
+SELECT @@innodb_fill_factor;
+@@innodb_fill_factor
+10
+CREATE TABLE t1(
+class INT,
+id INT,
+title VARCHAR(100)
+) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5000
+/* Create index. */
+CREATE INDEX idx_id ON t1(id);
+CREATE INDEX idx_title ON t1(title);
+/* Check table. */
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+/* Select by index. */
+EXPLAIN SELECT * FROM t1 WHERE id = 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_id idx_id 5 const 1
+EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition
+SELECT * FROM t1 WHERE id = 10;
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE id = 5000;
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE id = 10000;
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE id = 10010;
+class id title
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+/*Insert/Update/Delete. */
+DELETE FROM t1 WHERE id < 4010 AND id > 3990;
+INSERT INTO t1 VALUES(4000, 4000, 'b4000');
+UPDATE t1 SET title = CONCAT('b', id) WHERE id < 3010 AND id > 2990;
+SELECT * FROM t1 WHERE id = 3000;
+class id title
+3000 3000 b3000
+SELECT * FROM t1 WHERE title = 'a3000';
+class id title
+SELECT * FROM t1 WHERE title = 'b3000';
+class id title
+3000 3000 b3000
+SELECT * FROM t1 WHERE id = 4000;
+class id title
+4000 4000 b4000
+SELECT * FROM t1 WHERE title = 'a4000';
+class id title
+SELECT * FROM t1 WHERE title = 'b4000';
+class id title
+4000 4000 b4000
+SELECT * FROM t1 WHERE id = 4001;
+class id title
+SELECT * FROM t1 WHERE title = 'a4001';
+class id title
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+9992
+/* Add column. */
+ALTER TABLE t1 ADD COLUMN content TEXT;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT * FROM t1 WHERE id = 10;
+class id title content
+10 10 a10 NULL
+SELECT * FROM t1 WHERE title = 'a10';
+class id title content
+10 10 a10 NULL
+SELECT * FROM t1 WHERE id = 5000;
+class id title content
+5000 5000 a5000 NULL
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title content
+5000 5000 a5000 NULL
+SELECT * FROM t1 WHERE id = 10000;
+class id title content
+10000 10000 a10000 NULL
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title content
+10000 10000 a10000 NULL
+SELECT * FROM t1 WHERE id = 10010;
+class id title content
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title content
+/* Drop column. */
+ALTER TABLE t1 DROP COLUMN content;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT * FROM t1 WHERE id = 10;
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE id = 5000;
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE id = 10000;
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE id = 10010;
+class id title
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+DROP TABLE t1;
+CREATE TABLE t1(
+a INT PRIMARY KEY,
+b TEXT,
+c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+ALTER TABLE t1 ADD INDEX `idx` (a,b(5));
+SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
+CHAR_LENGTH(b)
+10000
+SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%';
+b=REPEAT(CONCAT('a',4975),2000)
+1
+UPDATE t1 SET b = REPEAT(CONCAT('b',4975),2000) WHERE a=4975 AND b like 'a4975%';
+SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%';
+b=REPEAT(CONCAT('a',4975),2000)
+SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%';
+b=REPEAT(CONCAT('b',4975),2000)
+1
+DELETE FROM t1 WHERE a=4975 AND b like 'b4975%';
+SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%';
+b=REPEAT(CONCAT('b',4975),2000)
+ALTER TABLE t1 DROP COLUMN c;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
+CHAR_LENGTH(b)
+DROP TABLE t1;
+DROP PROCEDURE populate_t1;
+SET GLOBAL innodb_fill_factor=50;
+CREATE PROCEDURE populate_t1(load_even INT)
+BEGIN
+DECLARE i int DEFAULT 1;
+START TRANSACTION;
+WHILE (i <= 10000) DO
+IF i%2 = 0 AND load_even = 1 THEN
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+END IF;
+IF i%2 != 0 AND load_even != 1 THEN
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+END IF;
+SET i = i + 1;
+END WHILE;
+COMMIT;
+END|
+SELECT @@innodb_fill_factor;
+@@innodb_fill_factor
+50
+CREATE TABLE t1(
+class INT,
+id INT,
+title VARCHAR(100)
+) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5000
+/* Create index. */
+CREATE INDEX idx_id ON t1(id);
+CREATE INDEX idx_title ON t1(title);
+/* Check table. */
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+/* Select by index. */
+EXPLAIN SELECT * FROM t1 WHERE id = 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_id idx_id 5 const 1
+EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition
+SELECT * FROM t1 WHERE id = 10;
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE id = 5000;
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE id = 10000;
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE id = 10010;
+class id title
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+/*Insert/Update/Delete. */
+DELETE FROM t1 WHERE id < 4010 AND id > 3990;
+INSERT INTO t1 VALUES(4000, 4000, 'b4000');
+UPDATE t1 SET title = CONCAT('b', id) WHERE id < 3010 AND id > 2990;
+SELECT * FROM t1 WHERE id = 3000;
+class id title
+3000 3000 b3000
+SELECT * FROM t1 WHERE title = 'a3000';
+class id title
+SELECT * FROM t1 WHERE title = 'b3000';
+class id title
+3000 3000 b3000
+SELECT * FROM t1 WHERE id = 4000;
+class id title
+4000 4000 b4000
+SELECT * FROM t1 WHERE title = 'a4000';
+class id title
+SELECT * FROM t1 WHERE title = 'b4000';
+class id title
+4000 4000 b4000
+SELECT * FROM t1 WHERE id = 4001;
+class id title
+SELECT * FROM t1 WHERE title = 'a4001';
+class id title
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+9992
+/* Add column. */
+ALTER TABLE t1 ADD COLUMN content TEXT;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT * FROM t1 WHERE id = 10;
+class id title content
+10 10 a10 NULL
+SELECT * FROM t1 WHERE title = 'a10';
+class id title content
+10 10 a10 NULL
+SELECT * FROM t1 WHERE id = 5000;
+class id title content
+5000 5000 a5000 NULL
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title content
+5000 5000 a5000 NULL
+SELECT * FROM t1 WHERE id = 10000;
+class id title content
+10000 10000 a10000 NULL
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title content
+10000 10000 a10000 NULL
+SELECT * FROM t1 WHERE id = 10010;
+class id title content
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title content
+/* Drop column. */
+ALTER TABLE t1 DROP COLUMN content;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT * FROM t1 WHERE id = 10;
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE id = 5000;
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE id = 10000;
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE id = 10010;
+class id title
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+DROP TABLE t1;
+CREATE TABLE t1(
+a INT PRIMARY KEY,
+b TEXT,
+c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+ALTER TABLE t1 ADD INDEX `idx` (a,b(5));
+SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
+CHAR_LENGTH(b)
+10000
+SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%';
+b=REPEAT(CONCAT('a',4975),2000)
+1
+UPDATE t1 SET b = REPEAT(CONCAT('b',4975),2000) WHERE a=4975 AND b like 'a4975%';
+SELECT b=REPEAT(CONCAT('a',4975),2000) FROM t1 WHERE a=4975 AND b like 'a4975%';
+b=REPEAT(CONCAT('a',4975),2000)
+SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%';
+b=REPEAT(CONCAT('b',4975),2000)
+1
+DELETE FROM t1 WHERE a=4975 AND b like 'b4975%';
+SELECT b=REPEAT(CONCAT('b',4975),2000) FROM t1 WHERE a=4975 AND b like 'b4975%';
+b=REPEAT(CONCAT('b',4975),2000)
+ALTER TABLE t1 DROP COLUMN c;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
+CHAR_LENGTH(b)
+DROP TABLE t1;
+DROP PROCEDURE populate_t1;
+SET GLOBAL innodb_fill_factor=default;
diff --git a/mysql-test/suite/innodb/r/innodb_bulk_create_index_debug.result b/mysql-test/suite/innodb/r/innodb_bulk_create_index_debug.result
new file mode 100644
index 00000000000..cd5a3c340da
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_bulk_create_index_debug.result
@@ -0,0 +1,485 @@
+CREATE PROCEDURE populate_t1()
+BEGIN
+DECLARE i int DEFAULT 1;
+START TRANSACTION;
+WHILE (i <= 10000) DO
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+SET i = i + 1;
+END WHILE;
+COMMIT;
+END|
+CREATE TABLE t1(
+class INT,
+id INT,
+title VARCHAR(100)
+) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+10000
+CREATE INDEX idx_title ON t1(title);
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+DROP TABLE t1;
+# Test Blob
+CREATE TABLE t1(
+a INT PRIMARY KEY,
+b TEXT,
+c TEXT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+INSERT INTO t1 VALUES
+(1, REPEAT('a',10000), 'a'),
+(2, REPEAT('b',20000), 'b'),
+(3, REPEAT('c',40000), 'c'),
+(4, REPEAT('d',60000), 'd');
+SELECT CHAR_LENGTH(b) FROM t1;
+CHAR_LENGTH(b)
+10000
+20000
+40000
+60000
+ALTER TABLE t1 DROP COLUMN c;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT CHAR_LENGTH(b) FROM t1;
+CHAR_LENGTH(b)
+10000
+20000
+40000
+60000
+DROP TABLE t1;
+CREATE TABLE t1(
+class INT,
+id INT,
+title VARCHAR(100)
+) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+SET debug_dbug='+d,crash_commit_before';
+CREATE INDEX idx_title ON t1(title);
+ERROR HY000: Lost connection to MySQL server during query
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+10000
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+DROP TABLE t1;
+# Test Blob
+CREATE TABLE t1(
+a INT PRIMARY KEY,
+b TEXT,
+c TEXT) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+INSERT INTO t1 VALUES
+(1, REPEAT('a',10000), 'a'),
+(2, REPEAT('b',20000), 'b'),
+(3, REPEAT('c',40000), 'c'),
+(4, REPEAT('d',60000), 'd');
+SELECT CHAR_LENGTH(b) FROM t1;
+CHAR_LENGTH(b)
+10000
+20000
+40000
+60000
+SET debug_dbug='+d,crash_commit_before';
+ALTER TABLE t1 DROP COLUMN c;
+ERROR HY000: Lost connection to MySQL server during query
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT CHAR_LENGTH(b) FROM t1;
+CHAR_LENGTH(b)
+10000
+20000
+40000
+60000
+DROP TABLE t1;
+DROP PROCEDURE populate_t1;
+CREATE PROCEDURE populate_t1()
+BEGIN
+DECLARE i int DEFAULT 1;
+START TRANSACTION;
+WHILE (i <= 10000) DO
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+SET i = i + 1;
+END WHILE;
+COMMIT;
+END|
+CREATE TABLE t1(
+class INT,
+id INT,
+title VARCHAR(100)
+) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+10000
+CREATE INDEX idx_title ON t1(title);
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+DROP TABLE t1;
+# Test Blob
+CREATE TABLE t1(
+a INT PRIMARY KEY,
+b TEXT,
+c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+INSERT INTO t1 VALUES
+(1, REPEAT('a',10000), 'a'),
+(2, REPEAT('b',20000), 'b'),
+(3, REPEAT('c',40000), 'c'),
+(4, REPEAT('d',60000), 'd');
+SELECT CHAR_LENGTH(b) FROM t1;
+CHAR_LENGTH(b)
+10000
+20000
+40000
+60000
+ALTER TABLE t1 DROP COLUMN c;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT CHAR_LENGTH(b) FROM t1;
+CHAR_LENGTH(b)
+10000
+20000
+40000
+60000
+DROP TABLE t1;
+CREATE TABLE t1(
+class INT,
+id INT,
+title VARCHAR(100)
+) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+SET debug_dbug='+d,crash_commit_before';
+CREATE INDEX idx_title ON t1(title);
+ERROR HY000: Lost connection to MySQL server during query
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+10000
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+DROP TABLE t1;
+# Test Blob
+CREATE TABLE t1(
+a INT PRIMARY KEY,
+b TEXT,
+c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+INSERT INTO t1 VALUES
+(1, REPEAT('a',10000), 'a'),
+(2, REPEAT('b',20000), 'b'),
+(3, REPEAT('c',40000), 'c'),
+(4, REPEAT('d',60000), 'd');
+SELECT CHAR_LENGTH(b) FROM t1;
+CHAR_LENGTH(b)
+10000
+20000
+40000
+60000
+SET debug_dbug='+d,crash_commit_before';
+ALTER TABLE t1 DROP COLUMN c;
+ERROR HY000: Lost connection to MySQL server during query
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT CHAR_LENGTH(b) FROM t1;
+CHAR_LENGTH(b)
+10000
+20000
+40000
+60000
+DROP TABLE t1;
+DROP PROCEDURE populate_t1;
+CREATE PROCEDURE populate_t1()
+BEGIN
+DECLARE i int DEFAULT 1;
+START TRANSACTION;
+WHILE (i <= 10000) DO
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+SET i = i + 1;
+END WHILE;
+COMMIT;
+END|
+CREATE TABLE t1(
+class INT,
+id INT,
+title VARCHAR(100)
+) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+10000
+CREATE INDEX idx_title ON t1(title);
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+DROP TABLE t1;
+# Test Blob
+CREATE TABLE t1(
+a INT PRIMARY KEY,
+b TEXT,
+c TEXT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+INSERT INTO t1 VALUES
+(1, REPEAT('a',10000), 'a'),
+(2, REPEAT('b',20000), 'b'),
+(3, REPEAT('c',40000), 'c'),
+(4, REPEAT('d',60000), 'd');
+SELECT CHAR_LENGTH(b) FROM t1;
+CHAR_LENGTH(b)
+10000
+20000
+40000
+60000
+ALTER TABLE t1 DROP COLUMN c;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT CHAR_LENGTH(b) FROM t1;
+CHAR_LENGTH(b)
+10000
+20000
+40000
+60000
+DROP TABLE t1;
+CREATE TABLE t1(
+class INT,
+id INT,
+title VARCHAR(100)
+) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+SET debug_dbug='+d,crash_commit_before';
+CREATE INDEX idx_title ON t1(title);
+ERROR HY000: Lost connection to MySQL server during query
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+10000
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+DROP TABLE t1;
+# Test Blob
+CREATE TABLE t1(
+a INT PRIMARY KEY,
+b TEXT,
+c TEXT) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+INSERT INTO t1 VALUES
+(1, REPEAT('a',10000), 'a'),
+(2, REPEAT('b',20000), 'b'),
+(3, REPEAT('c',40000), 'c'),
+(4, REPEAT('d',60000), 'd');
+SELECT CHAR_LENGTH(b) FROM t1;
+CHAR_LENGTH(b)
+10000
+20000
+40000
+60000
+SET debug_dbug='+d,crash_commit_before';
+ALTER TABLE t1 DROP COLUMN c;
+ERROR HY000: Lost connection to MySQL server during query
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT CHAR_LENGTH(b) FROM t1;
+CHAR_LENGTH(b)
+10000
+20000
+40000
+60000
+DROP TABLE t1;
+DROP PROCEDURE populate_t1;
+CREATE PROCEDURE populate_t1()
+BEGIN
+DECLARE i int DEFAULT 1;
+START TRANSACTION;
+WHILE (i <= 10000) DO
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+SET i = i + 1;
+END WHILE;
+COMMIT;
+END|
+SET GLOBAL innodb_file_per_table=1;
+CREATE TABLE t1(
+class INT,
+id INT,
+title VARCHAR(100)
+) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+10000
+CREATE INDEX idx_title ON t1(title);
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+DROP TABLE t1;
+# Test Blob
+SET GLOBAL innodb_file_per_table=1;
+CREATE TABLE t1(
+a INT PRIMARY KEY,
+b TEXT,
+c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
+INSERT INTO t1 VALUES
+(1, REPEAT('a',10000), 'a'),
+(2, REPEAT('b',20000), 'b'),
+(3, REPEAT('c',40000), 'c'),
+(4, REPEAT('d',60000), 'd');
+SELECT CHAR_LENGTH(b) FROM t1;
+CHAR_LENGTH(b)
+10000
+20000
+40000
+60000
+ALTER TABLE t1 DROP COLUMN c;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT CHAR_LENGTH(b) FROM t1;
+CHAR_LENGTH(b)
+10000
+20000
+40000
+60000
+DROP TABLE t1;
+SET GLOBAL innodb_file_per_table=1;
+CREATE TABLE t1(
+class INT,
+id INT,
+title VARCHAR(100)
+) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
+SET debug_dbug='+d,crash_commit_before';
+CREATE INDEX idx_title ON t1(title);
+ERROR HY000: Lost connection to MySQL server during query
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+10000
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a5000';
+class id title
+5000 5000 a5000
+SELECT * FROM t1 WHERE title = 'a10000';
+class id title
+10000 10000 a10000
+SELECT * FROM t1 WHERE title = 'a10010';
+class id title
+DROP TABLE t1;
+# Test Blob
+SET GLOBAL innodb_file_per_table=1;
+CREATE TABLE t1(
+a INT PRIMARY KEY,
+b TEXT,
+c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
+INSERT INTO t1 VALUES
+(1, REPEAT('a',10000), 'a'),
+(2, REPEAT('b',20000), 'b'),
+(3, REPEAT('c',40000), 'c'),
+(4, REPEAT('d',60000), 'd');
+SELECT CHAR_LENGTH(b) FROM t1;
+CHAR_LENGTH(b)
+10000
+20000
+40000
+60000
+SET debug_dbug='+d,crash_commit_before';
+ALTER TABLE t1 DROP COLUMN c;
+ERROR HY000: Lost connection to MySQL server during query
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT CHAR_LENGTH(b) FROM t1;
+CHAR_LENGTH(b)
+10000
+20000
+40000
+60000
+DROP TABLE t1;
+SET GLOBAL innodb_file_per_table=default;
+DROP PROCEDURE populate_t1;
diff --git a/mysql-test/suite/innodb/r/innodb_bulk_create_index_flush.result b/mysql-test/suite/innodb/r/innodb_bulk_create_index_flush.result
new file mode 100644
index 00000000000..c795ee044e6
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_bulk_create_index_flush.result
@@ -0,0 +1,54 @@
+CREATE PROCEDURE populate_t1()
+BEGIN
+DECLARE i int DEFAULT 1;
+START TRANSACTION;
+WHILE (i <= 10000) DO
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+SET i = i + 1;
+END WHILE;
+COMMIT;
+END|
+CREATE TABLE t1(
+class INT,
+id INT,
+title VARCHAR(100)
+) ENGINE=InnoDB;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+10000
+SET @saved_dbug= @@SESSION.debug_dbug;
+SET debug_dbug='+d,ib_index_build_fail_before_flush';
+CREATE INDEX idx_id ON t1(id);
+ERROR 70100: Query execution was interrupted
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+CREATE INDEX idx_title ON t1(title);
+ERROR 70100: Query execution was interrupted
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+CREATE FULLTEXT INDEX fidx_title ON t1(title);
+ERROR 70100: Query execution was interrupted
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+ALTER TABLE t1 ADD COLUMN content TEXT;
+ERROR 70100: Query execution was interrupted
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SET debug_dbug= @saved_dbug;
+INSERT INTO t1 VALUES(10001, 10001, 'a10000');
+ALTER TABLE t1 ADD UNIQUE INDEX idx_title(title);
+ERROR 23000: Duplicate entry 'a10000' for key 'idx_title'
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+ALTER TABLE t1 ADD UNIQUE INDEX idx_id(id), ADD UNIQUE INDEX idx_title(title);
+ERROR 23000: Duplicate entry 'a10000' for key 'idx_title'
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+DROP TABLE t1;
+DROP PROCEDURE populate_t1;
diff --git a/mysql-test/suite/innodb/r/innodb_bulk_create_index_replication.result b/mysql-test/suite/innodb/r/innodb_bulk_create_index_replication.result
new file mode 100644
index 00000000000..ae050170b4f
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_bulk_create_index_replication.result
@@ -0,0 +1,222 @@
+include/master-slave.inc
+[connection master]
+connection master;
+CREATE PROCEDURE populate_t1(load_even INT)
+BEGIN
+DECLARE i int DEFAULT 1;
+START TRANSACTION;
+WHILE (i <= 100) DO
+IF i%2 = 0 AND load_even = 1 THEN
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+END IF;
+IF i%2 != 0 AND load_even != 1 THEN
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+END IF;
+SET i = i + 1;
+END WHILE;
+COMMIT;
+END|
+CREATE TABLE t1(
+class INT,
+id INT,
+title VARCHAR(100)
+) ENGINE=InnoDB ;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+50
+/* Create index. */
+CREATE INDEX idx_id ON t1(id);
+CREATE INDEX idx_title ON t1(title);
+/* Select by index. */
+EXPLAIN SELECT * FROM t1 WHERE id = 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_id idx_id 5 const 1
+EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition
+SELECT * FROM t1 WHERE id = 10;
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE id = 20;
+class id title
+20 20 a20
+SELECT * FROM t1 WHERE title = 'a20';
+class id title
+20 20 a20
+SELECT * FROM t1 WHERE id = 30;
+class id title
+30 30 a30
+SELECT * FROM t1 WHERE title = 'a30';
+class id title
+30 30 a30
+SELECT * FROM t1 WHERE id = 101;
+class id title
+SELECT * FROM t1 WHERE title = 'a101';
+class id title
+/*Insert/Update/Delete. */
+DELETE FROM t1 WHERE id < 40 AND id > 30;
+INSERT INTO t1 VALUES(38, 38, 'b38');
+UPDATE t1 SET title = CONCAT('b', id) WHERE id < 30 AND id > 20;
+SELECT * FROM t1 WHERE id = 28;
+class id title
+28 28 b28
+SELECT * FROM t1 WHERE title = 'a28';
+class id title
+SELECT * FROM t1 WHERE title = 'b28';
+class id title
+28 28 b28
+SELECT * FROM t1 WHERE id = 38;
+class id title
+38 38 b38
+SELECT * FROM t1 WHERE title = 'a38';
+class id title
+SELECT * FROM t1 WHERE title = 'b38';
+class id title
+38 38 b38
+SELECT * FROM t1 WHERE id = 101;
+class id title
+SELECT * FROM t1 WHERE title = 'a101';
+class id title
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+97
+SELECT * FROM t1 WHERE id = 10;
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE id = 20;
+class id title
+20 20 a20
+SELECT * FROM t1 WHERE title = 'a20';
+class id title
+20 20 a20
+SELECT * FROM t1 WHERE id = 30;
+class id title
+30 30 a30
+SELECT * FROM t1 WHERE title = 'a30';
+class id title
+30 30 a30
+SELECT * FROM t1 WHERE id = 101;
+class id title
+SELECT * FROM t1 WHERE title = 'a101';
+class id title
+CREATE TABLE t_part (
+class INT ,
+id INT ,
+title VARCHAR(30)
+) ENGINE=InnoDB
+PARTITION BY RANGE(id)
+SUBPARTITION BY KEY(id)
+SUBPARTITIONS 4
+(
+PARTITION p0 VALUES LESS THAN (5000),
+PARTITION p1 VALUES LESS THAN (MAXVALUE)
+);
+INSERT INTO t_part SELECT * FROM t1;
+ALTER TABLE t_part ADD INDEX `idx` (class,id,title(10));
+SELECT * FROM t_part WHERE id = 10;
+class id title
+10 10 a10
+SELECT * FROM t_part WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t_part WHERE id = 20;
+class id title
+20 20 a20
+SELECT * FROM t_part WHERE title = 'a20';
+class id title
+20 20 a20
+SELECT * FROM t_part WHERE id = 30;
+class id title
+30 30 a30
+SELECT * FROM t_part WHERE title = 'a30';
+class id title
+30 30 a30
+SELECT * FROM t_part WHERE id = 101;
+class id title
+SELECT * FROM t_part WHERE title = 'a101';
+class id title
+include/sync_slave_sql_with_master.inc
+connection slave;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `class` int(11) DEFAULT NULL,
+ `id` int(11) DEFAULT NULL,
+ `title` varchar(100) DEFAULT NULL,
+ KEY `idx_id` (`id`),
+ KEY `idx_title` (`title`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+SHOW CREATE TABLE t_part;
+Table Create Table
+t_part CREATE TABLE `t_part` (
+ `class` int(11) DEFAULT NULL,
+ `id` int(11) DEFAULT NULL,
+ `title` varchar(30) DEFAULT NULL,
+ KEY `idx` (`class`,`id`,`title`(10))
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ PARTITION BY RANGE (`id`)
+SUBPARTITION BY KEY (`id`)
+SUBPARTITIONS 4
+(PARTITION `p0` VALUES LESS THAN (5000) ENGINE = InnoDB,
+ PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB)
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+97
+SELECT COUNT(*) FROM t_part;
+COUNT(*)
+97
+SELECT * FROM t1 WHERE id = 10;
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE id = 20;
+class id title
+20 20 a20
+SELECT * FROM t1 WHERE title = 'a20';
+class id title
+20 20 a20
+SELECT * FROM t1 WHERE id = 30;
+class id title
+30 30 a30
+SELECT * FROM t1 WHERE title = 'a30';
+class id title
+30 30 a30
+SELECT * FROM t1 WHERE id = 101;
+class id title
+SELECT * FROM t1 WHERE title = 'a101';
+class id title
+SELECT * FROM t_part WHERE id = 10;
+class id title
+10 10 a10
+SELECT * FROM t_part WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t_part WHERE id = 20;
+class id title
+20 20 a20
+SELECT * FROM t_part WHERE title = 'a20';
+class id title
+20 20 a20
+SELECT * FROM t_part WHERE id = 30;
+class id title
+30 30 a30
+SELECT * FROM t_part WHERE title = 'a30';
+class id title
+30 30 a30
+SELECT * FROM t_part WHERE id = 101;
+class id title
+SELECT * FROM t_part WHERE title = 'a101';
+class id title
+connection master;
+DROP PROCEDURE populate_t1;
+DROP TABLE t1;
+DROP TABLE t_part;
+include/rpl_end.inc
diff --git a/mysql-test/suite/innodb/r/innodb_bulk_create_index_small.result b/mysql-test/suite/innodb/r/innodb_bulk_create_index_small.result
new file mode 100644
index 00000000000..b48207d4497
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_bulk_create_index_small.result
@@ -0,0 +1,139 @@
+CREATE PROCEDURE populate_t1()
+BEGIN
+DECLARE i int DEFAULT 1;
+START TRANSACTION;
+WHILE (i <= 1000) DO
+INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+SET i = i + 1;
+END WHILE;
+COMMIT;
+END|
+SELECT @@innodb_fill_factor;
+@@innodb_fill_factor
+100
+CREATE TABLE t1(
+class INT,
+id INT,
+title VARCHAR(100)
+) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+1000
+/* Create index. */
+CREATE INDEX idx_id ON t1(id);
+CREATE INDEX idx_title ON t1(title);
+/* Check table. */
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+/* Select by index. */
+EXPLAIN SELECT * FROM t1 WHERE id = 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_id idx_id 5 const 1
+EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition
+SELECT * FROM t1 WHERE id = 10;
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE id = 500;
+class id title
+500 500 a500
+SELECT * FROM t1 WHERE title = 'a500';
+class id title
+500 500 a500
+SELECT * FROM t1 WHERE id = 1000;
+class id title
+1000 1000 a1000
+SELECT * FROM t1 WHERE title = 'a1000';
+class id title
+1000 1000 a1000
+SELECT * FROM t1 WHERE id = 1010;
+class id title
+SELECT * FROM t1 WHERE title = 'a1010';
+class id title
+DROP TABLE t1;
+CREATE TABLE t1(
+a INT PRIMARY KEY,
+b TEXT,
+c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+INSERT INTO t1 VALUES
+(1, REPEAT('a',10000), 'a'),
+(2, REPEAT('b',20000), 'b'),
+(3, REPEAT('c',40000), 'c'),
+(4, REPEAT('d',60000), 'd');
+ALTER TABLE t1 DROP COLUMN c;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
+CHAR_LENGTH(b)
+DROP TABLE t1;
+SET GLOBAL innodb_file_per_table=default;
+SET GLOBAL innodb_file_per_table=1;
+CREATE TABLE t1(
+class INT,
+id INT,
+title VARCHAR(100)
+) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+1000
+/* Create index. */
+CREATE INDEX idx_id ON t1(id);
+CREATE INDEX idx_title ON t1(title);
+/* Check table. */
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+/* Select by index. */
+EXPLAIN SELECT * FROM t1 WHERE id = 10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_id idx_id 5 const 1
+EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx_title idx_title 103 const 1 Using index condition
+SELECT * FROM t1 WHERE id = 10;
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE title = 'a10';
+class id title
+10 10 a10
+SELECT * FROM t1 WHERE id = 500;
+class id title
+500 500 a500
+SELECT * FROM t1 WHERE title = 'a500';
+class id title
+500 500 a500
+SELECT * FROM t1 WHERE id = 1000;
+class id title
+1000 1000 a1000
+SELECT * FROM t1 WHERE title = 'a1000';
+class id title
+1000 1000 a1000
+SELECT * FROM t1 WHERE id = 1010;
+class id title
+SELECT * FROM t1 WHERE title = 'a1010';
+class id title
+DROP TABLE t1;
+CREATE TABLE t1(
+a INT PRIMARY KEY,
+b TEXT,
+c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
+INSERT INTO t1 VALUES
+(1, REPEAT('a',10000), 'a'),
+(2, REPEAT('b',20000), 'b'),
+(3, REPEAT('c',40000), 'c'),
+(4, REPEAT('d',60000), 'd');
+ALTER TABLE t1 DROP COLUMN c;
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
+CHAR_LENGTH(b)
+DROP TABLE t1;
+SET GLOBAL innodb_file_per_table=default;
+DROP PROCEDURE populate_t1;
diff --git a/mysql-test/suite/innodb/r/truncate_restart.result b/mysql-test/suite/innodb/r/truncate_restart.result
new file mode 100644
index 00000000000..169a56a004e
--- /dev/null
+++ b/mysql-test/suite/innodb/r/truncate_restart.result
@@ -0,0 +1,13 @@
+call mtr.add_suppression("InnoDB: Cannot save table statistics for table `test`\\.`t1`: Persistent statistics do not exist");
+SET GLOBAL innodb_stats_persistent= ON;
+CREATE TABLE t1 (t TEXT) ENGINE=InnoDB;
+connect con1,localhost,root,,test;
+SET DEBUG_SYNC='ib_trunc_table_trunc_completing SIGNAL committed WAIT_FOR ever';
+TRUNCATE TABLE t1;
+connection default;
+SET DEBUG_SYNC='now WAIT_FOR committed';
+disconnect con1;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+0
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/innodb_bulk_create_index.test b/mysql-test/suite/innodb/t/innodb_bulk_create_index.test
new file mode 100644
index 00000000000..534b4de87f7
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bulk_create_index.test
@@ -0,0 +1,46 @@
+######## suite/innodb/t/innodb_bulk_create_index.test #####
+# #
+# Testcase for worklog WL#7277: InnoDB: Bulk Load for Create Index #
+# The basic idea of bulk load is to build an index from bottom up #
+# (also known as sorted index build). #
+# Earlier index was create by repeatedly inserting records #
+# Test scenario : #
+# - Run bulk create index on 10K rows #
+# - Run bulk create index on table with various row types #
+# - Run DML and SELECT after bulk index creation #
+# Creation: #
+# 2014-06-19 Implemented this test as part of WL#7277 #
+# #
+######################################################################
+
+-- source include/not_embedded.inc
+-- source include/innodb_page_size_small.inc
+-- source include/big_test.inc
+
+# Test Row Format: REDUNDANT.
+let $row_format = REDUNDANT;
+-- source suite/innodb/include/innodb_bulk_create_index.inc
+
+# Test Row Format: COMPACT.
+let $row_format = COMPACT;
+-- source suite/innodb/include/innodb_bulk_create_index.inc
+
+# Test Row Format: DYNAMIC.
+let $row_format = DYNAMIC;
+-- source suite/innodb/include/innodb_bulk_create_index.inc
+
+# Test Row Format: COMPRESSED.
+let $row_format = COMPRESSED;
+-- source suite/innodb/include/innodb_bulk_create_index.inc
+
+# Test Fill Factor: 10
+let $row_format = COMPACT;
+SET GLOBAL innodb_fill_factor=10;
+-- source suite/innodb/include/innodb_bulk_create_index.inc
+
+# Test Fill Factor: 50
+let $row_format = COMPACT;
+SET GLOBAL innodb_fill_factor=50;
+-- source suite/innodb/include/innodb_bulk_create_index.inc
+
+SET GLOBAL innodb_fill_factor=default;
diff --git a/mysql-test/suite/innodb/t/innodb_bulk_create_index_debug.test b/mysql-test/suite/innodb/t/innodb_bulk_create_index_debug.test
new file mode 100644
index 00000000000..83a12431802
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bulk_create_index_debug.test
@@ -0,0 +1,23 @@
+#
+# wl#7277: InnoDB: Bulk Load for Create Index
+#
+
+# Test Restart & Crash Recovery.
+-- source include/big_test.inc
+-- source include/innodb_page_size_small.inc
+
+# Test Row Format: REDUNDANT.
+let $row_format = REDUNDANT;
+-- source suite/innodb/include/innodb_bulk_create_index_debug.inc
+
+# Test Row Format: COMPACT.
+let $row_format = COMPACT;
+-- source suite/innodb/include/innodb_bulk_create_index_debug.inc
+
+# Test Row Format: DYNAMIC.
+let $row_format = DYNAMIC;
+-- source suite/innodb/include/innodb_bulk_create_index_debug.inc
+
+# Test Row Format: COMPRESSED.
+let $row_format = COMPRESSED;
+-- source suite/innodb/include/innodb_bulk_create_index_debug.inc
diff --git a/mysql-test/suite/innodb/t/innodb_bulk_create_index_flush.test b/mysql-test/suite/innodb/t/innodb_bulk_create_index_flush.test
new file mode 100644
index 00000000000..0cc52b46c20
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bulk_create_index_flush.test
@@ -0,0 +1,75 @@
+#
+# Test flush on error in bulk load to make sure we do a proper cleanup.
+# Note: We flush all dirty pages before applying any online log in bulk load.
+#
+
+-- source include/have_innodb.inc
+-- source include/have_debug.inc
+
+# Create Insert Procedure
+DELIMITER |;
+CREATE PROCEDURE populate_t1()
+BEGIN
+ DECLARE i int DEFAULT 1;
+
+ START TRANSACTION;
+ WHILE (i <= 10000) DO
+ INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+ SET i = i + 1;
+ END WHILE;
+ COMMIT;
+END|
+DELIMITER ;|
+
+CREATE TABLE t1(
+ class INT,
+ id INT,
+ title VARCHAR(100)
+) ENGINE=InnoDB;
+
+-- disable_query_log
+CALL populate_t1();
+-- enable_query_log
+
+SELECT COUNT(*) FROM t1;
+
+SET @saved_dbug= @@SESSION.debug_dbug;
+SET debug_dbug='+d,ib_index_build_fail_before_flush';
+
+-- error ER_QUERY_INTERRUPTED
+CREATE INDEX idx_id ON t1(id);
+
+CHECK TABLE t1;
+
+-- error ER_QUERY_INTERRUPTED
+CREATE INDEX idx_title ON t1(title);
+
+CHECK TABLE t1;
+
+-- error ER_QUERY_INTERRUPTED
+CREATE FULLTEXT INDEX fidx_title ON t1(title);
+
+CHECK TABLE t1;
+
+-- error ER_QUERY_INTERRUPTED
+ALTER TABLE t1 ADD COLUMN content TEXT;
+
+CHECK TABLE t1;
+
+SET debug_dbug= @saved_dbug;
+
+INSERT INTO t1 VALUES(10001, 10001, 'a10000');
+
+-- error ER_DUP_ENTRY
+ALTER TABLE t1 ADD UNIQUE INDEX idx_title(title);
+
+CHECK TABLE t1;
+
+-- error ER_DUP_ENTRY
+ALTER TABLE t1 ADD UNIQUE INDEX idx_id(id), ADD UNIQUE INDEX idx_title(title);
+
+CHECK TABLE t1;
+
+DROP TABLE t1;
+
+DROP PROCEDURE populate_t1;
diff --git a/mysql-test/suite/innodb/t/innodb_bulk_create_index_replication.test b/mysql-test/suite/innodb/t/innodb_bulk_create_index_replication.test
new file mode 100644
index 00000000000..5b4eaae7557
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bulk_create_index_replication.test
@@ -0,0 +1,182 @@
+######## suite/innodb/t/innodb_wl7277_1.test #####
+# #
+# Testcase for worklog WL#7277: InnoDB: Bulk Load for Create Index #
+# The basic idea of bulk load is to build an index from bottom up #
+# (also known as sorted index build). #
+# Earlier index was create by repeatedly inserting records #
+# Test scenario : #
+# - Run bulk create index on replication setup #
+# - Run bulk create on partitioned table and see its replictaed #
+# to slave #
+# Creation: #
+# 2014-06-19 Implemented this test as part of WL#7277 #
+# #
+######################################################################
+
+--source include/not_embedded.inc
+-- source include/have_innodb.inc
+-- source include/have_partition.inc
+-- source include/master-slave.inc
+
+-- connection master
+# Create Insert Procedure
+DELIMITER |;
+CREATE PROCEDURE populate_t1(load_even INT)
+BEGIN
+ DECLARE i int DEFAULT 1;
+
+ START TRANSACTION;
+ WHILE (i <= 100) DO
+ IF i%2 = 0 AND load_even = 1 THEN
+ INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+ END IF;
+ IF i%2 != 0 AND load_even != 1 THEN
+ INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+ END IF;
+ SET i = i + 1;
+ END WHILE;
+ COMMIT;
+END|
+DELIMITER ;|
+
+CREATE TABLE t1(
+ class INT,
+ id INT,
+ title VARCHAR(100)
+) ENGINE=InnoDB ;
+
+
+
+
+-- disable_query_log
+# Load half records
+CALL populate_t1(1);
+-- enable_query_log
+
+SELECT COUNT(*) FROM t1;
+
+/* Create index. */
+CREATE INDEX idx_id ON t1(id);
+
+CREATE INDEX idx_title ON t1(title);
+
+
+/* Select by index. */
+EXPLAIN SELECT * FROM t1 WHERE id = 10;
+EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
+
+SELECT * FROM t1 WHERE id = 10;
+SELECT * FROM t1 WHERE title = 'a10';
+
+SELECT * FROM t1 WHERE id = 20;
+SELECT * FROM t1 WHERE title = 'a20';
+
+SELECT * FROM t1 WHERE id = 30;
+SELECT * FROM t1 WHERE title = 'a30';
+
+SELECT * FROM t1 WHERE id = 101;
+SELECT * FROM t1 WHERE title = 'a101';
+
+/*Insert/Update/Delete. */
+DELETE FROM t1 WHERE id < 40 AND id > 30;
+INSERT INTO t1 VALUES(38, 38, 'b38');
+UPDATE t1 SET title = CONCAT('b', id) WHERE id < 30 AND id > 20;
+
+SELECT * FROM t1 WHERE id = 28;
+SELECT * FROM t1 WHERE title = 'a28';
+SELECT * FROM t1 WHERE title = 'b28';
+
+SELECT * FROM t1 WHERE id = 38;
+SELECT * FROM t1 WHERE title = 'a38';
+SELECT * FROM t1 WHERE title = 'b38';
+
+SELECT * FROM t1 WHERE id = 101;
+SELECT * FROM t1 WHERE title = 'a101';
+
+-- disable_query_log
+# Load half records (follow up load)
+CALL populate_t1(0);
+-- enable_query_log
+SELECT COUNT(*) FROM t1;
+
+
+SELECT * FROM t1 WHERE id = 10;
+SELECT * FROM t1 WHERE title = 'a10';
+
+SELECT * FROM t1 WHERE id = 20;
+SELECT * FROM t1 WHERE title = 'a20';
+
+SELECT * FROM t1 WHERE id = 30;
+SELECT * FROM t1 WHERE title = 'a30';
+
+SELECT * FROM t1 WHERE id = 101;
+SELECT * FROM t1 WHERE title = 'a101';
+
+# Create partition table
+CREATE TABLE t_part (
+ class INT ,
+ id INT ,
+ title VARCHAR(30)
+ ) ENGINE=InnoDB
+ PARTITION BY RANGE(id)
+ SUBPARTITION BY KEY(id)
+ SUBPARTITIONS 4
+ (
+ PARTITION p0 VALUES LESS THAN (5000),
+ PARTITION p1 VALUES LESS THAN (MAXVALUE)
+ );
+INSERT INTO t_part SELECT * FROM t1;
+ALTER TABLE t_part ADD INDEX `idx` (class,id,title(10));
+
+SELECT * FROM t_part WHERE id = 10;
+SELECT * FROM t_part WHERE title = 'a10';
+
+SELECT * FROM t_part WHERE id = 20;
+SELECT * FROM t_part WHERE title = 'a20';
+
+SELECT * FROM t_part WHERE id = 30;
+SELECT * FROM t_part WHERE title = 'a30';
+
+SELECT * FROM t_part WHERE id = 101;
+SELECT * FROM t_part WHERE title = 'a101';
+
+
+--source include/sync_slave_sql_with_master.inc
+-- connection slave
+SHOW CREATE TABLE t1;
+SHOW CREATE TABLE t_part;
+SELECT COUNT(*) FROM t1;
+SELECT COUNT(*) FROM t_part;
+
+SELECT * FROM t1 WHERE id = 10;
+SELECT * FROM t1 WHERE title = 'a10';
+
+SELECT * FROM t1 WHERE id = 20;
+SELECT * FROM t1 WHERE title = 'a20';
+
+SELECT * FROM t1 WHERE id = 30;
+SELECT * FROM t1 WHERE title = 'a30';
+
+SELECT * FROM t1 WHERE id = 101;
+SELECT * FROM t1 WHERE title = 'a101';
+
+
+
+SELECT * FROM t_part WHERE id = 10;
+SELECT * FROM t_part WHERE title = 'a10';
+
+SELECT * FROM t_part WHERE id = 20;
+SELECT * FROM t_part WHERE title = 'a20';
+
+SELECT * FROM t_part WHERE id = 30;
+SELECT * FROM t_part WHERE title = 'a30';
+
+SELECT * FROM t_part WHERE id = 101;
+SELECT * FROM t_part WHERE title = 'a101';
+
+
+-- connection master
+DROP PROCEDURE populate_t1;
+DROP TABLE t1;
+DROP TABLE t_part;
+--source include/rpl_end.inc
diff --git a/mysql-test/suite/innodb/t/innodb_bulk_create_index_small.test b/mysql-test/suite/innodb/t/innodb_bulk_create_index_small.test
new file mode 100644
index 00000000000..d04dd59f7e7
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_bulk_create_index_small.test
@@ -0,0 +1,148 @@
+#
+# wl#7277: InnoDB: Bulk Load for Create Index
+#
+
+-- source include/innodb_page_size_small.inc
+
+# Create Insert Procedure
+DELIMITER |;
+CREATE PROCEDURE populate_t1()
+BEGIN
+ DECLARE i int DEFAULT 1;
+
+ START TRANSACTION;
+ WHILE (i <= 1000) DO
+ INSERT INTO t1 VALUES (i, i, CONCAT('a', i));
+ SET i = i + 1;
+ END WHILE;
+ COMMIT;
+END|
+DELIMITER ;|
+
+SELECT @@innodb_fill_factor;
+
+# Test Compact Table
+CREATE TABLE t1(
+ class INT,
+ id INT,
+ title VARCHAR(100)
+) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+
+-- disable_query_log
+CALL populate_t1();
+-- enable_query_log
+
+SELECT COUNT(*) FROM t1;
+
+/* Create index. */
+CREATE INDEX idx_id ON t1(id);
+
+CREATE INDEX idx_title ON t1(title);
+
+/* Check table. */
+CHECK TABLE t1;
+
+/* Select by index. */
+EXPLAIN SELECT * FROM t1 WHERE id = 10;
+EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
+
+SELECT * FROM t1 WHERE id = 10;
+SELECT * FROM t1 WHERE title = 'a10';
+
+SELECT * FROM t1 WHERE id = 500;
+SELECT * FROM t1 WHERE title = 'a500';
+
+SELECT * FROM t1 WHERE id = 1000;
+SELECT * FROM t1 WHERE title = 'a1000';
+
+SELECT * FROM t1 WHERE id = 1010;
+SELECT * FROM t1 WHERE title = 'a1010';
+
+DROP TABLE t1;
+
+# Test Blob
+CREATE TABLE t1(
+ a INT PRIMARY KEY,
+ b TEXT,
+ c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+
+INSERT INTO t1 VALUES
+ (1, REPEAT('a',10000), 'a'),
+ (2, REPEAT('b',20000), 'b'),
+ (3, REPEAT('c',40000), 'c'),
+ (4, REPEAT('d',60000), 'd');
+
+ALTER TABLE t1 DROP COLUMN c;
+
+CHECK TABLE t1;
+
+SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
+
+DROP TABLE t1;
+
+SET GLOBAL innodb_file_per_table=default;
+
+# Test Compressed Table
+SET GLOBAL innodb_file_per_table=1;
+
+CREATE TABLE t1(
+ class INT,
+ id INT,
+ title VARCHAR(100)
+) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
+
+-- disable_query_log
+CALL populate_t1();
+-- enable_query_log
+
+SELECT COUNT(*) FROM t1;
+
+/* Create index. */
+CREATE INDEX idx_id ON t1(id);
+
+CREATE INDEX idx_title ON t1(title);
+
+/* Check table. */
+CHECK TABLE t1;
+
+/* Select by index. */
+EXPLAIN SELECT * FROM t1 WHERE id = 10;
+EXPLAIN SELECT * FROM t1 WHERE title = 'a10';
+
+SELECT * FROM t1 WHERE id = 10;
+SELECT * FROM t1 WHERE title = 'a10';
+
+SELECT * FROM t1 WHERE id = 500;
+SELECT * FROM t1 WHERE title = 'a500';
+
+SELECT * FROM t1 WHERE id = 1000;
+SELECT * FROM t1 WHERE title = 'a1000';
+
+SELECT * FROM t1 WHERE id = 1010;
+SELECT * FROM t1 WHERE title = 'a1010';
+
+DROP TABLE t1;
+
+# Test Compression & Blob
+CREATE TABLE t1(
+ a INT PRIMARY KEY,
+ b TEXT,
+ c TEXT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
+
+INSERT INTO t1 VALUES
+ (1, REPEAT('a',10000), 'a'),
+ (2, REPEAT('b',20000), 'b'),
+ (3, REPEAT('c',40000), 'c'),
+ (4, REPEAT('d',60000), 'd');
+
+ALTER TABLE t1 DROP COLUMN c;
+
+CHECK TABLE t1;
+
+SELECT CHAR_LENGTH(b) FROM t1 WHERE a=4975;
+
+DROP TABLE t1;
+
+SET GLOBAL innodb_file_per_table=default;
+
+DROP PROCEDURE populate_t1;
diff --git a/mysql-test/suite/innodb/t/truncate_restart.test b/mysql-test/suite/innodb/t/truncate_restart.test
new file mode 100644
index 00000000000..92f09ac89b1
--- /dev/null
+++ b/mysql-test/suite/innodb/t/truncate_restart.test
@@ -0,0 +1,18 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+
+call mtr.add_suppression("InnoDB: Cannot save table statistics for table `test`\\.`t1`: Persistent statistics do not exist");
+
+SET GLOBAL innodb_stats_persistent= ON;
+CREATE TABLE t1 (t TEXT) ENGINE=InnoDB;
+--connect (con1,localhost,root,,test)
+SET DEBUG_SYNC='ib_trunc_table_trunc_completing SIGNAL committed WAIT_FOR ever';
+--send
+TRUNCATE TABLE t1;
+--connection default
+SET DEBUG_SYNC='now WAIT_FOR committed';
+--source include/restart_mysqld.inc
+--disconnect con1
+SELECT COUNT(*) FROM t1;
+DROP TABLE t1;
diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc
index 4661a4e0d14..b497e4f84e8 100644
--- a/storage/innobase/buf/buf0flu.cc
+++ b/storage/innobase/buf/buf0flu.cc
@@ -3821,16 +3821,14 @@ FlushObserver::notify_remove(
void
FlushObserver::flush()
{
+ ut_ad(m_trx);
+
if (!m_interrupted && m_stage) {
m_stage->begin_phase_flush(buf_flush_get_dirty_pages_count(
m_space_id, this));
}
- /* MDEV-14317 FIXME: Discard all changes to only those pages
- that will be freed by the clean-up of the ALTER operation.
- (Maybe, instead of buf_pool->flush_list, use a dedicated list
- for pages on which redo logging has been disabled.) */
- buf_LRU_flush_or_remove_pages(m_space_id, m_trx);
+ buf_LRU_flush_or_remove_pages(m_space_id, this);
/* Wait for all dirty pages were flushed. */
for (ulint i = 0; i < srv_buf_pool_instances; i++) {
diff --git a/storage/innobase/buf/buf0lru.cc b/storage/innobase/buf/buf0lru.cc
index 9d0d9627d26..26814418033 100644
--- a/storage/innobase/buf/buf0lru.cc
+++ b/storage/innobase/buf/buf0lru.cc
@@ -542,27 +542,21 @@ buf_flush_or_remove_page(
return(processed);
}
-/******************************************************************//**
-Remove all dirty pages belonging to a given tablespace inside a specific
+/** Remove all dirty pages belonging to a given tablespace inside a specific
buffer pool instance when we are deleting the data file(s) of that
tablespace. The pages still remain a part of LRU and are evicted from
the list as they age towards the tail of the LRU.
-@retval DB_SUCCESS if all freed
-@retval DB_FAIL if not all freed
-@retval DB_INTERRUPTED if the transaction was interrupted */
+@param[in,out] buf_pool buffer pool
+@param[in] id tablespace identifier
+@param[in] observer flush observer (to check for interrupt),
+ or NULL if the files should not be written to
+@return whether all dirty pages were freed */
static MY_ATTRIBUTE((warn_unused_result))
-dberr_t
+bool
buf_flush_or_remove_pages(
-/*======================*/
- buf_pool_t* buf_pool, /*!< buffer pool instance */
- ulint id, /*!< in: target space id for which
- to remove or flush pages */
- FlushObserver* observer, /*!< in: flush observer */
- bool flush, /*!< in: flush to disk if true but
- don't remove else remove without
- flushing to disk */
- const trx_t* trx) /*!< to check if the operation must
- be interrupted, can be 0 */
+ buf_pool_t* buf_pool,
+ ulint id,
+ FlushObserver* observer)
{
buf_page_t* prev;
buf_page_t* bpage;
@@ -584,15 +578,27 @@ rescan:
prev = UT_LIST_GET_PREV(list, bpage);
- /* If flush observer is NULL, flush page for space id,
- or flush page for flush observer. */
- if (observer ? (observer != bpage->flush_observer)
- : (id != bpage->id.space())) {
-
- /* Skip this block, as it does not belong to
- the target space. */
-
- } else if (!buf_flush_or_remove_page(buf_pool, bpage, flush)) {
+ /* Flush the pages matching space id,
+ or pages matching the flush observer. */
+ if (observer && observer->is_partial_flush()) {
+ if (observer != bpage->flush_observer) {
+ /* Skip this block. */
+ } else if (!buf_flush_or_remove_page(
+ buf_pool, bpage,
+ !observer->is_interrupted())) {
+ all_freed = false;
+ } else if (!observer->is_interrupted()) {
+ /* The processing was successful. And during the
+ processing we have released the buf_pool mutex
+ when calling buf_page_flush(). We cannot trust
+ prev pointer. */
+ goto rescan;
+ }
+ } else if (id != bpage->id.space()) {
+ /* Skip this block, because it is for a
+ different tablespace. */
+ } else if (!buf_flush_or_remove_page(
+ buf_pool, bpage, observer != NULL)) {
/* Remove was unsuccessful, we have to try again
by scanning the entire list from the end.
@@ -615,7 +621,7 @@ rescan:
iteration. */
all_freed = false;
- } else if (flush) {
+ } else if (observer) {
/* The processing was successful. And during the
processing we have released the buf_pool mutex
@@ -636,25 +642,14 @@ rescan:
/* The check for trx is interrupted is expensive, we want
to check every N iterations. */
- if (!processed && trx && trx_is_interrupted(trx)) {
- if (trx->flush_observer != NULL) {
- if (flush) {
- trx->flush_observer->interrupted();
- } else {
- /* We should remove all pages with the
- the flush observer. */
- continue;
- }
- }
-
- buf_flush_list_mutex_exit(buf_pool);
- return(DB_INTERRUPTED);
+ if (!processed && observer) {
+ observer->check_interrupted();
}
}
buf_flush_list_mutex_exit(buf_pool);
- return(all_freed ? DB_SUCCESS : DB_FAIL);
+ return(all_freed);
}
/** Remove or flush all the dirty pages that belong to a given tablespace
@@ -665,73 +660,58 @@ the tail of the LRU list.
@param[in] id tablespace identifier
@param[in] observer flush observer,
or NULL if the files should not be written to
-@param[in] trx transaction (to check for interrupt),
- or NULL if the files should not be written to
*/
static
void
buf_flush_dirty_pages(
buf_pool_t* buf_pool,
ulint id,
- FlushObserver* observer,
- const trx_t* trx)
+ FlushObserver* observer)
{
- dberr_t err;
- bool flush = trx != NULL;
-
- do {
+ for (;;) {
buf_pool_mutex_enter(buf_pool);
- err = buf_flush_or_remove_pages(
- buf_pool, id, observer, flush, trx);
+ bool freed = buf_flush_or_remove_pages(buf_pool, id, observer);
buf_pool_mutex_exit(buf_pool);
ut_ad(buf_flush_validate(buf_pool));
- if (err == DB_FAIL) {
- os_thread_sleep(2000);
- }
-
- if (err == DB_INTERRUPTED && observer != NULL) {
- ut_a(flush);
-
- flush = false;
- err = DB_FAIL;
+ if (freed) {
+ break;
}
- /* DB_FAIL is a soft error, it means that the task wasn't
- completed, needs to be retried. */
-
+ os_thread_sleep(2000);
ut_ad(buf_flush_validate(buf_pool));
+ }
- } while (err == DB_FAIL);
-
- ut_ad(err == DB_INTERRUPTED
+ ut_ad((observer && observer->is_interrupted())
|| buf_pool_get_dirty_pages_count(buf_pool, id, observer) == 0);
}
/** Empty the flush list for all pages belonging to a tablespace.
@param[in] id tablespace identifier
-@param[in] trx transaction, for checking for user interrupt;
+@param[in] observer flush observer,
or NULL if nothing is to be written
@param[in] drop_ahi whether to drop the adaptive hash index */
void
-buf_LRU_flush_or_remove_pages(ulint id, const trx_t* trx, bool drop_ahi)
+buf_LRU_flush_or_remove_pages(
+ ulint id,
+ FlushObserver* observer,
+ bool drop_ahi)
{
- FlushObserver* observer = (trx == NULL) ? NULL : trx->flush_observer;
/* Pages in the system tablespace must never be discarded. */
- ut_ad(id || trx);
+ ut_ad(id || observer);
for (ulint i = 0; i < srv_buf_pool_instances; i++) {
buf_pool_t* buf_pool = buf_pool_from_array(i);
if (drop_ahi) {
buf_LRU_drop_page_hash_for_tablespace(buf_pool, id);
}
- buf_flush_dirty_pages(buf_pool, id, observer, trx);
+ buf_flush_dirty_pages(buf_pool, id, observer);
}
- if (trx && !observer && !trx_is_interrupted(trx)) {
+ if (observer && !observer->is_interrupted()) {
/* Ensure that all asynchronous IO is completed. */
os_aio_wait_until_no_pending_writes();
fil_flush(id);
diff --git a/storage/innobase/dict/dict0stats.cc b/storage/innobase/dict/dict0stats.cc
index 2ea482095ce..7584effee9e 100644
--- a/storage/innobase/dict/dict0stats.cc
+++ b/storage/innobase/dict/dict0stats.cc
@@ -293,7 +293,10 @@ dict_stats_exec_sql(
ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X));
ut_ad(mutex_own(&dict_sys->mutex));
- if (!dict_stats_persistent_storage_check(true)) {
+ extern bool dict_stats_start_shutdown;
+
+ if (dict_stats_start_shutdown
+ || !dict_stats_persistent_storage_check(true)) {
pars_info_free(pinfo);
return(DB_STATS_DO_NOT_EXIST);
}
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index 90a3baa6f83..3b496e3959f 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -2907,7 +2907,10 @@ fil_close_tablespace(
completely and permanently. The flag stop_new_ops also prevents
fil_flush() from being applied to this tablespace. */
- buf_LRU_flush_or_remove_pages(id, trx);
+ {
+ FlushObserver observer(id, trx, NULL);
+ buf_LRU_flush_or_remove_pages(id, &observer);
+ }
/* If the free is successful, the X lock will be released before
the space memory data structure is freed. */
diff --git a/storage/innobase/include/buf0flu.h b/storage/innobase/include/buf0flu.h
index d3a83b62a46..d77a7072cf6 100644
--- a/storage/innobase/include/buf0flu.h
+++ b/storage/innobase/include/buf0flu.h
@@ -363,6 +363,12 @@ public:
|| m_interrupted);
}
+ /** @return whether to flush only some pages of the tablespace */
+ bool is_partial_flush() const { return m_stage != NULL; }
+
+ /** @return whether the operation was interrupted */
+ bool is_interrupted() const { return m_interrupted; }
+
/** Interrupt observer not to wait. */
void interrupted()
{
@@ -375,7 +381,6 @@ public:
/** Flush dirty pages. */
void flush();
-
/** Notify observer of flushing a page
@param[in] buf_pool buffer pool instance
@param[in] bpage buffer page to flush */
@@ -391,10 +396,10 @@ public:
buf_page_t* bpage);
private:
/** Table space id */
- ulint m_space_id;
+ const ulint m_space_id;
/** Trx instance */
- trx_t* m_trx;
+ trx_t* const m_trx;
/** Performance schema accounting object, used by ALTER TABLE.
If not NULL, then stage->begin_phase_flush() will be called initially,
diff --git a/storage/innobase/include/buf0lru.h b/storage/innobase/include/buf0lru.h
index 54c001ce478..7b739fc0332 100644
--- a/storage/innobase/include/buf0lru.h
+++ b/storage/innobase/include/buf0lru.h
@@ -52,12 +52,14 @@ These are low-level functions
/** Empty the flush list for all pages belonging to a tablespace.
@param[in] id tablespace identifier
-@param[in] trx transaction, for checking for user interrupt;
+@param[in,out] observer flush observer,
or NULL if nothing is to be written
@param[in] drop_ahi whether to drop the adaptive hash index */
-UNIV_INTERN
void
-buf_LRU_flush_or_remove_pages(ulint id, const trx_t* trx, bool drop_ahi=false);
+buf_LRU_flush_or_remove_pages(
+ ulint id,
+ FlushObserver* observer,
+ bool drop_ahi = false);
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
/********************************************************************//**
diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc
index 44453599e68..a02f60c6800 100644
--- a/storage/innobase/row/row0import.cc
+++ b/storage/innobase/row/row0import.cc
@@ -3653,11 +3653,16 @@ row_import_for_mysql(
The only dirty pages generated should be from the pessimistic purge
of delete marked records that couldn't be purged in Phase I. */
- buf_LRU_flush_or_remove_pages(prebuilt->table->space, trx);
-
- if (trx_is_interrupted(trx)) {
- ib::info() << "Phase III - Flush interrupted";
- return(row_import_error(prebuilt, trx, DB_INTERRUPTED));
+ {
+ FlushObserver observer(prebuilt->table->space, trx, NULL);
+ buf_LRU_flush_or_remove_pages(prebuilt->table->space,
+ &observer);
+
+ if (observer.is_interrupted()) {
+ ib::info() << "Phase III - Flush interrupted";
+ return(row_import_error(prebuilt, trx,
+ DB_INTERRUPTED));
+ }
}
ib::info() << "Phase IV - Flush complete";
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index beb816d681f..017821fdf38 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -5024,7 +5024,7 @@ func_exit:
ut_ad(need_flush_observer);
DBUG_EXECUTE_IF("ib_index_build_fail_before_flush",
- error = DB_FAIL;
+ error = DB_INTERRUPTED;
);
if (error != DB_SUCCESS) {
diff --git a/storage/innobase/row/row0quiesce.cc b/storage/innobase/row/row0quiesce.cc
index 00897d747ff..dd6289c91e6 100644
--- a/storage/innobase/row/row0quiesce.cc
+++ b/storage/innobase/row/row0quiesce.cc
@@ -535,7 +535,10 @@ row_quiesce_table_start(
}
if (!trx_is_interrupted(trx)) {
- buf_LRU_flush_or_remove_pages(table->space, trx);
+ {
+ FlushObserver observer(table->space, trx, NULL);
+ buf_LRU_flush_or_remove_pages(table->space, &observer);
+ }
if (trx_is_interrupted(trx)) {
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index 85a6d2fa516..d776595568b 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -1100,22 +1100,19 @@ srv_undo_tablespaces_init(bool create_new_db)
mtr_commit(&mtr);
/* Step-2: Flush the dirty pages from the buffer pool. */
- trx_t* trx = trx_allocate_for_background();
-
for (undo::undo_spaces_t::const_iterator it
= undo::Truncate::s_fix_up_spaces.begin();
it != undo::Truncate::s_fix_up_spaces.end();
++it) {
-
- buf_LRU_flush_or_remove_pages(TRX_SYS_SPACE, trx);
-
- buf_LRU_flush_or_remove_pages(*it, trx);
+ FlushObserver dummy(TRX_SYS_SPACE, NULL, NULL);
+ buf_LRU_flush_or_remove_pages(TRX_SYS_SPACE, &dummy);
+ FlushObserver dummy2(*it, NULL, NULL);
+ buf_LRU_flush_or_remove_pages(*it, &dummy2);
/* Remove the truncate redo log file. */
undo::Truncate undo_trunc;
undo_trunc.done_logging(*it);
}
- trx_free_for_background(trx);
}
return(DB_SUCCESS);