| 1 |
--echo # |
| 2 |
--echo # Bug#15923864 (Bug#67718): |
| 3 |
--echo # INNODB DRASTICALLY UNDER-FILLS PAGES IN CERTAIN CONDITIONS |
| 4 |
--echo # |
| 5 |
# InnoDB should try to insert to the next page before split, |
| 6 |
# if the insert record for split_and_insert is last of the page. |
| 7 |
# Otherwise, the follwing records 999,998,997 cause each page per record. |
| 8 |
# |
| 9 |
|
| 10 |
--disable_query_log |
| 11 |
SET @old_innodb_file_per_table = @@innodb_file_per_table; |
| 12 |
--enable_query_log |
| 13 |
|
| 14 |
SET GLOBAL innodb_file_per_table=ON; |
| 15 |
|
| 16 |
CREATE TABLE t1 (a BIGINT PRIMARY KEY, b VARCHAR(4096)) ENGINE=InnoDB; |
| 17 |
INSERT INTO t1 VALUES (0, REPEAT('a', 4096)); |
| 18 |
INSERT INTO t1 VALUES (1000, REPEAT('a', 4096)); |
| 19 |
INSERT INTO t1 VALUES (1001, REPEAT('a', 4096)); |
| 20 |
INSERT INTO t1 VALUES (1002, REPEAT('a', 4096)); |
| 21 |
INSERT INTO t1 VALUES (1, REPEAT('a', 4096)); |
| 22 |
INSERT INTO t1 VALUES (2, REPEAT('a', 4096)); |
| 23 |
|
| 24 |
# | 0, 1, 2 | 1000, 1001, 1002| |
| 25 |
|
| 26 |
SELECT page_number, number_records |
| 27 |
FROM information_schema.innodb_tablespaces s1, |
| 28 |
information_schema.innodb_buffer_page s2, |
| 29 |
information_schema.innodb_tables s3 |
| 30 |
WHERE s1.space = s2.space AND s3.name = 'test/t1' |
| 31 |
AND page_type = "INDEX" AND s1.space = s3.space |
| 32 |
ORDER BY page_number; |
| 33 |
|
| 34 |
INSERT INTO t1 VALUES (999, REPEAT('a', 4096)); |
| 35 |
|
| 36 |
# try to insert '999' to the end of '0,1,2' page, but no space |
| 37 |
# the next '1000,1001,1002' page has also no space. |
| 38 |
# | 0, 1, 2 | 999 | 1000, 1001, 1002| |
| 39 |
|
| 40 |
SELECT page_number, number_records |
| 41 |
FROM information_schema.innodb_tablespaces s1, |
| 42 |
information_schema.innodb_buffer_page s2, |
| 43 |
information_schema.innodb_tables s3 |
| 44 |
WHERE s1.space = s2.space AND s3.name = 'test/t1' |
| 45 |
AND page_type = "INDEX" AND s1.space = s3.space |
| 46 |
ORDER BY page_number; |
| 47 |
|
| 48 |
|
| 49 |
INSERT INTO t1 VALUES (998, REPEAT('a', 4096)); |
| 50 |
|
| 51 |
# try to insert to the end of '0,1,2' page, but no space |
| 52 |
# the next '998' page has space. |
| 53 |
# | 0, 1, 2 | 998, 999 | 1000, 1001, 1002| |
| 54 |
|
| 55 |
SELECT page_number, number_records |
| 56 |
FROM information_schema.innodb_tablespaces s1, |
| 57 |
information_schema.innodb_buffer_page s2, |
| 58 |
information_schema.innodb_tables s3 |
| 59 |
WHERE s1.space = s2.space AND s3.name = 'test/t1' |
| 60 |
AND page_type = "INDEX" AND s1.space = s3.space |
| 61 |
ORDER BY page_number; |
| 62 |
|
| 63 |
INSERT INTO t1 VALUES (997, REPEAT('a', 4096)); |
| 64 |
|
| 65 |
# same |
| 66 |
# | 0, 1, 2 | 997, 998, 999 | 1000, 1001, 1002| |
| 67 |
|
| 68 |
SELECT page_number, number_records |
| 69 |
FROM information_schema.innodb_tablespaces s1, |
| 70 |
information_schema.innodb_buffer_page s2, |
| 71 |
information_schema.innodb_tables s3 |
| 72 |
WHERE s1.space = s2.space AND s3.name = 'test/t1' |
| 73 |
AND page_type = "INDEX" AND s1.space = s3.space |
| 74 |
ORDER BY page_number; |
| 75 |
|
| 76 |
DROP TABLE t1; |
| 77 |
|
| 78 |
--disable_query_log |
| 79 |
SET GLOBAL innodb_file_per_table = @old_innodb_file_per_table; |
| 80 |
--enable_query_log |