summaryrefslogtreecommitdiff
path: root/storage/innobase/srv/srv0start.cc
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase/srv/srv0start.cc')
-rw-r--r--storage/innobase/srv/srv0start.cc49
1 files changed, 44 insertions, 5 deletions
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index 3d0d62c335b..3822a9abf2d 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -99,6 +99,7 @@ Created 2/16/1996 Heikki Tuuri
# include "os0sync.h"
# include "zlib.h"
# include "ut0crc32.h"
+# include "btr0scrub.h"
/** Log sequence number immediately after startup */
UNIV_INTERN lsn_t srv_start_lsn;
@@ -664,7 +665,8 @@ create_log_files(
fil_space_create(
logfilename, SRV_LOG_SPACE_FIRST_ID,
fsp_flags_set_page_size(0, UNIV_PAGE_SIZE),
- FIL_LOG);
+ FIL_LOG,
+ NULL /* no encryption yet */);
ut_a(fil_validate());
logfile0 = fil_node_create(
@@ -802,6 +804,7 @@ open_or_create_data_files(
ulint space;
ulint rounded_size_pages;
char name[10000];
+ fil_space_crypt_t* crypt_data;
if (srv_n_data_files >= 1000) {
@@ -1021,7 +1024,7 @@ check_first_page:
min_arch_log_no, max_arch_log_no,
#endif /* UNIV_LOG_ARCHIVE */
min_flushed_lsn, max_flushed_lsn,
- ULINT_UNDEFINED);
+ ULINT_UNDEFINED, &crypt_data);
if (check_msg) {
@@ -1115,6 +1118,8 @@ check_first_page:
}
*sum_of_new_sizes += srv_data_file_sizes[i];
+
+ crypt_data = fil_space_create_crypt_data();
}
ret = os_file_close(files[i]);
@@ -1122,7 +1127,9 @@ check_first_page:
if (i == 0) {
flags = fsp_flags_set_page_size(0, UNIV_PAGE_SIZE);
- fil_space_create(name, 0, flags, FIL_TABLESPACE);
+ fil_space_create(name, 0, flags, FIL_TABLESPACE,
+ crypt_data);
+ crypt_data = NULL;
}
ut_a(fil_validate());
@@ -1268,7 +1275,8 @@ srv_undo_tablespace_open(
/* Set the compressed page size to 0 (non-compressed) */
flags = fsp_flags_set_page_size(0, UNIV_PAGE_SIZE);
- fil_space_create(name, space, flags, FIL_TABLESPACE);
+ fil_space_create(name, space, flags, FIL_TABLESPACE,
+ NULL /* no encryption */);
ut_a(fil_validate());
@@ -2257,7 +2265,8 @@ innobase_start_or_create_for_mysql(void)
fil_space_create(logfilename,
SRV_LOG_SPACE_FIRST_ID,
fsp_flags_set_page_size(0, UNIV_PAGE_SIZE),
- FIL_LOG);
+ FIL_LOG,
+ NULL /* no encryption yet */);
ut_a(fil_validate());
@@ -2313,6 +2322,11 @@ files_checked:
dict_stats_thread_init();
}
+ if (!srv_read_only_mode && srv_scrub_log) {
+ /* TODO(minliz): have/use log_scrub_thread_init() instead? */
+ log_scrub_event = os_event_create();
+ }
+
trx_sys_file_format_init();
trx_sys_create();
@@ -2917,6 +2931,16 @@ files_checked:
/* Create the thread that will optimize the FTS sub-system. */
fts_optimize_init();
+
+ /* Init data for datafile scrub threads */
+ btr_scrub_init();
+
+ /* Create thread(s) that handles key rotation */
+ fil_crypt_threads_init();
+
+ /* Create the log scrub thread */
+ if (srv_scrub_log)
+ os_thread_create(log_scrub_thread, NULL, NULL);
}
/* Initialize online defragmentation. */
@@ -2982,6 +3006,9 @@ innobase_shutdown_for_mysql(void)
fts_optimize_start_shutdown();
fts_optimize_end();
+
+ /* Shutdown key rotation threads */
+ fil_crypt_threads_end();
}
/* 1. Flush the buffer pool to disk, write the current lsn to
@@ -3090,6 +3117,18 @@ innobase_shutdown_for_mysql(void)
if (!srv_read_only_mode) {
dict_stats_thread_deinit();
+ if (srv_scrub_log) {
+ /* TODO(minliz): have/use log_scrub_thread_deinit() instead? */
+ os_event_free(log_scrub_event);
+ log_scrub_event = NULL;
+ }
+ }
+
+ if (!srv_read_only_mode) {
+ fil_crypt_threads_cleanup();
+
+ /* Cleanup data for datafile scrubbing */
+ btr_scrub_cleanup();
}
#ifdef __WIN__