~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Brian Aker
  • Date: 2008-09-04 19:31:00 UTC
  • Revision ID: brian@tangent.org-20080904193100-l849hgghfy4urj43
Changing default character set from this point on.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
#define DICT_UNIQUE     2       /* unique index */
32
32
#define DICT_UNIVERSAL  4       /* index which can contain records from any
33
33
                                other index */
34
 
#define DICT_IBUF       8       /* insert buffer tree */
 
34
#define DICT_IBUF       8       /* insert buffer tree */
35
35
 
36
36
/* Types for a table object */
37
37
#define DICT_TABLE_ORDINARY             1
41
41
                                          really a cluster definition */
42
42
#endif
43
43
 
44
 
/* Table flags.  All unused bits must be 0. */
45
 
#define DICT_TF_COMPACT                 1       /* Compact page format.
46
 
                                                This must be set for
47
 
                                                new file formats
48
 
                                                (later than
49
 
                                                DICT_TF_FORMAT_51). */
50
 
 
51
 
/* compressed page size (0=uncompressed, up to 15 compressed sizes) */
52
 
#define DICT_TF_ZSSIZE_SHIFT            1
53
 
#define DICT_TF_ZSSIZE_MASK             (15 << DICT_TF_ZSSIZE_SHIFT)
54
 
#define DICT_TF_ZSSIZE_MAX (UNIV_PAGE_SIZE_SHIFT - PAGE_ZIP_MIN_SIZE_SHIFT + 1)
55
 
 
56
 
 
57
 
#define DICT_TF_FORMAT_SHIFT            5       /* file format */
58
 
#define DICT_TF_FORMAT_MASK             (127 << DICT_TF_FORMAT_SHIFT)
59
 
#define DICT_TF_FORMAT_51               0       /* InnoDB/MySQL up to 5.1 */
60
 
#define DICT_TF_FORMAT_ZIP              1       /* InnoDB plugin for 5.1:
61
 
                                                compressed tables,
62
 
                                                new BLOB treatment */
63
 
#define DICT_TF_FORMAT_MAX              DICT_TF_FORMAT_ZIP
64
 
 
65
 
#define DICT_TF_BITS                    6       /* number of flag bits */
66
 
#if (1 << (DICT_TF_BITS - DICT_TF_FORMAT_SHIFT)) <= DICT_TF_FORMAT_MAX
67
 
# error "DICT_TF_BITS is insufficient for DICT_TF_FORMAT_MAX"
68
 
#endif
 
44
/* Table flags */
 
45
#define DICT_TF_COMPACT                 1       /* compact page format */
69
46
 
70
47
/**************************************************************************
71
48
Creates a table memory object. */
72
 
UNIV_INTERN
 
49
 
73
50
dict_table_t*
74
51
dict_mem_table_create(
75
52
/*==================*/
83
60
        ulint           flags);         /* in: table flags */
84
61
/********************************************************************
85
62
Free a table memory object. */
86
 
UNIV_INTERN
 
63
 
87
64
void
88
65
dict_mem_table_free(
89
66
/*================*/
90
67
        dict_table_t*   table);         /* in: table */
91
68
/**************************************************************************
92
69
Adds a column definition to a table. */
93
 
UNIV_INTERN
 
70
 
94
71
void
95
72
dict_mem_table_add_col(
96
73
/*===================*/
102
79
        ulint           len);   /* in: precision */
103
80
/**************************************************************************
104
81
Creates an index memory object. */
105
 
UNIV_INTERN
 
82
 
