diff options
Diffstat (limited to 'storage/innobase/srv/srv0start.cc')
-rw-r--r-- | storage/innobase/srv/srv0start.cc | 52 |
1 files changed, 44 insertions, 8 deletions
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index be98ece404c..7d5405ec02f 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved. Copyright (c) 2008, Google Inc. Copyright (c) 2009, Percona Inc. Copyright (c) 2013, 2015, MariaDB Corporation @@ -71,6 +71,8 @@ Created 2/16/1996 Heikki Tuuri #include "srv0srv.h" #include "btr0defragment.h" +#include <mysql/service_wsrep.h> + #ifndef UNIV_HOTBACKUP # include "trx0rseg.h" # include "os0proc.h" @@ -244,8 +246,8 @@ srv_file_check_mode( /* Note: stat.rw_perm is only valid of files */ - if (stat.type == OS_FILE_TYPE_FILE - || stat.type == OS_FILE_TYPE_BLOCK) { + if (stat.type == OS_FILE_TYPE_FILE) { + if (!stat.rw_perm) { ib_logf(IB_LOG_LEVEL_ERROR, @@ -442,14 +444,16 @@ srv_parse_data_file_paths_and_sizes( && *(str + 1) == 'e' && *(str + 2) == 'w') { str += 3; + /* Initialize new raw device only during bootstrap */ (srv_data_file_is_raw_partition)[i] = SRV_NEW_RAW; } if (*str == 'r' && *(str + 1) == 'a' && *(str + 2) == 'w') { str += 3; + /* Initialize new raw device only during bootstrap */ if ((srv_data_file_is_raw_partition)[i] == 0) { - (srv_data_file_is_raw_partition)[i] = SRV_OLD_RAW; + (srv_data_file_is_raw_partition)[i] = SRV_NEW_RAW; } } @@ -905,6 +909,24 @@ open_or_create_data_files( return(DB_ERROR); } + + const char* check_msg; + check_msg = fil_read_first_page( + files[i], FALSE, &flags, &space, +#ifdef UNIV_LOG_ARCHIVE + min_arch_log_no, max_arch_log_no, +#endif /* UNIV_LOG_ARCHIVE */ + min_flushed_lsn, max_flushed_lsn, NULL); + + /* If first page is valid, don't overwrite DB. + It prevents overwriting DB when mysql_install_db + starts mysqld multiple times during bootstrap. */ + if (check_msg == NULL) { + + srv_created_new_raw = FALSE; + ret = FALSE; + } + } else if (srv_data_file_is_raw_partition[i] == SRV_OLD_RAW) { srv_start_raw_disk_in_use = TRUE; @@ -1025,8 +1047,7 @@ check_first_page: #ifdef UNIV_LOG_ARCHIVE min_arch_log_no, max_arch_log_no, #endif /* UNIV_LOG_ARCHIVE */ - min_flushed_lsn, max_flushed_lsn, - ULINT_UNDEFINED, &crypt_data); + min_flushed_lsn, max_flushed_lsn, &crypt_data); if (check_msg) { @@ -2924,9 +2945,24 @@ files_checked: } if (!srv_read_only_mode) { +#ifdef WITH_WSREP + /* + Create the dump/load thread only when not running with + --wsrep-recover. + */ + if (!wsrep_recovery) { +#endif /* WITH_WSREP */ /* Create the buffer pool dump/load thread */ - buf_dump_thread_handle = os_thread_create(buf_dump_thread, NULL, NULL); + buf_dump_thread_handle= + os_thread_create(buf_dump_thread, NULL, NULL); buf_dump_thread_started = true; +#ifdef WITH_WSREP + } else { + ib_logf(IB_LOG_LEVEL_WARN, + "Skipping buffer pool dump/restore during " + "wsrep recovery."); + } +#endif /* WITH_WSREP */ /* Create the dict stats gathering thread */ dict_stats_thread_handle = os_thread_create(dict_stats_thread, NULL, NULL); @@ -3168,9 +3204,9 @@ innobase_shutdown_for_mysql(void) ibuf_close(); log_shutdown(); - lock_sys_close(); trx_sys_file_format_close(); trx_sys_close(); + lock_sys_close(); /* We don't create these mutexes in RO mode because we don't create the temp files that the cover. */ |