64
64
/**********************************************************************//**
65
Returns a new table, index, or space id. */
65
Returns a new table, index, or tree id.
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, ... */
74
73
dict_hdr_t* dict_hdr;
77
ut_ad((type == DICT_HDR_TABLE_ID) || (type == DICT_HDR_INDEX_ID));
80
81
dict_hdr = dict_hdr_get(&mtr);
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);
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);
97
*space_id = mtr_read_ulint(dict_hdr + DICT_HDR_MAX_SPACE_ID,
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);
83
id = mtr_read_dulint(dict_hdr + type, &mtr);
84
id = ut_dulint_add(id, 1);
86
mlog_write_dulint(dict_hdr + type, id, &mtr);
108
93
/**********************************************************************//**
166
151
mlog_write_dulint(dict_header + DICT_HDR_INDEX_ID,
167
152
ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
169
mlog_write_ulint(dict_header + DICT_HDR_MAX_SPACE_ID,
170
0, MLOG_4BYTES, mtr);
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);
176
158
/* Create the B-tree roots for the clustered indexes of the basic
386
368
#if DICT_SYS_INDEXES_TYPE_FIELD != 4 + 2
387
369
#error "DICT_SYS_INDEXES_TYPE_FIELD != 4 + 2"
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"
393
375
table->id = DICT_INDEXES_ID;