Skip to content

MDEV-41055 innodb_encryption_threads=0 hangs indefinitely when rotation IOPS is zero - #5653

Open
Thirunarayanan wants to merge 1 commit into
10.11from
MDEV-41055
Open

MDEV-41055 innodb_encryption_threads=0 hangs indefinitely when rotation IOPS is zero#5653
Thirunarayanan wants to merge 1 commit into
10.11from
MDEV-41055

Conversation

@Thirunarayanan

Copy link
Copy Markdown
Member

Problem:

When innodb_encryption_rotation_iops=0, an encryption thread
could be waiting on fil_crypt_iops_cond in fil_crypt_alloc_iops(). fil_crypt_set_thread_cnt() lowers srv_n_fil_crypt_threads and broadcasts only fil_crypt_thread_cond, so that the waiting thread never re-evaluates should_shutdown() and never exits.

Solution:

fil_crypt_set_thread_cnt(): Broadcast fil_crypt_iops_cond as well, so a thread waiting for IOPS wakes up and sees should_shutdown(), exits.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The result file does not match the test, and the test does not deterministically exercise the blocked condition-variable path.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Wakes encryption threads blocked on zero IOPS so thread-count reduction can complete.

Changes:

  • Broadcasts the IOPS condition when changing thread count.
  • Adds regression coverage for zero rotation IOPS.
  • Updates expected test output.
File summaries
File Description
storage/innobase/fil/fil0crypt.cc Wakes IOPS-blocked encryption threads.
mysql-test/suite/encryption/t/innodb-encr-threads.test Adds the regression scenario.
mysql-test/suite/encryption/r/innodb-encr-threads.result Adds expected regression output.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 3
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +16 to +20
SELECT COUNT(*) AS started_encrypting
FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION
WHERE ENCRYPTION_SCHEME = 1 AND MIN_KEY_VERSION = 0;
started_encrypting
0
Comment on lines +35 to +38
let $wait_condition=
SELECT COUNT(*) > 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION
WHERE ENCRYPTION_SCHEME = 1 AND MIN_KEY_VERSION = 0;
--source include/wait_condition.inc
Comment thread mysql-test/suite/encryption/t/innodb-encr-threads.test Outdated
…on IOPS is zero

Problem:
=======
  When innodb_encryption_rotation_iops=0, an encryption thread
could be waiting on fil_crypt_iops_cond in fil_crypt_alloc_iops().
fil_crypt_set_thread_cnt() lowers srv_n_fil_crypt_threads and
broadcasts only fil_crypt_thread_cond, so that the waiting thread
never re-evaluates should_shutdown() and never exits.

Solution:
=========
fil_crypt_set_thread_cnt(): Broadcast fil_crypt_iops_cond as well,
so a thread waiting for IOPS wakes up and sees should_shutdown(),
exits.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants