MySQL 8.0.40
Source Code Documentation
dict0upgrade.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (c) 1996, 2024, 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#include "my_inttypes.h"
29
30class THD;
31struct TABLE;
32
33/* This is used only during upgrade. We don't use ids
34from DICT_HDR during upgrade because unlike bootstrap case,
35the ids are moved after user table creation. Since we
36want to create dictionary tables with fixed ids, we use
37in-memory counter for upgrade */
38extern uint32_t dd_upgrade_indexes_num;
39
40namespace dd {
41class Table;
42class Tablespace;
43} // namespace dd
44
45/** Migrate table from InnoDB Dictionary (INNODB SYS_*) tables to new Data
46Dictionary. Since FTS tables contain table_id in their physical file name
47and during upgrade we reserve DICT_MAX_DD_TABLES for dictionary tables.
48So we rename FTS tablespace files
49@param[in] thd Server thread object
50@param[in] db_name database name
51@param[in] table_name table name
52@param[in,out] dd_table new dictionary table object to be filled
53@param[in] srv_table server table object
54@return false on success, true on failure. */
55bool dd_upgrade_table(THD *thd, const char *db_name, const char *table_name,
56 dd::Table *dd_table, TABLE *srv_table);
57
58/** Migrate tablespace entries from InnoDB SYS_TABLESPACES to new data
59dictionary. FTS Tablespaces are not registered as they are handled differently.
60FTS tablespaces have table_id in their name and we increment table_id of each
61table by DICT_MAX_DD_TABLES
62@param[in,out] thd THD
63@return MySQL error code */
65
66/** Add server and space version number to tablespace while upgrading.
67@param[in] space_id space id of tablespace
68@param[in] server_version_only leave space version unchanged
69@return false on success, true on failure. */
70bool upgrade_space_version(const uint32_t space_id, bool server_version_only);
71
72/** Add server version number to tablespace while upgrading.
73@param[in] tablespace dd::Tablespace
74@return false on success, true on failure. */
76
77/** Upgrade innodb undo logs after upgrade. Also increment the table_id
78offset by DICT_MAX_DD_TABLES. This offset increment is because the
79first 256 table_ids are reserved for dictionary.
80@param[in,out] thd THD
81@return MySQL error code */
82int dd_upgrade_logs(THD *thd);
83
84/** If upgrade is successful, this API is used to flush innodb
85dirty pages to disk. In case of server crash, this function
86sets storage engine for rollback any changes.
87@param[in,out] thd THD
88@param[in] failed_upgrade true when upgrade failed
89@return MySQL error code*/
90int dd_upgrade_finish(THD *thd, bool failed_upgrade);
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:34
Data structure that contains the information about shared tablespaces.
Definition: fsp0space.h:47
space_id_t space_id() const
Get the space id of the tablespace.
Definition: fsp0space.h:123
Definition: table.h:47
Definition: tablespace.h:55
int dd_upgrade_tablespace(THD *thd)
Migrate tablespace entries from InnoDB SYS_TABLESPACES to new data dictionary.
Definition: dict0upgrade.cc:1115
int dd_upgrade_logs(THD *thd)
Upgrade innodb undo logs after upgrade.
Definition: dict0upgrade.cc:1341
bool upgrade_space_version(const uint32_t space_id, bool server_version_only)
Add server and space version number to tablespace while upgrading.
Definition: dict0upgrade.cc:1289
uint32_t dd_upgrade_indexes_num
Definition: dict0upgrade.cc:54
int dd_upgrade_finish(THD *thd, bool failed_upgrade)
If upgrade is successful, this API is used to flush innodb dirty pages to disk.
Definition: dict0upgrade.cc:1460
bool dd_upgrade_table(THD *thd, const char *db_name, const char *table_name, dd::Table *dd_table, TABLE *srv_table)
Migrate table from InnoDB Dictionary (INNODB SYS_*) tables to new Data Dictionary.
Definition: dict0upgrade.cc:887
Some integer typedefs for easier portability.
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:43
const char * table_name
Definition: rules_table_service.cc:56
const char * db_name
Definition: rules_table_service.cc:55
Definition: table.h:1399