MySQL 8.3.0
Source Code Documentation
srv0start.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (c) 1995, 2023, 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 also distributed with certain software (including but not
10limited to OpenSSL) that is licensed under separate terms, as designated in a
11particular file or component or in included license documentation. The authors
12of MySQL hereby grant you an additional permission to link the program and
13your derivative works with the separately licensed software that they have
14included with MySQL.
15
16This program is distributed in the hope that it will be useful, but WITHOUT
17ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
19for more details.
20
21You should have received a copy of the GNU General Public License along with
22this program; if not, write to the Free Software Foundation, Inc.,
2351 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24
25*****************************************************************************/
26
27/** @file include/srv0start.h
28 Starts the Innobase database server
29
30 Created 10/10/1995 Heikki Tuuri
31 *******************************************************/
32
33#ifndef srv0start_h
34#define srv0start_h
35
36#include "os0thread-create.h"
37#ifndef UNIV_HOTBACKUP
38#include "sync0rw.h"
39#endif /* !UNIV_HOTBACKUP */
40#include "trx0purge.h"
41#include "univ.i"
42#include "ut0byte.h"
43
44// Forward declaration
45struct dict_table_t;
46
47#ifndef UNIV_DEBUG
48#define RECOVERY_CRASH(x) \
49 do { \
50 } while (0)
51#else
52#define RECOVERY_CRASH(x) \
53 do { \
54 if (srv_force_recovery_crash == x) { \
55 flush_error_log_messages(); \
56 fprintf(stderr, "innodb_force_recovery_crash=%lu\n", \
57 srv_force_recovery_crash); \
58 fflush(stderr); \
59 _exit(3); \
60 } \
61 } while (0)
62#endif /* UNIV_DEBUG */
63
64/** If buffer pool is less than the size,
65only one buffer pool instance is used. */
66constexpr uint32_t BUF_POOL_SIZE_THRESHOLD = 1024 * 1024 * 1024;
67
68/** Frees the memory allocated by srv_parse_data_file_paths_and_sizes()
69 and srv_parse_log_group_home_dirs(). */
71
72/** Adds a slash or a backslash to the end of a string if it is missing
73 and the string is not empty.
74 @return string which has the separator if the string is not empty */
76 char *str); /*!< in: null-terminated character string */
77#ifndef UNIV_HOTBACKUP
78
79/** Open an undo tablespace.
80@param[in] undo_space Undo tablespace
81@return DB_SUCCESS or error code */
83
84/** Upgrade undo tablespaces by deleting the old undo tablespaces
85referenced by the TRX_SYS page.
86@return error code */
88
89/** Start InnoDB.
90@param[in] create_new_db Whether to create a new database
91@return DB_SUCCESS or error code */
92[[nodiscard]] dberr_t srv_start(bool create_new_db);
93
94/** Fix up an undo tablespace if it was in the process of being truncated
95when the server crashed. This is the second call and is done after the DD
96is available so now we know the space_name, file_name and previous space_id.
97@param[in] space_name undo tablespace name
98@param[in] file_name undo tablespace file name
99@param[in] space_id undo tablespace ID
100@return error code */
101dberr_t srv_undo_tablespace_fixup(const char *space_name, const char *file_name,
102 space_id_t space_id);
103
104/** On a restart, initialize the remaining InnoDB subsystems so that
105any tables (including data dictionary tables) can be accessed. */
107
108/** Start up the InnoDB service threads which are independent of DDL recovery.
109 */
110void srv_start_threads();
111
112/** Start the remaining InnoDB service threads which must wait for
113complete DD recovery(post the DDL recovery) */
115
116/** Start purge threads. During upgrade we start
117purge threads early to apply purge. */
119
120/** Get the encryption-data filename from the table name for a
121single-table tablespace.
122@param[in] table table object
123@param[out] filename filename
124@param[in] max_len filename max length */
126 ulint max_len);
127#endif /* !UNIV_HOTBACKUP */
128
129/** true if the server is being started */
130extern bool srv_is_being_started;
131/** true if SYS_TABLESPACES is available for lookups */
132extern bool srv_sys_tablespaces_open;
133/** true if the server is being started, before rolling back any
134incomplete transactions */
136
137/** true if a raw partition is in use */
138extern bool srv_start_raw_disk_in_use;
139
140#endif
uint32_t space_id_t
Tablespace identifier.
Definition: api0api.h:46
dberr_t
Definition: db0err.h:38
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1065
static PFS_engine_table_share_proxy table
Definition: pfs.cc:60
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:93
The interface to the threading wrapper.
const char * filename
Definition: pfs_example_component_population.cc:66
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:3112
dberr_t srv_undo_tablespaces_upgrade()
Upgrade undo tablespaces by deleting the old undo tablespaces referenced by the TRX_SYS page.
Definition: srv0start.cc:995
void srv_dict_recover_on_restart()
On a restart, initialize the remaining InnoDB subsystems so that any tables (including data dictionar...
Definition: srv0start.cc:2386
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:531
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:468
bool srv_startup_is_before_trx_rollback_phase
true if the server is being started, before rolling back any incomplete transactions
Definition: srv0start.cc:140
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:2536
void srv_start_purge_threads()
Start purge threads.
Definition: srv0start.cc:2445
void srv_start_threads()
Start up the InnoDB service threads which are independent of DDL recovery.
Definition: srv0start.cc:2473
bool srv_start_raw_disk_in_use
true if a raw partition is in use
Definition: srv0start.cc:132
bool srv_sys_tablespaces_open
true if SYS_TABLESPACES is available for lookups
Definition: srv0start.cc:137
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:66
dberr_t srv_start(bool create_new_db)
Start InnoDB.
Definition: srv0start.cc:1547
bool srv_is_being_started
true if the server is being started
Definition: srv0start.cc:135
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:1908
An undo::Tablespace object is used to easily convert between undo_space_id and undo_space_num and to ...
Definition: trx0purge.h:313
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:405
Utilities for byte operations.