获取数据字典信息,其中有cluster index的space id(表空间)和page no(页、块)位置。
/** Error message for a delete-marked record in dict_load_index_low() */
static const char* dict_load_index_del = "delete-marked record in SYS_INDEXES";
/** Error message for table->id mismatch in dict_load_index_low() */
static const char* dict_load_index_id_err = "SYS_INDEXES.TABLE_ID mismatch";
/********************************************************************//**
Loads an index definition from a SYS_INDEXES record to dict_index_t.
If allocate=TRUE, we will create a dict_index_t structure and fill it
accordingly. If allocated=FALSE, the dict_index_t will be supplied by
the caller and filled with information read from the record. @return
error message, or NULL on success */
UNIV_INTERN
const char*
dict_load_index_low(
/*================*/
byte* table_id, /*!< in/out: table id (8 bytes),
an "in" value if allocate=TRUE
and "out" when allocate=FALSE */
const char* table_name, /*!< in: table name */
mem_heap_t* heap, /*!< in/out: temporary memory heap */
const rec_t* rec, /*!< in: SYS_INDEXES record */
ibool allocate, /*!< in: TRUE=allocate *index,
FALSE=fill in a pre-allocated
*index */
dict_index_t** index) /*!< out,own: index, or NULL */
{
const byte* field;
ulint len;
ulint name_len;
char* name_buf;
index_id_t id;
ulint n_fields;
ulint type;
ulint space;
if (allocate) {
/* If allocate=TRUE, no dict_index_t will
be supplied. Initialize "*index" to NULL */
*index = NULL;
}
if (UNIV_UNLIKELY(rec_get_deleted_flag(rec, 0))) {
return(dict_load_index_del);
}
if (UNIV_UNLIKELY(rec_get_n_fields_old(rec) != 9)) {
return("wrong number of columns in SYS_INDEXES record");
}
field = rec_get_nth_field_old(rec, 0/*TABLE_ID*/, &len);
if (UNIV_UNLIKELY(len != 8)) {
err_len:
return("incorrect column length in SYS_INDEXES");
}
if (!allocate) {
/* We are reading a SYS_INDEXES record. Copy the table_id */
memcpy(table_id, (const char*)field, 8);
} else if (memcmp(field, table_id, 8)) {
/* Caller supplied table_id, verify it is the same
id as on the index record */
return(dict_load_index_id_err);
}
field = rec_get_nth_field_old(rec, 1/*ID*/, &len);
if (UNIV_UNLIKELY(len != 8)) {
goto err_len;
}
id = mach_read_from_8(field);
rec_get_nth_field_offs_old(rec, 2/*DB_TRX_ID*/, &len);
if (UNIV_UNLIKELY(len != DATA_TRX_ID_LEN && len != UNIV_SQL_NULL)) {
goto err_len;
}
rec_get_nth_field_offs_old(rec, 3/*DB_ROLL_PTR*/, &len);
if (UNIV_UNLIKELY(len != DATA_ROLL_PTR_LEN && len != UNIV_SQL_NULL)) {
goto err_len;
}
field = rec_get_nth_field_old(rec, 4/*NAME*/, &name_len);
if (UNIV_UNLIKELY(name_len == UNIV_SQL_NULL)) {
goto err_len;
}
name_buf = mem_heap_strdupl(heap, (const char*) field,
name_len);
field = rec_get_nth_field_old(rec, 5/*N_FIELDS*/, &len);
if (UNIV_UNLIKELY(len != 4)) {
goto err_len;
}
n_fields = mach_read_from_4(field);
field = rec_get_nth_field_old(rec, 6/*TYPE*/, &len);
if (UNIV_UNLIKELY(len != 4)) {
goto err_len;
}
type = mach_read_from_4(field);
if (UNIV_UNLIKELY(type & (~0 << DICT_IT_BITS))) {
return("unknown SYS_INDEXES.TYPE bits");
}
field = rec_get_nth_field_old(rec, 7/*SPACE*/, &len);
if (UNIV_UNLIKELY(len != 4)) {
goto err_len;
}
space = mach_read_from_4(field);
field = rec_get_nth_field_old(rec, 8/*PAGE_NO*/, &len);
if (UNIV_UNLIKELY(len != 4)) {
goto err_len;
}
if (allocate) {
*index = dict_mem_index_create(table_name, name_buf,
space, type, n_fields);
} else {
ut_a(*index);
dict_mem_fill_index_struct(*index, NULL, NULL, name_buf,
space, type, n_fields);
}
(*index)->id = id;
(*index)->page = mach_read_from_4(field);
ut_ad((*index)->page);
return(NULL);
}
> mysqld.exe!dict_load_index_low(unsigned char * table_id=0x1fb0f198, const char * table_name=0x1fae0390, mem_block_info_struct * heap=0x1fb0f128, const unsigned char * rec=0x17664330, unsigned long allocate=1, dict_index_struct * * index=0x2284b898) Line 1359 C
mysqld.exe!dict_load_indexes(dict_table_struct * table=0x1fb16ee8, mem_block_info_struct * heap=0x1fb0f128, dict_err_ignore ignore_err=DICT_ERR_IGNORE_NONE) Line 1422 + 0x27 bytes C
mysqld.exe!dict_load_table(const char * name=0x2284c63c, unsigned long cached=1, dict_err_ignore ignore_err=DICT_ERR_IGNORE_NONE) Line 1858 + 0x14 bytes C
mysqld.exe!dict_table_get_low(const char * table_name=0x2284c63c) Line 876 + 0xd bytes C
mysqld.exe!dict_table_get(const char * table_name=0x2284c63c, unsigned long inc_mysql_count=1) Line 744 + 0x9 bytes C
mysqld.exe!ha_innobase::open(const char * name=0x1faff6c8, int mode=2, unsigned int test_if_locked=2) Line 3868 + 0xe bytes C++
mysqld.exe!handler::ha_open(TABLE * table_arg=0x1fb0cc48, const char * name=0x1faff6c8, int mode=2, int test_if_locked=2) Line 2238 + 0x1e bytes C++
mysqld.exe!open_table_from_share(THD * thd=0x1fa85ce8, TABLE_SHARE * share=0x1faff4a0, const char * alias=0x1fb07ea8, unsigned int db_stat=39, unsigned int prgflag=44, unsigned int ha_open_flags=0, TABLE * outparam=0x1fb0cc48, bool is_create_table=false) Line 2073 + 0x8f bytes C++
mysqld.exe!open_table(THD * thd=0x1fa85ce8, TABLE_LIST * table_list=0x1fb07eb0, st_mem_root * mem_root=0x2284d2a8, Open_table_context * ot_ctx=0x2284d2d4) Line 3098 + 0x2b bytes C++
mysqld.exe!open_and_process_table(THD * thd=0x1fa85ce8, LEX * lex=0x1fa86c88, TABLE_LIST * tables=0x1fb07eb0, unsigned int * counter=0x2284d5b8, unsigned int flags=1024, Prelocking_strategy * prelocking_strategy=0x2284d324, bool has_prelocking_list=false, Open_table_context * ot_ctx=0x2284d2d4, st_mem_root * new_frm_mem=0x2284d2a8) Line 4460 + 0x15 bytes C++
mysqld.exe!open_tables(THD * thd=0x1fa85ce8, TABLE_LIST * * start=0x2284de38, unsigned int * counter=0x2284d5b8, unsigned int flags=1024, Prelocking_strategy * prelocking_strategy=0x2284d324) Line 4908 + 0x2d bytes C++
mysqld.exe!open_tables(THD * thd=0x1fa85ce8, TABLE_LIST * * tables=0x2284de38, unsigned int * counter=0x2284d5b8, unsigned int flags=1024) Line 454 + 0x19 bytes C++
mysqld.exe!mysqld_show_create(THD * thd=0x1fa85ce8, TABLE_LIST * table_list=0x1fb07eb0) Line 694 + 0x19 bytes C++
mysqld.exe!mysql_execute_command(THD * thd=0x1fa85ce8) Line 2749 + 0xd bytes C++
mysqld.exe!mysql_parse(THD * thd=0x1fa85ce8, char * rawbuf=0x1fb07de0, unsigned int length=25, Parser_state * parser_state=0x2284f8e8) Line 5627 + 0x9 bytes C++
mysqld.exe!dispatch_command(enum_server_command command=COM_QUERY, THD * thd=0x1fa85ce8, char * packet=0x1faffaf1, unsigned int packet_length=25) Line 1037 + 0x22 bytes C++
mysqld.exe!do_command(THD * thd=0x1fa85ce8) Line 773 + 0x1b bytes C++
mysqld.exe!do_handle_one_connection(THD * thd_arg=0x1fa85ce8) Line 840 + 0x9 bytes C++
mysqld.exe!handle_one_connection(void * arg=0x1fa85ce8) Line 759 + 0x9 bytes C++
mysqld.exe!pfs_spawn_thread(void * arg=0x1faf4080) Line 1015 + 0x9 bytes C++
mysqld.exe!pthread_start(void * p=0x1fad95e0) Line 61 + 0x9 bytes C
mysqld.exe!_callthreadstartex() Line 348 + 0xf bytes C
mysqld.exe!_threadstartex(void * ptd=0x1fb03b38) Line 331 C
kernel32.dll!760833aa()
[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]
ntdll.dll!772f9ef2()
ntdll.dll!772f9ec5()
