Details
Description
Encryption threads encrypts the tablespace and it increases the active threads value.
At the same time alter(drop) operation wait for the encryption thread to stop accessing
the tablespace. Encryption thread wait for is_stopping() to exit early. But alter fail
to set the stopping flag before waiting for the encryption thread.
--source include/have_innodb.inc
|
--source include/have_sequence.inc
|
--source include/have_file_key_management_plugin.inc
|
--source include/count_sessions.inc
|
|
SET @save_threads = @@GLOBAL.innodb_encryption_threads;
|
|
SET default_storage_engine = InnoDB;
|
|
SET GLOBAL innodb_encryption_threads = 1;
|
|
create table t1(f1 int not null, f2 int not null)engine=innodb;
|
insert into t1 select seq, seq from seq_1_to_65536;
|
insert into t1 select seq, seq from seq_1_to_65536;
|
insert into t1 select seq, seq from seq_1_to_65536;
|
SET GLOBAL innodb_encrypt_tables=1;
|
sleep 20;
|
alter table t1 force, algorithm=inplace;
|
drop table t1;
|
|
Sleep is for InnoDB to complete the encryption on all other tablespace. Once it fetches table t1, I manually added the code in fil_crypt_thread()
if (thr.space->id == 5) {
|
while (1) {
|
if (thr.space->is_stopping()) {
|
fprintf(stderr, "reached stop\n");
|
break;
|
}
|
}
|
}
|
Above code just to make sure that encryption threads work on problematic tablespace for longer time. Test case leads to hang of alter operation and display the warning in error log
2024-03-26 14:42:18 9 [Warning] InnoDB: Waited 60 seconds to drop space: test/#sql-ib21 (5) active threads 1flushing=0.
|
2024-03-26 14:42:48 9 [Warning] InnoDB: Waited 90 seconds to drop space: test/#sql-ib21 (5) active threads 1flushing=0.
|
2024-03-26 14:43:18 9 [Warning] InnoDB: Waited 120 seconds to drop space: test/#sql-ib21 (5) active threads 1flushing=0.
|
Fix could be that in
@@ -2288,13 +2288,13 @@ fil_check_pending_operations(
|
fil_space_t* sp = fil_space_get_by_id(id);
|
|
if (sp) {
|
+ sp->set_stopping(true);
|
if (sp->crypt_data && sp->acquire()) {
|
mutex_exit(&fil_system.mutex);
|
fil_space_crypt_close_tablespace(sp);
|
mutex_enter(&fil_system.mutex);
|
sp->release();
|
}
|
- sp->set_stopping(true);
|
}
|
Attachments
Issue Links
- relates to
-
MDEV-23855 InnoDB log checkpointing causes regression for write-heavy OLTP
- Closed
- mentioned in
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...
-
Page Loading...