Commit dab6c837 authored by Sergei Golubchik's avatar Sergei Golubchik

allow srv_encrypt_tables and ENCRYPTED=YES to be used together

parent bc9f118e
...@@ -11290,22 +11290,12 @@ ha_innobase::check_table_options( ...@@ -11290,22 +11290,12 @@ ha_innobase::check_table_options(
atomic_writes_t awrites = (atomic_writes_t)options->atomic_writes; atomic_writes_t awrites = (atomic_writes_t)options->atomic_writes;
fil_encryption_t encrypt = (fil_encryption_t)options->encryption; fil_encryption_t encrypt = (fil_encryption_t)options->encryption;
if (encrypt == FIL_SPACE_ENCRYPTION_ON) { if (encrypt != FIL_SPACE_ENCRYPTION_DEFAULT && !use_tablespace) {
if (srv_encrypt_tables) {
push_warning( push_warning(
thd, Sql_condition::WARN_LEVEL_WARN, thd, Sql_condition::WARN_LEVEL_WARN,
HA_WRONG_CREATE_OPTION, HA_WRONG_CREATE_OPTION,
"InnoDB: ENCRYPTION not available if innodb_encrypt_tables=ON"); "InnoDB: ENCRYPTED requires innodb_file_per_table");
return "INNODB_ENCRYPT_TABLES"; return "ENCRYPTED";
}
if (!use_tablespace) {
push_warning(
thd, Sql_condition::WARN_LEVEL_WARN,
HA_WRONG_CREATE_OPTION,
"InnoDB: ENCRYPTION requires"
" innodb_file_per_table.");
return "PAGE_ENCRYPTION";
}
} }
/* Check page compression requirements */ /* Check page compression requirements */
...@@ -11380,8 +11370,8 @@ ha_innobase::check_table_options( ...@@ -11380,8 +11370,8 @@ ha_innobase::check_table_options(
} }
} }
if (options->encryption == FIL_SPACE_ENCRYPTION_ON || if (encrypt == FIL_SPACE_ENCRYPTION_ON ||
(options->encryption == FIL_SPACE_ENCRYPTION_DEFAULT && srv_encrypt_tables)) { (encrypt == FIL_SPACE_ENCRYPTION_DEFAULT && srv_encrypt_tables)) {
if (!encryption_key_id_exists(options->encryption_key_id)) { if (!encryption_key_id_exists(options->encryption_key_id)) {
push_warning_printf( push_warning_printf(
thd, Sql_condition::WARN_LEVEL_WARN, thd, Sql_condition::WARN_LEVEL_WARN,
...@@ -11708,7 +11698,7 @@ ha_innobase::create( ...@@ -11708,7 +11698,7 @@ ha_innobase::create(
/* If user has requested that table should be encrypted or table /* If user has requested that table should be encrypted or table
should remain as unencrypted store crypt data */ should remain as unencrypted store crypt data */
if (encrypt == FIL_SPACE_ENCRYPTION_ON || encrypt == FIL_SPACE_ENCRYPTION_OFF) { if (encrypt != FIL_SPACE_ENCRYPTION_DEFAULT) {
ulint maxsize; ulint maxsize;
ulint zip_size = fil_space_get_zip_size(innobase_table->space); ulint zip_size = fil_space_get_zip_size(innobase_table->space);
fil_space_crypt_t* old_crypt_data = fil_space_get_crypt_data(innobase_table->space); fil_space_crypt_t* old_crypt_data = fil_space_get_crypt_data(innobase_table->space);
......
...@@ -11796,23 +11796,12 @@ ha_innobase::check_table_options( ...@@ -11796,23 +11796,12 @@ ha_innobase::check_table_options(
atomic_writes_t awrites = (atomic_writes_t)options->atomic_writes; atomic_writes_t awrites = (atomic_writes_t)options->atomic_writes;
fil_encryption_t encrypt = (fil_encryption_t)options->encryption; fil_encryption_t encrypt = (fil_encryption_t)options->encryption;
if (encrypt == FIL_SPACE_ENCRYPTION_ON) { if (encrypt != FIL_SPACE_ENCRYPTION_DEFAULT && !use_tablespace) {
if (srv_encrypt_tables) {
push_warning( push_warning(
thd, Sql_condition::WARN_LEVEL_WARN, thd, Sql_condition::WARN_LEVEL_WARN,
HA_WRONG_CREATE_OPTION, HA_WRONG_CREATE_OPTION,
"InnoDB: ENCRYPTION not available if innodb_encrypt_tables=ON"); "InnoDB: ENCRYPTED requires innodb_file_per_table");
return "INNODB_ENCRYPT_TABLES"; return "ENCRYPTED";
}
if (!use_tablespace) {
push_warning(
thd, Sql_condition::WARN_LEVEL_WARN,
HA_WRONG_CREATE_OPTION,
"InnoDB: ENCRYPTION requires"
" innodb_file_per_table.");
return "PAGE_ENCRYPTION";
}
} }
/* Check page compression requirements */ /* Check page compression requirements */
...@@ -11887,8 +11876,8 @@ ha_innobase::check_table_options( ...@@ -11887,8 +11876,8 @@ ha_innobase::check_table_options(
} }
} }
if (options->encryption == FIL_SPACE_ENCRYPTION_ON || if (encrypt == FIL_SPACE_ENCRYPTION_ON ||
(options->encryption == FIL_SPACE_ENCRYPTION_DEFAULT && srv_encrypt_tables)) { (encrypt == FIL_SPACE_ENCRYPTION_DEFAULT && srv_encrypt_tables)) {
if (!encryption_key_id_exists(options->encryption_key_id)) { if (!encryption_key_id_exists(options->encryption_key_id)) {
push_warning_printf( push_warning_printf(
thd, Sql_condition::WARN_LEVEL_WARN, thd, Sql_condition::WARN_LEVEL_WARN,
...@@ -12222,7 +12211,7 @@ ha_innobase::create( ...@@ -12222,7 +12211,7 @@ ha_innobase::create(
/* If user has requested that table should be encrypted or table /* If user has requested that table should be encrypted or table
should remain as unencrypted store crypt data */ should remain as unencrypted store crypt data */
if (encrypt == FIL_SPACE_ENCRYPTION_ON || encrypt == FIL_SPACE_ENCRYPTION_OFF) { if (encrypt != FIL_SPACE_ENCRYPTION_DEFAULT) {
ulint maxsize; ulint maxsize;
ulint zip_size = fil_space_get_zip_size(innobase_table->space); ulint zip_size = fil_space_get_zip_size(innobase_table->space);
fil_space_crypt_t* old_crypt_data = fil_space_get_crypt_data(innobase_table->space); fil_space_crypt_t* old_crypt_data = fil_space_get_crypt_data(innobase_table->space);
......
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