MySQL 9.4.0
Source Code Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
srv0start.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (c) 1995, 2025, Oracle and/or its affiliates.
4
5This program is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License, version 2.0, as published by the
7Free Software Foundation.
8
9This program is designed to work with certain software (including
10but not limited to OpenSSL) that is licensed under separate terms,
11as designated in a particular file or component or in included license
12documentation. The authors of MySQL hereby grant you an additional
13permission to link the program and your derivative works with the
14separately licensed software that they have either included with
15the program or referenced in the documentation.
16
17This program is distributed in the hope that it will be useful, but WITHOUT
18ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
20for more details.
21
22You should have received a copy of the GNU General Public License along with
23this program; if not, write to the Free Software Foundation, Inc.,
2451 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
26*****************************************************************************/
27
28/** @file include/srv0start.h
29 Starts the Innobase database server
30
31 Created 10/10/1995 Heikki Tuuri
32 *******************************************************/
33
34#ifndef srv0start_h
35#define srv0start_h
36
37#include "os0thread-create.h"
38#ifndef UNIV_HOTBACKUP
39#include "sync0rw.h"
40#endif /* !UNIV_HOTBACKUP */
41#include "trx0purge.h"
42#include "univ.i"
43#include "ut0byte.h"
44
45// Forward declaration
46struct dict_table_t;
47
48#ifndef UNIV_DEBUG
49#define RECOVERY_CRASH(x) \
50 do { \
51 } while (0)
52#else
53#define RECOVERY_CRASH(x) \
54 do { \
55 if (srv_force_recovery_crash == x) { \
56 flush_error_log_messages(); \
57 fprintf(stderr, "innodb_force_recovery_crash=%lu\n", \
58 srv_force_recovery_crash); \
59 fflush(stderr); \
60 _exit(3); \
61 } \
62 } while (0)
63#endif /* UNIV_DEBUG */
64
65/** If buffer pool is less than the size,
66only one buffer pool instance is used. */
67constexpr uint32_t BUF_POOL_SIZE_THRESHOLD = 1024 * 1024 * 1024;
68
69/** Frees the memory allocated by srv_parse_data_file_paths_and_sizes()
70 and srv_parse_log_group_home_dirs(). */
72
73/** Adds a slash or a backslash to the end of a string if it is missing
74 and the string is not empty.
75 @return string which has the separator if the string is not empty */
77 char *str); /*!< in: null-terminated character string */
78#ifndef UNIV_HOTBACKUP
79
80/** Open an undo tablespace.
81@param[in] undo_space Undo tablespace
82@return DB_SUCCESS or error code */
84
85/** Start InnoDB.
86@param[in] create_new_db Whether to create a new database
87@return DB_SUCCESS or error code */
88[[nodiscard]] dberr_t srv_start(bool create_new_db);
89
90/** Fix up an undo tablespace if it was in the process of being truncated
91when the server crashed. This is the second call and is done after the DD
92is available so now we know the space_name, file_name and previous space_id.
93@param[in] space_name undo tablespace name
94@param[in] file_name undo tablespace file name
95@param[in] space_id undo tablespace ID
96@return error code */
97dberr_t srv_undo_tablespace_fixup(const char *space_name, const char *file_name,
98 space_id_t space_id);
99
100/** On a restart, initialize the remaining InnoDB subsystems so that
101any tables (including data dictionary tables) can be accessed. */
103
104/** Start up the InnoDB service threads which are independent of DDL recovery.
105 */
106void srv_start_threads();
107
108/** Start the remaining InnoDB service threads which must wait for
109complete DD recovery(post the DDL recovery) */
111
112/** Start purge threads. During upgrade we start
113purge threads early to apply purge. */
115
116/** Get the encryption-data filename from the table name for a
117single-table tablespace.
118@param[in] table table object
119@param[out] filename filename
120@param[in] max_len filename max length */
122 ulint max_len);
123#endif /* !UNIV_HOTBACKUP */
124
125/** true if the server is being started */
126extern bool srv_is_being_started;
127/** true if SYS_TABLESPACES is available for lookups */
128extern bool srv_sys_tablespaces_open;
129/** true if the server is being started, before rolling back any
130incomplete transactions */
132
133/** true if a raw partition is in use */
134extern bool srv_start_raw_disk_in_use;
135
136#endif
uint32_t space_id_t
Tablespace identifier.
Definition: api0api.h:48
dberr_t
Definition: db0err.h:39
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1084
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
std::string file_name(Log_file_id file_id)
Provides name of the log file with the given file id, e.g.
Definition: log0pre_8_0_30.cc:94
The interface to the threading wrapper.
const char * filename
Definition: pfs_example_component_population.cc:67
void srv_get_encryption_data_filename(dict_table_t *table, char *filename, ulint max_len)
Get the encryption-data filename from the table name for a single-table tablespace.
Definition: srv0start.cc:2850
void srv_dict_recover_on_restart()
On a restart, initialize the remaining InnoDB subsystems so that any tables (including data dictionar...
Definition: srv0start.cc:2124
void srv_free_paths_and_sizes(void)
Frees the memory allocated by srv_parse_data_file_paths_and_sizes() and srv_parse_log_group_home_dirs...
dberr_t srv_undo_tablespace_open(undo::Tablespace &undo_space)
Open an undo tablespace.
Definition: srv0start.cc:498
dberr_t srv_undo_tablespace_fixup(const char *space_name, const char *file_name, space_id_t space_id)
Fix up an undo tablespace if it was in the process of being truncated when the server crashed.
Definition: srv0start.cc:435
bool srv_startup_is_before_trx_rollback_phase
true if the server is being started, before rolling back any incomplete transactions
Definition: srv0start.cc:138
void srv_start_threads_after_ddl_recovery()
Start the remaining InnoDB service threads which must wait for complete DD recovery(post the DDL reco...
Definition: srv0start.cc:2274
void srv_start_purge_threads()
Start purge threads.
Definition: srv0start.cc:2183
void srv_start_threads()
Start up the InnoDB service threads which are independent of DDL recovery.
Definition: srv0start.cc:2211
bool srv_start_raw_disk_in_use
true if a raw partition is in use
Definition: srv0start.cc:130
bool srv_sys_tablespaces_open
true if SYS_TABLESPACES is available for lookups
Definition: srv0start.cc:135
constexpr uint32_t BUF_POOL_SIZE_THRESHOLD
If buffer pool is less than the size, only one buffer pool instance is used.
Definition: srv0start.h:67
dberr_t srv_start(bool create_new_db)
Start InnoDB.
Definition: srv0start.cc:1329
bool srv_is_being_started
true if the server is being started
Definition: srv0start.cc:133
char * srv_add_path_separator_if_needed(char *str)
Adds a slash or a backslash to the end of a string if it is missing and the string is not empty.
Data structure for a database table.
Definition: dict0mem.h:1913
An undo::Tablespace object is used to easily convert between undo_space_id and undo_space_num and to ...
Definition: trx0purge.h:312
The read-write lock (for threads, not for database transactions)
Purge old versions.
Version control for database, common definitions, and include files.
unsigned long int ulint
Definition: univ.i:406
Utilities for byte operations.