~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

Merge initial InnoDB+ import.

This was applied by generating a patch between MySQL 5.1.50 InnoDB plugin and
the just-merged innodb+ from mysql-trunk revision-id: vasil.dimov@oracle.com-20100422110752-1zowoqxel5xx3z2e

Then, some manual merge resolving and it worked. This should make it much
easier to merge the rest of InnoDB 1.1 and 1.2 from the mysql tree using
my bzr-reapply script.

This takes us to InnoDB 1.1.1(ish).

Show diffs side-by-side

added added

removed removed

Lines of Context:
62
62
}
63
63
 
64
64
/**********************************************************************//**
65
 
Returns a new table, index, or space id. */
 
65
Returns a new table, index, or tree id.
 
66
@return the new id */
66
67
UNIV_INTERN
67
 
void
 
68
dulint
68
69
dict_hdr_get_new_id(
69
70
/*================*/
70
 
        dulint* table_id,       /*!< out: table id (not assigned if NULL) */
71
 
        dulint* index_id,       /*!< out: index id (not assigned if NULL) */
72
 
        ulint*  space_id)       /*!< out: space id (not assigned if NULL) */
 
71
        ulint   type)   /*!< in: DICT_HDR_ROW_ID, ... */
73
72
{
74
73
        dict_hdr_t*     dict_hdr;
75
74
        dulint          id;
76
75
        mtr_t           mtr;
77
76
 
 
77
        ut_ad((type == DICT_HDR_TABLE_ID) || (type == DICT_HDR_INDEX_ID));
 
78
 
78
79
        mtr_start(&mtr);
79
80
 
80
81
        dict_hdr = dict_hdr_get(&mtr);
81
82
 
82
 
        if (table_id) {
83
 
                id = mtr_read_dulint(dict_hdr + DICT_HDR_TABLE_ID, &mtr);
84
 
                id = ut_dulint_add(id, 1);
85
 
                mlog_write_dulint(dict_hdr + DICT_HDR_TABLE_ID, id, &mtr);
86
 
                *table_id = id;
87
 
        }
88
 
 
89
 
        if (index_id) {
90
 
                id = mtr_read_dulint(dict_hdr + DICT_HDR_INDEX_ID, &mtr);
91
 
                id = ut_dulint_add(id, 1);
92
 
                mlog_write_dulint(dict_hdr + DICT_HDR_INDEX_ID, id, &mtr);
93
 
                *index_id = id;
94
 
        }
95
 
 
96
 
        if (space_id) {
97
 
                *space_id = mtr_read_ulint(dict_hdr + DICT_HDR_MAX_SPACE_ID,
98
 
                                           MLOG_4BYTES, &mtr);
99
 
                if (fil_assign_new_space_id(space_id)) {
100
 
                        mlog_write_ulint(dict_hdr + DICT_HDR_MAX_SPACE_ID,
101
 
                                         *space_id, MLOG_4BYTES, &mtr);
102
 
                }
103
 
        }
 
83
        id = mtr_read_dulint(dict_hdr + type, &mtr);
 
84
        id = ut_dulint_add(id, 1);
 
85
 
 
86
        mlog_write_dulint(dict_hdr + type, id, &mtr);
104
87
 
105
88
        mtr_commit(&mtr);
 
89
 
 
90
        return(id);
106
91
}
107
92
 
108
93
/**********************************************************************//**
166
151
        mlog_write_dulint(dict_header + DICT_HDR_INDEX_ID,
167
152
                          ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
168
153
 
169
 
        mlog_write_ulint(dict_header + DICT_HDR_MAX_SPACE_ID,
170
 
                         0, MLOG_4BYTES, mtr);
171
 
 
172
 
        /* Obsolete, but we must initialize it anyway. */
173
 
        mlog_write_ulint(dict_header + DICT_HDR_MIX_ID_LOW,
174
 
                         DICT_HDR_FIRST_ID, MLOG_4BYTES, mtr);
 
154
        /* Obsolete, but we must initialize it to 0 anyway. */
 
155
        mlog_write_dulint(dict_header + DICT_HDR_MIX_ID,
 
156
                          ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
175
157
 
176
158
        /* Create the B-tree roots for the clustered indexes of the basic
177
159
        system tables */
386
368
#if DICT_SYS_INDEXES_TYPE_FIELD != 4 + 2
387
369
#error "DICT_SYS_INDEXES_TYPE_FIELD != 4 + 2"
388
370
#endif
389
 
#if DICT_SYS_INDEXES_NAME_FIELD != 2 + 2
390
 
#error "DICT_SYS_INDEXES_NAME_FIELD != 2 + 2"
 
371
#if DICT_SYS_INDEXES_NAME_FIELD != 1 + 2
 
372
#error "DICT_SYS_INDEXES_NAME_FIELD != 1 + 2"
391
373
#endif
392
374
 
393
375
        table->id = DICT_INDEXES_ID;