30
13
#include "dict0types.h"
31
14
#include "data0type.h"
15
#include "data0data.h"
32
16
#include "mem0mem.h"
33
17
#include "rem0types.h"
34
18
#include "btr0types.h"
35
#ifndef UNIV_HOTBACKUP
36
# include "lock0types.h"
37
# include "que0types.h"
39
#endif /* !UNIV_HOTBACKUP */
40
19
#include "ut0mem.h"
41
20
#include "ut0lst.h"
42
21
#include "ut0rnd.h"
43
22
#include "ut0byte.h"
24
#include "lock0types.h"
44
25
#include "hash0hash.h"
26
#include "que0types.h"
45
27
#include "trx0types.h"
47
/** Type flags of an index: OR'ing of the flags is allowed to define a
29
/* Type flags of an index: OR'ing of the flags is allowed to define a
48
30
combination of types */
50
#define DICT_CLUSTERED 1 /*!< clustered index */
51
#define DICT_UNIQUE 2 /*!< unique index */
52
#define DICT_UNIVERSAL 4 /*!< index which can contain records from any
31
#define DICT_CLUSTERED 1 /* clustered index */
32
#define DICT_UNIQUE 2 /* unique index */
33
#define DICT_UNIVERSAL 4 /* index which can contain records from any
54
#define DICT_IBUF 8 /*!< insert buffer tree */
35
#define DICT_IBUF 8 /* insert buffer tree */
57
/** Types for a table object */
58
#define DICT_TABLE_ORDINARY 1 /*!< ordinary table */
37
/* Types for a table object */
38
#define DICT_TABLE_ORDINARY 1
59
39
#if 0 /* not implemented */
60
40
#define DICT_TABLE_CLUSTER_MEMBER 2
61
41
#define DICT_TABLE_CLUSTER 3 /* this means that the table is
62
42
really a cluster definition */
65
/** Table flags. All unused bits must be 0. */
45
/* Table flags. All unused bits must be 0. */
67
46
#define DICT_TF_COMPACT 1 /* Compact page format.
68
47
This must be set for
71
50
DICT_TF_FORMAT_51). */
73
/** Compressed page size (0=uncompressed, up to 15 compressed sizes) */
52
/* compressed page size (0=uncompressed, up to 15 compressed sizes) */
75
53
#define DICT_TF_ZSSIZE_SHIFT 1
76
54
#define DICT_TF_ZSSIZE_MASK (15 << DICT_TF_ZSSIZE_SHIFT)
77
55
#define DICT_TF_ZSSIZE_MAX (UNIV_PAGE_SIZE_SHIFT - PAGE_ZIP_MIN_SIZE_SHIFT + 1)
82
58
#define DICT_TF_FORMAT_SHIFT 5 /* file format */
83
#define DICT_TF_FORMAT_MASK \
84
((~(~0 << (DICT_TF_BITS - DICT_TF_FORMAT_SHIFT))) << DICT_TF_FORMAT_SHIFT)
85
#define DICT_TF_FORMAT_51 0 /*!< InnoDB/MySQL up to 5.1 */
86
#define DICT_TF_FORMAT_ZIP 1 /*!< InnoDB plugin for 5.1:
59
#define DICT_TF_FORMAT_MASK (127 << DICT_TF_FORMAT_SHIFT)
60
#define DICT_TF_FORMAT_51 0 /* InnoDB/MySQL up to 5.1 */
61
#define DICT_TF_FORMAT_ZIP 1 /* InnoDB plugin for 5.1:
88
63
new BLOB treatment */
89
/** Maximum supported file format */
90
64
#define DICT_TF_FORMAT_MAX DICT_TF_FORMAT_ZIP
92
/** Minimum supported file format */
93
#define DICT_TF_FORMAT_MIN DICT_TF_FORMAT_51
96
#define DICT_TF_BITS 6 /*!< number of flag bits */
66
#define DICT_TF_BITS 6 /* number of flag bits */
97
67
#if (1 << (DICT_TF_BITS - DICT_TF_FORMAT_SHIFT)) <= DICT_TF_FORMAT_MAX
98
68
# error "DICT_TF_BITS is insufficient for DICT_TF_FORMAT_MAX"
102
/** @brief Additional table flags.
104
These flags will be stored in SYS_TABLES.MIX_LEN. All unused flags
105
will be written as 0. The column may contain garbage for tables
106
created with old versions of InnoDB that only implemented
107
ROW_FORMAT=REDUNDANT. */
109
#define DICT_TF2_SHIFT DICT_TF_BITS
112
#define DICT_TF2_TEMPORARY 1 /*!< TRUE for tables from
113
CREATE TEMPORARY TABLE. */
114
#define DICT_TF2_BITS (DICT_TF2_SHIFT + 1)
115
/*!< Total number of bits
119
/** Tables could be chained together with Foreign key constraint. When
120
first load the parent table, we would load all of its descedents.
121
This could result in rescursive calls and out of stack error eventually.
122
DICT_FK_MAX_RECURSIVE_LOAD defines the maximum number of recursive loads,
123
when exceeded, the child table will not be loaded. It will be loaded when
124
the foreign constraint check needs to be run. */
125
#define DICT_FK_MAX_RECURSIVE_LOAD 255
127
/** Similarly, when tables are chained together with foreign key constraints
128
with on cascading delete/update clause, delete from parent table could
129
result in recursive cascading calls. This defines the maximum number of
130
such cascading deletes/updates allowed. When exceeded, the delete from
131
parent table will fail, and user has to drop excessive foreign constraint
133
#define FK_MAX_CASCADE_DEL 255
135
/**********************************************************************//**
136
Creates a table memory object.
137
@return own: table object */
71
/**************************************************************************
72
Creates a table memory object. */
140
75
dict_mem_table_create(
141
76
/*==================*/
142
const char* name, /*!< in: table name */
143
ulint space, /*!< in: space where the clustered index
77
/* out, own: table object */
78
const char* name, /* in: table name */
79
ulint space, /* in: space where the clustered index
144
80
of the table is placed; this parameter
145
81
is ignored if the table is made
146
82
a member of a cluster */
147
ulint n_cols, /*!< in: number of columns */
148
ulint flags); /*!< in: table flags */
149
/****************************************************************//**
83
ulint n_cols, /* in: number of columns */
84
ulint flags); /* in: table flags */
85
/********************************************************************
150
86
Free a table memory object. */
153
89
dict_mem_table_free(
154
90
/*================*/
155
dict_table_t* table); /*!< in: table */
156
/**********************************************************************//**
91
dict_table_t* table); /* in: table */
92
/**************************************************************************
157
93
Adds a column definition to a table. */
160
96
dict_mem_table_add_col(
161
97
/*===================*/
162
dict_table_t* table, /*!< in: table */
163
mem_heap_t* heap, /*!< in: temporary memory heap, or NULL */
164
const char* name, /*!< in: column name, or NULL */
165
ulint mtype, /*!< in: main datatype */
166
ulint prtype, /*!< in: precise type */
167
ulint len); /*!< in: precision */
168
/**********************************************************************//**
169
This function populates a dict_col_t memory structure with
170
supplied information. */
173
dict_mem_fill_column_struct(
174
/*========================*/
175
dict_col_t* column, /*!< out: column struct to be
177
ulint col_pos, /*!< in: column position */
178
ulint mtype, /*!< in: main data type */
179
ulint prtype, /*!< in: precise type */
180
ulint col_len); /*!< in: column length */
181
/**********************************************************************//**
182
This function poplulates a dict_index_t index memory structure with
183
supplied information. */
186
dict_mem_fill_index_struct(
187
/*=======================*/
188
dict_index_t* index, /*!< out: index to be filled */
189
mem_heap_t* heap, /*!< in: memory heap */
190
const char* table_name, /*!< in: table name */
191
const char* index_name, /*!< in: index name */
192
ulint space, /*!< in: space where the index tree is
193
placed, ignored if the index is of
194
the clustered type */
195
ulint type, /*!< in: DICT_UNIQUE,
196
DICT_CLUSTERED, ... ORed */
197
ulint n_fields); /*!< in: number of fields */
198
/**********************************************************************//**
199
Creates an index memory object.
200
@return own: index object */
98
dict_table_t* table, /* in: table */
99
mem_heap_t* heap, /* in: temporary memory heap, or NULL */
100
const char* name, /* in: column name, or NULL */
101
ulint mtype, /* in: main datatype */
102
ulint prtype, /* in: precise type */
103
ulint len); /* in: precision */
104
/**************************************************************************
105
Creates an index memory object. */
203
108
dict_mem_index_create(
204
109
/*==================*/
205
const char* table_name, /*!< in: table name */
206
const char* index_name, /*!< in: index name */
207
ulint space, /*!< in: space where the index tree is
110
/* out, own: index object */
111
const char* table_name, /* in: table name */
112
const char* index_name, /* in: index name */
113
ulint space, /* in: space where the index tree is
208
114
placed, ignored if the index is of
209
115
the clustered type */
210
ulint type, /*!< in: DICT_UNIQUE,
116
ulint type, /* in: DICT_UNIQUE,
211
117
DICT_CLUSTERED, ... ORed */
212
ulint n_fields); /*!< in: number of fields */
213
/**********************************************************************//**
118
ulint n_fields); /* in: number of fields */
119
/**************************************************************************
214
120
Adds a field definition to an index. NOTE: does not take a copy
215
121
of the column name if the field is a column. The memory occupied
216
122
by the column name may be released only after publishing the index. */
264
169
the string, MySQL uses 1 or 2
265
170
bytes to store the string length) */
267
unsigned mbminmaxlen:5; /*!< minimum and maximum length of a
269
DATA_MBMINMAXLEN(mbminlen,mbmaxlen);
270
mbminlen=DATA_MBMINLEN(mbminmaxlen);
271
mbmaxlen=DATA_MBMINLEN(mbminmaxlen) */
172
unsigned mbminlen:2; /* minimum length of a
173
character, in bytes */
174
unsigned mbmaxlen:3; /* maximum length of a
175
character, in bytes */
272
176
/*----------------------*/
273
177
/* End of definitions copied from dtype_t */
276
unsigned ind:10; /*!< table column position
179
unsigned ind:10; /* table column position
277
180
(starting from 0) */
278
unsigned ord_part:1; /*!< nonzero if this column
181
unsigned ord_part:1; /* nonzero if this column
279
182
appears in the ordering fields
283
/** @brief DICT_MAX_INDEX_COL_LEN is measured in bytes and is the maximum
284
indexed column length (or indexed prefix length).
286
It is set to 3*256, so that one can create a column prefix index on
287
256 characters of a TEXT or VARCHAR column also in the UTF-8
288
charset. In that charset, a character may take at most 3 bytes. This
289
constant MUST NOT BE CHANGED, or the compatibility of InnoDB data
186
/* DICT_MAX_INDEX_COL_LEN is measured in bytes and is the maximum
187
indexed column length (or indexed prefix length). It is set to 3*256,
188
so that one can create a column prefix index on 256 characters of a
189
TEXT or VARCHAR column also in the UTF-8 charset. In that charset,
190
a character may take at most 3 bytes.
191
This constant MUST NOT BE CHANGED, or the compatibility of InnoDB data
290
192
files would be at risk! */
291
194
#define DICT_MAX_INDEX_COL_LEN REC_MAX_INDEX_COL_LEN
293
/** Data structure for a field in an index */
196
/* Data structure for a field in an index */
294
197
struct dict_field_struct{
295
dict_col_t* col; /*!< pointer to the table column */
296
const char* name; /*!< name of the column */
297
unsigned prefix_len:10; /*!< 0 or the length of the column
198
dict_col_t* col; /* pointer to the table column */
199
const char* name; /* name of the column */
200
unsigned prefix_len:10; /* 0 or the length of the column
298
201
prefix in bytes in a MySQL index of
299
202
type, e.g., INDEX (textcol(25));
300
203
must be smaller than
301
204
DICT_MAX_INDEX_COL_LEN; NOTE that
302
205
in the UTF-8 charset, MySQL sets this
303
206
to 3 * the prefix len in UTF-8 chars */
304
unsigned fixed_len:10; /*!< 0 or the fixed length of the
207
unsigned fixed_len:10; /* 0 or the fixed length of the
305
208
column if smaller than
306
209
DICT_MAX_INDEX_COL_LEN */
309
/** Data structure for an index. Most fields will be
212
/* Data structure for an index. Most fields will be
310
213
initialized to 0, NULL or FALSE in dict_mem_index_create(). */
311
214
struct dict_index_struct{
312
index_id_t id; /*!< id of the index */
313
mem_heap_t* heap; /*!< memory heap */
314
const char* name; /*!< index name */
315
const char* table_name;/*!< table name */
316
dict_table_t* table; /*!< back pointer to table */
317
#ifndef UNIV_HOTBACKUP
215
dulint id; /* id of the index */
216
mem_heap_t* heap; /* memory heap */
217
const char* name; /* index name */
218
const char* table_name; /* table name */
219
dict_table_t* table; /* back pointer to table */
318
220
unsigned space:32;
319
/*!< space where the index tree is placed */
320
unsigned page:32;/*!< index tree root page number */
321
#endif /* !UNIV_HOTBACKUP */
322
unsigned type:4; /*!< index type (DICT_CLUSTERED, DICT_UNIQUE,
221
/* space where the index tree is placed */
222
unsigned page:32;/* index tree root page number */
223
unsigned type:4; /* index type (DICT_CLUSTERED, DICT_UNIQUE,
323
224
DICT_UNIVERSAL, DICT_IBUF) */
324
unsigned trx_id_offset:10;/*!< position of the trx id column
225
unsigned trx_id_offset:10;/* position of the trx id column
325
226
in a clustered index record, if the fields
326
227
before it are known to be of a fixed size,
328
229
unsigned n_user_defined_cols:10;
329
/*!< number of columns the user defined to
230
/* number of columns the user defined to
330
231
be in the index: in the internal
331
232
representation we add more columns */
332
unsigned n_uniq:10;/*!< number of fields from the beginning
233
unsigned n_uniq:10;/* number of fields from the beginning
333
234
which are enough to determine an index
334
235
entry uniquely */
335
unsigned n_def:10;/*!< number of fields defined so far */
336
unsigned n_fields:10;/*!< number of fields in the index */
337
unsigned n_nullable:10;/*!< number of nullable fields */
338
unsigned cached:1;/*!< TRUE if the index object is in the
236
unsigned n_def:10;/* number of fields defined so far */
237
unsigned n_fields:10;/* number of fields in the index */
238
unsigned n_nullable:10;/* number of nullable fields */
239
unsigned cached:1;/* TRUE if the index object is in the
339
240
dictionary cache */
340
241
unsigned to_be_dropped:1;
341
/*!< TRUE if this index is marked to be
242
/* TRUE if this index is marked to be
342
243
dropped in ha_innobase::prepare_drop_index(),
343
244
otherwise FALSE */
344
dict_field_t* fields; /*!< array of field descriptions */
345
#ifndef UNIV_HOTBACKUP
245
dict_field_t* fields; /* array of field descriptions */
346
246
UT_LIST_NODE_T(dict_index_t)
347
indexes;/*!< list of indexes of the table */
348
btr_search_t* search_info; /*!< info used in optimistic searches */
247
indexes;/* list of indexes of the table */
248
btr_search_t* search_info; /* info used in optimistic searches */
349
249
/*----------------------*/
350
/** Statistics for query optimization */
352
250
ib_int64_t* stat_n_diff_key_vals;
353
/*!< approximate number of different
354
key values for this index, for each
355
n-column prefix where n <=
356
dict_get_n_unique(index); we
357
periodically calculate new
251
/* approximate number of different key values
252
for this index, for each n-column prefix
253
where n <= dict_get_n_unique(index); we
254
periodically calculate new estimates */
359
255
ulint stat_index_size;
360
/*!< approximate index size in
256
/* approximate index size in database pages */
362
257
ulint stat_n_leaf_pages;
363
/*!< approximate number of leaf pages in the
258
/* approximate number of leaf pages in the
366
rw_lock_t lock; /*!< read-write lock protecting the
367
upper levels of the index tree */
368
trx_id_t trx_id; /*!< id of the transaction that created this
369
index, or 0 if the index existed
260
rw_lock_t lock; /* read-write lock protecting the upper levels
262
#ifdef ROW_MERGE_IS_INDEX_USABLE
263
dulint trx_id; /* id of the transaction that created this
264
index, or ut_dulint_zero if the index existed
370
265
when InnoDB was started up */
371
#endif /* !UNIV_HOTBACKUP */
266
#endif /* ROW_MERGE_IS_INDEX_USABLE */
372
267
#ifdef UNIV_DEBUG
373
ulint magic_n;/*!< magic number */
374
/** Value of dict_index_struct::magic_n */
268
ulint magic_n;/* magic number */
375
269
# define DICT_INDEX_MAGIC_N 76789786
379
/** Data structure for a foreign key constraint; an example:
273
/* Data structure for a foreign key constraint; an example:
380
274
FOREIGN KEY (A, B) REFERENCES TABLE2 (C, D). Most fields will be
381
275
initialized to 0, NULL or FALSE in dict_mem_foreign_create(). */
382
277
struct dict_foreign_struct{
383
mem_heap_t* heap; /*!< this object is allocated from
278
mem_heap_t* heap; /* this object is allocated from
384
279
this memory heap */
385
char* id; /*!< id of the constraint as a
280
char* id; /* id of the constraint as a
386
281
null-terminated string */
387
unsigned n_fields:10; /*!< number of indexes' first fields
282
unsigned n_fields:10; /* number of indexes' first fields
388
283
for which the the foreign key
389
284
constraint is defined: we allow the
390
285
indexes to contain more fields than
391
286
mentioned in the constraint, as long
392
287
as the first fields are as mentioned */
393
unsigned type:6; /*!< 0 or DICT_FOREIGN_ON_DELETE_CASCADE
288
unsigned type:6; /* 0 or DICT_FOREIGN_ON_DELETE_CASCADE
394
289
or DICT_FOREIGN_ON_DELETE_SET_NULL */
395
char* foreign_table_name;/*!< foreign table name */
396
dict_table_t* foreign_table; /*!< table where the foreign key is */
397
const char** foreign_col_names;/*!< names of the columns in the
290
char* foreign_table_name;/* foreign table name */
291
dict_table_t* foreign_table; /* table where the foreign key is */
292
const char** foreign_col_names;/* names of the columns in the
399
char* referenced_table_name;/*!< referenced table name */
400
dict_table_t* referenced_table;/*!< table where the referenced key
294
char* referenced_table_name;/* referenced table name */
295
dict_table_t* referenced_table;/* table where the referenced key
402
const char** referenced_col_names;/*!< names of the referenced
297
const char** referenced_col_names;/* names of the referenced
403
298
columns in the referenced table */
404
dict_index_t* foreign_index; /*!< foreign index; we require that
299
dict_index_t* foreign_index; /* foreign index; we require that
405
300
both tables contain explicitly defined
406
301
indexes for the constraint: InnoDB
407
302
does not generate new indexes
409
dict_index_t* referenced_index;/*!< referenced index */
410
UT_LIST_NODE_T(dict_foreign_t)
411
foreign_list; /*!< list node for foreign keys of the
413
UT_LIST_NODE_T(dict_foreign_t)
414
referenced_list;/*!< list node for referenced
304
dict_index_t* referenced_index;/* referenced index */
305
UT_LIST_NODE_T(dict_foreign_t)
306
foreign_list; /* list node for foreign keys of the
308
UT_LIST_NODE_T(dict_foreign_t)
309
referenced_list;/* list node for referenced keys of the
418
/** The flags for ON_UPDATE and ON_DELETE can be ORed; the default is that
313
/* The flags for ON_UPDATE and ON_DELETE can be ORed; the default is that
419
314
a foreign key constraint is enforced, therefore RESTRICT just means no flag */
421
#define DICT_FOREIGN_ON_DELETE_CASCADE 1 /*!< ON DELETE CASCADE */
422
#define DICT_FOREIGN_ON_DELETE_SET_NULL 2 /*!< ON UPDATE SET NULL */
423
#define DICT_FOREIGN_ON_UPDATE_CASCADE 4 /*!< ON DELETE CASCADE */
424
#define DICT_FOREIGN_ON_UPDATE_SET_NULL 8 /*!< ON UPDATE SET NULL */
425
#define DICT_FOREIGN_ON_DELETE_NO_ACTION 16 /*!< ON DELETE NO ACTION */
426
#define DICT_FOREIGN_ON_UPDATE_NO_ACTION 32 /*!< ON UPDATE NO ACTION */
430
/** Data structure for a database table. Most fields will be
315
#define DICT_FOREIGN_ON_DELETE_CASCADE 1
316
#define DICT_FOREIGN_ON_DELETE_SET_NULL 2
317
#define DICT_FOREIGN_ON_UPDATE_CASCADE 4
318
#define DICT_FOREIGN_ON_UPDATE_SET_NULL 8
319
#define DICT_FOREIGN_ON_DELETE_NO_ACTION 16
320
#define DICT_FOREIGN_ON_UPDATE_NO_ACTION 32
323
/* Data structure for a database table. Most fields will be
431
324
initialized to 0, NULL or FALSE in dict_mem_table_create(). */
432
325
struct dict_table_struct{
433
table_id_t id; /*!< id of the table */
434
mem_heap_t* heap; /*!< memory heap */
435
char* name; /*!< table name */
436
const char* dir_path_of_temp_table;/*!< NULL or the directory path
326
dulint id; /* id of the table */
327
mem_heap_t* heap; /* memory heap */
328
const char* name; /* table name */
329
const char* dir_path_of_temp_table;/* NULL or the directory path
437
330
where a TEMPORARY table that was explicitly
438
331
created by a user should be placed if
439
332
innodb_file_per_table is defined in my.cnf;
440
333
in Unix this is usually /tmp/..., in Windows
442
335
unsigned space:32;
443
/*!< space where the clustered index of the
336
/* space where the clustered index of the
444
337
table is placed */
445
unsigned flags:DICT_TF2_BITS;/*!< DICT_TF_COMPACT, ... */
338
unsigned flags:DICT_TF_BITS;/* DICT_TF_COMPACT, ... */
446
339
unsigned ibd_file_missing:1;
447
/*!< TRUE if this is in a single-table
340
/* TRUE if this is in a single-table
448
341
tablespace and the .ibd file is missing; then
449
342
we must return in ha_innodb.cc an error if the
450
343
user tries to query such an orphaned table */
451
344
unsigned tablespace_discarded:1;
452
/*!< this flag is set TRUE when the user
345
/* this flag is set TRUE when the user
453
346
calls DISCARD TABLESPACE on this
454
347
table, and reset to FALSE in IMPORT
456
unsigned cached:1;/*!< TRUE if the table object has been added
349
unsigned cached:1;/* TRUE if the table object has been added
457
350
to the dictionary cache */
458
unsigned n_def:10;/*!< number of columns defined so far */
459
unsigned n_cols:10;/*!< number of columns */
460
dict_col_t* cols; /*!< array of column descriptions */
351
unsigned n_def:10;/* number of columns defined so far */
352
unsigned n_cols:10;/* number of columns */
353
dict_col_t* cols; /* array of column descriptions */
461
354
const char* col_names;
462
/*!< Column names packed in a character string
355
/* Column names packed in a character string
463
356
"name1\0name2\0...nameN\0". Until
464
357
the string contains n_cols, it will be
465
358
allocated from a temporary heap. The final
466
359
string will be allocated from table->heap. */
467
#ifndef UNIV_HOTBACKUP
468
hash_node_t name_hash; /*!< hash chain node */
469
hash_node_t id_hash; /*!< hash chain node */
360
hash_node_t name_hash; /* hash chain node */
361
hash_node_t id_hash; /* hash chain node */
470
362
UT_LIST_BASE_NODE_T(dict_index_t)
471
indexes; /*!< list of indexes of the table */
363
indexes; /* list of indexes of the table */
472
364
UT_LIST_BASE_NODE_T(dict_foreign_t)
473
foreign_list;/*!< list of foreign key constraints
365
foreign_list;/* list of foreign key constraints
474
366
in the table; these refer to columns
475
367
in other tables */
476
368
UT_LIST_BASE_NODE_T(dict_foreign_t)
477
referenced_list;/*!< list of foreign key constraints
369
referenced_list;/* list of foreign key constraints
478
370
which refer to this table */
479
371
UT_LIST_NODE_T(dict_table_t)
480
table_LRU; /*!< node of the LRU list of tables */
372
table_LRU; /* node of the LRU list of tables */
481
373
ulint n_mysql_handles_opened;
482
/*!< count of how many handles MySQL has opened
374
/* count of how many handles MySQL has opened
483
375
to this table; dropping of the table is
484
376
NOT allowed until this count gets to zero;
485
377
MySQL does NOT itself check the number of
486
378
open handles at drop */
487
unsigned fk_max_recusive_level:8;
488
/*!< maximum recursive level we support when
489
loading tables chained together with FK
490
constraints. If exceeds this level, we will
491
stop loading child table into memory along with
493
379
ulint n_foreign_key_checks_running;
494
/*!< count of how many foreign key check
380
/* count of how many foreign key check
495
381
operations are currently being performed
496
382
on the table: we cannot drop the table while
497
383
there are foreign key checks running on
499
trx_id_t query_cache_inv_trx_id;
500
/*!< transactions whose trx id is
501
smaller than this number are not
502
allowed to store to the MySQL query
503
cache or retrieve from it; when a trx
504
with undo logs commits, it sets this
505
to the value of the trx id counter for
506
the tables it had an IX lock on */
385
dulint query_cache_inv_trx_id;
386
/* transactions whose trx id < than this
387
number are not allowed to store to the MySQL
388
query cache or retrieve from it; when a trx
389
with undo logs commits, it sets this to the
390
value of the trx id counter for the tables it
507
392
UT_LIST_BASE_NODE_T(lock_t)
508
locks; /*!< list of locks on the table */
393
locks; /* list of locks on the table */
509
394
#ifdef UNIV_DEBUG
510
395
/*----------------------*/
511
396
ibool does_not_fit_in_memory;
512
/*!< this field is used to specify in
513
simulations tables which are so big
514
that disk should be accessed: disk
515
access is simulated by putting the
516
thread to sleep for a while; NOTE that
517
this flag is not stored to the data
518
dictionary on disk, and the database
519
will forget about value TRUE if it has
520
to reload the table definition from
397
/* this field is used to specify in simulations
398
tables which are so big that disk should be
399
accessed: disk access is simulated by
400
putting the thread to sleep for a while;
401
NOTE that this flag is not stored to the data
402
dictionary on disk, and the database will
403
forget about value TRUE if it has to reload
404
the table definition from disk */
522
405
#endif /* UNIV_DEBUG */
523
406
/*----------------------*/
524
407
unsigned big_rows:1;
525
/*!< flag: TRUE if the maximum length of
408
/* flag: TRUE if the maximum length of
526
409
a single row exceeds BIG_ROW_SIZE;
527
410
initialized in dict_table_add_to_cache() */
528
/** Statistics for query optimization */
530
unsigned stat_initialized:1; /*!< TRUE if statistics have
411
unsigned stat_initialized:1; /* TRUE if statistics have
531
412
been calculated the first time
532
413
after database startup or table creation */
533
414
ib_int64_t stat_n_rows;
534
/*!< approximate number of rows in the table;
415
/* approximate number of rows in the table;
535
416
we periodically calculate new estimates */
536
417
ulint stat_clustered_index_size;
537
/*!< approximate clustered index size in
418
/* approximate clustered index size in
538
419
database pages */
539
420
ulint stat_sum_of_other_index_sizes;
540
/*!< other indexes in database pages */
421
/* other indexes in database pages */
541
422
ulint stat_modified_counter;
542
/*!< when a row is inserted, updated,
423
/* when a row is inserted, updated, or deleted,
544
424
we add 1 to this number; we calculate new
545
425
estimates for the stat_... values for the
546
426
table and the indexes at an interval of 2 GB