Commit 64dfb280 authored by marko's avatar marko

branches/zip: Remove some checks if an index or a table is a temporary one

created in fast index creation.

dict_load_indexes(): Always complain if the first index is not clustered.

lock_table_enqueue_waiting(): Always complain about lock waits in
a dictionary operation.

row_merge_rename_tables(): Add an assertion that dict_sys->mutex is
being held.

row_undo_mod_del_unmark_sec_and_undo_update(): Make the test about
temporary indexes more readable.

row_create_table_for_mysql(): Do not retry creating a temporary table
in fast index creation.  Orphaned temporary tables will have to be dropped
in crash recovery.
parent 3131340b
...@@ -693,15 +693,13 @@ dict_load_indexes( ...@@ -693,15 +693,13 @@ dict_load_indexes(
if ((type & DICT_CLUSTERED) == 0 if ((type & DICT_CLUSTERED) == 0
&& NULL == dict_table_get_first_index(table)) { && NULL == dict_table_get_first_index(table)) {
if (*table->name != TEMP_TABLE_PREFIX) { fputs("InnoDB: Error: trying to load index ",
stderr);
fprintf(stderr, ut_print_name(stderr, NULL, FALSE, name_buf);
"InnoDB: Error: trying to" fputs(" for table ", stderr);
" load index %s for table %s\n" ut_print_name(stderr, NULL, TRUE, table->name);
"InnoDB: but the first index" fputs("\nInnoDB: but the first index"
" is not clustered!\n", " is not clustered!\n", stderr);
name_buf, table->name);
}
btr_pcur_close(&pcur); btr_pcur_close(&pcur);
mtr_commit(&mtr); mtr_commit(&mtr);
......
...@@ -3635,9 +3635,7 @@ lock_table_enqueue_waiting( ...@@ -3635,9 +3635,7 @@ lock_table_enqueue_waiting(
trx = thr_get_trx(thr); trx = thr_get_trx(thr);
/* We have little choice here during index merge operations, and so if (trx->dict_operation) {
we suppress the printing of the message.*/
if (trx->dict_operation && *table->name != TEMP_TABLE_PREFIX) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fputs(" InnoDB: Error: a table lock wait happens" fputs(" InnoDB: Error: a table lock wait happens"
" in a dictionary operation!\n" " in a dictionary operation!\n"
......
...@@ -1761,6 +1761,7 @@ row_merge_rename_tables( ...@@ -1761,6 +1761,7 @@ row_merge_rename_tables(
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id()); ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
ut_ad(old_table != new_table); ut_ad(old_table != new_table);
ut_ad(mutex_own(&dict_sys->mutex));
trx->op_info = "renaming tables"; trx->op_info = "renaming tables";
trx_start_if_not_started(trx); trx_start_if_not_started(trx);
......
...@@ -1812,9 +1812,6 @@ row_create_table_for_mysql( ...@@ -1812,9 +1812,6 @@ row_create_table_for_mysql(
ulint table_name_len; ulint table_name_len;
ulint err; ulint err;
ulint i; ulint i;
ibool retry;
retry = FALSE;
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id()); ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
...@@ -1934,7 +1931,6 @@ row_create_table_for_mysql( ...@@ -1934,7 +1931,6 @@ row_create_table_for_mysql(
heap = mem_heap_create(512); heap = mem_heap_create(512);
retry_create:
trx->dict_operation = TRUE; trx->dict_operation = TRUE;
node = tab_create_graph_create(table, heap); node = tab_create_graph_create(table, heap);
...@@ -1946,82 +1942,55 @@ retry_create: ...@@ -1946,82 +1942,55 @@ retry_create:
err = trx->error_state; err = trx->error_state;
if (err != DB_SUCCESS) { switch (err) {
/* We have special error handling here */ case DB_OUT_OF_FILE_SPACE:
trx_general_rollback_for_mysql(trx, FALSE, NULL);
trx->error_state = DB_SUCCESS;
if (err == DB_OUT_OF_FILE_SPACE) {
trx_general_rollback_for_mysql(trx, FALSE, NULL);
ut_print_timestamp(stderr);
fputs(" InnoDB: Warning: cannot create table ",
stderr);
ut_print_name(stderr, trx, TRUE, table->name);
fputs(" because tablespace full\n", stderr);
if (dict_table_get_low(table->name)) {
row_drop_table_for_mysql(table->name, trx,
FALSE);
}
} else if (err == DB_DUPLICATE_KEY) { ut_print_timestamp(stderr);
ut_print_timestamp(stderr); fputs(" InnoDB: Warning: cannot create table ",
stderr);
ut_print_name(stderr, trx, TRUE, table->name);
fputs(" because tablespace full\n", stderr);
if (*table->name != TEMP_TABLE_PREFIX) { if (dict_table_get_low(table->name)) {
trx_general_rollback_for_mysql(
trx, FALSE, NULL);
fputs(" InnoDB: Error: table ", stderr); row_drop_table_for_mysql(table->name, trx, FALSE);
ut_print_name(stderr, trx, TRUE, table->name); }
fputs(" already exists in InnoDB internal\n" break;
"InnoDB: data dictionary. Have you deleted"
" the .frm file\n"
"InnoDB: and not used DROP TABLE?"
" Have you used DROP DATABASE\n"
"InnoDB: for InnoDB tables in"
" MySQL version <= 3.23.43?\n"
"InnoDB: See the Restrictions section"
" of the InnoDB manual.\n"
"InnoDB: You can drop the orphaned table"
" inside InnoDB by\n"
"InnoDB: creating an InnoDB table with"
" the same name in another\n"
"InnoDB: database and copying the .frm file"
" to the current database.\n"
"InnoDB: Then MySQL thinks the table exists,"
" and DROP TABLE will\n"
"InnoDB: succeed.\n"
"InnoDB: You can look for further help from\n"
"InnoDB: "
"http://dev.mysql.com/doc/refman/5.1/en/"
"innodb-troubleshooting.html\n",
stderr);
} else if (!retry) {
fputs(" InnoDB: Warning: table ", stderr);
ut_print_name(stderr, trx, TRUE, table->name);
fputs(" already exists in InnoDB internal\n"
"InnoDB: dropping old temporary table\n",
stderr);
row_drop_table_for_mysql(table->name, trx, case DB_DUPLICATE_KEY:
FALSE); trx_general_rollback_for_mysql(trx, FALSE, NULL);
retry = TRUE; ut_print_timestamp(stderr);
goto retry_create; fputs(" InnoDB: Error: table ", stderr);
} else { ut_print_name(stderr, trx, TRUE, table->name);
trx_general_rollback_for_mysql( fputs(" already exists in InnoDB internal\n"
trx, FALSE, NULL); "InnoDB: data dictionary. Have you deleted"
} " the .frm file\n"
} "InnoDB: and not used DROP TABLE?"
" Have you used DROP DATABASE\n"
"InnoDB: for InnoDB tables in"
" MySQL version <= 3.23.43?\n"
"InnoDB: See the Restrictions section"
" of the InnoDB manual.\n"
"InnoDB: You can drop the orphaned table"
" inside InnoDB by\n"
"InnoDB: creating an InnoDB table with"
" the same name in another\n"
"InnoDB: database and copying the .frm file"
" to the current database.\n"
"InnoDB: Then MySQL thinks the table exists,"
" and DROP TABLE will\n"
"InnoDB: succeed.\n"
"InnoDB: You can look for further help from\n"
"InnoDB: "
"http://dev.mysql.com/doc/refman/5.1/en/"
"innodb-troubleshooting.html\n", stderr);
/* We may also get err == DB_ERROR if the .ibd file for the /* We may also get err == DB_ERROR if the .ibd file for the
table already exists */ table already exists */
trx->error_state = DB_SUCCESS; break;
} }
que_graph_free((que_t*) que_node_get_parent(thr)); que_graph_free((que_t*) que_node_get_parent(thr));
......
...@@ -419,7 +419,6 @@ row_undo_mod_del_unmark_sec_and_undo_update( ...@@ -419,7 +419,6 @@ row_undo_mod_del_unmark_sec_and_undo_update(
btr_pcur_t pcur; btr_pcur_t pcur;
upd_t* update; upd_t* update;
ulint err = DB_SUCCESS; ulint err = DB_SUCCESS;
ibool found;
big_rec_t* dummy_big_rec; big_rec_t* dummy_big_rec;
mtr_t mtr; mtr_t mtr;
trx_t* trx = thr_get_trx(thr); trx_t* trx = thr_get_trx(thr);
...@@ -427,17 +426,14 @@ row_undo_mod_del_unmark_sec_and_undo_update( ...@@ -427,17 +426,14 @@ row_undo_mod_del_unmark_sec_and_undo_update(
log_free_check(); log_free_check();
mtr_start(&mtr); mtr_start(&mtr);
/* Check if the index was created after this transaction was /* Ignore indexes that are being created. */
started because then this index will not have the changes made if (UNIV_UNLIKELY(*index->name == TEMP_TABLE_PREFIX)) {
by this transaction.*/
if (*index->name != TEMP_TABLE_PREFIX) {
found = row_search_index_entry(index, entry, mode, &pcur, &mtr);
} else {
return(err); return(DB_SUCCESS);
} }
if (!found) { if (UNIV_UNLIKELY(!row_search_index_entry(index, entry,
mode, &pcur, &mtr))) {
fputs("InnoDB: error in sec index entry del undo in\n" fputs("InnoDB: error in sec index entry del undo in\n"
"InnoDB: ", stderr); "InnoDB: ", stderr);
dict_index_name_print(stderr, trx, index); dict_index_name_print(stderr, trx, index);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment