~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/dict/dict0mem.c

  • Committer: Brian Aker
  • Date: 2010-11-17 21:25:31 UTC
  • mto: (1939.1.1 quick)
  • mto: This revision was merged to the branch mainline in revision 1940.
  • Revision ID: brian@tangent.org-20101117212531-va13j4xh43zuma68
First pass though barriers.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved.
 
3
Copyright (c) 1996, 2009, 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
40
40
#define DICT_HEAP_SIZE          100     /*!< initial memory heap size when
41
41
                                        creating a table or index object */
42
42
 
43
 
#ifdef UNIV_PFS_MUTEX
44
 
/* Key to register autoinc_mutex with performance schema */
45
 
UNIV_INTERN mysql_pfs_key_t     autoinc_mutex_key;
46
 
#endif /* UNIV_PFS_MUTEX */
47
 
 
48
43
/**********************************************************************//**
49
44
Creates a table memory object.
50
45
@return own: table object */
83
78
#ifndef UNIV_HOTBACKUP
84
79
        table->autoinc_lock = mem_heap_alloc(heap, lock_get_size());
85
80
 
86
 
        mutex_create(autoinc_mutex_key,
87
 
                     &table->autoinc_mutex, SYNC_DICT_AUTOINC_MUTEX);
 
81
        mutex_create(&table->autoinc_mutex, SYNC_DICT_AUTOINC_MUTEX);
88
82
 
89
83
        table->autoinc = 0;
90
84
 
177
171
        ulint           len)    /*!< in: precision */
178
172
{
179
173
        dict_col_t*     col;
 
174
#ifndef UNIV_HOTBACKUP
 
175
        ulint           mbminlen;
 
176
        ulint           mbmaxlen;
 
177
#endif /* !UNIV_HOTBACKUP */
180
178
        ulint           i;
181
179
 
182
180
        ut_ad(table);
201
199
 
202
200
        col = dict_table_get_nth_col(table, i);
203
201
 
204
 
        dict_mem_fill_column_struct(col, i, mtype, prtype, len);
 
202
        col->ind = (unsigned int) i;
 
203
        col->ord_part = 0;
 
204
 
 
205
        col->mtype = (unsigned int) mtype;
 
206
        col->prtype = (unsigned int) prtype;
 
207
        col->len = (unsigned int) len;
 
208
 
 
209
#ifndef UNIV_HOTBACKUP
 
210
        dtype_get_mblen(mtype, prtype, &mbminlen, &mbmaxlen);
 
211
 
 
212
        col->mbminlen = (unsigned int) mbminlen;
 
213
        col->mbmaxlen = (unsigned int) mbmaxlen;
 
214
#endif /* !UNIV_HOTBACKUP */
205
215
}
206
216
 
207
217
/**********************************************************************//**
228
238
        heap = mem_heap_create(DICT_HEAP_SIZE);
229
239
        index = mem_heap_zalloc(heap, sizeof(dict_index_t));
230
240
 
231
 
        dict_mem_fill_index_struct(index, heap, table_name, index_name,
232
 
                                   space, type, n_fields);
 
241
        index->heap = heap;
233
242
 
 
243
        index->type = type;
 
244
#ifndef UNIV_HOTBACKUP
 
245
        index->space = (unsigned int) space;
 
246
#endif /* !UNIV_HOTBACKUP */
 
247
        index->name = mem_heap_strdup(heap, index_name);
 
248
        index->table_name = table_name;
 
249
        index->n_fields = (unsigned int) n_fields;
 
250
        index->fields = mem_heap_alloc(heap, 1 + n_fields
 
251
                                       * sizeof(dict_field_t));
 
252
        /* The '1 +' above prevents allocation
 
253
        of an empty mem block */
 
254
#ifdef UNIV_DEBUG
 
255
        index->magic_n = DICT_INDEX_MAGIC_N;
 
256
#endif /* UNIV_DEBUG */
234
257
        return(index);
235
258
}
236
259