mirror of
https://github.com/MariaDB/server.git
synced 2025-04-09 00:35:40 +02:00

On Windows systems, occurrences of ERROR_SHARING_VIOLATION due to conflicting share modes between processes accessing the same file can result in CreateFile failures. mysys' my_open() already incorporates a workaround by implementing wait/retry logic on Windows. But this does not help if files are opened using shell redirection like mysqltest traditionally did it, i.e via --echo exec "some text" > output_file In such cases, it is cmd.exe, that opens the output_file, and it won't do any sharing-violation retries. This commit addresses the issue by introducing a new built-in command, 'write_line', in mysqltest. This new command serves as a brief alternative to 'write_file', with a single line output, that also resolves variables like "exec" would. Internally, this command will use my_open(), and therefore retry-on-error logic. Hopefully this will eliminate the very sporadic "can't open file because it is used by another process" error on CI.
117 lines
4.1 KiB
Text
117 lines
4.1 KiB
Text
--source include/have_innodb.inc
|
|
--source include/have_example_key_management_plugin.inc
|
|
--source include/have_debug.inc
|
|
--source include/not_embedded.inc
|
|
|
|
SHOW VARIABLES LIKE 'innodb_encrypt%';
|
|
|
|
SET GLOBAL innodb_encrypt_tables = ON;
|
|
|
|
CREATE TABLE t1(f1 BIGINT PRIMARY KEY, f2 int not null,
|
|
f3 int not null, index(f1), index idx_1(f2),
|
|
index(f2, f3)) ENGINE=InnoDB;
|
|
--let $tables_count= `select count(*) + 1 from information_schema.tables where engine = 'InnoDB'`
|
|
|
|
--echo # Wait max 10 min for key encryption threads to encrypt all spaces
|
|
--let $wait_timeout= 600
|
|
--let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
|
|
--source include/wait_condition.inc
|
|
--sorted_result
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
|
|
|
|
CREATE TABLE t2 (f1 int not null)engine=innodb;
|
|
let $restart_parameters=--debug=d,ib_log_checkpoint_avoid;
|
|
--source include/restart_mysqld.inc
|
|
|
|
# Stop the purge
|
|
connect(con1,localhost,root,,,);
|
|
begin;
|
|
insert into t2 values(1);
|
|
|
|
connection default;
|
|
|
|
--let $tables_count= `select count(*) + 1 from information_schema.tables where engine = 'InnoDB'`
|
|
set global innodb_encrypt_tables = OFF;
|
|
|
|
--echo # Wait max 10 min for key encryption threads to decrypt all spaces
|
|
--let $wait_timeout= 600
|
|
--let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
|
|
--source include/wait_condition.inc
|
|
--sorted_result
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
|
|
|
|
# Free the index `idx_1`
|
|
alter table t1 drop index idx_1;
|
|
|
|
set global innodb_encrypt_tables = ON;
|
|
|
|
--echo # Wait max 10 min for key encryption threads to encrypt all spaces
|
|
--let $wait_timeout= 600
|
|
--let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
|
|
--source include/wait_condition.inc
|
|
--sorted_result
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
|
|
|
|
disconnect con1;
|
|
let $shutdown_timeout=0;
|
|
--source include/restart_mysqld.inc
|
|
|
|
drop table t1, t2;
|
|
|
|
#
|
|
#
|
|
CREATE TABLE t1(f1 BIGINT PRIMARY KEY, f2 int not null,
|
|
f3 int not null, index(f1), index idx_1(f2),
|
|
index(f2, f3)) ENGINE=InnoDB;
|
|
--let $tables_count= `select count(*) + 1 from information_schema.tables where engine = 'InnoDB'`
|
|
|
|
--echo # Wait max 10 min for key encryption threads to encrypt all spaces
|
|
--let $wait_timeout= 600
|
|
--let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
|
|
--source include/wait_condition.inc
|
|
--sorted_result
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
|
|
|
|
CREATE TABLE t2 (f1 int not null)engine=innodb;
|
|
--source include/restart_mysqld.inc
|
|
|
|
# Stop the purge
|
|
connect(con1,localhost,root,,,);
|
|
begin;
|
|
insert into t2 values(1);
|
|
|
|
connection default;
|
|
|
|
--let $tables_count= `select count(*) + 1 from information_schema.tables where engine = 'InnoDB'`
|
|
set global innodb_encrypt_tables = OFF;
|
|
|
|
--echo # Wait max 10 min for key encryption threads to decrypt all spaces
|
|
--let $wait_timeout= 600
|
|
--let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
|
|
--source include/wait_condition.inc
|
|
--sorted_result
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
|
|
|
|
# Free the index `idx_1`
|
|
alter table t1 drop index idx_1;
|
|
|
|
disconnect con1;
|
|
--source include/restart_mysqld.inc
|
|
|
|
# Stop the purge
|
|
connect(con1,localhost,root,,,);
|
|
begin;
|
|
insert into t2 values(1);
|
|
|
|
connection default;
|
|
set global innodb_encrypt_tables = ON;
|
|
|
|
--echo # Wait max 10 min for key encryption threads to encrypt all spaces
|
|
--let $wait_timeout= 600
|
|
--let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
|
|
--source include/wait_condition.inc
|
|
--sorted_result
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
|
|
|
|
disconnect con1;
|
|
drop table t2, t1;
|