|
| 1 | +-- source include/have_innodb.inc |
| 2 | +-- source include/have_debug.inc |
| 3 | +if (`select count(*) = 0 from information_schema.plugins |
| 4 | + where plugin_name = 'debug_key_management' and plugin_status='active'`) |
| 5 | +{ |
| 6 | + --skip Needs debug_key_management |
| 7 | +} |
| 8 | +create table t1(a serial) engine=innoDB; |
| 9 | + |
| 10 | +set global innodb_encryption_threads=2; |
| 11 | +SET GLOBAL debug_dbug="+d,rotate_only_2_timed_waits"; |
| 12 | +set global debug_key_management_version=10; |
| 13 | +SET GLOBAL innodb_encrypt_tables="FORCE"; |
| 14 | + |
| 15 | +--let $tables_count= `select count(*) + 1 + @@global.innodb_undo_tablespaces from information_schema.tables where engine = 'InnoDB'` |
| 16 | + |
| 17 | +let $wait_condition= select count(*) = $tables_count from information_schema.innodb_tablespaces_encryption where current_key_version=10; |
| 18 | +--source include/wait_condition.inc |
| 19 | + |
| 20 | +# Record initial indefinite wait count |
| 21 | +--let $initial_indefinite_waits= `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='INNODB_ENCRYPTION_INDEFINITE_WAITS'` |
| 22 | + |
| 23 | +sleep 20; |
| 24 | + |
| 25 | +# After sleep, verify threads used indefinite waits (not busy looping) |
| 26 | +--let $final_indefinite_waits= `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='INNODB_ENCRYPTION_INDEFINITE_WAITS'` |
| 27 | + |
| 28 | +# Ensure indefinite waits increased (threads are sleeping, not busy-looping) |
| 29 | +if (`SELECT $final_indefinite_waits <= $initial_indefinite_waits`) |
| 30 | +{ |
| 31 | + --echo ERROR: Encryption threads did not use indefinite waits during idle period |
| 32 | + --echo This indicates potential busy-loop behavior |
| 33 | + --die Encryption threads busy-looping detected |
| 34 | +} |
| 35 | +--echo Indefinite waits happened |
| 36 | +drop table t1; |
| 37 | +--source include/restart_mysqld.inc |
0 commit comments