| 1 |
--source include/have_debug.inc |
| 2 |
|
| 3 |
--echo # Prepare schema. |
| 4 |
CREATE TABLE t (a INT PRIMARY KEY, b CHAR(100)); |
| 5 |
|
| 6 |
--echo # Disable the dict_stats thread and the master thread to avoid redo log records being created in background. |
| 7 |
SET GLOBAL innodb_dict_stats_disabled_debug = 1; |
| 8 |
SET GLOBAL innodb_master_thread_disabled_debug = 1; |
| 9 |
|
| 10 |
--echo # Execute sharp checkpoint. |
| 11 |
SET GLOBAL innodb_log_checkpoint_now = 1; |
| 12 |
|
| 13 |
--echo # Ensure that redo log is logically empty (within 1 block) |
| 14 |
--let $assert_text='Redo log is logically empty (has 1 block)' |
| 15 |
--let $assert_cond= "[SELECT variable_value FROM performance_schema.global_status WHERE variable_name = \'Innodb_redo_log_logical_size\']" = 512 |
| 16 |
--source include/assert.inc |
| 17 |
|
| 18 |
--echo # Disable page cleaners and prevent page flushing/checkpointing. |
| 19 |
--source ../include/log_disable_page_cleaners.inc |
| 20 |
|
| 21 |
--echo # Apply some modifications. |
| 22 |
INSERT INTO t(a,b) VALUES (1, REPEAT('x',100)), (2, REPEAT('x',100)), (3, REPEAT('x',100)), |
| 23 |
(4, REPEAT('x',100)), (5, REPEAT('x',100)), (6, REPEAT('x',100)); |
| 24 |
UPDATE t SET b = REPEAT('y',100); |
| 25 |
|
| 26 |
--echo # Wait until the logical size is updated: |
| 27 |
SET GLOBAL DEBUG = '+d,syncpoint_log_status_variables_updated'; |
| 28 |
SET DEBUG_SYNC = 'now WAIT_FOR reached_log_status_variables_updated'; |
| 29 |
SET GLOBAL DEBUG = '-d,syncpoint_log_status_variables_updated'; |
| 30 |
SET DEBUG_SYNC = 'now SIGNAL continue_log_status_variables_updated'; |
| 31 |
|
| 32 |
--echo # Check if the logical size of the redo log is greater than 1kB. |
| 33 |
--let $REDO_LOG_SIZE= `SELECT variable_value FROM performance_schema.global_status WHERE variable_name = 'Innodb_redo_log_logical_size'` |
| 34 |
--let $assert_text='Redo log has more than 1kB of logical data' |
| 35 |
--let $assert_cond= "$REDO_LOG_SIZE" > 1024 |
| 36 |
--source include/assert.inc |
| 37 |
|
| 38 |
--echo # Apply single row modification. |
| 39 |
UPDATE t SET b = REPEAT('z',100) WHERE a=1; |
| 40 |
|
| 41 |
--echo # Wait until the logical size is updated: |
| 42 |
SET GLOBAL DEBUG = '+d,syncpoint_log_status_variables_updated'; |
| 43 |
SET DEBUG_SYNC = 'now WAIT_FOR reached_log_status_variables_updated'; |
| 44 |
SET GLOBAL DEBUG = '-d,syncpoint_log_status_variables_updated'; |
| 45 |
SET DEBUG_SYNC = 'now SIGNAL continue_log_status_variables_updated'; |
| 46 |
|
| 47 |
--echo # Check if the logical size increase is in proper range (between 100bytes and 1kB). |
| 48 |
--let $NEW_REDO_LOG_SIZE= `SELECT variable_value FROM performance_schema.global_status WHERE variable_name = 'Innodb_redo_log_logical_size'` |
| 49 |
--let $INCREASE= `SELECT $NEW_REDO_LOG_SIZE - $REDO_LOG_SIZE` |
| 50 |
--let $assert_text='Redo log increased by at least 100 bytes' |
| 51 |
--let $assert_cond= "$INCREASE" >= 100 |
| 52 |
--source include/assert.inc |
| 53 |
--let $assert_text='Redo log increased by no more than 16kB' |
| 54 |
--let $assert_cond= "$INCREASE" <= 16*1024 |
| 55 |
--source include/assert.inc |
| 56 |
|
| 57 |
--echo # Enable page cleaners, page flushing and log checkpointing. |
| 58 |
--source ../include/log_enable_page_cleaners.inc |
| 59 |
|
| 60 |
--echo # Execute sharp checkpoint. |
| 61 |
SET GLOBAL innodb_log_checkpoint_now = 1; |
| 62 |
|
| 63 |
--echo # Ensure that redo log is logically empty (within 1 block) |
| 64 |
--let $assert_text='Redo log is logically empty (has 1 block)' |
| 65 |
--let $assert_cond= "[SELECT variable_value FROM performance_schema.global_status WHERE variable_name = \'Innodb_redo_log_logical_size\']" = 512 |
| 66 |
--source include/assert.inc |
| 67 |
|
| 68 |
--echo # Enable the dict_stats thread and the master thread. |
| 69 |
SET GLOBAL innodb_dict_stats_disabled_debug = 0; |
| 70 |
SET GLOBAL innodb_master_thread_disabled_debug = 0; |
| 71 |
|
| 72 |
--echo # Cleanup. |
| 73 |
DROP TABLE t; |