1# restart 2RESET CHANGED_PAGE_BITMAPS; 3DROP TABLE IF EXISTS T1, ICP_COPY; 4# restart 5CREATE TABLE T1 (F1 CHAR(255)) ENGINE=INNODB; 6# restart 71st interval end LSN greater than interval start LSN: 8should_be_1 91 10# restart 11# restart 12# restart 13log record interval start LSN should remain constant across the previous restarts 14should_be_1 151 16INSERT INTO T1 VALUES (REPEAT('A', 255)); 17# restart 18log record interval start LSN should remain constant after workload 19should_be_1 201 21log record interval end LSN should have advanced after workload 22should_be_1 231 24At least some of the records should be attributed to T1 25should_be_1 261 27INSERT INTO T1 VALUES (REPEAT('B', 255)); 28# restart 29log record interval start LSN should remain constant after workload 30should_be_1 311 32log record interval end LSN should have advanced after workload 33should_be_1 341 35INSERT INTO T1 VALUES (REPEAT('C', 255)); 36# restart 37SELECT VARIABLE_VALUE INTO @start_max_trx_id FROM performance_schema.global_status 38WHERE VARIABLE_NAME = 'Innodb_max_trx_id'; 39log record interval start LSN should remain constant after workload 40should_be_1 411 42log record interval end LSN should have advanced after workload 43should_be_1 441 45At least some of the records should be attributed to T1 46should_be_1 471 48Total number of changed pages is smaller than reasonable limit (should be 1): 49COUNT(DISTINCT PAGE_ID) < 10 501 51Check if the maximum page id is less than resonable limit (should be 1): 52MAX(PAGE_ID) < 10 531 54Check that the combination of the two above does not violate the pigeon hole principle (should be 1): 55MAX(PAGE_ID) + 1 >= COUNT(DISTINCT PAGE_ID) 561 57SELECT COUNT(*) 58FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES 59WHERE START_LSN >= END_LSN; 60COUNT(*) 610 62SELECT * FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES 63WHERE START_LSN < 10 AND END_LSN > 20; 64space_id page_id start_lsn end_lsn 65ICP tests (all should be 1): 66SELECT COUNT(*) = @cond_test_pages_count 67FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES 68WHERE END_LSN = @max_end_lsn; 69COUNT(*) = @cond_test_pages_count 701 71SELECT COUNT(*) = @cond_test_pages_count 72FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES 73WHERE 74END_LSN > (@max_end_lsn - 1) AND 75END_LSN < (@max_end_lsn + 1); 76COUNT(*) = @cond_test_pages_count 771 78SELECT COUNT(*) = @cond_test_pages_count 79FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES 80WHERE 81END_LSN >= @max_end_lsn AND 82END_LSN <= @max_end_lsn; 83COUNT(*) = @cond_test_pages_count 841 85SELECT COUNT(*) = @cond_test_pages_count 86FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES 87WHERE 88(@max_end_lsn - 1) < END_LSN AND 89@max_end_lsn >= END_LSN; 90COUNT(*) = @cond_test_pages_count 911 92SELECT COUNT(*) = @cond_test_pages_count 93FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES 94WHERE 95START_LSN <= @max_end_lsn AND 96END_LSN >= @max_end_lsn; 97COUNT(*) = @cond_test_pages_count 981 99SELECT COUNT(*) = @cond_test_pages_count 100FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES 101WHERE 102START_LSN >= @cond_test_max_start_lsn; 103COUNT(*) = @cond_test_pages_count 1041 105SELECT COUNT(*) = @cond_test_pages_count 106FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES 107WHERE 108START_LSN > (@cond_test_max_start_lsn - 1); 109COUNT(*) = @cond_test_pages_count 1101 111SELECT COUNT(*) = @cond_test_pages_count 112FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES 113WHERE 114START_LSN >= @cond_test_max_start_lsn AND 115END_LSN <= @max_end_lsn; 116COUNT(*) = @cond_test_pages_count 1171 118SELECT COUNT(*) = @cond_test_pages_count 119FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES 120WHERE 121START_LSN > (@cond_test_max_start_lsn - 1) AND 122END_LSN <= @max_end_lsn; 123COUNT(*) = @cond_test_pages_count 1241 125SELECT COUNT(*) = @cond_test_pages_count 126FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES 127WHERE 128START_LSN >= @cond_test_max_start_lsn AND 129END_LSN < (@max_end_lsn + 1); 130COUNT(*) = @cond_test_pages_count 1311 132SELECT COUNT(*) = @cond_test_pages_count 133FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES 134WHERE 135START_LSN >= @cond_test_max_start_lsn AND 136END_LSN >= @cond_test_max_start_lsn; 137COUNT(*) = @cond_test_pages_count 1381 139SELECT COUNT(*) = @cond_test_pages_count 140FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES 141WHERE 142@cond_test_max_start_lsn <= START_LSN AND 143@max_end_lsn >= END_LSN; 144COUNT(*) = @cond_test_pages_count 1451 146SELECT COUNT(*) 147FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES 148WHERE 149START_LSN > @cond_test_max_lsn AND 150END_LSN < @cond_test_max_lsn; 151COUNT(*) 1520 153SELECT COUNT(*) 154FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES 155WHERE 156START_LSN > @cond_test_max_lsn + 10 AND 157END_LSN < @cond_test_max_lsn - 10; 158COUNT(*) 1590 160SELECT COUNT(*) 161FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES 162WHERE 163START_LSN <= (@min_start_lsn - 1); 164COUNT(*) 1650 166SELECT COUNT(*) 167FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES 168WHERE 169START_LSN < @min_start_lsn; 170COUNT(*) 1710 172SELECT COUNT(*) 173FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES 174WHERE 175END_LSN > @max_end_lsn; 176COUNT(*) 1770 178SELECT COUNT(*) 179FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES 180WHERE 181END_LSN >= (@max_end_lsn + 1); 182COUNT(*) 1830 184SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES 185WHERE START_LSN = (@min_start_lsn - 1); 186COUNT(*) 1870 188SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES 189WHERE START_LSN < @min_start_lsn OR END_LSN > @max_end_lsn; 190COUNT(*) 1910 192SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES 193WHERE START_LSN <= (@min_start_lsn - 1) OR END_LSN > @max_end_lsn; 194COUNT(*) 1950 196SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES 197WHERE START_LSN < @min_start_lsn OR END_LSN >= (@max_end_lsn + 1); 198COUNT(*) 1990 200SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES 201WHERE START_LSN <= (@min_start_lsn - 1) OR END_LSN >= (@max_end_lsn + 1); 202COUNT(*) 2030 204SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES 205WHERE (START_LSN > @cond_test_max_lsn AND END_LSN < @cond_test_max_lsn) 206OR (START_LSN > @cond_test_max_lsn + 10 AND END_LSN < @cond_test_max_lsn - 10); 207COUNT(*) 2080 209SELECT @total_pages=@r1_r4_pages AS should_be_1; 210should_be_1 2111 212SELECT @r1_r2_pages+@r2_r3_pages+@r3_r4_pages=@r1_r4_pages AS should_be_1; 213should_be_1 2141 215SELECT @r1_r2_pages+@r2_r3_pages=@r1_r3_pages AS should_be_1; 216should_be_1 2171 218SELECT @r2_r3_pages+@r3_r4_pages=@r2_r4_pages AS should_be_1; 219should_be_1 2201 221SET GLOBAL INNODB_MAX_CHANGED_PAGES = 1; 222SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES; 223COUNT(*) 2241 225SET GLOBAL INNODB_MAX_CHANGED_PAGES = 5; 226SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES; 227COUNT(*) 2285 229SET GLOBAL INNODB_MAX_CHANGED_PAGES = 1000000; 230SELECT VARIABLE_VALUE INTO @end_max_trx_id FROM performance_schema.global_status 231WHERE VARIABLE_NAME = 'Innodb_max_trx_id'; 232include/assert.inc [Maximum InnoDB transaction ID should not have moved during RO workload] 233include/assert.inc [No bitmap data must exist with START_LSN > @max_end_lsn] 234include/assert.inc [No bitmap data must exist with END_LSN > @max_end_lsn] 235CREATE TABLE ICP_COPY ( 236space_id INT(11) NOT NULL, 237page_id INT(11) NOT NULL, 238start_lsn BIGINT(21) NOT NULL, 239end_lsn BIGINT(21) NOT NULL, 240INDEX page_id(space_id, page_id)) ENGINE=InnoDB; 241INSERT INTO ICP_COPY SELECT * FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES 242WHERE END_LSN <= @max_end_lsn; 243# restart:--innodb_track_changed_pages=FALSE 244SELECT @@global.innodb_track_changed_pages; 245@@global.innodb_track_changed_pages 2460 247SET @max_end_lsn= (SELECT MAX(end_lsn) FROM ICP_COPY); 248TRUNCATE TABLE ICP_COPY; 249INSERT INTO ICP_COPY SELECT * FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES 250WHERE END_LSN <= @max_end_lsn; 251Check that INNODB_CHANGED_PAGES copies checksum the same (should be 1): 252should_be_1 2531 254call mtr.add_suppression("but the last checkpoint LSN is"); 255# restart 256SELECT @@global.innodb_track_changed_pages; 257@@global.innodb_track_changed_pages 2581 259ib_modified_log_4 260SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES 261WHERE START_LSN > 10000; 262ERROR HY000: Can't read record in system table 263DROP TABLE T1, ICP_COPY; 264