| 1 | /***************************************************************************** |
| 2 | |
| 3 | Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved. |
| 4 | Copyright (c) 2009, Percona Inc. |
| 5 | Copyright (c) 2013, 2023, MariaDB Corporation. |
| 6 | |
| 7 | Portions of this file contain modifications contributed and copyrighted |
| 8 | by Percona Inc.. Those modifications are |
| 9 | gratefully acknowledged and are described briefly in the InnoDB |
| 10 | documentation. The contributions by Percona Inc. are incorporated with |
| 11 | their permission, and subject to the conditions contained in the file |
| 12 | COPYING.Percona. |
| 13 | |
| 14 | This program is free software; you can redistribute it and/or modify it under |
| 15 | the terms of the GNU General Public License as published by the Free Software |
| 16 | Foundation; version 2 of the License. |
| 17 | |
| 18 | This program is distributed in the hope that it will be useful, but WITHOUT |
| 19 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 20 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
| 21 | |
| 22 | You should have received a copy of the GNU General Public License along with |
| 23 | this program; if not, write to the Free Software Foundation, Inc., |
| 24 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA |
| 25 | |
| 26 | *****************************************************************************/ |
| 27 | |
| 28 | /********************************************************************//** |
| 29 | @file srv/srv0start.cc |
| 30 | Starts the InnoDB database server |
| 31 | |
| 32 | Created 2/16/1996 Heikki Tuuri |
| 33 | *************************************************************************/ |
| 34 | |
| 35 | #include "my_global.h"cxx . . $ `<file>/include/my_global.h`/ |
| 36 | |
| 37 | #include "mysqld.h"cxx . . $ `<file>/sql/mysqld.h`/ |
| 38 | #include "mysql/psi/mysql_stage.h"cxx . . $ `<file>/include/mysql/psi/mysql_stage.h`/ |
| 39 | #include "mysql/psi/psi.h"cxx . . $ `<file>/include/mysql/psi/psi.h`/ |
| 40 | |
| 41 | #include "row0ftsort.h"cxx . . $ `<file>/storage/innobase/include/row0ftsort.h`/ |
| 42 | #include "ut0mem.h"cxx . . $ `<file>/storage/innobase/include/ut0mem.h`/ |
| 43 | #include "mem0mem.h"cxx . . $ `<file>/storage/innobase/include/mem0mem.h`/ |
| 44 | #include "data0data.h"cxx . . $ `<file>/storage/innobase/include/data0data.h`/ |
| 45 | #include "data0type.h"cxx . . $ `<file>/storage/innobase/include/data0type.h`/ |
| 46 | #include "dict0dict.h"cxx . . $ `<file>/storage/innobase/include/dict0dict.h`/ |
| 47 | #include "buf0buf.h"cxx . . $ `<file>/storage/innobase/include/buf0buf.h`/ |
| 48 | #include "buf0dblwr.h"cxx . . $ `<file>/storage/innobase/include/buf0dblwr.h`/ |
| 49 | #include "buf0dump.h"cxx . . $ `<file>/storage/innobase/include/buf0dump.h`/ |
| 50 | #include "os0file.h"cxx . . $ `<file>/storage/innobase/include/os0file.h`/ |
| 51 | #include "fil0fil.h"cxx . . $ `<file>/storage/innobase/include/fil0fil.h`/ |
| 52 | #include "fil0crypt.h"cxx . . $ `<file>/storage/innobase/include/fil0crypt.h`/ |
| 53 | #include "fsp0fsp.h"cxx . . $ `<file>/storage/innobase/include/fsp0fsp.h`/ |
| 54 | #include "rem0rec.h"cxx . . $ `<file>/storage/innobase/include/rem0rec.h`/ |
| 55 | #include "mtr0mtr.h"cxx . . $ `<file>/storage/innobase/include/mtr0mtr.h`/ |
| 56 | #include "log0crypt.h"cxx . . $ `<file>/storage/innobase/include/log0crypt.h`/ |
| 57 | #include "log0recv.h"cxx . . $ `<file>/storage/innobase/include/log0recv.h`/ |
| 58 | #include "page0page.h"cxx . . $ `<file>/storage/innobase/include/page0page.h`/ |
| 59 | #include "page0cur.h"cxx . . $ `<file>/storage/innobase/include/page0cur.h`/ |
| 60 | #include "trx0trx.h"cxx . . $ `<file>/storage/innobase/include/trx0trx.h`/ |
| 61 | #include "trx0sys.h"cxx . . $ `<file>/storage/innobase/include/trx0sys.h`/ |
| 62 | #include "btr0btr.h"cxx . . $ `<file>/storage/innobase/include/btr0btr.h`/ |
| 63 | #include "btr0cur.h"cxx . . $ `<file>/storage/innobase/include/btr0cur.h`/ |
| 64 | #include "rem0rec.h"cxx . . $ `<file>/storage/innobase/include/rem0rec.h`/ |
| 65 | #include "srv0start.h"cxx . . $ `<file>/storage/innobase/include/srv0start.h`/ |
| 66 | #include "srv0srv.h"cxx . . $ `<file>/storage/innobase/include/srv0srv.h`/ |
| 67 | #include "mysql/service_wsrep.h"cxx . . $ `<file>/include/mysql/service_wsrep.h`/ /* wsrep_recovery */ |
| 68 | #include "trx0rseg.h"cxx . . $ `<file>/storage/innobase/include/trx0rseg.h`/ |
| 69 | #include "buf0flu.h"cxx . . $ `<file>/storage/innobase/include/buf0flu.h`/ |
| 70 | #include "buf0rea.h"cxx . . $ `<file>/storage/innobase/include/buf0rea.h`/ |
| 71 | #include "dict0boot.h"cxx . . $ `<file>/storage/innobase/include/dict0boot.h`/ |
| 72 | #include "dict0load.h"cxx . . $ `<file>/storage/innobase/include/dict0load.h`/ |
| 73 | #include "dict0stats_bg.h"cxx . . $ `<file>/storage/innobase/include/dict0stats_bg.h`/ |
| 74 | #include "que0que.h"cxx . . $ `<file>/storage/innobase/include/que0que.h`/ |
| 75 | #include "lock0lock.h"cxx . . $ `<file>/storage/innobase/include/lock0lock.h`/ |
| 76 | #include "trx0roll.h"cxx . . $ `<file>/storage/innobase/include/trx0roll.h`/ |
| 77 | #include "trx0purge.h"cxx . . $ `<file>/storage/innobase/include/trx0purge.h`/ |
| 78 | #include "lock0lock.h"cxx . . $ `<file>/storage/innobase/include/lock0lock.h`/ |
| 79 | #include "pars0pars.h"cxx . . $ `<file>/storage/innobase/include/pars0pars.h`/ |
| 80 | #include "btr0sea.h"cxx . . $ `<file>/storage/innobase/include/btr0sea.h`/ |
| 81 | #include "rem0cmp.h"cxx . . $ `<file>/storage/innobase/include/rem0cmp.h`/ |
| 82 | #include "dict0crea.h"cxx . . $ `<file>/storage/innobase/include/dict0crea.h`/ |
| 83 | #include "row0ins.h"cxx . . $ `<file>/storage/innobase/include/row0ins.h`/ |
| 84 | #include "row0sel.h"cxx . . $ `<file>/storage/innobase/include/row0sel.h`/ |
| 85 | #include "row0upd.h"cxx . . $ `<file>/storage/innobase/include/row0upd.h`/ |
| 86 | #include "row0row.h"cxx . . $ `<file>/storage/innobase/include/row0row.h`/ |
| 87 | #include "row0mysql.h"cxx . . $ `<file>/storage/innobase/include/row0mysql.h`/ |
| 88 | #include "btr0pcur.h"cxx . . $ `<file>/storage/innobase/include/btr0pcur.h`/ |
| 89 | #include "ibuf0ibuf.h"cxx . . $ `<file>/storage/innobase/include/ibuf0ibuf.h`/ |
| 90 | #include "zlib.h" |
| 91 | #include "log.h"cxx . . $ `<file>/sql/log.h`/ |
| 92 | |
| 93 | /** TRUE if a raw partition is in use */ |
| 94 | iboolcxx . . $ `storage/innobase/include/univ.i:355:9`! srv_start_raw_disk_in_usecxx . . $ srv_start_raw_disk_in_use.; |
| 95 | |
| 96 | /** UNDO tablespaces starts with space id. */ |
| 97 | uint32_tcxx . . $ uint32_t# srv_undo_space_id_startcxx . . $ srv_undo_space_id_start.; |
| 98 | |
| 99 | /** TRUE if the server is being started, before rolling back any |
| 100 | incomplete transactions */ |
| 101 | bool srv_startup_is_before_trx_rollback_phasecxx . . $ srv_startup_is_before_trx_rollback_phase.; |
| 102 | /** TRUE if the server is being started */ |
| 103 | bool srv_is_being_startedcxx . . $ srv_is_being_started.; |
| 104 | /** TRUE if the server was successfully started */ |
| 105 | bool srv_was_startedcxx . . $ srv_was_started.; |
| 106 | /** whether srv_start() has been called */ |
| 107 | static bool srv_start_has_been_calledcxx . . $ srv_start_has_been_called.; |
| 108 | |
| 109 | /** Whether any undo log records can be generated */ |
| 110 | bool srv_undo_sourcescxx . . $ srv_undo_sources.; |
| 111 | |
| 112 | /** innodb_encrypt_log */ |
| 113 | my_boolcxx . . $ my_bool# srv_encrypt_logcxx . . $ srv_encrypt_log.; |
| 114 | |
| 115 | #ifdef UNIV_DEBUG |
| 116 | /** InnoDB system tablespace to set during recovery */ |
| 117 | uint srv_sys_space_size_debug; |
| 118 | /** whether redo log file have been created at startup */ |
| 119 | bool srv_log_file_created; |
| 120 | #endif /* UNIV_DEBUG */ |
| 121 | |
| 122 | /** whether some background threads that create redo log have been started */ |
| 123 | static bool srv_started_redocxx . . $ srv_started_redo.; |
| 124 | |
| 125 | /** At a shutdown this value climbs from SRV_SHUTDOWN_NONE to |
| 126 | SRV_SHUTDOWN_CLEANUP and then to SRV_SHUTDOWN_LAST_PHASE, and so on */ |
| 127 | enum srv_shutdown_tcxx . . $ srv_shutdown_t# srv_shutdown_statecxx . . $ srv_shutdown_state. = SRV_SHUTDOWN_NONEcxx . . $ SRV_SHUTDOWN_NONE.; |
| 128 | |
| 129 | /** Name of srv_monitor_file */ |
| 130 | static char* srv_monitor_file_namecxx . . $ srv_monitor_file_name.; |
| 131 | stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<tpoolcxx . . $ tpool/::timercxx . . $ tpool/timer#> srv_master_timercxx . . $ srv_master_timer.; |
| 132 | |
| 133 | /** */ |
| 134 | #define SRV_MAX_N_PENDING_SYNC_IOScxx . . $ `storage/innobase/srv/srv0start.cc:134:9`! 100 |
| 135 | |
| 136 | #ifdef UNIV_PFS_THREADcxx . . $ `storage/innobase/include/univ.i:71:10`! |
| 137 | /* Keys to register InnoDB threads with performance schema */ |
| 138 | mysql_pfs_key_tcxx . . $ mysql_pfs_key_t# thread_pool_thread_keycxx . . $ thread_pool_thread_key.; |
| 139 | #endif /* UNIV_PFS_THREAD */ |
| 140 | |
| 141 | #ifdef HAVE_PSI_STAGE_INTERFACEcxx . . $ `include/mysql/psi/psi.h:469:9`! |
| 142 | /** Array of all InnoDB stage events for monitoring activities via |
| 143 | performance schema. */ |
| 144 | static PSI_stage_info* srv_stagescxx . . $ srv_stages.[] = |
| 145 | { |
| 146 | &srv_stage_alter_table_endcxx . . $ srv_stage_alter_table_end., |
| 147 | &srv_stage_alter_table_insertcxx . . $ srv_stage_alter_table_insert., |
| 148 | &srv_stage_alter_table_log_indexcxx . . $ srv_stage_alter_table_log_index., |
| 149 | &srv_stage_alter_table_log_tablecxx . . $ srv_stage_alter_table_log_table., |
| 150 | &srv_stage_alter_table_merge_sortcxx . . $ srv_stage_alter_table_merge_sort., |
| 151 | &srv_stage_alter_table_read_pk_internal_sortcxx . . $ srv_stage_alter_table_read_pk_internal_sort., |
| 152 | &srv_stage_buffer_pool_loadcxx . . $ srv_stage_buffer_pool_load., |
| 153 | }; |
| 154 | #endif /* HAVE_PSI_STAGE_INTERFACE */ |
| 155 | |
| 156 | /** Delete any garbage log files */ |
| 157 | static void delete_log_filescxx . . $ delete_log_files(49f6e7a06ebc5aa8).() |
| 158 | { |
| 159 | for (size_t i= 1; i < 102; i++) |
| 160 | delete_log_filecxx . . $ delete_log_file(85c52e162fed56f9).(stdcxx . . $ std/::to_stringcxx . . $ std/__cxx11/to_string(354ce04007c9ea85).(i).c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).()); |
| 161 | } |
| 162 | |
| 163 | /** Creates log file. |
| 164 | @param create_new_db whether the database is being initialized |
| 165 | @param lsn log sequence number |
| 166 | @param logfile0 name of the log file |
| 167 | @return DB_SUCCESS or error code */ |
| 168 | static dberr_tcxx . . $ dberr_t# create_log_filecxx . . $ create_log_file(97127bc9b032d3da).(bool create_new_db, lsn_tcxx . . $ lsn_t# lsn) |
| 169 | { |
| 170 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(log_sys.latch_have_wr()); |
| 171 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(!srv_read_only_mode); |
| 172 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(!buf_pool.get_oldest_modification(0)); |
| 173 | |
| 174 | /* We will retain ib_logfile0 until we have written a new logically |
| 175 | empty log as ib_logfile101 and atomically renamed it to |
| 176 | ib_logfile0 in log_t::resize_rename(). */ |
| 177 | delete_log_filescxx . . $ delete_log_files(49f6e7a06ebc5aa8).(); |
| 178 | |
| 179 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(!os_aio_pending_reads()); |
| 180 | /* os_aio_pending_writes() may hold here if some |
| 181 | write_io_callback() did not release the slot yet. However, |
| 182 | the page write itself must have completed, because the |
| 183 | buf_pool.flush_list is empty. In debug builds, we wait for |
| 184 | this to happen, hoping to get a hung process if this |
| 185 | assumption does not hold. */ |
| 186 | ut_dcxx . . $ `storage/innobase/include/ut0dbg.h:68:9`!(os_aio_wait_until_no_pending_writes(false)); |
| 187 | |
| 188 | log_syscxx . . $ log_sys..set_capacitycxx . . $ log_t#set_capacity(ced63f7c635d850d).(); |
| 189 | |
| 190 | stdcxx . . $ std/::stringcxx . . $ std/string# logfile0{get_log_file_pathcxx . . $ get_log_file_path(d06bf7adff8c4caf).("ib_logfile101")}; |
| 191 | bool ret; |
| 192 | os_file_tcxx . . $ os_file_t# file{ |
| 193 | os_file_create_funccxx . . $ os_file_create_func(dcffda9e86dd51f7).(logfile0.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(), |
| 194 | OS_FILE_CREATEcxx . . $ OS_FILE_CREATE., |
| 195 | OS_LOG_FILEcxx . . $ OS_LOG_FILE., false, &ret) |
| 196 | }; |
| 197 | |
| 198 | if (!ret) { |
| 199 | sql_print_errorcxx . . $ sql_print_error(326aeb464d16410c).("InnoDB: Cannot create %.*s", |
| 200 | int(logfile0.sizecxx . . $ std/__cxx11/basic_string#size(6f8bd5c0ea8fb29a).()), logfile0.datacxx . . $ std/__cxx11/basic_string#data(258ee1c9e0a18a5c).()); |
| 201 | err_exit: |
| 202 | log_syscxx . . $ log_sys..latchcxx . . $ log_t#latch..wr_unlockcxx . . $ ssux_lock_impl#wr_unlock(ced63f7c635d850d).(); |
| 203 | mysql_mutex_unlockcxx . . $ `include/mysql/psi/mysql_thread.h:391:11`!(&buf_pool.flush_list_mutex); |
| 204 | return DB_ERRORcxx . . $ DB_ERROR.; |
| 205 | } |
| 206 | |
| 207 | ret = os_file_set_sizecxx . . $ os_file_set_size(c5e330475387994b).(logfile0.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(), file, srv_log_file_sizecxx . . $ srv_log_file_size.); |
| 208 | if (!ret) { |
| 209 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "Cannot set log file " <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). logfile0 |
| 210 | <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). " size to " <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). ibcxx . . $ ib/bytes_iec#bytes_iec(891dc3055356b409).::bytes_ieccxx . . $ ib/bytes_iec#{srv_log_file_sizecxx . . $ srv_log_file_size.}; |
| 211 | close_and_exit: |
| 212 | os_file_close_funccxx . . $ os_file_close_func(83c267b20bac841a).(file); |
| 213 | goto err_exit; |
| 214 | } |
| 215 | |
| 216 | log_syscxx . . $ log_sys..set_latest_formatcxx . . $ log_t#set_latest_format(9f0ba574c1c44ffc).(srv_encrypt_logcxx . . $ srv_encrypt_log.); |
| 217 | if (!log_syscxx . . $ log_sys..attachcxx . . $ log_t#attach(a212f70c8100ed2f).(filecxx . . $ log_file_t#log_file_t(f349c77f591a7878)., srv_log_file_sizecxx . . $ srv_log_file_size.)) { |
| 218 | goto close_and_exit; |
| 219 | } |
| 220 | |
| 221 | /* Create a log checkpoint. */ |
| 222 | if (log_syscxx . . $ log_sys..is_encryptedcxx . . $ log_t#is_encrypted(3482b152b9333168).() && !log_crypt_initcxx . . $ log_crypt_init(c9857a73d68e59ba).()) { |
| 223 | goto err_exit; |
| 224 | } |
| 225 | ut_dcxx . . $ `storage/innobase/include/ut0dbg.h:68:9`!(recv_no_log_write = false); |
| 226 | log_syscxx . . $ log_sys..createcxx . . $ log_t#create(203741fbd813a59e).(lsn); |
| 227 | |
| 228 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(srv_startup_is_before_trx_rollback_phase); |
| 229 | if (create_new_db) { |
| 230 | srv_startup_is_before_trx_rollback_phasecxx . . $ srv_startup_is_before_trx_rollback_phase. = false; |
| 231 | } |
| 232 | |
| 233 | /* Enable log_checkpoint() in buf_flush_page_cleaner(). |
| 234 | If we are upgrading or resizing the log at startup, we must not |
| 235 | write any FILE_MODIFY or FILE_CHECKPOINT records to the old log file |
| 236 | because the ib_logfile0 could be in an old format that we can only |
| 237 | check for emptiness, or the write could lead to an overflow. |
| 238 | |
| 239 | At this point, we are not holding recv_sys.mutex, but there are no |
| 240 | pending page reads, and buf_pool.flush_list is empty. Therefore, |
| 241 | we can clear the flag without risking any race condition with |
| 242 | buf_page_t::read_complete(). */ |
| 243 | recv_syscxx . . $ recv_sys..recovery_oncxx . . $ recv_sys_t#recovery_on. =cxx . . $ Atomic_relaxed#`operator=`(ada6a8422704cf8a). false; |
| 244 | log_syscxx . . $ log_sys..latchcxx . . $ log_t#latch..wr_unlockcxx . . $ ssux_lock_impl#wr_unlock(ced63f7c635d850d).(); |
| 245 | mysql_mutex_unlockcxx . . $ `include/mysql/psi/mysql_thread.h:391:11`!(&buf_pool.flush_list_mutex); |
| 246 | |
| 247 | log_make_checkpointcxx . . $ log_make_checkpoint(ced63f7c635d850d).(); |
| 248 | |
| 249 | return DB_SUCCESScxx . . $ DB_SUCCESS.; |
| 250 | } |
| 251 | |
| 252 | /** Rename the redo log file after resizing. |
| 253 | @return whether an error occurred */ |
| 254 | bool log_tcxx . . $ log_t#::resize_renamecxx . . $ log_t#resize_rename(77ce49a7840d23c7).() noexcept |
| 255 | { |
| 256 | stdcxx . . $ std/::stringcxx . . $ std/string# old_name{get_log_file_pathcxx . . $ get_log_file_path(d06bf7adff8c4caf).("ib_logfile101")}; |
| 257 | stdcxx . . $ std/::stringcxx . . $ std/string# new_name{get_log_file_pathcxx . . $ get_log_file_path(d06bf7adff8c4caf).()}; |
| 258 | |
| 259 | if (IF_WINcxx . . $ `include/my_global.h:97:9`!(MoveFileEx(old_name.c_str(), new_name.c_str(), |
| 260 | MOVEFILE_REPLACE_EXISTING), |
| 261 | !rename(old_name.c_str(), new_name.c_str()))) |
| 262 | return false; |
| 263 | |
| 264 | sql_print_errorcxx . . $ sql_print_error(326aeb464d16410c).("InnoDB: Failed to rename log from %.*s to %.*s (error %d)", |
| 265 | int(old_name.sizecxx . . $ std/__cxx11/basic_string#size(6f8bd5c0ea8fb29a).()), old_name.datacxx . . $ std/__cxx11/basic_string#data(258ee1c9e0a18a5c).(), |
| 266 | int(new_name.sizecxx . . $ std/__cxx11/basic_string#size(6f8bd5c0ea8fb29a).()), new_name.datacxx . . $ std/__cxx11/basic_string#data(258ee1c9e0a18a5c).(), |
| 267 | IF_WINcxx . . $ `include/my_global.h:97:9`!(int(GetLastError()), errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!)); |
| 268 | return true; |
| 269 | } |
| 270 | |
| 271 | /** Create an undo tablespace file |
| 272 | @param[in] name file name |
| 273 | @return DB_SUCCESS or error code */ |
| 274 | static dberr_tcxx . . $ dberr_t# srv_undo_tablespace_createcxx . . $ srv_undo_tablespace_create(c53cb439c81747f).(const char* name) |
| 275 | { |
| 276 | pfs_os_file_tcxx . . $ pfs_os_file_t# fhcxx . . $ pfs_os_file_t#pfs_os_file_t(d4f767463ce0a6b3).; |
| 277 | bool ret; |
| 278 | dberr_tcxx . . $ dberr_t# err = DB_SUCCESScxx . . $ DB_SUCCESS.; |
| 279 | |
| 280 | os_file_create_subdirs_if_neededcxx . . $ os_file_create_subdirs_if_needed(810cb64731787954).(name); |
| 281 | |
| 282 | fh =cxx . . $ pfs_os_file_t#`operator=`(a945d8173081eda2). os_file_createcxx . . $ `storage/innobase/include/os0file.h:549:10`!( |
| 283 | innodb_data_file_key, |
| 284 | name, |
| 285 | srv_read_only_mode ? OS_FILE_OPEN : OS_FILE_CREATE, |
| 286 | OS_DATA_FILE, srv_read_only_mode, &ret); |
| 287 | |
| 288 | if (!ret) { |
| 289 | if (os_file_get_last_errorcxx . . $ os_file_get_last_error(19c5c1b41feeabaf).(false) != OS_FILE_ALREADY_EXISTScxx . . $ OS_FILE_ALREADY_EXISTS. |
| 290 | #ifdef _AIX |
| 291 | /* AIX 5.1 after security patch ML7 may have |
| 292 | errno set to 0 here, which causes our function |
| 293 | to return 100; work around that AIX problem */ |
| 294 | && os_file_get_last_error(false) != 100 |
| 295 | #endif |
| 296 | ) { |
| 297 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "Can't create UNDO tablespace " |
| 298 | <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). name; |
| 299 | } |
| 300 | err = DB_ERRORcxx . . $ DB_ERROR.; |
| 301 | } else if (srv_read_only_modecxx . . $ srv_read_only_mode.) { |
| 302 | ibcxx . . $ ib/::infocxx . . $ ib/info#() <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). name <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). " opened in read-only mode"; |
| 303 | } else { |
| 304 | /* We created the data file and now write it full of zeros */ |
| 305 | |
| 306 | ibcxx . . $ ib/::infocxx . . $ ib/info#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "Data file " <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). name <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). " did not exist: new to" |
| 307 | " be created"; |
| 308 | |
| 309 | ibcxx . . $ ib/::infocxx . . $ ib/info#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "Setting file " <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). name <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). " size to " |
| 310 | <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). ibcxx . . $ ib/bytes_iec#bytes_iec(891dc3055356b409).::bytes_ieccxx . . $ ib/bytes_iec#{SRV_UNDO_TABLESPACE_SIZE_IN_PAGEScxx . . $ SRV_UNDO_TABLESPACE_SIZE_IN_PAGES. |
| 311 | << srv_page_size_shiftcxx . . $ srv_page_size_shift.}; |
| 312 | |
| 313 | ibcxx . . $ ib/::infocxx . . $ ib/info#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "Database physically writes the file full: " |
| 314 | <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "wait..."; |
| 315 | |
| 316 | if (!os_file_set_sizecxx . . $ os_file_set_size(c5e330475387994b).(name, fh, os_offset_tcxx . . $ os_offset_t# |
| 317 | {SRV_UNDO_TABLESPACE_SIZE_IN_PAGEScxx . . $ SRV_UNDO_TABLESPACE_SIZE_IN_PAGES.} |
| 318 | << srv_page_size_shiftcxx . . $ srv_page_size_shift.)) { |
| 319 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "Unable to allocate " <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). name; |
| 320 | err = DB_ERRORcxx . . $ DB_ERROR.; |
| 321 | } |
| 322 | |
| 323 | os_file_closecxx . . $ `storage/innobase/include/os0file.h:565:10`!(fh); |
| 324 | } |
| 325 | |
| 326 | return(err); |
| 327 | } |
| 328 | |
| 329 | inline dberr_tcxx . . $ dberr_t# trx_sys_tcxx . . $ trx_sys_t#::reset_pagecxx . . $ trx_sys_t#reset_page(5ccbb810592e2a69).(mtr_tcxx . . $ mtr_t# *mtr) |
| 330 | { |
| 331 | dberr_tcxx . . $ dberr_t# err= DB_SUCCESScxx . . $ DB_SUCCESS.; |
| 332 | buf_block_tcxx . . $ buf_block_t# *sys_header= buf_page_get_gencxx . . $ buf_page_get_gen(4cc82125c68d4d05).( |
| 333 | page_id_tcxx . . $ page_id_t#page_id_t(b4d55b1286ff73e8).(TRX_SYS_SPACEcxx . . $ TRX_SYS_SPACE., TRX_SYS_PAGE_NOcxx . . $ `storage/innobase/include/trx0types.h:44:9`!), 0, RW_X_LATCHcxx . . $ RW_X_LATCH., nullptr, |
| 334 | BUF_GETcxx . . $ `storage/innobase/include/buf0buf.h:53:9`!, mtr, &err); |
| 335 | |
| 336 | if (!sys_header) return err; |
| 337 | |
| 338 | if (mach_read_from_4cxx . . $ mach_read_from_4(ca1608e2c87725e2).(sys_header->pagecxx . . $ buf_block_t#page..framecxx . . $ buf_page_t#frame. + TRX_SYScxx . . $ `storage/innobase/include/trx0sys.h:132:9`! + |
| 339 | TRX_SYS_FSEG_HEADERcxx . . $ `storage/innobase/include/trx0sys.h:143:9`!) != TRX_SYS_SPACEcxx . . $ TRX_SYS_SPACE.) |
| 340 | return DB_CORRUPTIONcxx . . $ DB_CORRUPTION.; |
| 341 | |
| 342 | /* Store the TRX_SYS_FSEG_HEADER page, offset */ |
| 343 | char fseg_addr[6]; |
| 344 | memcpy(fseg_addr, |
| 345 | sys_header->pagecxx . . $ buf_block_t#page..framecxx . . $ buf_page_t#frame. + TRX_SYScxx . . $ `storage/innobase/include/trx0sys.h:132:9`! + TRX_SYS_FSEG_HEADERcxx . . $ `storage/innobase/include/trx0sys.h:143:9`! + 4, 6); |
| 346 | |
| 347 | const bool dblwr_enabled= |
| 348 | mach_read_from_4cxx . . $ mach_read_from_4(ca1608e2c87725e2).(TRX_SYS_DOUBLEWRITE_MAGICcxx . . $ `storage/innobase/include/trx0sys.h:288:9`! + TRX_SYS_DOUBLEWRITEcxx . . $ `storage/innobase/include/trx0sys.h:283:9`! + |
| 349 | sys_header->pagecxx . . $ buf_block_t#page..framecxx . . $ buf_page_t#frame.) |
| 350 | == TRX_SYS_DOUBLEWRITE_MAGIC_Ncxx . . $ TRX_SYS_DOUBLEWRITE_MAGIC_N.; |
| 351 | |
| 352 | char doublewrite[TRX_SYS_DOUBLEWRITE_BLOCK2cxx . . $ `storage/innobase/include/trx0sys.h:300:9`! + 4]; |
| 353 | memcpy(doublewrite, TRX_SYS_DOUBLEWRITEcxx . . $ `storage/innobase/include/trx0sys.h:283:9`! + sys_header->pagecxx . . $ buf_block_t#page..framecxx . . $ buf_page_t#frame., |
| 354 | sizeof doublewrite); |
| 355 | |
| 356 | fsp_init_file_pagecxx . . $ `storage/innobase/include/fsp0fsp.h:562:10`!(fil_system.sys_space, sys_header, mtr); |
| 357 | |
| 358 | mtr->writecxx . . $ mtr_t#write(4888ddbfa94c5eeb).<2>(*sys_header, FIL_PAGE_TYPEcxx . . $ `storage/innobase/include/fil0fil.h:1215:9`! + sys_header->pagecxx . . $ buf_block_t#page..framecxx . . $ buf_page_t#frame., |
| 359 | FIL_PAGE_TYPE_TRX_SYScxx . . $ FIL_PAGE_TYPE_TRX_SYS.); |
| 360 | |
| 361 | DBUG_EXECUTE_IFcxx . . $ `include/my_dbug.h:172:9`!("sys_fseg_header_fail", |
| 362 | { |
| 363 | fseg_addr[4]= 0; |
| 364 | fseg_addr[5]= 0; |
| 365 | }); |
| 366 | |
| 367 | /** Write the TRX_SYS_FSEG_HEADER only if it is not zero-filled */ |
| 368 | if (!memcmp(fseg_addr + 4, "00", 2)) |
| 369 | mtr->memcpycxx . . $ mtr_t#memcpy(cacdda589782ca45).(*sys_header, |
| 370 | sys_header->pagecxx . . $ buf_block_t#page..framecxx . . $ buf_page_t#frame. + TRX_SYScxx . . $ `storage/innobase/include/trx0sys.h:132:9`! + TRX_SYS_FSEG_HEADERcxx . . $ `storage/innobase/include/trx0sys.h:143:9`! + 4, |
| 371 | fseg_addr, 6); |
| 372 | mtr->writecxx . . $ mtr_t#write(4888ddbfa94c5eeb).<4>(*sys_header, |
| 373 | TRX_SYScxx . . $ `storage/innobase/include/trx0sys.h:132:9`! + TRX_SYS_RSEGScxx . . $ `storage/innobase/include/trx0sys.h:146:9`! + TRX_SYS_RSEG_PAGE_NOcxx . . $ `storage/innobase/include/trx0sys.h:157:9`! + |
| 374 | sys_header->pagecxx . . $ buf_block_t#page..framecxx . . $ buf_page_t#frame., FSP_FIRST_RSEG_PAGE_NOcxx . . $ `storage/innobase/include/fsp0types.h:178:9`!); |
| 375 | mtr->memsetcxx . . $ mtr_t#memset(514fd140d769d0f8).(sys_header, |
| 376 | TRX_SYScxx . . $ `storage/innobase/include/trx0sys.h:132:9`! + TRX_SYS_RSEGScxx . . $ `storage/innobase/include/trx0sys.h:146:9`! + TRX_SYS_RSEG_SLOT_SIZEcxx . . $ `storage/innobase/include/trx0sys.h:159:9`!, |
| 377 | 254 * TRX_SYS_RSEG_SLOT_SIZEcxx . . $ `storage/innobase/include/trx0sys.h:159:9`!, 0xff); |
| 378 | |
| 379 | static_assert(TRX_SYS_RSEG_SLOT_SIZEcxx . . $ `storage/innobase/include/trx0sys.h:159:9`! == 8, ""); |
| 380 | |
| 381 | if (dblwr_enabled) |
| 382 | { |
| 383 | mtr->memcpycxx . . $ mtr_t#memcpy(cacdda589782ca45).( |
| 384 | *sys_header, sys_header->pagecxx . . $ buf_block_t#page..framecxx . . $ buf_page_t#frame. + TRX_SYS_DOUBLEWRITEcxx . . $ `storage/innobase/include/trx0sys.h:283:9`!, |
| 385 | doublewrite, sizeof doublewrite); |
| 386 | mtr->memmovecxx . . $ mtr_t#memmove(6b3ae618754b5d9e).( |
| 387 | *sys_header, |
| 388 | TRX_SYS_DOUBLEWRITEcxx . . $ `storage/innobase/include/trx0sys.h:283:9`! + FSEG_HEADER_SIZEcxx . . $ `storage/innobase/include/fsp0types.h:90:9`! + TRX_SYS_DOUBLEWRITE_REPEATcxx . . $ `storage/innobase/include/trx0sys.h:306:9`!, |
| 389 | TRX_SYS_DOUBLEWRITEcxx . . $ `storage/innobase/include/trx0sys.h:283:9`! + FSEG_HEADER_SIZEcxx . . $ `storage/innobase/include/fsp0types.h:90:9`!, 12); |
| 390 | memcpy( |
| 391 | sys_header->pagecxx . . $ buf_block_t#page..framecxx . . $ buf_page_t#frame. + TRX_SYS_DOUBLEWRITEcxx . . $ `storage/innobase/include/trx0sys.h:283:9`! |
| 392 | + FSEG_HEADER_SIZEcxx . . $ `storage/innobase/include/fsp0types.h:90:9`! + TRX_SYS_DOUBLEWRITE_REPEATcxx . . $ `storage/innobase/include/trx0sys.h:306:9`!, |
| 393 | sys_header->pagecxx . . $ buf_block_t#page..framecxx . . $ buf_page_t#frame. + TRX_SYS_DOUBLEWRITEcxx . . $ `storage/innobase/include/trx0sys.h:283:9`! + FSEG_HEADER_SIZEcxx . . $ `storage/innobase/include/fsp0types.h:90:9`!, 12); |
| 394 | mtr->writecxx . . $ mtr_t#write(4888ddbfa94c5eeb).<4>( |
| 395 | *sys_header, |
| 396 | TRX_SYS_DOUBLEWRITEcxx . . $ `storage/innobase/include/trx0sys.h:283:9`! + TRX_SYS_DOUBLEWRITE_SPACE_ID_STOREDcxx . . $ `storage/innobase/include/trx0sys.h:319:9`! + |
| 397 | sys_header->pagecxx . . $ buf_block_t#page..framecxx . . $ buf_page_t#frame., |
| 398 | TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED_Ncxx . . $ TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED_N.); |
| 399 | } |
| 400 | |
| 401 | return DB_SUCCESScxx . . $ DB_SUCCESS.; |
| 402 | } |
| 403 | |
| 404 | /** Recreate the undo log tablespaces */ |
| 405 | ATTRIBUTE_COLDcxx . . $ `include/my_compiler.h:166:10`! static dberr_tcxx . . $ dberr_t# srv_undo_tablespaces_reinitcxx . . $ srv_undo_tablespaces_reinit(629d9d73bf1a44e9).() |
| 406 | { |
| 407 | mtr_tcxx . . $ mtr_t# mtrcxx . . $ mtr_t#mtr_t(a6968fd0d8f26912).{nullptr}; |
| 408 | dberr_tcxx . . $ dberr_t# err; |
| 409 | buf_block_tcxx . . $ buf_block_t# *first_rseg_hdr; |
| 410 | uint32_tcxx . . $ uint32_t# latest_space_id; |
| 411 | |
| 412 | mtr.startcxx . . $ mtr_t#start(49f6e7a06ebc5aa8).(); |
| 413 | |
| 414 | buf_block_tcxx . . $ buf_block_t# *dict_hdr= buf_page_get_gencxx . . $ buf_page_get_gen(4cc82125c68d4d05).( |
| 415 | page_id_tcxx . . $ page_id_t#page_id_t(b4d55b1286ff73e8).(DICT_HDR_SPACEcxx . . $ `storage/innobase/include/dict0boot.h:71:9`!, DICT_HDR_PAGE_NOcxx . . $ `storage/innobase/include/dict0boot.h:72:9`!), 0, RW_X_LATCHcxx . . $ RW_X_LATCH., |
| 416 | nullptr, BUF_GETcxx . . $ `storage/innobase/include/buf0buf.h:53:9`!, &mtr, &err); |
| 417 | |
| 418 | if (!dict_hdr) |
| 419 | goto func_exit; |
| 420 | |
| 421 | /* Assign the new space id for the first undo tablespace */ |
| 422 | latest_space_id= mach_read_from_4cxx . . $ mach_read_from_4(ca1608e2c87725e2).( |
| 423 | DICT_HDRcxx . . $ `storage/innobase/include/dict0boot.h:83:9`! + DICT_HDR_MAX_SPACE_IDcxx . . $ `storage/innobase/include/dict0boot.h:90:9`! + dict_hdr->pagecxx . . $ buf_block_t#page..framecxx . . $ buf_page_t#frame.); |
| 424 | |
| 425 | if (latest_space_id + srv_undo_tablespacescxx . . $ srv_undo_tablespaces. > SRV_SPACE_ID_UPPER_BOUNDcxx . . $ SRV_SPACE_ID_UPPER_BOUND.) |
| 426 | { |
| 427 | err= DB_ERRORcxx . . $ DB_ERROR.; |
| 428 | sql_print_errorcxx . . $ sql_print_error(326aeb464d16410c).("InnoDB: Running out of tablespace id"); |
| 429 | goto func_exit; |
| 430 | } |
| 431 | |
| 432 | first_rseg_hdr= |
| 433 | buf_page_get_gencxx . . $ buf_page_get_gen(4cc82125c68d4d05).(trx_syscxx . . $ trx_sys..rseg_arraycxx . . $ trx_sys_t#rseg_array.[0].page_idcxx . . $ trx_rseg_t#page_id(bf57bd4462354dd6).(), 0, RW_X_LATCHcxx . . $ RW_X_LATCH., |
| 434 | nullptr, BUF_GETcxx . . $ `storage/innobase/include/buf0buf.h:53:9`!, &mtr, &err); |
| 435 | if (!first_rseg_hdr) |
| 436 | goto func_exit; |
| 437 | |
| 438 | if (UNIV_UNLIKELYcxx . . $ `storage/innobase/include/univ.i:439:9`!(mach_read_from_4(TRX_RSEGcxx . . $ `storage/innobase/include/trx0rseg.h:208:9`! + TRX_RSEG_FORMATcxx . . $ `storage/innobase/include/trx0rseg.h:213:9`! + |
| 439 | first_rseg_hdr->page.frame))) |
| 440 | trx_rseg_format_upgradecxx . . $ trx_rseg_format_upgrade(c4796673375b2726).(first_rseg_hdr, &mtr); |
| 441 | |
| 442 | mtr.writecxx . . $ mtr_t#write(4888ddbfa94c5eeb).<8,mtr_tcxx . . $ mtr_t#::MAYBE_NOPcxx . . $ mtr_t#MAYBE_NOP.>(*first_rseg_hdr, |
| 443 | TRX_RSEGcxx . . $ `storage/innobase/include/trx0rseg.h:208:9`! + TRX_RSEG_MAX_TRX_IDcxx . . $ `storage/innobase/include/trx0rseg.h:224:9`! + |
| 444 | first_rseg_hdr->pagecxx . . $ buf_block_t#page..framecxx . . $ buf_page_t#frame., |
| 445 | trx_syscxx . . $ trx_sys..get_max_trx_idcxx . . $ trx_sys_t#get_max_trx_id(f708dce9a8856c70).() - 1); |
| 446 | |
| 447 | /* Reset TRX_SYS page */ |
| 448 | err= trx_syscxx . . $ trx_sys..reset_pagecxx . . $ trx_sys_t#reset_page(5ccbb810592e2a69).(&mtr); |
| 449 | |
| 450 | if (err) |
| 451 | goto func_exit; |
| 452 | |
| 453 | if (srv_undo_tablespaces_opencxx . . $ srv_undo_tablespaces_open. == 0) |
| 454 | { |
| 455 | /* Free the system rollback segment */ |
| 456 | for (ulintcxx . . $ ulint# i= 1; i < TRX_SYS_N_RSEGScxx . . $ TRX_SYS_N_RSEGS.; i++) |
| 457 | { |
| 458 | trx_rseg_tcxx . . $ trx_rseg_t# *rseg= &trx_syscxx . . $ trx_sys..rseg_arraycxx . . $ trx_sys_t#rseg_array.[i]; |
| 459 | if (rseg->spacecxx . . $ trx_rseg_t#space. != fil_systemcxx . . $ fil_system..sys_spacecxx . . $ fil_system_t#sys_space.) |
| 460 | continue; |
| 461 | buf_block_tcxx . . $ buf_block_t# *block= buf_page_get_gencxx . . $ buf_page_get_gen(4cc82125c68d4d05).( |
| 462 | rseg->page_idcxx . . $ trx_rseg_t#page_id(bf57bd4462354dd6).(), 0, RW_X_LATCHcxx . . $ RW_X_LATCH., nullptr, BUF_GETcxx . . $ `storage/innobase/include/buf0buf.h:53:9`!, &mtr); |
| 463 | if (!block) break; |
| 464 | while (!fseg_free_stepcxx . . $ fseg_free_step(8fc797f7c0e1ec22).(block, TRX_RSEGcxx . . $ `storage/innobase/include/trx0rseg.h:208:9`! + TRX_RSEG_FSEG_HEADERcxx . . $ `storage/innobase/include/trx0rseg.h:218:9`!, &mtr)); |
| 465 | } |
| 466 | } |
| 467 | |
| 468 | for (ulintcxx . . $ ulint# rseg_id= 1; rseg_id < TRX_SYS_N_RSEGScxx . . $ TRX_SYS_N_RSEGS.; rseg_id++) |
| 469 | { |
| 470 | trx_rseg_tcxx . . $ trx_rseg_t# *rseg= &trx_syscxx . . $ trx_sys..rseg_arraycxx . . $ trx_sys_t#rseg_array.[rseg_id]; |
| 471 | rseg->destroycxx . . $ trx_rseg_t#destroy(49f6e7a06ebc5aa8).(); |
| 472 | rseg->initcxx . . $ trx_rseg_t#init(9b026bbe728f3d55).(nullptr, FIL_NULLcxx . . $ `storage/innobase/include/fil0fil.h:1175:9`!); |
| 473 | } |
| 474 | |
| 475 | if (*trx_syscxx . . $ trx_sys..recovered_binlog_filenamecxx . . $ trx_sys_t#recovered_binlog_filename. |
| 476 | #ifdef WITH_WSREPcxx . . $ `/build/tmp.NxIY9EeyJN/package/build/include/my_config.h:539:9`! |
| 477 | || !trx_syscxx . . $ trx_sys..recovered_wsrep_xidcxx . . $ trx_sys_t#recovered_wsrep_xid..is_nullcxx . . $ xid_t#is_null(50ce9a9e25b4a850).() |
| 478 | #endif /* WITH_WSREP */ |
| 479 | ) |
| 480 | { |
| 481 | /* Update binlog offset, binlog file name & wsrep xid in |
| 482 | system tablespace rollback segment */ |
| 483 | if (*trx_syscxx . . $ trx_sys..recovered_binlog_filenamecxx . . $ trx_sys_t#recovered_binlog_filename.) |
| 484 | { |
| 485 | ut_dcxx . . $ `storage/innobase/include/ut0dbg.h:68:9`!(const size_t len = strlen(trx_sys.recovered_binlog_filename) + 1); |
| 486 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(len > 1); |
| 487 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(len <= TRX_RSEG_BINLOG_NAME_LEN); |
| 488 | trx_rseg_update_binlog_offsetcxx . . $ trx_rseg_update_binlog_offset(f30604bdcff3669a).( |
| 489 | first_rseg_hdr, trx_syscxx . . $ trx_sys..recovered_binlog_filenamecxx . . $ trx_sys_t#recovered_binlog_filename., |
| 490 | trx_syscxx . . $ trx_sys..recovered_binlog_offsetcxx . . $ trx_sys_t#recovered_binlog_offset., &mtr); |
| 491 | } |
| 492 | |
| 493 | #ifdef WITH_WSREPcxx . . $ `/build/tmp.NxIY9EeyJN/package/build/include/my_config.h:539:9`! |
| 494 | if (!trx_syscxx . . $ trx_sys..recovered_wsrep_xidcxx . . $ trx_sys_t#recovered_wsrep_xid..is_nullcxx . . $ xid_t#is_null(50ce9a9e25b4a850).()) |
| 495 | trx_rseg_update_wsrep_checkpointcxx . . $ trx_rseg_update_wsrep_checkpoint(f0606f2b5f242699).( |
| 496 | first_rseg_hdr, &trx_syscxx . . $ trx_sys..recovered_wsrep_xidcxx . . $ trx_sys_t#recovered_wsrep_xid., &mtr); |
| 497 | #endif /* WITH_WSREP */ |
| 498 | } |
| 499 | |
| 500 | dict_hdr->pagecxx . . $ buf_block_t#page..fixcxx . . $ buf_page_t#fix(6e3776fd289463bb).(); |
| 501 | |
| 502 | mtr.commitcxx . . $ mtr_t#commit(49f6e7a06ebc5aa8).(); |
| 503 | |
| 504 | DBUG_EXECUTE_IFcxx . . $ `include/my_dbug.h:172:9`!("after_rseg_reset_abort", |
| 505 | log_write_up_to(mtr.commit_lsn(), true); |
| 506 | err= DB_ERROR; goto unfix_exit;); |
| 507 | |
| 508 | log_make_checkpointcxx . . $ log_make_checkpoint(ced63f7c635d850d).(); |
| 509 | |
| 510 | sql_print_informationcxx . . $ sql_print_information(326aeb464d16410c).( |
| 511 | "InnoDB: Reinitializing innodb_undo_tablespaces= %u from %u", |
| 512 | srv_undo_tablespacescxx . . $ srv_undo_tablespaces., srv_undo_tablespaces_opencxx . . $ srv_undo_tablespaces_open.); |
| 513 | |
| 514 | /* Delete the old undo tablespaces */ |
| 515 | for (uint32_tcxx . . $ uint32_t# i= 0; i < srv_undo_tablespaces_opencxx . . $ srv_undo_tablespaces_open.; ++i) |
| 516 | fil_close_tablespacecxx . . $ fil_close_tablespace(6bab9b75950d6f3).(srv_undo_space_id_startcxx . . $ srv_undo_space_id_start. + i); |
| 517 | |
| 518 | DBUG_EXECUTE_IFcxx . . $ `include/my_dbug.h:172:9`!("after_deleting_old_undo_abort", |
| 519 | err= DB_ERROR; goto unfix_exit;); |
| 520 | |
| 521 | /* Do checkpoint to get rid of old undo log tablespaces redo logs */ |
| 522 | log_make_checkpointcxx . . $ log_make_checkpoint(ced63f7c635d850d).(); |
| 523 | |
| 524 | DBUG_EXECUTE_IFcxx . . $ `include/my_dbug.h:172:9`!("after_deleting_old_undo_success", |
| 525 | err= DB_ERROR; goto unfix_exit;); |
| 526 | |
| 527 | if (srv_undo_tablespacescxx . . $ srv_undo_tablespaces. == 0) |
| 528 | { |
| 529 | srv_undo_space_id_startcxx . . $ srv_undo_space_id_start.= 0; |
| 530 | srv_undo_tablespaces_opencxx . . $ srv_undo_tablespaces_open.= 0; |
| 531 | srv_undo_tablespaces_activecxx . . $ srv_undo_tablespaces_active.= 0; |
| 532 | #ifndef DBUG_OFFcxx . . $ `<built-in>:492:9`! |
| 533 | unfix_exit: |
| 534 | #endif |
| 535 | dict_hdr->pagecxx . . $ buf_block_t#page..unfixcxx . . $ buf_page_t#unfix(2658d6455debfaef).(); |
| 536 | return err; |
| 537 | } |
| 538 | |
| 539 | mtr.startcxx . . $ mtr_t#start(49f6e7a06ebc5aa8).(); |
| 540 | |
| 541 | dict_hdr->pagecxx . . $ buf_block_t#page..lockcxx . . $ buf_page_t#lock..x_lockcxx . . $ sux_lock#x_lock(b45ddcbc8423892c).(); |
| 542 | mtr.memo_pushcxx . . $ mtr_t#memo_push(1e7bab2d46fcb4c1).(dict_hdr, MTR_MEMO_PAGE_X_FIXcxx . . $ MTR_MEMO_PAGE_X_FIX.); |
| 543 | |
| 544 | srv_undo_space_id_startcxx . . $ srv_undo_space_id_start.= latest_space_id; |
| 545 | if (fil_assign_new_space_idcxx . . $ fil_assign_new_space_id(f4db574767150238).(&srv_undo_space_id_startcxx . . $ srv_undo_space_id_start.)) |
| 546 | mtr.writecxx . . $ mtr_t#write(4888ddbfa94c5eeb).<4>(*dict_hdr, DICT_HDRcxx . . $ `storage/innobase/include/dict0boot.h:83:9`! + DICT_HDR_MAX_SPACE_IDcxx . . $ `storage/innobase/include/dict0boot.h:90:9`! + |
| 547 | dict_hdr->pagecxx . . $ buf_block_t#page..framecxx . . $ buf_page_t#frame., srv_undo_space_id_startcxx . . $ srv_undo_space_id_start.); |
| 548 | |
| 549 | /* Re-create the new undo tablespaces */ |
| 550 | err= srv_undo_tablespaces_initcxx . . $ srv_undo_tablespaces_init(6d2923315c0e5618).(true, &mtr); |
| 551 | func_exit: |
| 552 | mtr.commitcxx . . $ mtr_t#commit(49f6e7a06ebc5aa8).(); |
| 553 | |
| 554 | if (err == DB_SUCCESScxx . . $ DB_SUCCESS.) |
| 555 | { |
| 556 | /* Usually, recovery must work no matter when |
| 557 | log_checkpoints are triggered. This is a special case, |
| 558 | because this code is executed as part of InnoDB startup. |
| 559 | Backup requires that the server has been started up, |
| 560 | backup should never observe the log records that |
| 561 | were written in mtr and also srv_undo_tablespaces_init() |
| 562 | initializes the undo tablespace start id based on page0 |
| 563 | content before reading the redo log */ |
| 564 | srv_undo_tablespaces_activecxx . . $ srv_undo_tablespaces_active.= srv_undo_tablespacescxx . . $ srv_undo_tablespaces.; |
| 565 | log_make_checkpointcxx . . $ log_make_checkpoint(ced63f7c635d850d).(); |
| 566 | } |
| 567 | return err; |
| 568 | } |
| 569 | |
| 570 | /** Reinitialize the undo tablespaces when there is no undo log |
| 571 | left to purge/rollback and validate the number of undo opened |
| 572 | undo tablespace and user given undo tablespace |
| 573 | @return DB_SUCCESS if it is valid */ |
| 574 | static dberr_tcxx . . $ dberr_t# srv_undo_tablespaces_reinitializecxx . . $ srv_undo_tablespaces_reinitialize(629d9d73bf1a44e9).() |
| 575 | { |
| 576 | |
| 577 | /* Re-create the undo tablespaces if it has no undo logs |
| 578 | left to purge/rollback */ |
| 579 | if (srv_undo_tablespacescxx . . $ srv_undo_tablespaces. != srv_undo_tablespaces_opencxx . . $ srv_undo_tablespaces_open. && |
| 580 | trx_syscxx . . $ trx_sys..is_undo_emptycxx . . $ trx_sys_t#is_undo_empty(50ce9a9e25b4a850).()) |
| 581 | return srv_undo_tablespaces_reinitcxx . . $ srv_undo_tablespaces_reinit(629d9d73bf1a44e9).(); |
| 582 | |
| 583 | /* If the user says that there are fewer than what we find we |
| 584 | tolerate that discrepancy but not the inverse. Because there could |
| 585 | be unused undo tablespaces for future use. */ |
| 586 | |
| 587 | if (srv_undo_tablespacescxx . . $ srv_undo_tablespaces. != srv_undo_tablespaces_opencxx . . $ srv_undo_tablespaces_open.) |
| 588 | { |
| 589 | sql_print_warningcxx . . $ sql_print_warning(326aeb464d16410c).("InnoDB: Cannot change innodb_undo_tablespaces=%u " |
| 590 | "because previous shutdown was not with " |
| 591 | "innodb_fast_shutdown=0", srv_undo_tablespacescxx . . $ srv_undo_tablespaces.); |
| 592 | srv_undo_tablespacescxx . . $ srv_undo_tablespaces.= srv_undo_tablespaces_opencxx . . $ srv_undo_tablespaces_open.; |
| 593 | } |
| 594 | else if (srv_undo_tablespaces_opencxx . . $ srv_undo_tablespaces_open. > 0) |
| 595 | sql_print_informationcxx . . $ sql_print_information(326aeb464d16410c).("InnoDB: Opened " UINT32PFcxx . . $ `storage/innobase/include/univ.i:312:10`! " undo tablespaces", |
| 596 | srv_undo_tablespaces_opencxx . . $ srv_undo_tablespaces_open.); |
| 597 | |
| 598 | return DB_SUCCESScxx . . $ DB_SUCCESS.; |
| 599 | } |
| 600 | |
| 601 | /** @return the number of active undo tablespaces (except system tablespace) */ |
| 602 | static uint32_tcxx . . $ uint32_t# trx_rseg_get_n_undo_tablespacescxx . . $ trx_rseg_get_n_undo_tablespaces(db52760e79bf9054).() |
| 603 | { |
| 604 | stdcxx . . $ std/::setcxx . . $ std/set#<uint32_tcxx . . $ uint32_t#> space_idscxx . . $ std/set#set(49f6e7a06ebc5aa8).; |
| 605 | mtr_tcxx . . $ mtr_t# mtrcxx . . $ mtr_t#mtr_t(a6968fd0d8f26912).{nullptr}; |
| 606 | mtr.startcxx . . $ mtr_t#start(49f6e7a06ebc5aa8).(); |
| 607 | |
| 608 | if (const buf_block_tcxx . . $ buf_block_t# *sys_header= |
| 609 | recv_syscxx . . $ recv_sys..recovercxx . . $ recv_sys_t#recover(f8d552174319aa25).({cxx . . $ page_id_t#page_id_t(b4d55b1286ff73e8).TRX_SYS_SPACEcxx . . $ TRX_SYS_SPACE., TRX_SYS_PAGE_NOcxx . . $ `storage/innobase/include/trx0types.h:44:9`!}, &mtr, nullptr)) |
| 610 | for (ulintcxx . . $ ulint# rseg_id= 0; rseg_id < TRX_SYS_N_RSEGScxx . . $ TRX_SYS_N_RSEGS.; rseg_id++) |
| 611 | if (trx_sysf_rseg_get_page_nocxx . . $ trx_sysf_rseg_get_page_no(8bf97e93036f040c).(sys_header, rseg_id) != FIL_NULLcxx . . $ `storage/innobase/include/fil0fil.h:1175:9`!) |
| 612 | if (uint32_tcxx . . $ uint32_t# space= trx_sysf_rseg_get_spacecxx . . $ trx_sysf_rseg_get_space(8bf97e93036f040c).(sys_header, rseg_id)) |
| 613 | space_ids.insertcxx . . $ std/set#insert(411a10a755068dfe).(space); |
| 614 | mtr.commitcxx . . $ mtr_t#commit(49f6e7a06ebc5aa8).(); |
| 615 | return static_cast<uint32_tcxx . . $ uint32_t#>(space_ids.sizecxx . . $ std/set#size(fa801f5ac5d26b4e).()); |
| 616 | } |
| 617 | |
| 618 | /** Open an undo tablespace. |
| 619 | @param[in] create whether undo tablespaces are being created |
| 620 | @param[in] name tablespace file name |
| 621 | @param[in] i undo tablespace count |
| 622 | @return undo tablespace identifier |
| 623 | @retval 0 if file doesn't exist |
| 624 | @retval ~0U if page0 is corrupted */ |
| 625 | static uint32_tcxx . . $ uint32_t# srv_undo_tablespace_opencxx . . $ srv_undo_tablespace_open(93cc4506e5f74ffc).(bool create, const char* name, |
| 626 | uint32_tcxx . . $ uint32_t# i) |
| 627 | { |
| 628 | bool success; |
| 629 | uint32_tcxx . . $ uint32_t# space_id= 0; |
| 630 | uint32_tcxx . . $ uint32_t# fsp_flags= 0; |
| 631 | |
| 632 | if (create) |
| 633 | { |
| 634 | space_id= srv_undo_space_id_startcxx . . $ srv_undo_space_id_start. + i; |
| 635 | switch (srv_checksum_algorithmcxx . . $ srv_checksum_algorithm.) { |
| 636 | case SRV_CHECKSUM_ALGORITHM_FULL_CRC32cxx . . $ SRV_CHECKSUM_ALGORITHM_FULL_CRC32.: |
| 637 | case SRV_CHECKSUM_ALGORITHM_STRICT_FULL_CRC32cxx . . $ SRV_CHECKSUM_ALGORITHM_STRICT_FULL_CRC32.: |
| 638 | fsp_flags= FSP_FLAGS_FCRC32_MASK_MARKERcxx . . $ `storage/innobase/include/fsp0types.h:344:9`! | FSP_FLAGS_FCRC32_PAGE_SSIZEcxx . . $ `storage/innobase/include/fsp0fsp.h:51:9`!(); |
| 639 | break; |
| 640 | default: |
| 641 | fsp_flags= FSP_FLAGS_PAGE_SSIZEcxx . . $ `storage/innobase/include/fsp0fsp.h:44:9`!(); |
| 642 | } |
| 643 | } |
| 644 | |
| 645 | pfs_os_file_tcxx . . $ pfs_os_file_t# fh= os_file_createcxx . . $ `storage/innobase/include/os0file.h:549:10`!(innodb_data_file_key, name, |
| 646 | OS_FILE_OPEN_SILENT, |
| 647 | OS_DATA_FILE, |
| 648 | srv_read_only_mode, &success); |
| 649 | |
| 650 | if (!success) |
| 651 | return 0; |
| 652 | |
| 653 | ulintcxx . . $ ulint# n_retries = 5; |
| 654 | os_offset_tcxx . . $ os_offset_t# size= os_file_get_sizecxx . . $ os_file_get_size(a516d6ace67a1470).(fh); |
| 655 | ut_acxx . . $ `storage/innobase/include/ut0dbg.h:50:9`!(size != os_offset_t(-1)); |
| 656 | page_tcxx . . $ `storage/innobase/include/page0types.h:38:9`! *apage= nullptr; |
| 657 | const page_tcxx . . $ `storage/innobase/include/page0types.h:38:9`! *page= nullptr; |
| 658 | |
| 659 | if (!create) |
| 660 | { |
| 661 | apage= static_cast<bytecxx . . $ byte#*>(aligned_malloccxx . . $ aligned_malloc(63a7bf2941bfcd7a).(srv_page_sizecxx . . $ srv_page_size., srv_page_sizecxx . . $ srv_page_size.)); |
| 662 | undo_retry: |
| 663 | if (os_file_readcxx . . $ `storage/innobase/include/os0file.h:568:10`!(IORequestRead, fh, apage, 0, srv_page_size, nullptr) != |
| 664 | DB_SUCCESScxx . . $ DB_SUCCESS.) |
| 665 | { |
| 666 | err_exit: |
| 667 | if (n_retries && srv_operationcxx . . $ srv_operation. == SRV_OPERATION_BACKUPcxx . . $ SRV_OPERATION_BACKUP.) |
| 668 | { |
| 669 | sql_print_informationcxx . . $ sql_print_information(326aeb464d16410c).("InnoDB: Retrying to read undo " |
| 670 | "tablespace %s", name); |
| 671 | n_retries--; |
| 672 | goto undo_retry; |
| 673 | } |
| 674 | sql_print_errorcxx . . $ sql_print_error(326aeb464d16410c).("InnoDB: Unable to read first page of file %s", name); |
| 675 | aligned_freecxx . . $ aligned_free(5d22bdacc48458e8).(apage); |
| 676 | return ~0U; |
| 677 | } |
| 678 | |
| 679 | page= apage; |
| 680 | DBUG_EXECUTE_IFcxx . . $ `include/my_dbug.h:172:9`!("undo_space_read_fail", goto err_exit;); |
| 681 | |
| 682 | uint32_tcxx . . $ uint32_t# id= mach_read_from_4cxx . . $ mach_read_from_4(ca1608e2c87725e2).(FIL_PAGE_SPACE_IDcxx . . $ `storage/innobase/include/fil0fil.h:1247:9`! + page); |
| 683 | if (id == 0 || id >= SRV_SPACE_ID_UPPER_BOUNDcxx . . $ SRV_SPACE_ID_UPPER_BOUND. || |
| 684 | memcmp_alignedcxx . . $ memcmp_aligned(36f949851efa3055).<2>(FIL_PAGE_SPACE_IDcxx . . $ `storage/innobase/include/fil0fil.h:1247:9`! + page, |
| 685 | FSP_HEADER_OFFSETcxx . . $ `storage/innobase/include/fsp0fsp.h:102:9`! + FSP_SPACE_IDcxx . . $ `storage/innobase/include/fsp0fsp.h:115:9`! + page, 4)) |
| 686 | { |
| 687 | sql_print_errorcxx . . $ sql_print_error(326aeb464d16410c).("InnoDB: Inconsistent tablespace ID in file %s", name); |
| 688 | goto err_exit; |
| 689 | } |
| 690 | |
| 691 | space_id= id; |
| 692 | fsp_flags= mach_read_from_4cxx . . $ mach_read_from_4(ca1608e2c87725e2).(FSP_HEADER_OFFSETcxx . . $ `storage/innobase/include/fsp0fsp.h:102:9`! + FSP_SPACE_FLAGScxx . . $ `storage/innobase/include/fsp0fsp.h:132:9`! + page); |
| 693 | |
| 694 | if (buf_page_is_corruptedcxx . . $ buf_page_is_corrupted(714b375f2102dbcf).(false, page, fsp_flags)) |
| 695 | { |
| 696 | page= recv_syscxx . . $ recv_sys..dblwrcxx . . $ recv_sys_t#dblwr..find_pagecxx . . $ recv_dblwr_t#find_page(4b0b53387b33bea6).(page_id_tcxx . . $ page_id_t#page_id_t(b4d55b1286ff73e8).{space_id, 0}, LSN_MAXcxx . . $ `storage/innobase/include/log0types.h:34:9`!); |
| 697 | if (!page) |
| 698 | { |
| 699 | /* If the first page of the given user tablespace is not there |
| 700 | in the doublewrite buffer, then the recovery is going to fail |
| 701 | now. Report error only when doublewrite buffer is not empty */ |
| 702 | sql_print_errorcxx . . $ sql_print_error(326aeb464d16410c).("InnoDB: Corrupted page " |
| 703 | "[page id: space=" UINT32PFcxx . . $ `storage/innobase/include/univ.i:312:10`! ", page number=0]" |
| 704 | " of datafile '%s' could not be found" |
| 705 | " in the doublewrite buffer", space_id, name); |
| 706 | goto err_exit; |
| 707 | } |
| 708 | |
| 709 | fsp_flags= mach_read_from_4cxx . . $ mach_read_from_4(ca1608e2c87725e2).(FSP_HEADER_OFFSETcxx . . $ `storage/innobase/include/fsp0fsp.h:102:9`! + FSP_SPACE_FLAGScxx . . $ `storage/innobase/include/fsp0fsp.h:132:9`! + page); |
| 710 | } |
| 711 | } |
| 712 | |
| 713 | /* Load the tablespace into InnoDB's internal data structures. */ |
| 714 | |
| 715 | /* We set the biggest space id to the undo tablespace |
| 716 | because InnoDB hasn't opened any other tablespace apart |
| 717 | from the system tablespace. */ |
| 718 | |
| 719 | fil_set_max_space_id_if_biggercxx . . $ fil_set_max_space_id_if_bigger(6bab9b75950d6f3).(space_id); |
| 720 | |
| 721 | mysql_mutex_lockcxx . . $ `include/mysql/psi/mysql_thread.h:360:11`!(&fil_system.mutex); |
| 722 | fil_space_tcxx . . $ fil_space_t# *space= fil_space_tcxx . . $ fil_space_t#::createcxx . . $ fil_space_t#create(cde1c5f51b8ca16c).(space_id, fsp_flags, false, nullptr, |
| 723 | FIL_ENCRYPTION_DEFAULTcxx . . $ FIL_ENCRYPTION_DEFAULT., true); |
| 724 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(space); |
| 725 | fil_node_tcxx . . $ fil_node_t# *file= space->addcxx . . $ fil_space_t#add(6a6aa7e3155b8dbc).(name, fh, 0, false, true); |
| 726 | |
| 727 | if (create) |
| 728 | { |
| 729 | space->set_sizescxx . . $ fil_space_t#set_sizes(6bab9b75950d6f3).(SRV_UNDO_TABLESPACE_SIZE_IN_PAGEScxx . . $ SRV_UNDO_TABLESPACE_SIZE_IN_PAGES.); |
| 730 | space->sizecxx . . $ fil_space_t#size.= file->sizecxx . . $ fil_node_t#size.= uint32_tcxx . . $ uint32_t#(size >> srv_page_size_shiftcxx . . $ srv_page_size_shift.); |
| 731 | } |
| 732 | else if (!file->read_page0cxx . . $ fil_node_t#read_page0(dc35541a7e0d3731).(page, true)) |
| 733 | { |
| 734 | os_file_closecxx . . $ `storage/innobase/include/os0file.h:565:10`!(file->handle); |
| 735 | file->handlecxx . . $ fil_node_t#handle.=cxx . . $ pfs_os_file_t#`operator=`(d4f767463ce0a6b3). OS_FILE_CLOSEDcxx . . $ OS_FILE_CLOSED.; |
| 736 | ut_acxx . . $ `storage/innobase/include/ut0dbg.h:50:9`!(fil_system.n_open > 0); |
| 737 | fil_systemcxx . . $ fil_system..n_opencxx . . $ fil_system_t#n_open.--; |
| 738 | } |
| 739 | |
| 740 | mysql_mutex_unlockcxx . . $ `include/mysql/psi/mysql_thread.h:391:11`!(&fil_system.mutex); |
| 741 | aligned_freecxx . . $ aligned_free(5d22bdacc48458e8).(apage); |
| 742 | return space_id; |
| 743 | } |
| 744 | |
| 745 | /** Check if undo tablespaces and redo log files exist before creating a |
| 746 | new system tablespace |
| 747 | @retval DB_SUCCESS if all undo and redo logs are not found |
| 748 | @retval DB_ERROR if any undo and redo logs are found */ |
| 749 | static |
| 750 | dberr_tcxx . . $ dberr_t# |
| 751 | srv_check_undo_redo_logs_existscxx . . $ srv_check_undo_redo_logs_exists(629d9d73bf1a44e9).() |
| 752 | { |
| 753 | bool ret; |
| 754 | os_file_tcxx . . $ os_file_t# fh; |
| 755 | char name[OS_FILE_MAX_PATHcxx . . $ `storage/innobase/include/os0file.h:307:9`!]; |
| 756 | |
| 757 | /* Check if any undo tablespaces exist */ |
| 758 | for (ulintcxx . . $ ulint# i = 1; i <= srv_undo_tablespacescxx . . $ srv_undo_tablespaces.; ++i) { |
| 759 | |
| 760 | snprintf(name, sizeof name, "%s/undo%03zu", srv_undo_dircxx . . $ srv_undo_dir., i); |
| 761 | |
| 762 | fh = os_file_create_funccxx . . $ os_file_create_func(dcffda9e86dd51f7).( |
| 763 | name, |
| 764 | OS_FILE_OPEN_RETRY_SILENTcxx . . $ OS_FILE_OPEN_RETRY_SILENT., |
| 765 | OS_DATA_FILEcxx . . $ OS_DATA_FILE., |
| 766 | srv_read_only_modecxx . . $ srv_read_only_mode., |
| 767 | &ret); |
| 768 | |
| 769 | if (ret) { |
| 770 | os_file_close_funccxx . . $ os_file_close_func(83c267b20bac841a).(fh); |
| 771 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() |
| 772 | <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "undo tablespace '" <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). name <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "' exists." |
| 773 | " Creating system tablespace with existing undo" |
| 774 | " tablespaces is not supported. Please delete" |
| 775 | " all undo tablespaces before creating new" |
| 776 | " system tablespace."; |
| 777 | return(DB_ERRORcxx . . $ DB_ERROR.); |
| 778 | } |
| 779 | } |
| 780 | |
| 781 | /* Check if redo log file exists */ |
| 782 | auto logfilename = get_log_file_pathcxx . . $ get_log_file_path(d06bf7adff8c4caf).(); |
| 783 | |
| 784 | fh = os_file_create_funccxx . . $ os_file_create_func(dcffda9e86dd51f7).(logfilename.c_strcxx . . $ std/__cxx11/basic_string#c_str(8e614c7de0b1573e).(), |
| 785 | OS_FILE_OPEN_RETRY_SILENTcxx . . $ OS_FILE_OPEN_RETRY_SILENT., |
| 786 | OS_LOG_FILEcxx . . $ OS_LOG_FILE., |
| 787 | srv_read_only_modecxx . . $ srv_read_only_mode., &ret); |
| 788 | |
| 789 | if (ret) { |
| 790 | os_file_close_funccxx . . $ os_file_close_func(83c267b20bac841a).(fh); |
| 791 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "redo log file '" <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). logfilename |
| 792 | <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "' exists. Creating system tablespace with" |
| 793 | " existing redo log file is not recommended." |
| 794 | " Please delete redo log file before" |
| 795 | " creating new system tablespace."; |
| 796 | return DB_ERRORcxx . . $ DB_ERROR.; |
| 797 | } |
| 798 | |
| 799 | return(DB_SUCCESScxx . . $ DB_SUCCESS.); |
| 800 | } |
| 801 | |
| 802 | static dberr_tcxx . . $ dberr_t# srv_all_undo_tablespaces_opencxx . . $ srv_all_undo_tablespaces_open(5bbffe166ced5302).(bool create_new_undo, |
| 803 | uint32_tcxx . . $ uint32_t# n_undo) |
| 804 | { |
| 805 | /* Open all the undo tablespaces that are currently in use. If we |
| 806 | fail to open any of these it is a fatal error. The tablespace ids |
| 807 | should be contiguous. It is a fatal error because they are required |
| 808 | for recovery and are referenced by the UNDO logs (a.k.a RBS). */ |
| 809 | |
| 810 | uint32_tcxx . . $ uint32_t# prev_id= create_new_undo ? srv_undo_space_id_startcxx . . $ srv_undo_space_id_start. - 1 : 0; |
| 811 | |
| 812 | for (uint32_tcxx . . $ uint32_t# i= 0; i < n_undo; ++i) |
| 813 | { |
| 814 | char name[OS_FILE_MAX_PATHcxx . . $ `storage/innobase/include/os0file.h:307:9`!]; |
| 815 | snprintf(name, sizeof name, "%s/undo%03u", srv_undo_dircxx . . $ srv_undo_dir., i + 1); |
| 816 | uint32_tcxx . . $ uint32_t# space_id= srv_undo_tablespace_opencxx . . $ srv_undo_tablespace_open(93cc4506e5f74ffc).(create_new_undo, name, i); |
| 817 | switch (space_id) { |
| 818 | case ~0U: |
| 819 | return DB_CORRUPTIONcxx . . $ DB_CORRUPTION.; |
| 820 | case 0: |
| 821 | if (!create_new_undo) |
| 822 | goto unused_undo; |
| 823 | sql_print_errorcxx . . $ sql_print_error(326aeb464d16410c).("InnoDB: Unable to open create tablespace '%s'.", name); |
| 824 | return DB_ERRORcxx . . $ DB_ERROR.; |
| 825 | default: |
| 826 | /* Should be no gaps in undo tablespace ids. */ |
| 827 | ut_acxx . . $ `storage/innobase/include/ut0dbg.h:50:9`!(!i || prev_id + 1 == space_id); |
| 828 | } |
| 829 | |
| 830 | prev_id= space_id; |
| 831 | |
| 832 | /* Note the first undo tablespace id in case of |
| 833 | no active undo tablespace. */ |
| 834 | if (0 == srv_undo_tablespaces_opencxx . . $ srv_undo_tablespaces_open.++) |
| 835 | srv_undo_space_id_startcxx . . $ srv_undo_space_id_start.= space_id; |
| 836 | } |
| 837 | |
| 838 | /* Open any extra unused undo tablespaces. These must be contiguous. |
| 839 | We stop at the first failure. These are undo tablespaces that are |
| 840 | not in use and therefore not required by recovery. We only check |
| 841 | that there are no gaps. */ |
| 842 | unused_undo: |
| 843 | for (uint32_tcxx . . $ uint32_t# i= prev_id + 1; i < srv_undo_space_id_startcxx . . $ srv_undo_space_id_start. + TRX_SYS_N_RSEGScxx . . $ TRX_SYS_N_RSEGS.; |
| 844 | ++i) |
| 845 | { |
| 846 | char name[OS_FILE_MAX_PATHcxx . . $ `storage/innobase/include/os0file.h:307:9`!]; |
| 847 | snprintf(name, sizeof name, "%s/undo%03u", srv_undo_dircxx . . $ srv_undo_dir., i); |
| 848 | uint32_tcxx . . $ uint32_t# space_id= srv_undo_tablespace_opencxx . . $ srv_undo_tablespace_open(93cc4506e5f74ffc).(false, name, i); |
| 849 | if (!space_id || space_id == ~0U) |
| 850 | break; |
| 851 | if (0 == srv_undo_tablespaces_opencxx . . $ srv_undo_tablespaces_open.++) |
| 852 | srv_undo_space_id_startcxx . . $ srv_undo_space_id_start.= space_id; |
| 853 | } |
| 854 | |
| 855 | return DB_SUCCESScxx . . $ DB_SUCCESS.; |
| 856 | } |
| 857 | |
| 858 | PRAGMA_DISABLE_CHECK_STACK_FRAMEcxx . . $ `include/my_attribute.h:87:9`! |
| 859 | |
| 860 | /** Open the configured number of dedicated undo tablespaces. |
| 861 | @param[in] create_new_undo whether the undo tablespaces has to be created |
| 862 | @param[in,out] mtr mini-transaction |
| 863 | @return DB_SUCCESS or error code */ |
| 864 | dberr_tcxx . . $ dberr_t# srv_undo_tablespaces_initcxx . . $ srv_undo_tablespaces_init(6d2923315c0e5618).(bool create_new_undo, mtr_tcxx . . $ mtr_t# *mtr) |
| 865 | { |
| 866 | srv_undo_tablespaces_opencxx . . $ srv_undo_tablespaces_open.= 0; |
| 867 | |
| 868 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(!create_new_undo || mtr); |
| 869 | ut_acxx . . $ `storage/innobase/include/ut0dbg.h:50:9`!(srv_undo_tablespaces <= TRX_SYS_N_RSEGS); |
| 870 | ut_acxx . . $ `storage/innobase/include/ut0dbg.h:50:9`!(!create_new_undo || srv_operation <= SRV_OPERATION_EXPORT_RESTORED); |
| 871 | |
| 872 | if (srv_undo_tablespacescxx . . $ srv_undo_tablespaces. == 1) |
| 873 | srv_undo_tablespacescxx . . $ srv_undo_tablespaces.= 0; |
| 874 | |
| 875 | /* Create the undo spaces only if we are creating a new |
| 876 | instance. We don't allow creating of new undo tablespaces |
| 877 | in an existing instance (yet). */ |
| 878 | if (create_new_undo) |
| 879 | { |
| 880 | DBUG_EXECUTE_IFcxx . . $ `include/my_dbug.h:172:9`!("innodb_undo_upgrade", srv_undo_space_id_start= 3;); |
| 881 | |
| 882 | for (ulintcxx . . $ ulint# i= 0; i < srv_undo_tablespacescxx . . $ srv_undo_tablespaces.; ++i) |
| 883 | { |
| 884 | char name[OS_FILE_MAX_PATHcxx . . $ `storage/innobase/include/os0file.h:307:9`!]; |
| 885 | snprintf(name, sizeof name, "%s/undo%03zu", srv_undo_dircxx . . $ srv_undo_dir., i + 1); |
| 886 | if (dberr_tcxx . . $ dberr_t# err= srv_undo_tablespace_createcxx . . $ srv_undo_tablespace_create(c53cb439c81747f).(name)) |
| 887 | { |
| 888 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "Could not create undo tablespace '" <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). name <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "'."; |
| 889 | return err; |
| 890 | } |
| 891 | } |
| 892 | } |
| 893 | |
| 894 | /* Get the tablespace ids of all the undo segments excluding |
| 895 | the system tablespace (0). If we are creating a new instance then |
| 896 | we build the undo_tablespace_ids ourselves since they don't |
| 897 | already exist. */ |
| 898 | srv_undo_tablespaces_activecxx . . $ srv_undo_tablespaces_active.= srv_undo_tablespacescxx . . $ srv_undo_tablespaces.; |
| 899 | |
| 900 | uint32_tcxx . . $ uint32_t# n_undo= (create_new_undo || srv_operationcxx . . $ srv_operation. == SRV_OPERATION_BACKUPcxx . . $ SRV_OPERATION_BACKUP. || |
| 901 | srv_operationcxx . . $ srv_operation. == SRV_OPERATION_RESTORE_DELTAcxx . . $ SRV_OPERATION_RESTORE_DELTA.) |
| 902 | ? srv_undo_tablespacescxx . . $ srv_undo_tablespaces. : TRX_SYS_N_RSEGScxx . . $ TRX_SYS_N_RSEGS.; |
| 903 | |
| 904 | mysql_mutex_lockcxx . . $ `include/mysql/psi/mysql_thread.h:360:11`!(&recv_sys.mutex); |
| 905 | dberr_tcxx . . $ dberr_t# err= srv_all_undo_tablespaces_opencxx . . $ srv_all_undo_tablespaces_open(5bbffe166ced5302).(create_new_undo, n_undo); |
| 906 | mysql_mutex_unlockcxx . . $ `include/mysql/psi/mysql_thread.h:391:11`!(&recv_sys.mutex); |
| 907 | |
| 908 | /* Initialize srv_undo_space_id_start=0 when there are no |
| 909 | dedicated undo tablespaces. */ |
| 910 | if (srv_undo_tablespaces_opencxx . . $ srv_undo_tablespaces_open. == 0) |
| 911 | srv_undo_space_id_startcxx . . $ srv_undo_space_id_start.= 0; |
| 912 | |
| 913 | if (create_new_undo) |
| 914 | for (uint32_tcxx . . $ uint32_t# i= 0; err == DB_SUCCESScxx . . $ DB_SUCCESS. && i < srv_undo_tablespacescxx . . $ srv_undo_tablespaces.; ++i) |
| 915 | err= fsp_header_initcxx . . $ fsp_header_init(b514e9335f788ed6).(fil_space_getcxx . . $ fil_space_get(fb1f3aca84eadcbc).(srv_undo_space_id_startcxx . . $ srv_undo_space_id_start. + i), |
| 916 | SRV_UNDO_TABLESPACE_SIZE_IN_PAGEScxx . . $ SRV_UNDO_TABLESPACE_SIZE_IN_PAGES., mtr); |
| 917 | |
| 918 | return err; |
| 919 | } |
| 920 | |
| 921 | PRAGMA_REENABLE_CHECK_STACK_FRAMEcxx . . $ `include/my_attribute.h:91:9`! |
| 922 | |
| 923 | |
| 924 | /** Create the temporary file tablespace. |
| 925 | @param[in] create_new_db whether we are creating a new database |
| 926 | @return DB_SUCCESS or error code. */ |
| 927 | static |
| 928 | dberr_tcxx . . $ dberr_t# |
| 929 | srv_open_tmp_tablespacecxx . . $ srv_open_tmp_tablespace(d04655808700f477).(bool create_new_db) |
| 930 | { |
| 931 | ulintcxx . . $ ulint# sum_of_new_sizes; |
| 932 | |
| 933 | /* Will try to remove if there is existing file left-over by last |
| 934 | unclean shutdown */ |
| 935 | srv_tmp_spacecxx . . $ srv_tmp_space..set_sanity_check_statuscxx . . $ SysTablespace#set_sanity_check_status(b45ddcbc8423892c).(true); |
| 936 | srv_tmp_spacecxx . . $ srv_tmp_space..delete_filescxx . . $ Tablespace#delete_files(49f6e7a06ebc5aa8).(); |
| 937 | srv_tmp_spacecxx . . $ srv_tmp_space..set_ignore_read_onlycxx . . $ Tablespace#set_ignore_read_only(b45ddcbc8423892c).(true); |
| 938 | |
| 939 | bool create_new_temp_space; |
| 940 | |
| 941 | srv_tmp_spacecxx . . $ srv_tmp_space..set_space_idcxx . . $ Tablespace#set_space_id(cb2f890c2fdad230).(SRV_TMP_SPACE_IDcxx . . $ SRV_TMP_SPACE_ID.); |
| 942 | |
| 943 | dberr_tcxx . . $ dberr_t# err = srv_tmp_spacecxx . . $ srv_tmp_space..check_file_speccxx . . $ SysTablespace#check_file_spec(8a501ed6ab1d5d38).( |
| 944 | &create_new_temp_space, 12 * 1024 * 1024); |
| 945 | |
| 946 | if (err == DB_FAILcxx . . $ DB_FAIL.) { |
| 947 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "The innodb_temporary" |
| 948 | " data file must be writable!"; |
| 949 | err = DB_ERRORcxx . . $ DB_ERROR.; |
| 950 | } else if (err != DB_SUCCESScxx . . $ DB_SUCCESS.) { |
| 951 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "Could not create the shared innodb_temporary."; |
| 952 | } else if ((err = srv_tmp_spacecxx . . $ srv_tmp_space..open_or_createcxx . . $ SysTablespace#open_or_create(8c43b2175a26c688).( |
| 953 | true, create_new_db, &sum_of_new_sizes)) |
| 954 | != DB_SUCCESScxx . . $ DB_SUCCESS.) { |
| 955 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "Unable to create the shared innodb_temporary"; |
| 956 | } else if (fil_systemcxx . . $ fil_system..temp_spacecxx . . $ fil_system_t#temp_space.->opencxx . . $ fil_space_t#open(efaadfb7dc14930a).(true)) { |
| 957 | /* Initialize the header page */ |
| 958 | mtr_tcxx . . $ mtr_t# mtrcxx . . $ mtr_t#mtr_t(a6968fd0d8f26912).{nullptr}; |
| 959 | mtr.startcxx . . $ mtr_t#start(49f6e7a06ebc5aa8).(); |
| 960 | mtr.set_log_modecxx . . $ mtr_t#set_log_mode(9fa4fa4ef91bef56).(MTR_LOG_NO_REDOcxx . . $ MTR_LOG_NO_REDO.); |
| 961 | err = fsp_header_initcxx . . $ fsp_header_init(b514e9335f788ed6).(fil_systemcxx . . $ fil_system..temp_spacecxx . . $ fil_system_t#temp_space., |
| 962 | srv_tmp_spacecxx . . $ srv_tmp_space..get_sum_of_sizescxx . . $ Tablespace#get_sum_of_sizes(ddd8539a2fcdd4ce).(), |
| 963 | &mtr); |
| 964 | mtr.commitcxx . . $ mtr_t#commit(49f6e7a06ebc5aa8).(); |
| 965 | if (err == DB_SUCCESScxx . . $ DB_SUCCESS.) { |
| 966 | err = trx_temp_rseg_createcxx . . $ trx_temp_rseg_create(5ccbb810592e2a69).(&mtr); |
| 967 | } |
| 968 | } else { |
| 969 | /* This file was just opened in the code above! */ |
| 970 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "The innodb_temporary" |
| 971 | " data file cannot be re-opened" |
| 972 | " after check_file_spec() succeeded!"; |
| 973 | err = DB_ERRORcxx . . $ DB_ERROR.; |
| 974 | } |
| 975 | |
| 976 | return(err); |
| 977 | } |
| 978 | |
| 979 | /** Shutdown background threads, except the page cleaner. |
| 980 | @param init_abort set to true when InnoDB startup aborted */ |
| 981 | static void srv_shutdown_threadscxx . . $ srv_shutdown_threads(b45ddcbc8423892c).(bool init_abort= false) |
| 982 | { |
| 983 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(!srv_undo_sources); |
| 984 | srv_master_timercxx . . $ srv_master_timer..resetcxx . . $ std/unique_ptr#reset(c8c3025d73122d7d).(); |
| 985 | /* In case of InnoDB start up aborted, Don't change |
| 986 | the srv_shutdown_state. Because innodb_shutdown() |
| 987 | does call innodb_preshutdown() which changes the |
| 988 | srv_shutdown_state back to SRV_SHUTDOWN_INITIATED */ |
| 989 | if (!init_abort) { |
| 990 | srv_shutdown_statecxx . . $ srv_shutdown_state. = SRV_SHUTDOWN_EXIT_THREADScxx . . $ SRV_SHUTDOWN_EXIT_THREADS.; |
| 991 | } |
| 992 | |
| 993 | if (purge_syscxx . . $ purge_sys..enabledcxx . . $ purge_sys_t#enabled(c9857a73d68e59ba).()) { |
| 994 | srv_purge_shutdowncxx . . $ srv_purge_shutdown(49f6e7a06ebc5aa8).(); |
| 995 | } |
| 996 | |
| 997 | if (srv_n_fil_crypt_threadscxx . . $ srv_n_fil_crypt_threads.) { |
| 998 | fil_crypt_set_thread_cntcxx . . $ fil_crypt_set_thread_cnt(cb2f890c2fdad230).(0); |
| 999 | } |
| 1000 | } |
| 1001 | |
| 1002 | |
| 1003 | /** Shut down background threads that can generate undo log. */ |
| 1004 | static void srv_shutdown_bg_undo_sourcescxx . . $ srv_shutdown_bg_undo_sources(49f6e7a06ebc5aa8).() |
| 1005 | { |
| 1006 | srv_shutdown_statecxx . . $ srv_shutdown_state.= SRV_SHUTDOWN_INITIATEDcxx . . $ SRV_SHUTDOWN_INITIATED.; |
| 1007 | |
| 1008 | if (srv_undo_sourcescxx . . $ srv_undo_sources.) |
| 1009 | { |
| 1010 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(!srv_read_only_mode); |
| 1011 | fts_optimize_shutdowncxx . . $ fts_optimize_shutdown(49f6e7a06ebc5aa8).(); |
| 1012 | dict_stats_shutdowncxx . . $ dict_stats_shutdown(49f6e7a06ebc5aa8).(); |
| 1013 | srv_undo_sourcescxx . . $ srv_undo_sources.= false; |
| 1014 | } |
| 1015 | } |
| 1016 | |
| 1017 | #ifdef UNIV_DEBUG |
| 1018 | # define srv_init_abort(_db_err) \ |
| 1019 | srv_init_abort_low(create_new_db, __FILE__, __LINE__, _db_err) |
| 1020 | #else |
| 1021 | # define srv_init_abortcxx . . $ `storage/innobase/srv/srv0start.cc:1021:10`!(_db_err) \ |
| 1022 | srv_init_abort_low(create_new_db, _db_err) |
| 1023 | #endif /* UNIV_DEBUG */ |
| 1024 | |
| 1025 | /** Innobase start-up aborted. Perform cleanup actions. |
| 1026 | @param[in] create_new_db TRUE if new db is being created |
| 1027 | @param[in] file File name |
| 1028 | @param[in] line Line number |
| 1029 | @param[in] err Reason for aborting InnoDB startup |
| 1030 | @return DB_SUCCESS or error code. */ |
| 1031 | MY_ATTRIBUTEcxx . . $ `storage/innobase/include/univ.i:162:11`!((warn_unused_result, nonnull)) |
| 1032 | static |
| 1033 | dberr_tcxx . . $ dberr_t# |
| 1034 | srv_init_abort_lowcxx . . $ srv_init_abort_low(aba86d61161916de).( |
| 1035 | bool create_new_db, |
| 1036 | #ifdef UNIV_DEBUG |
| 1037 | const char* file, |
| 1038 | unsigned line, |
| 1039 | #endif /* UNIV_DEBUG */ |
| 1040 | dberr_tcxx . . $ dberr_t# err) |
| 1041 | { |
| 1042 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(srv_is_being_started); |
| 1043 | |
| 1044 | if (create_new_db) { |
| 1045 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "Database creation was aborted" |
| 1046 | #ifdef UNIV_DEBUG |
| 1047 | " at " << innobase_basename(file) << "[" << line << "]" |
| 1048 | #endif /* UNIV_DEBUG */ |
| 1049 | " with error " <<cxx . . $ ib/logger#`operator<<`(21d5b4e5d60c54d2). err <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). ". You may need" |
| 1050 | " to delete the ibdata1 file before trying to start" |
| 1051 | " up again."; |
| 1052 | } else if (srv_operationcxx . . $ srv_operation. == SRV_OPERATION_NORMALcxx . . $ SRV_OPERATION_NORMAL.) { |
| 1053 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "Plugin initialization aborted" |
| 1054 | #ifdef UNIV_DEBUG |
| 1055 | " at " << innobase_basename(file) << "[" << line << "]" |
| 1056 | #endif /* UNIV_DEBUG */ |
| 1057 | " with error " <<cxx . . $ ib/logger#`operator<<`(21d5b4e5d60c54d2). err; |
| 1058 | } |
| 1059 | |
| 1060 | srv_shutdown_bg_undo_sourcescxx . . $ srv_shutdown_bg_undo_sources(49f6e7a06ebc5aa8).(); |
| 1061 | srv_shutdown_threadscxx . . $ srv_shutdown_threads(b45ddcbc8423892c).(true); |
| 1062 | return(err); |
| 1063 | } |
| 1064 | |
| 1065 | /** Prepare to delete the redo log file. Flush the dirty pages from all the |
| 1066 | buffer pools. Flush the redo log buffer to the redo log file. |
| 1067 | @return lsn upto which data pages have been flushed and log_sys.latch acquired |
| 1068 | @retval 0 in case of error; log_sys.latch will not be acquired */ |
| 1069 | static ATTRIBUTE_COLDcxx . . $ `include/my_compiler.h:166:10`! lsn_tcxx . . $ lsn_t# srv_prepare_to_delete_redo_log_filecxx . . $ srv_prepare_to_delete_redo_log_file(cee159cc271e827).() noexcept |
| 1070 | { |
| 1071 | DBUG_ENTERcxx . . $ `include/my_dbug.h:165:9`!("srv_prepare_to_delete_redo_log_file"); |
| 1072 | |
| 1073 | mysql_mutex_lockcxx . . $ `include/mysql/psi/mysql_thread.h:360:11`!(&recv_sys.mutex); |
| 1074 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(recv_sys.recovery_on); |
| 1075 | recv_syscxx . . $ recv_sys..applycxx . . $ recv_sys_t#apply(b45ddcbc8423892c).(true); |
| 1076 | mysql_mutex_unlockcxx . . $ `include/mysql/psi/mysql_thread.h:391:11`!(&recv_sys.mutex); |
| 1077 | |
| 1078 | /* Clean the buffer pool. */ |
| 1079 | buf_flush_sync_batchcxx . . $ buf_flush_sync_batch(a798fad6deb73b4b).(0, false); |
| 1080 | |
| 1081 | DBUG_EXECUTE_IFcxx . . $ `include/my_dbug.h:172:9`!("innodb_log_abort_1", recv_sys.recovery_on= false; |
| 1082 | DBUG_RETURN(0);); |
| 1083 | DBUG_PRINTcxx . . $ `include/my_dbug.h:174:9`!("ib_log", ("After innodb_log_abort_1")); |
| 1084 | |
| 1085 | log_syscxx . . $ log_sys..latchcxx . . $ log_t#latch..wr_lockcxx . . $ ssux_lock_impl#wr_lock(ced63f7c635d850d).(); |
| 1086 | const bool latest_format{log_syscxx . . $ log_sys..is_latestcxx . . $ log_t#is_latest(3482b152b9333168).()}; |
| 1087 | lsn_tcxx . . $ lsn_t# flushed_lsn{log_syscxx . . $ log_sys..get_flushed_lsncxx . . $ log_t#get_flushed_lsn(40133418db5a06a).(stdcxx . . $ std/::memory_order_relaxedcxx . . $ std/memory_order_relaxed.)}; |
| 1088 | |
| 1089 | { |
| 1090 | const char *msg; |
| 1091 | if (!latest_format) |
| 1092 | { |
| 1093 | msg= "Upgrading redo log: "; |
| 1094 | same_size: |
| 1095 | ibcxx . . $ ib/::infocxx . . $ ib/info#() <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). msg <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). ibcxx . . $ ib/::bytes_ieccxx . . $ ib/bytes_iec#(srv_log_file_sizecxx . . $ srv_log_file_size.) |
| 1096 | <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "; LSN=" <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). flushed_lsn; |
| 1097 | } |
| 1098 | else if (srv_log_file_sizecxx . . $ srv_log_file_size. == log_syscxx . . $ log_sys..file_sizecxx . . $ log_t#file_size.) |
| 1099 | { |
| 1100 | msg= srv_encrypt_logcxx . . $ srv_encrypt_log. |
| 1101 | ? "Encrypting redo log: " : "Removing redo log encryption: "; |
| 1102 | goto same_size; |
| 1103 | } |
| 1104 | else |
| 1105 | { |
| 1106 | if (srv_encrypt_logcxx . . $ srv_encrypt_log. == (my_boolcxx . . $ my_bool#)log_syscxx . . $ log_sys..is_encryptedcxx . . $ log_t#is_encrypted(3482b152b9333168).()) |
| 1107 | msg= srv_encrypt_logcxx . . $ srv_encrypt_log. ? "Resizing encrypted" : "Resizing"; |
| 1108 | else |
| 1109 | msg= srv_encrypt_logcxx . . $ srv_encrypt_log. |
| 1110 | ? "Encrypting and resizing" |
| 1111 | : "Removing encryption and resizing"; |
| 1112 | |
| 1113 | ibcxx . . $ ib/::infocxx . . $ ib/info#() <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). msg <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). " redo log from " |
| 1114 | <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). ibcxx . . $ ib/bytes_iec#bytes_iec(891dc3055356b409).::bytes_ieccxx . . $ ib/bytes_iec#{log_syscxx . . $ log_sys..file_sizecxx . . $ log_t#file_size.} <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). " to " |
| 1115 | <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). ibcxx . . $ ib/bytes_iec#bytes_iec(891dc3055356b409).::bytes_ieccxx . . $ ib/bytes_iec#{srv_log_file_sizecxx . . $ srv_log_file_size.} |
| 1116 | <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "; LSN=" <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). flushed_lsn; |
| 1117 | } |
| 1118 | } |
| 1119 | |
| 1120 | DBUG_RETURNcxx . . $ `include/my_dbug.h:168:9`!(flushed_lsn); |
| 1121 | } |
| 1122 | |
| 1123 | /** Upgrade the redo log to the latest format, or change its size |
| 1124 | or encryption, before starting to write any log records. */ |
| 1125 | ATTRIBUTE_COLDcxx . . $ `include/my_compiler.h:166:10`! static dberr_tcxx . . $ dberr_t# srv_log_rebuildcxx . . $ srv_log_rebuild(61cafcde64169af4).() noexcept |
| 1126 | { |
| 1127 | /* Prepare to delete the old redo log file */ |
| 1128 | const lsn_tcxx . . $ lsn_t# lsn{srv_prepare_to_delete_redo_log_filecxx . . $ srv_prepare_to_delete_redo_log_file(cee159cc271e827).()}; |
| 1129 | if (!lsn) |
| 1130 | return DB_ERRORcxx . . $ DB_ERROR.; |
| 1131 | mysql_mutex_lockcxx . . $ `include/mysql/psi/mysql_thread.h:360:11`!(&buf_pool.flush_list_mutex); |
| 1132 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(!buf_pool.get_oldest_modification(0)); |
| 1133 | /* Prohibit redo log writes from any other threads until creating a |
| 1134 | log checkpoint at the end of create_log_file(). */ |
| 1135 | ut_dcxx . . $ `storage/innobase/include/ut0dbg.h:68:9`!(recv_no_log_write= true); |
| 1136 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(!os_aio_pending_reads()); |
| 1137 | |
| 1138 | DBUG_EXECUTE_IFcxx . . $ `include/my_dbug.h:172:9`!("innodb_log_abort_5", |
| 1139 | recv_sys.recovery_on= false; recv_no_log_write= false; |
| 1140 | log_sys.latch.wr_unlock(); |
| 1141 | mysql_mutex_unlock(&buf_pool.flush_list_mutex); |
| 1142 | return DB_ERROR;); |
| 1143 | /* Close the redo log file, so that we can replace it */ |
| 1144 | log_syscxx . . $ log_sys..close_filecxx . . $ log_t#close_file(9f0ba574c1c44ffc).(); |
| 1145 | dberr_tcxx . . $ dberr_t# err= create_log_filecxx . . $ create_log_file(97127bc9b032d3da).(false, lsn); |
| 1146 | |
| 1147 | if (err == DB_SUCCESScxx . . $ DB_SUCCESS. && log_syscxx . . $ log_sys..resize_renamecxx . . $ log_t#resize_rename(77ce49a7840d23c7).()) |
| 1148 | err = DB_ERRORcxx . . $ DB_ERROR.; |
| 1149 | |
| 1150 | return err; |
| 1151 | } |
| 1152 | |
| 1153 | /** Rebuild the redo log if needed. */ |
| 1154 | static dberr_tcxx . . $ dberr_t# srv_log_rebuild_if_neededcxx . . $ srv_log_rebuild_if_needed(61cafcde64169af4).() noexcept |
| 1155 | { |
| 1156 | if (srv_force_recoverycxx . . $ srv_force_recovery. == SRV_FORCE_NO_LOG_REDOcxx . . $ SRV_FORCE_NO_LOG_REDO.) |
| 1157 | /* Completely ignore the redo log. */ |
| 1158 | return DB_SUCCESScxx . . $ DB_SUCCESS.; |
| 1159 | if (srv_read_only_modecxx . . $ srv_read_only_mode.) |
| 1160 | /* Leave the redo log alone. */ |
| 1161 | return DB_SUCCESScxx . . $ DB_SUCCESS.; |
| 1162 | |
| 1163 | if (log_syscxx . . $ log_sys..file_sizecxx . . $ log_t#file_size. == srv_log_file_sizecxx . . $ srv_log_file_size. && |
| 1164 | log_syscxx . . $ log_sys..formatcxx . . $ log_t#format. == |
| 1165 | (srv_encrypt_logcxx . . $ srv_encrypt_log. ? log_tcxx . . $ log_t#::FORMAT_ENC_11cxx . . $ log_t#FORMAT_ENC_11. : log_tcxx . . $ log_t#::FORMAT_10_8cxx . . $ log_t#FORMAT_10_8.)) |
| 1166 | { |
| 1167 | /* No need to add or remove encryption, upgrade, or resize. */ |
| 1168 | delete_log_filescxx . . $ delete_log_files(49f6e7a06ebc5aa8).(); |
| 1169 | return DB_SUCCESScxx . . $ DB_SUCCESS.; |
| 1170 | } |
| 1171 | |
| 1172 | return srv_log_rebuildcxx . . $ srv_log_rebuild(61cafcde64169af4).(); |
| 1173 | } |
| 1174 | |
| 1175 | ut_dcxx . . $ `storage/innobase/include/ut0dbg.h:68:9`!(bool ibuf_upgrade_was_needed;) |
| 1176 | |
| 1177 | ATTRIBUTE_COLDcxx . . $ `include/my_compiler.h:166:10`! static dberr_tcxx . . $ dberr_t# ibuf_log_rebuild_if_neededcxx . . $ ibuf_log_rebuild_if_needed(629d9d73bf1a44e9).() |
| 1178 | { |
| 1179 | ut_dcxx . . $ `storage/innobase/include/ut0dbg.h:68:9`!(ibuf_upgrade_was_needed= true;) |
| 1180 | mysql_mutex_lockcxx . . $ `include/mysql/psi/mysql_thread.h:360:11`!(&recv_sys.mutex); |
| 1181 | recv_syscxx . . $ recv_sys..applycxx . . $ recv_sys_t#apply(b45ddcbc8423892c).(true); |
| 1182 | mysql_mutex_unlockcxx . . $ `include/mysql/psi/mysql_thread.h:391:11`!(&recv_sys.mutex); |
| 1183 | |
| 1184 | if (recv_syscxx . . $ recv_sys..is_corrupt_logcxx . . $ recv_sys_t#is_corrupt_log(50ce9a9e25b4a850).() || recv_syscxx . . $ recv_sys..is_corrupt_fscxx . . $ recv_sys_t#is_corrupt_fs(50ce9a9e25b4a850).()) |
| 1185 | return DB_CORRUPTIONcxx . . $ DB_CORRUPTION.; |
| 1186 | |
| 1187 | dberr_tcxx . . $ dberr_t# err= srv_log_rebuild_if_neededcxx . . $ srv_log_rebuild_if_needed(61cafcde64169af4).(); |
| 1188 | recv_syscxx . . $ recv_sys..debug_freecxx . . $ recv_sys_t#debug_free(49f6e7a06ebc5aa8).(); |
| 1189 | return err; |
| 1190 | } |
| 1191 | |
| 1192 | |
| 1193 | inline lsn_tcxx . . $ lsn_t# log_tcxx . . $ log_t#::init_lsncxx . . $ log_t#init_lsn(cee159cc271e827).() noexcept |
| 1194 | { |
| 1195 | latchcxx . . $ log_t#latch..wr_lockcxx . . $ ssux_lock_impl#wr_lock(ced63f7c635d850d).(); |
| 1196 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(!write_lsn_offset); |
| 1197 | write_lsn_offsetcxx . . $ log_t#write_lsn_offset.=cxx . . $ Atomic_relaxed#`operator=`(ada6a8422704cf8a). 0; |
| 1198 | const lsn_tcxx . . $ lsn_t# lsn{base_lsncxx . . $ log_t#base_lsn..loadcxx . . $ std/__atomic_base#load(1776886d83107284).(stdcxx . . $ std/::memory_order_relaxedcxx . . $ std/memory_order_relaxed.)}; |
| 1199 | flushed_to_disk_lsncxx . . $ log_t#flushed_to_disk_lsn..storecxx . . $ std/__atomic_base#store(3f1f49b30cba5fcc).(lsn, stdcxx . . $ std/::memory_order_relaxedcxx . . $ std/memory_order_relaxed.); |
| 1200 | write_lsncxx . . $ log_t#write_lsn.= lsn; |
| 1201 | latchcxx . . $ log_t#latch..wr_unlockcxx . . $ ssux_lock_impl#wr_unlock(ced63f7c635d850d).(); |
| 1202 | return lsn; |
| 1203 | } |
| 1204 | |
| 1205 | PRAGMA_DISABLE_CHECK_STACK_FRAMEcxx . . $ `include/my_attribute.h:87:9`! |
| 1206 | |
| 1207 | /** Load the dictionary tables */ |
| 1208 | static dberr_tcxx . . $ dberr_t# srv_load_tablescxx . . $ srv_load_tables(44f7aba9ad2324c1).(bool must_upgrade_ibuf) noexcept |
| 1209 | { |
| 1210 | mem_heap_tcxx . . $ mem_heap_t# *heap= mem_heap_createcxx . . $ `storage/innobase/include/mem0mem.h:85:10`!(1000); |
| 1211 | mtr_tcxx . . $ mtr_t# mtrcxx . . $ mtr_t#mtr_t(a6968fd0d8f26912).{nullptr}; |
| 1212 | dict_syscxx . . $ dict_sys..lockcxx . . $ dict_sys_t#lock(9bb8261ff8654062).(SRW_LOCK_CALLcxx . . $ `storage/innobase/include/srw_lock.h:44:10`!); |
| 1213 | dberr_tcxx . . $ dberr_t# err = dict_load_indexescxx . . $ dict_load_indexes(61d42a777c99396f).(&mtr, dict_syscxx . . $ dict_sys..sys_tablescxx . . $ dict_sys_t#sys_tables., false, heap, |
| 1214 | DICT_ERR_IGNORE_NONEcxx . . $ DICT_ERR_IGNORE_NONE.); |
| 1215 | mem_heap_emptycxx . . $ mem_heap_empty(5231cf397463bfab).(heap); |
| 1216 | if (UNIV_UNLIKELYcxx . . $ `storage/innobase/include/univ.i:439:9`!(must_upgrade_ibuf) && |
| 1217 | (err == DB_SUCCESScxx . . $ DB_SUCCESS. || srv_force_recoverycxx . . $ srv_force_recovery. >= SRV_FORCE_NO_DDL_UNDOcxx . . $ SRV_FORCE_NO_DDL_UNDO.)) |
| 1218 | { |
| 1219 | dict_syscxx . . $ dict_sys..unlockcxx . . $ dict_sys_t#unlock(ced63f7c635d850d).(); |
| 1220 | dict_load_tablespacescxx . . $ dict_load_tablespaces(a5108321e3739a4b).(nullptr, true); |
| 1221 | err= ibuf_upgradecxx . . $ ibuf_upgrade(629d9d73bf1a44e9).(); |
| 1222 | dict_syscxx . . $ dict_sys..lockcxx . . $ dict_sys_t#lock(9bb8261ff8654062).(SRW_LOCK_CALLcxx . . $ `storage/innobase/include/srw_lock.h:44:10`!); |
| 1223 | } |
| 1224 | if (err == DB_SUCCESScxx . . $ DB_SUCCESS. || srv_force_recoverycxx . . $ srv_force_recovery. >= SRV_FORCE_NO_DDL_UNDOcxx . . $ SRV_FORCE_NO_DDL_UNDO.) |
| 1225 | { |
| 1226 | err = dict_load_indexescxx . . $ dict_load_indexes(61d42a777c99396f).(&mtr, dict_syscxx . . $ dict_sys..sys_columnscxx . . $ dict_sys_t#sys_columns., false, heap, |
| 1227 | DICT_ERR_IGNORE_NONEcxx . . $ DICT_ERR_IGNORE_NONE.); |
| 1228 | mem_heap_emptycxx . . $ mem_heap_empty(5231cf397463bfab).(heap); |
| 1229 | } |
| 1230 | if (err == DB_SUCCESScxx . . $ DB_SUCCESS. || srv_force_recoverycxx . . $ srv_force_recovery. >= SRV_FORCE_NO_DDL_UNDOcxx . . $ SRV_FORCE_NO_DDL_UNDO.) |
| 1231 | { |
| 1232 | err = dict_load_indexescxx . . $ dict_load_indexes(61d42a777c99396f).(&mtr, dict_syscxx . . $ dict_sys..sys_indexescxx . . $ dict_sys_t#sys_indexes., false, heap, |
| 1233 | DICT_ERR_IGNORE_NONEcxx . . $ DICT_ERR_IGNORE_NONE.); |
| 1234 | mem_heap_emptycxx . . $ mem_heap_empty(5231cf397463bfab).(heap); |
| 1235 | } |
| 1236 | if (err == DB_SUCCESScxx . . $ DB_SUCCESS. || srv_force_recoverycxx . . $ srv_force_recovery. >= SRV_FORCE_NO_DDL_UNDOcxx . . $ SRV_FORCE_NO_DDL_UNDO.) { |
| 1237 | err = dict_load_indexescxx . . $ dict_load_indexes(61d42a777c99396f).(&mtr, dict_syscxx . . $ dict_sys..sys_fieldscxx . . $ dict_sys_t#sys_fields., false, heap, |
| 1238 | DICT_ERR_IGNORE_NONEcxx . . $ DICT_ERR_IGNORE_NONE.); |
| 1239 | } |
| 1240 | mem_heap_freecxx . . $ mem_heap_free(5231cf397463bfab).(heap); |
| 1241 | dict_syscxx . . $ dict_sys..unlockcxx . . $ dict_sys_t#unlock(ced63f7c635d850d).(); |
| 1242 | dict_syscxx . . $ dict_sys..load_sys_tablescxx . . $ dict_sys_t#load_sys_tables(77ce49a7840d23c7).(); |
| 1243 | return err; |
| 1244 | } |
| 1245 | |
| 1246 | /** Start InnoDB. |
| 1247 | @param[in] create_new_db whether to create a new database |
| 1248 | @return DB_SUCCESS or error code */ |
| 1249 | dberr_tcxx . . $ dberr_t# srv_startcxx . . $ srv_start(d04655808700f477).(bool create_new_db) |
| 1250 | { |
| 1251 | dberr_tcxx . . $ dberr_t# err = DB_SUCCESScxx . . $ DB_SUCCESS.; |
| 1252 | mtr_tcxx . . $ mtr_t# mtrcxx . . $ mtr_t#mtr_t(a6968fd0d8f26912).{nullptr}; |
| 1253 | |
| 1254 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(srv_operation <= SRV_OPERATION_RESTORE_EXPORT |
| 1255 | || srv_operation == SRV_OPERATION_RESTORE |
| 1256 | || srv_operation == SRV_OPERATION_RESTORE_EXPORT); |
| 1257 | |
| 1258 | if (srv_force_recoverycxx . . $ srv_force_recovery.) { |
| 1259 | ibcxx . . $ ib/::infocxx . . $ ib/info#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "!!! innodb_force_recovery is set to " |
| 1260 | <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). srv_force_recoverycxx . . $ srv_force_recovery. <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). " !!!"; |
| 1261 | if (srv_force_recoverycxx . . $ srv_force_recovery. == SRV_FORCE_NO_LOG_REDOcxx . . $ SRV_FORCE_NO_LOG_REDO.) { |
| 1262 | srv_read_only_modecxx . . $ srv_read_only_mode. = true; |
| 1263 | } |
| 1264 | } |
| 1265 | |
| 1266 | if (srv_read_only_modecxx . . $ srv_read_only_mode.) { |
| 1267 | sql_print_informationcxx . . $ sql_print_information(326aeb464d16410c).("InnoDB: Started in read only mode"); |
| 1268 | buf_dblwrcxx . . $ buf_dblwr..usecxx . . $ buf_dblwr_t#use. = buf_dblwrcxx . . $ buf_dblwr..USE_NOcxx . . $ buf_dblwr_t#USE_NO.; |
| 1269 | } |
| 1270 | |
| 1271 | high_level_read_onlycxx . . $ high_level_read_only. = srv_read_only_modecxx . . $ srv_read_only_mode. |
| 1272 | || srv_force_recoverycxx . . $ srv_force_recovery. >= SRV_FORCE_NO_UNDO_LOG_SCANcxx . . $ SRV_FORCE_NO_UNDO_LOG_SCAN. |
| 1273 | || srv_sys_spacecxx . . $ srv_sys_space..created_new_rawcxx . . $ SysTablespace#created_new_raw(50ce9a9e25b4a850).(); |
| 1274 | |
| 1275 | srv_started_redocxx . . $ srv_started_redo. = false; |
| 1276 | |
| 1277 | compile_time_assertcxx . . $ `include/my_global.h:377:9`!(sizeof(ulint) == sizeof(void*)); |
| 1278 | |
| 1279 | #ifdef UNIV_DEBUG |
| 1280 | ib::info() << "!!!!!!!! UNIV_DEBUG switched on !!!!!!!!!"; |
| 1281 | #endif |
| 1282 | |
| 1283 | ibcxx . . $ ib/::infocxx . . $ ib/info#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "Compressed tables use zlib " ZLIB_VERSIONcxx . . $ `<external>/8929586433573063152/zlib.h:44:9`! |
| 1284 | #ifdef UNIV_ZIP_DEBUG |
| 1285 | " with validation" |
| 1286 | #endif /* UNIV_ZIP_DEBUG */ |
| 1287 | ; |
| 1288 | #ifdef UNIV_ZIP_COPY |
| 1289 | ib::info() << "and extra copying"; |
| 1290 | #endif /* UNIV_ZIP_COPY */ |
| 1291 | |
| 1292 | /* Since InnoDB does not currently clean up all its internal data |
| 1293 | structures in MySQL Embedded Server Library server_end(), we |
| 1294 | print an error message if someone tries to start up InnoDB a |
| 1295 | second time during the process lifetime. */ |
| 1296 | |
| 1297 | if (srv_start_has_been_calledcxx . . $ srv_start_has_been_called.) { |
| 1298 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "Startup called second time" |
| 1299 | " during the process lifetime." |
| 1300 | " In the MariaDB Embedded Server Library" |
| 1301 | " you cannot call server_init() more than" |
| 1302 | " once during the process lifetime."; |
| 1303 | } |
| 1304 | |
| 1305 | srv_start_has_been_calledcxx . . $ srv_start_has_been_called. = true; |
| 1306 | |
| 1307 | srv_is_being_startedcxx . . $ srv_is_being_started. = true; |
| 1308 | |
| 1309 | /* Register performance schema stages before any real work has been |
| 1310 | started which may need to be instrumented. */ |
| 1311 | mysql_stage_registercxx . . $ `include/mysql/psi/mysql_stage.h:48:9`!("innodb", srv_stages, |
| 1312 | static_cast<int>(UT_ARR_SIZEcxx . . $ `storage/innobase/include/univ.i:442:9`!(srv_stages))); |
| 1313 | |
| 1314 | srv_bootcxx . . $ srv_boot(49f6e7a06ebc5aa8).(); |
| 1315 | |
| 1316 | ibcxx . . $ ib/::infocxx . . $ ib/info#() <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). my_crc32c_implementation(); |
| 1317 | |
| 1318 | if (!srv_read_only_modecxx . . $ srv_read_only_mode.) { |
| 1319 | mysql_mutex_initcxx . . $ `include/mysql/psi/mysql_thread.h:325:13`!(srv_monitor_file_mutex_key, |
| 1320 | &srv_monitor_file_mutex, nullptr); |
| 1321 | mysql_mutex_initcxx . . $ `include/mysql/psi/mysql_thread.h:325:13`!(srv_misc_tmpfile_mutex_key, |
| 1322 | &srv_misc_tmpfile_mutex, nullptr); |
| 1323 | } |
| 1324 | |
| 1325 | if (!srv_read_only_modecxx . . $ srv_read_only_mode.) { |
| 1326 | if (srv_innodb_statuscxx . . $ srv_innodb_status.) { |
| 1327 | |
| 1328 | size_t srv_monitor_file_name_size= |
| 1329 | strlen(fil_path_to_mysql_datadircxx . . $ fil_path_to_mysql_datadir.) |
| 1330 | + 20 + sizeof "/innodb_status."; |
| 1331 | srv_monitor_file_namecxx . . $ srv_monitor_file_name. = static_cast<char*>( |
| 1332 | ut_malloc_nokeycxx . . $ `storage/innobase/include/ut0new.h:1028:9`!(srv_monitor_file_name_size)); |
| 1333 | |
| 1334 | snprintf(srv_monitor_file_namecxx . . $ srv_monitor_file_name., |
| 1335 | srv_monitor_file_name_size, |
| 1336 | "%s/innodb_status." ULINTPFcxx . . $ `storage/innobase/include/univ.i:290:9`!, |
| 1337 | fil_path_to_mysql_datadircxx . . $ fil_path_to_mysql_datadir., |
| 1338 | static_cast<ulintcxx . . $ ulint#> |
| 1339 | (IF_WINcxx . . $ `include/my_global.h:97:9`!(GetCurrentProcessId(), getpid()))); |
| 1340 | |
| 1341 | srv_monitor_filecxx . . $ srv_monitor_file. = my_fopen(srv_monitor_file_namecxx . . $ srv_monitor_file_name., |
| 1342 | O_RDWRcxx . . $ `<external>/14578502075116107718/fcntl-linux.h:45:9`!|O_TRUNCcxx . . $ `<external>/14578502075116107718/fcntl-linux.h:56:10`!|O_CREATcxx . . $ `<external>/14578502075116107718/fcntl-linux.h:47:10`!, |
| 1343 | MYFcxx . . $ `include/my_global.h:986:9`!(MY_WMEcxx . . $ `include/my_sys.h:57:9`!)); |
| 1344 | |
| 1345 | if (!srv_monitor_filecxx . . $ srv_monitor_file.) { |
| 1346 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "Unable to create " |
| 1347 | <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). srv_monitor_file_namecxx . . $ srv_monitor_file_name. <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). ": " |
| 1348 | <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!); |
| 1349 | if (err == DB_SUCCESScxx . . $ DB_SUCCESS.) { |
| 1350 | err = DB_ERRORcxx . . $ DB_ERROR.; |
| 1351 | } |
| 1352 | } |
| 1353 | } else { |
| 1354 | |
| 1355 | srv_monitor_file_namecxx . . $ srv_monitor_file_name. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:416:9`!; |
| 1356 | srv_monitor_filecxx . . $ srv_monitor_file. = os_file_create_tmpfilecxx . . $ os_file_create_tmpfile(5a483b8a75d6a13b).(); |
| 1357 | |
| 1358 | if (!srv_monitor_filecxx . . $ srv_monitor_file. && err == DB_SUCCESScxx . . $ DB_SUCCESS.) { |
| 1359 | err = DB_ERRORcxx . . $ DB_ERROR.; |
| 1360 | } |
| 1361 | } |
| 1362 | |
| 1363 | srv_misc_tmpfilecxx . . $ srv_misc_tmpfile. = os_file_create_tmpfilecxx . . $ os_file_create_tmpfile(5a483b8a75d6a13b).(); |
| 1364 | |
| 1365 | if (!srv_misc_tmpfilecxx . . $ srv_misc_tmpfile. && err == DB_SUCCESScxx . . $ DB_SUCCESS.) { |
| 1366 | err = DB_ERRORcxx . . $ DB_ERROR.; |
| 1367 | } |
| 1368 | } |
| 1369 | |
| 1370 | if (err != DB_SUCCESScxx . . $ DB_SUCCESS.) { |
| 1371 | return(srv_init_abortcxx . . $ `storage/innobase/srv/srv0start.cc:1021:10`!(err)); |
| 1372 | } |
| 1373 | |
| 1374 | if (os_aio_initcxx . . $ os_aio_init(9efc7249d839d30e).()) { |
| 1375 | return(srv_init_abortcxx . . $ `storage/innobase/srv/srv0start.cc:1021:10`!(DB_ERROR)); |
| 1376 | } |
| 1377 | |
| 1378 | fil_systemcxx . . $ fil_system..createcxx . . $ fil_system_t#create(2c44cd906ae4e829).(srv_file_per_tablecxx . . $ srv_file_per_table. ? 50000 : 5000); |
| 1379 | |
| 1380 | if (buf_poolcxx . . $ buf_pool..createcxx . . $ buf_pool_t#create(77ce49a7840d23c7).()) { |
| 1381 | return(srv_init_abortcxx . . $ `storage/innobase/srv/srv0start.cc:1021:10`!(DB_ERROR)); |
| 1382 | } |
| 1383 | |
| 1384 | log_syscxx . . $ log_sys..createcxx . . $ log_t#create(ced63f7c635d850d).(); |
| 1385 | recv_syscxx . . $ recv_sys..createcxx . . $ recv_sys_t#create(49f6e7a06ebc5aa8).(); |
| 1386 | lock_syscxx . . $ lock_sys..createcxx . . $ lock_sys_t#create(2c44cd906ae4e829).(srv_lock_table_sizecxx . . $ srv_lock_table_size. = 5 * buf_poolcxx . . $ buf_pool..curr_sizecxx . . $ buf_pool_t#curr_size(c9b1e749b64d5edc).()); |
| 1387 | |
| 1388 | srv_startup_is_before_trx_rollback_phasecxx . . $ srv_startup_is_before_trx_rollback_phase. = true; |
| 1389 | |
| 1390 | if (!srv_read_only_modecxx . . $ srv_read_only_mode.) { |
| 1391 | buf_flush_page_cleaner_initcxx . . $ buf_flush_page_cleaner_init(ced63f7c635d850d).(); |
| 1392 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(buf_page_cleaner_is_active); |
| 1393 | } |
| 1394 | |
| 1395 | if (innodb_encrypt_temporary_tablescxx . . $ innodb_encrypt_temporary_tables. && !log_crypt_initcxx . . $ log_crypt_init(c9857a73d68e59ba).()) { |
| 1396 | return srv_init_abortcxx . . $ `storage/innobase/srv/srv0start.cc:1021:10`!(DB_ERROR); |
| 1397 | } |
| 1398 | |
| 1399 | /* Check if undo tablespaces and redo log files exist before creating |
| 1400 | a new system tablespace */ |
| 1401 | if (create_new_db) { |
| 1402 | err = srv_check_undo_redo_logs_existscxx . . $ srv_check_undo_redo_logs_exists(629d9d73bf1a44e9).(); |
| 1403 | if (err != DB_SUCCESScxx . . $ DB_SUCCESS.) { |
| 1404 | return(srv_init_abortcxx . . $ `storage/innobase/srv/srv0start.cc:1021:10`!(DB_ERROR)); |
| 1405 | } |
| 1406 | recv_syscxx . . $ recv_sys..debug_freecxx . . $ recv_sys_t#debug_free(49f6e7a06ebc5aa8).(); |
| 1407 | } else { |
| 1408 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(srv_operation <= SRV_OPERATION_EXPORT_RESTORED |
| 1409 | || srv_operation == SRV_OPERATION_RESTORE |
| 1410 | || srv_operation == SRV_OPERATION_RESTORE_EXPORT); |
| 1411 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(!recv_sys.recovery_on); |
| 1412 | |
| 1413 | if (srv_force_recoverycxx . . $ srv_force_recovery. < SRV_FORCE_NO_LOG_REDOcxx . . $ SRV_FORCE_NO_LOG_REDO.) { |
| 1414 | log_syscxx . . $ log_sys..latchcxx . . $ log_t#latch..wr_lockcxx . . $ ssux_lock_impl#wr_lock(ced63f7c635d850d).(); |
| 1415 | err = recv_syscxx . . $ recv_sys..find_checkpointcxx . . $ recv_sys_t#find_checkpoint(629d9d73bf1a44e9).(); |
| 1416 | log_syscxx . . $ log_sys..latchcxx . . $ log_t#latch..wr_unlockcxx . . $ ssux_lock_impl#wr_unlock(ced63f7c635d850d).(); |
| 1417 | if (err != DB_SUCCESScxx . . $ DB_SUCCESS.) { |
| 1418 | return srv_init_abortcxx . . $ `storage/innobase/srv/srv0start.cc:1021:10`!(err); |
| 1419 | } |
| 1420 | } |
| 1421 | } |
| 1422 | |
| 1423 | /* Open or create the data files. */ |
| 1424 | ulintcxx . . $ ulint# sum_of_new_sizes; |
| 1425 | |
| 1426 | err = srv_sys_spacecxx . . $ srv_sys_space..open_or_createcxx . . $ SysTablespace#open_or_create(8c43b2175a26c688).( |
| 1427 | false, create_new_db, &sum_of_new_sizes); |
| 1428 | |
| 1429 | switch (err) { |
| 1430 | case DB_SUCCESScxx . . $ DB_SUCCESS.: |
| 1431 | break; |
| 1432 | case DB_CANNOT_OPEN_FILEcxx . . $ DB_CANNOT_OPEN_FILE.: |
| 1433 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() |
| 1434 | <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "Could not open or create the system tablespace. If" |
| 1435 | " you tried to add new data files to the system" |
| 1436 | " tablespace, and it failed here, you should now" |
| 1437 | " edit innodb_data_file_path in my.cnf back to what" |
| 1438 | " it was, and remove the new ibdata files InnoDB" |
| 1439 | " created in this failed attempt. InnoDB only wrote" |
| 1440 | " those files full of zeros, but did not yet use" |
| 1441 | " them in any way. But be careful: do not remove" |
| 1442 | " old data files which contain your precious data!"; |
| 1443 | /* fall through */ |
| 1444 | default: |
| 1445 | /* Other errors might be flagged by |
| 1446 | Datafile::validate_first_page() */ |
| 1447 | return srv_init_abortcxx . . $ `storage/innobase/srv/srv0start.cc:1021:10`!(err); |
| 1448 | } |
| 1449 | |
| 1450 | if (create_new_db) { |
| 1451 | lsn_tcxx . . $ lsn_t# flushed_lsn = log_syscxx . . $ log_sys..init_lsncxx . . $ log_t#init_lsn(cee159cc271e827).(); |
| 1452 | log_syscxx . . $ log_sys..latchcxx . . $ log_t#latch..wr_lockcxx . . $ ssux_lock_impl#wr_lock(ced63f7c635d850d).(); |
| 1453 | mysql_mutex_lockcxx . . $ `include/mysql/psi/mysql_thread.h:360:11`!(&buf_pool.flush_list_mutex); |
| 1454 | |
| 1455 | err = create_log_filecxx . . $ create_log_file(97127bc9b032d3da).(true, flushed_lsn); |
| 1456 | |
| 1457 | if (err != DB_SUCCESScxx . . $ DB_SUCCESS.) { |
| 1458 | for (const Datafilecxx . . $ Datafile# &file: srv_sys_spacecxx . . $ srv_sys_space.) { |
| 1459 | os_file_deletecxx . . $ `storage/innobase/include/os0file.h:581:10`!(innodb_data_file_key, |
| 1460 | file.filepath()); |
| 1461 | } |
| 1462 | return srv_init_abortcxx . . $ `storage/innobase/srv/srv0start.cc:1021:10`!(err); |
| 1463 | } |
| 1464 | |
| 1465 | srv_undo_space_id_startcxx . . $ srv_undo_space_id_start. = 1; |
| 1466 | } |
| 1467 | |
| 1468 | /* Open data files in the system tablespace: we keep |
| 1469 | them open until database shutdown */ |
| 1470 | mysql_mutex_lockcxx . . $ `include/mysql/psi/mysql_thread.h:360:11`!(&recv_sys.mutex); |
| 1471 | ut_dcxx . . $ `storage/innobase/include/ut0dbg.h:68:9`!(fil_system.sys_space->recv_size = srv_sys_space_size_debug); |
| 1472 | err = fil_systemcxx . . $ fil_system..sys_spacecxx . . $ fil_system_t#sys_space.->opencxx . . $ fil_space_t#open(efaadfb7dc14930a).(create_new_db) |
| 1473 | ? DB_SUCCESScxx . . $ DB_SUCCESS. : DB_ERRORcxx . . $ DB_ERROR.; |
| 1474 | mysql_mutex_unlockcxx . . $ `include/mysql/psi/mysql_thread.h:391:11`!(&recv_sys.mutex); |
| 1475 | |
| 1476 | |
| 1477 | if (err == DB_SUCCESScxx . . $ DB_SUCCESS.) { |
| 1478 | mtr.startcxx . . $ mtr_t#start(49f6e7a06ebc5aa8).(); |
| 1479 | err= srv_undo_tablespaces_initcxx . . $ srv_undo_tablespaces_init(6d2923315c0e5618).(create_new_db, &mtr); |
| 1480 | mtr.commitcxx . . $ mtr_t#commit(49f6e7a06ebc5aa8).(); |
| 1481 | } |
| 1482 | else { |
| 1483 | err= DB_ERRORcxx . . $ DB_ERROR.; |
| 1484 | } |
| 1485 | |
| 1486 | /* If the force recovery is set very high then we carry on regardless |
| 1487 | of all errors. Basically this is fingers crossed mode. */ |
| 1488 | |
| 1489 | if (err != DB_SUCCESScxx . . $ DB_SUCCESS. |
| 1490 | && srv_force_recoverycxx . . $ srv_force_recovery. < SRV_FORCE_NO_UNDO_LOG_SCANcxx . . $ SRV_FORCE_NO_UNDO_LOG_SCAN.) { |
| 1491 | |
| 1492 | return(srv_init_abortcxx . . $ `storage/innobase/srv/srv0start.cc:1021:10`!(err)); |
| 1493 | } |
| 1494 | |
| 1495 | /* Initialize objects used by dict stats gathering thread, which |
| 1496 | can also be used by recovery if it tries to drop some table */ |
| 1497 | if (!srv_read_only_modecxx . . $ srv_read_only_mode.) { |
| 1498 | dict_stats_initcxx . . $ dict_stats_init(49f6e7a06ebc5aa8).(); |
| 1499 | } |
| 1500 | |
| 1501 | trx_syscxx . . $ trx_sys..createcxx . . $ trx_sys_t#create(49f6e7a06ebc5aa8).(); |
| 1502 | |
| 1503 | if (create_new_db) { |
| 1504 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(!srv_read_only_mode); |
| 1505 | |
| 1506 | mtr.startcxx . . $ mtr_t#start(49f6e7a06ebc5aa8).(); |
| 1507 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(fil_system.sys_space->id == 0); |
| 1508 | compile_time_assertcxx . . $ `include/my_global.h:377:9`!(TRX_SYS_SPACE == 0); |
| 1509 | err = fsp_header_initcxx . . $ fsp_header_init(b514e9335f788ed6).(fil_systemcxx . . $ fil_system..sys_spacecxx . . $ fil_system_t#sys_space., |
| 1510 | uint32_tcxx . . $ uint32_t#(sum_of_new_sizes), &mtr); |
| 1511 | /* Allocate dummy change buffer pages for backward |
| 1512 | compatibility and to prevent a downgrade. */ |
| 1513 | if (err != DB_SUCCESScxx . . $ DB_SUCCESS.) { |
| 1514 | } else if (buf_block_tcxx . . $ buf_block_t# *b = |
| 1515 | fseg_createcxx . . $ fseg_create(8bc949c6f95c6eb1).(fil_systemcxx . . $ fil_system..sys_spacecxx . . $ fil_system_t#sys_space., PAGE_DATAcxx . . $ `storage/innobase/include/page0page.h:129:9`!, &mtr, |
| 1516 | &err)) { |
| 1517 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(b->page.id() |
| 1518 | == page_id_t(0, FSP_IBUF_HEADER_PAGE_NO)); |
| 1519 | b = fseg_alloc_free_page_generalcxx . . $ fseg_alloc_free_page_general(deb8b3a5a4fea0d7).( |
| 1520 | b->pagecxx . . $ buf_block_t#page..framecxx . . $ buf_page_t#frame. + PAGE_DATAcxx . . $ `storage/innobase/include/page0page.h:129:9`!, |
| 1521 | FSP_IBUF_TREE_ROOT_PAGE_NOcxx . . $ `storage/innobase/include/fsp0types.h:172:9`!, FSP_UPcxx . . $ `storage/innobase/include/fsp0types.h:53:9`!, false, |
| 1522 | &mtr, &mtr, &err); |
| 1523 | if (b) { |
| 1524 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(b->page.id() == page_id_t |
| 1525 | (0, FSP_IBUF_TREE_ROOT_PAGE_NO)); |
| 1526 | mtr.set_modifiedcxx . . $ mtr_t#set_modified(9d39882757cf72c6).(*b); |
| 1527 | fsp_init_file_pagecxx . . $ `storage/innobase/include/fsp0fsp.h:562:10`!(fil_system.sys_space, b, |
| 1528 | &mtr); |
| 1529 | } else { |
| 1530 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(err != DB_SUCCESS); |
| 1531 | } |
| 1532 | } |
| 1533 | /* To maintain backward compatibility we create only |
| 1534 | the first rollback segment before the double write buffer. |
| 1535 | All the remaining rollback segments will be created later, |
| 1536 | after the double write buffer has been created. */ |
| 1537 | if (err == DB_SUCCESScxx . . $ DB_SUCCESS.) { |
| 1538 | err = trx_sys_create_sys_pagescxx . . $ trx_sys_create_sys_pages(5ccbb810592e2a69).(&mtr); |
| 1539 | } |
| 1540 | mtr.commitcxx . . $ mtr_t#commit(49f6e7a06ebc5aa8).(); |
| 1541 | |
| 1542 | if (err != DB_SUCCESScxx . . $ DB_SUCCESS.) { |
| 1543 | return(srv_init_abortcxx . . $ `storage/innobase/srv/srv0start.cc:1021:10`!(err)); |
| 1544 | } |
| 1545 | |
| 1546 | err = dict_createcxx . . $ dict_create(629d9d73bf1a44e9).(); |
| 1547 | |
| 1548 | if (err != DB_SUCCESScxx . . $ DB_SUCCESS.) { |
| 1549 | return(srv_init_abortcxx . . $ `storage/innobase/srv/srv0start.cc:1021:10`!(err)); |
| 1550 | } |
| 1551 | |
| 1552 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(!srv_log_file_created); |
| 1553 | ut_dcxx . . $ `storage/innobase/include/ut0dbg.h:68:9`!(srv_log_file_created= true); |
| 1554 | |
| 1555 | if (log_syscxx . . $ log_sys..resize_renamecxx . . $ log_t#resize_rename(77ce49a7840d23c7).()) { |
| 1556 | return(srv_init_abortcxx . . $ `storage/innobase/srv/srv0start.cc:1021:10`!(DB_ERROR)); |
| 1557 | } |
| 1558 | } else { |
| 1559 | /* Suppress warnings in fil_space_t::create() for files |
| 1560 | that are being read before dict_boot() has recovered |
| 1561 | DICT_HDR_MAX_SPACE_ID. */ |
| 1562 | fil_systemcxx . . $ fil_system..space_id_reuse_warnedcxx . . $ fil_system_t#space_id_reuse_warned. = true; |
| 1563 | |
| 1564 | /* We always try to do a recovery, even if the database had |
| 1565 | been shut down normally: this is the normal startup path */ |
| 1566 | |
| 1567 | err = recv_recovery_from_checkpoint_startcxx . . $ recv_recovery_from_checkpoint_start(629d9d73bf1a44e9).(); |
| 1568 | recv_syscxx . . $ recv_sys..close_filescxx . . $ recv_sys_t#close_files(49f6e7a06ebc5aa8).(); |
| 1569 | |
| 1570 | bool must_upgrade_ibuf = false; |
| 1571 | |
| 1572 | switch (srv_operationcxx . . $ srv_operation.) { |
| 1573 | case SRV_OPERATION_NORMALcxx . . $ SRV_OPERATION_NORMAL.: |
| 1574 | case SRV_OPERATION_EXPORT_RESTOREDcxx . . $ SRV_OPERATION_EXPORT_RESTORED.: |
| 1575 | case SRV_OPERATION_RESTORE_EXPORTcxx . . $ SRV_OPERATION_RESTORE_EXPORT.: |
| 1576 | if (err != DB_SUCCESScxx . . $ DB_SUCCESS.) { |
| 1577 | break; |
| 1578 | } |
| 1579 | |
| 1580 | err = ibuf_upgrade_neededcxx . . $ ibuf_upgrade_needed(629d9d73bf1a44e9).(); |
| 1581 | |
| 1582 | if (UNIV_UNLIKELYcxx . . $ `storage/innobase/include/univ.i:439:9`!(err == DB_FAIL)) { |
| 1583 | must_upgrade_ibuf = true; |
| 1584 | err = ibuf_log_rebuild_if_neededcxx . . $ ibuf_log_rebuild_if_needed(629d9d73bf1a44e9).(); |
| 1585 | } |
| 1586 | |
| 1587 | if (err != DB_SUCCESScxx . . $ DB_SUCCESS.) { |
| 1588 | break; |
| 1589 | } |
| 1590 | |
| 1591 | err = dict_bootcxx . . $ dict_boot(629d9d73bf1a44e9).(); |
| 1592 | /* fall through */ |
| 1593 | case SRV_OPERATION_RESTOREcxx . . $ SRV_OPERATION_RESTORE.: |
| 1594 | if (err != DB_SUCCESScxx . . $ DB_SUCCESS.) { |
| 1595 | break; |
| 1596 | } |
| 1597 | |
| 1598 | srv_undo_tablespaces_activecxx . . $ srv_undo_tablespaces_active. |
| 1599 | = trx_rseg_get_n_undo_tablespacescxx . . $ trx_rseg_get_n_undo_tablespaces(db52760e79bf9054).(); |
| 1600 | break; |
| 1601 | default: |
| 1602 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!("wrong mariabackup mode" == 0); |
| 1603 | } |
| 1604 | |
| 1605 | if (err != DB_SUCCESScxx . . $ DB_SUCCESS.) { |
| 1606 | return srv_init_abortcxx . . $ `storage/innobase/srv/srv0start.cc:1021:10`!(err); |
| 1607 | } |
| 1608 | |
| 1609 | if (srv_force_recoverycxx . . $ srv_force_recovery. < SRV_FORCE_NO_LOG_REDOcxx . . $ SRV_FORCE_NO_LOG_REDO.) { |
| 1610 | /* Apply the hashed log records to the |
| 1611 | respective file pages, for the last batch of |
| 1612 | recv_group_scan_log_recs(). |
| 1613 | Since it may generate huge batch of threadpool tasks, |
| 1614 | for read io task group, scale down thread creation rate |
| 1615 | by temporarily restricting tpool concurrency. |
| 1616 | */ |
| 1617 | srv_thread_poolcxx . . $ srv_thread_pool.->set_concurrencycxx . . $ tpool/thread_pool#set_concurrency(cb2f890c2fdad230).(srv_n_read_io_threadscxx . . $ srv_n_read_io_threads.); |
| 1618 | |
| 1619 | mysql_mutex_lockcxx . . $ `include/mysql/psi/mysql_thread.h:360:11`!(&recv_sys.mutex); |
| 1620 | recv_syscxx . . $ recv_sys..applycxx . . $ recv_sys_t#apply(b45ddcbc8423892c).(true); |
| 1621 | mysql_mutex_unlockcxx . . $ `include/mysql/psi/mysql_thread.h:391:11`!(&recv_sys.mutex); |
| 1622 | |
| 1623 | srv_thread_poolcxx . . $ srv_thread_pool.->set_concurrencycxx . . $ tpool/thread_pool#set_concurrency(cb2f890c2fdad230).(); |
| 1624 | |
| 1625 | if (recv_syscxx . . $ recv_sys..is_corrupt_logcxx . . $ recv_sys_t#is_corrupt_log(50ce9a9e25b4a850).() |
| 1626 | || recv_syscxx . . $ recv_sys..is_corrupt_fscxx . . $ recv_sys_t#is_corrupt_fs(50ce9a9e25b4a850).()) { |
| 1627 | return(srv_init_abortcxx . . $ `storage/innobase/srv/srv0start.cc:1021:10`!(DB_CORRUPTION)); |
| 1628 | } |
| 1629 | |
| 1630 | if (srv_operationcxx . . $ srv_operation. != SRV_OPERATION_RESTOREcxx . . $ SRV_OPERATION_RESTORE. |
| 1631 | || recv_needed_recoverycxx . . $ recv_needed_recovery.) { |
| 1632 | } |
| 1633 | |
| 1634 | DBUG_PRINTcxx . . $ `include/my_dbug.h:174:9`!("ib_log", ("apply completed")); |
| 1635 | |
| 1636 | if (srv_operationcxx . . $ srv_operation. != SRV_OPERATION_RESTOREcxx . . $ SRV_OPERATION_RESTORE.) { |
| 1637 | err = srv_load_tablescxx . . $ srv_load_tables(44f7aba9ad2324c1).(must_upgrade_ibuf); |
| 1638 | if (err != DB_SUCCESScxx . . $ DB_SUCCESS.) { |
| 1639 | return srv_init_abortcxx . . $ `storage/innobase/srv/srv0start.cc:1021:10`!(err); |
| 1640 | } |
| 1641 | |
| 1642 | err = trx_lists_init_at_db_startcxx . . $ trx_lists_init_at_db_start(629d9d73bf1a44e9).(); |
| 1643 | if (err != DB_SUCCESScxx . . $ DB_SUCCESS.) { |
| 1644 | return srv_init_abortcxx . . $ `storage/innobase/srv/srv0start.cc:1021:10`!(err); |
| 1645 | } |
| 1646 | |
| 1647 | if (recv_needed_recoverycxx . . $ recv_needed_recovery.) { |
| 1648 | trx_sys_print_mysql_binlog_offsetcxx . . $ trx_sys_print_mysql_binlog_offset(49f6e7a06ebc5aa8).(); |
| 1649 | } |
| 1650 | } else if (recv_needed_recoverycxx . . $ recv_needed_recovery.) { |
| 1651 | err = trx_lists_init_at_db_startcxx . . $ trx_lists_init_at_db_start(629d9d73bf1a44e9).(); |
| 1652 | if (err != DB_SUCCESScxx . . $ DB_SUCCESS.) { |
| 1653 | return srv_init_abortcxx . . $ `storage/innobase/srv/srv0start.cc:1021:10`!(err); |
| 1654 | } |
| 1655 | trx_sys_print_mysql_binlog_offsetcxx . . $ trx_sys_print_mysql_binlog_offset(49f6e7a06ebc5aa8).(); |
| 1656 | } |
| 1657 | } |
| 1658 | |
| 1659 | fil_systemcxx . . $ fil_system..space_id_reuse_warnedcxx . . $ fil_system_t#space_id_reuse_warned. = false; |
| 1660 | |
| 1661 | if (srv_operationcxx . . $ srv_operation. > SRV_OPERATION_EXPORT_RESTOREDcxx . . $ SRV_OPERATION_EXPORT_RESTORED.) { |
| 1662 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(srv_operation == SRV_OPERATION_RESTORE_EXPORT |
| 1663 | || srv_operation == SRV_OPERATION_RESTORE); |
| 1664 | return(err); |
| 1665 | } |
| 1666 | |
| 1667 | /* Upgrade or resize or rebuild the redo logs before |
| 1668 | generating any dirty pages, so that the old redo log |
| 1669 | file will not be written to. */ |
| 1670 | |
| 1671 | err = srv_log_rebuild_if_neededcxx . . $ srv_log_rebuild_if_needed(61cafcde64169af4).(); |
| 1672 | |
| 1673 | if (err != DB_SUCCESScxx . . $ DB_SUCCESS.) { |
| 1674 | return srv_init_abortcxx . . $ `storage/innobase/srv/srv0start.cc:1021:10`!(err); |
| 1675 | } |
| 1676 | |
| 1677 | recv_syscxx . . $ recv_sys..debug_freecxx . . $ recv_sys_t#debug_free(49f6e7a06ebc5aa8).(); |
| 1678 | |
| 1679 | if (!srv_read_only_modecxx . . $ srv_read_only_mode.) { |
| 1680 | const uint32_tcxx . . $ uint32_t# flags = FSP_FLAGS_PAGE_SSIZEcxx . . $ `storage/innobase/include/fsp0fsp.h:44:9`!(); |
| 1681 | for (uint32_tcxx . . $ uint32_t# id = srv_undo_space_id_startcxx . . $ srv_undo_space_id_start.; |
| 1682 | id <= srv_undo_tablespacescxx . . $ srv_undo_tablespaces.; id++) { |
| 1683 | if (fil_space_tcxx . . $ fil_space_t#* space = fil_space_getcxx . . $ fil_space_get(fb1f3aca84eadcbc).(id)) { |
| 1684 | fsp_flags_try_adjustcxx . . $ fsp_flags_try_adjust(9b026bbe728f3d55).(space, flags); |
| 1685 | } |
| 1686 | } |
| 1687 | |
| 1688 | if (sum_of_new_sizes > 0) { |
| 1689 | /* New data file(s) were added */ |
| 1690 | mtr.startcxx . . $ mtr_t#start(49f6e7a06ebc5aa8).(); |
| 1691 | mtr.x_lock_spacecxx . . $ mtr_t#x_lock_space(932cf7f430860204).(fil_systemcxx . . $ fil_system..sys_spacecxx . . $ fil_system_t#sys_space.); |
| 1692 | buf_block_tcxx . . $ buf_block_t#* block = buf_page_getcxx . . $ `storage/innobase/include/buf0buf.h:149:10`!( |
| 1693 | page_id_t(0, 0), 0, |
| 1694 | RW_SX_LATCH, &mtr); |
| 1695 | /* The first page of the system tablespace |
| 1696 | should already have been successfully |
| 1697 | accessed earlier during startup. */ |
| 1698 | ut_acxx . . $ `storage/innobase/include/ut0dbg.h:50:9`!(block); |
| 1699 | ulintcxx . . $ ulint# size = mach_read_from_4cxx . . $ mach_read_from_4(ca1608e2c87725e2).( |
| 1700 | FSP_HEADER_OFFSETcxx . . $ `storage/innobase/include/fsp0fsp.h:102:9`! + FSP_SIZEcxx . . $ `storage/innobase/include/fsp0fsp.h:120:9`! |
| 1701 | + block->pagecxx . . $ buf_block_t#page..framecxx . . $ buf_page_t#frame.); |
| 1702 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(size == fil_system.sys_space |
| 1703 | ->size_in_header); |
| 1704 | size += sum_of_new_sizes; |
| 1705 | mtr.writecxx . . $ mtr_t#write(4888ddbfa94c5eeb).<4>(*block, |
| 1706 | FSP_HEADER_OFFSETcxx . . $ `storage/innobase/include/fsp0fsp.h:102:9`! + FSP_SIZEcxx . . $ `storage/innobase/include/fsp0fsp.h:120:9`! |
| 1707 | + block->pagecxx . . $ buf_block_t#page..framecxx . . $ buf_page_t#frame., size); |
| 1708 | fil_systemcxx . . $ fil_system..sys_spacecxx . . $ fil_system_t#sys_space.->size_in_headercxx . . $ fil_space_t#size_in_header. |
| 1709 | = uint32_tcxx . . $ uint32_t#(size); |
| 1710 | mtr.commitcxx . . $ mtr_t#commit(49f6e7a06ebc5aa8).(); |
| 1711 | log_write_up_tocxx . . $ log_write_up_to(1121c55f63b1cb8).(mtr.commit_lsncxx . . $ mtr_t#commit_lsn(fe4d2d262d4164a8).(), true); |
| 1712 | } |
| 1713 | } |
| 1714 | |
| 1715 | #ifdef UNIV_DEBUG |
| 1716 | { |
| 1717 | mtr.start(); |
| 1718 | buf_block_t* block = buf_page_get(page_id_t(0, 0), 0, |
| 1719 | RW_S_LATCH, &mtr); |
| 1720 | ut_ad(mach_read_from_4(FSP_SIZE + FSP_HEADER_OFFSET |
| 1721 | + block->page.frame) |
| 1722 | == fil_system.sys_space->size_in_header); |
| 1723 | mtr.commit(); |
| 1724 | } |
| 1725 | #endif |
| 1726 | const ulintcxx . . $ ulint# tablespace_size_in_header |
| 1727 | = fil_systemcxx . . $ fil_system..sys_spacecxx . . $ fil_system_t#sys_space.->size_in_headercxx . . $ fil_space_t#size_in_header.; |
| 1728 | const ulintcxx . . $ ulint# sum_of_data_file_sizes |
| 1729 | = srv_sys_spacecxx . . $ srv_sys_space..get_sum_of_sizescxx . . $ Tablespace#get_sum_of_sizes(ddd8539a2fcdd4ce).(); |
| 1730 | /* Compare the system tablespace file size to what is |
| 1731 | stored in FSP_SIZE. In srv_sys_space.open_or_create() |
| 1732 | we already checked that the file sizes match the |
| 1733 | innodb_data_file_path specification. */ |
| 1734 | if (srv_read_only_modecxx . . $ srv_read_only_mode. |
| 1735 | || sum_of_data_file_sizes == tablespace_size_in_header) { |
| 1736 | /* Do not complain about the size. */ |
| 1737 | } else if (!srv_sys_spacecxx . . $ srv_sys_space..can_auto_extend_last_filecxx . . $ SysTablespace#can_auto_extend_last_file(fe4d2d262d4164a8).() |
| 1738 | || sum_of_data_file_sizes |
| 1739 | < tablespace_size_in_header) { |
| 1740 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "Tablespace size stored in header is " |
| 1741 | <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). tablespace_size_in_header |
| 1742 | <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). " pages, but the sum of data file sizes is " |
| 1743 | <<cxx . . $ ib/logger#`operator<<`(8dc2c095a0caceff). sum_of_data_file_sizes <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). " pages"; |
| 1744 | |
| 1745 | if (srv_force_recoverycxx . . $ srv_force_recovery. == 0 |
| 1746 | && sum_of_data_file_sizes |
| 1747 | < tablespace_size_in_header) { |
| 1748 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). |
| 1749 | "Cannot start InnoDB. The tail of" |
| 1750 | " the system tablespace is" |
| 1751 | " missing. Have you edited" |
| 1752 | " innodb_data_file_path in my.cnf" |
| 1753 | " in an inappropriate way, removing" |
| 1754 | " data files from there?" |
| 1755 | " You can set innodb_force_recovery=1" |
| 1756 | " in my.cnf to force" |
| 1757 | " a startup if you are trying to" |
| 1758 | " recover a badly corrupt database."; |
| 1759 | |
| 1760 | return(srv_init_abortcxx . . $ `storage/innobase/srv/srv0start.cc:1021:10`!(DB_ERROR)); |
| 1761 | } |
| 1762 | } |
| 1763 | } |
| 1764 | |
| 1765 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(err == DB_SUCCESS); |
| 1766 | ut_acxx . . $ `storage/innobase/include/ut0dbg.h:50:9`!(sum_of_new_sizes != ULINT_UNDEFINEDcxx . . $ `storage/innobase/include/univ.i:329:9`!); |
| 1767 | |
| 1768 | /* Create the doublewrite buffer to a new tablespace */ |
| 1769 | if (!srv_read_only_modecxx . . $ srv_read_only_mode. && srv_force_recoverycxx . . $ srv_force_recovery. < SRV_FORCE_NO_TRX_UNDOcxx . . $ SRV_FORCE_NO_TRX_UNDO. |
| 1770 | && !buf_dblwrcxx . . $ buf_dblwr..createcxx . . $ buf_dblwr_t#create(77ce49a7840d23c7).()) { |
| 1771 | return(srv_init_abortcxx . . $ `storage/innobase/srv/srv0start.cc:1021:10`!(DB_ERROR)); |
| 1772 | } |
| 1773 | |
| 1774 | /* Recreate the undo tablespaces */ |
| 1775 | if (!high_level_read_onlycxx . . $ high_level_read_only.) { |
| 1776 | err = srv_undo_tablespaces_reinitializecxx . . $ srv_undo_tablespaces_reinitialize(629d9d73bf1a44e9).(); |
| 1777 | if (err) { |
| 1778 | return srv_init_abortcxx . . $ `storage/innobase/srv/srv0start.cc:1021:10`!(err); |
| 1779 | } |
| 1780 | } |
| 1781 | |
| 1782 | srv_undo_tablespacescxx . . $ srv_undo_tablespaces. = srv_undo_tablespaces_opencxx . . $ srv_undo_tablespaces_open.; |
| 1783 | |
| 1784 | /* Here the double write buffer has already been created and so |
| 1785 | any new rollback segments will be allocated after the double |
| 1786 | write buffer. The default segment should already exist. |
| 1787 | We create the new segments only if it's a new database or |
| 1788 | the database was shutdown cleanly. */ |
| 1789 | |
| 1790 | /* Note: When creating the extra rollback segments during an upgrade |
| 1791 | we violate the latching order, even if the change buffer is empty. |
| 1792 | It cannot create a deadlock because we are still |
| 1793 | running in single threaded mode essentially. Only the IO threads |
| 1794 | should be running at this stage. */ |
| 1795 | |
| 1796 | if (!trx_sys_create_rsegscxx . . $ trx_sys_create_rsegs(c9857a73d68e59ba).()) { |
| 1797 | return(srv_init_abortcxx . . $ `storage/innobase/srv/srv0start.cc:1021:10`!(DB_ERROR)); |
| 1798 | } |
| 1799 | |
| 1800 | if (!create_new_db) { |
| 1801 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(high_level_read_only |
| 1802 | || srv_force_recovery < SRV_FORCE_NO_UNDO_LOG_SCAN); |
| 1803 | |
| 1804 | if (!high_level_read_onlycxx . . $ high_level_read_only. |
| 1805 | && srv_sys_spacecxx . . $ srv_sys_space..can_auto_shrinkcxx . . $ SysTablespace#can_auto_shrink(50ce9a9e25b4a850).()) { |
| 1806 | fsp_system_tablespace_truncatecxx . . $ fsp_system_tablespace_truncate(b45ddcbc8423892c).(false); |
| 1807 | DBUG_EXECUTE_IFcxx . . $ `include/my_dbug.h:172:9`!("crash_after_sys_truncate", |
| 1808 | return srv_init_abort(DB_ERROR);); |
| 1809 | } |
| 1810 | |
| 1811 | /* Validate a few system page types that were left |
| 1812 | uninitialized before MySQL or MariaDB 5.5. */ |
| 1813 | if (!high_level_read_onlycxx . . $ high_level_read_only. |
| 1814 | && !fil_systemcxx . . $ fil_system..sys_spacecxx . . $ fil_system_t#sys_space.->full_crc32cxx . . $ fil_space_t#full_crc32(3482b152b9333168).()) { |
| 1815 | buf_block_tcxx . . $ buf_block_t#* block; |
| 1816 | mtr.startcxx . . $ mtr_t#start(49f6e7a06ebc5aa8).(); |
| 1817 | /* Bitmap page types will be reset in |
| 1818 | buf_dblwr_check_block() without redo logging. */ |
| 1819 | block = buf_page_getcxx . . $ `storage/innobase/include/buf0buf.h:149:10`!( |
| 1820 | page_id_t(0, FSP_IBUF_HEADER_PAGE_NOcxx . . $ `storage/innobase/include/fsp0types.h:169:9`!), |
| 1821 | 0, RW_X_LATCH, &mtr); |
| 1822 | if (UNIV_UNLIKELYcxx . . $ `storage/innobase/include/univ.i:439:9`!(!block)) { |
| 1823 | corrupted_old_page: |
| 1824 | mtr.commitcxx . . $ mtr_t#commit(49f6e7a06ebc5aa8).(); |
| 1825 | return srv_init_abortcxx . . $ `storage/innobase/srv/srv0start.cc:1021:10`!(DB_CORRUPTION); |
| 1826 | } |
| 1827 | fil_block_check_typecxx . . $ fil_block_check_type(e1ead169ec4e69fa).(*block, FIL_PAGE_TYPE_SYScxx . . $ FIL_PAGE_TYPE_SYS., &mtr); |
| 1828 | /* Already MySQL 3.23.53 initialized |
| 1829 | FSP_IBUF_TREE_ROOT_PAGE_NO to |
| 1830 | FIL_PAGE_INDEX. No need to reset that one. */ |
| 1831 | block = buf_page_getcxx . . $ `storage/innobase/include/buf0buf.h:149:10`!( |
| 1832 | page_id_t(TRX_SYS_SPACE, TRX_SYS_PAGE_NOcxx . . $ `storage/innobase/include/trx0types.h:44:9`!), |
| 1833 | 0, RW_X_LATCH, &mtr); |
| 1834 | if (UNIV_UNLIKELYcxx . . $ `storage/innobase/include/univ.i:439:9`!(!block)) { |
| 1835 | goto corrupted_old_page; |
| 1836 | } |
| 1837 | fil_block_check_typecxx . . $ fil_block_check_type(e1ead169ec4e69fa).(*block, FIL_PAGE_TYPE_TRX_SYScxx . . $ FIL_PAGE_TYPE_TRX_SYS., |
| 1838 | &mtr); |
| 1839 | block = buf_page_getcxx . . $ `storage/innobase/include/buf0buf.h:149:10`!( |
| 1840 | page_id_t(TRX_SYS_SPACE, |
| 1841 | FSP_FIRST_RSEG_PAGE_NOcxx . . $ `storage/innobase/include/fsp0types.h:178:9`!), |
| 1842 | 0, RW_X_LATCH, &mtr); |
| 1843 | if (UNIV_UNLIKELYcxx . . $ `storage/innobase/include/univ.i:439:9`!(!block)) { |
| 1844 | goto corrupted_old_page; |
| 1845 | } |
| 1846 | fil_block_check_typecxx . . $ fil_block_check_type(e1ead169ec4e69fa).(*block, FIL_PAGE_TYPE_SYScxx . . $ FIL_PAGE_TYPE_SYS., &mtr); |
| 1847 | block = buf_page_getcxx . . $ `storage/innobase/include/buf0buf.h:149:10`!( |
| 1848 | page_id_t(TRX_SYS_SPACE, FSP_DICT_HDR_PAGE_NOcxx . . $ `storage/innobase/include/fsp0types.h:180:9`!), |
| 1849 | 0, RW_X_LATCH, &mtr); |
| 1850 | if (UNIV_UNLIKELYcxx . . $ `storage/innobase/include/univ.i:439:9`!(!block)) { |
| 1851 | goto corrupted_old_page; |
| 1852 | } |
| 1853 | fil_block_check_typecxx . . $ fil_block_check_type(e1ead169ec4e69fa).(*block, FIL_PAGE_TYPE_SYScxx . . $ FIL_PAGE_TYPE_SYS., &mtr); |
| 1854 | mtr.commitcxx . . $ mtr_t#commit(49f6e7a06ebc5aa8).(); |
| 1855 | } |
| 1856 | |
| 1857 | /* Roll back any recovered data dictionary |
| 1858 | transactions, so that the data dictionary tables will |
| 1859 | be free of any locks. The data dictionary latch |
| 1860 | should guarantee that there is at most one data |
| 1861 | dictionary transaction active at a time. */ |
| 1862 | if (!high_level_read_onlycxx . . $ high_level_read_only. |
| 1863 | && srv_force_recoverycxx . . $ srv_force_recovery. <= SRV_FORCE_NO_TRX_UNDOcxx . . $ SRV_FORCE_NO_TRX_UNDO.) { |
| 1864 | /* If the following call is ever removed, the |
| 1865 | first-time ha_innobase::open() must hold (or |
| 1866 | acquire and release) a table lock that |
| 1867 | conflicts with trx_resurrect_table_locks(), to |
| 1868 | ensure that any recovered incomplete ALTER |
| 1869 | TABLE will have been rolled back. Otherwise, |
| 1870 | dict_table_t::instant could be cleared by |
| 1871 | rollback invoking |
| 1872 | dict_index_t::clear_instant_alter() while open |
| 1873 | table handles exist in client connections. */ |
| 1874 | trx_rollback_recoveredcxx . . $ trx_rollback_recovered(b45ddcbc8423892c).(false); |
| 1875 | } |
| 1876 | |
| 1877 | if (srv_force_recoverycxx . . $ srv_force_recovery. < SRV_FORCE_NO_UNDO_LOG_SCANcxx . . $ SRV_FORCE_NO_UNDO_LOG_SCAN.) { |
| 1878 | dict_load_tablespacescxx . . $ dict_load_tablespaces(a5108321e3739a4b).(); |
| 1879 | } |
| 1880 | |
| 1881 | if (srv_force_recoverycxx . . $ srv_force_recovery. < SRV_FORCE_NO_TRX_UNDOcxx . . $ SRV_FORCE_NO_TRX_UNDO. |
| 1882 | && !srv_read_only_modecxx . . $ srv_read_only_mode.) { |
| 1883 | /* Drop partially created indexes. */ |
| 1884 | row_merge_drop_temp_indexescxx . . $ row_merge_drop_temp_indexes(49f6e7a06ebc5aa8).(); |
| 1885 | #ifdef EMBEDDED_LIBRARY |
| 1886 | /* Rollback incomplete non-DDL transactions */ |
| 1887 | trx_rollback_is_active = true; |
| 1888 | srv_thread_pool->submit_task(&rollback_all_recovered_task); |
| 1889 | #endif |
| 1890 | } |
| 1891 | } |
| 1892 | |
| 1893 | srv_startup_is_before_trx_rollback_phasecxx . . $ srv_startup_is_before_trx_rollback_phase. = false; |
| 1894 | |
| 1895 | if (!srv_read_only_modecxx . . $ srv_read_only_mode.) { |
| 1896 | DBUG_EXECUTE_IFcxx . . $ `include/my_dbug.h:172:9`!("innodb_skip_monitors", goto skip_monitors;); |
| 1897 | /* Create the task which warns of long semaphore waits */ |
| 1898 | srv_start_periodic_timercxx . . $ srv_start_periodic_timer(ae5d182d06b7ee0f).(srv_monitor_timercxx . . $ srv_monitor_timer., srv_monitor_task, |
| 1899 | SRV_MONITOR_INTERVALcxx . . $ SRV_MONITOR_INTERVAL.); |
| 1900 | |
| 1901 | #ifndef DBUG_OFFcxx . . $ `<built-in>:492:9`! |
| 1902 | skip_monitors: |
| 1903 | #endif |
| 1904 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(srv_force_recovery >= SRV_FORCE_NO_UNDO_LOG_SCAN |
| 1905 | || !purge_sys.enabled()); |
| 1906 | |
| 1907 | if (srv_force_recoverycxx . . $ srv_force_recovery. < SRV_FORCE_NO_BACKGROUNDcxx . . $ SRV_FORCE_NO_BACKGROUND.) { |
| 1908 | srv_undo_sourcescxx . . $ srv_undo_sources. = true; |
| 1909 | /* Create the dict stats gathering task */ |
| 1910 | dict_stats_startcxx . . $ dict_stats_start(49f6e7a06ebc5aa8).(); |
| 1911 | /* Create the thread that will optimize the |
| 1912 | FULLTEXT search index subsystem. */ |
| 1913 | fts_optimize_initcxx . . $ fts_optimize_init(49f6e7a06ebc5aa8).(); |
| 1914 | } |
| 1915 | } |
| 1916 | |
| 1917 | err = dict_syscxx . . $ dict_sys..create_or_check_sys_tablescxx . . $ dict_sys_t#create_or_check_sys_tables(61cafcde64169af4).(); |
| 1918 | switch (err) { |
| 1919 | case DB_SUCCESScxx . . $ DB_SUCCESS.: |
| 1920 | break; |
| 1921 | case DB_READ_ONLYcxx . . $ DB_READ_ONLY.: |
| 1922 | if (srv_force_recoverycxx . . $ srv_force_recovery. >= SRV_FORCE_NO_TRX_UNDOcxx . . $ SRV_FORCE_NO_TRX_UNDO.) { |
| 1923 | break; |
| 1924 | } |
| 1925 | ibcxx . . $ ib/::errorcxx . . $ ib/error#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). "Cannot create system tables in read-only mode"; |
| 1926 | /* fall through */ |
| 1927 | default: |
| 1928 | return(srv_init_abortcxx . . $ `storage/innobase/srv/srv0start.cc:1021:10`!(err)); |
| 1929 | } |
| 1930 | |
| 1931 | if (!srv_read_only_modecxx . . $ srv_read_only_mode. |
| 1932 | && srv_operationcxx . . $ srv_operation. <= SRV_OPERATION_EXPORT_RESTOREDcxx . . $ SRV_OPERATION_EXPORT_RESTORED.) { |
| 1933 | /* Initialize the innodb_temporary tablespace and keep |
| 1934 | it open until shutdown. */ |
| 1935 | err = srv_open_tmp_tablespacecxx . . $ srv_open_tmp_tablespace(d04655808700f477).(create_new_db); |
| 1936 | |
| 1937 | if (err != DB_SUCCESScxx . . $ DB_SUCCESS.) { |
| 1938 | return(srv_init_abortcxx . . $ `storage/innobase/srv/srv0start.cc:1021:10`!(err)); |
| 1939 | } |
| 1940 | |
| 1941 | if (srv_force_recoverycxx . . $ srv_force_recovery. < SRV_FORCE_NO_BACKGROUNDcxx . . $ SRV_FORCE_NO_BACKGROUND.) { |
| 1942 | srv_start_periodic_timercxx . . $ srv_start_periodic_timer(ae5d182d06b7ee0f).(srv_master_timercxx . . $ srv_master_timer., srv_master_callback, 1000); |
| 1943 | } |
| 1944 | } |
| 1945 | |
| 1946 | srv_is_being_startedcxx . . $ srv_is_being_started. = false; |
| 1947 | |
| 1948 | if (srv_print_verbose_logcxx . . $ srv_print_verbose_log.) { |
| 1949 | sql_print_informationcxx . . $ sql_print_information(326aeb464d16410c).("InnoDB: " |
| 1950 | "log sequence number " LSN_PFcxx . . $ `storage/innobase/include/log0types.h:36:9`! |
| 1951 | "%s" |
| 1952 | "; transaction id " TRX_ID_FMTcxx . . $ `storage/innobase/include/trx0types.h:34:9`!, |
| 1953 | recv_syscxx . . $ recv_sys..lsncxx . . $ recv_sys_t#lsn., |
| 1954 | log_syscxx . . $ log_sys..is_mmapcxx . . $ log_t#is_mmap(3482b152b9333168).() |
| 1955 | ? " (memory-mapped)" : "", |
| 1956 | trx_syscxx . . $ trx_sys..get_max_trx_idcxx . . $ trx_sys_t#get_max_trx_id(f708dce9a8856c70).()); |
| 1957 | } |
| 1958 | |
| 1959 | if (!srv_read_only_modecxx . . $ srv_read_only_mode.) { |
| 1960 | if (create_new_db) { |
| 1961 | srv_buffer_pool_load_at_startupcxx . . $ srv_buffer_pool_load_at_startup. = FALSEcxx . . $ `include/my_global.h:477:9`!; |
| 1962 | } |
| 1963 | |
| 1964 | #ifdef WITH_WSREPcxx . . $ `/build/tmp.NxIY9EeyJN/package/build/include/my_config.h:539:9`! |
| 1965 | /* |
| 1966 | Create the dump/load thread only when not running with |
| 1967 | --wsrep-recover. |
| 1968 | */ |
| 1969 | if (!get_wsrep_recoverycxx . . $ get_wsrep_recovery(6e9c618e4dd2eafc).()) { |
| 1970 | #endif /* WITH_WSREP */ |
| 1971 | |
| 1972 | /* Start buffer pool dump/load task */ |
| 1973 | buf_load_at_startupcxx . . $ buf_load_at_startup(49f6e7a06ebc5aa8).(); |
| 1974 | |
| 1975 | #ifdef WITH_WSREPcxx . . $ `/build/tmp.NxIY9EeyJN/package/build/include/my_config.h:539:9`! |
| 1976 | } else { |
| 1977 | ibcxx . . $ ib/::warncxx . . $ ib/warn#() <<cxx . . $ ib/logger#`operator<<`(dcbc6b5678e2764). |
| 1978 | "Skipping buffer pool dump/restore during " |
| 1979 | "wsrep recovery."; |
| 1980 | } |
| 1981 | #endif /* WITH_WSREP */ |
| 1982 | |
| 1983 | /* Create thread(s) that handles key rotation. This is |
| 1984 | needed already here as log_preflush_pool_modified_pages |
| 1985 | will flush dirty pages and that might need e.g. |
| 1986 | fil_crypt_threads_cond. */ |
| 1987 | fil_crypt_threads_initcxx . . $ fil_crypt_threads_init(49f6e7a06ebc5aa8).(); |
| 1988 | |
| 1989 | srv_started_redocxx . . $ srv_started_redo. = true; |
| 1990 | } |
| 1991 | |
| 1992 | return(DB_SUCCESScxx . . $ DB_SUCCESS.); |
| 1993 | } |
| 1994 | |
| 1995 | PRAGMA_REENABLE_CHECK_STACK_FRAMEcxx . . $ `include/my_attribute.h:91:9`! |
| 1996 | |
| 1997 | /** |
| 1998 | Shutdown purge to make sure that there is no possibility that we call any |
| 1999 | plugin code (e.g., audit) inside virtual column computation. |
| 2000 | */ |
| 2001 | void innodb_preshutdowncxx . . $ innodb_preshutdown(49f6e7a06ebc5aa8).() |
| 2002 | { |
| 2003 | static bool first_time= true; |
| 2004 | if (!first_time) |
| 2005 | return; |
| 2006 | first_time= false; |
| 2007 | |
| 2008 | if (srv_read_only_modecxx . . $ srv_read_only_mode.) |
| 2009 | return; |
| 2010 | |
| 2011 | #ifndef EMBEDDED_LIBRARY |
| 2012 | if (srv_force_recoverycxx . . $ srv_force_recovery. < SRV_FORCE_NO_TRX_UNDOcxx . . $ SRV_FORCE_NO_TRX_UNDO. && srv_was_startedcxx . . $ srv_was_started. && |
| 2013 | !trx_rollback_is_activecxx . . $ trx_rollback_is_active. && trx_syscxx . . $ trx_sys..any_active_transaction_recoveredcxx . . $ trx_sys_t#any_active_transaction_recovered(c9857a73d68e59ba).()) |
| 2014 | { |
| 2015 | /* Trx rollback thread may not be started yet, since error happened before |
| 2016 | innobase_tc_log_recovery_done(), thus it is started here to finish the |
| 2017 | normal shutdown process. |
| 2018 | */ |
| 2019 | trx_rollback_is_activecxx . . $ trx_rollback_is_active.= true; |
| 2020 | srv_thread_poolcxx . . $ srv_thread_pool.->submit_taskcxx . . $ tpool/thread_pool#submit_task(b575c5a2f6d6c59e).(&rollback_all_recovered_taskcxx . . $ rollback_all_recovered_task.); |
| 2021 | } |
| 2022 | #endif |
| 2023 | |
| 2024 | if (!srv_fast_shutdowncxx . . $ srv_fast_shutdown. && srv_operationcxx . . $ srv_operation. <= SRV_OPERATION_EXPORT_RESTOREDcxx . . $ SRV_OPERATION_EXPORT_RESTORED.) |
| 2025 | if (srv_force_recoverycxx . . $ srv_force_recovery. < SRV_FORCE_NO_TRX_UNDOcxx . . $ SRV_FORCE_NO_TRX_UNDO. && srv_was_startedcxx . . $ srv_was_started.) |
| 2026 | while (trx_syscxx . . $ trx_sys..any_active_transactionscxx . . $ trx_sys_t#any_active_transactions(eded8a470c234103).()) |
| 2027 | stdcxx . . $ std/::this_threadcxx . . $ std/this_thread/::sleep_forcxx . . $ std/this_thread/sleep_for(fb2140da9187dddf).(stdcxx . . $ std/::chronocxx . . $ std/chrono/::millisecondscxx . . $ std/chrono/milliseconds#(1)); |
| 2028 | srv_shutdown_bg_undo_sourcescxx . . $ srv_shutdown_bg_undo_sources(49f6e7a06ebc5aa8).(); |
| 2029 | srv_purge_shutdowncxx . . $ srv_purge_shutdown(49f6e7a06ebc5aa8).(); |
| 2030 | |
| 2031 | if (srv_n_fil_crypt_threadscxx . . $ srv_n_fil_crypt_threads.) |
| 2032 | fil_crypt_set_thread_cntcxx . . $ fil_crypt_set_thread_cnt(cb2f890c2fdad230).(0); |
| 2033 | } |
| 2034 | |
| 2035 | |
| 2036 | /** Shut down InnoDB. */ |
| 2037 | void innodb_shutdowncxx . . $ innodb_shutdown(49f6e7a06ebc5aa8).() |
| 2038 | { |
| 2039 | innodb_preshutdowncxx . . $ innodb_preshutdown(49f6e7a06ebc5aa8).(); |
| 2040 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(!srv_undo_sources); |
| 2041 | const lsn_tcxx . . $ lsn_t# lsn{logs_empty_and_mark_files_at_shutdowncxx . . $ logs_empty_and_mark_files_at_shutdown(cee159cc271e827).()}; |
| 2042 | os_aio_freecxx . . $ os_aio_free(ced63f7c635d850d).(); |
| 2043 | fil_space_tcxx . . $ fil_space_t#::close_allcxx . . $ fil_space_t#close_all(ced63f7c635d850d).(); |
| 2044 | /* Exit any remaining threads. */ |
| 2045 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(!buf_page_cleaner_is_active); |
| 2046 | srv_shutdown_threadscxx . . $ srv_shutdown_threads(b45ddcbc8423892c).(); |
| 2047 | |
| 2048 | if (srv_monitor_filecxx . . $ srv_monitor_file.) { |
| 2049 | my_fclose(srv_monitor_filecxx . . $ srv_monitor_file., MYFcxx . . $ `include/my_global.h:986:9`!(MY_WMEcxx . . $ `include/my_sys.h:57:9`!)); |
| 2050 | srv_monitor_filecxx . . $ srv_monitor_file. = 0; |
| 2051 | if (srv_monitor_file_namecxx . . $ srv_monitor_file_name.) { |
| 2052 | unlink(srv_monitor_file_namecxx . . $ srv_monitor_file_name.); |
| 2053 | ut_freecxx . . $ `storage/innobase/include/ut0new.h:1044:9`!(srv_monitor_file_name); |
| 2054 | } |
| 2055 | } |
| 2056 | |
| 2057 | if (srv_misc_tmpfilecxx . . $ srv_misc_tmpfile.) { |
| 2058 | my_fclose(srv_misc_tmpfilecxx . . $ srv_misc_tmpfile., MYFcxx . . $ `include/my_global.h:986:9`!(MY_WMEcxx . . $ `include/my_sys.h:57:9`!)); |
| 2059 | srv_misc_tmpfilecxx . . $ srv_misc_tmpfile. = 0; |
| 2060 | } |
| 2061 | |
| 2062 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(dict_sys.is_initialised() || !srv_was_started); |
| 2063 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(trx_sys.is_initialised() || !srv_was_started); |
| 2064 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(buf_dblwr.is_created() || !srv_was_started |
| 2065 | || srv_read_only_mode |
| 2066 | || srv_force_recovery >= SRV_FORCE_NO_TRX_UNDO); |
| 2067 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(lock_sys.is_initialised() || !srv_was_started); |
| 2068 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(log_sys.is_initialised() || !srv_was_started); |
| 2069 | |
| 2070 | dict_stats_deinitcxx . . $ dict_stats_deinit(49f6e7a06ebc5aa8).(); |
| 2071 | |
| 2072 | if (srv_started_redocxx . . $ srv_started_redo.) { |
| 2073 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(!srv_read_only_mode); |
| 2074 | /* srv_shutdown_bg_undo_sources() already invoked |
| 2075 | fts_optimize_shutdown(); dict_stats_shutdown(); */ |
| 2076 | |
| 2077 | fil_crypt_threads_cleanupcxx . . $ fil_crypt_threads_cleanup(49f6e7a06ebc5aa8).(); |
| 2078 | } |
| 2079 | |
| 2080 | /* This must be disabled before closing the buffer pool |
| 2081 | and closing the data dictionary. */ |
| 2082 | |
| 2083 | #ifdef BTR_CUR_HASH_ADAPTcxx . . $ `<built-in>:481:9`! |
| 2084 | if (dict_syscxx . . $ dict_sys..is_initialisedcxx . . $ dict_sys_t#is_initialised(3482b152b9333168).()) { |
| 2085 | btr_searchcxx . . $ btr_search..disablecxx . . $ btr_sea#disable(77ce49a7840d23c7).(); |
| 2086 | } |
| 2087 | #endif /* BTR_CUR_HASH_ADAPT */ |
| 2088 | log_syscxx . . $ log_sys..closecxx . . $ log_t#close(49f6e7a06ebc5aa8).(); |
| 2089 | purge_syscxx . . $ purge_sys..closecxx . . $ purge_sys_t#close(49f6e7a06ebc5aa8).(); |
| 2090 | trx_syscxx . . $ trx_sys..closecxx . . $ trx_sys_t#close(49f6e7a06ebc5aa8).(); |
| 2091 | buf_dblwrcxx . . $ buf_dblwr..closecxx . . $ buf_dblwr_t#close(ced63f7c635d850d).(); |
| 2092 | lock_syscxx . . $ lock_sys..closecxx . . $ lock_sys_t#close(49f6e7a06ebc5aa8).(); |
| 2093 | trx_pool_closecxx . . $ trx_pool_close(49f6e7a06ebc5aa8).(); |
| 2094 | |
| 2095 | if (!srv_read_only_modecxx . . $ srv_read_only_mode.) { |
| 2096 | mysql_mutex_destroycxx . . $ `include/mysql/psi/mysql_thread.h:348:11`!(&srv_monitor_file_mutex); |
| 2097 | mysql_mutex_destroycxx . . $ `include/mysql/psi/mysql_thread.h:348:11`!(&srv_misc_tmpfile_mutex); |
| 2098 | } |
| 2099 | |
| 2100 | dict_syscxx . . $ dict_sys..closecxx . . $ dict_sys_t#close(ced63f7c635d850d).(); |
| 2101 | btr_search_sys_freecxx . . $ `storage/innobase/include/btr0sea.h:38:10`!(); |
| 2102 | srv_freecxx . . $ srv_free(49f6e7a06ebc5aa8).(); |
| 2103 | fil_systemcxx . . $ fil_system..closecxx . . $ fil_system_t#close(ced63f7c635d850d).(); |
| 2104 | pars_lexer_closecxx . . $ pars_lexer_close(49f6e7a06ebc5aa8).(); |
| 2105 | recv_syscxx . . $ recv_sys..closecxx . . $ recv_sys_t#close(49f6e7a06ebc5aa8).(); |
| 2106 | |
| 2107 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(buf_pool.is_initialised() || !srv_was_started); |
| 2108 | buf_poolcxx . . $ buf_pool..closecxx . . $ buf_pool_t#close(ced63f7c635d850d).(); |
| 2109 | |
| 2110 | srv_sys_spacecxx . . $ srv_sys_space..shutdowncxx . . $ SysTablespace#shutdown(49f6e7a06ebc5aa8).(); |
| 2111 | if (srv_tmp_spacecxx . . $ srv_tmp_space..get_sanity_check_statuscxx . . $ SysTablespace#get_sanity_check_status(c9857a73d68e59ba).()) { |
| 2112 | if (fil_systemcxx . . $ fil_system..temp_spacecxx . . $ fil_system_t#temp_space.) { |
| 2113 | fil_systemcxx . . $ fil_system..temp_spacecxx . . $ fil_system_t#temp_space.->closecxx . . $ fil_space_t#close(49f6e7a06ebc5aa8).(); |
| 2114 | } |
| 2115 | srv_tmp_spacecxx . . $ srv_tmp_space..delete_filescxx . . $ Tablespace#delete_files(49f6e7a06ebc5aa8).(); |
| 2116 | } |
| 2117 | srv_tmp_spacecxx . . $ srv_tmp_space..shutdowncxx . . $ SysTablespace#shutdown(49f6e7a06ebc5aa8).(); |
| 2118 | |
| 2119 | if (const size_t pce = srv_statscxx . . $ srv_stats..pages_page_compression_errorcxx . . $ srv_stats_t#pages_page_compression_error.) { |
| 2120 | sql_print_warningcxx . . $ sql_print_warning(326aeb464d16410c).("InnoDB: Page compression errors: %zu", pce); |
| 2121 | } |
| 2122 | |
| 2123 | if (lsn && srv_was_startedcxx . . $ srv_was_started. && srv_print_verbose_logcxx . . $ srv_print_verbose_log.) { |
| 2124 | sql_print_informationcxx . . $ sql_print_information(326aeb464d16410c).("Shutdown completed;" |
| 2125 | " log sequence number " LSN_PFcxx . . $ `storage/innobase/include/log0types.h:36:9`! ";" |
| 2126 | " transaction id " TRX_ID_FMTcxx . . $ `storage/innobase/include/trx0types.h:34:9`!, |
| 2127 | lsn, trx_syscxx . . $ trx_sys..get_max_trx_idcxx . . $ trx_sys_t#get_max_trx_id(f708dce9a8856c70).()); |
| 2128 | } |
| 2129 | srv_thread_pool_endcxx . . $ srv_thread_pool_end(49f6e7a06ebc5aa8).(); |
| 2130 | srv_started_redocxx . . $ srv_started_redo. = false; |
| 2131 | srv_was_startedcxx . . $ srv_was_started. = false; |
| 2132 | srv_start_has_been_calledcxx . . $ srv_start_has_been_called. = false; |
| 2133 | } |
| 2134 | |
| 2135 | /** Get the meta-data filename from the table name for a |
| 2136 | single-table tablespace. |
| 2137 | @param[in] table table object |
| 2138 | @param[out] filename filename |
| 2139 | @param[in] max_len filename max length */ |
| 2140 | void |
| 2141 | srv_get_meta_data_filenamecxx . . $ srv_get_meta_data_filename(33198f4e78d9d6f7).( |
| 2142 | dict_table_tcxx . . $ dict_table_t#* table, |
| 2143 | char* filename, |
| 2144 | ulintcxx . . $ ulint# max_len) |
| 2145 | { |
| 2146 | ulintcxx . . $ ulint# len; |
| 2147 | char* path; |
| 2148 | |
| 2149 | /* Make sure the data_dir_path is set. */ |
| 2150 | dict_get_and_save_data_dir_pathcxx . . $ dict_get_and_save_data_dir_path(48b6e9ea9d480c5b).(table); |
| 2151 | |
| 2152 | const char* data_dir_path = DICT_TF_HAS_DATA_DIRcxx . . $ `storage/innobase/include/dict0mem.h:224:9`!(table->flags) |
| 2153 | ? table->data_dir_pathcxx . . $ dict_table_t#data_dir_path. : nullptr; |
| 2154 | ut_adcxx . . $ `storage/innobase/include/ut0dbg.h:62:9`!(!DICT_TF_HAS_DATA_DIR(table->flags) || data_dir_path); |
| 2155 | |
| 2156 | path = fil_make_filepathcxx . . $ fil_make_filepath(8c662c98e388b103).(data_dir_path, table->namecxx . . $ dict_table_t#name., CFGcxx . . $ CFG., |
| 2157 | data_dir_path != nullptr); |
| 2158 | ut_acxx . . $ `storage/innobase/include/ut0dbg.h:50:9`!(path); |
| 2159 | len = strlen(path); |
| 2160 | ut_acxx . . $ `storage/innobase/include/ut0dbg.h:50:9`!(max_len >= len); |
| 2161 | |
| 2162 | strcpy(filename, path); |
| 2163 | |
| 2164 | ut_freecxx . . $ `storage/innobase/include/ut0new.h:1044:9`!(path); |
| 2165 | } |