mysql open table创建table内存对象

390阅读 0评论2013-03-21 gladness
分类:Mysql/postgreSQL

/* Precise data types for system columns and the length of those columns;

NOTE: the values must run from 0 up in the order given! All codes must

be less than 256 */

#define  DATA_ROW_ID   0    /* row id: a 48-bit integer */

#define DATA_ROW_ID_LEN 6    /* stored length for row id */

 

#define DATA_TRX_ID    1    /* transaction id: 6 bytes */

#define DATA_TRX_ID_LEN 6

 

#define  DATA_ROLL_PTR 2    /* rollback data pointer: 7 bytes */

#define DATA_ROLL_PTR_LEN 7

 

#define  DATA_N_SYS_COLS 3  /* number of system columns defined above */

 




/**********************************************************************//**

Creates a table memory object.

@return  own: table object */

UNIV_INTERN

dict_table_t*

dict_mem_table_create(

/*==================*/

     const char*   name,    /*!< in: table name */

     ulint         space,   /*!< in: space where the clustered index of

                   the table is placed; this parameter is

                   ignored if the table is made a member of

                   a cluster */

     ulint         n_cols,  /*!< in: number of columns */

     ulint         flags)   /*!< in: table flags */

{

     dict_table_t* table;

     mem_heap_t*   heap;

 

     ut_ad(name);

     ut_a(!(flags & (~0 << DICT_TF2_BITS)));

 

     heap = mem_heap_create(DICT_HEAP_SIZE);

 

     table = mem_heap_zalloc(heap, sizeof(dict_table_t));

 

     table->heap = heap;

 

     table->flags = (unsigned int) flags;

     table->name = ut_malloc(strlen(name) + 1);

     memcpy(table->name, name, strlen(name) + 1);

     table->space = (unsigned int) space;

     table->n_cols = (unsigned int) (n_cols + DATA_N_SYS_COLS);

 

     table->cols = mem_heap_alloc(heap, (n_cols + DATA_N_SYS_COLS)

                        * sizeof(dict_col_t));

 

#ifndef UNIV_HOTBACKUP

     table->autoinc_lock = mem_heap_alloc(heap, lock_get_size());

 

     mutex_create(autoinc_mutex_key,

              &table->autoinc_mutex, SYNC_DICT_AUTOINC_MUTEX);

 

     table->autoinc = 0;

 

     /* The number of transactions that are either waiting on the

     AUTOINC lock or have been granted the lock. */

     table->n_waiting_or_granted_auto_inc_locks = 0;

#endif /* !UNIV_HOTBACKUP */

 

     ut_d(table->magic_n = DICT_TABLE_MAGIC_N);

     return(table);

}

 
> mysqld.exe!dict_mem_table_create(const char * name=0x21d7cf88, unsigned long space=1, unsigned long n_cols=2, unsigned long flags=1)  行77 C
  mysqld.exe!dict_load_table_low(const char * name=0x21d7cf88, const unsigned char * rec=0x16d5c16a, dict_table_struct * * table=0x21d7cc64)  行1713 + 0x1a 字节 C
  mysqld.exe!dict_load_table(const char * name=0x21d7cf88, unsigned long cached=1, dict_err_ignore ignore_err=DICT_ERR_IGNORE_NONE)  行1803 + 0x14 字节 C
  mysqld.exe!dict_table_get_low(const char * table_name=0x21d7cf88)  行876 + 0xd 字节 C
  mysqld.exe!dict_table_get(const char * table_name=0x21d7cf88, unsigned long inc_mysql_count=1)  行744 + 0x9 字节 C
  mysqld.exe!ha_innobase::open(const char * name=0x1efda100, int mode=2, unsigned int test_if_locked=2)  行3868 + 0xe 字节 C++
  mysqld.exe!handler::ha_open(TABLE * table_arg=0x1efe7680, const char * name=0x1efda100, int mode=2, int test_if_locked=2)  行2238 + 0x1e 字节 C++
  mysqld.exe!open_table_from_share(THD * thd=0x1ef7e228, TABLE_SHARE * share=0x1efd9ed8, const char * alias=0x1efe2958, unsigned int db_stat=39, unsigned int prgflag=44, unsigned int ha_open_flags=0, TABLE * outparam=0x1efe7680, bool is_create_table=false)  行2073 + 0x8f 字节 C++
  mysqld.exe!open_table(THD * thd=0x1ef7e228, TABLE_LIST * table_list=0x1efe2960, st_mem_root * mem_root=0x21d7dbf4, Open_table_context * ot_ctx=0x21d7dc20)  行3098 + 0x2b 字节 C++
  mysqld.exe!open_and_process_table(THD * thd=0x1ef7e228, LEX * lex=0x1ef7f1c8, TABLE_LIST * tables=0x1efe2960, unsigned int * counter=0x21d7dc9c, unsigned int flags=0, Prelocking_strategy * prelocking_strategy=0x21d7dcc8, bool has_prelocking_list=false, Open_table_context * ot_ctx=0x21d7dc20, st_mem_root * new_frm_mem=0x21d7dbf4)  行4460 + 0x15 字节 C++
  mysqld.exe!open_tables(THD * thd=0x1ef7e228, TABLE_LIST * * start=0x21d7dcb0, unsigned int * counter=0x21d7dc9c, unsigned int flags=0, Prelocking_strategy * prelocking_strategy=0x21d7dcc8)  行4908 + 0x2d 字节 C++
  mysqld.exe!open_and_lock_tables(THD * thd=0x1ef7e228, TABLE_LIST * tables=0x1efe2960, bool derived=true, unsigned int flags=0, Prelocking_strategy * prelocking_strategy=0x21d7dcc8)  行5512 + 0x19 字节 C++
  mysqld.exe!open_and_lock_tables(THD * thd=0x1ef7e228, TABLE_LIST * tables=0x1efe2960, bool derived=true, unsigned int flags=0)  行475 + 0x1a 字节 C++
  mysqld.exe!execute_sqlcom_select(THD * thd=0x1ef7e228, TABLE_LIST * all_tables=0x1efe2960)  行4547 + 0x11 字节 C++
  mysqld.exe!mysql_execute_command(THD * thd=0x1ef7e228)  行2151 + 0xd 字节 C++
  mysqld.exe!mysql_parse(THD * thd=0x1ef7e228, char * rawbuf=0x1efe2818, unsigned int length=16, Parser_state * parser_state=0x21d7fc14)  行5627 + 0x9 字节 C++
  mysqld.exe!dispatch_command(enum_server_command command=COM_QUERY, THD * thd=0x1ef7e228, char * packet=0x1efda529, unsigned int packet_length=16)  行1037 + 0x22 字节 C++
  mysqld.exe!do_command(THD * thd=0x1ef7e228)  行773 + 0x1b 字节 C++
  mysqld.exe!do_handle_one_connection(THD * thd_arg=0x1ef7e228)  行840 + 0x9 字节 C++
  mysqld.exe!handle_one_connection(void * arg=0x1ef7e228)  行759 + 0x9 字节 C++
  mysqld.exe!pfs_spawn_thread(void * arg=0x1efaf650)  行1015 + 0x9 字节 C++
  mysqld.exe!pthread_start(void * p=0x1efbe170)  行61 + 0x9 字节 C
  mysqld.exe!_callthreadstartex()  行348 + 0xf 字节 C
  mysqld.exe!_threadstartex(void * ptd=0x1efde570)  行331 C
  kernel32.dll!76daed6c()
  [下面的框架可能不正确和/或缺失,没有为 kernel32.dll 加载符号]
  ntdll.dll!7723377b()
  ntdll.dll!7723374e()



上一篇:mysql open table需要访问字典表,获取该表的space和page位置
下一篇:获取cluster index的space和page no的一个路径