Commit b4777bfc authored by Sergei Golubchik's avatar Sergei Golubchik

cleanup, use encryption_key_id_exists() where appropriate

parent 66380916
...@@ -1994,9 +1994,8 @@ fil_read_first_page( ...@@ -1994,9 +1994,8 @@ fil_read_first_page(
if ((cdata && cdata->encryption == FIL_SPACE_ENCRYPTION_ON) || if ((cdata && cdata->encryption == FIL_SPACE_ENCRYPTION_ON) ||
(srv_encrypt_tables && (srv_encrypt_tables &&
cdata && cdata->encryption == FIL_SPACE_ENCRYPTION_DEFAULT)) { cdata && cdata->encryption == FIL_SPACE_ENCRYPTION_DEFAULT)) {
uint rc = encryption_key_get_latest_version(cdata->key_id);
if (rc == ENCRYPTION_KEY_VERSION_INVALID) { if (!encryption_key_id_exists(cdata->key_id)) {
ib_logf(IB_LOG_LEVEL_FATAL, ib_logf(IB_LOG_LEVEL_FATAL,
"Tablespace id %ld encrypted but encryption service" "Tablespace id %ld encrypted but encryption service"
" not available. Can't continue opening tablespace.\n", " not available. Can't continue opening tablespace.\n",
......
...@@ -315,8 +315,7 @@ void ma_crypt_set_data_pagecache_callbacks(PAGECACHE_FILE *file, ...@@ -315,8 +315,7 @@ void ma_crypt_set_data_pagecache_callbacks(PAGECACHE_FILE *file,
__attribute__((unused))) __attribute__((unused)))
{ {
/* Only use encryption if we have defined it */ /* Only use encryption if we have defined it */
if (encryption_key_get_latest_version(HARD_CODED_ENCRYPTION_KEY_ID) != if (encryption_key_id_exists(HARD_CODED_ENCRYPTION_KEY_ID))
ENCRYPTION_KEY_VERSION_INVALID)
{ {
file->pre_read_hook= ma_crypt_pre_read_hook; file->pre_read_hook= ma_crypt_pre_read_hook;
file->post_read_hook= ma_crypt_data_post_read_hook; file->post_read_hook= ma_crypt_data_post_read_hook;
......
...@@ -2032,9 +2032,8 @@ fil_read_first_page( ...@@ -2032,9 +2032,8 @@ fil_read_first_page(
if ((cdata && cdata->encryption == FIL_SPACE_ENCRYPTION_ON) || if ((cdata && cdata->encryption == FIL_SPACE_ENCRYPTION_ON) ||
(srv_encrypt_tables && (srv_encrypt_tables &&
cdata && cdata->encryption == FIL_SPACE_ENCRYPTION_DEFAULT)) { cdata && cdata->encryption == FIL_SPACE_ENCRYPTION_DEFAULT)) {
uint rc = encryption_key_get_latest_version(cdata->key_id);
if (rc == ENCRYPTION_KEY_VERSION_INVALID) { if (!encryption_key_id_exists(cdata->key_id)) {
ib_logf(IB_LOG_LEVEL_FATAL, ib_logf(IB_LOG_LEVEL_FATAL,
"Tablespace id %ld encrypted but encryption service" "Tablespace id %ld encrypted but encryption service"
" not available. Can't continue opening tablespace.\n", " not available. Can't continue opening tablespace.\n",
......
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