diff options
Diffstat (limited to 'innobase/row')
-rw-r--r-- | innobase/row/row0ins.c | 33 | ||||
-rw-r--r-- | innobase/row/row0mysql.c | 284 | ||||
-rw-r--r-- | innobase/row/row0sel.c | 18 | ||||
-rw-r--r-- | innobase/row/row0upd.c | 6 |
4 files changed, 189 insertions, 152 deletions
diff --git a/innobase/row/row0ins.c b/innobase/row/row0ins.c index 062f21369a7..7f1852c70f2 100644 --- a/innobase/row/row0ins.c +++ b/innobase/row/row0ins.c @@ -80,9 +80,9 @@ ins_node_create( node->trx_id = ut_dulint_zero; node->entry_sys_heap = mem_heap_create(128); -#ifdef UNIV_DEBUG - node->magic_n = INS_NODE_MAGIC_N; -#endif /* UNIV_DEBUG */ + + node->magic_n = INS_NODE_MAGIC_N; + return(node); } @@ -194,7 +194,6 @@ ins_node_set_new_row( ins_node_t* node, /* in: insert node */ dtuple_t* row) /* in: new row (or first row) for the node */ { - ut_ad(node->magic_n == INS_NODE_MAGIC_N); node->state = INS_NODE_SET_IX_LOCK; node->index = NULL; node->entry = NULL; @@ -518,7 +517,7 @@ static void row_ins_foreign_report_err( /*=======================*/ - char* errstr, /* in: error string from the viewpoint + const char* errstr, /* in: error string from the viewpoint of the parent table */ que_thr_t* thr, /* in: query thread whose run_node is an update node */ @@ -652,32 +651,33 @@ row_ins_foreign_check_on_constraint( ulint err; ulint i; char* ptr; - char table_name_buf[1000]; + char* table_name_buf; ut_a(thr && foreign && pcur && mtr); /* Since we are going to delete or update a row, we have to invalidate the MySQL query cache for table */ - ut_a(ut_strlen(table->name) < 998); - strcpy(table_name_buf, table->name); + table_name_buf = mem_strdup(table->name); ptr = strchr(table_name_buf, '/'); ut_a(ptr); *ptr = '\0'; - /* We call a function in ha_innodb.cc */ #ifndef UNIV_HOTBACKUP + /* We call a function in ha_innodb.cc */ innobase_invalidate_query_cache(thr_get_trx(thr), table_name_buf, - ut_strlen(table->name) + 1); + strlen(table->name) + 1); #endif + mem_free(table_name_buf); + node = thr->run_node; if (node->is_delete && 0 == (foreign->type & (DICT_FOREIGN_ON_DELETE_CASCADE | DICT_FOREIGN_ON_DELETE_SET_NULL))) { - row_ins_foreign_report_err((char*)"Trying to delete", + row_ins_foreign_report_err("Trying to delete", thr, foreign, btr_pcur_get_rec(pcur), entry); @@ -690,7 +690,7 @@ row_ins_foreign_check_on_constraint( /* This is an UPDATE */ - row_ins_foreign_report_err((char*)"Trying to update", + row_ins_foreign_report_err("Trying to update", thr, foreign, btr_pcur_get_rec(pcur), entry); @@ -751,7 +751,7 @@ row_ins_foreign_check_on_constraint( err = DB_ROW_IS_REFERENCED; row_ins_foreign_report_err( -(char*)"Trying an update, possibly causing a cyclic cascaded update\n" +"Trying an update, possibly causing a cyclic cascaded update\n" "in the child table,", thr, foreign, btr_pcur_get_rec(pcur), entry); goto nonstandard_exit_func; @@ -876,7 +876,7 @@ row_ins_foreign_check_on_constraint( err = DB_ROW_IS_REFERENCED; row_ins_foreign_report_err( -(char*)"Trying a cascaded update where the updated value in the child\n" +"Trying a cascaded update where the updated value in the child\n" "table would not fit in the length of the column, or the value would\n" "be NULL and the column is declared as not NULL in the child table,", thr, foreign, btr_pcur_get_rec(pcur), entry); @@ -1194,7 +1194,7 @@ run_again: } } else { row_ins_foreign_report_err( - (char*)"Trying to delete or update", + "Trying to delete or update", thr, foreign, rec, entry); err = DB_ROW_IS_REFERENCED; @@ -2013,7 +2013,6 @@ row_ins( ulint err; ut_ad(node && thr); - ut_ad(node->magic_n == INS_NODE_MAGIC_N); if (node->state == INS_NODE_ALLOC_ROW_ID) { @@ -2078,7 +2077,7 @@ row_ins_step( trx_start_if_not_started(trx); node = thr->run_node; - ut_ad(node->magic_n == INS_NODE_MAGIC_N); + ut_ad(que_node_get_type(node) == QUE_NODE_INSERT); parent = que_node_get_parent(node); diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c index 61be3a7248e..c4408de2a85 100644 --- a/innobase/row/row0mysql.c +++ b/innobase/row/row0mysql.c @@ -397,6 +397,7 @@ row_create_prebuilt( prebuilt->clust_pcur = btr_pcur_create_for_mysql(); prebuilt->select_lock_type = LOCK_NONE; + prebuilt->stored_select_lock_type = 99999999; prebuilt->sel_graph = NULL; @@ -691,7 +692,7 @@ row_lock_table_autoinc_for_mysql( return(DB_SUCCESS); } - trx->op_info = (char *) "setting auto-inc lock"; + trx->op_info = "setting auto-inc lock"; if (node == NULL) { row_get_prebuilt_insert_row(prebuilt); @@ -727,14 +728,14 @@ run_again: goto run_again; } - trx->op_info = (char *) ""; + trx->op_info = ""; return(err); } que_thr_stop_for_mysql_no_error(thr, trx); - trx->op_info = (char *) ""; + trx->op_info = ""; return((int) err); } @@ -774,7 +775,7 @@ row_lock_table_for_mysql( ut_ad(trx); ut_ad(trx->mysql_thread_id == os_thread_get_curr_id()); - trx->op_info = (char *) "setting table lock"; + trx->op_info = "setting table lock"; if (prebuilt->sel_graph == NULL) { /* Build a dummy select query graph */ @@ -811,14 +812,14 @@ run_again: goto run_again; } - trx->op_info = (char *) ""; + trx->op_info = ""; return(err); } que_thr_stop_for_mysql_no_error(thr, trx); - trx->op_info = (char *) ""; + trx->op_info = ""; return((int) err); } @@ -869,7 +870,7 @@ row_insert_for_mysql( return(DB_ERROR); } - trx->op_info = (char *) "inserting"; + trx->op_info = "inserting"; trx_start_if_not_started(trx); @@ -910,7 +911,7 @@ run_again: goto run_again; } - trx->op_info = (char *) ""; + trx->op_info = ""; return(err); } @@ -927,7 +928,7 @@ run_again: } row_update_statistics_if_needed(prebuilt->table); - trx->op_info = (char *) ""; + trx->op_info = ""; return((int) err); } @@ -1084,7 +1085,7 @@ row_update_for_mysql( return(DB_ERROR); } - trx->op_info = (char *) "updating or deleting"; + trx->op_info = "updating or deleting"; trx_start_if_not_started(trx); @@ -1131,7 +1132,7 @@ run_again: if (err == DB_RECORD_NOT_FOUND) { trx->error_state = DB_SUCCESS; - trx->op_info = (char *) ""; + trx->op_info = ""; return((int) err); } @@ -1142,7 +1143,7 @@ run_again: goto run_again; } - trx->op_info = (char *) ""; + trx->op_info = ""; return(err); } @@ -1161,7 +1162,7 @@ run_again: row_update_statistics_if_needed(prebuilt->table); - trx->op_info = (char *) ""; + trx->op_info = ""; return((int) err); } @@ -1413,7 +1414,8 @@ row_create_table_for_mysql( tab_node_t* node; mem_heap_t* heap; que_thr_t* thr; - ulint namelen; + const char* table_name; + ulint table_name_len; ulint err; ut_ad(trx->mysql_thread_id == os_thread_get_curr_id()); @@ -1437,7 +1439,7 @@ row_create_table_for_mysql( return(DB_ERROR); } - trx->op_info = (char *) "creating table"; + trx->op_info = "creating table"; if (row_mysql_is_system_table(table->name)) { @@ -1465,10 +1467,17 @@ row_create_table_for_mysql( return(row_mysql_recover_tmp_table(table, trx)); } - namelen = strlen(table->name) + 1; + /* The table name is prefixed with the database name and a '/'. + Certain table names starting with 'innodb_' have their special + meaning regardless of the database name. Thus, we need to + ignore the database name prefix in the comparisons. */ + table_name = strchr(table->name, '/'); + ut_a(table_name); + table_name++; + table_name_len = strlen(table_name) + 1; - if (namelen == sizeof S_innodb_monitor - && !memcmp(table->name, S_innodb_monitor, + if (table_name_len == sizeof S_innodb_monitor + && !memcmp(table_name, S_innodb_monitor, sizeof S_innodb_monitor)) { /* Table equals "innodb_monitor": @@ -1480,27 +1489,27 @@ row_create_table_for_mysql( of InnoDB monitor prints */ os_event_set(srv_lock_timeout_thread_event); - } else if (namelen == sizeof S_innodb_lock_monitor - && !memcmp(table->name, S_innodb_lock_monitor, + } else if (table_name_len == sizeof S_innodb_lock_monitor + && !memcmp(table_name, S_innodb_lock_monitor, sizeof S_innodb_lock_monitor)) { srv_print_innodb_monitor = TRUE; srv_print_innodb_lock_monitor = TRUE; os_event_set(srv_lock_timeout_thread_event); - } else if (namelen == sizeof S_innodb_tablespace_monitor - && !memcmp(table->name, S_innodb_tablespace_monitor, + } else if (table_name_len == sizeof S_innodb_tablespace_monitor + && !memcmp(table_name, S_innodb_tablespace_monitor, sizeof S_innodb_tablespace_monitor)) { srv_print_innodb_tablespace_monitor = TRUE; os_event_set(srv_lock_timeout_thread_event); - } else if (namelen == sizeof S_innodb_table_monitor - && !memcmp(table->name, S_innodb_table_monitor, + } else if (table_name_len == sizeof S_innodb_table_monitor + && !memcmp(table_name, S_innodb_table_monitor, sizeof S_innodb_table_monitor)) { srv_print_innodb_table_monitor = TRUE; os_event_set(srv_lock_timeout_thread_event); - } else if (namelen == sizeof S_innodb_mem_validate - && !memcmp(table->name, S_innodb_mem_validate, + } else if (table_name_len == sizeof S_innodb_mem_validate + && !memcmp(table_name, S_innodb_mem_validate, sizeof S_innodb_mem_validate)) { /* We define here a debugging feature intended for developers */ @@ -1572,7 +1581,7 @@ row_create_table_for_mysql( que_graph_free((que_t*) que_node_get_parent(thr)); - trx->op_info = (char *) ""; + trx->op_info = ""; return((int) err); } @@ -1601,7 +1610,7 @@ row_create_index_for_mysql( #endif /* UNIV_SYNC_DEBUG */ ut_ad(trx->mysql_thread_id == os_thread_get_curr_id()); - trx->op_info = (char *) "creating index"; + trx->op_info = "creating index"; /* Check that the same column does not appear twice in the index. Starting from 4.0.14, InnoDB should be able to cope with that, but @@ -1669,7 +1678,7 @@ error_handling: trx->error_state = DB_SUCCESS; } - trx->op_info = (char *) ""; + trx->op_info = ""; return((int) err); } @@ -1705,7 +1714,7 @@ row_table_add_foreign_constraints( #endif /* UNIV_SYNC_DEBUG */ ut_a(sql_string); - trx->op_info = (char *) "adding foreign keys"; + trx->op_info = "adding foreign keys"; trx_start_if_not_started(trx); @@ -1749,8 +1758,8 @@ static int row_drop_table_for_mysql_in_background( /*===================================*/ - /* out: error code or DB_SUCCESS */ - char* name) /* in: table name */ + /* out: error code or DB_SUCCESS */ + const char* name) /* in: table name */ { ulint error; trx_t* trx; @@ -1951,11 +1960,41 @@ row_discard_tablespace_for_mysql( que_t* graph = NULL; ibool success; ulint err; - char buf[2 * OS_FILE_MAX_PATH]; + char* buf; + + static const char discard_tablespace_proc1[] = + "PROCEDURE DISCARD_TABLESPACE_PROC () IS\n" + "old_id CHAR;\n" + "new_id CHAR;\n" + "new_id_low INT;\n" + "new_id_high INT;\n" + "table_name CHAR;\n" + "BEGIN\n" + "table_name := "; + static const char discard_tablespace_proc2[] = + ";\n" + "new_id_high := %lu;\n" + "new_id_low := %lu;\n" + "new_id := CONCAT(TO_BINARY(new_id_high, 4), TO_BINARY(new_id_low, 4));\n" + "SELECT ID INTO old_id\n" + "FROM SYS_TABLES\n" + "WHERE NAME = table_name;\n" + "IF (SQL %% NOTFOUND) THEN\n" + " COMMIT WORK;\n" + " RETURN;\n" + "END IF;\n" + "UPDATE SYS_TABLES SET ID = new_id\n" + "WHERE ID = old_id;\n" + "UPDATE SYS_COLUMNS SET TABLE_ID = new_id\n" + "WHERE TABLE_ID = old_id;\n" + "UPDATE SYS_INDEXES SET TABLE_ID = new_id\n" + "WHERE TABLE_ID = old_id;\n" + "COMMIT WORK;\n" + "END;\n"; ut_ad(trx->mysql_thread_id == os_thread_get_curr_id()); - trx->op_info = (char *) "discarding tablespace"; + trx->op_info = "discarding tablespace"; trx_start_if_not_started(trx); /* Serialize data dictionary operations with dictionary mutex: @@ -1973,9 +2012,10 @@ row_discard_tablespace_for_mysql( if (table->space == 0) { ut_print_timestamp(stderr); - fprintf(stderr, -" InnoDB: Error: table %s\n" -"InnoDB: is in the system tablespace 0 which cannot be discarded\n", name); + fputs(" InnoDB: Error: table ", stderr); + ut_print_name(stderr, name); + fputs("\n" +"InnoDB: is in the system tablespace 0 which cannot be discarded\n", stderr); err = DB_ERROR; goto funct_exit; @@ -1983,36 +2023,16 @@ row_discard_tablespace_for_mysql( new_id = dict_hdr_get_new_id(DICT_HDR_TABLE_ID); - sprintf(buf, - "PROCEDURE DISCARD_TABLESPACE_PROC () IS\n" - "old_id CHAR;\n" - "new_id CHAR;\n" - "new_id_low INT;\n" - "new_id_high INT;\n" - "table_name CHAR;\n" - "BEGIN\n" - "table_name :='%s';\n" - "new_id_high := %lu;\n" - "new_id_low := %lu;\n" - "new_id := CONCAT(TO_BINARY(new_id_high, 4), TO_BINARY(new_id_low, 4));\n" - "SELECT ID INTO old_id\n" - "FROM SYS_TABLES\n" - "WHERE NAME = table_name;\n" - "IF (SQL %% NOTFOUND) THEN\n" - " COMMIT WORK;\n" - " RETURN;\n" - "END IF;\n" - "UPDATE SYS_TABLES SET ID = new_id\n" - "WHERE ID = old_id;\n" - "UPDATE SYS_COLUMNS SET TABLE_ID = new_id\n" - "WHERE TABLE_ID = old_id;\n" - "UPDATE SYS_INDEXES SET TABLE_ID = new_id\n" - "WHERE TABLE_ID = old_id;\n" - "COMMIT WORK;\n" - "END;\n", name, (ulong) ut_dulint_get_high(new_id), - (ulong) ut_dulint_get_low(new_id)); + buf = mem_alloc((sizeof discard_tablespace_proc1) + + (sizeof discard_tablespace_proc2) + + 20 + ut_strlenq(name, '\'')); - ut_a(strlen(buf) < 2 * OS_FILE_MAX_PATH); + memcpy(buf, discard_tablespace_proc1, sizeof discard_tablespace_proc1); + sprintf(ut_strcpyq(buf + (sizeof discard_tablespace_proc1 - 1), + '\'', name), + discard_tablespace_proc2, + (ulong) ut_dulint_get_high(new_id), + (ulong) ut_dulint_get_low(new_id)); graph = pars_sql(buf); @@ -2060,7 +2080,7 @@ funct_exit: trx_commit_for_mysql(trx); - trx->op_info = (char *) ""; + trx->op_info = ""; return((int) err); } @@ -2085,7 +2105,7 @@ row_import_tablespace_for_mysql( trx_start_if_not_started(trx); - trx->op_info = (char*) "importing tablespace"; + trx->op_info = "importing tablespace"; current_lsn = log_get_lsn(); @@ -2126,9 +2146,10 @@ row_import_tablespace_for_mysql( if (table->space == 0) { ut_print_timestamp(stderr); - fprintf(stderr, -" InnoDB: Error: table %s\n" -"InnoDB: is in the system tablespace 0 which cannot be imported\n", name); + fputs(" InnoDB: Error: table ", stderr); + ut_print_name(stderr, name); + fputs("\n" +"InnoDB: is in the system tablespace 0 which cannot be imported\n", stderr); err = DB_ERROR; goto funct_exit; @@ -2136,10 +2157,12 @@ row_import_tablespace_for_mysql( if (!table->tablespace_discarded) { ut_print_timestamp(stderr); - fprintf(stderr, + fputs( " InnoDB: Error: you are trying to IMPORT a tablespace\n" -"InnoDB: %s, though you have not called DISCARD on it yet\n" -"InnoDB: during the lifetime of the mysqld process!\n", name); +"InnoDB: ", stderr); + ut_print_name(stderr, name); + fputs(", though you have not called DISCARD on it yet\n" +"InnoDB: during the lifetime of the mysqld process!\n", stderr); err = DB_ERROR; @@ -2165,7 +2188,7 @@ funct_exit: trx_commit_for_mysql(trx); - trx->op_info = (char *) ""; + trx->op_info = ""; return((int) err); } @@ -2189,6 +2212,7 @@ row_drop_table_for_mysql( que_thr_t* thr; que_t* graph; ulint err; + const char* table_name; ulint namelen; ibool success; ibool locked_dictionary = FALSE; @@ -2274,14 +2298,21 @@ row_drop_table_for_mysql( return(DB_ERROR); } - trx->op_info = (char *) "dropping table"; + trx->op_info = "dropping table"; trx_start_if_not_started(trx); - namelen = strlen(name) + 1; + /* The table name is prefixed with the database name and a '/'. + Certain table names starting with 'innodb_' have their special + meaning regardless of the database name. Thus, we need to + ignore the database name prefix in the comparisons. */ + table_name = strchr(name, '/'); + ut_a(table_name); + table_name++; + namelen = strlen(table_name) + 1; if (namelen == sizeof S_innodb_monitor - && !memcmp(name, S_innodb_monitor, + && !memcmp(table_name, S_innodb_monitor, sizeof S_innodb_monitor)) { /* Table name equals "innodb_monitor": @@ -2290,17 +2321,17 @@ row_drop_table_for_mysql( srv_print_innodb_monitor = FALSE; srv_print_innodb_lock_monitor = FALSE; } else if (namelen == sizeof S_innodb_lock_monitor - && !memcmp(name, S_innodb_lock_monitor, + && !memcmp(table_name, S_innodb_lock_monitor, sizeof S_innodb_lock_monitor)) { srv_print_innodb_monitor = FALSE; srv_print_innodb_lock_monitor = FALSE; } else if (namelen == sizeof S_innodb_tablespace_monitor - && !memcmp(name, S_innodb_tablespace_monitor, + && !memcmp(table_name, S_innodb_tablespace_monitor, sizeof S_innodb_tablespace_monitor)) { srv_print_innodb_tablespace_monitor = FALSE; } else if (namelen == sizeof S_innodb_table_monitor - && !memcmp(name, S_innodb_table_monitor, + && !memcmp(table_name, S_innodb_table_monitor, sizeof S_innodb_table_monitor)) { srv_print_innodb_table_monitor = FALSE; @@ -2469,7 +2500,7 @@ row_drop_table_for_mysql( if (dict_load_table(name) != NULL) { ut_print_timestamp(stderr); fputs(" InnoDB: Error: not able to remove table ", - stderr); + stderr); ut_print_name(stderr, name); fputs(" from the dictionary cache!\n", stderr); err = DB_ERROR; @@ -2491,8 +2522,10 @@ row_drop_table_for_mysql( if (!success) { ut_print_timestamp(stderr); fprintf(stderr, -" InnoDB: Error: not able to delete tablespace %lu of table %s!\n", - (ulong) space_id, name); +" InnoDB: Error: not able to delete tablespace %lu of table ", + (ulong) space_id); + ut_print_name(stderr, name); + fputs("!\n", stderr); err = DB_ERROR; } } @@ -2507,7 +2540,7 @@ funct_exit: trx_commit_for_mysql(trx); - trx->op_info = (char *) ""; + trx->op_info = ""; srv_wake_master_thread(); @@ -2533,7 +2566,7 @@ row_drop_database_for_mysql( ut_a(name != NULL); ut_a(name[namelen - 1] == '/'); - trx->op_info = (char *) "dropping database"; + trx->op_info = "dropping database"; trx_start_if_not_started(trx); loop: @@ -2587,7 +2620,7 @@ loop: trx_commit_for_mysql(trx); - trx->op_info = (char *) ""; + trx->op_info = ""; return(err); } @@ -2738,7 +2771,7 @@ row_rename_table_for_mysql( return(DB_ERROR); } - trx->op_info = (char *) "renaming table"; + trx->op_info = "renaming table"; trx_start_if_not_started(trx); if (row_mysql_is_recovered_tmp_table(new_name)) { @@ -2757,15 +2790,14 @@ row_rename_table_for_mysql( err = DB_TABLE_NOT_FOUND; ut_print_timestamp(stderr); - fprintf(stderr, - " InnoDB: Error: table %s\n" - "InnoDB: does not exist in the InnoDB internal\n" + fputs(" InnoDB: Error: table ", stderr); + ut_print_name(stderr, old_name); + fputs(" does not exist in the InnoDB internal\n" "InnoDB: data dictionary though MySQL is trying to rename the table.\n" "InnoDB: Have you copied the .frm file of the table to the\n" "InnoDB: MySQL database directory from another database?\n" "InnoDB: You can look for further help from section 15.1 of\n" - "InnoDB: http://www.innodb.com/ibman.html\n", - old_name); + "InnoDB: http://www.innodb.com/ibman.php\n", stderr); goto funct_exit; } @@ -2773,12 +2805,12 @@ row_rename_table_for_mysql( err = DB_TABLE_NOT_FOUND; ut_print_timestamp(stderr); - fprintf(stderr, - " InnoDB: Error: table %s\n" - "InnoDB: does not have an .ibd file in the database directory.\n" + fputs(" InnoDB: Error: table ", stderr); + ut_print_name(stderr, old_name); + fputs( + " does not have an .ibd file in the database directory.\n" "InnoDB: You can look for further help from section 15.1 of\n" - "InnoDB: http://www.innodb.com/ibman.html\n", - old_name); + "InnoDB: http://www.innodb.com/ibman.php\n", stderr); goto funct_exit; } @@ -2905,23 +2937,25 @@ row_rename_table_for_mysql( if (err != DB_SUCCESS) { if (err == DB_DUPLICATE_KEY) { ut_print_timestamp(stderr); - fprintf(stderr, - " InnoDB: Error: table %s exists in the InnoDB internal data\n" - "InnoDB: dictionary though MySQL is trying rename table %s to it.\n" + fputs(" InnoDB: Error: table ", stderr); + ut_print_name(stderr, new_name); + fputs(" exists in the InnoDB internal data\n" + "InnoDB: dictionary though MySQL is trying rename table ", stderr); + ut_print_name(stderr, old_name); + fputs(" to it.\n" "InnoDB: Have you deleted the .frm file and not used DROP TABLE?\n" "InnoDB: You can look for further help from section 15.1 of\n" - "InnoDB: http://www.innodb.com/ibman.html\n", - new_name, old_name); - fprintf(stderr, - "InnoDB: If table %s is a temporary table #sql..., then it can be that\n" + "InnoDB: http://www.innodb.com/ibman.php\n" + "InnoDB: If table ", stderr); + ut_print_name(stderr, new_name); + fputs(" is a temporary table #sql..., then it can be that\n" "InnoDB: there are still queries running on the table, and it will be\n" - "InnoDB: dropped automatically when the queries end.\n", new_name); - fprintf(stderr, + "InnoDB: dropped automatically when the queries end.\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 moving the .frm file to the current database.\n" "InnoDB: Then MySQL thinks the table exists, and DROP TABLE will\n" - "InnoDB: succeed.\n"); + "InnoDB: succeed.\n", stderr); } trx->error_state = DB_SUCCESS; trx_general_rollback_for_mysql(trx, FALSE, NULL); @@ -2937,9 +2971,12 @@ row_rename_table_for_mysql( trx_general_rollback_for_mysql(trx, FALSE, NULL); trx->error_state = DB_SUCCESS; ut_print_timestamp(stderr); - fprintf(stderr, -" InnoDB: Error in table rename, cannot rename %s to %s\n", old_name, - new_name); + fputs(" InnoDB: Error in table rename, cannot rename ", + stderr); + ut_print_name(stderr, old_name); + fputs(" to ", stderr); + ut_print_name(stderr, new_name); + putc('\n', stderr); err = DB_ERROR; goto funct_exit; @@ -2958,11 +2995,14 @@ row_rename_table_for_mysql( if (err != DB_SUCCESS) { ut_print_timestamp(stderr); - fprintf(stderr, - " InnoDB: Error: in ALTER TABLE table %s\n" - "InnoDB: has or is referenced in foreign key constraints\n" - "InnoDB: which are not compatible with the new table definition.\n", - new_name); + fputs(" InnoDB: Error: in ALTER TABLE ", + stderr); + ut_print_name(stderr, new_name); + fputs("\n" + "InnoDB: has or is referenced in foreign key constraints\n" + "InnoDB: which are not compatible with the new table definition.\n", + stderr); + ut_a(dict_table_rename_in_cache(table, old_name, FALSE)); trx->error_state = DB_SUCCESS; @@ -2987,7 +3027,7 @@ funct_exit: trx_commit_for_mysql(trx); - trx->op_info = (char *) ""; + trx->op_info = ""; return((int) err); } @@ -3125,7 +3165,7 @@ row_check_table_for_mysql( ulint ret = DB_SUCCESS; ulint old_isolation_level; - prebuilt->trx->op_info = (char *) "checking table"; + prebuilt->trx->op_info = "checking table"; old_isolation_level = prebuilt->trx->isolation_level; @@ -3160,9 +3200,11 @@ row_check_table_for_mysql( ret = DB_ERROR; + fputs("Error: ", stderr); + dict_index_name_print(stderr, index); fprintf(stderr, - "Error: index %s contains %lu entries, should be %lu\n", - index->name, (ulong) n_rows, + " contains %lu entries, should be %lu\n", + (ulong) n_rows, (ulong) n_rows_in_table); } } @@ -3181,7 +3223,7 @@ row_check_table_for_mysql( ret = DB_ERROR; } - prebuilt->trx->op_info = (char *) ""; + prebuilt->trx->op_info = ""; return(ret); } diff --git a/innobase/row/row0sel.c b/innobase/row/row0sel.c index 48796c8a455..9e8e9b82f2d 100644 --- a/innobase/row/row0sel.c +++ b/innobase/row/row0sel.c @@ -2831,7 +2831,7 @@ row_search_for_mysql( /* PHASE 1: Try to pop the row from the prefetch cache */ if (direction == 0) { - trx->op_info = (char *) "starting index read"; + trx->op_info = "starting index read"; prebuilt->n_rows_fetched = 0; prebuilt->n_fetch_cached = 0; @@ -2842,7 +2842,7 @@ row_search_for_mysql( row_prebuild_sel_graph(prebuilt); } } else { - trx->op_info = (char *) "fetching rows"; + trx->op_info = "fetching rows"; if (prebuilt->n_rows_fetched == 0) { prebuilt->fetch_direction = direction; @@ -2867,7 +2867,7 @@ row_search_for_mysql( prebuilt->n_rows_fetched++; srv_n_rows_read++; - trx->op_info = (char *) ""; + trx->op_info = ""; return(DB_SUCCESS); } @@ -2879,7 +2879,7 @@ row_search_for_mysql( cache, but the cache was not full at the time of the popping: no more rows can exist in the result set */ - trx->op_info = (char *) ""; + trx->op_info = ""; return(DB_RECORD_NOT_FOUND); } @@ -2924,7 +2924,7 @@ row_search_for_mysql( if (direction != 0 && !prebuilt->used_in_HANDLER) { - trx->op_info = (char *) ""; + trx->op_info = ""; return(DB_RECORD_NOT_FOUND); } } @@ -3005,7 +3005,7 @@ row_search_for_mysql( trx->has_search_latch = FALSE; } - trx->op_info = (char *) ""; + trx->op_info = ""; /* NOTE that we do NOT store the cursor position */ @@ -3028,7 +3028,7 @@ row_search_for_mysql( trx->has_search_latch = FALSE; } - trx->op_info = (char *) ""; + trx->op_info = ""; /* NOTE that we do NOT store the cursor position */ @@ -3575,7 +3575,7 @@ lock_wait_or_error: /* fputs("Using ", stderr); dict_index_name_print(stderr, index); fprintf(stderr, " cnt %lu ret value %lu err\n", cnt, err); */ - trx->op_info = (char *) ""; + trx->op_info = ""; return(err); @@ -3598,7 +3598,7 @@ normal_return: srv_n_rows_read++; } - trx->op_info = (char *) ""; + trx->op_info = ""; return(ret); } diff --git a/innobase/row/row0upd.c b/innobase/row/row0upd.c index 724e7bf91e7..d35ae0a3e38 100644 --- a/innobase/row/row0upd.c +++ b/innobase/row/row0upd.c @@ -287,9 +287,7 @@ upd_node_create( node->select = NULL; node->heap = mem_heap_create(128); -#ifdef UNIV_DEBUG - node->magic_n = UPD_NODE_MAGIC_N; -#endif /* UNIV_DEBUG */ + node->magic_n = UPD_NODE_MAGIC_N; node->cmpl_info = 0; @@ -1806,7 +1804,6 @@ row_upd_step( trx_start_if_not_started(trx); node = thr->run_node; - ut_ad(node->magic_n == UPD_NODE_MAGIC_N); sel_node = node->select; @@ -1926,7 +1923,6 @@ row_upd_in_place_in_select( node = que_node_get_parent(sel_node); - ut_ad(node->magic_n == UPD_NODE_MAGIC_N); ut_ad(que_node_get_type(node) == QUE_NODE_UPDATE); pcur = node->pcur; |