106
83
dict_index_t*
107
84
dict_mem_index_create(
108
85
/*==================*/
119
96
Adds a field definition to an index. NOTE: does not take a copy
120
97
of the column name if the field is a column. The memory occupied
121
98
by the column name may be released only after publishing the index. */
122
 
UNIV_INTERN
 
99
 
123
100
void
124
101
dict_mem_index_add_field(
125
102
/*=====================*/
130
107
                                        INDEX (textcol(25)) */
131
108
/**************************************************************************
132
109
Frees an index memory object. */
133
 
UNIV_INTERN
 
110
 
134
111
void
135
112
dict_mem_index_free(
136
113
/*================*/
137
114
        dict_index_t*   index); /* in: index */
138
115
/**************************************************************************
139
116
Creates and initializes a foreign constraint memory object. */
140
 
UNIV_INTERN
 
117
 
141
118
dict_foreign_t*
142
119
dict_mem_foreign_create(void);
143
120
/*=========================*/
190
167
This constant MUST NOT BE CHANGED, or the compatibility of InnoDB data
191
168
files would be at risk! */
192
169
 
193
 
#define DICT_MAX_INDEX_COL_LEN          REC_MAX_INDEX_COL_LEN
 
170
#define DICT_MAX_INDEX_COL_LEN          768
194
171
 
195
172
/* Data structure for a field in an index */
196
173
struct dict_field_struct{
208
185
                                        DICT_MAX_INDEX_COL_LEN */
209
186
};
210
187
 
211
 
/* Data structure for an index.  Most fields will be
212
 
initialized to 0, NULL or FALSE in dict_mem_index_create(). */
 
188
/* Data structure for an index */
213
189
struct dict_index_struct{
214
190
        dulint          id;     /* id of the index */
215
191
        mem_heap_t*     heap;   /* memory heap */
 
192
        ulint           type;   /* index type */
216
193
        const char*     name;   /* index name */
217
194
        const char*     table_name; /* table name */
218
195
        dict_table_t*   table;  /* back pointer to table */
219
196
        unsigned        space:32;
220
197
                                /* space where the index tree is placed */
221
198
        unsigned        page:32;/* index tree root page number */
222
 
        unsigned        type:4; /* index type (DICT_CLUSTERED, DICT_UNIQUE,
223
 
                                DICT_UNIVERSAL, DICT_IBUF) */
224
199
        unsigned        trx_id_offset:10;/* position of the the trx id column
225
200
                                in a clustered index record, if the fields
226
201
                                before it are known to be of a fixed size,
237
212
        unsigned        n_nullable:10;/* number of nullable fields */
238
213
        unsigned        cached:1;/* TRUE if the index object is in the
239
214
                                dictionary cache */
240
 
        unsigned        to_be_dropped:1;
241
 
                                /* TRUE if this index is marked to be
242
 
                                dropped in ha_innobase::prepare_drop_index(),
243
 
                                otherwise FALSE */
244
215
        dict_field_t*   fields; /* array of field descriptions */
245
216
        UT_LIST_NODE_T(dict_index_t)
246
217
                        indexes;/* list of indexes of the table */
247
218
        btr_search_t*   search_info; /* info used in optimistic searches */
248
219
        /*----------------------*/
249
 
        ib_int64_t*     stat_n_diff_key_vals;
 
220
        ib_longlong*    stat_n_diff_key_vals;
250
221
                                /* approximate number of different key values
251
222
                                for this index, for each n-column prefix
252
223
                                where n <= dict_get_n_unique(index); we
258
229
                                index tree */
259
230
        rw_lock_t       lock;   /* read-write lock protecting the upper levels
260
231
                                of the index tree */
261
 
#ifdef ROW_MERGE_IS_INDEX_USABLE
262
 
        dulint          trx_id; /* id of the transaction that created this
263
 
                                index, or ut_dulint_zero if the index existed
264
 
                                when InnoDB was started up */
265
 
#endif /* ROW_MERGE_IS_INDEX_USABLE */
266
232
#ifdef UNIV_DEBUG
267
233
        ulint           magic_n;/* magic number */
268
234
# define DICT_INDEX_MAGIC_N     76789786
270
236
};
271
237
 
272
238
/* Data structure for a foreign key constraint; an example:
273
 
FOREIGN KEY (A, B) REFERENCES TABLE2 (C, D).  Most fields will be
274
 
initialized to 0, NULL or FALSE in dict_mem_foreign_create(). */
 
239
FOREIGN KEY (A, B) REFERENCES TABLE2 (C, D) */
275
240
 
276
241
struct dict_foreign_struct{
277
242
        mem_heap_t*     heap;           /* this object is allocated from
319
284
#define DICT_FOREIGN_ON_UPDATE_NO_ACTION 32
320
285
 
321
286
 
322
 
/* Data structure for a database table.  Most fields will be
323
 
initialized to 0, NULL or FALSE in dict_mem_table_create(). */
 
287
/* Data structure for a database table */
324
288
struct dict_table_struct{
325
289
        dulint          id;     /* id of the table */
326
290
        mem_heap_t*     heap;   /* memory heap */
334
298
        unsigned        space:32;
335
299
                                /* space where the clustered index of the
336
300
                                table is placed */
337
 
        unsigned        flags:DICT_TF_BITS;/* DICT_TF_COMPACT, ... */
338
301
        unsigned        ibd_file_missing:1;
339
302
                                /* TRUE if this is in a single-table
340
303
                                tablespace and the .ibd file is missing; then
347
310
                                TABLESPACE */
348
311
        unsigned        cached:1;/* TRUE if the table object has been added
349
312
                                to the dictionary cache */
 
313
        unsigned        flags:8;/* DICT_TF_COMPACT, ... */
350
314
        unsigned        n_def:10;/* number of columns defined so far */
351
315
        unsigned        n_cols:10;/* number of columns */
352
316
        dict_col_t*     cols;   /* array of column descriptions */
417
381
        unsigned        stat_initialized:1; /* TRUE if statistics have
418
382
                                been calculated the first time
419
383
                                after database startup or table creation */
420
 
        ib_int64_t      stat_n_rows;
 
384
        ib_longlong     stat_n_rows;
421
385
                                /* approximate number of rows in the table;
422
386
                                we periodically calculate new estimates */
423
387
        ulint           stat_clustered_index_size;
445
409
                                /* TRUE if the autoinc counter has been
446
410
                                inited; MySQL gets the init value by executing
447
411
                                SELECT MAX(auto inc column) */
448
 
        ib_uint64_t     autoinc;/* autoinc counter value to give to the
 
412
        ib_longlong     autoinc;/* autoinc counter value to give to the
449
413
                                next inserted row */
450
 
        ib_int64_t      autoinc_increment;
 
414
 
 
415
        ib_longlong     autoinc_increment;
451
416
                                /* The increment step of the auto increment
452
417
                                column. Value must be greater than or equal
453
418
                                to 1 */
454
 
        /*----------------------*/
455
419
        ulong           n_waiting_or_granted_auto_inc_locks;
456
420
                                /* This counter is used to track the number
457
421
                                of granted and pending autoinc locks on this