369
369
mem_heap_t* heap, /*!< in/out: heap memory */
370
370
const rec_t* rec, /*!< in: current SYS_INDEXES rec */
371
371
dict_index_t* index, /*!< out: index to be filled */
372
dulint* table_id) /*!< out: index table id */
372
table_id_t* table_id) /*!< out: index table id */
374
374
const char* err_msg;
395
395
mem_heap_t* heap, /*!< in/out: heap memory */
396
396
const rec_t* rec, /*!< in: current SYS_COLUMNS rec */
397
397
dict_col_t* column, /*!< out: dict_col_t to be filled */
398
dulint* table_id, /*!< out: table id */
398
table_id_t* table_id, /*!< out: table id */
399
399
const char** col_name) /*!< out: column name */
401
401
const char* err_msg;
419
419
dict_field_t* sys_field, /*!< out: dict_field_t to be
421
421
ulint* pos, /*!< out: Field position */
422
dulint* index_id, /*!< out: current index id */
423
dulint last_id) /*!< in: previous index id */
422
index_id_t* index_id, /*!< out: current index id */
423
index_id_t last_id) /*!< in: previous index id */
426
426
byte* last_index_id;
736
736
sys_index = UT_LIST_GET_FIRST(sys_tables->indexes);
737
737
ut_a(!dict_table_is_comp(sys_tables));
739
max_space_id = mtr_read_ulint(dict_hdr_get(&mtr)
740
+ DICT_HDR_MAX_SPACE_ID,
742
fil_set_max_space_id_if_bigger(max_space_id);
739
744
btr_pcur_open_at_index_side(TRUE, sys_index, BTR_SEARCH_LEAF, &pcur,
858
863
dict_load_column_low(
859
864
/*=================*/
860
865
dict_table_t* table, /*!< in/out: table, could be NULL
861
if we just polulate a dict_column_t
866
if we just populate a dict_column_t
862
867
struct with information from
863
868
a SYS_COLUMNS record */
864
869
mem_heap_t* heap, /*!< in/out: memory heap
865
870
for temporary storage */
866
dict_col_t* column, /*!< out: dict_column_t to fill */
867
dulint* table_id, /*!< out: table id */
871
dict_col_t* column, /*!< out: dict_column_t to fill,
872
or NULL if table != NULL */
873
table_id_t* table_id, /*!< out: table id */
868
874
const char** col_name, /*!< out: column name */
869
875
const rec_t* rec) /*!< in: SYS_COLUMNS record */
894
902
*table_id = mach_read_from_8(field);
895
} else if (UNIV_UNLIKELY(ut_dulint_cmp(table->id,
896
mach_read_from_8(field)))) {
903
} else if (UNIV_UNLIKELY(table->id != mach_read_from_8(field))) {
897
904
return("SYS_COLUMNS.TABLE_ID mismatch");
907
pos = mach_read_from_4(field);
908
} else if (UNIV_UNLIKELY(table->n_def != mach_read_from_4(field))) {
913
pos = mach_read_from_4(field);
915
if (UNIV_UNLIKELY(table && table->n_def != pos)) {
909
916
return("SYS_COLUMNS.POS mismatch");
1250
1257
/********************************************************************//**
1251
1258
Loads an index definition from a SYS_INDEXES record to dict_index_t.
1252
If "cached" is set to "TRUE", we will create a dict_index_t structure
1253
and fill it accordingly. Otherwise, the dict_index_t will
1254
be supplied by the caller and filled with information read from
1256
@return error message, or NULL on success */
1259
If allocate=TRUE, we will create a dict_index_t structure and fill it
1260
accordingly. If allocated=FALSE, the dict_index_t will be supplied by
1261
the caller and filled with information read from the record. @return
1262
error message, or NULL on success */
1259
1265
dict_load_index_low(
1260
1266
/*================*/
1261
1267
byte* table_id, /*!< in/out: table id (8 bytes),
1262
an "in" value if cached=TRUE
1263
and "out" when cached=FALSE */
1268
an "in" value if allocate=TRUE
1269
and "out" when allocate=FALSE */
1264
1270
const char* table_name, /*!< in: table name */
1265
1271
mem_heap_t* heap, /*!< in/out: temporary memory heap */
1266
1272
const rec_t* rec, /*!< in: SYS_INDEXES record */
1267
ibool cached, /*!< in: TRUE = add to cache,
1273
ibool allocate, /*!< in: TRUE=allocate *index,
1274
FALSE=fill in a pre-allocated
1269
1276
dict_index_t** index) /*!< out,own: index, or NULL */
1271
1278
const byte* field;
1273
1280
ulint name_len;
1274
1281
char* name_buf;
1276
1283
ulint n_fields;
1281
/* If "cached" is set to TRUE, no dict_index_t will
1288
/* If allocate=TRUE, no dict_index_t will
1282
1289
be supplied. Initialize "*index" to NULL */
1297
1304
return("incorrect column length in SYS_INDEXES");
1301
1308
/* We are reading a SYS_INDEXES record. Copy the table_id */
1302
1309
memcpy(table_id, (const char*)field, 8);
1303
1310
} else if (memcmp(field, table_id, 8)) {
1389
1396
dfield_t* dfield;
1390
1397
const rec_t* rec;
1394
1400
ulint error = DB_SUCCESS;
1396
1402
ut_ad(mutex_own(&(dict_sys->mutex)));
1398
if ((ut_dulint_get_high(table->id) == 0)
1399
&& (ut_dulint_get_low(table->id) < DICT_HDR_FIRST_ID)) {
1400
is_sys_table = TRUE;
1402
is_sys_table = FALSE;
1405
1404
mtr_start(&mtr);
1407
1406
sys_indexes = dict_table_get_low("SYS_INDEXES");
1487
1486
" is not clustered!\n", stderr);
1489
1488
goto corrupted;
1490
} else if (is_sys_table
1489
} else if (table->id < DICT_HDR_FIRST_ID
1491
1490
&& (dict_index_is_clust(index)
1492
1491
|| ((table == dict_sys->sys_tables)
1493
1492
&& !strcmp("ID_IND", index->name)))) {