~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/include/dict0mem.h

  • Committer: Brian Aker
  • Date: 2011-02-22 06:12:02 UTC
  • mfrom: (2190.1.6 drizzle-build)
  • Revision ID: brian@tangent.org-20110222061202-k03czxykqy4x9hjs
List update, header fixes, multiple symbols, and David deletes some code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved.
 
3
Copyright (C) 1996, 2010, Innobase Oy. All Rights Reserved.
4
4
 
5
5
This program is free software; you can redistribute it and/or modify it under
6
6
the terms of the GNU General Public License as published by the Free Software
80
80
/** File format */
81
81
/* @{ */
82
82
#define DICT_TF_FORMAT_SHIFT            5       /* file format */
83
 
#define DICT_TF_FORMAT_MASK             (127 << DICT_TF_FORMAT_SHIFT)
 
83
#define DICT_TF_FORMAT_MASK             \
 
84
((~(~0 << (DICT_TF_BITS - DICT_TF_FORMAT_SHIFT))) << DICT_TF_FORMAT_SHIFT)
84
85
#define DICT_TF_FORMAT_51               0       /*!< InnoDB/MySQL up to 5.1 */
85
86
#define DICT_TF_FORMAT_ZIP              1       /*!< InnoDB plugin for 5.1:
86
87
                                                compressed tables,
88
89
/** Maximum supported file format */
89
90
#define DICT_TF_FORMAT_MAX              DICT_TF_FORMAT_ZIP
90
91
 
 
92
/** Minimum supported file format */
 
93
#define DICT_TF_FORMAT_MIN              DICT_TF_FORMAT_51
 
94
 
 
95
/* @} */
91
96
#define DICT_TF_BITS                    6       /*!< number of flag bits */
92
97
#if (1 << (DICT_TF_BITS - DICT_TF_FORMAT_SHIFT)) <= DICT_TF_FORMAT_MAX
93
98
# error "DICT_TF_BITS is insufficient for DICT_TF_FORMAT_MAX"
94
99
#endif
95
100
/* @} */
 
101
 
 
102
/** @brief Additional table flags.
 
103
 
 
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. */
 
108
/* @{ */
 
109
#define DICT_TF2_SHIFT                  DICT_TF_BITS
 
110
                                                /*!< Shift value for
 
111
                                                table->flags. */
 
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
 
116
                                                in table->flags. */
96
117
/* @} */
97
118
 
 
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
 
126
 
 
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
 
132
before proceeds. */
 
133
#define FK_MAX_CASCADE_DEL              255
 
134
 
98
135
/**********************************************************************//**
99
136
Creates a table memory object.
100
137
@return own: table object */
129
166
        ulint           prtype, /*!< in: precise type */
130
167
        ulint           len);   /*!< in: precision */
131
168
/**********************************************************************//**
 
169
This function populates a dict_col_t memory structure with
 
170
supplied information. */
 
171
UNIV_INTERN
 
172
void
 
173
dict_mem_fill_column_struct(
 
174
/*========================*/
 
175
        dict_col_t*     column,         /*!< out: column struct to be
 
176
                                        filled */
 
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. */
 
184
UNIV_INLINE
 
185
void
 
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
/**********************************************************************//**
132
199
Creates an index memory object.
133
200
@return own: index object */
134
201
UNIV_INTERN
197
264
                                        the string, MySQL uses 1 or 2
198
265
                                        bytes to store the string length) */
199
266
 
200
 
        unsigned        mbminlen:2;     /*!< minimum length of a
201
 
                                        character, in bytes */
202
 
        unsigned        mbmaxlen:3;     /*!< maximum length of a
203
 
                                        character, in bytes */
 
267
        unsigned        mbminmaxlen:5;  /*!< minimum and maximum length of a
 
268
                                        character, in bytes;
 
269
                                        DATA_MBMINMAXLEN(mbminlen,mbmaxlen);
 
270
                                        mbminlen=DATA_MBMINLEN(mbminmaxlen);
 
271
                                        mbmaxlen=DATA_MBMINLEN(mbminmaxlen) */
204
272
        /*----------------------*/
205
273
        /* End of definitions copied from dtype_t */
206
274
        /* @} */
241
309
/** Data structure for an index.  Most fields will be
242
310
initialized to 0, NULL or FALSE in dict_mem_index_create(). */
243
311
struct dict_index_struct{
244
 
        dulint          id;     /*!< id of the index */
 
312
        index_id_t      id;     /*!< id of the index */
245
313
        mem_heap_t*     heap;   /*!< memory heap */
246
314
        const char*     name;   /*!< index name */
247
315
        const char*     table_name;/*!< table name */
297
365
        /* @} */
298
366
        rw_lock_t       lock;   /*!< read-write lock protecting the
299
367
                                upper levels of the index tree */
300
 
        ib_uint64_t     trx_id; /*!< id of the transaction that created this
 
368
        trx_id_t        trx_id; /*!< id of the transaction that created this
301
369
                                index, or 0 if the index existed
302
370
                                when InnoDB was started up */
303
371
#endif /* !UNIV_HOTBACKUP */
362
430
/** Data structure for a database table.  Most fields will be
363
431
initialized to 0, NULL or FALSE in dict_mem_table_create(). */
364
432
struct dict_table_struct{
365
 
        dulint          id;     /*!< id of the table */
 
433
        table_id_t      id;     /*!< id of the table */
366
434
        mem_heap_t*     heap;   /*!< memory heap */
367
 
        const char*     name;   /*!< table name */
 
435
        char*           name;   /*!< table name */
368
436
        const char*     dir_path_of_temp_table;/*!< NULL or the directory path
369
437
                                where a TEMPORARY table that was explicitly
370
438
                                created by a user should be placed if
374
442
        unsigned        space:32;
375
443
                                /*!< space where the clustered index of the
376
444
                                table is placed */
377
 
        unsigned        flags:DICT_TF_BITS;/*!< DICT_TF_COMPACT, ... */
 
445
        unsigned        flags:DICT_TF2_BITS;/*!< DICT_TF_COMPACT, ... */
378
446
        unsigned        ibd_file_missing:1;
379
447
                                /*!< TRUE if this is in a single-table
380
448
                                tablespace and the .ibd file is missing; then
416
484
                                NOT allowed until this count gets to zero;
417
485
                                MySQL does NOT itself check the number of
418
486
                                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
 
492
                                its parent table */
419
493
        ulint           n_foreign_key_checks_running;
420
494
                                /*!< count of how many foreign key check
421
495
                                operations are currently being performed