1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

InnoDB: quote identifiers according to MySQL settings (Bug #5292)

innobase/btr/btr0btr.c:
  Add parameter to ut_print_name() and dict_index_name_print() calls
innobase/btr/btr0cur.c:
  Add parameter to dict_index_name_print() calls
innobase/buf/buf0buf.c:
  Add parameter to dict_index_name_print() calls
innobase/dict/dict0crea.c:
  Add parameter to ut_print_name() calls
innobase/dict/dict0dict.c:
  Add parameter to ut_print_name() calls
  Update documentation links to http://dev.mysql.com
innobase/dict/dict0load.c:
  Add parameter to ut_print_name() calls
innobase/fil/fil0fil.c:
  Use ut_print_filename()
  Update links to documentation to http://dev.mysql.com
innobase/ibuf/ibuf0ibuf.c:
  Replaced printf(...) with fprintf(stderr,...)
innobase/include/dict0dict.h:
  Added trx parameters
innobase/include/row0row.h:
  Added trx parameter
innobase/include/row0sel.h:
  Added trx parameter
innobase/include/row0upd.h:
  Added trx parameters
innobase/include/row0upd.ic:
  Added trx parameter for dict_index_name_print()
innobase/include/trx0rec.h:
  Added trx parameter
innobase/include/ut0ut.h:
  Added ut_print_filename()
  Added trx parameter to ut_print_name() and ut_print_namel()
innobase/lock/lock0lock.c:
  Added parameter to dict_index_name_print() and ut_print_name() calls
innobase/page/page0page.c:
  Added parameter to dict_index_name_print() calls
innobase/pars/pars0opt.c:
  Added parameter to dict_index_name_print() call
innobase/pars/pars0pars.c:
  Added parameter to upd_field_set_field_no() call
innobase/row/row0ins.c:
  Added trx parameters
innobase/row/row0mysql.c:
  Added trx parameters
innobase/row/row0purge.c:
  Added trx parameter
innobase/row/row0row.c:
  Added trx parameter
innobase/row/row0sel.c:
  Added trx parameters
innobase/row/row0umod.c:
  Added trx parameters
innobase/row/row0upd.c:
  Added trx parameters
innobase/trx/trx0rec.c:
  Added trx parameters
innobase/trx/trx0roll.c:
  Added parameter to ut_print_name() calls
innobase/ut/ut0ut.c:
  Added ut_print_filename()
  Added trx parameter to ut_print_namel() and ut_print_name() calls
sql/ha_innodb.cc:
  Added trx parameters
  Rewrote mysql_get_identifier_quote_char()
sql/mysql_priv.h:
  Added get_quote_char_for_identifier()
sql/sql_show.cc:
  Added get_quote_char_for_identifier()
  Removed append_quoted_simple_identifier()
  Make append_identifier() use get_quote_char_for_identifier()
This commit is contained in:
unknown
2004-10-01 11:51:59 +03:00
parent 927179ecd4
commit a418a35ceb
32 changed files with 487 additions and 360 deletions

View File

@@ -595,10 +595,10 @@ btr_page_get_father_for_rec(
buf_page_print(buf_frame_align(node_ptr)); buf_page_print(buf_frame_align(node_ptr));
fputs("InnoDB: Corruption of an index tree: table ", stderr); fputs("InnoDB: Corruption of an index tree: table ", stderr);
ut_print_name(stderr, ut_print_name(stderr, NULL,
UT_LIST_GET_FIRST(tree->tree_indexes)->table_name); UT_LIST_GET_FIRST(tree->tree_indexes)->table_name);
fputs(", index ", stderr); fputs(", index ", stderr);
ut_print_name(stderr, ut_print_name(stderr, NULL,
UT_LIST_GET_FIRST(tree->tree_indexes)->name); UT_LIST_GET_FIRST(tree->tree_indexes)->name);
fprintf(stderr, ",\n" fprintf(stderr, ",\n"
"InnoDB: father ptr page no %lu, child page no %lu\n", "InnoDB: father ptr page no %lu, child page no %lu\n",
@@ -2341,7 +2341,7 @@ btr_index_rec_validate_report(
dict_index_t* index) /* in: index */ dict_index_t* index) /* in: index */
{ {
fputs("InnoDB: Record in ", stderr); fputs("InnoDB: Record in ", stderr);
dict_index_name_print(stderr, index); dict_index_name_print(stderr, NULL, index);
fprintf(stderr, ", page %lu, at offset %lu\n", fprintf(stderr, ", page %lu, at offset %lu\n",
buf_frame_get_page_no(page), (ulint)(rec - page)); buf_frame_get_page_no(page), (ulint)(rec - page));
} }
@@ -2479,7 +2479,7 @@ btr_validate_report1(
{ {
fprintf(stderr, "InnoDB: Error in page %lu of ", fprintf(stderr, "InnoDB: Error in page %lu of ",
buf_frame_get_page_no(page)); buf_frame_get_page_no(page));
dict_index_name_print(stderr, index); dict_index_name_print(stderr, NULL, index);
if (level) { if (level) {
fprintf(stderr, ", index tree level %lu", level); fprintf(stderr, ", index tree level %lu", level);
} }
@@ -2500,7 +2500,7 @@ btr_validate_report2(
fprintf(stderr, "InnoDB: Error in pages %lu and %lu of ", fprintf(stderr, "InnoDB: Error in pages %lu and %lu of ",
buf_frame_get_page_no(page1), buf_frame_get_page_no(page1),
buf_frame_get_page_no(page2)); buf_frame_get_page_no(page2));
dict_index_name_print(stderr, index); dict_index_name_print(stderr, NULL, index);
if (level) { if (level) {
fprintf(stderr, ", index tree level %lu", level); fprintf(stderr, ", index tree level %lu", level);
} }

View File

@@ -839,7 +839,7 @@ static
void void
btr_cur_trx_report( btr_cur_trx_report(
/*===============*/ /*===============*/
const trx_t* trx, /* in: transaction */ trx_t* trx, /* in: transaction */
const dict_index_t* index, /* in: index */ const dict_index_t* index, /* in: index */
const char* op) /* in: operation */ const char* op) /* in: operation */
{ {
@@ -847,7 +847,7 @@ btr_cur_trx_report(
ut_dulint_get_high(trx->id), ut_dulint_get_high(trx->id),
ut_dulint_get_low(trx->id)); ut_dulint_get_low(trx->id));
fputs(op, stderr); fputs(op, stderr);
dict_index_name_print(stderr, index); dict_index_name_print(stderr, trx, index);
putc('\n', stderr); putc('\n', stderr);
} }
@@ -899,7 +899,7 @@ btr_cur_optimistic_insert(
if (!dtuple_check_typed_no_assert(entry)) { if (!dtuple_check_typed_no_assert(entry)) {
fputs("InnoDB: Error in a tuple to insert into ", stderr); fputs("InnoDB: Error in a tuple to insert into ", stderr);
dict_index_name_print(stderr, index); dict_index_name_print(stderr, thr_get_trx(thr), index);
} }
if (btr_cur_print_record_ops && thr) { if (btr_cur_print_record_ops && thr) {
@@ -1001,7 +1001,7 @@ calculate_sizes_again:
fputs("InnoDB: Error: cannot insert tuple ", stderr); fputs("InnoDB: Error: cannot insert tuple ", stderr);
dtuple_print(stderr, entry); dtuple_print(stderr, entry);
fputs(" into ", stderr); fputs(" into ", stderr);
dict_index_name_print(stderr, index); dict_index_name_print(stderr, thr_get_trx(thr), index);
fprintf(stderr, "\nInnoDB: max insert size %lu\n", fprintf(stderr, "\nInnoDB: max insert size %lu\n",
(ulong) max_size); (ulong) max_size);
ut_error; ut_error;

View File

@@ -427,7 +427,7 @@ buf_page_print(
btr_page_get_index_id(read_buf)); btr_page_get_index_id(read_buf));
if (index) { if (index) {
fputs("InnoDB: (", stderr); fputs("InnoDB: (", stderr);
dict_index_name_print(stderr, index); dict_index_name_print(stderr, NULL, index);
fputs(")\n", stderr); fputs(")\n", stderr);
} }
} }
@@ -2123,7 +2123,7 @@ buf_print(void)
if (index) { if (index) {
putc(' ', stderr); putc(' ', stderr);
dict_index_name_print(stderr, index); dict_index_name_print(stderr, NULL, index);
} }
putc('\n', stderr); putc('\n', stderr);

View File

@@ -501,11 +501,14 @@ dict_build_index_def_step(
dict_table_t* table; dict_table_t* table;
dict_index_t* index; dict_index_t* index;
dtuple_t* row; dtuple_t* row;
trx_t* trx;
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex))); ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
trx = thr_get_trx(thr);
index = node->index; index = node->index;
table = dict_table_get_low(index->table_name); table = dict_table_get_low(index->table_name);
@@ -514,7 +517,7 @@ dict_build_index_def_step(
return(DB_TABLE_NOT_FOUND); return(DB_TABLE_NOT_FOUND);
} }
thr_get_trx(thr)->table_id = table->id; trx->table_id = table->id;
node->table = table; node->table = table;
@@ -1264,9 +1267,9 @@ loop:
ut_print_timestamp(ef); ut_print_timestamp(ef);
fputs(" Error in foreign key constraint creation for table ", fputs(" Error in foreign key constraint creation for table ",
ef); ef);
ut_print_name(ef, table->name); ut_print_name(ef, trx, table->name);
fputs(".\nA foreign key constraint of name ", ef); fputs(".\nA foreign key constraint of name ", ef);
ut_print_name(ef, foreign->id); ut_print_name(ef, trx, foreign->id);
fputs("\nalready exists." fputs("\nalready exists."
" (Note that internally InnoDB adds 'databasename/'\n" " (Note that internally InnoDB adds 'databasename/'\n"
"in front of the user-defined constraint name).\n", "in front of the user-defined constraint name).\n",
@@ -1286,7 +1289,7 @@ loop:
ut_print_timestamp(ef); ut_print_timestamp(ef);
fputs(" Internal error in foreign key constraint creation" fputs(" Internal error in foreign key constraint creation"
" for table ", ef); " for table ", ef);
ut_print_name(ef, table->name); ut_print_name(ef, trx, table->name);
fputs(".\n" fputs(".\n"
"See the MySQL .err log in the datadir for more information.\n", ef); "See the MySQL .err log in the datadir for more information.\n", ef);
mutex_exit(&dict_foreign_err_mutex); mutex_exit(&dict_foreign_err_mutex);

View File

@@ -2085,14 +2085,14 @@ Report an error in a foreign key definition. */
static static
void void
dict_foreign_error_report_low( dict_foreign_error_report_low(
/*==========================*/
FILE* file, /* in: output stream */ FILE* file, /* in: output stream */
const char* name) /* in: table name */ const char* name) /* in: table name */
{ {
rewind(file); rewind(file);
ut_print_timestamp(file); ut_print_timestamp(file);
fputs(" Error in foreign key constraint of table ", file); fprintf(file, " Error in foreign key constraint of table %s:\n",
ut_print_name(file, name); name);
fputs(":\n", file);
} }
/************************************************************************** /**************************************************************************
@@ -2100,6 +2100,7 @@ Report an error in a foreign key definition. */
static static
void void
dict_foreign_error_report( dict_foreign_error_report(
/*======================*/
FILE* file, /* in: output stream */ FILE* file, /* in: output stream */
dict_foreign_t* fk, /* in: foreign key constraint */ dict_foreign_t* fk, /* in: foreign key constraint */
const char* msg) /* in: the error message */ const char* msg) /* in: the error message */
@@ -2108,10 +2109,10 @@ dict_foreign_error_report(
dict_foreign_error_report_low(file, fk->foreign_table_name); dict_foreign_error_report_low(file, fk->foreign_table_name);
fputs(msg, file); fputs(msg, file);
fputs(" Constraint:\n", file); fputs(" Constraint:\n", file);
dict_print_info_on_foreign_key_in_create_format(file, fk); dict_print_info_on_foreign_key_in_create_format(file, NULL, fk);
if (fk->foreign_index) { if (fk->foreign_index) {
fputs("\nThe index in the foreign key in table is ", file); fputs("\nThe index in the foreign key in table is ", file);
ut_print_name(file, fk->foreign_index->name); ut_print_name(file, NULL, fk->foreign_index->name);
fputs( fputs(
"See http://www.innodb.com/ibman.php for correct foreign key definition.\n", "See http://www.innodb.com/ibman.php for correct foreign key definition.\n",
file); file);
@@ -2946,7 +2947,7 @@ col_loop1:
mutex_enter(&dict_foreign_err_mutex); mutex_enter(&dict_foreign_err_mutex);
dict_foreign_error_report_low(ef, name); dict_foreign_error_report_low(ef, name);
fputs("There is no index in table ", ef); fputs("There is no index in table ", ef);
ut_print_name(ef, name); ut_print_name(ef, NULL, name);
fprintf(ef, " where the columns appear\n" fprintf(ef, " where the columns appear\n"
"as the first columns. Constraint:\n%s\n" "as the first columns. Constraint:\n%s\n"
"See http://www.innodb.com/ibman.php for correct foreign key definition.\n", "See http://www.innodb.com/ibman.php for correct foreign key definition.\n",
@@ -3389,12 +3390,12 @@ loop:
ut_print_timestamp(ef); ut_print_timestamp(ef);
fputs( fputs(
" Error in dropping of a foreign key constraint of table ", ef); " Error in dropping of a foreign key constraint of table ", ef);
ut_print_name(ef, table->name); ut_print_name(ef, NULL, table->name);
fputs(",\n" fputs(",\n"
"in SQL command\n", ef); "in SQL command\n", ef);
fputs(str, ef); fputs(str, ef);
fputs("\nCannot find a constraint with the given id ", ef); fputs("\nCannot find a constraint with the given id ", ef);
ut_print_name(ef, id); ut_print_name(ef, NULL, id);
fputs(".\n", ef); fputs(".\n", ef);
mutex_exit(&dict_foreign_err_mutex); mutex_exit(&dict_foreign_err_mutex);
@@ -3411,7 +3412,7 @@ syntax_error:
ut_print_timestamp(ef); ut_print_timestamp(ef);
fputs( fputs(
" Syntax error in dropping of a foreign key constraint of table ", ef); " Syntax error in dropping of a foreign key constraint of table ", ef);
ut_print_name(ef, table->name); ut_print_name(ef, NULL, table->name);
fprintf(ef, ",\n" fprintf(ef, ",\n"
"close to:\n%s\n in SQL command\n%s\n", ptr, str); "close to:\n%s\n in SQL command\n%s\n", ptr, str);
mutex_exit(&dict_foreign_err_mutex); mutex_exit(&dict_foreign_err_mutex);
@@ -3818,9 +3819,11 @@ dict_update_statistics_low(
if (table->ibd_file_missing) { if (table->ibd_file_missing) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: cannot calculate statistics for table %s\n" " InnoDB: cannot calculate statistics for table %s\n"
"InnoDB: because the .ibd file is missing. See section 15.1 of\n" "InnoDB: because the .ibd file is missing. For help, please refer to\n"
"InnoDB: http:/www.innodb.com/ibman.html for help\n", table->name); "InnoDB: "
"http://dev.mysql.com/doc/mysql/en/InnoDB_troubleshooting_datadict.html\n",
table->name);
return; return;
} }
@@ -3906,25 +3909,19 @@ dict_foreign_print_low(
ut_ad(mutex_own(&(dict_sys->mutex))); ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
fputs(" FOREIGN KEY CONSTRAINT ", stderr); fprintf(stderr, " FOREIGN KEY CONSTRAINT %s: %s (",
ut_print_name(stderr, foreign->id); foreign->id, foreign->foreign_table_name);
fputs(": ", stderr);
ut_print_name(stderr, foreign->foreign_table_name);
fputs(" (", stderr);
for (i = 0; i < foreign->n_fields; i++) { for (i = 0; i < foreign->n_fields; i++) {
putc(' ', stderr); fprintf(stderr, " %s", foreign->foreign_col_names[i]);
ut_print_name(stderr, foreign->foreign_col_names[i]);
} }
fputs(" )\n" fprintf(stderr, " )\n"
" REFERENCES ", stderr); " REFERENCES %s (",
ut_print_name(stderr, foreign->referenced_table_name); foreign->referenced_table_name);
fputs(" (", stderr);
for (i = 0; i < foreign->n_fields; i++) { for (i = 0; i < foreign->n_fields; i++) {
putc(' ', stderr); fprintf(stderr, " %s", foreign->referenced_col_names[i]);
ut_print_name(stderr, foreign->referenced_col_names[i]);
} }
fputs(" )\n", stderr); fputs(" )\n", stderr);
@@ -3981,12 +3978,11 @@ dict_table_print_low(
dict_update_statistics_low(table, TRUE); dict_update_statistics_low(table, TRUE);
fputs("--------------------------------------\n"
"TABLE: name ", stderr);
ut_print_name(stderr, table->name);
fprintf(stderr, fprintf(stderr,
", id %lu %lu, columns %lu, indexes %lu, appr.rows %lu\n" "--------------------------------------\n"
" COLUMNS: ", "TABLE: name %s, id %lu %lu, columns %lu, indexes %lu, appr.rows %lu\n"
" COLUMNS: ",
table->name,
(ulong) ut_dulint_get_high(table->id), (ulong) ut_dulint_get_high(table->id),
(ulong) ut_dulint_get_low(table->id), (ulong) ut_dulint_get_low(table->id),
(ulong) table->n_cols, (ulong) table->n_cols,
@@ -4037,8 +4033,7 @@ dict_col_print_low(
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
type = dict_col_get_type(col); type = dict_col_get_type(col);
ut_print_name(stderr, col->name); fprintf(stderr, "%s: ", col->name);
fputs(": ", stderr);
dtype_print(type); dtype_print(type);
} }
@@ -4068,13 +4063,12 @@ dict_index_print_low(
n_vals = index->stat_n_diff_key_vals[1]; n_vals = index->stat_n_diff_key_vals[1];
} }
fputs(" INDEX: ", stderr);
dict_index_name_print(stderr, index);
fprintf(stderr, fprintf(stderr,
", id %lu %lu, fields %lu/%lu, type %lu\n" " INDEX: name %s, id %lu %lu, fields %lu/%lu, type %lu\n"
" root page %lu, appr.key vals %lu," " root page %lu, appr.key vals %lu,"
" leaf pages %lu, size pages %lu\n" " leaf pages %lu, size pages %lu\n"
" FIELDS: ", " FIELDS: ",
index->name,
(ulong) ut_dulint_get_high(tree->id), (ulong) ut_dulint_get_high(tree->id),
(ulong) ut_dulint_get_low(tree->id), (ulong) ut_dulint_get_low(tree->id),
(ulong) index->n_user_defined_cols, (ulong) index->n_user_defined_cols,
@@ -4106,8 +4100,7 @@ dict_field_print_low(
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex))); ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
putc(' ', stderr); fprintf(stderr, " %s", field->name);
ut_print_name(stderr, field->name);
if (field->prefix_len != 0) { if (field->prefix_len != 0) {
fprintf(stderr, "(%lu)", (ulong) field->prefix_len); fprintf(stderr, "(%lu)", (ulong) field->prefix_len);
@@ -4122,6 +4115,7 @@ void
dict_print_info_on_foreign_key_in_create_format( dict_print_info_on_foreign_key_in_create_format(
/*============================================*/ /*============================================*/
FILE* file, /* in: file where to print */ FILE* file, /* in: file where to print */
trx_t* trx, /* in: transaction */
dict_foreign_t* foreign)/* in: foreign key constraint */ dict_foreign_t* foreign)/* in: foreign key constraint */
{ {
const char* stripped_id; const char* stripped_id;
@@ -4136,11 +4130,11 @@ dict_print_info_on_foreign_key_in_create_format(
} }
fputs(",\n CONSTRAINT ", file); fputs(",\n CONSTRAINT ", file);
ut_print_name(file, stripped_id); ut_print_name(file, trx, stripped_id);
fputs(" FOREIGN KEY (", file); fputs(" FOREIGN KEY (", file);
for (i = 0;;) { for (i = 0;;) {
ut_print_name(file, foreign->foreign_col_names[i]); ut_print_name(file, trx, foreign->foreign_col_names[i]);
if (++i < foreign->n_fields) { if (++i < foreign->n_fields) {
fputs(", ", file); fputs(", ", file);
} else { } else {
@@ -4153,7 +4147,7 @@ dict_print_info_on_foreign_key_in_create_format(
if (dict_tables_have_same_db(foreign->foreign_table_name, if (dict_tables_have_same_db(foreign->foreign_table_name,
foreign->referenced_table_name)) { foreign->referenced_table_name)) {
/* Do not print the database name of the referenced table */ /* Do not print the database name of the referenced table */
ut_print_name(file, dict_remove_db_name( ut_print_name(file, trx, dict_remove_db_name(
foreign->referenced_table_name)); foreign->referenced_table_name));
} else { } else {
/* Look for the '/' in the table name */ /* Look for the '/' in the table name */
@@ -4163,16 +4157,17 @@ dict_print_info_on_foreign_key_in_create_format(
i++; i++;
} }
ut_print_namel(file, foreign->referenced_table_name, i); ut_print_namel(file, trx, foreign->referenced_table_name, i);
putc('.', file); putc('.', file);
ut_print_name(file, foreign->referenced_table_name + i + 1); ut_print_name(file, trx,
foreign->referenced_table_name + i + 1);
} }
putc(' ', file); putc(' ', file);
putc('(', file); putc('(', file);
for (i = 0;;) { for (i = 0;;) {
ut_print_name(file, foreign->referenced_col_names[i]); ut_print_name(file, trx, foreign->referenced_col_names[i]);
if (++i < foreign->n_fields) { if (++i < foreign->n_fields) {
fputs(", ", file); fputs(", ", file);
} else { } else {
@@ -4218,6 +4213,7 @@ dict_print_info_on_foreign_keys(
a CREATE TABLE, otherwise in the format a CREATE TABLE, otherwise in the format
of SHOW TABLE STATUS */ of SHOW TABLE STATUS */
FILE* file, /* in: file where to print */ FILE* file, /* in: file where to print */
trx_t* trx, /* in: transaction */
dict_table_t* table) /* in: table */ dict_table_t* table) /* in: table */
{ {
dict_foreign_t* foreign; dict_foreign_t* foreign;
@@ -4235,7 +4231,7 @@ dict_print_info_on_foreign_keys(
while (foreign != NULL) { while (foreign != NULL) {
if (create_table_format) { if (create_table_format) {
dict_print_info_on_foreign_key_in_create_format( dict_print_info_on_foreign_key_in_create_format(
file, foreign); file, trx, foreign);
} else { } else {
ulint i; ulint i;
fputs("; (", file); fputs("; (", file);
@@ -4245,19 +4241,20 @@ dict_print_info_on_foreign_keys(
putc(' ', file); putc(' ', file);
} }
ut_print_name(file, ut_print_name(file, trx,
foreign->foreign_col_names[i]); foreign->foreign_col_names[i]);
} }
fputs(") REFER ", file); fputs(") REFER ", file);
ut_print_name(file, foreign->referenced_table_name); ut_print_name(file, trx,
foreign->referenced_table_name);
putc('(', file); putc('(', file);
for (i = 0; i < foreign->n_fields; i++) { for (i = 0; i < foreign->n_fields; i++) {
if (i) { if (i) {
putc(' ', file); putc(' ', file);
} }
ut_print_name(file, ut_print_name(file, trx,
foreign->referenced_col_names[i]); foreign->referenced_col_names[i]);
} }
@@ -4300,10 +4297,11 @@ void
dict_index_name_print( dict_index_name_print(
/*==================*/ /*==================*/
FILE* file, /* in: output stream */ FILE* file, /* in: output stream */
trx_t* trx, /* in: transaction */
const dict_index_t* index) /* in: index to print */ const dict_index_t* index) /* in: index to print */
{ {
fputs("index ", file); fputs("index ", file);
ut_print_name(file, index->name); ut_print_name(file, trx, index->name);
fputs(" of table ", file); fputs(" of table ", file);
ut_print_name(file, index->table_name); ut_print_name(file, trx, index->table_name);
} }

View File

@@ -30,7 +30,7 @@ dict_get_first_table_name_in_db(
/* out, own: table name, NULL if /* out, own: table name, NULL if
does not exist; the caller must does not exist; the caller must
free the memory in the string! */ free the memory in the string! */
const char* name) /* in: database name which ends to '/' */ const char* name) /* in: database name which ends in '/' */
{ {
dict_table_t* sys_tables; dict_table_t* sys_tables;
btr_pcur_t pcur; btr_pcur_t pcur;
@@ -165,7 +165,7 @@ loop:
if (table == NULL) { if (table == NULL) {
fputs("InnoDB: Failed to load table ", stderr); fputs("InnoDB: Failed to load table ", stderr);
ut_print_namel(stderr, field, len); ut_print_namel(stderr, NULL, field, len);
putc('\n', stderr); putc('\n', stderr);
} else { } else {
/* The table definition was corrupt if there /* The table definition was corrupt if there
@@ -389,18 +389,16 @@ Report that an index field or index for a table has been delete marked. */
static static
void void
dict_load_report_deleted_index( dict_load_report_deleted_index(
/*===========================*/
const char* name, /* in: table name */ const char* name, /* in: table name */
ulint field) /* in: index field, or ULINT_UNDEFINED */ ulint field) /* in: index field, or ULINT_UNDEFINED */
{ {
fputs("InnoDB: Error: data dictionary entry" fprintf(stderr, "InnoDB: Error: data dictionary entry"
" for table ", stderr); " for table %s is corrupt!\n", name);
ut_print_name(stderr, name);
fputs(" is corrupt!\n", stderr);
if (field != ULINT_UNDEFINED) { if (field != ULINT_UNDEFINED) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Index field %lu is delete marked.\n", field); "InnoDB: Index field %lu is delete marked.\n", field);
} } else {
else {
fputs("InnoDB: An index is delete marked.\n", stderr); fputs("InnoDB: An index is delete marked.\n", stderr);
} }
} }
@@ -620,12 +618,10 @@ dict_load_indexes(
if (page_no == FIL_NULL) { if (page_no == FIL_NULL) {
fputs("InnoDB: Error: trying to load index ", stderr); fprintf(stderr,
ut_print_name(stderr, name_buf); "InnoDB: Error: trying to load index %s for table %s\n"
fputs(" for table ", stderr); "InnoDB: but the index tree has been freed!\n",
ut_print_name(stderr, table->name); name_buf, table->name);
fputs("\n"
"InnoDB: but the index tree has been freed!\n", stderr);
btr_pcur_close(&pcur); btr_pcur_close(&pcur);
mtr_commit(&mtr); mtr_commit(&mtr);
@@ -636,12 +632,10 @@ 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)) {
fputs("InnoDB: Error: trying to load index ", stderr); fprintf(stderr,
ut_print_namel(stderr, name_buf, name_len); "InnoDB: Error: trying to load index %s for table %s\n"
fputs(" for table ", stderr); "InnoDB: but the first index is not clustered!\n",
ut_print_name(stderr, table->name); name_buf, table->name);
fputs("\n"
"InnoDB: but the first index is not clustered!\n", stderr);
btr_pcur_close(&pcur); btr_pcur_close(&pcur);
mtr_commit(&mtr); mtr_commit(&mtr);
@@ -1097,10 +1091,9 @@ dict_load_foreign(
|| rec_get_deleted_flag(rec)) { || rec_get_deleted_flag(rec)) {
/* Not found */ /* Not found */
fputs("InnoDB: Error A: cannot load foreign constraint ", fprintf(stderr,
stderr); "InnoDB: Error A: cannot load foreign constraint %s\n",
ut_print_name(stderr, id); id);
putc('\n', stderr);
btr_pcur_close(&pcur); btr_pcur_close(&pcur);
mtr_commit(&mtr); mtr_commit(&mtr);
@@ -1114,10 +1107,9 @@ dict_load_foreign(
/* Check if the id in record is the searched one */ /* Check if the id in record is the searched one */
if (len != ut_strlen(id) || ut_memcmp(id, field, len) != 0) { if (len != ut_strlen(id) || ut_memcmp(id, field, len) != 0) {
fputs("InnoDB: Error B: cannot load foreign constraint ", fprintf(stderr,
stderr); "InnoDB: Error B: cannot load foreign constraint %s\n",
ut_print_name(stderr, id); id);
putc('\n', stderr);
btr_pcur_close(&pcur); btr_pcur_close(&pcur);
mtr_commit(&mtr); mtr_commit(&mtr);

View File

@@ -428,7 +428,9 @@ fil_node_create(
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: Error: Could not find tablespace %lu for\n" " InnoDB: Error: Could not find tablespace %lu for\n"
"InnoDB: file %s from the tablespace memory cache.\n", (ulong) id, name); "InnoDB: file ", (ulong) id);
ut_print_filename(stderr, name);
fputs(" in the tablespace memory cache.\n", stderr);
mem_free(node->name); mem_free(node->name);
mem_free(node); mem_free(node);
@@ -596,16 +598,19 @@ fil_try_to_close_file_in_LRU(
} }
if (print_info && node->n_pending_flushes > 0) { if (print_info && node->n_pending_flushes > 0) {
fprintf(stderr, fputs("InnoDB: cannot close file ", stderr);
"InnoDB: cannot close file %s, because n_pending_flushes %lu\n", node->name, ut_print_filename(stderr, node->name);
fprintf(stderr, ", because n_pending_flushes %lu\n",
(ulong) node->n_pending_flushes); (ulong) node->n_pending_flushes);
} }
if (print_info if (print_info
&& node->modification_counter != node->flush_counter) { && node->modification_counter != node->flush_counter) {
fputs("InnoDB: cannot close file ", stderr);
ut_print_filename(stderr, node->name);
fprintf(stderr, fprintf(stderr,
"InnoDB: cannot close file %s, because mod_count %lld != fl_count %lld\n", ", because mod_count %lld != fl_count %lld\n",
node->name, node->modification_counter, node->modification_counter,
node->flush_counter); node->flush_counter);
} }
@@ -660,10 +665,11 @@ retry:
for a while */ for a while */
if (count2 > 20000) { if (count2 > 20000) {
fputs("InnoDB: Warning: tablespace ", stderr);
ut_print_filename(stderr, space->name);
fprintf(stderr, fprintf(stderr,
"InnoDB: Warning: tablespace %s has i/o ops stopped for a long time %lu\n", " has i/o ops stopped for a long time %lu\n",
space->name, (ulong) count2);
(ulong) count2);
} }
mutex_exit(&(system->mutex)); mutex_exit(&(system->mutex));
@@ -833,11 +839,12 @@ try_again:
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: Warning: trying to init to the tablespace memory cache\n" " InnoDB: Warning: trying to init to the tablespace memory cache\n"
"InnoDB: a tablespace %lu of name %s,\n" "InnoDB: a tablespace %lu of name ", (ulong) id);
"InnoDB: but a tablespace %lu of the same name %s\n" ut_print_filename(stderr, name);
fprintf(stderr, ",\n"
"InnoDB: but a tablespace %lu of the same name\n"
"InnoDB: already exists in the tablespace memory cache!\n", "InnoDB: already exists in the tablespace memory cache!\n",
(ulong) id, name, (ulong) space->id);
(ulong) space->id, space->name);
if (id == 0 || purpose != FIL_TABLESPACE) { if (id == 0 || purpose != FIL_TABLESPACE) {
@@ -868,10 +875,14 @@ try_again:
if (space != NULL) { if (space != NULL) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: trying to add tablespace %lu of name %s\n" "InnoDB: Error: trying to add tablespace %lu of name ", (ulong) id);
ut_print_filename(stderr, name);
fprintf(stderr, "\n"
"InnoDB: to the tablespace memory cache, but tablespace\n" "InnoDB: to the tablespace memory cache, but tablespace\n"
"InnoDB: %lu of name %s already exists in the tablespace\n" "InnoDB: %lu of name ", (ulong) space->id);
"InnoDB: memory cache!\n", (ulong) id, name, (ulong) space->id, space->name); ut_print_filename(stderr, space->name);
fputs(" already exists in the tablespace\n"
"InnoDB: memory cache!\n", stderr);
mutex_exit(&(system->mutex)); mutex_exit(&(system->mutex));
@@ -1772,10 +1783,12 @@ stop_ibuf_merges:
} else { } else {
if (count > 5000) { if (count > 5000) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fputs(
" InnoDB: Warning: trying to delete tablespace %s,\n" " InnoDB: Warning: trying to delete tablespace ", stderr);
ut_print_filename(stderr, space->name);
fprintf(stderr, ",\n"
"InnoDB: but there are %lu pending ibuf merges on it.\n" "InnoDB: but there are %lu pending ibuf merges on it.\n"
"InnoDB: Loop %lu.\n", space->name, (ulong) space->n_pending_ibuf_merges, "InnoDB: Loop %lu.\n", (ulong) space->n_pending_ibuf_merges,
(ulong) count); (ulong) count);
} }
@@ -1819,10 +1832,12 @@ try_again:
if (space->n_pending_flushes > 0 || node->n_pending > 0) { if (space->n_pending_flushes > 0 || node->n_pending > 0) {
if (count > 1000) { if (count > 1000) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fputs(
" InnoDB: Warning: trying to delete tablespace %s,\n" " InnoDB: Warning: trying to delete tablespace ", stderr);
ut_print_filename(stderr, space->name);
fprintf(stderr, ",\n"
"InnoDB: but there are %lu flushes and %lu pending i/o's on it\n" "InnoDB: but there are %lu flushes and %lu pending i/o's on it\n"
"InnoDB: Loop %lu.\n", space->name, (ulong) space->n_pending_flushes, "InnoDB: Loop %lu.\n", (ulong) space->n_pending_flushes,
(ulong) node->n_pending, (ulong) node->n_pending,
(ulong) count); (ulong) count);
} }
@@ -1931,8 +1946,9 @@ fil_rename_tablespace_in_mem(
HASH_SEARCH(name_hash, system->name_hash, ut_fold_string(old_name), HASH_SEARCH(name_hash, system->name_hash, ut_fold_string(old_name),
space2, 0 == strcmp(old_name, space2->name)); space2, 0 == strcmp(old_name, space2->name));
if (space != space2) { if (space != space2) {
fprintf(stderr, fputs("InnoDB: Error: cannot find ", stderr);
"InnoDB: Error: cannot find %s in tablespace memory cache\n", old_name); ut_print_filename(stderr, old_name);
fputs(" in tablespace memory cache\n", stderr);
return(FALSE); return(FALSE);
} }
@@ -1940,8 +1956,9 @@ fil_rename_tablespace_in_mem(
HASH_SEARCH(name_hash, system->name_hash, ut_fold_string(path), HASH_SEARCH(name_hash, system->name_hash, ut_fold_string(path),
space2, 0 == strcmp(path, space2->name)); space2, 0 == strcmp(path, space2->name));
if (space2 != NULL) { if (space2 != NULL) {
fprintf(stderr, fputs("InnoDB: Error: ", stderr);
"InnoDB: Error: %s is already in tablespace memory cache\n", path); ut_print_filename(stderr, path);
fputs(" is already in tablespace memory cache\n", stderr);
return(FALSE); return(FALSE);
} }
@@ -2019,10 +2036,11 @@ retry:
if (count > 1000) { if (count > 1000) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fputs(" InnoDB: Warning: problems renaming ", stderr);
" InnoDB: Warning: problems renaming %s to %s, %lu iterations\n", ut_print_filename(stderr, old_name);
old_name, new_name, fputs(" to ", stderr);
(ulong) count); ut_print_filename(stderr, new_name);
fprintf(stderr, ", %lu iterations\n", (ulong) count);
} }
mutex_enter(&(system->mutex)); mutex_enter(&(system->mutex));
@@ -2032,8 +2050,9 @@ retry:
if (space == NULL) { if (space == NULL) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: cannot find space id %lu from the tablespace memory cache\n" "InnoDB: Error: cannot find space id %lu from the tablespace memory cache\n"
"InnoDB: though the table %s in a rename operation should have that id\n", "InnoDB: though the table ", (ulong) id);
(ulong) id, old_name); ut_print_filename(stderr, old_name);
fputs(" in a rename operation should have that id\n", stderr);
mutex_exit(&(system->mutex)); mutex_exit(&(system->mutex));
return(FALSE); return(FALSE);
@@ -2166,22 +2185,25 @@ fil_create_new_single_table_tablespace(
OS_DATA_FILE, &ret); OS_DATA_FILE, &ret);
if (ret == FALSE) { if (ret == FALSE) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fputs(" InnoDB: Error creating file ", stderr);
" InnoDB: Error creating file %s.\n", path); ut_print_filename(stderr, path);
fputs(".\n", stderr);
/* The following call will print an error message */ /* The following call will print an error message */
err = os_file_get_last_error(TRUE); err = os_file_get_last_error(TRUE);
if (err == OS_FILE_ALREADY_EXISTS) { if (err == OS_FILE_ALREADY_EXISTS) {
fprintf(stderr, fputs(
"InnoDB: The file already exists though the corresponding table did not\n" "InnoDB: The file already exists though the corresponding table did not\n"
"InnoDB: exist in the InnoDB data dictionary. Have you moved InnoDB\n" "InnoDB: exist in the InnoDB data dictionary. Have you moved InnoDB\n"
"InnoDB: .ibd files around without using the SQL commands\n" "InnoDB: .ibd files around without using the SQL commands\n"
"InnoDB: DISCARD TABLESPACE and IMPORT TABLESPACE, or did\n" "InnoDB: DISCARD TABLESPACE and IMPORT TABLESPACE, or did\n"
"InnoDB: mysqld crash in the middle of CREATE TABLE? You can\n" "InnoDB: mysqld crash in the middle of CREATE TABLE? You can\n"
"InnoDB: resolve the problem by removing the file %s\n" "InnoDB: resolve the problem by removing the file ", stderr);
"InnoDB: under the 'datadir' of MySQL.\n", path); ut_print_filename(stderr, path);
fputs("\n"
"InnoDB: under the 'datadir' of MySQL.\n", stderr);
mem_free(path); mem_free(path);
return(DB_TABLESPACE_ALREADY_EXISTS); return(DB_TABLESPACE_ALREADY_EXISTS);
@@ -2249,16 +2271,20 @@ fil_create_new_single_table_tablespace(
ut_free(buf2); ut_free(buf2);
if (!ret) { if (!ret) {
fprintf(stderr, fputs(
"InnoDB: Error: could not write the first page to tablespace %s\n", path); "InnoDB: Error: could not write the first page to tablespace ", stderr);
ut_print_filename(stderr, path);
putc('\n', stderr);
goto error_exit; goto error_exit;
} }
ret = os_file_flush(file); ret = os_file_flush(file);
if (!ret) { if (!ret) {
fprintf(stderr, fputs(
"InnoDB: Error: file flush of tablespace %s failed\n", path); "InnoDB: Error: file flush of tablespace ", stderr);
ut_print_filename(stderr, path);
fputs(" failed\n", stderr);
goto error_exit; goto error_exit;
} }
@@ -2361,12 +2387,14 @@ fil_reset_too_high_lsns(
fprintf(stderr, fprintf(stderr,
" InnoDB: Flush lsn in the tablespace file %lu to be imported\n" " InnoDB: Flush lsn in the tablespace file %lu to be imported\n"
"InnoDB: is %lu %lu, which exceeds current system lsn %lu %lu.\n" "InnoDB: is %lu %lu, which exceeds current system lsn %lu %lu.\n"
"InnoDB: We reset the lsn's in the file %s.\n", "InnoDB: We reset the lsn's in the file ",
(ulong) space_id, (ulong) space_id,
(ulong) ut_dulint_get_high(flush_lsn), (ulong) ut_dulint_get_high(flush_lsn),
(ulong) ut_dulint_get_low(flush_lsn), (ulong) ut_dulint_get_low(flush_lsn),
(ulong) ut_dulint_get_high(current_lsn), (ulong) ut_dulint_get_high(current_lsn),
(ulong) ut_dulint_get_low(current_lsn), filepath); (ulong) ut_dulint_get_low(current_lsn));
ut_print_filename(stderr, filepath);
fputs(".\n", stderr);
/* Loop through all the pages in the tablespace and reset the lsn and /* Loop through all the pages in the tablespace and reset the lsn and
the page checksum if necessary */ the page checksum if necessary */
@@ -2464,14 +2492,17 @@ fil_open_single_table_tablespace(
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fputs(
" InnoDB: Error: trying to open a table, but could not\n" " InnoDB: Error: trying to open a table, but could not\n"
"InnoDB: open the tablespace file %s!\n", filepath); "InnoDB: open the tablespace file ", stderr);
fprintf(stderr, ut_print_filename(stderr, filepath);
"InnoDB: have you moved InnoDB .ibd files around without using the\n" fputs("!\n"
"InnoDB: Have you moved InnoDB .ibd files around without using the\n"
"InnoDB: commands DISCARD TABLESPACE and IMPORT TABLESPACE?\n" "InnoDB: commands DISCARD TABLESPACE and IMPORT TABLESPACE?\n"
"InnoDB: You can look from section 15.1 of http://www.innodb.com/ibman.html\n" "InnoDB: Please refer to\n"
"InnoDB: how to resolve the issue.\n"); "InnoDB:"
" http://dev.mysql.com/doc/mysql/en/InnoDB_troubleshooting_datadict.html\n"
"InnoDB: how to resolve the issue.\n", stderr);
mem_free(filepath); mem_free(filepath);
@@ -2493,14 +2524,17 @@ fil_open_single_table_tablespace(
if (space_id != id) { if (space_id != id) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fputs(
" InnoDB: Error: tablespace id in file %s is %lu, but in the InnoDB\n" " InnoDB: Error: tablespace id in file ", stderr);
"InnoDB: data dictionary it is %lu.\n", filepath, (ulong) space_id, (ulong) id); ut_print_filename(stderr, filepath);
fprintf(stderr, fprintf(stderr, " is %lu, but in the InnoDB\n"
"InnoDB: data dictionary it is %lu.\n"
"InnoDB: Have you moved InnoDB .ibd files around without using the\n" "InnoDB: Have you moved InnoDB .ibd files around without using the\n"
"InnoDB: commands DISCARD TABLESPACE and IMPORT TABLESPACE?\n" "InnoDB: commands DISCARD TABLESPACE and IMPORT TABLESPACE?\n"
"InnoDB: You can look from section 15.1 of http://www.innodb.com/ibman.html\n" "InnoDB: Please refer to\n"
"InnoDB: how to resolve the issue.\n"); "InnoDB:"
" http://dev.mysql.com/doc/mysql/en/InnoDB_troubleshooting_datadict.html\n"
"InnoDB: how to resolve the issue.\n", (ulong) space_id, (ulong) id);
ret = FALSE; ret = FALSE;
@@ -2867,8 +2901,10 @@ next_file_item:
} }
if (0 != os_file_closedir(dbdir)) { if (0 != os_file_closedir(dbdir)) {
fprintf(stderr, fputs(
"InnoDB: Warning: could not close database directory %s\n", dbpath); "InnoDB: Warning: could not close database directory ", stderr);
ut_print_filename(stderr, dbpath);
putc('\n', stderr);
} }
} }
@@ -2921,9 +2957,10 @@ fil_print_orphaned_tablespaces(void)
while (space) { while (space) {
if (space->purpose == FIL_TABLESPACE && space->id != 0 if (space->purpose == FIL_TABLESPACE && space->id != 0
&& !space->mark) { && !space->mark) {
fprintf(stderr, fputs("InnoDB: Warning: tablespace ", stderr);
"InnoDB: Warning: tablespace %s of id %lu has no matching table in\n" ut_print_filename(stderr, space->name);
"InnoDB: the InnoDB data dictionary.\n", space->name, (ulong) space->id); fprintf(stderr, " of id %lu has no matching table in\n"
"InnoDB: the InnoDB data dictionary.\n", (ulong) space->id);
} }
space = UT_LIST_GET_NEXT(space_list, space); space = UT_LIST_GET_NEXT(space_list, space);
@@ -3072,26 +3109,31 @@ fil_space_for_table_exists_in_mem(
if (space == NULL) { if (space == NULL) {
if (namespace == NULL) { if (namespace == NULL) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fputs(" InnoDB: Error: table ", stderr);
" InnoDB: Error: table %s\n" ut_print_filename(stderr, name);
fprintf(stderr, "\n"
"InnoDB: in InnoDB data dictionary has tablespace id %lu,\n" "InnoDB: in InnoDB data dictionary has tablespace id %lu,\n"
"InnoDB: but tablespace with that id or name does not exist. Have\n" "InnoDB: but tablespace with that id or name does not exist. Have\n"
"InnoDB: you deleted or moved .ibd files?\n", "InnoDB: you deleted or moved .ibd files?\n",
name, (ulong) id); (ulong) id);
} else { } else {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fputs(" InnoDB: Error: table ", stderr);
" InnoDB: Error: table %s\n" ut_print_filename(stderr, name);
fprintf(stderr, "\n"
"InnoDB: in InnoDB data dictionary has tablespace id %lu,\n" "InnoDB: in InnoDB data dictionary has tablespace id %lu,\n"
"InnoDB: but tablespace with that id does not exist. There is\n" "InnoDB: but tablespace with that id does not exist. There is\n"
"InnoDB: a tablespace of name %s and id %lu, though. Have\n" "InnoDB: a tablespace of name %s and id %lu, though. Have\n"
"InnoDB: you deleted or moved .ibd files?\n", "InnoDB: you deleted or moved .ibd files?\n",
name, (ulong) id, namespace->name, (ulong) id, namespace->name,
(ulong) namespace->id); (ulong) namespace->id);
} }
fprintf(stderr, error_exit:
"InnoDB: You can look from section 15.1 of http://www.innodb.com/ibman.html\n" fputs(
"InnoDB: how to resolve the issue.\n"); "InnoDB: Please refer to\n"
"InnoDB:"
" http://dev.mysql.com/doc/mysql/en/InnoDB_troubleshooting_datadict.html\n"
"InnoDB: how to resolve the issue.\n", stderr);
mem_free(path); mem_free(path);
mutex_exit(&(system->mutex)); mutex_exit(&(system->mutex));
@@ -3101,26 +3143,23 @@ fil_space_for_table_exists_in_mem(
if (0 != strcmp(space->name, path)) { if (0 != strcmp(space->name, path)) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fputs(" InnoDB: Error: table ", stderr);
" InnoDB: Error: table %s\n" ut_print_filename(stderr, name);
fprintf(stderr, "\n"
"InnoDB: in InnoDB data dictionary has tablespace id %lu,\n" "InnoDB: in InnoDB data dictionary has tablespace id %lu,\n"
"InnoDB: but tablespace with that id has name %s.\n" "InnoDB: but tablespace with that id has name %s.\n"
"InnoDB: Have you deleted or moved .ibd files?\n", name, (ulong) id, space->name); "InnoDB: Have you deleted or moved .ibd files?\n", (ulong) id, space->name);
if (namespace != NULL) { if (namespace != NULL) {
fprintf(stderr, fputs(
"InnoDB: There is a tablespace with the right name\n" "InnoDB: There is a tablespace with the right name\n"
"InnoDB: %s, but its id is %lu.\n", namespace->name, (ulong) namespace->id); "InnoDB: ", stderr);
ut_print_filename(stderr, namespace->name);
fprintf(stderr, ", but its id is %lu.\n",
(ulong) namespace->id);
} }
fprintf(stderr, goto error_exit;
"InnoDB: You can look from section 15.1 of http://www.innodb.com/ibman.html\n"
"InnoDB: how to resolve the issue.\n");
mem_free(path);
mutex_exit(&(system->mutex));
return(FALSE);
} }
mem_free(path); mem_free(path);

View File

@@ -3268,8 +3268,9 @@ leave_loop:
mutex_exit(&ibuf_mutex); mutex_exit(&ibuf_mutex);
printf("Discarded %lu ibuf entries for space %lu\n", (ulong) n_inserts, fprintf(stderr,
(ulong) space); "InnoDB: Discarded %lu ibuf entries for space %lu\n",
(ulong) n_inserts, (ulong) space);
ibuf_exit(); ibuf_exit();

View File

@@ -356,6 +356,7 @@ dict_print_info_on_foreign_keys(
a CREATE TABLE, otherwise in the format a CREATE TABLE, otherwise in the format
of SHOW TABLE STATUS */ of SHOW TABLE STATUS */
FILE* file, /* in: file where to print */ FILE* file, /* in: file where to print */
trx_t* trx, /* in: transaction */
dict_table_t* table); /* in: table */ dict_table_t* table); /* in: table */
/************************************************************************** /**************************************************************************
Outputs info on a foreign key of a table in a format suitable for Outputs info on a foreign key of a table in a format suitable for
@@ -364,6 +365,7 @@ void
dict_print_info_on_foreign_key_in_create_format( dict_print_info_on_foreign_key_in_create_format(
/*============================================*/ /*============================================*/
FILE* file, /* in: file where to print */ FILE* file, /* in: file where to print */
trx_t* trx, /* in: transaction */
dict_foreign_t* foreign);/* in: foreign key constraint */ dict_foreign_t* foreign);/* in: foreign key constraint */
/************************************************************************ /************************************************************************
Displays the names of the index and the table. */ Displays the names of the index and the table. */
@@ -371,6 +373,7 @@ void
dict_index_name_print( dict_index_name_print(
/*==================*/ /*==================*/
FILE* file, /* in: output stream */ FILE* file, /* in: output stream */
trx_t* trx, /* in: transaction */
const dict_index_t* index); /* in: index to print */ const dict_index_t* index); /* in: index to print */
/************************************************************************ /************************************************************************
Gets the first index on the table (the clustered index). */ Gets the first index on the table (the clustered index). */

View File

@@ -147,12 +147,13 @@ row_build_row_ref_in_tuple(
dtuple_t* ref, /* in/out: row reference built; see the dtuple_t* ref, /* in/out: row reference built; see the
NOTE below! */ NOTE below! */
dict_index_t* index, /* in: index */ dict_index_t* index, /* in: index */
rec_t* rec); /* in: record in the index; rec_t* rec, /* in: record in the index;
NOTE: the data fields in ref will point NOTE: the data fields in ref will point
directly into this record, therefore, directly into this record, therefore,
the buffer page of this record must be the buffer page of this record must be
at least s-latched and the latch held at least s-latched and the latch held
as long as the row reference is used! */ as long as the row reference is used! */
trx_t* trx); /* in: transaction */
/*********************************************************************** /***********************************************************************
From a row build a row reference with which we can search the clustered From a row build a row reference with which we can search the clustered
index record. */ index record. */

View File

@@ -105,7 +105,8 @@ row_sel_convert_mysql_key_to_innobase(
ulint buf_len, /* in: buffer length */ ulint buf_len, /* in: buffer length */
dict_index_t* index, /* in: index of the key value */ dict_index_t* index, /* in: index of the key value */
byte* key_ptr, /* in: MySQL key value */ byte* key_ptr, /* in: MySQL key value */
ulint key_len); /* in: MySQL key value length */ ulint key_len, /* in: MySQL key value length */
trx_t* trx); /* in: transaction */
/************************************************************************ /************************************************************************
Searches for rows in the database. This is used in the interface to Searches for rows in the database. This is used in the interface to
MySQL. This function opens a cursor, and also implements fetch next MySQL. This function opens a cursor, and also implements fetch next

View File

@@ -55,7 +55,8 @@ upd_field_set_field_no(
upd_field_t* upd_field, /* in: update vector field */ upd_field_t* upd_field, /* in: update vector field */
ulint field_no, /* in: field number in a clustered ulint field_no, /* in: field number in a clustered
index */ index */
dict_index_t* index); /* in: index */ dict_index_t* index, /* in: index */
trx_t* trx); /* in: transaction */
/************************************************************************* /*************************************************************************
Writes into the redo log the values of trx id and roll ptr and enough info Writes into the redo log the values of trx id and roll ptr and enough info
to determine their positions within a clustered index record. */ to determine their positions within a clustered index record. */
@@ -149,6 +150,7 @@ row_upd_build_sec_rec_difference_binary(
dict_index_t* index, /* in: index */ dict_index_t* index, /* in: index */
dtuple_t* entry, /* in: entry to insert */ dtuple_t* entry, /* in: entry to insert */
rec_t* rec, /* in: secondary index record */ rec_t* rec, /* in: secondary index record */
trx_t* trx, /* in: transaction */
mem_heap_t* heap); /* in: memory heap from which allocated */ mem_heap_t* heap); /* in: memory heap from which allocated */
/******************************************************************* /*******************************************************************
Builds an update vector from those fields, excluding the roll ptr and Builds an update vector from those fields, excluding the roll ptr and
@@ -166,6 +168,7 @@ row_upd_build_difference_binary(
externally stored fields in entry, or NULL */ externally stored fields in entry, or NULL */
ulint n_ext_vec,/* in: number of fields in ext_vec */ ulint n_ext_vec,/* in: number of fields in ext_vec */
rec_t* rec, /* in: clustered index record */ rec_t* rec, /* in: clustered index record */
trx_t* trx, /* in: transaction */
mem_heap_t* heap); /* in: memory heap from which allocated */ mem_heap_t* heap); /* in: memory heap from which allocated */
/*************************************************************** /***************************************************************
Replaces the new column values stored in the update vector to the index entry Replaces the new column values stored in the update vector to the index entry

View File

@@ -78,7 +78,8 @@ upd_field_set_field_no(
upd_field_t* upd_field, /* in: update vector field */ upd_field_t* upd_field, /* in: update vector field */
ulint field_no, /* in: field number in a clustered ulint field_no, /* in: field number in a clustered
index */ index */
dict_index_t* index) /* in: index */ dict_index_t* index, /* in: index */
trx_t* trx) /* in: transaction */
{ {
upd_field->field_no = field_no; upd_field->field_no = field_no;
@@ -86,7 +87,7 @@ upd_field_set_field_no(
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: trying to access field %lu in ", "InnoDB: Error: trying to access field %lu in ",
(ulong) field_no); (ulong) field_no);
dict_index_name_print(stderr, index); dict_index_name_print(stderr, trx, index);
fprintf(stderr, "\n" fprintf(stderr, "\n"
"InnoDB: but index only has %lu fields\n", "InnoDB: but index only has %lu fields\n",
(ulong) dict_index_get_n_fields(index)); (ulong) dict_index_get_n_fields(index));

View File

@@ -145,6 +145,7 @@ trx_undo_update_rec_get_update(
dulint trx_id, /* in: transaction id from this undorecord */ dulint trx_id, /* in: transaction id from this undorecord */
dulint roll_ptr,/* in: roll pointer from this undo record */ dulint roll_ptr,/* in: roll pointer from this undo record */
ulint info_bits,/* in: info bits from this undo record */ ulint info_bits,/* in: info bits from this undo record */
trx_t* trx, /* in: transaction */
mem_heap_t* heap, /* in: memory heap from which the memory mem_heap_t* heap, /* in: memory heap from which the memory
needed is allocated */ needed is allocated */
upd_t** upd); /* out, own: update vector */ upd_t** upd); /* out, own: update vector */

View File

@@ -197,13 +197,25 @@ ut_print_buf(
const byte* buf, /* in: memory buffer */ const byte* buf, /* in: memory buffer */
ulint len); /* in: length of the buffer */ ulint len); /* in: length of the buffer */
/**************************************************************************
Outputs a NUL-terminated file name, quoted with apostrophes. */
void
ut_print_filename(
/*==============*/
FILE* f, /* in: output stream */
const char* name); /* in: name to print */
/************************************************************************** /**************************************************************************
Outputs a NUL-terminated string, quoted as an SQL identifier. */ Outputs a NUL-terminated string, quoted as an SQL identifier. */
struct trx_struct;
void void
ut_print_name( ut_print_name(
/*==========*/ /*==========*/
FILE* f, /* in: output stream */ FILE* f, /* in: output stream */
struct trx_struct*trx, /* in: transaction */
const char* name); /* in: name to print */ const char* name); /* in: name to print */
/************************************************************************** /**************************************************************************
@@ -213,6 +225,7 @@ void
ut_print_namel( ut_print_namel(
/*==========*/ /*==========*/
FILE* f, /* in: output stream */ FILE* f, /* in: output stream */
struct trx_struct*trx, /* in: transaction (NULL=no quotes) */
const char* name, /* in: name to print */ const char* name, /* in: name to print */
ulint namelen);/* in: length of name */ ulint namelen);/* in: length of name */

View File

@@ -398,7 +398,7 @@ lock_check_trx_id_sanity(
stderr); stderr);
rec_print(stderr, rec); rec_print(stderr, rec);
fputs("InnoDB: in ", stderr); fputs("InnoDB: in ", stderr);
dict_index_name_print(stderr, index); dict_index_name_print(stderr, NULL, index);
fprintf(stderr, "\n" fprintf(stderr, "\n"
"InnoDB: is %lu %lu which is higher than the global trx id counter %lu %lu!\n" "InnoDB: is %lu %lu which is higher than the global trx id counter %lu %lu!\n"
"InnoDB: The table is corrupt. You have to do dump + drop + reimport.\n", "InnoDB: The table is corrupt. You have to do dump + drop + reimport.\n",
@@ -1651,7 +1651,7 @@ lock_rec_enqueue_waiting(
fputs( fputs(
" InnoDB: Error: a record lock wait happens in a dictionary operation!\n" " InnoDB: Error: a record lock wait happens in a dictionary operation!\n"
"InnoDB: Table name ", stderr); "InnoDB: Table name ", stderr);
ut_print_name(stderr, index->table_name); ut_print_name(stderr, trx, index->table_name);
fputs(".\n" fputs(".\n"
"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n", "InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n",
stderr); stderr);
@@ -1688,7 +1688,7 @@ lock_rec_enqueue_waiting(
if (lock_print_waits) { if (lock_print_waits) {
fprintf(stderr, "Lock wait for trx %lu in index ", fprintf(stderr, "Lock wait for trx %lu in index ",
(ulong) ut_dulint_get_low(trx->id)); (ulong) ut_dulint_get_low(trx->id));
ut_print_name(stderr, index->name); ut_print_name(stderr, trx, index->name);
} }
return(DB_LOCK_WAIT); return(DB_LOCK_WAIT);
@@ -3293,7 +3293,7 @@ lock_table_enqueue_waiting(
fputs( fputs(
" InnoDB: Error: a table lock wait happens in a dictionary operation!\n" " InnoDB: Error: a table lock wait happens in a dictionary operation!\n"
"InnoDB: Table name ", stderr); "InnoDB: Table name ", stderr);
ut_print_name(stderr, table->name); ut_print_name(stderr, trx, table->name);
fputs(".\n" fputs(".\n"
"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n", "InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n",
stderr); stderr);
@@ -3820,7 +3820,7 @@ lock_table_print(
fputs("EXPLICIT ", file); fputs("EXPLICIT ", file);
} }
fputs("TABLE LOCK table ", file); fputs("TABLE LOCK table ", file);
ut_print_name(file, lock->un_member.tab_lock.table->name); ut_print_name(file, lock->trx, lock->un_member.tab_lock.table->name);
fprintf(file, " trx id %lu %lu", fprintf(file, " trx id %lu %lu",
(ulong) (lock->trx)->id.high, (ulong) (lock->trx)->id.low); (ulong) (lock->trx)->id.high, (ulong) (lock->trx)->id.low);
@@ -3871,7 +3871,7 @@ lock_rec_print(
fprintf(file, "RECORD LOCKS space id %lu page no %lu n bits %lu ", fprintf(file, "RECORD LOCKS space id %lu page no %lu n bits %lu ",
(ulong) space, (ulong) page_no, (ulong) space, (ulong) page_no,
(ulong) lock_rec_get_n_bits(lock)); (ulong) lock_rec_get_n_bits(lock));
dict_index_name_print(file, lock->index); dict_index_name_print(file, lock->trx, lock->index);
fprintf(file, " trx id %lu %lu", fprintf(file, " trx id %lu %lu",
(ulong) (lock->trx)->id.high, (ulong) (lock->trx)->id.high,
(ulong) (lock->trx)->id.low); (ulong) (lock->trx)->id.low);

View File

@@ -1579,7 +1579,7 @@ page_validate(
fputs("InnoDB: Record heap and dir overlap on a page ", fputs("InnoDB: Record heap and dir overlap on a page ",
stderr); stderr);
dict_index_name_print(stderr, index); dict_index_name_print(stderr, NULL, index);
fprintf(stderr, ", %p, %p\n", fprintf(stderr, ", %p, %p\n",
page_header_get_ptr(page, PAGE_HEAP_TOP), page_header_get_ptr(page, PAGE_HEAP_TOP),
page_dir_get_nth_slot(page, n_slots - 1)); page_dir_get_nth_slot(page, n_slots - 1));
@@ -1610,7 +1610,7 @@ page_validate(
fprintf(stderr, fprintf(stderr,
"InnoDB: Records in wrong order on page %lu", "InnoDB: Records in wrong order on page %lu",
(ulong) buf_frame_get_page_no(page)); (ulong) buf_frame_get_page_no(page));
dict_index_name_print(stderr, index); dict_index_name_print(stderr, NULL, index);
fputs("\nInnoDB: previous record ", stderr); fputs("\nInnoDB: previous record ", stderr);
rec_print(stderr, old_rec); rec_print(stderr, old_rec);
fputs("\nInnoDB: record ", stderr); fputs("\nInnoDB: record ", stderr);
@@ -1752,7 +1752,7 @@ func_exit:
func_exit2: func_exit2:
fprintf(stderr, "InnoDB: Apparent corruption in page %lu in ", fprintf(stderr, "InnoDB: Apparent corruption in page %lu in ",
(ulong) buf_frame_get_page_no(page)); (ulong) buf_frame_get_page_no(page));
dict_index_name_print(stderr, index); dict_index_name_print(stderr, NULL, index);
putc('\n', stderr); putc('\n', stderr);
buf_page_print(page); buf_page_print(page);
} }

View File

@@ -1229,7 +1229,7 @@ opt_print_query_plan(
} }
fputs("Table ", stderr); fputs("Table ", stderr);
dict_index_name_print(stderr, plan->index); dict_index_name_print(stderr, NULL, plan->index);
fprintf(stderr,"; exact m. %lu, match %lu, end conds %lu\n", fprintf(stderr,"; exact m. %lu, match %lu, end conds %lu\n",
(unsigned long) plan->n_exact_match, (unsigned long) plan->n_exact_match,
(unsigned long) n_fields, (unsigned long) n_fields,

View File

@@ -886,7 +886,7 @@ pars_process_assign_list(
upd_field_set_field_no(upd_field, upd_field_set_field_no(upd_field,
dict_index_get_nth_col_pos(clust_index, dict_index_get_nth_col_pos(clust_index,
col_sym->col_no), col_sym->col_no),
clust_index); clust_index, NULL);
upd_field->exp = assign_node->val; upd_field->exp = assign_node->val;
if (!dtype_is_fixed_size( if (!dtype_is_fixed_size(

View File

@@ -252,7 +252,7 @@ row_ins_sec_index_entry_by_modify(
heap = mem_heap_create(1024); heap = mem_heap_create(1024);
update = row_upd_build_sec_rec_difference_binary(cursor->index, update = row_upd_build_sec_rec_difference_binary(cursor->index,
entry, rec, heap); entry, rec, thr_get_trx(thr), heap);
if (mode == BTR_MODIFY_LEAF) { if (mode == BTR_MODIFY_LEAF) {
/* Try an optimistic updating of the record, keeping changes /* Try an optimistic updating of the record, keeping changes
within the page */ within the page */
@@ -316,7 +316,7 @@ row_ins_clust_index_entry_by_modify(
roll_ptr */ roll_ptr */
update = row_upd_build_difference_binary(cursor->index, entry, ext_vec, update = row_upd_build_difference_binary(cursor->index, entry, ext_vec,
n_ext_vec, rec, heap); n_ext_vec, rec, thr_get_trx(thr), heap);
if (mode == BTR_MODIFY_LEAF) { if (mode == BTR_MODIFY_LEAF) {
/* Try optimistic updating of the record, keeping changes /* Try optimistic updating of the record, keeping changes
within the page */ within the page */
@@ -554,29 +554,30 @@ row_ins_foreign_report_err(
table */ table */
{ {
FILE* ef = dict_foreign_err_file; FILE* ef = dict_foreign_err_file;
trx_t* trx = thr_get_trx(thr);
mutex_enter(&dict_foreign_err_mutex); mutex_enter(&dict_foreign_err_mutex);
rewind(ef); rewind(ef);
ut_print_timestamp(ef); ut_print_timestamp(ef);
fputs(" Transaction:\n", ef); fputs(" Transaction:\n", ef);
trx_print(ef, thr_get_trx(thr)); trx_print(ef, trx);
fputs("Foreign key constraint fails for table ", ef); fputs("Foreign key constraint fails for table ", ef);
ut_print_name(ef, foreign->foreign_table_name); ut_print_name(ef, trx, foreign->foreign_table_name);
fputs(":\n", ef); fputs(":\n", ef);
dict_print_info_on_foreign_key_in_create_format(ef, foreign); dict_print_info_on_foreign_key_in_create_format(ef, trx, foreign);
putc('\n', ef); putc('\n', ef);
fputs(errstr, ef); fputs(errstr, ef);
fputs(" in parent table, in index ", ef); fputs(" in parent table, in index ", ef);
ut_print_name(ef, foreign->referenced_index->name); ut_print_name(ef, trx, foreign->referenced_index->name);
if (entry) { if (entry) {
fputs(" tuple:\n", ef); fputs(" tuple:\n", ef);
dtuple_print(ef, entry); dtuple_print(ef, entry);
} }
fputs("\nBut in child table ", ef); fputs("\nBut in child table ", ef);
ut_print_name(ef, foreign->foreign_table_name); ut_print_name(ef, trx, foreign->foreign_table_name);
fputs(", in index ", ef); fputs(", in index ", ef);
ut_print_name(ef, foreign->foreign_index->name); ut_print_name(ef, trx, foreign->foreign_index->name);
if (rec) { if (rec) {
fputs(", there is a record:\n", ef); fputs(", there is a record:\n", ef);
rec_print(ef, rec); rec_print(ef, rec);
@@ -612,19 +613,19 @@ row_ins_foreign_report_add_err(
fputs(" Transaction:\n", ef); fputs(" Transaction:\n", ef);
trx_print(ef, trx); trx_print(ef, trx);
fputs("Foreign key constraint fails for table ", ef); fputs("Foreign key constraint fails for table ", ef);
ut_print_name(ef, foreign->foreign_table_name); ut_print_name(ef, trx, foreign->foreign_table_name);
fputs(":\n", ef); fputs(":\n", ef);
dict_print_info_on_foreign_key_in_create_format(ef, foreign); dict_print_info_on_foreign_key_in_create_format(ef, trx, foreign);
fputs("\nTrying to add in child table, in index ", ef); fputs("\nTrying to add in child table, in index ", ef);
ut_print_name(ef, foreign->foreign_index->name); ut_print_name(ef, trx, foreign->foreign_index->name);
if (entry) { if (entry) {
fputs(" tuple:\n", ef); fputs(" tuple:\n", ef);
dtuple_print(ef, entry); dtuple_print(ef, entry);
} }
fputs("\nBut in parent table ", ef); fputs("\nBut in parent table ", ef);
ut_print_name(ef, foreign->referenced_table_name); ut_print_name(ef, trx, foreign->referenced_table_name);
fputs(", in index ", ef); fputs(", in index ", ef);
ut_print_name(ef, foreign->referenced_index->name); ut_print_name(ef, trx, foreign->referenced_index->name);
fputs(",\nthe closest match we can find is record:\n", ef); fputs(",\nthe closest match we can find is record:\n", ef);
if (rec && page_rec_is_supremum(rec)) { if (rec && page_rec_is_supremum(rec)) {
/* If the cursor ended on a supremum record, it is better /* If the cursor ended on a supremum record, it is better
@@ -704,11 +705,13 @@ row_ins_foreign_check_on_constraint(
ulint n_to_update; ulint n_to_update;
ulint err; ulint err;
ulint i; ulint i;
trx_t* trx;
ut_a(thr && foreign && pcur && mtr); ut_a(thr && foreign && pcur && mtr);
trx = thr_get_trx(thr);
/* Since we are going to delete or update a row, we have to invalidate /* Since we are going to delete or update a row, we have to invalidate
the MySQL query cache for table */ the MySQL query cache for table */
@@ -847,7 +850,7 @@ row_ins_foreign_check_on_constraint(
fputs( fputs(
"InnoDB: error in cascade of a foreign key op\n" "InnoDB: error in cascade of a foreign key op\n"
"InnoDB: ", stderr); "InnoDB: ", stderr);
dict_index_name_print(stderr, index); dict_index_name_print(stderr, trx, index);
fputs("\n" fputs("\n"
"InnoDB: record ", stderr); "InnoDB: record ", stderr);
@@ -1057,6 +1060,7 @@ row_ins_check_foreign_constraint(
ulint err; ulint err;
ulint i; ulint i;
mtr_t mtr; mtr_t mtr;
trx_t* trx = thr_get_trx(thr);
run_again: run_again:
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
@@ -1065,7 +1069,7 @@ run_again:
err = DB_SUCCESS; err = DB_SUCCESS;
if (thr_get_trx(thr)->check_foreigns == FALSE) { if (trx->check_foreigns == FALSE) {
/* The user has suppressed foreign key checks currently for /* The user has suppressed foreign key checks currently for
this session */ this session */
@@ -1123,18 +1127,18 @@ run_again:
rewind(ef); rewind(ef);
ut_print_timestamp(ef); ut_print_timestamp(ef);
fputs(" Transaction:\n", ef); fputs(" Transaction:\n", ef);
trx_print(ef, thr_get_trx(thr)); trx_print(ef, trx);
fputs("Foreign key constraint fails for table ", ef); fputs("Foreign key constraint fails for table ", ef);
ut_print_name(ef, foreign->foreign_table_name); ut_print_name(ef, trx, foreign->foreign_table_name);
fputs(":\n", ef); fputs(":\n", ef);
dict_print_info_on_foreign_key_in_create_format(ef, dict_print_info_on_foreign_key_in_create_format(ef,
foreign); trx, foreign);
fputs("\nTrying to add to index ", ef); fputs("\nTrying to add to index ", ef);
ut_print_name(ef, foreign->foreign_index->name); ut_print_name(ef, trx, foreign->foreign_index->name);
fputs(" tuple:\n", ef); fputs(" tuple:\n", ef);
dtuple_print(ef, entry); dtuple_print(ef, entry);
fputs("\nBut the parent table ", ef); fputs("\nBut the parent table ", ef);
ut_print_name(ef, foreign->referenced_table_name); ut_print_name(ef, trx, foreign->referenced_table_name);
fputs(" does not currently exist!\n", ef); fputs(" does not currently exist!\n", ef);
mutex_exit(&dict_foreign_err_mutex); mutex_exit(&dict_foreign_err_mutex);
@@ -1267,7 +1271,7 @@ run_again:
if (check_ref) { if (check_ref) {
err = DB_NO_REFERENCED_ROW; err = DB_NO_REFERENCED_ROW;
row_ins_foreign_report_add_err( row_ins_foreign_report_add_err(
thr_get_trx(thr), foreign, rec, entry); trx, foreign, rec, entry);
} else { } else {
err = DB_SUCCESS; err = DB_SUCCESS;
} }
@@ -1283,7 +1287,7 @@ next_rec:
if (check_ref) { if (check_ref) {
rec = btr_pcur_get_rec(&pcur); rec = btr_pcur_get_rec(&pcur);
row_ins_foreign_report_add_err( row_ins_foreign_report_add_err(
thr_get_trx(thr), foreign, rec, entry); trx, foreign, rec, entry);
err = DB_NO_REFERENCED_ROW; err = DB_NO_REFERENCED_ROW;
} else { } else {
err = DB_SUCCESS; err = DB_SUCCESS;
@@ -1302,18 +1306,18 @@ next_rec:
do_possible_lock_wait: do_possible_lock_wait:
if (err == DB_LOCK_WAIT) { if (err == DB_LOCK_WAIT) {
thr_get_trx(thr)->error_state = err; trx->error_state = err;
que_thr_stop_for_mysql(thr); que_thr_stop_for_mysql(thr);
srv_suspend_mysql_thread(thr); srv_suspend_mysql_thread(thr);
if (thr_get_trx(thr)->error_state == DB_SUCCESS) { if (trx->error_state == DB_SUCCESS) {
goto run_again; goto run_again;
} }
err = thr_get_trx(thr)->error_state; err = trx->error_state;
} }
return(err); return(err);

View File

@@ -457,7 +457,7 @@ row_prebuilt_free(
"InnoDB: table handle. Magic n %lu, magic n2 %lu, table name", "InnoDB: table handle. Magic n %lu, magic n2 %lu, table name",
(ulong) prebuilt->magic_n, (ulong) prebuilt->magic_n,
(ulong) prebuilt->magic_n2); (ulong) prebuilt->magic_n2);
ut_print_name(stderr, prebuilt->table->name); ut_print_name(stderr, NULL, prebuilt->table->name);
putc('\n', stderr); putc('\n', stderr);
mem_analyze_corruption((byte*)prebuilt); mem_analyze_corruption((byte*)prebuilt);
@@ -550,7 +550,7 @@ row_update_prebuilt_trx(
"InnoDB: Error: trying to use a corrupt\n" "InnoDB: Error: trying to use a corrupt\n"
"InnoDB: table handle. Magic n %lu, table name", "InnoDB: table handle. Magic n %lu, table name",
(ulong) prebuilt->magic_n); (ulong) prebuilt->magic_n);
ut_print_name(stderr, prebuilt->table->name); ut_print_name(stderr, NULL, prebuilt->table->name);
putc('\n', stderr); putc('\n', stderr);
mem_analyze_corruption((byte*)prebuilt); mem_analyze_corruption((byte*)prebuilt);
@@ -864,7 +864,7 @@ row_insert_for_mysql(
"InnoDB: Error: trying to free a corrupt\n" "InnoDB: Error: trying to free a corrupt\n"
"InnoDB: table handle. Magic n %lu, table name", "InnoDB: table handle. Magic n %lu, table name",
(ulong) prebuilt->magic_n); (ulong) prebuilt->magic_n);
ut_print_name(stderr, prebuilt->table->name); ut_print_name(stderr, prebuilt->trx, prebuilt->table->name);
putc('\n', stderr); putc('\n', stderr);
mem_analyze_corruption((byte*)prebuilt); mem_analyze_corruption((byte*)prebuilt);
@@ -1081,7 +1081,7 @@ row_update_for_mysql(
"InnoDB: Error: trying to free a corrupt\n" "InnoDB: Error: trying to free a corrupt\n"
"InnoDB: table handle. Magic n %lu, table name", "InnoDB: table handle. Magic n %lu, table name",
(ulong) prebuilt->magic_n); (ulong) prebuilt->magic_n);
ut_print_name(stderr, prebuilt->table->name); ut_print_name(stderr, prebuilt->trx, prebuilt->table->name);
putc('\n', stderr); putc('\n', stderr);
mem_analyze_corruption((byte*)prebuilt); mem_analyze_corruption((byte*)prebuilt);
@@ -1568,7 +1568,7 @@ row_create_table_for_mysql(
if (err == DB_OUT_OF_FILE_SPACE) { if (err == DB_OUT_OF_FILE_SPACE) {
fputs("InnoDB: Warning: cannot create table ", stderr); fputs("InnoDB: Warning: cannot create table ", stderr);
ut_print_name(stderr, table->name); ut_print_name(stderr, trx, table->name);
fputs(" because tablespace full\n", stderr); fputs(" because tablespace full\n", stderr);
row_drop_table_for_mysql(table->name, trx, FALSE); row_drop_table_for_mysql(table->name, trx, FALSE);
@@ -1576,7 +1576,7 @@ row_create_table_for_mysql(
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fputs(" InnoDB: Error: table ", stderr); fputs(" InnoDB: Error: table ", stderr);
ut_print_name(stderr, table->name); ut_print_name(stderr, trx, table->name);
fputs(" already exists in InnoDB internal\n" fputs(" already exists in InnoDB internal\n"
"InnoDB: data dictionary. Have you deleted the .frm file\n" "InnoDB: data dictionary. Have you deleted the .frm file\n"
"InnoDB: and not used DROP TABLE? Have you used DROP DATABASE\n" "InnoDB: and not used DROP TABLE? Have you used DROP DATABASE\n"
@@ -1643,10 +1643,10 @@ row_create_index_for_mysql(
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fputs(" InnoDB: Error: column ", stderr); fputs(" InnoDB: Error: column ", stderr);
ut_print_name(stderr, ut_print_name(stderr, trx,
dict_index_get_nth_field(index, i)->name); dict_index_get_nth_field(index, i)->name);
fputs(" appears twice in ", stderr); fputs(" appears twice in ", stderr);
dict_index_name_print(stderr, index); dict_index_name_print(stderr, trx, index);
fputs("\n" fputs("\n"
"InnoDB: This is not allowed in InnoDB.\n", "InnoDB: This is not allowed in InnoDB.\n",
stderr); stderr);
@@ -1795,7 +1795,7 @@ row_drop_table_for_mysql_in_background(
if (error != DB_SUCCESS) { if (error != DB_SUCCESS) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fputs(" InnoDB: Error: Dropping table ", stderr); fputs(" InnoDB: Error: Dropping table ", stderr);
ut_print_name(stderr, name); ut_print_name(stderr, trx, name);
fputs(" in background drop list failed\n", stderr); fputs(" in background drop list failed\n", stderr);
} }
@@ -1874,9 +1874,9 @@ already_dropped:
UT_LIST_REMOVE(row_mysql_drop_list, row_mysql_drop_list, drop); UT_LIST_REMOVE(row_mysql_drop_list, row_mysql_drop_list, drop);
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fputs(" InnoDB: Dropped table ", stderr); fprintf(stderr,
ut_print_name(stderr, drop->table_name); " InnoDB: Dropped table %s in background drop queue.\n",
fputs(" in background drop queue.\n", stderr); drop->table_name);
mem_free(drop->table_name); mem_free(drop->table_name);
@@ -2031,7 +2031,7 @@ row_discard_tablespace_for_mysql(
if (table->space == 0) { if (table->space == 0) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fputs(" InnoDB: Error: table ", stderr); fputs(" InnoDB: Error: table ", stderr);
ut_print_name(stderr, name); ut_print_name(stderr, trx, name);
fputs("\n" fputs("\n"
"InnoDB: is in the system tablespace 0 which cannot be discarded\n", stderr); "InnoDB: is in the system tablespace 0 which cannot be discarded\n", stderr);
err = DB_ERROR; err = DB_ERROR;
@@ -2165,7 +2165,7 @@ row_import_tablespace_for_mysql(
if (table->space == 0) { if (table->space == 0) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fputs(" InnoDB: Error: table ", stderr); fputs(" InnoDB: Error: table ", stderr);
ut_print_name(stderr, name); ut_print_name(stderr, trx, name);
fputs("\n" fputs("\n"
"InnoDB: is in the system tablespace 0 which cannot be imported\n", stderr); "InnoDB: is in the system tablespace 0 which cannot be imported\n", stderr);
err = DB_ERROR; err = DB_ERROR;
@@ -2178,7 +2178,7 @@ row_import_tablespace_for_mysql(
fputs( fputs(
" InnoDB: Error: you are trying to IMPORT a tablespace\n" " InnoDB: Error: you are trying to IMPORT a tablespace\n"
"InnoDB: ", stderr); "InnoDB: ", stderr);
ut_print_name(stderr, name); ut_print_name(stderr, trx, name);
fputs(", though you have not called DISCARD on it yet\n" fputs(", though you have not called DISCARD on it yet\n"
"InnoDB: during the lifetime of the mysqld process!\n", stderr); "InnoDB: during the lifetime of the mysqld process!\n", stderr);
@@ -2395,7 +2395,7 @@ row_drop_table_for_mysql(
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fputs(" InnoDB: Error: table ", stderr); fputs(" InnoDB: Error: table ", stderr);
ut_print_name(stderr, name); ut_print_name(stderr, trx, name);
fputs(" does not exist in the InnoDB internal\n" fputs(" does not exist in the InnoDB internal\n"
"InnoDB: data dictionary though MySQL is trying to drop it.\n" "InnoDB: data dictionary though MySQL is trying to drop it.\n"
"InnoDB: Have you copied the .frm file of the table to the\n" "InnoDB: Have you copied the .frm file of the table to the\n"
@@ -2429,10 +2429,10 @@ row_drop_table_for_mysql(
ut_print_timestamp(ef); ut_print_timestamp(ef);
fputs(" Cannot drop table ", ef); fputs(" Cannot drop table ", ef);
ut_print_name(ef, name); ut_print_name(ef, trx, name);
fputs("\n" fputs("\n"
"because it is referenced by ", ef); "because it is referenced by ", ef);
ut_print_name(ef, foreign->foreign_table_name); ut_print_name(ef, trx, foreign->foreign_table_name);
putc('\n', ef); putc('\n', ef);
mutex_exit(&dict_foreign_err_mutex); mutex_exit(&dict_foreign_err_mutex);
@@ -2444,7 +2444,7 @@ row_drop_table_for_mysql(
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fputs(" InnoDB: Warning: MySQL is trying to drop table ", fputs(" InnoDB: Warning: MySQL is trying to drop table ",
stderr); stderr);
ut_print_name(stderr, table->name); ut_print_name(stderr, trx, table->name);
fputs("\n" fputs("\n"
"InnoDB: though there are still open handles to it.\n" "InnoDB: though there are still open handles to it.\n"
"InnoDB: Adding the table to the background drop queue.\n", "InnoDB: Adding the table to the background drop queue.\n",
@@ -2461,7 +2461,7 @@ row_drop_table_for_mysql(
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fputs(" InnoDB: You are trying to drop table ", stderr); fputs(" InnoDB: You are trying to drop table ", stderr);
ut_print_name(stderr, table->name); ut_print_name(stderr, trx, table->name);
fputs("\n" fputs("\n"
"InnoDB: though there are foreign key check running on it.\n" "InnoDB: though there are foreign key check running on it.\n"
"InnoDB: Adding the table to the background drop queue.\n", "InnoDB: Adding the table to the background drop queue.\n",
@@ -2503,7 +2503,7 @@ row_drop_table_for_mysql(
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fputs(" InnoDB: Error: not able to remove table ", fputs(" InnoDB: Error: not able to remove table ",
stderr); stderr);
ut_print_name(stderr, name); ut_print_name(stderr, trx, name);
fputs(" from the dictionary cache!\n", stderr); fputs(" from the dictionary cache!\n", stderr);
err = DB_ERROR; err = DB_ERROR;
} }
@@ -2526,7 +2526,7 @@ row_drop_table_for_mysql(
fprintf(stderr, fprintf(stderr,
" InnoDB: Error: not able to delete tablespace %lu of table ", " InnoDB: Error: not able to delete tablespace %lu of table ",
(ulong) space_id); (ulong) space_id);
ut_print_name(stderr, name); ut_print_name(stderr, trx, name);
fputs("!\n", stderr); fputs("!\n", stderr);
err = DB_ERROR; err = DB_ERROR;
} }
@@ -2590,10 +2590,10 @@ loop:
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fputs( fputs(
" InnoDB: Warning: MySQL is trying to drop database ", stderr); " InnoDB: Warning: MySQL is trying to drop database ", stderr);
ut_print_name(stderr, name); ut_print_name(stderr, trx, name);
fputs("\n" fputs("\n"
"InnoDB: though there are still open handles to table ", stderr); "InnoDB: though there are still open handles to table ", stderr);
ut_print_name(stderr, table_name); ut_print_name(stderr, trx, table_name);
fputs(".\n", stderr); fputs(".\n", stderr);
os_thread_sleep(1000000); os_thread_sleep(1000000);
@@ -2609,10 +2609,10 @@ loop:
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
fputs("InnoDB: DROP DATABASE ", stderr); fputs("InnoDB: DROP DATABASE ", stderr);
ut_print_name(stderr, name); ut_print_name(stderr, trx, name);
fprintf(stderr, " failed with error %lu for table ", fprintf(stderr, " failed with error %lu for table ",
(ulint) err); (ulint) err);
ut_print_name(stderr, table_name); ut_print_name(stderr, trx, table_name);
putc('\n', stderr); putc('\n', stderr);
break; break;
} }
@@ -2793,7 +2793,7 @@ row_rename_table_for_mysql(
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fputs(" InnoDB: Error: table ", stderr); fputs(" InnoDB: Error: table ", stderr);
ut_print_name(stderr, old_name); ut_print_name(stderr, trx, old_name);
fputs(" does not exist in the InnoDB internal\n" fputs(" does not exist in the InnoDB internal\n"
"InnoDB: data dictionary though MySQL is trying to rename the table.\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: Have you copied the .frm file of the table to the\n"
@@ -2808,7 +2808,7 @@ row_rename_table_for_mysql(
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fputs(" InnoDB: Error: table ", stderr); fputs(" InnoDB: Error: table ", stderr);
ut_print_name(stderr, old_name); ut_print_name(stderr, trx, old_name);
fputs( fputs(
" does not have an .ibd file in the database directory.\n" " 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: You can look for further help from section 15.1 of\n"
@@ -2940,16 +2940,16 @@ row_rename_table_for_mysql(
if (err == DB_DUPLICATE_KEY) { if (err == DB_DUPLICATE_KEY) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fputs(" InnoDB: Error: table ", stderr); fputs(" InnoDB: Error: table ", stderr);
ut_print_name(stderr, new_name); ut_print_name(stderr, trx, new_name);
fputs(" exists in the InnoDB internal data\n" fputs(" exists in the InnoDB internal data\n"
"InnoDB: dictionary though MySQL is trying rename table ", stderr); "InnoDB: dictionary though MySQL is trying rename table ", stderr);
ut_print_name(stderr, old_name); ut_print_name(stderr, trx, old_name);
fputs(" to it.\n" fputs(" to it.\n"
"InnoDB: Have you deleted the .frm file and not used DROP TABLE?\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: You can look for further help from section 15.1 of\n"
"InnoDB: http://www.innodb.com/ibman.php\n" "InnoDB: http://www.innodb.com/ibman.php\n"
"InnoDB: If table ", stderr); "InnoDB: If table ", stderr);
ut_print_name(stderr, new_name); ut_print_name(stderr, trx, new_name);
fputs(" is a temporary table #sql..., then it can be that\n" 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: there are still queries running on the table, and it will be\n"
"InnoDB: dropped automatically when the queries end.\n" "InnoDB: dropped automatically when the queries end.\n"
@@ -2975,9 +2975,9 @@ row_rename_table_for_mysql(
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fputs(" InnoDB: Error in table rename, cannot rename ", fputs(" InnoDB: Error in table rename, cannot rename ",
stderr); stderr);
ut_print_name(stderr, old_name); ut_print_name(stderr, trx, old_name);
fputs(" to ", stderr); fputs(" to ", stderr);
ut_print_name(stderr, new_name); ut_print_name(stderr, trx, new_name);
putc('\n', stderr); putc('\n', stderr);
err = DB_ERROR; err = DB_ERROR;
@@ -2999,14 +2999,14 @@ row_rename_table_for_mysql(
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fputs(" InnoDB: Error: in ALTER TABLE ", fputs(" InnoDB: Error: in ALTER TABLE ",
stderr); stderr);
ut_print_name(stderr, new_name); ut_print_name(stderr, trx, new_name);
fputs("\n" fputs("\n"
"InnoDB: has or is referenced in foreign key constraints\n" "InnoDB: has or is referenced in foreign key constraints\n"
"InnoDB: which are not compatible with the new table definition.\n", "InnoDB: which are not compatible with the new table definition.\n",
stderr); stderr);
ut_a(dict_table_rename_in_cache(table, ut_a(dict_table_rename_in_cache(table,
old_name, FALSE)); old_name, FALSE));
trx->error_state = DB_SUCCESS; trx->error_state = DB_SUCCESS;
trx_general_rollback_for_mysql(trx, FALSE, trx_general_rollback_for_mysql(trx, FALSE,
NULL); NULL);
@@ -3022,14 +3022,14 @@ row_rename_table_for_mysql(
fputs( fputs(
" InnoDB: Error: in RENAME TABLE table ", " InnoDB: Error: in RENAME TABLE table ",
stderr); stderr);
ut_print_name(stderr, new_name); ut_print_name(stderr, trx, new_name);
fputs("\n" fputs("\n"
"InnoDB: is referenced in foreign key constraints\n" "InnoDB: is referenced in foreign key constraints\n"
"InnoDB: which are not compatible with the new table definition.\n", "InnoDB: which are not compatible with the new table definition.\n",
stderr); stderr);
ut_a(dict_table_rename_in_cache(table, ut_a(dict_table_rename_in_cache(table,
old_name, FALSE)); old_name, FALSE));
trx->error_state = DB_SUCCESS; trx->error_state = DB_SUCCESS;
trx_general_rollback_for_mysql(trx, FALSE, trx_general_rollback_for_mysql(trx, FALSE,
@@ -3146,7 +3146,8 @@ loop:
fputs("InnoDB: index records in a wrong order in ", fputs("InnoDB: index records in a wrong order in ",
stderr); stderr);
not_ok: not_ok:
dict_index_name_print(stderr, index); dict_index_name_print(stderr,
prebuilt->trx, index);
fputs("\n" fputs("\n"
"InnoDB: prev record ", stderr); "InnoDB: prev record ", stderr);
dtuple_print(stderr, prev_entry); dtuple_print(stderr, prev_entry);
@@ -3232,7 +3233,8 @@ row_check_table_for_mysql(
ret = DB_ERROR; ret = DB_ERROR;
fputs("Error: ", stderr); fputs("Error: ", stderr);
dict_index_name_print(stderr, index); dict_index_name_print(stderr,
prebuilt->trx, index);
fprintf(stderr, fprintf(stderr,
" contains %lu entries, should be %lu\n", " contains %lu entries, should be %lu\n",
(ulong) n_rows, (ulong) n_rows,

View File

@@ -543,8 +543,8 @@ row_purge_parse_undo_rec(
node->heap); node->heap);
ptr = trx_undo_update_rec_get_update(ptr, clust_index, type, trx_id, ptr = trx_undo_update_rec_get_update(ptr, clust_index, type, trx_id,
roll_ptr, info_bits, node->heap, roll_ptr, info_bits, trx,
&(node->update)); node->heap, &(node->update));
/* Read to the partial row the fields that occur in indexes */ /* Read to the partial row the fields that occur in indexes */

View File

@@ -383,12 +383,13 @@ row_build_row_ref_in_tuple(
dtuple_t* ref, /* in/out: row reference built; see the dtuple_t* ref, /* in/out: row reference built; see the
NOTE below! */ NOTE below! */
dict_index_t* index, /* in: index */ dict_index_t* index, /* in: index */
rec_t* rec) /* in: record in the index; rec_t* rec, /* in: record in the index;
NOTE: the data fields in ref will point NOTE: the data fields in ref will point
directly into this record, therefore, directly into this record, therefore,
the buffer page of this record must be the buffer page of this record must be
at least s-latched and the latch held at least s-latched and the latch held
as long as the row reference is used! */ as long as the row reference is used! */
trx_t* trx) /* in: transaction */
{ {
dict_index_t* clust_index; dict_index_t* clust_index;
dfield_t* dfield; dfield_t* dfield;
@@ -403,9 +404,9 @@ row_build_row_ref_in_tuple(
if (!index->table) { if (!index->table) {
fputs("InnoDB: table ", stderr); fputs("InnoDB: table ", stderr);
notfound: notfound:
ut_print_name(stderr, index->table_name); ut_print_name(stderr, trx, index->table_name);
fputs(" for index ", stderr); fputs(" for index ", stderr);
ut_print_name(stderr, index->name); ut_print_name(stderr, trx, index->name);
fputs(" not found\n", stderr); fputs(" not found\n", stderr);
ut_error; ut_error;
} }

View File

@@ -1942,7 +1942,8 @@ row_sel_convert_mysql_key_to_innobase(
ulint buf_len, /* in: buffer length */ ulint buf_len, /* in: buffer length */
dict_index_t* index, /* in: index of the key value */ dict_index_t* index, /* in: index of the key value */
byte* key_ptr, /* in: MySQL key value */ byte* key_ptr, /* in: MySQL key value */
ulint key_len) /* in: MySQL key value length */ ulint key_len, /* in: MySQL key value length */
trx_t* trx) /* in: transaction */
{ {
byte* original_buf = buf; byte* original_buf = buf;
byte* original_key_ptr = key_ptr; byte* original_key_ptr = key_ptr;
@@ -2025,7 +2026,7 @@ row_sel_convert_mysql_key_to_innobase(
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fputs( fputs(
" InnoDB: Error: BLOB or TEXT prefix > 255 bytes in query to table ", stderr); " InnoDB: Error: BLOB or TEXT prefix > 255 bytes in query to table ", stderr);
ut_print_name(stderr, index->table_name); ut_print_name(stderr, trx, index->table_name);
putc('\n', stderr); putc('\n', stderr);
} }
@@ -2069,11 +2070,13 @@ row_sel_convert_mysql_key_to_innobase(
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fputs(
" InnoDB: Warning: using a partial-field key prefix in search.\n" " InnoDB: Warning: using a partial-field key prefix in search.\n"
"InnoDB: Table name %s, index name %s. Last data field length %lu bytes,\n" "InnoDB: ", stderr);
dict_index_name_print(stderr, trx, index);
fprintf(stderr, ". Last data field length %lu bytes,\n"
"InnoDB: key ptr now exceeds key end by %lu bytes.\n" "InnoDB: key ptr now exceeds key end by %lu bytes.\n"
"InnoDB: Key value in the MySQL format:\n", index->table_name, index->name, "InnoDB: Key value in the MySQL format:\n",
(ulong) data_field_len, (ulong) data_field_len,
(ulong) (key_ptr - key_end)); (ulong) (key_ptr - key_end));
fflush(stderr); fflush(stderr);
@@ -2116,7 +2119,7 @@ row_sel_store_row_id_to_prebuilt(
if (len != DATA_ROW_ID_LEN) { if (len != DATA_ROW_ID_LEN) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: Row id field is wrong length %lu in ", (ulong) len); "InnoDB: Error: Row id field is wrong length %lu in ", (ulong) len);
dict_index_name_print(stderr, index); dict_index_name_print(stderr, prebuilt->trx, index);
fprintf(stderr, "\n" fprintf(stderr, "\n"
"InnoDB: Field number %lu, record:\n", "InnoDB: Field number %lu, record:\n",
(ulong) dict_index_get_sys_col_pos(index, DATA_ROW_ID)); (ulong) dict_index_get_sys_col_pos(index, DATA_ROW_ID));
@@ -2275,7 +2278,11 @@ row_sel_store_mysql_rec(
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: Warning: could not allocate %lu + 1000000 bytes to retrieve\n" " InnoDB: Warning: could not allocate %lu + 1000000 bytes to retrieve\n"
"InnoDB: a big column. Table name %s\n", (ulong) len, prebuilt->table->name); "InnoDB: a big column. Table name ", (ulong) len);
ut_print_name(stderr,
prebuilt->trx,
prebuilt->table->name);
putc('\n', stderr);
if (extern_field_heap) { if (extern_field_heap) {
mem_heap_free( mem_heap_free(
@@ -2407,8 +2414,9 @@ row_sel_get_clust_rec_for_mysql(
trx_t* trx; trx_t* trx;
*out_rec = NULL; *out_rec = NULL;
trx = thr_get_trx(thr);
row_build_row_ref_in_tuple(prebuilt->clust_ref, sec_index, rec); row_build_row_ref_in_tuple(prebuilt->clust_ref, sec_index, rec, trx);
clust_index = dict_table_get_first_index(sec_index->table); clust_index = dict_table_get_first_index(sec_index->table);
@@ -2441,7 +2449,7 @@ row_sel_get_clust_rec_for_mysql(
fputs(" InnoDB: error clustered record" fputs(" InnoDB: error clustered record"
" for sec rec not found\n" " for sec rec not found\n"
"InnoDB: ", stderr); "InnoDB: ", stderr);
dict_index_name_print(stderr, sec_index); dict_index_name_print(stderr, trx, sec_index);
fputs("\n" fputs("\n"
"InnoDB: sec index record ", stderr); "InnoDB: sec index record ", stderr);
rec_print(stderr, rec); rec_print(stderr, rec);
@@ -2449,7 +2457,7 @@ row_sel_get_clust_rec_for_mysql(
"InnoDB: clust index record ", stderr); "InnoDB: clust index record ", stderr);
rec_print(stderr, clust_rec); rec_print(stderr, clust_rec);
putc('\n', stderr); putc('\n', stderr);
trx_print(stderr, thr_get_trx(thr)); trx_print(stderr, trx);
fputs("\n" fputs("\n"
"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n", stderr); "InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n", stderr);
@@ -2477,8 +2485,6 @@ row_sel_get_clust_rec_for_mysql(
/* This is a non-locking consistent read: if necessary, fetch /* This is a non-locking consistent read: if necessary, fetch
a previous version of the record */ a previous version of the record */
trx = thr_get_trx(thr);
old_vers = NULL; old_vers = NULL;
/* If the isolation level allows reading of uncommitted data, /* If the isolation level allows reading of uncommitted data,
@@ -2803,7 +2809,7 @@ row_search_for_mysql(
"InnoDB: Error: trying to free a corrupt\n" "InnoDB: Error: trying to free a corrupt\n"
"InnoDB: table handle. Magic n %lu, table name ", "InnoDB: table handle. Magic n %lu, table name ",
(ulong) prebuilt->magic_n); (ulong) prebuilt->magic_n);
ut_print_name(stderr, prebuilt->table->name); ut_print_name(stderr, trx, prebuilt->table->name);
putc('\n', stderr); putc('\n', stderr);
mem_analyze_corruption((byte*)prebuilt); mem_analyze_corruption((byte*)prebuilt);
@@ -3237,7 +3243,7 @@ rec_loop:
(ulong) (rec - buf_frame_align(rec)), (ulong) (rec - buf_frame_align(rec)),
(ulong) next_offs, (ulong) next_offs,
(ulong) buf_frame_get_page_no(rec)); (ulong) buf_frame_get_page_no(rec));
dict_index_name_print(stderr, index); dict_index_name_print(stderr, trx, index);
fputs(". Run CHECK TABLE. You may need to\n" fputs(". Run CHECK TABLE. You may need to\n"
"InnoDB: restore from a backup, or dump + drop + reimport the table.\n", "InnoDB: restore from a backup, or dump + drop + reimport the table.\n",
stderr); stderr);
@@ -3255,7 +3261,7 @@ rec_loop:
(ulong) (rec - buf_frame_align(rec)), (ulong) (rec - buf_frame_align(rec)),
(ulong) next_offs, (ulong) next_offs,
(ulong) buf_frame_get_page_no(rec)); (ulong) buf_frame_get_page_no(rec));
dict_index_name_print(stderr, index); dict_index_name_print(stderr, trx, index);
fputs(". We try to skip the rest of the page.\n", fputs(". We try to skip the rest of the page.\n",
stderr); stderr);
@@ -3274,7 +3280,7 @@ rec_loop:
(ulong) (rec - buf_frame_align(rec)), (ulong) (rec - buf_frame_align(rec)),
(ulong) next_offs, (ulong) next_offs,
(ulong) buf_frame_get_page_no(rec)); (ulong) buf_frame_get_page_no(rec));
dict_index_name_print(stderr, index); dict_index_name_print(stderr, trx, index);
fputs(". We try to skip the record.\n", fputs(". We try to skip the record.\n",
stderr); stderr);

View File

@@ -422,6 +422,7 @@ row_undo_mod_del_unmark_sec_and_undo_update(
ibool found; 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);
log_free_check(); log_free_check();
mtr_start(&mtr); mtr_start(&mtr);
@@ -431,7 +432,7 @@ row_undo_mod_del_unmark_sec_and_undo_update(
if (!found) { if (!found) {
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, index); dict_index_name_print(stderr, trx, index);
fputs("\n" fputs("\n"
"InnoDB: tuple ", stderr); "InnoDB: tuple ", stderr);
dtuple_print(stderr, entry); dtuple_print(stderr, entry);
@@ -439,7 +440,7 @@ row_undo_mod_del_unmark_sec_and_undo_update(
"InnoDB: record ", stderr); "InnoDB: record ", stderr);
rec_print(stderr, btr_pcur_get_rec(&pcur)); rec_print(stderr, btr_pcur_get_rec(&pcur));
putc('\n', stderr); putc('\n', stderr);
trx_print(stderr, thr_get_trx(thr)); trx_print(stderr, trx);
fputs("\n" fputs("\n"
"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n", stderr); "InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n", stderr);
} else { } else {
@@ -451,7 +452,7 @@ row_undo_mod_del_unmark_sec_and_undo_update(
heap = mem_heap_create(100); heap = mem_heap_create(100);
update = row_upd_build_sec_rec_difference_binary(index, entry, update = row_upd_build_sec_rec_difference_binary(index, entry,
btr_cur_get_rec(btr_cur), heap); btr_cur_get_rec(btr_cur), trx, heap);
if (upd_get_n_fields(update) == 0) { if (upd_get_n_fields(update) == 0) {
/* Do nothing */ /* Do nothing */
@@ -671,14 +672,15 @@ row_undo_mod_parse_undo_rec(
ulint type; ulint type;
ulint cmpl_info; ulint cmpl_info;
ibool dummy_extern; ibool dummy_extern;
trx_t* trx;
ut_ad(node && thr); ut_ad(node && thr);
trx = thr_get_trx(thr);
ptr = trx_undo_rec_get_pars(node->undo_rec, &type, &cmpl_info, ptr = trx_undo_rec_get_pars(node->undo_rec, &type, &cmpl_info,
&dummy_extern, &undo_no, &table_id); &dummy_extern, &undo_no, &table_id);
node->rec_type = type; node->rec_type = type;
node->table = dict_table_get_on_id(table_id, thr_get_trx(thr)); node->table = dict_table_get_on_id(table_id, trx);
/* TODO: other fixes associated with DROP TABLE + rollback in the /* TODO: other fixes associated with DROP TABLE + rollback in the
same table by another user */ same table by another user */
@@ -704,8 +706,8 @@ row_undo_mod_parse_undo_rec(
node->heap); node->heap);
trx_undo_update_rec_get_update(ptr, clust_index, type, trx_id, trx_undo_update_rec_get_update(ptr, clust_index, type, trx_id,
roll_ptr, info_bits, node->heap, roll_ptr, info_bits, trx,
&(node->update)); node->heap, &(node->update));
node->new_roll_ptr = roll_ptr; node->new_roll_ptr = roll_ptr;
node->new_trx_id = trx_id; node->new_trx_id = trx_id;
node->cmpl_info = cmpl_info; node->cmpl_info = cmpl_info;

View File

@@ -685,6 +685,7 @@ row_upd_build_sec_rec_difference_binary(
dict_index_t* index, /* in: index */ dict_index_t* index, /* in: index */
dtuple_t* entry, /* in: entry to insert */ dtuple_t* entry, /* in: entry to insert */
rec_t* rec, /* in: secondary index record */ rec_t* rec, /* in: secondary index record */
trx_t* trx, /* in: transaction */
mem_heap_t* heap) /* in: memory heap from which allocated */ mem_heap_t* heap) /* in: memory heap from which allocated */
{ {
upd_field_t* upd_field; upd_field_t* upd_field;
@@ -725,7 +726,7 @@ row_upd_build_sec_rec_difference_binary(
dfield_copy(&(upd_field->new_val), dfield); dfield_copy(&(upd_field->new_val), dfield);
upd_field_set_field_no(upd_field, i, index); upd_field_set_field_no(upd_field, i, index, trx);
upd_field->extern_storage = FALSE; upd_field->extern_storage = FALSE;
@@ -754,6 +755,7 @@ row_upd_build_difference_binary(
externally stored fields in entry, or NULL */ externally stored fields in entry, or NULL */
ulint n_ext_vec,/* in: number of fields in ext_vec */ ulint n_ext_vec,/* in: number of fields in ext_vec */
rec_t* rec, /* in: clustered index record */ rec_t* rec, /* in: clustered index record */
trx_t* trx, /* in: transaction */
mem_heap_t* heap) /* in: memory heap from which allocated */ mem_heap_t* heap) /* in: memory heap from which allocated */
{ {
upd_field_t* upd_field; upd_field_t* upd_field;
@@ -800,7 +802,7 @@ row_upd_build_difference_binary(
dfield_copy(&(upd_field->new_val), dfield); dfield_copy(&(upd_field->new_val), dfield);
upd_field_set_field_no(upd_field, i, index); upd_field_set_field_no(upd_field, i, index, trx);
if (upd_ext_vec_contains(ext_vec, n_ext_vec, i)) { if (upd_ext_vec_contains(ext_vec, n_ext_vec, i)) {
upd_field->extern_storage = TRUE; upd_field->extern_storage = TRUE;
@@ -1200,10 +1202,11 @@ row_upd_sec_index_entry(
rec_t* rec; rec_t* rec;
ulint err = DB_SUCCESS; ulint err = DB_SUCCESS;
mtr_t mtr; mtr_t mtr;
trx_t* trx = thr_get_trx(thr);
index = node->index; index = node->index;
check_ref = row_upd_index_is_referenced(index, thr_get_trx(thr)); check_ref = row_upd_index_is_referenced(index, trx);
heap = mem_heap_create(1024); heap = mem_heap_create(1024);
@@ -1222,7 +1225,7 @@ row_upd_sec_index_entry(
if (!found) { if (!found) {
fputs("InnoDB: error in sec index entry update in\n" fputs("InnoDB: error in sec index entry update in\n"
"InnoDB: ", stderr); "InnoDB: ", stderr);
dict_index_name_print(stderr, index); dict_index_name_print(stderr, trx, index);
fputs("\n" fputs("\n"
"InnoDB: tuple ", stderr); "InnoDB: tuple ", stderr);
dtuple_print(stderr, entry); dtuple_print(stderr, entry);
@@ -1231,7 +1234,7 @@ row_upd_sec_index_entry(
rec_print(stderr, rec); rec_print(stderr, rec);
putc('\n', stderr); putc('\n', stderr);
trx_print(stderr, thr_get_trx(thr)); trx_print(stderr, trx);
fputs("\n" fputs("\n"
"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n", stderr); "InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n", stderr);

View File

@@ -770,6 +770,7 @@ trx_undo_update_rec_get_update(
dulint trx_id, /* in: transaction id from this undo record */ dulint trx_id, /* in: transaction id from this undo record */
dulint roll_ptr,/* in: roll pointer from this undo record */ dulint roll_ptr,/* in: roll pointer from this undo record */
ulint info_bits,/* in: info bits from this undo record */ ulint info_bits,/* in: info bits from this undo record */
trx_t* trx, /* in: transaction */
mem_heap_t* heap, /* in: memory heap from which the memory mem_heap_t* heap, /* in: memory heap from which the memory
needed is allocated */ needed is allocated */
upd_t** upd) /* out, own: update vector */ upd_t** upd) /* out, own: update vector */
@@ -803,7 +804,7 @@ trx_undo_update_rec_get_update(
upd_field_set_field_no(upd_field, upd_field_set_field_no(upd_field,
dict_index_get_sys_col_pos(index, DATA_TRX_ID), dict_index_get_sys_col_pos(index, DATA_TRX_ID),
index); index, trx);
dfield_set_data(&(upd_field->new_val), buf, DATA_TRX_ID_LEN); dfield_set_data(&(upd_field->new_val), buf, DATA_TRX_ID_LEN);
upd_field = upd_get_nth_field(update, n_fields + 1); upd_field = upd_get_nth_field(update, n_fields + 1);
@@ -812,7 +813,7 @@ trx_undo_update_rec_get_update(
upd_field_set_field_no(upd_field, upd_field_set_field_no(upd_field,
dict_index_get_sys_col_pos(index, DATA_ROLL_PTR), dict_index_get_sys_col_pos(index, DATA_ROLL_PTR),
index); index, trx);
dfield_set_data(&(upd_field->new_val), buf, DATA_ROLL_PTR_LEN); dfield_set_data(&(upd_field->new_val), buf, DATA_ROLL_PTR_LEN);
/* Store then the updated ordinary columns to the update vector */ /* Store then the updated ordinary columns to the update vector */
@@ -824,13 +825,13 @@ trx_undo_update_rec_get_update(
if (field_no >= dict_index_get_n_fields(index)) { if (field_no >= dict_index_get_n_fields(index)) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: trying to access update undo rec field %lu in ", (ulong) field_no); "InnoDB: Error: trying to access update undo rec field %lu in ", (ulong) field_no);
dict_index_name_print(stderr, index); dict_index_name_print(stderr, trx, index);
fprintf(stderr, "\n" fprintf(stderr, "\n"
"InnoDB: but index has only %lu fields\n" "InnoDB: but index has only %lu fields\n"
"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n" "InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n"
"InnoDB: Run also CHECK TABLE ", "InnoDB: Run also CHECK TABLE ",
(ulong) dict_index_get_n_fields(index)); (ulong) dict_index_get_n_fields(index));
ut_print_name(stderr, index->table_name); ut_print_name(stderr, trx, index->table_name);
fprintf(stderr, "\n" fprintf(stderr, "\n"
"InnoDB: n_fields = %lu, i = %lu, ptr %p\n", "InnoDB: n_fields = %lu, i = %lu, ptr %p\n",
(ulong) n_fields, (ulong) i, ptr); (ulong) n_fields, (ulong) i, ptr);
@@ -841,7 +842,7 @@ trx_undo_update_rec_get_update(
upd_field = upd_get_nth_field(update, i); upd_field = upd_get_nth_field(update, i);
upd_field_set_field_no(upd_field, field_no, index); upd_field_set_field_no(upd_field, field_no, index, trx);
if (len != UNIV_SQL_NULL && len >= UNIV_EXTERN_STORAGE_FIELD) { if (len != UNIV_SQL_NULL && len >= UNIV_EXTERN_STORAGE_FIELD) {
@@ -1266,12 +1267,11 @@ trx_undo_prev_version_build(
mtr_memo_contains(index_mtr, buf_block_align(index_rec), mtr_memo_contains(index_mtr, buf_block_align(index_rec),
MTR_MEMO_PAGE_X_FIX)); MTR_MEMO_PAGE_X_FIX));
if (!(index->type & DICT_CLUSTERED)) { if (!(index->type & DICT_CLUSTERED)) {
fputs("InnoDB: Error: trying to access" fprintf(stderr, "InnoDB: Error: trying to access"
" update undo rec for non-clustered ", stderr); " update undo rec for non-clustered index %s\n"
dict_index_name_print(stderr, index); "InnoDB: Submit a detailed bug report to"
fputs("\n" " http://bugs.mysql.com\n"
"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n" "InnoDB: index record ", index->name);
"InnoDB: index record ", stderr);
rec_print(stderr, index_rec); rec_print(stderr, index_rec);
fputs("\n" fputs("\n"
"InnoDB: record version ", stderr); "InnoDB: record version ", stderr);
@@ -1309,32 +1309,29 @@ trx_undo_prev_version_build(
ptr = trx_undo_rec_skip_row_ref(ptr, index); ptr = trx_undo_rec_skip_row_ref(ptr, index);
ptr = trx_undo_update_rec_get_update(ptr, index, type, trx_id, ptr = trx_undo_update_rec_get_update(ptr, index, type, trx_id,
roll_ptr, info_bits, heap, &update); roll_ptr, info_bits, NULL, heap, &update);
if (ut_dulint_cmp(table_id, index->table->id) != 0) { if (ut_dulint_cmp(table_id, index->table->id) != 0) {
ptr = NULL; ptr = NULL;
fputs("InnoDB: Error: trying to access" fprintf(stderr,
" update undo rec for table ", stderr); "InnoDB: Error: trying to access update undo rec for table %s\n"
ut_print_name(stderr, index->table_name);
fputs("\n"
"InnoDB: but the table id in the undo record is wrong\n" "InnoDB: but the table id in the undo record is wrong\n"
"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n" "InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n"
"InnoDB: Run also CHECK TABLE ", stderr); "InnoDB: Run also CHECK TABLE %s\n",
ut_print_name(stderr, index->table_name); index->table_name, index->table_name);
putc('\n', stderr);
} }
if (ptr == NULL) { if (ptr == NULL) {
/* The record was corrupted, return an error; these printfs /* The record was corrupted, return an error; these printfs
should catch an elusive bug in row_vers_old_has_index_entry */ should catch an elusive bug in row_vers_old_has_index_entry */
fputs("InnoDB: ", stderr); fprintf(stderr,
dict_index_name_print(stderr, index); "InnoDB: table %s, index %s, n_uniq %lu\n"
fprintf(stderr, ", n_uniq %lu\n"
"InnoDB: undo rec address %p, type %lu cmpl_info %lu\n" "InnoDB: undo rec address %p, type %lu cmpl_info %lu\n"
"InnoDB: undo rec table id %lu %lu, index table id %lu %lu\n" "InnoDB: undo rec table id %lu %lu, index table id %lu %lu\n"
"InnoDB: dump of 150 bytes in undo rec: ", "InnoDB: dump of 150 bytes in undo rec: ",
index->table_name, index->name,
(ulong) dict_index_get_n_unique(index), (ulong) dict_index_get_n_unique(index),
undo_rec, (ulong) type, (ulong) cmpl_info, undo_rec, (ulong) type, (ulong) cmpl_info,
(ulong) ut_dulint_get_high(table_id), (ulong) ut_dulint_get_high(table_id),

View File

@@ -229,7 +229,7 @@ trx_rollback_to_savepoint_for_mysql(
if (trx->conc_state == TRX_NOT_STARTED) { if (trx->conc_state == TRX_NOT_STARTED) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fputs(" InnoDB: Error: transaction has a savepoint ", stderr); fputs(" InnoDB: Error: transaction has a savepoint ", stderr);
ut_print_name(stderr, savep->name); ut_print_name(stderr, trx, savep->name);
fputs(" though it is not started\n", stderr); fputs(" though it is not started\n", stderr);
return(DB_ERROR); return(DB_ERROR);
} }
@@ -467,7 +467,7 @@ loop:
if (table) { if (table) {
fputs("InnoDB: Table found: dropping table ", stderr); fputs("InnoDB: Table found: dropping table ", stderr);
ut_print_name(stderr, table->name); ut_print_name(stderr, trx, table->name);
fputs(" in recovery\n", stderr); fputs(" in recovery\n", stderr);
err = row_drop_table_for_mysql(table->name, trx, TRUE); err = row_drop_table_for_mysql(table->name, trx, TRUE);

View File

@@ -16,18 +16,22 @@ Created 5/11/1994 Heikki Tuuri
#include <string.h> #include <string.h>
#include "ut0sort.h" #include "ut0sort.h"
#include "trx0trx.h"
ibool ut_always_false = FALSE; ibool ut_always_false = FALSE;
/********************************************************************* /*********************************************************************
Get the quote character to be used in SQL identifiers. Get the quote character to be used in SQL identifiers.
This definition must match the one in sql/ha_innodb.cc! */ This definition must match the one in sql/ha_innodb.cc! */
extern
char int
mysql_get_identifier_quote_char(void); mysql_get_identifier_quote_char(
/*=================================*/ /*============================*/
/* out: quote character to be /* out: quote character to be
used in SQL identifiers */ used in SQL identifiers; EOF if none */
trx_t* trx, /* in: transaction */
const char* name, /* in: name to print */
ulint namelen);/* in: length of name */
/************************************************************ /************************************************************
Gets the high 32 bits in a ulint. That is makes a shift >> 32, Gets the high 32 bits in a ulint. That is makes a shift >> 32,
@@ -333,6 +337,31 @@ ut_2_power_up(
return(res); return(res);
} }
/**************************************************************************
Outputs a NUL-terminated file name, quoted with apostrophes. */
void
ut_print_filename(
/*==============*/
FILE* f, /* in: output stream */
const char* name) /* in: name to print */
{
putc('\'', f);
for (;;) {
int c = *name++;
switch (c) {
case 0:
goto done;
case '\'':
putc(c, f);
/* fall through */
default:
putc(c, f);
}
}
done:
putc('\'', f);
}
/************************************************************************** /**************************************************************************
Outputs a NUL-terminated string, quoted as an SQL identifier. */ Outputs a NUL-terminated string, quoted as an SQL identifier. */
@@ -341,9 +370,10 @@ void
ut_print_name( ut_print_name(
/*==========*/ /*==========*/
FILE* f, /* in: output stream */ FILE* f, /* in: output stream */
trx_t* trx, /* in: transaction */
const char* name) /* in: name to print */ const char* name) /* in: name to print */
{ {
ut_print_namel(f, name, strlen(name)); ut_print_namel(f, trx, name, strlen(name));
} }
/************************************************************************** /**************************************************************************
@@ -353,12 +383,17 @@ void
ut_print_namel( ut_print_namel(
/*==========*/ /*==========*/
FILE* f, /* in: output stream */ FILE* f, /* in: output stream */
trx_t* trx, /* in: transaction (NULL=no quotes) */
const char* name, /* in: name to print */ const char* name, /* in: name to print */
ulint namelen)/* in: length of name */ ulint namelen)/* in: length of name */
{ {
const char* s = name; const char* s = name;
const char* e = s + namelen; const char* e = s + namelen;
char q = mysql_get_identifier_quote_char(); int q = mysql_get_identifier_quote_char(trx, name, namelen);
if (q == EOF) {
fwrite(name, 1, namelen, f);
return;
}
putc(q, f); putc(q, f);
while (s < e) { while (s < e) {
int c = *s++; int c = *s++;

View File

@@ -736,15 +736,35 @@ innobase_invalidate_query_cache(
} }
/********************************************************************* /*********************************************************************
Get the quote character to be used in SQL identifiers. */ Get the quote character to be used in SQL identifiers.
This definition must match the one in innobase/ut/ut0ut.c! */
extern "C" extern "C"
char int
mysql_get_identifier_quote_char(void) mysql_get_identifier_quote_char(
/*=================================*/ /*============================*/
/* out: quote character to be /* out: quote character to be
used in SQL identifiers */ used in SQL identifiers; EOF if none */
trx_t* trx, /* in: transaction */
const char* name, /* in: name to print */
ulint namelen)/* in: length of name */
{ {
return '`'; if (!trx || !trx->mysql_thd) {
return(EOF);
}
return(get_quote_char_for_identifier((THD*) trx->mysql_thd,
name, namelen));
}
/**************************************************************************
Obtain a pointer to the MySQL THD object, as in current_thd(). This
definition must match the one in sql/ha_innodb.cc! */
extern "C"
void*
innobase_current_thd(void)
/*======================*/
/* out: MySQL THD object */
{
return(current_thd);
} }
/********************************************************************* /*********************************************************************
@@ -1483,12 +1503,14 @@ ha_innobase::open(
{ {
dict_table_t* ib_table; dict_table_t* ib_table;
char norm_name[1000]; char norm_name[1000];
THD* thd;
DBUG_ENTER("ha_innobase::open"); DBUG_ENTER("ha_innobase::open");
UT_NOT_USED(mode); UT_NOT_USED(mode);
UT_NOT_USED(test_if_locked); UT_NOT_USED(test_if_locked);
thd = current_thd;
normalize_table_name(norm_name, name); normalize_table_name(norm_name, name);
user_thd = NULL; user_thd = NULL;
@@ -1538,7 +1560,7 @@ ha_innobase::open(
DBUG_RETURN(1); DBUG_RETURN(1);
} }
if (ib_table->ibd_file_missing && !current_thd->tablespace_op) { if (ib_table->ibd_file_missing && !thd->tablespace_op) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB error:\n" fprintf(stderr, " InnoDB error:\n"
"MySQL is trying to open a table handle but the .ibd file for\n" "MySQL is trying to open a table handle but the .ibd file for\n"
@@ -2862,7 +2884,7 @@ ha_innobase::index_read(
(ulint)upd_and_key_val_buff_len, (ulint)upd_and_key_val_buff_len,
index, index,
(byte*) key_ptr, (byte*) key_ptr,
(ulint) key_len); (ulint) key_len, prebuilt->trx);
} else { } else {
/* We position the cursor to the last or the first entry /* We position the cursor to the last or the first entry
in the index */ in the index */
@@ -4074,14 +4096,16 @@ ha_innobase::records_in_range(
index, index,
(byte*) (min_key ? min_key->key : (byte*) (min_key ? min_key->key :
(const mysql_byte*) 0), (const mysql_byte*) 0),
(ulint) (min_key ? min_key->length : 0)); (ulint) (min_key ? min_key->length : 0),
prebuilt->trx);
row_sel_convert_mysql_key_to_innobase( row_sel_convert_mysql_key_to_innobase(
range_end, (byte*) key_val_buff2, range_end, (byte*) key_val_buff2,
buff2_len, index, buff2_len, index,
(byte*) (max_key ? max_key->key : (byte*) (max_key ? max_key->key :
(const mysql_byte*) 0), (const mysql_byte*) 0),
(ulint) (max_key ? max_key->length : 0)); (ulint) (max_key ? max_key->length : 0),
prebuilt->trx);
mode1 = convert_search_mode_to_innobase(min_key ? min_key->flag : mode1 = convert_search_mode_to_innobase(min_key ? min_key->flag :
HA_READ_KEY_EXACT); HA_READ_KEY_EXACT);
@@ -4468,7 +4492,8 @@ ha_innobase::update_table_comment(
(ulong) fsp_get_available_space_in_free_extents( (ulong) fsp_get_available_space_in_free_extents(
prebuilt->table->space)); prebuilt->table->space));
dict_print_info_on_foreign_keys(FALSE, file, prebuilt->table); dict_print_info_on_foreign_keys(FALSE, file,
prebuilt->trx, prebuilt->table);
flen = ftell(file); flen = ftell(file);
if(length + flen + 3 > 64000) { if(length + flen + 3 > 64000) {
flen = 64000 - 3 - length; flen = 64000 - 3 - length;
@@ -4534,7 +4559,8 @@ ha_innobase::get_foreign_key_create_info(void)
trx_search_latch_release_if_reserved(prebuilt->trx); trx_search_latch_release_if_reserved(prebuilt->trx);
/* output the data to a temporary file */ /* output the data to a temporary file */
dict_print_info_on_foreign_keys(TRUE, file, prebuilt->table); dict_print_info_on_foreign_keys(TRUE, file,
prebuilt->trx, prebuilt->table);
prebuilt->trx->op_info = (char*)""; prebuilt->trx->op_info = (char*)"";
flen = ftell(file); flen = ftell(file);

View File

@@ -636,6 +636,7 @@ int mysqld_show_keys(THD *thd, TABLE_LIST *table);
int mysqld_show_logs(THD *thd); int mysqld_show_logs(THD *thd);
void append_identifier(THD *thd, String *packet, const char *name, void append_identifier(THD *thd, String *packet, const char *name,
uint length); uint length);
int get_quote_char_for_identifier(THD *thd, const char *name, uint length);
void mysqld_list_fields(THD *thd,TABLE_LIST *table, const char *wild); void mysqld_list_fields(THD *thd,TABLE_LIST *table, const char *wild);
int mysqld_dump_create_info(THD *thd, TABLE *table, int fd = -1); int mysqld_dump_create_info(THD *thd, TABLE *table, int fd = -1);
int mysqld_show_create(THD *thd, TABLE_LIST *table_list); int mysqld_show_create(THD *thd, TABLE_LIST *table_list);

View File

@@ -1143,40 +1143,18 @@ static const char *require_quotes(const char *name, uint name_length)
} }
static void append_quoted_simple_identifier(String *packet, char quote_char,
const char *name, uint length)
{
packet->append(&quote_char, 1, system_charset_info);
packet->append(name, length, system_charset_info);
packet->append(&quote_char, 1, system_charset_info);
}
void void
append_identifier(THD *thd, String *packet, const char *name, uint length) append_identifier(THD *thd, String *packet, const char *name, uint length)
{ {
const char *name_end; const char *name_end;
char quote_char; int q= get_quote_char_for_identifier(thd, name, length);
if (thd->variables.sql_mode & MODE_ANSI_QUOTES) if (q == EOF) {
quote_char= '\"'; packet->append(name, length, system_charset_info);
else
quote_char= '`';
if (is_keyword(name,length))
{
append_quoted_simple_identifier(packet, quote_char, name, length);
return; return;
} }
if (!require_quotes(name, length)) char quote_char= q;
{
if (!(thd->options & OPTION_QUOTE_SHOW_CREATE))
packet->append(name, length, system_charset_info);
else
append_quoted_simple_identifier(packet, quote_char, name, length);
return;
}
/* The identifier must be quoted as it includes a quote character */ /* The identifier must be quoted as it includes a quote character */
@@ -1195,6 +1173,22 @@ append_identifier(THD *thd, String *packet, const char *name, uint length)
} }
/* Get the quote character for displaying an identifier.
If no quote character is needed, return EOF. */
int get_quote_char_for_identifier(THD *thd, const char *name, uint length)
{
if (!is_keyword(name,length) &&
!require_quotes(name, length) &&
!(thd->options & OPTION_QUOTE_SHOW_CREATE))
return EOF;
else if (thd->variables.sql_mode & MODE_ANSI_QUOTES)
return '"';
else
return '`';
}
/* Append directory name (if exists) to CREATE INFO */ /* Append directory name (if exists) to CREATE INFO */
static void append_directory(THD *thd, String *packet, const char *dir_type, static void append_directory(THD *thd, String *packet, const char *dir_type,