Index: storage/innobase/dict/dict0mem.cc =================================================================== --- storage/innobase/dict/dict0mem.cc (revision 6741) +++ storage/innobase/dict/dict0mem.cc (working copy) @@ -58,14 +58,17 @@ @return own: table object */ UNIV_INTERN dict_table_t* -dict_mem_table_create( +dict_mem_table_create_low( /*==================*/ const char* name, /*!< in: table name */ ulint space, /*!< in: space where the clustered index of the table is placed */ ulint n_cols, /*!< in: number of columns */ ulint flags, /*!< in: table flags */ - ulint flags2) /*!< in: table flags2 */ + ulint flags2, /*!< in: table flags2 */ + bool nonshared)/*!< in: whether the table object is a dummy + one that does not need the initialization of + locking-related fields. */ { dict_table_t* table; mem_heap_t* heap; @@ -100,11 +103,14 @@ dict_table_stats_latch_create(table, true); #ifndef UNIV_HOTBACKUP - table->autoinc_lock = static_cast( - mem_heap_alloc(heap, lock_get_size())); + if (!nonshared) { + table->autoinc_lock = static_cast( + mem_heap_alloc(heap, lock_get_size())); - mutex_create(autoinc_mutex_key, - &table->autoinc_mutex, SYNC_DICT_AUTOINC_MUTEX); + mutex_create(autoinc_mutex_key, + &table->autoinc_mutex, SYNC_DICT_AUTOINC_MUTEX); + } else + table->autoinc_lock = NULL; table->autoinc = 0; @@ -151,7 +157,8 @@ } } #ifndef UNIV_HOTBACKUP - mutex_free(&(table->autoinc_mutex)); + if (table->autoinc_lock) + mutex_free(&(table->autoinc_mutex)); #endif /* UNIV_HOTBACKUP */ dict_table_stats_latch_destroy(table); @@ -438,7 +445,7 @@ @return own: index object */ UNIV_INTERN dict_index_t* -dict_mem_index_create( +dict_mem_index_create_low( /*==================*/ const char* table_name, /*!< in: table name */ const char* index_name, /*!< in: index name */ @@ -447,7 +454,10 @@ the clustered type */ ulint type, /*!< in: DICT_UNIQUE, DICT_CLUSTERED, ... ORed */ - ulint n_fields) /*!< in: number of fields */ + ulint n_fields, /*!< in: number of fields */ + bool nonshared)/*!< in: whether the table object is a dummy + one that does not need the initialization of + locking-related fields. */ { dict_index_t* index; mem_heap_t* heap; @@ -462,7 +472,11 @@ dict_mem_fill_index_struct(index, heap, table_name, index_name, space, type, n_fields); - os_fast_mutex_init(zip_pad_mutex_key, &index->zip_pad.mutex); + if (!nonshared) { + os_fast_mutex_init(zip_pad_mutex_key, &index->zip_pad.mutex); + index->zip_pad.inited_mutex = true; + } else + index->zip_pad.inited_mutex = false; return(index); } @@ -596,7 +610,8 @@ } #endif /* UNIV_BLOB_DEBUG */ - os_fast_mutex_free(&index->zip_pad.mutex); + if (index->zip_pad.inited_mutex) + os_fast_mutex_free(&index->zip_pad.mutex); mem_heap_free(index->heap); } Index: storage/innobase/dict/dict0dict.cc =================================================================== --- storage/innobase/dict/dict0dict.cc (revision 6741) +++ storage/innobase/dict/dict0dict.cc (working copy) @@ -5759,24 +5759,24 @@ dict_table_t* table; /* create dummy table and index for REDUNDANT infimum and supremum */ - table = dict_mem_table_create("SYS_DUMMY1", DICT_HDR_SPACE, 1, 0, 0); + table = dict_mem_table_create_low("SYS_DUMMY1", DICT_HDR_SPACE, 1, 0, 0, true); dict_mem_table_add_col(table, NULL, NULL, DATA_CHAR, DATA_ENGLISH | DATA_NOT_NULL, 8); - dict_ind_redundant = dict_mem_index_create("SYS_DUMMY1", "SYS_DUMMY1", - DICT_HDR_SPACE, 0, 1); + dict_ind_redundant = dict_mem_index_create_low("SYS_DUMMY1", "SYS_DUMMY1", + DICT_HDR_SPACE, 0, 1, true); dict_index_add_col(dict_ind_redundant, table, dict_table_get_nth_col(table, 0), 0); dict_ind_redundant->table = table; /* create dummy table and index for COMPACT infimum and supremum */ - table = dict_mem_table_create("SYS_DUMMY2", + table = dict_mem_table_create_low("SYS_DUMMY2", DICT_HDR_SPACE, 1, - DICT_TF_COMPACT, 0); + DICT_TF_COMPACT, 0, true); dict_mem_table_add_col(table, NULL, NULL, DATA_CHAR, DATA_ENGLISH | DATA_NOT_NULL, 8); - dict_ind_compact = dict_mem_index_create("SYS_DUMMY2", "SYS_DUMMY2", - DICT_HDR_SPACE, 0, 1); + dict_ind_compact = dict_mem_index_create_low("SYS_DUMMY2", "SYS_DUMMY2", + DICT_HDR_SPACE, 0, 1, true); dict_index_add_col(dict_ind_compact, table, dict_table_get_nth_col(table, 0), 0); dict_ind_compact->table = table; Index: storage/innobase/mtr/mtr0log.cc =================================================================== --- storage/innobase/mtr/mtr0log.cc (revision 6741) +++ storage/innobase/mtr/mtr0log.cc (working copy) @@ -559,10 +559,10 @@ } else { n = n_uniq = 1; } - table = dict_mem_table_create("LOG_DUMMY", DICT_HDR_SPACE, n, - comp ? DICT_TF_COMPACT : 0, 0); - ind = dict_mem_index_create("LOG_DUMMY", "LOG_DUMMY", - DICT_HDR_SPACE, 0, n); + table = dict_mem_table_create_low("LOG_DUMMY", DICT_HDR_SPACE, n, + comp ? DICT_TF_COMPACT : 0, 0, true); + ind = dict_mem_index_create_low("LOG_DUMMY", "LOG_DUMMY", + DICT_HDR_SPACE, 0, n, true); ind->table = table; ind->n_uniq = (unsigned int) n_uniq; if (n_uniq != n) { Index: storage/innobase/include/dict0mem.h =================================================================== --- storage/innobase/include/dict0mem.h (revision 6741) +++ storage/innobase/include/dict0mem.h (working copy) @@ -241,19 +241,23 @@ before proceeds. */ #define FK_MAX_CASCADE_DEL 255 +#define dict_mem_table_create(A,B,C,D,E) dict_mem_table_create_low(A,B,C,D,E,0) /**********************************************************************//** Creates a table memory object. @return own: table object */ UNIV_INTERN dict_table_t* -dict_mem_table_create( +dict_mem_table_create_low( /*==================*/ const char* name, /*!< in: table name */ ulint space, /*!< in: space where the clustered index of the table is placed */ ulint n_cols, /*!< in: number of columns */ ulint flags, /*!< in: table flags */ - ulint flags2); /*!< in: table flags2 */ + ulint flags2, /*!< in: table flags2 */ + bool nonshared);/*!< in: whether the table object is a dummy + one that does not need the initialization of + locking-related fields. */ /****************************************************************//** Free a table memory object. */ UNIV_INTERN @@ -315,12 +319,14 @@ ulint type, /*!< in: DICT_UNIQUE, DICT_CLUSTERED, ... ORed */ ulint n_fields); /*!< in: number of fields */ + +#define dict_mem_index_create(A,B,C,D,E) dict_mem_index_create_low(A,B,C,D,E,0) /**********************************************************************//** Creates an index memory object. @return own: index object */ UNIV_INTERN dict_index_t* -dict_mem_index_create( +dict_mem_index_create_low( /*==================*/ const char* table_name, /*!< in: table name */ const char* index_name, /*!< in: index name */ @@ -329,7 +335,10 @@ the clustered type */ ulint type, /*!< in: DICT_UNIQUE, DICT_CLUSTERED, ... ORed */ - ulint n_fields); /*!< in: number of fields */ + ulint n_fields, /*!< in: number of fields */ + bool nonshared);/*!< in: whether the table object is a dummy + one that does not need the initialization of + locking-related fields. */ /**********************************************************************//** Adds a field definition to an index. NOTE: does not take a copy of the column name if the field is a column. The memory occupied @@ -529,6 +538,7 @@ failures. This estimate is based on a self-adapting heuristic. */ struct zip_pad_info_t { os_fast_mutex_t mutex; /*!< mutex protecting the info */ + bool inited_mutex; /*!< true if mutex is inited*/ ulint pad; /*!< number of bytes used as pad */ ulint success;/*!< successful compression ops during current round */ Index: storage/innobase/ibuf/ibuf0ibuf.cc =================================================================== --- storage/innobase/ibuf/ibuf0ibuf.cc (revision 6741) +++ storage/innobase/ibuf/ibuf0ibuf.cc (working copy) @@ -1529,12 +1529,12 @@ dict_table_t* table; dict_index_t* index; - table = dict_mem_table_create("IBUF_DUMMY", + table = dict_mem_table_create_low("IBUF_DUMMY", DICT_HDR_SPACE, n, - comp ? DICT_TF_COMPACT : 0, 0); + comp ? DICT_TF_COMPACT : 0, 0, true); - index = dict_mem_index_create("IBUF_DUMMY", "IBUF_DUMMY", - DICT_HDR_SPACE, 0, n); + index = dict_mem_index_create_low("IBUF_DUMMY", "IBUF_DUMMY", + DICT_HDR_SPACE, 0, n, true); index->table = table; Index: storage/innobase/page/page0zip.cc =================================================================== --- storage/innobase/page/page0zip.cc (revision 6741) +++ storage/innobase/page/page0zip.cc (working copy) @@ -1572,7 +1572,7 @@ { if (index) { dict_table_t* table = index->table; - os_fast_mutex_free(&index->zip_pad.mutex); + ut_a(index->zip_pad.inited_mutex == 0); mem_heap_free(index->heap); dict_mem_table_free(table); @@ -1622,10 +1622,10 @@ return(NULL); } - table = dict_mem_table_create("ZIP_DUMMY", DICT_HDR_SPACE, n, - DICT_TF_COMPACT, 0); - index = dict_mem_index_create("ZIP_DUMMY", "ZIP_DUMMY", - DICT_HDR_SPACE, 0, n); + table = dict_mem_table_create_low("ZIP_DUMMY", DICT_HDR_SPACE, n, + DICT_TF_COMPACT, 0, true); + index = dict_mem_index_create_low("ZIP_DUMMY", "ZIP_DUMMY", + DICT_HDR_SPACE, 0, n, true); index->table = table; index->n_uniq = n; /* avoid ut_ad(index->cached) in dict_index_get_n_unique_in_tree */