Skip to content
Permalink
Browse files
MDEV-15752 Possible race between DDL and accessing I_S.INNODB_TABLESP…
…ACES_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.
  • Loading branch information
dr-m committed Apr 7, 2018
1 parent 4c89cff commit d9c85ee
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
@@ -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;
}

0 comments on commit d9c85ee

Please sign in to comment.