mirror of
https://github.com/MariaDB/server.git
synced 2025-01-27 01:04:19 +01:00
ca9b46f71a
* Fix BUG#15650: "DELETE with LEFT JOIN crashes server with innodb_locks_unsafe_for binlog" * Fix BUG#17134: "Partitions: uncommitted changes are visible" * Fix BUG#17992: "Partitions: InnoDB, somehow rotten table after UPDATE" row0ins.c: MySQL's partitioned table code does not set preduilt->sql_stat_start right if it does an insert in the same statement after doing a search first in the same partition table. We now write trx id always to the buffer, not just when flag sql_stat_start is on. This will waste CPU time very sightly. * Fix BUG#18077: "InnoDB uses full explicit table locks in stored FUNCTION" * Fix BUG#18238: "When locks exhaust the buffer pool, InnoDB does not roll back the trx" * Fix BUG#18252" "Disk space leak in updates of InnoDB BLOB rows in 5.0 and 5.1" * Fix BUG#18283: "When InnoDB returns error 'lock table full', MySQL can write to binlog too much" * Fix BUG#18350: "Use consistent read in CREATE ... SELECT ... if innodb_locks_unsafe_for_binlog" * Fix BUG#18384: "InnoDB memory leak on duplicate key errors in 5.0 if row has many columns" * Fix BUG#18934: "InnoDB crashes when table uses column names like DB_ROW_ID" Refuse tables that use reserved column names. * InnoDB's SQL parser: - Add support for UNSIGNED types, EXIT keyword, quoted identifiers, user-function callbacks for processing results of FETCH statements, bound literals, DATA_VARCHAR for bound literals. - Allow bound literals of type non-INTEGER to be of length 0. - Add make_flex.sh and update lexer/parser generation documentation. - Add comment clarifying the difference between 'alias' and 'indirection' fields in sym_node_t. - Remove never reached duplicate code in pars_set_dfield_type(). - Rewrite pars_info datatypes and APIs, add a few helper functions. - Since the functions definitions in pars_info_t are accessed after pars_sql() returns in the query graph execution stage, we can't free pars_info_t in pars_sql(). Instead, make pars_sql() transfer ownership of pars_info_t to the created query graph, and make que_graph_free() free it if needed. - Allow access to system columns like DB_ROW_ID. * Use bound literals in row_truncate_table_for_mysql, row_drop_table_for_mysql, row_discard_tablespace_for_mysql, and row_rename_table_for_mysql. * Setting an isolation level of the transaction to read committed weakens the locks for this session similarly like the option innodb_locks_unsafe_for binlog. This patch removes alnost all gap locking (used in next-key locking) and makes MySQL to release the row locks on the rows which does not belong to result set. Additionally, nonlocking selects on INSERT INTO SELECT, UPDATE ... (SELECT ...), and CREATE ... SELECT ... use a nonlocking consistent read. If a binlog is used, then binlog format should be set to row based binloging to make the execution of the complex SQL statements. * Disable the statistic variables btr_search_n_hash_fail and n_hash_succ, n_hash_fail, n_patt_succ, and n_searches of btr_search_t in builds without #ifdef UNIV_SEARCH_PERF_STAT. * Make innodb.test faster. Group all consistent read test cases to a one test case and wait their lock timeout after all have been send to the server. Decrease amount of rows inserted in a certain test - this has no effect on the effectiveness of the test and reduces the running time by ~10 sec. Remove temporary work-arounds from innodb.result now that ALTER TABLE DROP FOREIGN KEY works once again. * Make innodb_unsafe_binlog.test faster. Grout all consistent read test cases to a one test case amd wait their lock timeout after all have been sent to the server. Remove unnecessary option --loose_innodb_lock_wait_timeout. * Print dictionary memory size in SHOW INNODB STATUS. * Fix memory leaks in row_create_table_for_mysql() in rare corner cases. * Remove code related to clustered tables. They were never implemented, and the implementation would be challenging with ROW_FORMAT=COMPACT. Remove the table types DICT_TABLE_CLUSTER_MEMBER and DICT_TABLE_CLUSTER and all related tests and functions. dict_table_t: Remove mix_id, mix_len, mix_id_len, mix_id_buf, and cluster_name. plan_t: Remove mixed_index. dict_create_sys_tables_tuple(): Set MIX_ID=0, MIX_LEN=0, CLUSTER_NAME=NULL when inserting into SYS_TABLES. dict_tree_check_search_tuple(): Enclose in #ifdef UNIV_DEBUG. * Move calling of thr_local_free() from trx_free_for_mysql() to innobase_close_connection(). mysql-test/r/innodb.result: Applied innodb-5.1-ss475 snapshot. mysql-test/r/innodb_unsafe_binlog.result: Applied innodb-5.1-ss475 snapshot. mysql-test/t/innodb-master.opt: Applied innodb-5.1-ss475 snapshot. mysql-test/t/innodb.test: Applied innodb-5.1-ss475 snapshot. mysql-test/t/innodb_unsafe_binlog-master.opt: Applied innodb-5.1-ss475 snapshot. mysql-test/t/innodb_unsafe_binlog.test: Applied innodb-5.1-ss475 snapshot. sql/ha_innodb.cc: Applied innodb-5.1-ss475 snapshot. Do not use inlined functions in ha_innodb.cc. Remove assertion ut_error which crashes the mysqld server if it prints a warning about the adaptive latch. storage/innobase/Makefile.am: Applied innodb-5.1-ss475 snapshot. storage/innobase/btr/btr0btr.c: Applied innodb-5.1-ss475 snapshot. storage/innobase/btr/btr0cur.c: Applied innodb-5.1-ss475 snapshot. storage/innobase/btr/btr0pcur.c: Applied innodb-5.1-ss475 snapshot. storage/innobase/btr/btr0sea.c: Applied innodb-5.1-ss475 snapshot. Fix compilation problem with non-C99 compilers. storage/innobase/buf/buf0lru.c: Applied innodb-5.1-ss475 snapshot. storage/innobase/cmakelists.txt: Applied innodb-5.1-ss475 snapshot. storage/innobase/configure.in: Applied innodb-5.1-ss475 snapshot. Add disabled-by-default logic to switch GCC to a strict C89-mode. Add -Werror-implicit-function_declaration to CFLAGS when using gcc. storage/innobase/data/data0type.c: Applied innodb-5.1-ss475 snapshot. dtype_print(): Recognize DATA_FIXBINARY and DATA_BLOB types. Print known flags from prtype. Use a switch statement instead of else-if chain. storage/innobase/dict/dict0crea.c: Applied innodb-5.1-ss475 snapshot. Use bound literals in all SQL statements instead of elaborately constructing correctly allocated and quoted strings to pass the data in ASCII form. storage/innobase/dict/dict0dict.c: Applied innodb-5.1-ss475 snapshot. storage/innobase/dict/dict0load.c: Applied innodb-5.1-ss475 snapshot. storage/innobase/dict/dict0mem.c: Applied innodb-5.1-ss475 snapshot. storage/innobase/eval/eval0proc.c: Applied innodb-5.1-ss475 snapshot. storage/innobase/ibuf/ibuf0ibuf.c: Applied innodb-5.1-ss475 snapshot. storage/innobase/include/btr0cur.h: Applied innodb-5.1-ss475 snapshot. storage/innobase/include/btr0cur.ic: Applied innodb-5.1-ss475 snapshot. storage/innobase/include/btr0sea.h: Applied innodb-5.1-ss475 snapshot. storage/innobase/include/buf0lru.h: Applied innodb-5.1-ss475 snapshot. storage/innobase/include/dict0dict.h: Applied innodb-5.1-ss475 snapshot. storage/innobase/include/dict0dict.ic: Applied innodb-5.1-ss475 snapshot. Remove too strict assertions from some dict_table_t accessor functions. storage/innobase/include/dict0mem.h: Applied innodb-5.1-ss475 snapshot. storage/innobase/include/eval0proc.h: Applied innodb-5.1-ss475 snapshot. storage/innobase/include/hash0hash.h: Applied innodb-5.1-ss475 snapshot. storage/innobase/include/lock0lock.h: Applied innodb-5.1-ss475 snapshot. storage/innobase/include/mem0mem.h: Applied innodb-5.1-ss475 snapshot. storage/innobase/include/page0page.ic: Applied innodb-5.1-ss475 snapshot. Remove UNIV_RELEASE_NOT_YET_STABLE and related checks. storage/innobase/include/pars0grm.h: Applied innodb-5.1-ss475 snapshot. storage/innobase/include/pars0pars.h: Applied innodb-5.1-ss475 snapshot. storage/innobase/include/pars0sym.h: Applied innodb-5.1-ss475 snapshot. storage/innobase/include/pars0types.h: Applied innodb-5.1-ss475 snapshot. storage/innobase/include/que0que.h: Applied innodb-5.1-ss475 snapshot. storage/innobase/include/row0mysql.h: Applied innodb-5.1-ss475 snapshot. storage/innobase/include/row0sel.h: Applied innodb-5.1-ss475 snapshot. storage/innobase/include/row0upd.h: Applied innodb-5.1-ss475 snapshot. storage/innobase/include/trx0trx.h: Applied innodb-5.1-ss475 snapshot. storage/innobase/include/univ.i: Applied innodb-5.1-ss475 snapshot. Remove UNIV_RELEASE_NOT_YET_STABLE and related checks. When using GCC, use __inline__ instead of inline. storage/innobase/include/ut0mem.h: Applied innodb-5.1-ss475 snapshot. storage/innobase/lock/lock0lock.c: Applied innodb-5.1-ss475 snapshot. storage/innobase/log/log0recv.c: Applied innodb-5.1-ss475 snapshot. storage/innobase/mem/mem0dbg.c: Applied innodb-5.1-ss475 snapshot. Add (void*) cast when using the %p printf format specifier. storage/innobase/mem/mem0mem.c: Applied innodb-5.1-ss475 snapshot. storage/innobase/os/os0sync.c: Applied innodb-5.1-ss475 snapshot. Add (void*) cast when using the %p printf format specifier. storage/innobase/pars/lexyy.c: Applied innodb-5.1-ss475 snapshot. storage/innobase/pars/make_bison.sh: Applied innodb-5.1-ss475 snapshot. storage/innobase/pars/pars0grm.c: Applied innodb-5.1-ss475 snapshot. storage/innobase/pars/pars0grm.h: Applied innodb-5.1-ss475 snapshot. storage/innobase/pars/pars0grm.y: Applied innodb-5.1-ss475 snapshot. storage/innobase/pars/pars0lex.l: Applied innodb-5.1-ss475 snapshot. storage/innobase/pars/pars0opt.c: Applied innodb-5.1-ss475 snapshot. storage/innobase/pars/pars0pars.c: Applied innodb-5.1-ss475 snapshot. storage/innobase/pars/pars0sym.c: Applied innodb-5.1-ss475 snapshot. storage/innobase/que/que0que.c: Applied innodb-5.1-ss475 snapshot. storage/innobase/row/row0ins.c: Applied innodb-5.1-ss475 snapshot. Remove a memory leak when trying to insert a duplicate record to a clustered inedx comprising more than about 90 columns (Bug#18384). row_ins_duplicate_error_in_clust(): Call mem_heap_free(heap) at func_exit if needed. storage/innobase/row/row0mysql.c: Applied innodb-5.1-ss475 snapshot. row_mysql_is_system_table(): Use strncmp, not memcmp, since we don't know how long the input string is. storage/innobase/row/row0sel.c: Applied innodb-5.1-ss475 snapshot. Remove UNIV_RELEASE_NOT_YET_STABLE and related checks. row_sel_field_store_in_mysql_format(): Turn the assertions on mbminlen, mbmaxlen, and templ->type into debug assertions. fetch_step(): Print a more usefull error message when the cursor is closed. storage/innobase/row/row0upd.c: Applied innodb-5.1-ss475 snapshot. row_upd_index_replace_new_col_vals_index_pos(): Add a parameter order_only for limiting the replacement to the ordering fields of the index. storage/innobase/srv/srv0srv.c: Applied innodb-5.1-ss475 snapshot. storage/innobase/sync/sync0arr.c: Applied innodb-5.1-ss475 snapshot. Add (void*) cast when using the %p printf format specifier. storage/innobase/sync/sync0rw.c: Applied innodb-5.1-ss475 snapshot. Add (void*) cast when using the %p printf format specifier. storage/innobase/sync/sync0sync.c: Applied innodb-5.1-ss475 snapshot. Add (void*) cast when using the %p printf format specifier. storage/innobase/trx/trx0trx.c: Applied innodb-5.1-ss475 snapshot. storage/innobase/ut/Makefile.am: Applied innodb-5.1-ss475 snapshot. storage/innobase/ut/ut0mem.c: Applied innodb-5.1-ss475 snapshot. storage/innobase/include/ut0vec.h: Applied innodb-5.1-ss475 snapshot. storage/innobase/include/ut0vec.ic: Applied innodb-5.1-ss475 snapshot. storage/innobase/pars/make_flex.sh: Applied innodb-5.1-ss475 snapshot. storage/innobase/ut/ut0vec.c: Applied innodb-5.1-ss475 snapshot.
403 lines
14 KiB
C
403 lines
14 KiB
C
/******************************************************
|
|
Data dictionary memory object creation
|
|
|
|
(c) 1996 Innobase Oy
|
|
|
|
Created 1/8/1996 Heikki Tuuri
|
|
*******************************************************/
|
|
|
|
#ifndef dict0mem_h
|
|
#define dict0mem_h
|
|
|
|
#include "univ.i"
|
|
#include "dict0types.h"
|
|
#include "data0type.h"
|
|
#include "data0data.h"
|
|
#include "mem0mem.h"
|
|
#include "rem0types.h"
|
|
#include "btr0types.h"
|
|
#include "ut0mem.h"
|
|
#include "ut0lst.h"
|
|
#include "ut0rnd.h"
|
|
#include "ut0byte.h"
|
|
#include "sync0rw.h"
|
|
#include "lock0types.h"
|
|
#include "hash0hash.h"
|
|
#include "que0types.h"
|
|
|
|
/* Type flags of an index: OR'ing of the flags is allowed to define a
|
|
combination of types */
|
|
#define DICT_CLUSTERED 1 /* clustered index */
|
|
#define DICT_UNIQUE 2 /* unique index */
|
|
#define DICT_UNIVERSAL 4 /* index which can contain records from any
|
|
other index */
|
|
#define DICT_IBUF 8 /* insert buffer tree */
|
|
|
|
/* Types for a table object */
|
|
#define DICT_TABLE_ORDINARY 1
|
|
#if 0 /* not implemented */
|
|
#define DICT_TABLE_CLUSTER_MEMBER 2
|
|
#define DICT_TABLE_CLUSTER 3 /* this means that the table is
|
|
really a cluster definition */
|
|
#endif
|
|
|
|
/* Table flags */
|
|
#define DICT_TF_COMPACT 1 /* compact page format */
|
|
|
|
/**************************************************************************
|
|
Creates a table memory object. */
|
|
|
|
dict_table_t*
|
|
dict_mem_table_create(
|
|
/*==================*/
|
|
/* out, own: table object */
|
|
const char* name, /* in: table name */
|
|
ulint space, /* in: space where the clustered index
|
|
of the table is placed; this parameter
|
|
is ignored if the table is made
|
|
a member of a cluster */
|
|
ulint n_cols, /* in: number of columns */
|
|
ulint flags); /* in: table flags */
|
|
/********************************************************************
|
|
Free a table memory object. */
|
|
|
|
void
|
|
dict_mem_table_free(
|
|
/*================*/
|
|
dict_table_t* table); /* in: table */
|
|
/**************************************************************************
|
|
Adds a column definition to a table. */
|
|
|
|
void
|
|
dict_mem_table_add_col(
|
|
/*===================*/
|
|
dict_table_t* table, /* in: table */
|
|
const char* name, /* in: column name */
|
|
ulint mtype, /* in: main datatype */
|
|
ulint prtype, /* in: precise type */
|
|
ulint len, /* in: length */
|
|
ulint prec); /* in: precision */
|
|
/**************************************************************************
|
|
Creates an index memory object. */
|
|
|
|
dict_index_t*
|
|
dict_mem_index_create(
|
|
/*==================*/
|
|
/* out, own: index object */
|
|
const char* table_name, /* in: table name */
|
|
const char* index_name, /* in: index name */
|
|
ulint space, /* in: space where the index tree is
|
|
placed, ignored if the index is of
|
|
the clustered type */
|
|
ulint type, /* in: DICT_UNIQUE,
|
|
DICT_CLUSTERED, ... ORed */
|
|
ulint n_fields); /* in: number of fields */
|
|
/**************************************************************************
|
|
Adds a field definition to an index. NOTE: does not take a copy
|
|
of the column name if the field is a column. The memory occupied
|
|
by the column name may be released only after publishing the index. */
|
|
|
|
void
|
|
dict_mem_index_add_field(
|
|
/*=====================*/
|
|
dict_index_t* index, /* in: index */
|
|
const char* name, /* in: column name */
|
|
ulint prefix_len); /* in: 0 or the column prefix length
|
|
in a MySQL index like
|
|
INDEX (textcol(25)) */
|
|
/**************************************************************************
|
|
Frees an index memory object. */
|
|
|
|
void
|
|
dict_mem_index_free(
|
|
/*================*/
|
|
dict_index_t* index); /* in: index */
|
|
/**************************************************************************
|
|
Creates and initializes a foreign constraint memory object. */
|
|
|
|
dict_foreign_t*
|
|
dict_mem_foreign_create(void);
|
|
/*=========================*/
|
|
/* out, own: foreign constraint struct */
|
|
|
|
/* Data structure for a column in a table */
|
|
struct dict_col_struct{
|
|
hash_node_t hash; /* hash chain node */
|
|
ulint ind; /* table column position (they are numbered
|
|
starting from 0) */
|
|
ulint clust_pos;/* position of the column in the
|
|
clustered index */
|
|
ulint ord_part;/* count of how many times this column
|
|
appears in ordering fields of an index */
|
|
const char* name; /* name */
|
|
dtype_t type; /* data type */
|
|
dict_table_t* table; /* back pointer to table of this column */
|
|
ulint aux; /* this is used as an auxiliary variable
|
|
in some of the functions below */
|
|
};
|
|
|
|
/* DICT_MAX_INDEX_COL_LEN is measured in bytes and is the max index column
|
|
length + 1. Starting from 4.1.6, we set it to < 3 * 256, so that one can
|
|
create a column prefix index on 255 characters of a TEXT field also in the
|
|
UTF-8 charset. In that charset, a character may take at most 3 bytes. */
|
|
|
|
#define DICT_MAX_INDEX_COL_LEN 768
|
|
|
|
/* Data structure for a field in an index */
|
|
struct dict_field_struct{
|
|
dict_col_t* col; /* pointer to the table column */
|
|
const char* name; /* name of the column */
|
|
ulint prefix_len; /* 0 or the length of the column
|
|
prefix in bytes in a MySQL index of
|
|
type, e.g., INDEX (textcol(25));
|
|
must be smaller than
|
|
DICT_MAX_INDEX_COL_LEN; NOTE that
|
|
in the UTF-8 charset, MySQL sets this
|
|
to 3 * the prefix len in UTF-8 chars */
|
|
ulint fixed_len; /* 0 or the fixed length of the
|
|
column if smaller than
|
|
DICT_MAX_INDEX_COL_LEN */
|
|
};
|
|
|
|
/* Data structure for an index tree */
|
|
struct dict_tree_struct{
|
|
ulint type; /* tree type */
|
|
dulint id; /* id of the index stored in the tree */
|
|
ulint space; /* space of index tree */
|
|
ulint page; /* index tree root page number */
|
|
byte pad[64];/* Padding to prevent other memory hotspots on
|
|
the same memory cache line */
|
|
rw_lock_t lock; /* read-write lock protecting the upper levels
|
|
of the index tree */
|
|
ulint mem_fix;/* count of how many times this tree
|
|
struct has been memoryfixed (by mini-
|
|
transactions wanting to access the index
|
|
tree) */
|
|
dict_index_t* tree_index; /* the index stored in the
|
|
index tree */
|
|
ulint magic_n;/* magic number */
|
|
};
|
|
|
|
#define DICT_TREE_MAGIC_N 7545676
|
|
|
|
/* Data structure for an index */
|
|
struct dict_index_struct{
|
|
dulint id; /* id of the index */
|
|
mem_heap_t* heap; /* memory heap */
|
|
ulint type; /* index type */
|
|
const char* name; /* index name */
|
|
const char* table_name; /* table name */
|
|
dict_table_t* table; /* back pointer to table */
|
|
ulint space; /* space where the index tree is placed */
|
|
ulint trx_id_offset;/* position of the the trx id column
|
|
in a clustered index record, if the fields
|
|
before it are known to be of a fixed size,
|
|
0 otherwise */
|
|
ulint n_user_defined_cols;
|
|
/* number of columns the user defined to
|
|
be in the index: in the internal
|
|
representation we add more columns */
|
|
ulint n_uniq; /* number of fields from the beginning
|
|
which are enough to determine an index
|
|
entry uniquely */
|
|
ulint n_def; /* number of fields defined so far */
|
|
ulint n_fields;/* number of fields in the index */
|
|
dict_field_t* fields; /* array of field descriptions */
|
|
ulint n_nullable;/* number of nullable fields */
|
|
UT_LIST_NODE_T(dict_index_t)
|
|
indexes;/* list of indexes of the table */
|
|
dict_tree_t* tree; /* index tree struct */
|
|
UT_LIST_NODE_T(dict_index_t)
|
|
tree_indexes; /* list of indexes of the same index
|
|
tree */
|
|
ibool cached; /* TRUE if the index object is in the
|
|
dictionary cache */
|
|
btr_search_t* search_info; /* info used in optimistic searches */
|
|
/*----------------------*/
|
|
ib_longlong* stat_n_diff_key_vals;
|
|
/* approximate number of different key values
|
|
for this index, for each n-column prefix
|
|
where n <= dict_get_n_unique(index); we
|
|
periodically calculate new estimates */
|
|
ulint stat_index_size;
|
|
/* approximate index size in database pages */
|
|
ulint stat_n_leaf_pages;
|
|
/* approximate number of leaf pages in the
|
|
index tree */
|
|
ulint magic_n;/* magic number */
|
|
};
|
|
|
|
/* Data structure for a foreign key constraint; an example:
|
|
FOREIGN KEY (A, B) REFERENCES TABLE2 (C, D) */
|
|
|
|
struct dict_foreign_struct{
|
|
mem_heap_t* heap; /* this object is allocated from
|
|
this memory heap */
|
|
char* id; /* id of the constraint as a
|
|
null-terminated string */
|
|
ulint type; /* 0 or DICT_FOREIGN_ON_DELETE_CASCADE
|
|
or DICT_FOREIGN_ON_DELETE_SET_NULL */
|
|
char* foreign_table_name;/* foreign table name */
|
|
dict_table_t* foreign_table; /* table where the foreign key is */
|
|
const char** foreign_col_names;/* names of the columns in the
|
|
foreign key */
|
|
char* referenced_table_name;/* referenced table name */
|
|
dict_table_t* referenced_table;/* table where the referenced key
|
|
is */
|
|
const char** referenced_col_names;/* names of the referenced
|
|
columns in the referenced table */
|
|
ulint n_fields; /* number of indexes' first fields
|
|
for which the the foreign key
|
|
constraint is defined: we allow the
|
|
indexes to contain more fields than
|
|
mentioned in the constraint, as long
|
|
as the first fields are as mentioned */
|
|
dict_index_t* foreign_index; /* foreign index; we require that
|
|
both tables contain explicitly defined
|
|
indexes for the constraint: InnoDB
|
|
does not generate new indexes
|
|
implicitly */
|
|
dict_index_t* referenced_index;/* referenced index */
|
|
UT_LIST_NODE_T(dict_foreign_t)
|
|
foreign_list; /* list node for foreign keys of the
|
|
table */
|
|
UT_LIST_NODE_T(dict_foreign_t)
|
|
referenced_list;/* list node for referenced keys of the
|
|
table */
|
|
};
|
|
|
|
/* The flags for ON_UPDATE and ON_DELETE can be ORed; the default is that
|
|
a foreign key constraint is enforced, therefore RESTRICT just means no flag */
|
|
#define DICT_FOREIGN_ON_DELETE_CASCADE 1
|
|
#define DICT_FOREIGN_ON_DELETE_SET_NULL 2
|
|
#define DICT_FOREIGN_ON_UPDATE_CASCADE 4
|
|
#define DICT_FOREIGN_ON_UPDATE_SET_NULL 8
|
|
#define DICT_FOREIGN_ON_DELETE_NO_ACTION 16
|
|
#define DICT_FOREIGN_ON_UPDATE_NO_ACTION 32
|
|
|
|
|
|
#define DICT_INDEX_MAGIC_N 76789786
|
|
|
|
/* Data structure for a database table */
|
|
struct dict_table_struct{
|
|
dulint id; /* id of the table */
|
|
ulint flags; /* DICT_TF_COMPACT, ... */
|
|
mem_heap_t* heap; /* memory heap */
|
|
const char* name; /* table name */
|
|
const char* dir_path_of_temp_table;/* NULL or the directory path
|
|
where a TEMPORARY table that was explicitly
|
|
created by a user should be placed if
|
|
innodb_file_per_table is defined in my.cnf;
|
|
in Unix this is usually /tmp/..., in Windows
|
|
\temp\... */
|
|
ulint space; /* space where the clustered index of the
|
|
table is placed */
|
|
ibool ibd_file_missing;/* TRUE if this is in a single-table
|
|
tablespace and the .ibd file is missing; then
|
|
we must return in ha_innodb.cc an error if the
|
|
user tries to query such an orphaned table */
|
|
ibool tablespace_discarded;/* this flag is set TRUE when the
|
|
user calls DISCARD TABLESPACE on this table,
|
|
and reset to FALSE in IMPORT TABLESPACE */
|
|
hash_node_t name_hash; /* hash chain node */
|
|
hash_node_t id_hash; /* hash chain node */
|
|
ulint n_def; /* number of columns defined so far */
|
|
ulint n_cols; /* number of columns */
|
|
dict_col_t* cols; /* array of column descriptions */
|
|
UT_LIST_BASE_NODE_T(dict_index_t)
|
|
indexes; /* list of indexes of the table */
|
|
UT_LIST_BASE_NODE_T(dict_foreign_t)
|
|
foreign_list;/* list of foreign key constraints
|
|
in the table; these refer to columns
|
|
in other tables */
|
|
UT_LIST_BASE_NODE_T(dict_foreign_t)
|
|
referenced_list;/* list of foreign key constraints
|
|
which refer to this table */
|
|
UT_LIST_NODE_T(dict_table_t)
|
|
table_LRU; /* node of the LRU list of tables */
|
|
ulint mem_fix;/* count of how many times the table
|
|
and its indexes has been fixed in memory;
|
|
currently NOT used */
|
|
ulint n_mysql_handles_opened;
|
|
/* count of how many handles MySQL has opened
|
|
to this table; dropping of the table is
|
|
NOT allowed until this count gets to zero;
|
|
MySQL does NOT itself check the number of
|
|
open handles at drop */
|
|
ulint n_foreign_key_checks_running;
|
|
/* count of how many foreign key check
|
|
operations are currently being performed
|
|
on the table: we cannot drop the table while
|
|
there are foreign key checks running on
|
|
it! */
|
|
ibool cached; /* TRUE if the table object has been added
|
|
to the dictionary cache */
|
|
lock_t* auto_inc_lock;/* a buffer for an auto-inc lock
|
|
for this table: we allocate the memory here
|
|
so that individual transactions can get it
|
|
and release it without a need to allocate
|
|
space from the lock heap of the trx:
|
|
otherwise the lock heap would grow rapidly
|
|
if we do a large insert from a select */
|
|
dulint query_cache_inv_trx_id;
|
|
/* transactions whose trx id < than this
|
|
number are not allowed to store to the MySQL
|
|
query cache or retrieve from it; when a trx
|
|
with undo logs commits, it sets this to the
|
|
value of the trx id counter for the tables it
|
|
had an IX lock on */
|
|
UT_LIST_BASE_NODE_T(lock_t)
|
|
locks; /* list of locks on the table */
|
|
/*----------------------*/
|
|
ibool does_not_fit_in_memory;
|
|
/* this field is used to specify in simulations
|
|
tables which are so big that disk should be
|
|
accessed: disk access is simulated by
|
|
putting the thread to sleep for a while;
|
|
NOTE that this flag is not stored to the data
|
|
dictionary on disk, and the database will
|
|
forget about value TRUE if it has to reload
|
|
the table definition from disk */
|
|
/*----------------------*/
|
|
ib_longlong stat_n_rows;
|
|
/* approximate number of rows in the table;
|
|
we periodically calculate new estimates */
|
|
ulint stat_clustered_index_size;
|
|
/* approximate clustered index size in
|
|
database pages */
|
|
ulint stat_sum_of_other_index_sizes;
|
|
/* other indexes in database pages */
|
|
ibool stat_initialized; /* TRUE if statistics have
|
|
been calculated the first time
|
|
after database startup or table creation */
|
|
ulint stat_modified_counter;
|
|
/* when a row is inserted, updated, or deleted,
|
|
we add 1 to this number; we calculate new
|
|
estimates for the stat_... values for the
|
|
table and the indexes at an interval of 2 GB
|
|
or when about 1 / 16 of table has been
|
|
modified; also when the estimate operation is
|
|
called for MySQL SHOW TABLE STATUS; the
|
|
counter is reset to zero at statistics
|
|
calculation; this counter is not protected by
|
|
any latch, because this is only used for
|
|
heuristics */
|
|
/*----------------------*/
|
|
mutex_t autoinc_mutex;
|
|
/* mutex protecting the autoincrement
|
|
counter */
|
|
ibool autoinc_inited;
|
|
/* TRUE if the autoinc counter has been
|
|
inited; MySQL gets the init value by executing
|
|
SELECT MAX(auto inc column) */
|
|
ib_longlong autoinc;/* autoinc counter value to give to the
|
|
next inserted row */
|
|
ulint magic_n;/* magic number */
|
|
};
|
|
#define DICT_TABLE_MAGIC_N 76333786
|
|
|
|
#ifndef UNIV_NONINL
|
|
#include "dict0mem.ic"
|
|
#endif
|
|
|
|
#endif
|