summaryrefslogtreecommitdiff
path: root/storage/xtradb
diff options
context:
space:
mode:
Diffstat (limited to 'storage/xtradb')
-rw-r--r--storage/xtradb/fil/fil0crypt.cc13
-rw-r--r--storage/xtradb/fil/fil0fil.cc2
-rw-r--r--storage/xtradb/fsp/fsp0fsp.cc6
-rw-r--r--storage/xtradb/handler/i_s.cc7
-rw-r--r--storage/xtradb/srv/srv0start.cc5
5 files changed, 24 insertions, 9 deletions
diff --git a/storage/xtradb/fil/fil0crypt.cc b/storage/xtradb/fil/fil0crypt.cc
index 683974d8920..d974b9a8586 100644
--- a/storage/xtradb/fil/fil0crypt.cc
+++ b/storage/xtradb/fil/fil0crypt.cc
@@ -2298,7 +2298,7 @@ fil_crypt_set_thread_cnt(
os_thread_create(fil_crypt_thread, NULL, &rotation_thread_id);
ib_logf(IB_LOG_LEVEL_INFO,
- "Creating #%d thread id %lu total threads %u.",
+ "Creating #%d encryption thread id %lu total threads %u.",
i+1, os_thread_pf(rotation_thread_id), new_cnt);
}
} else if (new_cnt < srv_n_fil_crypt_threads) {
@@ -2312,6 +2312,14 @@ fil_crypt_set_thread_cnt(
os_event_reset(fil_crypt_event);
os_event_wait_time(fil_crypt_event, 1000000);
}
+
+ /* Send a message to encryption threads that there could be
+ something to do. */
+ if (srv_n_fil_crypt_threads) {
+ mutex_enter(&fil_crypt_threads_mutex);
+ os_event_set(fil_crypt_threads_event);
+ mutex_exit(&fil_crypt_threads_mutex);
+ }
}
/*********************************************************************
@@ -2456,9 +2464,10 @@ fil_space_crypt_get_status(
ut_ad(space->n_pending_ops > 0);
fil_crypt_read_crypt_data(const_cast<fil_space_t*>(space));
- status->space = space->id;
+ status->space = ULINT_UNDEFINED;
if (fil_space_crypt_t* crypt_data = space->crypt_data) {
+ status->space = space->id;
mutex_enter(&crypt_data->mutex);
status->scheme = crypt_data->type;
status->keyserver_requests = crypt_data->keyserver_requests;
diff --git a/storage/xtradb/fil/fil0fil.cc b/storage/xtradb/fil/fil0fil.cc
index dbf6501b183..8469cb1364d 100644
--- a/storage/xtradb/fil/fil0fil.cc
+++ b/storage/xtradb/fil/fil0fil.cc
@@ -2268,7 +2268,7 @@ fil_write_flushed_lsn(
/* If tablespace is not encrypted, stamp flush_lsn to
first page of all system tablespace datafiles to avoid
unnecessary error messages on possible downgrade. */
- if (space->crypt_data->min_key_version == 0) {
+ if (!space->crypt_data || space->crypt_data->min_key_version == 0) {
fil_node_t* node;
ulint sum_of_sizes = 0;
diff --git a/storage/xtradb/fsp/fsp0fsp.cc b/storage/xtradb/fsp/fsp0fsp.cc
index b5491ac6550..13aa3b8b3f9 100644
--- a/storage/xtradb/fsp/fsp0fsp.cc
+++ b/storage/xtradb/fsp/fsp0fsp.cc
@@ -728,7 +728,11 @@ fsp_header_init(ulint space_id, ulint size, mtr_t* mtr)
fil_space_t* space = fil_space_acquire(space_id);
ut_ad(space);
- if (space->crypt_data) {
+ /* Write encryption metadata to page 0 if tablespace is
+ encrypted or encryption is disabled by table option. */
+ if (space->crypt_data &&
+ (space->crypt_data->should_encrypt() ||
+ space->crypt_data->not_encrypted())) {
space->crypt_data->write_page0(page, mtr);
}
diff --git a/storage/xtradb/handler/i_s.cc b/storage/xtradb/handler/i_s.cc
index 9cef04c4244..4be4e93a19a 100644
--- a/storage/xtradb/handler/i_s.cc
+++ b/storage/xtradb/handler/i_s.cc
@@ -8524,6 +8524,12 @@ i_s_dict_fill_tablespaces_encryption(
fil_space_crypt_get_status(space, &status);
+ /* If tablespace id does not match, we did not find
+ encryption information for this tablespace. */
+ if (space->id != status.space) {
+ goto skip;
+ }
+
OK(fields[TABLESPACES_ENCRYPTION_SPACE]->store(space->id));
OK(field_store_string(fields[TABLESPACES_ENCRYPTION_NAME],
@@ -8558,6 +8564,7 @@ i_s_dict_fill_tablespaces_encryption(
OK(schema_table_store_record(thd, table_to_fill));
+skip:
DBUG_RETURN(0);
}
/*******************************************************************//**
diff --git a/storage/xtradb/srv/srv0start.cc b/storage/xtradb/srv/srv0start.cc
index aab0bc9282b..43fdb202a18 100644
--- a/storage/xtradb/srv/srv0start.cc
+++ b/storage/xtradb/srv/srv0start.cc
@@ -1228,11 +1228,6 @@ check_first_page:
ut_a(ret);
if (i == 0) {
- if (!crypt_data) {
- crypt_data = fil_space_create_crypt_data(FIL_ENCRYPTION_DEFAULT,
- FIL_DEFAULT_ENCRYPTION_KEY);
- }
-
flags = FSP_FLAGS_PAGE_SSIZE();
fil_space_create(name, 0, flags, FIL_TABLESPACE,