Commit d9c85ee4 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-15752 Possible race between DDL and accessing I_S.INNODB_TABLESPACES_ENCRYPTION

fil_crypt_read_crypt_data(): Do not attempt to read the tablespace
if the file is unaccessible due to a pending DDL operation, such as
renaming the file or DROP TABLE or TRUNCATE TABLE. This is only
reducing the probability of the race condition, not completely
preventing it.
parent 4c89cff5
......@@ -1016,10 +1016,17 @@ static inline
void
fil_crypt_read_crypt_data(fil_space_t* space)
{
if (space->crypt_data || space->size) {
if (space->crypt_data || space->size
|| !fil_space_get_size(space->id)) {
/* The encryption metadata has already been read, or
the tablespace is not encrypted and the file has been
opened already. */
opened already, or the file cannot be accessed,
likely due to a concurrent TRUNCATE or
RENAME or DROP (possibly as part of ALTER TABLE).
FIXME: The file can become unaccessible any time
after this check! We should really remove this
function and instead make crypt_data an integral
part of fil_space_t. */
return;
}
......
......@@ -1016,10 +1016,17 @@ static inline
void
fil_crypt_read_crypt_data(fil_space_t* space)
{
if (space->crypt_data || space->size) {
if (space->crypt_data || space->size
|| !fil_space_get_size(space->id)) {
/* The encryption metadata has already been read, or
the tablespace is not encrypted and the file has been
opened already. */
opened already, or the file cannot be accessed,
likely due to a concurrent TRUNCATE or
RENAME or DROP (possibly as part of ALTER TABLE).
FIXME: The file can become unaccessible any time
after this check! We should really remove this
function and instead make crypt_data an integral
part of fil_space_t. */
return;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment