Loading innobase/btr/btr0sea.c +39 −5 Original line number Diff line number Diff line Loading @@ -191,7 +191,7 @@ static void btr_search_info_update_hash( /*========================*/ btr_search_t* info, /* in: search info */ btr_search_t* info, /* in/out: search info */ btr_cur_t* cursor) /* in: cursor which was just positioned */ { dict_index_t* index; Loading Loading @@ -452,7 +452,7 @@ Updates the search info. */ void btr_search_info_update_slow( /*========================*/ btr_search_t* info, /* in: search info */ btr_search_t* info, /* in/out: search info */ btr_cur_t* cursor) /* in: cursor which was just positioned */ { buf_block_t* block; Loading Loading @@ -912,12 +912,12 @@ btr_search_drop_page_hash_index( ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED)); ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX)); #endif /* UNIV_SYNC_DEBUG */ retry: rw_lock_s_lock(&btr_search_latch); block = buf_block_align(page); if (!block->is_hashed) { if (UNIV_LIKELY(!block->is_hashed)) { rw_lock_s_unlock(&btr_search_latch); Loading Loading @@ -958,6 +958,8 @@ btr_search_drop_page_hash_index( tree_id = btr_page_get_index_id(page); ut_a(0 == ut_dulint_cmp(tree_id, index->id)); prev_fold = 0; heap = NULL; Loading Loading @@ -992,6 +994,26 @@ btr_search_drop_page_hash_index( rw_lock_x_lock(&btr_search_latch); if (UNIV_UNLIKELY(!block->is_hashed)) { /* Someone else has meanwhile dropped the hash index */ goto cleanup; } ut_a(block->index == index); if (UNIV_UNLIKELY(block->curr_n_fields != n_fields) || UNIV_UNLIKELY(block->curr_n_bytes != n_bytes)) { /* Someone else has meanwhile built a new hash index on the page, with different parameters */ rw_lock_x_unlock(&btr_search_latch); mem_free(folds); goto retry; } for (i = 0; i < n_cached; i++) { ha_remove_all_nodes_to_page(table, folds[i], page); Loading @@ -999,8 +1021,20 @@ btr_search_drop_page_hash_index( block->is_hashed = FALSE; block->index = NULL; cleanup: if (UNIV_UNLIKELY(block->n_pointers)) { /* Corruption */ ut_print_timestamp(stderr); fprintf(stderr, " InnoDB: Corruption of adaptive hash index. After dropping\n" "InnoDB: the hash index to a page of %s, still %lu hash nodes remain.\n", index->name, (ulong) block->n_pointers); rw_lock_x_unlock(&btr_search_latch); btr_search_validate(); } else { rw_lock_x_unlock(&btr_search_latch); } mem_free(folds); } Loading innobase/dict/dict0dict.c +2 −1 Original line number Diff line number Diff line Loading @@ -2803,7 +2803,8 @@ dict_table_get_highest_foreign_id( if (ut_strlen(foreign->id) > ((sizeof dict_ibfk) - 1) + len && 0 == ut_memcmp(foreign->id, table->name, len) && 0 == ut_memcmp(foreign->id + len, dict_ibfk, (sizeof dict_ibfk) - 1)) { dict_ibfk, (sizeof dict_ibfk) - 1) && foreign->id[len + ((sizeof dict_ibfk) - 1)] != '0') { /* It is of the >= 4.0.18 format */ id = strtoul(foreign->id + len + ((sizeof dict_ibfk) - 1), Loading innobase/dict/dict0load.c +15 −5 Original line number Diff line number Diff line Loading @@ -385,14 +385,24 @@ dict_load_columns( field = rec_get_nth_field_old(rec, 6, &len); prtype = mach_read_from_4(field); if (dtype_is_non_binary_string_type(mtype, prtype) && dtype_get_charset_coll(prtype) == 0) { /* This is a non-binary string type, and the table was created with < 4.1.2. Use the default charset. */ if (dtype_get_charset_coll(prtype) == 0 && dtype_is_string_type(mtype)) { /* The table was created with < 4.1.2. */ if (dtype_is_binary_string_type(mtype, prtype)) { /* Use the binary collation for string columns of binary type. */ prtype = dtype_form_prtype(prtype, DATA_MYSQL_BINARY_CHARSET_COLL); } else { /* Use the default charset for other than binary columns. */ prtype = dtype_form_prtype(prtype, data_mysql_default_charset_coll); } } field = rec_get_nth_field_old(rec, 7, &len); col_len = mach_read_from_4(field); Loading innobase/fil/fil0fil.c +81 −2 Original line number Diff line number Diff line Loading @@ -181,6 +181,11 @@ struct fil_space_struct { hash_node_t name_hash;/* hash chain the name_hash table */ rw_lock_t latch; /* latch protecting the file space storage allocation */ UT_LIST_NODE_T(fil_space_t) unflushed_spaces; /* list of spaces with at least one unflushed file we have written to */ ibool is_in_unflushed_spaces; /* TRUE if this space is currently in the list above */ UT_LIST_NODE_T(fil_space_t) space_list; /* list of all spaces */ ibuf_data_t* ibuf_data; Loading Loading @@ -213,6 +218,12 @@ struct fil_system_struct { not put to this list: they are opened after the startup, and kept open until shutdown */ UT_LIST_BASE_NODE_T(fil_space_t) unflushed_spaces; /* base node for the list of those tablespaces whose files contain unflushed writes; those spaces have at least one file node where modification_counter > flush_counter */ ulint n_open; /* number of files currently open */ ulint max_n_open; /* n_open is not allowed to exceed this */ Loading Loading @@ -389,6 +400,36 @@ fil_space_get_ibuf_data( return(space->ibuf_data); } /************************************************************************** Checks if all the file nodes in a space are flushed. The caller must hold the fil_system mutex. */ static ibool fil_space_is_flushed( /*=================*/ /* out: TRUE if all are flushed */ fil_space_t* space) /* in: space */ { fil_node_t* node; #ifdef UNIV_SYNC_DEBUG ut_ad(mutex_own(&(fil_system->mutex))); #endif /* UNIV_SYNC_DEBUG */ node = UT_LIST_GET_FIRST(space->chain); while (node) { if (node->modification_counter > node->flush_counter) { return(FALSE); } node = UT_LIST_GET_NEXT(chain, node); } return(TRUE); } /*********************************************************************** Appends a new file to the chain of files of a space. File must be closed. */ Loading Loading @@ -841,6 +882,16 @@ fil_node_free( node->modification_counter = node->flush_counter; if (space->is_in_unflushed_spaces && fil_space_is_flushed(space)) { space->is_in_unflushed_spaces = FALSE; UT_LIST_REMOVE(unflushed_spaces, system->unflushed_spaces, space); } fil_node_close_file(node, system); } Loading Loading @@ -1004,6 +1055,8 @@ fil_space_create( HASH_INSERT(fil_space_t, name_hash, system->name_hash, ut_fold_string(name), space); space->is_in_unflushed_spaces = FALSE; UT_LIST_ADD_LAST(space_list, system->space_list, space); mutex_exit(&(system->mutex)); Loading Loading @@ -1099,6 +1152,13 @@ fil_space_free( HASH_DELETE(fil_space_t, name_hash, system->name_hash, ut_fold_string(space->name), space); if (space->is_in_unflushed_spaces) { space->is_in_unflushed_spaces = FALSE; UT_LIST_REMOVE(unflushed_spaces, system->unflushed_spaces, space); } UT_LIST_REMOVE(space_list, system->space_list, space); ut_a(space->magic_n == FIL_SPACE_MAGIC_N); Loading Loading @@ -1250,6 +1310,7 @@ fil_system_create( system->tablespace_version = 0; UT_LIST_INIT(system->unflushed_spaces); UT_LIST_INIT(system->space_list); return(system); Loading Loading @@ -3742,6 +3803,14 @@ fil_node_complete_io( if (type == OS_FILE_WRITE) { system->modification_counter++; node->modification_counter = system->modification_counter; if (!node->space->is_in_unflushed_spaces) { node->space->is_in_unflushed_spaces = TRUE; UT_LIST_ADD_FIRST(unflushed_spaces, system->unflushed_spaces, node->space); } } if (node->n_pending == 0 && node->space->purpose == FIL_TABLESPACE Loading Loading @@ -4162,6 +4231,16 @@ fil_flush( skip_flush: if (node->flush_counter < old_mod_counter) { node->flush_counter = old_mod_counter; if (space->is_in_unflushed_spaces && fil_space_is_flushed(space)) { space->is_in_unflushed_spaces = FALSE; UT_LIST_REMOVE(unflushed_spaces, system->unflushed_spaces, space); } } if (space->purpose == FIL_TABLESPACE) { Loading Loading @@ -4193,7 +4272,7 @@ fil_flush_file_spaces( mutex_enter(&(system->mutex)); space = UT_LIST_GET_FIRST(system->space_list); space = UT_LIST_GET_FIRST(system->unflushed_spaces); while (space) { if (space->purpose == purpose && !space->is_being_deleted) { Loading @@ -4209,7 +4288,7 @@ fil_flush_file_spaces( space->n_pending_flushes--; } space = UT_LIST_GET_NEXT(space_list, space); space = UT_LIST_GET_NEXT(unflushed_spaces, space); } mutex_exit(&(system->mutex)); Loading innobase/include/univ.i +0 −6 Original line number Diff line number Diff line Loading @@ -126,14 +126,8 @@ by one. */ #ifdef __WIN__ #define UNIV_INLINE __inline #else /* config.h contains the right def for 'inline' for the current compiler */ #if (__GNUC__ == 2) #define UNIV_INLINE extern inline #else /* extern inline doesn't work with gcc 3.0.2 */ #define UNIV_INLINE static inline #endif #endif #else /* If we want to compile a noninlined version we use the following macro Loading Loading
innobase/btr/btr0sea.c +39 −5 Original line number Diff line number Diff line Loading @@ -191,7 +191,7 @@ static void btr_search_info_update_hash( /*========================*/ btr_search_t* info, /* in: search info */ btr_search_t* info, /* in/out: search info */ btr_cur_t* cursor) /* in: cursor which was just positioned */ { dict_index_t* index; Loading Loading @@ -452,7 +452,7 @@ Updates the search info. */ void btr_search_info_update_slow( /*========================*/ btr_search_t* info, /* in: search info */ btr_search_t* info, /* in/out: search info */ btr_cur_t* cursor) /* in: cursor which was just positioned */ { buf_block_t* block; Loading Loading @@ -912,12 +912,12 @@ btr_search_drop_page_hash_index( ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED)); ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX)); #endif /* UNIV_SYNC_DEBUG */ retry: rw_lock_s_lock(&btr_search_latch); block = buf_block_align(page); if (!block->is_hashed) { if (UNIV_LIKELY(!block->is_hashed)) { rw_lock_s_unlock(&btr_search_latch); Loading Loading @@ -958,6 +958,8 @@ btr_search_drop_page_hash_index( tree_id = btr_page_get_index_id(page); ut_a(0 == ut_dulint_cmp(tree_id, index->id)); prev_fold = 0; heap = NULL; Loading Loading @@ -992,6 +994,26 @@ btr_search_drop_page_hash_index( rw_lock_x_lock(&btr_search_latch); if (UNIV_UNLIKELY(!block->is_hashed)) { /* Someone else has meanwhile dropped the hash index */ goto cleanup; } ut_a(block->index == index); if (UNIV_UNLIKELY(block->curr_n_fields != n_fields) || UNIV_UNLIKELY(block->curr_n_bytes != n_bytes)) { /* Someone else has meanwhile built a new hash index on the page, with different parameters */ rw_lock_x_unlock(&btr_search_latch); mem_free(folds); goto retry; } for (i = 0; i < n_cached; i++) { ha_remove_all_nodes_to_page(table, folds[i], page); Loading @@ -999,8 +1021,20 @@ btr_search_drop_page_hash_index( block->is_hashed = FALSE; block->index = NULL; cleanup: if (UNIV_UNLIKELY(block->n_pointers)) { /* Corruption */ ut_print_timestamp(stderr); fprintf(stderr, " InnoDB: Corruption of adaptive hash index. After dropping\n" "InnoDB: the hash index to a page of %s, still %lu hash nodes remain.\n", index->name, (ulong) block->n_pointers); rw_lock_x_unlock(&btr_search_latch); btr_search_validate(); } else { rw_lock_x_unlock(&btr_search_latch); } mem_free(folds); } Loading
innobase/dict/dict0dict.c +2 −1 Original line number Diff line number Diff line Loading @@ -2803,7 +2803,8 @@ dict_table_get_highest_foreign_id( if (ut_strlen(foreign->id) > ((sizeof dict_ibfk) - 1) + len && 0 == ut_memcmp(foreign->id, table->name, len) && 0 == ut_memcmp(foreign->id + len, dict_ibfk, (sizeof dict_ibfk) - 1)) { dict_ibfk, (sizeof dict_ibfk) - 1) && foreign->id[len + ((sizeof dict_ibfk) - 1)] != '0') { /* It is of the >= 4.0.18 format */ id = strtoul(foreign->id + len + ((sizeof dict_ibfk) - 1), Loading
innobase/dict/dict0load.c +15 −5 Original line number Diff line number Diff line Loading @@ -385,14 +385,24 @@ dict_load_columns( field = rec_get_nth_field_old(rec, 6, &len); prtype = mach_read_from_4(field); if (dtype_is_non_binary_string_type(mtype, prtype) && dtype_get_charset_coll(prtype) == 0) { /* This is a non-binary string type, and the table was created with < 4.1.2. Use the default charset. */ if (dtype_get_charset_coll(prtype) == 0 && dtype_is_string_type(mtype)) { /* The table was created with < 4.1.2. */ if (dtype_is_binary_string_type(mtype, prtype)) { /* Use the binary collation for string columns of binary type. */ prtype = dtype_form_prtype(prtype, DATA_MYSQL_BINARY_CHARSET_COLL); } else { /* Use the default charset for other than binary columns. */ prtype = dtype_form_prtype(prtype, data_mysql_default_charset_coll); } } field = rec_get_nth_field_old(rec, 7, &len); col_len = mach_read_from_4(field); Loading
innobase/fil/fil0fil.c +81 −2 Original line number Diff line number Diff line Loading @@ -181,6 +181,11 @@ struct fil_space_struct { hash_node_t name_hash;/* hash chain the name_hash table */ rw_lock_t latch; /* latch protecting the file space storage allocation */ UT_LIST_NODE_T(fil_space_t) unflushed_spaces; /* list of spaces with at least one unflushed file we have written to */ ibool is_in_unflushed_spaces; /* TRUE if this space is currently in the list above */ UT_LIST_NODE_T(fil_space_t) space_list; /* list of all spaces */ ibuf_data_t* ibuf_data; Loading Loading @@ -213,6 +218,12 @@ struct fil_system_struct { not put to this list: they are opened after the startup, and kept open until shutdown */ UT_LIST_BASE_NODE_T(fil_space_t) unflushed_spaces; /* base node for the list of those tablespaces whose files contain unflushed writes; those spaces have at least one file node where modification_counter > flush_counter */ ulint n_open; /* number of files currently open */ ulint max_n_open; /* n_open is not allowed to exceed this */ Loading Loading @@ -389,6 +400,36 @@ fil_space_get_ibuf_data( return(space->ibuf_data); } /************************************************************************** Checks if all the file nodes in a space are flushed. The caller must hold the fil_system mutex. */ static ibool fil_space_is_flushed( /*=================*/ /* out: TRUE if all are flushed */ fil_space_t* space) /* in: space */ { fil_node_t* node; #ifdef UNIV_SYNC_DEBUG ut_ad(mutex_own(&(fil_system->mutex))); #endif /* UNIV_SYNC_DEBUG */ node = UT_LIST_GET_FIRST(space->chain); while (node) { if (node->modification_counter > node->flush_counter) { return(FALSE); } node = UT_LIST_GET_NEXT(chain, node); } return(TRUE); } /*********************************************************************** Appends a new file to the chain of files of a space. File must be closed. */ Loading Loading @@ -841,6 +882,16 @@ fil_node_free( node->modification_counter = node->flush_counter; if (space->is_in_unflushed_spaces && fil_space_is_flushed(space)) { space->is_in_unflushed_spaces = FALSE; UT_LIST_REMOVE(unflushed_spaces, system->unflushed_spaces, space); } fil_node_close_file(node, system); } Loading Loading @@ -1004,6 +1055,8 @@ fil_space_create( HASH_INSERT(fil_space_t, name_hash, system->name_hash, ut_fold_string(name), space); space->is_in_unflushed_spaces = FALSE; UT_LIST_ADD_LAST(space_list, system->space_list, space); mutex_exit(&(system->mutex)); Loading Loading @@ -1099,6 +1152,13 @@ fil_space_free( HASH_DELETE(fil_space_t, name_hash, system->name_hash, ut_fold_string(space->name), space); if (space->is_in_unflushed_spaces) { space->is_in_unflushed_spaces = FALSE; UT_LIST_REMOVE(unflushed_spaces, system->unflushed_spaces, space); } UT_LIST_REMOVE(space_list, system->space_list, space); ut_a(space->magic_n == FIL_SPACE_MAGIC_N); Loading Loading @@ -1250,6 +1310,7 @@ fil_system_create( system->tablespace_version = 0; UT_LIST_INIT(system->unflushed_spaces); UT_LIST_INIT(system->space_list); return(system); Loading Loading @@ -3742,6 +3803,14 @@ fil_node_complete_io( if (type == OS_FILE_WRITE) { system->modification_counter++; node->modification_counter = system->modification_counter; if (!node->space->is_in_unflushed_spaces) { node->space->is_in_unflushed_spaces = TRUE; UT_LIST_ADD_FIRST(unflushed_spaces, system->unflushed_spaces, node->space); } } if (node->n_pending == 0 && node->space->purpose == FIL_TABLESPACE Loading Loading @@ -4162,6 +4231,16 @@ fil_flush( skip_flush: if (node->flush_counter < old_mod_counter) { node->flush_counter = old_mod_counter; if (space->is_in_unflushed_spaces && fil_space_is_flushed(space)) { space->is_in_unflushed_spaces = FALSE; UT_LIST_REMOVE(unflushed_spaces, system->unflushed_spaces, space); } } if (space->purpose == FIL_TABLESPACE) { Loading Loading @@ -4193,7 +4272,7 @@ fil_flush_file_spaces( mutex_enter(&(system->mutex)); space = UT_LIST_GET_FIRST(system->space_list); space = UT_LIST_GET_FIRST(system->unflushed_spaces); while (space) { if (space->purpose == purpose && !space->is_being_deleted) { Loading @@ -4209,7 +4288,7 @@ fil_flush_file_spaces( space->n_pending_flushes--; } space = UT_LIST_GET_NEXT(space_list, space); space = UT_LIST_GET_NEXT(unflushed_spaces, space); } mutex_exit(&(system->mutex)); Loading
innobase/include/univ.i +0 −6 Original line number Diff line number Diff line Loading @@ -126,14 +126,8 @@ by one. */ #ifdef __WIN__ #define UNIV_INLINE __inline #else /* config.h contains the right def for 'inline' for the current compiler */ #if (__GNUC__ == 2) #define UNIV_INLINE extern inline #else /* extern inline doesn't work with gcc 3.0.2 */ #define UNIV_INLINE static inline #endif #endif #else /* If we want to compile a noninlined version we use the following macro Loading