mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 13:02:28 +01:00
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.
This commit is contained in:
parent
9129593724
commit
c13f191357
5 changed files with 55 additions and 93 deletions
|
@ -693,15 +693,13 @@ dict_load_indexes(
|
|||
if ((type & DICT_CLUSTERED) == 0
|
||||
&& NULL == dict_table_get_first_index(table)) {
|
||||
|
||||
if (*table->name != TEMP_TABLE_PREFIX) {
|
||||
|
||||
fprintf(stderr,
|
||||
"InnoDB: Error: trying to"
|
||||
" load index %s for table %s\n"
|
||||
"InnoDB: but the first index"
|
||||
" is not clustered!\n",
|
||||
name_buf, table->name);
|
||||
}
|
||||
fputs("InnoDB: Error: trying to load index ",
|
||||
stderr);
|
||||
ut_print_name(stderr, NULL, FALSE, name_buf);
|
||||
fputs(" for table ", stderr);
|
||||
ut_print_name(stderr, NULL, TRUE, table->name);
|
||||
fputs("\nInnoDB: but the first index"
|
||||
" is not clustered!\n", stderr);
|
||||
|
||||
btr_pcur_close(&pcur);
|
||||
mtr_commit(&mtr);
|
||||
|
|
|
@ -3635,9 +3635,7 @@ lock_table_enqueue_waiting(
|
|||
|
||||
trx = thr_get_trx(thr);
|
||||
|
||||
/* We have little choice here during index merge operations, and so
|
||||
we suppress the printing of the message.*/
|
||||
if (trx->dict_operation && *table->name != TEMP_TABLE_PREFIX) {
|
||||
if (trx->dict_operation) {
|
||||
ut_print_timestamp(stderr);
|
||||
fputs(" InnoDB: Error: a table lock wait happens"
|
||||
" in a dictionary operation!\n"
|
||||
|
|
|
@ -1761,6 +1761,7 @@ row_merge_rename_tables(
|
|||
|
||||
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
|
||||
ut_ad(old_table != new_table);
|
||||
ut_ad(mutex_own(&dict_sys->mutex));
|
||||
|
||||
trx->op_info = "renaming tables";
|
||||
trx_start_if_not_started(trx);
|
||||
|
|
113
row/row0mysql.c
113
row/row0mysql.c
|
@ -1812,9 +1812,6 @@ row_create_table_for_mysql(
|
|||
ulint table_name_len;
|
||||
ulint err;
|
||||
ulint i;
|
||||
ibool retry;
|
||||
|
||||
retry = FALSE;
|
||||
|
||||
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
|
@ -1934,7 +1931,6 @@ row_create_table_for_mysql(
|
|||
|
||||
heap = mem_heap_create(512);
|
||||
|
||||
retry_create:
|
||||
trx->dict_operation = TRUE;
|
||||
|
||||
node = tab_create_graph_create(table, heap);
|
||||
|
@ -1946,82 +1942,55 @@ retry_create:
|
|||
|
||||
err = trx->error_state;
|
||||
|
||||
if (err != DB_SUCCESS) {
|
||||
/* We have special error handling here */
|
||||
switch (err) {
|
||||
case DB_OUT_OF_FILE_SPACE:
|
||||
trx_general_rollback_for_mysql(trx, FALSE, NULL);
|
||||
|
||||
trx->error_state = DB_SUCCESS;
|
||||
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)) {
|
||||
|
||||
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);
|
||||
|
||||
if (*table->name != TEMP_TABLE_PREFIX) {
|
||||
trx_general_rollback_for_mysql(
|
||||
trx, FALSE, NULL);
|
||||
|
||||
fputs(" InnoDB: Error: table ", stderr);
|
||||
ut_print_name(stderr, trx, TRUE, table->name);
|
||||
fputs(" already exists in InnoDB internal\n"
|
||||
"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,
|
||||
FALSE);
|
||||
|
||||
retry = TRUE;
|
||||
goto retry_create;
|
||||
} else {
|
||||
trx_general_rollback_for_mysql(
|
||||
trx, FALSE, NULL);
|
||||
}
|
||||
row_drop_table_for_mysql(table->name, trx, FALSE);
|
||||
}
|
||||
break;
|
||||
|
||||
case DB_DUPLICATE_KEY:
|
||||
trx_general_rollback_for_mysql(trx, FALSE, NULL);
|
||||
|
||||
ut_print_timestamp(stderr);
|
||||
fputs(" InnoDB: Error: table ", stderr);
|
||||
ut_print_name(stderr, trx, TRUE, table->name);
|
||||
fputs(" already exists in InnoDB internal\n"
|
||||
"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
|
||||
table already exists */
|
||||
|
||||
trx->error_state = DB_SUCCESS;
|
||||
break;
|
||||
}
|
||||
|
||||
que_graph_free((que_t*) que_node_get_parent(thr));
|
||||
|
|
|
@ -419,7 +419,6 @@ row_undo_mod_del_unmark_sec_and_undo_update(
|
|||
btr_pcur_t pcur;
|
||||
upd_t* update;
|
||||
ulint err = DB_SUCCESS;
|
||||
ibool found;
|
||||
big_rec_t* dummy_big_rec;
|
||||
mtr_t mtr;
|
||||
trx_t* trx = thr_get_trx(thr);
|
||||
|
@ -427,17 +426,14 @@ row_undo_mod_del_unmark_sec_and_undo_update(
|
|||
log_free_check();
|
||||
mtr_start(&mtr);
|
||||
|
||||
/* Check if the index was created after this transaction was
|
||||
started because then this index will not have the changes made
|
||||
by this transaction.*/
|
||||
if (*index->name != TEMP_TABLE_PREFIX) {
|
||||
found = row_search_index_entry(index, entry, mode, &pcur, &mtr);
|
||||
} else {
|
||||
/* Ignore indexes that are being created. */
|
||||
if (UNIV_UNLIKELY(*index->name == TEMP_TABLE_PREFIX)) {
|
||||
|
||||
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"
|
||||
"InnoDB: ", stderr);
|
||||
dict_index_name_print(stderr, trx, index);
|
||||
|
|
Loading…
Reference in a new issue