2001-02-17 13:19:19 +01:00
|
|
|
/******************************************************
|
|
|
|
Loads to the memory cache database object definitions
|
|
|
|
from dictionary tables
|
|
|
|
|
|
|
|
(c) 1996 Innobase Oy
|
|
|
|
|
|
|
|
Created 4/24/1996 Heikki Tuuri
|
|
|
|
*******************************************************/
|
|
|
|
|
|
|
|
#ifndef dict0load_h
|
|
|
|
#define dict0load_h
|
|
|
|
|
|
|
|
#include "univ.i"
|
|
|
|
#include "dict0types.h"
|
|
|
|
#include "ut0byte.h"
|
|
|
|
|
2003-10-07 16:28:59 +02:00
|
|
|
/************************************************************************
|
|
|
|
In a crash recovery we already have all the tablespace objects created.
|
|
|
|
This function compares the space id information in the InnoDB data dictionary
|
|
|
|
to what we already read with fil_load_single_table_tablespaces().
|
Many files:
Fix InnoDB critical bug #7496; we scan the InnoDB data dictionary also at a normal mysqld startup, and create the spaces, so that we know the mapping space id -> .ibd file name; fix an infinite loop if DISCARD TABLESPACE coincides with INSERT or some other table operation; fix a potential crash if DISCARD TABLESPACE coincides with a cascaded FOREIGN KEY operation in the same table; do not allow DISCARD TABLESPACE of a referenced table if FOREIGN_KEY_CHECKS=1
innobase/buf/buf0rea.c:
Fix InnoDB critical bug #7496; we scan the InnoDB data dictionary also at a normal mysqld startup, and create the spaces, so that we know the mapping space id -> .ibd file name; fix an infinite loop if DISCARD TABLESPACE coincides with INSERT or some other table operation; fix a potential crash if DISCARD TABLESPACE coincides with a cascaded FOREIGN KEY operation in the same table; do not allow DISCARD TABLESPACE of a referenced table if FOREIGN_KEY_CHECKS=1
innobase/include/dict0load.h:
Fix InnoDB critical bug #7496; we scan the InnoDB data dictionary also at a normal mysqld startup, and create the spaces, so that we know the mapping space id -> .ibd file name; fix an infinite loop if DISCARD TABLESPACE coincides with INSERT or some other table operation; fix a potential crash if DISCARD TABLESPACE coincides with a cascaded FOREIGN KEY operation in the same table; do not allow DISCARD TABLESPACE of a referenced table if FOREIGN_KEY_CHECKS=1
innobase/include/fil0fil.h:
Fix InnoDB critical bug #7496; we scan the InnoDB data dictionary also at a normal mysqld startup, and create the spaces, so that we know the mapping space id -> .ibd file name; fix an infinite loop if DISCARD TABLESPACE coincides with INSERT or some other table operation; fix a potential crash if DISCARD TABLESPACE coincides with a cascaded FOREIGN KEY operation in the same table; do not allow DISCARD TABLESPACE of a referenced table if FOREIGN_KEY_CHECKS=1
innobase/include/row0mysql.h:
Fix InnoDB critical bug #7496; we scan the InnoDB data dictionary also at a normal mysqld startup, and create the spaces, so that we know the mapping space id -> .ibd file name; fix an infinite loop if DISCARD TABLESPACE coincides with INSERT or some other table operation; fix a potential crash if DISCARD TABLESPACE coincides with a cascaded FOREIGN KEY operation in the same table; do not allow DISCARD TABLESPACE of a referenced table if FOREIGN_KEY_CHECKS=1
innobase/include/trx0trx.h:
Fix InnoDB critical bug #7496; we scan the InnoDB data dictionary also at a normal mysqld startup, and create the spaces, so that we know the mapping space id -> .ibd file name; fix an infinite loop if DISCARD TABLESPACE coincides with INSERT or some other table operation; fix a potential crash if DISCARD TABLESPACE coincides with a cascaded FOREIGN KEY operation in the same table; do not allow DISCARD TABLESPACE of a referenced table if FOREIGN_KEY_CHECKS=1
innobase/dict/dict0load.c:
Fix InnoDB critical bug #7496; we scan the InnoDB data dictionary also at a normal mysqld startup, and create the spaces, so that we know the mapping space id -> .ibd file name; fix an infinite loop if DISCARD TABLESPACE coincides with INSERT or some other table operation; fix a potential crash if DISCARD TABLESPACE coincides with a cascaded FOREIGN KEY operation in the same table; do not allow DISCARD TABLESPACE of a referenced table if FOREIGN_KEY_CHECKS=1
innobase/fil/fil0fil.c:
Fix InnoDB critical bug #7496; we scan the InnoDB data dictionary also at a normal mysqld startup, and create the spaces, so that we know the mapping space id -> .ibd file name; fix an infinite loop if DISCARD TABLESPACE coincides with INSERT or some other table operation; fix a potential crash if DISCARD TABLESPACE coincides with a cascaded FOREIGN KEY operation in the same table; do not allow DISCARD TABLESPACE of a referenced table if FOREIGN_KEY_CHECKS=1
innobase/row/row0ins.c:
Fix InnoDB critical bug #7496; we scan the InnoDB data dictionary also at a normal mysqld startup, and create the spaces, so that we know the mapping space id -> .ibd file name; fix an infinite loop if DISCARD TABLESPACE coincides with INSERT or some other table operation; fix a potential crash if DISCARD TABLESPACE coincides with a cascaded FOREIGN KEY operation in the same table; do not allow DISCARD TABLESPACE of a referenced table if FOREIGN_KEY_CHECKS=1
innobase/row/row0mysql.c:
Fix InnoDB critical bug #7496; we scan the InnoDB data dictionary also at a normal mysqld startup, and create the spaces, so that we know the mapping space id -> .ibd file name; fix an infinite loop if DISCARD TABLESPACE coincides with INSERT or some other table operation; fix a potential crash if DISCARD TABLESPACE coincides with a cascaded FOREIGN KEY operation in the same table; do not allow DISCARD TABLESPACE of a referenced table if FOREIGN_KEY_CHECKS=1
innobase/row/row0sel.c:
Fix InnoDB critical bug #7496; we scan the InnoDB data dictionary also at a normal mysqld startup, and create the spaces, so that we know the mapping space id -> .ibd file name; fix an infinite loop if DISCARD TABLESPACE coincides with INSERT or some other table operation; fix a potential crash if DISCARD TABLESPACE coincides with a cascaded FOREIGN KEY operation in the same table; do not allow DISCARD TABLESPACE of a referenced table if FOREIGN_KEY_CHECKS=1
innobase/srv/srv0start.c:
Fix InnoDB critical bug #7496; we scan the InnoDB data dictionary also at a normal mysqld startup, and create the spaces, so that we know the mapping space id -> .ibd file name; fix an infinite loop if DISCARD TABLESPACE coincides with INSERT or some other table operation; fix a potential crash if DISCARD TABLESPACE coincides with a cascaded FOREIGN KEY operation in the same table; do not allow DISCARD TABLESPACE of a referenced table if FOREIGN_KEY_CHECKS=1
innobase/trx/trx0trx.c:
Fix InnoDB critical bug #7496; we scan the InnoDB data dictionary also at a normal mysqld startup, and create the spaces, so that we know the mapping space id -> .ibd file name; fix an infinite loop if DISCARD TABLESPACE coincides with INSERT or some other table operation; fix a potential crash if DISCARD TABLESPACE coincides with a cascaded FOREIGN KEY operation in the same table; do not allow DISCARD TABLESPACE of a referenced table if FOREIGN_KEY_CHECKS=1
sql/ha_innodb.cc:
Fix InnoDB critical bug #7496; we scan the InnoDB data dictionary also at a normal mysqld startup, and create the spaces, so that we know the mapping space id -> .ibd file name; fix an infinite loop if DISCARD TABLESPACE coincides with INSERT or some other table operation; fix a potential crash if DISCARD TABLESPACE coincides with a cascaded FOREIGN KEY operation in the same table; do not allow DISCARD TABLESPACE of a referenced table if FOREIGN_KEY_CHECKS=1
2004-12-27 03:10:25 +01:00
|
|
|
|
|
|
|
In a normal startup, we create the tablespace objects for every table in
|
|
|
|
InnoDB's data dictionary, if the corresponding .ibd file exists.
|
|
|
|
We also scan the biggest space id, and store it to fil_system. */
|
2003-10-07 16:28:59 +02:00
|
|
|
|
|
|
|
void
|
Many files:
Fix InnoDB critical bug #7496; we scan the InnoDB data dictionary also at a normal mysqld startup, and create the spaces, so that we know the mapping space id -> .ibd file name; fix an infinite loop if DISCARD TABLESPACE coincides with INSERT or some other table operation; fix a potential crash if DISCARD TABLESPACE coincides with a cascaded FOREIGN KEY operation in the same table; do not allow DISCARD TABLESPACE of a referenced table if FOREIGN_KEY_CHECKS=1
innobase/buf/buf0rea.c:
Fix InnoDB critical bug #7496; we scan the InnoDB data dictionary also at a normal mysqld startup, and create the spaces, so that we know the mapping space id -> .ibd file name; fix an infinite loop if DISCARD TABLESPACE coincides with INSERT or some other table operation; fix a potential crash if DISCARD TABLESPACE coincides with a cascaded FOREIGN KEY operation in the same table; do not allow DISCARD TABLESPACE of a referenced table if FOREIGN_KEY_CHECKS=1
innobase/include/dict0load.h:
Fix InnoDB critical bug #7496; we scan the InnoDB data dictionary also at a normal mysqld startup, and create the spaces, so that we know the mapping space id -> .ibd file name; fix an infinite loop if DISCARD TABLESPACE coincides with INSERT or some other table operation; fix a potential crash if DISCARD TABLESPACE coincides with a cascaded FOREIGN KEY operation in the same table; do not allow DISCARD TABLESPACE of a referenced table if FOREIGN_KEY_CHECKS=1
innobase/include/fil0fil.h:
Fix InnoDB critical bug #7496; we scan the InnoDB data dictionary also at a normal mysqld startup, and create the spaces, so that we know the mapping space id -> .ibd file name; fix an infinite loop if DISCARD TABLESPACE coincides with INSERT or some other table operation; fix a potential crash if DISCARD TABLESPACE coincides with a cascaded FOREIGN KEY operation in the same table; do not allow DISCARD TABLESPACE of a referenced table if FOREIGN_KEY_CHECKS=1
innobase/include/row0mysql.h:
Fix InnoDB critical bug #7496; we scan the InnoDB data dictionary also at a normal mysqld startup, and create the spaces, so that we know the mapping space id -> .ibd file name; fix an infinite loop if DISCARD TABLESPACE coincides with INSERT or some other table operation; fix a potential crash if DISCARD TABLESPACE coincides with a cascaded FOREIGN KEY operation in the same table; do not allow DISCARD TABLESPACE of a referenced table if FOREIGN_KEY_CHECKS=1
innobase/include/trx0trx.h:
Fix InnoDB critical bug #7496; we scan the InnoDB data dictionary also at a normal mysqld startup, and create the spaces, so that we know the mapping space id -> .ibd file name; fix an infinite loop if DISCARD TABLESPACE coincides with INSERT or some other table operation; fix a potential crash if DISCARD TABLESPACE coincides with a cascaded FOREIGN KEY operation in the same table; do not allow DISCARD TABLESPACE of a referenced table if FOREIGN_KEY_CHECKS=1
innobase/dict/dict0load.c:
Fix InnoDB critical bug #7496; we scan the InnoDB data dictionary also at a normal mysqld startup, and create the spaces, so that we know the mapping space id -> .ibd file name; fix an infinite loop if DISCARD TABLESPACE coincides with INSERT or some other table operation; fix a potential crash if DISCARD TABLESPACE coincides with a cascaded FOREIGN KEY operation in the same table; do not allow DISCARD TABLESPACE of a referenced table if FOREIGN_KEY_CHECKS=1
innobase/fil/fil0fil.c:
Fix InnoDB critical bug #7496; we scan the InnoDB data dictionary also at a normal mysqld startup, and create the spaces, so that we know the mapping space id -> .ibd file name; fix an infinite loop if DISCARD TABLESPACE coincides with INSERT or some other table operation; fix a potential crash if DISCARD TABLESPACE coincides with a cascaded FOREIGN KEY operation in the same table; do not allow DISCARD TABLESPACE of a referenced table if FOREIGN_KEY_CHECKS=1
innobase/row/row0ins.c:
Fix InnoDB critical bug #7496; we scan the InnoDB data dictionary also at a normal mysqld startup, and create the spaces, so that we know the mapping space id -> .ibd file name; fix an infinite loop if DISCARD TABLESPACE coincides with INSERT or some other table operation; fix a potential crash if DISCARD TABLESPACE coincides with a cascaded FOREIGN KEY operation in the same table; do not allow DISCARD TABLESPACE of a referenced table if FOREIGN_KEY_CHECKS=1
innobase/row/row0mysql.c:
Fix InnoDB critical bug #7496; we scan the InnoDB data dictionary also at a normal mysqld startup, and create the spaces, so that we know the mapping space id -> .ibd file name; fix an infinite loop if DISCARD TABLESPACE coincides with INSERT or some other table operation; fix a potential crash if DISCARD TABLESPACE coincides with a cascaded FOREIGN KEY operation in the same table; do not allow DISCARD TABLESPACE of a referenced table if FOREIGN_KEY_CHECKS=1
innobase/row/row0sel.c:
Fix InnoDB critical bug #7496; we scan the InnoDB data dictionary also at a normal mysqld startup, and create the spaces, so that we know the mapping space id -> .ibd file name; fix an infinite loop if DISCARD TABLESPACE coincides with INSERT or some other table operation; fix a potential crash if DISCARD TABLESPACE coincides with a cascaded FOREIGN KEY operation in the same table; do not allow DISCARD TABLESPACE of a referenced table if FOREIGN_KEY_CHECKS=1
innobase/srv/srv0start.c:
Fix InnoDB critical bug #7496; we scan the InnoDB data dictionary also at a normal mysqld startup, and create the spaces, so that we know the mapping space id -> .ibd file name; fix an infinite loop if DISCARD TABLESPACE coincides with INSERT or some other table operation; fix a potential crash if DISCARD TABLESPACE coincides with a cascaded FOREIGN KEY operation in the same table; do not allow DISCARD TABLESPACE of a referenced table if FOREIGN_KEY_CHECKS=1
innobase/trx/trx0trx.c:
Fix InnoDB critical bug #7496; we scan the InnoDB data dictionary also at a normal mysqld startup, and create the spaces, so that we know the mapping space id -> .ibd file name; fix an infinite loop if DISCARD TABLESPACE coincides with INSERT or some other table operation; fix a potential crash if DISCARD TABLESPACE coincides with a cascaded FOREIGN KEY operation in the same table; do not allow DISCARD TABLESPACE of a referenced table if FOREIGN_KEY_CHECKS=1
sql/ha_innodb.cc:
Fix InnoDB critical bug #7496; we scan the InnoDB data dictionary also at a normal mysqld startup, and create the spaces, so that we know the mapping space id -> .ibd file name; fix an infinite loop if DISCARD TABLESPACE coincides with INSERT or some other table operation; fix a potential crash if DISCARD TABLESPACE coincides with a cascaded FOREIGN KEY operation in the same table; do not allow DISCARD TABLESPACE of a referenced table if FOREIGN_KEY_CHECKS=1
2004-12-27 03:10:25 +01:00
|
|
|
dict_check_tablespaces_and_store_max_id(
|
|
|
|
/*====================================*/
|
2003-10-07 16:28:59 +02:00
|
|
|
ibool in_crash_recovery); /* in: are we doing a crash recovery */
|
2001-10-10 21:47:08 +02:00
|
|
|
/************************************************************************
|
|
|
|
Finds the first table name in the given database. */
|
|
|
|
|
|
|
|
char*
|
|
|
|
dict_get_first_table_name_in_db(
|
|
|
|
/*============================*/
|
2004-05-17 13:40:31 +02:00
|
|
|
/* out, own: table name, NULL if
|
|
|
|
does not exist; the caller must free
|
|
|
|
the memory in the string! */
|
|
|
|
const char* name); /* in: database name which ends to '/' */
|
2001-02-17 13:19:19 +01:00
|
|
|
/************************************************************************
|
|
|
|
Loads a table definition and also all its index definitions, and also
|
2001-10-10 21:47:08 +02:00
|
|
|
the cluster definition if the table is a member in a cluster. Also loads
|
|
|
|
all foreign key constraints where the foreign key is in the table or where
|
|
|
|
a foreign key references columns in this table. */
|
2001-02-17 13:19:19 +01:00
|
|
|
|
|
|
|
dict_table_t*
|
|
|
|
dict_load_table(
|
|
|
|
/*============*/
|
2004-05-17 13:40:31 +02:00
|
|
|
/* out: table, NULL if does not exist;
|
|
|
|
if the table is stored in an .ibd file,
|
|
|
|
but the file does not exist,
|
|
|
|
then we set the ibd_file_missing flag TRUE
|
|
|
|
in the table object we return */
|
|
|
|
const char* name); /* in: table name in the
|
|
|
|
databasename/tablename format */
|
2001-02-17 13:19:19 +01:00
|
|
|
/***************************************************************************
|
|
|
|
Loads a table object based on the table id. */
|
|
|
|
|
|
|
|
dict_table_t*
|
|
|
|
dict_load_table_on_id(
|
|
|
|
/*==================*/
|
|
|
|
/* out: table; NULL if table does not exist */
|
|
|
|
dulint table_id); /* in: table id */
|
|
|
|
/************************************************************************
|
|
|
|
This function is called when the database is booted.
|
|
|
|
Loads system table index definitions except for the clustered index which
|
|
|
|
is added to the dictionary cache at booting before calling this function. */
|
|
|
|
|
|
|
|
void
|
|
|
|
dict_load_sys_table(
|
|
|
|
/*================*/
|
|
|
|
dict_table_t* table); /* in: system table */
|
2001-10-10 21:47:08 +02:00
|
|
|
/***************************************************************************
|
|
|
|
Loads foreign key constraints where the table is either the foreign key
|
|
|
|
holder or where the table is referenced by a foreign key. Adds these
|
|
|
|
constraints to the data dictionary. Note that we know that the dictionary
|
|
|
|
cache already contains all constraints where the other relevant table is
|
|
|
|
already in the dictionary cache. */
|
|
|
|
|
|
|
|
ulint
|
|
|
|
dict_load_foreigns(
|
|
|
|
/*===============*/
|
2004-05-17 13:40:31 +02:00
|
|
|
/* out: DB_SUCCESS or error code */
|
|
|
|
const char* table_name); /* in: table name */
|
2001-10-10 21:47:08 +02:00
|
|
|
/************************************************************************
|
|
|
|
Prints to the standard output information on all tables found in the data
|
|
|
|
dictionary system table. */
|
|
|
|
|
|
|
|
void
|
|
|
|
dict_print(void);
|
|
|
|
/*============*/
|
2001-02-17 13:19:19 +01:00
|
|
|
|
|
|
|
|
|
|
|
#ifndef UNIV_NONINL
|
|
|
|
#include "dict0load.ic"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|