MySQL 9.1.0
Source Code Documentation
|
Import a tablespace to a running instance. More...
#include <errno.h>
#include <my_aes.h>
#include <sys/types.h>
#include <memory>
#include <vector>
#include "sql/dd/types/column_type_element.h"
#include "btr0pcur.h"
#include "dict0boot.h"
#include "dict0crea.h"
#include "dict0dd.h"
#include "dict0upgrade.h"
#include "ha_prototypes.h"
#include "ibuf0ibuf.h"
#include "lob0first.h"
#include "lob0impl.h"
#include "lob0lob.h"
#include "lob0pages.h"
#include "log0chkp.h"
#include "pars0pars.h"
#include "que0que.h"
#include "row0import.h"
#include "row0mysql.h"
#include "row0quiesce.h"
#include "row0sel.h"
#include "row0upd.h"
#include "sql/mysqld.h"
#include "srv0start.h"
#include "ut0new.h"
#include "zlob0first.h"
#include "my_dbug.h"
Classes | |
struct | row_stats_t |
For gathering stats on records during phase I. More... | |
struct | row_index_t |
Index information required by IMPORT. More... | |
struct | row_import |
Meta data required by IMPORT. More... | |
class | RecIterator |
Use the page cursor to iterate over records in a block. More... | |
class | IndexPurge |
Class that purges delete marked records from indexes, both secondary and cluster. More... | |
class | AbstractCallback |
Functor that is called for each physical page that is read from the tablespace file. More... | |
struct | FetchIndexRootPages |
Try and determine the index root pages by checking if the next/prev pointers are both FIL_NULL. More... | |
struct | FetchIndexRootPages::Index |
Index information gathered from the .ibd file. More... | |
class | PageConverter |
Functions | |
size_t | IO_BUFFER_SIZE (size_t m, size_t n) |
The size of the buffer to use for IO. More... | |
static void | row_import_discard_changes (row_prebuilt_t *prebuilt, trx_t *trx, dberr_t err) |
Clean up after import tablespace failure, this function will acquire the dictionary latches on behalf of the transaction if the transaction hasn't already acquired them. More... | |
static dberr_t | row_import_cleanup (row_prebuilt_t *prebuilt, trx_t *trx, dberr_t err) |
Clean up after import tablespace. More... | |
static dberr_t | row_import_error (row_prebuilt_t *prebuilt, trx_t *trx, dberr_t err) |
Report error during tablespace import. More... | |
static dberr_t | row_import_adjust_root_pages_of_secondary_indexes (trx_t *trx, dict_table_t *table, const row_import &cfg) |
Adjust the root page index node and leaf node segment headers, update with the new space id. More... | |
static dberr_t | row_import_set_sys_max_row_id (row_prebuilt_t *prebuilt, dict_table_t *table) |
Ensure that dict_sys->row_id exceeds SELECT MAX(DB_ROW_ID). More... | |
static dberr_t | row_import_cfg_read_string (FILE *file, byte *ptr, ulint max_len) |
Read the a string from the meta data file. More... | |
static dberr_t | row_import_cfg_read_index_fields (FILE *file, THD *thd, row_index_t *index, row_import *cfg) |
Write the meta data (index user fields) config file. More... | |
static dberr_t | row_import_read_index_data (FILE *file, THD *thd, row_import *cfg) |
Read the index names and root page numbers of the indexes and set the values. More... | |
static dberr_t | row_import_read_indexes (FILE *file, THD *thd, row_import *cfg) |
Set the index root page number for v1 format. More... | |
static byte * | row_import_read_bytes (FILE *file, size_t length) |
Read specified bytes from the meta data file. More... | |
static dberr_t | row_import_read_default_values (FILE *file, dict_col_t *col, mem_heap_t **heap, bool *read) |
Read the metadata config file. More... | |
static dberr_t | row_import_read_dropped_col_metadata (dd::Table *table_def, FILE *file, THD *thd, dict_col_t *col, const char *col_name) |
Read dd::Column metadata for the dropped table. More... | |
static dberr_t | row_import_read_columns (dd::Table *table_def, FILE *file, THD *thd, row_import *cfg) |
Read the meta data (table columns) config file. More... | |
static dberr_t | row_import_read_v1 (FILE *file, THD *thd, row_import *cfg) |
Read the contents of the <tablespace>.cfg file. More... | |
static dberr_t | row_import_read_v2 (FILE *file, THD *thd, row_import *cfg) |
Read tablespace flags and compression type info from <tablespace>.cfg file. More... | |
static dberr_t | row_import_read_common (dd::Table *table_def, FILE *file, THD *thd, row_import *cfg) |
Read the contents of the <tablespace>.cfg file. More... | |
static dberr_t | row_import_read_meta_data (dict_table_t *table, dd::Table *table_def, FILE *file, THD *thd, row_import &cfg) |
Read the contents of the <tablespace>.cfg file. More... | |
static dberr_t | row_import_read_cfg (dict_table_t *table, dd::Table *table_def, THD *thd, row_import &cfg) |
Read the contents of the <tablename>.cfg file. More... | |
static dberr_t | row_import_read_encryption_data (row_import &cfg, FILE *file, THD *thd) |
Read the contents of the .cfp file. More... | |
static dberr_t | row_import_read_cfp (dict_table_t *table, THD *thd, row_import &import) |
Read the contents of the .cfp file. More... | |
dberr_t | row_import_check_corruption (dict_table_t *table, THD *thd, bool missing) |
Check the correctness of clustered index of imported table. More... | |
dberr_t | row_import_for_mysql (dict_table_t *table, dd::Table *table_def, row_prebuilt_t *prebuilt) |
Imports a tablespace. More... | |
Import a tablespace to a running instance.
Created 2012-02-08 by Sunny Bains.
|
inline |
The size of the buffer to use for IO.
Note: os_file_read() doesn't expect reads to fail. If you set the buffer size to be greater than a multiple of the file size then it will assert. TODO: Fix this limitation of the IO functions.
m | page size of the tablespace. |
n | page size of the tablespace. |
number | of pages |
|
static |
Adjust the root page index node and leaf node segment headers, update with the new space id.
For all the table's secondary indexes.
trx | in: transaction used for the import |
table | in: table the indexes belong to |
cfg | Import context |
|
static |
Write the meta data (index user fields) config file.
file | in: file to write to |
thd | in/out: session |
index | Index being read in |
cfg | in/out: meta-data read |
Read the a string from the meta data file.
file | in/out: File to read from |
ptr | out: string to read |
max_len | in: maximum length of the output buffer in bytes |
dberr_t row_import_check_corruption | ( | dict_table_t * | table, |
THD * | thd, | ||
bool | missing | ||
) |
Check the correctness of clustered index of imported table.
Once there is corruption found, the IMPORT would be refused. This can help to detect the missing .cfg file for a table with instant added columns.
[in,out] | table | InnoDB table object |
[in,out] | thd | MySQL session variable |
[in] | missing | true if .cfg file is missing |
|
static |
Clean up after import tablespace.
prebuilt | in/out: prebuilt from handler |
trx | in/out: transaction for import |
err | in: error code |
|
static |
Clean up after import tablespace failure, this function will acquire the dictionary latches on behalf of the transaction if the transaction hasn't already acquired them.
prebuilt | in/out: prebuilt from handler |
trx | in/out: transaction for import |
err | in: error code |
|
static |
Report error during tablespace import.
prebuilt | in/out: prebuilt from handler |
trx | in/out: transaction for import |
err | in: error code |
dberr_t row_import_for_mysql | ( | dict_table_t * | table, |
dd::Table * | table_def, | ||
row_prebuilt_t * | prebuilt | ||
) |
Imports a tablespace.
The space id in the .ibd file must match the space id of the table in the data dictionary.
[in] | table | table |
[in] | table_def | dd table |
[in] | prebuilt | prebuilt struct in MySQL |
|
static |
Read specified bytes from the meta data file.
[in] | file | file to read from |
[in] | length | length of bytes to read |
|
static |
Read the contents of the <tablename>.cfg file.
[in] | table | table |
[in] | table_def | dd table |
[in] | thd | session |
[in,out] | cfg | contents of the .cfg file |
|
static |
Read the contents of the .cfp file.
[in] | table | table |
[in] | thd | session |
[in,out] | import | meta data |
|
static |
Read the meta data (table columns) config file.
Deserialise the contents of dict_col_t structure, along with the column name.
[in,out] | table_def | Table definition |
[in] | file | file to read from |
[in] | thd | session |
[in] | cfg | meta-data read |
|
static |
Read the contents of the <tablespace>.cfg file.
[in] | table_def | Table definition |
[in] | file | file to read from |
[in] | thd | session |
[in,out] | cfg | meta data |
|
static |
Read the metadata config file.
Deserialise the contents of dict_col_t::instant_default if exists. Refer to row_quiesce_write_default_value() for the format details.
[in] | file | file to read from |
[in,out] | col | column whose default value to read |
[in,out] | heap | memory heap to store default value |
[in,out] | read | true if default value read |
|
static |
Read dd::Column metadata for the dropped table.
[in,out] | table_def | Table definition |
[in] | file | file to read from |
[in] | thd | session |
[in] | col | dict_col_t |
[in] | col_name | name of the columns |
|
static |
Read the contents of the .cfp file.
[out] | cfg | the encryption key will be stored to it |
[in] | file | file to read from |
[in] | thd | session |
|
static |
Read the index names and root page numbers of the indexes and set the values.
Row format [root_page_no, len of str, str ... ]
[in] | file | File to read from |
[in] | thd | Session handle |
[in,out] | cfg | Meta-data read |
|
static |
Set the index root page number for v1 format.
file | in: File to read from |
thd | in: session |
cfg | in/out: meta-data read |
|
static |
Read the contents of the <tablespace>.cfg file.
[in] | table | dict table |
[in] | table_def | Table definition |
[in] | file | File to read from |
[in] | thd | session |
[out] | cfg | contents of the .cfg file |
|
static |
Read the contents of the <tablespace>.cfg file.
file | in: File to read from |
thd | in: session |
cfg | out: meta data |
|
static |
Read tablespace flags and compression type info from <tablespace>.cfg file.
[in] | file | File to read from |
[in] | thd | session |
[in,out] | cfg | meta data |
|
static |
Ensure that dict_sys->row_id exceeds SELECT MAX(DB_ROW_ID).
prebuilt | in/out: prebuilt from handler |
table | in: table to import |