diff options
Diffstat (limited to 'storage/innobase/row/row0mysql.c')
-rw-r--r-- | storage/innobase/row/row0mysql.c | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c index d5ef12d0af2..d76af54b420 100644 --- a/storage/innobase/row/row0mysql.c +++ b/storage/innobase/row/row0mysql.c @@ -661,7 +661,14 @@ row_create_prebuilt( prebuilt->old_vers_heap = NULL; - prebuilt->last_value = 0; + prebuilt->autoinc_error = 0; + prebuilt->autoinc_offset = 0; + + /* Default to 1, we will set the actual value later in + ha_innobase::get_auto_increment(). */ + prebuilt->autoinc_increment = 1; + + prebuilt->autoinc_last_value = 0; return(prebuilt); } @@ -1963,6 +1970,7 @@ row_create_index_for_mysql( ulint err; ulint i, j; ulint len; + char* table_name; #ifdef UNIV_SYNC_DEBUG ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_EX)); @@ -1972,6 +1980,11 @@ row_create_index_for_mysql( trx->op_info = "creating index"; + /* Copy the table name because we may want to drop the + table later, after the index object is freed (inside + que_run_threads()) and thus index->table_name is not available. */ + table_name = mem_strdup(index->table_name); + trx_start_if_not_started(trx); /* Check that the same column does not appear twice in the index. @@ -2044,13 +2057,15 @@ error_handling: trx_general_rollback_for_mysql(trx, FALSE, NULL); - row_drop_table_for_mysql(index->table_name, trx, FALSE); + row_drop_table_for_mysql(table_name, trx, FALSE); trx->error_state = DB_SUCCESS; } trx->op_info = ""; + mem_free(table_name); + return((int) err); } @@ -2443,8 +2458,8 @@ row_discard_tablespace_for_mysql( new_id = dict_hdr_get_new_id(DICT_HDR_TABLE_ID); - /* Remove any locks there are on the table or its records */ - lock_reset_all_on_table(table); + /* Remove all locks except the table-level S and X locks. */ + lock_remove_all_on_table(table, FALSE); info = pars_info_create(); @@ -2779,9 +2794,8 @@ row_truncate_table_for_mysql( goto funct_exit; } - /* Remove any locks there are on the table or its records */ - - lock_reset_all_on_table(table); + /* Remove all locks except the table-level S and X locks. */ + lock_remove_all_on_table(table, FALSE); trx->table_id = table->id; @@ -2896,7 +2910,7 @@ next_rec: /* MySQL calls ha_innobase::reset_auto_increment() which does the same thing. */ dict_table_autoinc_lock(table); - dict_table_autoinc_initialize(table, 0); + dict_table_autoinc_initialize(table, 1); dict_table_autoinc_unlock(table); dict_update_statistics(table); @@ -3131,9 +3145,8 @@ check_next_foreign: goto funct_exit; } - /* Remove any locks there are on the table or its records */ - - lock_reset_all_on_table(table); + /* Remove all locks there are on the table or its records */ + lock_remove_all_on_table(table, TRUE); trx->dict_operation = TRUE; trx->table_id = table->id; @@ -3429,8 +3442,6 @@ loop: err = row_drop_table_for_mysql(table_name, trx, TRUE); - mem_free(table_name); - if (err != DB_SUCCESS) { fputs("InnoDB: DROP DATABASE ", stderr); ut_print_name(stderr, trx, TRUE, name); @@ -3438,8 +3449,11 @@ loop: (ulint) err); ut_print_name(stderr, trx, TRUE, table_name); putc('\n', stderr); + mem_free(table_name); break; } + + mem_free(table_name); } if (err == DB_SUCCESS) { |