~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Lee Bieber
  • Date: 2010-12-03 01:16:19 UTC
  • mfrom: (1819.9.81 update-innobase)
  • Revision ID: kalebral@gmail.com-20101203011619-n6v584rijwdet05b
Merge Stewart - update Innobase plugin based on InnoDB 1.1.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
void
68
68
dict_hdr_get_new_id(
69
69
/*================*/
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) */
 
70
        table_id_t*     table_id,       /*!< out: table id
 
71
                                        (not assigned if NULL) */
 
72
        index_id_t*     index_id,       /*!< out: index id
 
73
                                        (not assigned if NULL) */
 
74
        ulint*          space_id)       /*!< out: space id
 
75
                                        (not assigned if NULL) */
73
76
{
74
77
        dict_hdr_t*     dict_hdr;
75
 
        dulint          id;
 
78
        ib_id_t         id;
76
79
        mtr_t           mtr;
77
80
 
78
81
        mtr_start(&mtr);
80
83
        dict_hdr = dict_hdr_get(&mtr);
81
84
 
82
85
        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
                id = mach_read_from_8(dict_hdr + DICT_HDR_TABLE_ID);
 
87
                id++;
 
88
                mlog_write_ull(dict_hdr + DICT_HDR_TABLE_ID, id, &mtr);
86
89
                *table_id = id;
87
90
        }
88
91
 
89
92
        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
                id = mach_read_from_8(dict_hdr + DICT_HDR_INDEX_ID);
 
94
                id++;
 
95
                mlog_write_ull(dict_hdr + DICT_HDR_INDEX_ID, id, &mtr);
93
96
                *index_id = id;
94
97
        }
95
98
 
114
117
/*=======================*/
115
118
{
116
119
        dict_hdr_t*     dict_hdr;
117
 
        dulint          id;
 
120
        row_id_t        id;
118
121
        mtr_t           mtr;
119
122
 
120
123
        ut_ad(mutex_own(&(dict_sys->mutex)));
125
128
 
126
129
        dict_hdr = dict_hdr_get(&mtr);
127
130
 
128
 
        mlog_write_dulint(dict_hdr + DICT_HDR_ROW_ID, id, &mtr);
 
131
        mlog_write_ull(dict_hdr + DICT_HDR_ROW_ID, id, &mtr);
129
132
 
130
133
        mtr_commit(&mtr);
131
134
}
157
160
 
158
161
        /* Start counting row, table, index, and tree ids from
159
162
        DICT_HDR_FIRST_ID */
160
 
        mlog_write_dulint(dict_header + DICT_HDR_ROW_ID,
161
 
                          ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
162
 
 
163
 
        mlog_write_dulint(dict_header + DICT_HDR_TABLE_ID,
164
 
                          ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
165
 
 
166
 
        mlog_write_dulint(dict_header + DICT_HDR_INDEX_ID,
167
 
                          ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
 
163
        mlog_write_ull(dict_header + DICT_HDR_ROW_ID,
 
164
                       DICT_HDR_FIRST_ID, mtr);
 
165
 
 
166
        mlog_write_ull(dict_header + DICT_HDR_TABLE_ID,
 
167
                       DICT_HDR_FIRST_ID, mtr);
 
168
 
 
169
        mlog_write_ull(dict_header + DICT_HDR_INDEX_ID,
 
170
                       DICT_HDR_FIRST_ID, mtr);
168
171
 
169
172
        mlog_write_ulint(dict_header + DICT_HDR_MAX_SPACE_ID,
170
173
                         0, MLOG_4BYTES, mtr);
273
276
        ..._MARGIN, it will immediately be updated to the disk-based
274
277
        header. */
275
278
 
276
 
        dict_sys->row_id = ut_dulint_add(
277
 
                ut_dulint_align_up(mtr_read_dulint(dict_hdr + DICT_HDR_ROW_ID,
278
 
                                                   &mtr),
279
 
                                   DICT_HDR_ROW_ID_WRITE_MARGIN),
280
 
                DICT_HDR_ROW_ID_WRITE_MARGIN);
 
279
        dict_sys->row_id = DICT_HDR_ROW_ID_WRITE_MARGIN
 
280
                + ut_uint64_align_up(mach_read_from_8(dict_hdr + DICT_HDR_ROW_ID),
 
281
                                     DICT_HDR_ROW_ID_WRITE_MARGIN);
281
282
 
282
283
        /* Insert into the dictionary cache the descriptions of the basic
283
284
        system tables */