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