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