Commit bcf9350e authored by sergefp@mysql.com's avatar sergefp@mysql.com

Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-4.1

into mysql.com:/dbdata/psergey/mysql-4.1-bug3567
parents b8802c51 3a7b6d68
......@@ -92,6 +92,7 @@ monty@donna.mysql.fi
monty@hundin.mysql.fi
monty@mashka.(none)
monty@mashka.mysql.fi
monty@mishka.local
monty@mishka.mysql.fi
monty@mysql.com
monty@narttu.
......
......@@ -43,5 +43,5 @@ enum options_client
OPT_PROMPT, OPT_IGN_LINES,OPT_TRANSACTION,OPT_MYSQL_PROTOCOL,
OPT_SHARED_MEMORY_BASE_NAME, OPT_FRM, OPT_SKIP_OPTIMIZATION,
OPT_COMPATIBLE, OPT_RECONNECT, OPT_DELIMITER, OPT_SECURE_AUTH,
OPT_OPEN_FILES_LIMIT, OPT_SET_CHARSET
OPT_OPEN_FILES_LIMIT, OPT_SET_CHARSET, OPT_CREATE_OPTIONS
};
......@@ -37,7 +37,7 @@
** 10 Jun 2003: SET NAMES and --no-set-names by Alexander Barkov
*/
#define DUMP_VERSION "10.6"
#define DUMP_VERSION "10.7"
#include <my_global.h>
#include <my_sys.h>
......@@ -91,7 +91,6 @@ static char insert_pat[12 * 1024],*opt_password=0,*current_user=0,
*opt_compatible_mode_str= 0,
*err_ptr= 0;
static char compatible_mode_normal_str[255];
static char *default_charset= (char*) MYSQL_UNIVERSAL_CLIENT_CHARSET;
static ulong opt_compatible_mode= 0;
static uint opt_mysql_port= 0, err_len= 0;
static my_string opt_mysql_unix_port=0;
......@@ -104,7 +103,9 @@ FILE *md_result_file;
static char *shared_memory_base_name=0;
#endif
static uint opt_protocol= 0;
static char *default_charset= (char*) MYSQL_UNIVERSAL_CLIENT_CHARSET;
static CHARSET_INFO *charset_info= &my_charset_latin1;
const char *default_dbug_option="d:t:o,/tmp/mysqldump.trace";
const char *compatible_mode_names[]=
{
......@@ -132,9 +133,6 @@ static struct my_option my_long_options[] =
"Dump all the databases. This will be same as --databases with all databases selected.",
(gptr*) &opt_alldbs, (gptr*) &opt_alldbs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"all", 'a', "Include all MySQL specific create options.",
(gptr*) &create_options, (gptr*) &create_options, 0, GET_BOOL, NO_ARG, 1,
0, 0, 0, 0, 0},
{"add-drop-table", OPT_DROP, "Add a 'drop table' before each create.",
(gptr*) &opt_drop, (gptr*) &opt_drop, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0,
0},
......@@ -148,7 +146,7 @@ static struct my_option my_long_options[] =
"Directory where character sets are.", (gptr*) &charsets_dir,
(gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"compatible", OPT_COMPATIBLE,
"Change the dump to be compatible with a given mode. By default tables are dumped without any restrictions. Legal modes are: ansi, mysql323, mysql40, postgresql, oracle, mssql, db2, maxdb, no_key_options, no_table_options, no_field_options. One can use several modes separated by commas. Note: Requires MySQL server version 4.1.0 or higher. This option does a no operation on earlier server versions.",
"Change the dump to be compatible with a given mode. By default tables are dumped in a format optimized for MySQL. Legal modes are: ansi, mysql323, mysql40, postgresql, oracle, mssql, db2, maxdb, no_key_options, no_table_options, no_field_options. One can use several modes separated by commas. Note: Requires MySQL server version 4.1.0 or higher. This option is ignored with earlier server versions.",
(gptr*) &opt_compatible_mode_str, (gptr*) &opt_compatible_mode_str, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"compact", OPT_COMPACT,
......@@ -160,12 +158,21 @@ static struct my_option my_long_options[] =
{"compress", 'C', "Use compression in server/client protocol.",
(gptr*) &opt_compress, (gptr*) &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"create-options", OPT_CREATE_OPTIONS,
"Include all MySQL specific create options.",
(gptr*) &create_options, (gptr*) &create_options, 0, GET_BOOL, NO_ARG, 1,
0, 0, 0, 0, 0},
{"databases", 'B',
"To dump several databases. Note the difference in usage; In this case no tables are given. All name arguments are regarded as databasenames. 'USE db_name;' will be included in the output.",
(gptr*) &opt_databases, (gptr*) &opt_databases, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#ifdef DBUG_OFF
{"debug", '#', "This is a non-debug version. Catch this and exit",
0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
#else
{"debug", '#', "Output debug log", (gptr*) &default_dbug_option,
(gptr*) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"default-character-set", OPT_DEFAULT_CHARSET,
"Set the default character set.", (gptr*) &default_charset,
(gptr*) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
......@@ -463,7 +470,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt_disable_keys=0;
break;
case '#':
DBUG_PUSH(argument ? argument : "d:t:o");
DBUG_PUSH(argument ? argument : default_dbug_option);
break;
#include <sslopt-case.h>
case 'V': print_version(); exit(0);
......@@ -483,7 +490,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break;
case (int) OPT_SKIP_OPTIMIZATION:
extended_insert= opt_drop= opt_lock= quick= create_options=
opt_disable_keys= lock_tables= 0;
opt_disable_keys= lock_tables= opt_set_charset= 0;
break;
case (int) OPT_COMPACT:
if (opt_compact)
......@@ -859,11 +866,11 @@ static void print_xml_row(FILE *xml_file, const char *row_name,
{
if ((*row)[i])
{
fputs(" ", xml_file);
fputc(' ', xml_file);
print_quoted_xml(xml_file, field->name, field->name_length);
fputs("=\"", xml_file);
print_quoted_xml(xml_file, (*row)[i], lengths[i]);
fputs("\"", xml_file);
fputc('"', xml_file);
}
}
fputs(" />\n", xml_file);
......@@ -897,6 +904,9 @@ static uint getTableStructure(char *table, char* db)
sprintf(insert_pat,"SET OPTION SQL_QUOTE_SHOW_CREATE=%d",
(opt_quoted || opt_keywords));
if (!create_options)
strmov(strend(insert_pat), "/*!40102 ,SQL_MODE=concat(@@sql_mode, _utf8 'NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS') */");
result_table= quote_name(table, table_buff, 1);
opt_quoted_table= quote_name(table, table_buff2, 0);
if (!opt_xml && !mysql_query(sock,insert_pat))
......@@ -978,8 +988,10 @@ static uint getTableStructure(char *table, char* db)
}
else
{
/* fprintf(stderr, "%s: Can't set SQL_QUOTE_SHOW_CREATE option (%s)\n",
my_progname, mysql_error(sock)); */
if (verbose)
fprintf(stderr,
"%s: Warning: Can't set SQL_QUOTE_SHOW_CREATE option (%s)\n",
my_progname, mysql_error(sock));
sprintf(insert_pat,"show fields from %s", result_table);
if (mysql_query(sock,insert_pat) || !(tableRes=mysql_store_result(sock)))
......@@ -1172,7 +1184,7 @@ static uint getTableStructure(char *table, char* db)
else
{
fputs("/*!",sql_file);
print_value(sql_file,tableRes,row,"type=","Type",0);
print_value(sql_file,tableRes,row,"engine=","Engine",0);
print_value(sql_file,tableRes,row,"","Create_options",0);
print_value(sql_file,tableRes,row,"comment=","Comment",1);
fputs(" */",sql_file);
......@@ -1413,12 +1425,12 @@ static void dumpTable(uint numFields, char *table)
fputs("Aborting dump (out of memory)",stderr);
safe_exit(EX_EOM);
}
dynstr_append(&extended_row,"\'");
dynstr_append(&extended_row,"'");
extended_row.length +=
mysql_real_escape_string(&mysql_connection,
&extended_row.str[extended_row.length],row[i],length);
extended_row.str[extended_row.length]='\0';
dynstr_append(&extended_row,"\'");
dynstr_append(&extended_row,"'");
}
else
{
......@@ -1432,9 +1444,9 @@ static void dumpTable(uint numFields, char *table)
if (field->type == FIELD_TYPE_DECIMAL)
{
/* add " signs around */
dynstr_append(&extended_row, "\"");
dynstr_append(&extended_row, "'");
dynstr_append(&extended_row, ptr);
dynstr_append(&extended_row, "\"");
dynstr_append(&extended_row, "'");
}
else
dynstr_append(&extended_row, ptr);
......@@ -1442,7 +1454,7 @@ static void dumpTable(uint numFields, char *table)
}
}
else
dynstr_append(&extended_row,"\'\'");
dynstr_append(&extended_row,"''");
}
else if (dynstr_append(&extended_row,"NULL"))
{
......@@ -1486,9 +1498,9 @@ static void dumpTable(uint numFields, char *table)
else if (field->type == FIELD_TYPE_DECIMAL)
{
/* add " signs around */
fputs("\"", md_result_file);
fputc('\'', md_result_file);
fputs(ptr, md_result_file);
fputs("\"", md_result_file);
fputc('\'', md_result_file);
}
else
fputs(ptr, md_result_file);
......
This diff is collapsed.
......@@ -120,7 +120,6 @@ static
void
btr_cur_latch_leaves(
/*=================*/
dict_tree_t* tree __attribute__((unused)), /* in: index tree */
page_t* page, /* in: leaf page where the search
converged */
ulint space, /* in: space id */
......@@ -133,7 +132,7 @@ btr_cur_latch_leaves(
ulint right_page_no;
page_t* get_page;
ut_ad(tree && page && mtr);
ut_ad(page && mtr);
if (latch_mode == BTR_SEARCH_LEAF) {
......@@ -366,17 +365,19 @@ btr_cur_search_to_nth_level(
B-tree. These let us end up in the right B-tree leaf. In that leaf
we use the original search mode. */
if (mode == PAGE_CUR_GE) {
switch (mode) {
case PAGE_CUR_GE:
page_mode = PAGE_CUR_L;
} else if (mode == PAGE_CUR_G) {
break;
case PAGE_CUR_G:
page_mode = PAGE_CUR_LE;
} else if (mode == PAGE_CUR_LE) {
page_mode = PAGE_CUR_LE;
} else if (mode == PAGE_CUR_LE_OR_EXTENDS) {
page_mode = PAGE_CUR_LE_OR_EXTENDS;
} else {
ut_ad(mode == PAGE_CUR_L);
page_mode = PAGE_CUR_L;
break;
default:
ut_ad(mode == PAGE_CUR_L
|| mode == PAGE_CUR_LE
|| mode == PAGE_CUR_LE_OR_EXTENDS);
page_mode = mode;
break;
}
/* Loop and search until we arrive at the desired level */
......@@ -451,7 +452,7 @@ retry_page_get:
if (height == 0) {
if (rw_latch == RW_NO_LATCH) {
btr_cur_latch_leaves(tree, page, space,
btr_cur_latch_leaves(page, space,
page_no, latch_mode, cursor,
mtr);
}
......@@ -478,6 +479,9 @@ retry_page_get:
/* If this is the desired level, leave the loop */
ut_ad(height
== btr_page_get_level(page_cur_get_page(page_cursor), mtr));
if (level == height) {
if (level > 0) {
......@@ -591,7 +595,7 @@ btr_cur_open_at_index_side(
}
if (height == 0) {
btr_cur_latch_leaves(tree, page, space, page_no,
btr_cur_latch_leaves(page, space, page_no,
latch_mode, cursor, mtr);
/* In versions <= 3.23.52 we had forgotten to
......@@ -697,7 +701,7 @@ btr_cur_open_at_rnd_pos(
}
if (height == 0) {
btr_cur_latch_leaves(tree, page, space, page_no,
btr_cur_latch_leaves(page, space, page_no,
latch_mode, cursor, mtr);
}
......@@ -829,6 +833,24 @@ btr_cur_ins_lock_and_undo(
return(DB_SUCCESS);
}
/*****************************************************************
Report information about a transaction. */
static
void
btr_cur_trx_report(
/*===============*/
const trx_t* trx, /* in: transaction */
const dict_index_t* index, /* in: index */
const char* op) /* in: operation */
{
fprintf(stderr, "Trx with id %lu %lu going to ",
ut_dulint_get_high(trx->id),
ut_dulint_get_low(trx->id));
fputs(op, stderr);
dict_index_name_print(stderr, index);
putc('\n', stderr);
}
/*****************************************************************
Tries to perform an insert to a page in an index tree, next to cursor.
It is assumed that mtr holds an x-latch on the page. The operation does
......@@ -876,18 +898,13 @@ btr_cur_optimistic_insert(
index = cursor->index;
if (!dtuple_check_typed_no_assert(entry)) {
fprintf(stderr,
"InnoDB: Error in a tuple to insert into table %s index %s\n",
index->table_name, index->name);
fputs("InnoDB: Error in a tuple to insert into ", stderr);
dict_index_name_print(stderr, index);
}
if (btr_cur_print_record_ops && thr) {
printf(
"Trx with id %lu %lu going to insert to table %s index %s\n",
(unsigned long) ut_dulint_get_high(thr_get_trx(thr)->id),
(unsigned long) ut_dulint_get_low(thr_get_trx(thr)->id),
index->table_name, index->name);
dtuple_print(entry);
btr_cur_trx_report(thr_get_trx(thr), index, "insert into ");
dtuple_print(stderr, entry);
}
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
......@@ -980,21 +997,15 @@ calculate_sizes_again:
*rec = page_cur_tuple_insert(page_cursor, entry, mtr);
if (!(*rec)) {
char* err_buf = mem_alloc(1000);
dtuple_sprintf(err_buf, 900, entry);
fprintf(stderr,
"InnoDB: Error: cannot insert tuple %s to index %s of table %s\n"
"InnoDB: max insert size %lu\n",
err_buf, index->name, index->table->name,
(unsigned long) max_size);
mem_free(err_buf);
if (!*rec) {
fputs("InnoDB: Error: cannot insert tuple ", stderr);
dtuple_print(stderr, entry);
fputs(" into ", stderr);
dict_index_name_print(stderr, index);
fprintf(stderr, "\nInnoDB: max insert size %lu\n",
(ulong) max_size);
ut_error;
}
ut_a(*rec); /* <- We calculated above the record would fit */
}
#ifdef BTR_CUR_HASH_ADAPT
......@@ -1010,7 +1021,8 @@ calculate_sizes_again:
lock_update_insert(*rec);
}
/* printf("Insert to page %lu, max ins size %lu, rec %lu ind type %lu\n",
/* fprintf(stderr, "Insert into page %lu, max ins size %lu,"
" rec %lu ind type %lu\n",
buf_frame_get_page_no(page), max_size,
rec_size + PAGE_DIR_SLOT_SIZE, type);
*/
......@@ -1363,12 +1375,8 @@ btr_cur_update_in_place(
trx = thr_get_trx(thr);
if (btr_cur_print_record_ops && thr) {
printf(
"Trx with id %lu %lu going to update table %s index %s\n",
(unsigned long) ut_dulint_get_high(thr_get_trx(thr)->id),
(unsigned long) ut_dulint_get_low(thr_get_trx(thr)->id),
index->table_name, index->name);
rec_print(rec);
btr_cur_trx_report(trx, index, "update ");
rec_print(stderr, rec);
}
/* Do lock checking and undo logging */
......@@ -1467,12 +1475,8 @@ btr_cur_optimistic_update(
index = cursor->index;
if (btr_cur_print_record_ops && thr) {
printf(
"Trx with id %lu %lu going to update table %s index %s\n",
(unsigned long) ut_dulint_get_high(thr_get_trx(thr)->id),
(unsigned long) ut_dulint_get_low(thr_get_trx(thr)->id),
index->table_name, index->name);
rec_print(rec);
btr_cur_trx_report(thr_get_trx(thr), index, "update ");
rec_print(stderr, rec);
}
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
......@@ -2016,12 +2020,8 @@ btr_cur_del_mark_set_clust_rec(
index = cursor->index;
if (btr_cur_print_record_ops && thr) {
printf(
"Trx with id %lu %lu going to del mark table %s index %s\n",
(unsigned long) ut_dulint_get_high(thr_get_trx(thr)->id),
(unsigned long) ut_dulint_get_low(thr_get_trx(thr)->id),
index->table_name, index->name);
rec_print(rec);
btr_cur_trx_report(thr_get_trx(thr), index, "del mark ");
rec_print(stderr, rec);
}
ut_ad(index->type & DICT_CLUSTERED);
......@@ -2156,12 +2156,9 @@ btr_cur_del_mark_set_sec_rec(
rec = btr_cur_get_rec(cursor);
if (btr_cur_print_record_ops && thr) {
printf(
"Trx with id %lu %lu going to del mark table %s index %s\n",
(unsigned long) ut_dulint_get_high(thr_get_trx(thr)->id),
(unsigned long) ut_dulint_get_low(thr_get_trx(thr)->id),
cursor->index->table_name, cursor->index->name);
rec_print(rec);
btr_cur_trx_report(thr_get_trx(thr), cursor->index,
"del mark ");
rec_print(stderr, rec);
}
err = lock_sec_rec_modify_check_and_lock(flags, rec, cursor->index,
......
......@@ -803,7 +803,7 @@ btr_search_guess_on_hash(
success = FALSE;
/*
printf("Tree id %lu, page index id %lu fold %lu\n",
fprintf(stderr, "Tree id %lu, page index id %lu fold %lu\n",
ut_dulint_get_low(tree_id),
ut_dulint_get_low(btr_page_get_index_id(page)),
fold);
......@@ -1517,8 +1517,9 @@ check_next_rec:
ha_insert_for_fold(table, ins_fold, ins_rec);
/*
printf("Hash insert for %s, fold %lu\n",
cursor->index->name, ins_fold);
fputs("Hash insert for ", stderr);
dict_index_name_print(stderr, cursor->index);
fprintf(stderr, " fold %lu\n", ins_fold);
*/
} else {
ha_insert_for_fold(table, next_fold, next_rec);
......@@ -1545,7 +1546,6 @@ btr_search_validate(void)
ulint n_page_dumps = 0;
ibool ok = TRUE;
ulint i;
char rec_str[500];
rw_lock_x_lock(&btr_search_latch);
......@@ -1566,29 +1566,25 @@ btr_search_validate(void)
fprintf(stderr,
" InnoDB: Error in an adaptive hash index pointer to page %lu\n"
"ptr mem address %lu index id %lu %lu, node fold %lu, rec fold %lu\n",
(ulong) buf_frame_get_page_no(page),
(ulong)(node->data),
(ulong) ut_dulint_get_high(btr_page_get_index_id(page)),
(ulong) ut_dulint_get_low(btr_page_get_index_id(page)),
(ulong) node->fold,
(ulong) rec_fold((rec_t*)(node->data),
block->curr_n_fields,
block->curr_n_bytes,
btr_page_get_index_id(page)));
rec_sprintf(rec_str, 450, (rec_t*)(node->data));
fprintf(stderr,
"InnoDB: Record %s\n"
"InnoDB: on that page.", rec_str);
fprintf(stderr,
"Page mem address %lu, is hashed %lu, n fields %lu, n bytes %lu\n"
"ptr mem address %p index id %lu %lu, node fold %lu, rec fold %lu\n",
(ulong) buf_frame_get_page_no(page),
node->data,
(ulong) ut_dulint_get_high(btr_page_get_index_id(page)),
(ulong) ut_dulint_get_low(btr_page_get_index_id(page)),
(ulong) node->fold,
(ulong) rec_fold((rec_t*)(node->data),
block->curr_n_fields,
block->curr_n_bytes,
btr_page_get_index_id(page)));
fputs("InnoDB: Record ", stderr);
rec_print(stderr, (rec_t*)(node->data));
fprintf(stderr, "\nInnoDB: on that page."
"Page mem address %p, is hashed %lu, n fields %lu, n bytes %lu\n"
"side %lu\n",
(ulong) page, (ulong) block->is_hashed,
(ulong) block->curr_n_fields,
(ulong) block->curr_n_bytes, (ulong) block->curr_side);
page, (ulong) block->is_hashed,
(ulong) block->curr_n_fields,
(ulong) block->curr_n_bytes, (ulong) block->curr_side);
if (n_page_dumps < 20) {
buf_page_print(page);
......
This diff is collapsed.
......@@ -32,6 +32,7 @@ flushed along with the original page. */
#define BUF_FLUSH_AREA ut_min(BUF_READ_AHEAD_AREA,\
buf_pool->curr_size / 16)
#ifdef UNIV_DEBUG
/**********************************************************************
Validates the flush list. */
static
......@@ -39,6 +40,7 @@ ibool
buf_flush_validate_low(void);
/*========================*/
/* out: TRUE if ok */
#endif /* UNIV_DEBUG */
/************************************************************************
Inserts a modified block into the flush list. */
......@@ -193,7 +195,7 @@ buf_flush_write_complete(
buf_pool->LRU_flush_ended++;
}
/* printf("n pending flush %lu\n",
/* fprintf(stderr, "n pending flush %lu\n",
buf_pool->n_flush[block->flush_type]); */
if ((buf_pool->n_flush[block->flush_type] == 0)
......@@ -420,8 +422,8 @@ buf_flush_write_block_low(
ut_ad(!ut_dulint_is_zero(block->newest_modification));
#ifdef UNIV_LOG_DEBUG
printf(
"Warning: cannot force log to disk in the log debug version!\n");
fputs("Warning: cannot force log to disk in the log debug version!\n",
stderr);
#else
/* Force the log to the disk before writing the modified block */
log_write_up_to(block->newest_modification, LOG_WAIT_ALL_GROUPS, TRUE);
......@@ -511,11 +513,13 @@ buf_flush_try_page(
rw_lock_s_lock_gen(&(block->lock), BUF_IO_WRITE);
}
#ifdef UNIV_DEBUG
if (buf_debug_prints) {
printf("Flushing page space %lu, page no %lu \n",
(ulong) block->space,
(ulong) block->offset);
fprintf(stderr,
"Flushing page space %lu, page no %lu \n",
(ulong) block->space, (ulong) block->offset);
}
#endif /* UNIV_DEBUG */
buf_flush_write_block_low(block);
......@@ -599,12 +603,14 @@ buf_flush_try_page(
rw_lock_s_lock_gen(&(block->lock), BUF_IO_WRITE);
#ifdef UNIV_DEBUG
if (buf_debug_prints) {
printf(
fprintf(stderr,
"Flushing single page space %lu, page no %lu \n",
(ulong) block->space,
(ulong) block->offset);
}
#endif /* UNIV_DEBUG */
buf_flush_write_block_low(block);
......@@ -645,7 +651,7 @@ buf_flush_try_neighbors(
high = offset + 1;
}
/* printf("Flush area: low %lu high %lu\n", low, high); */
/* fprintf(stderr, "Flush area: low %lu high %lu\n", low, high); */
if (high > fil_space_get_size(space)) {
high = fil_space_get_size(space);
......@@ -793,7 +799,7 @@ buf_flush_batch(
page_count +=
buf_flush_try_neighbors(space, offset,
flush_type);
/* printf(
/* fprintf(stderr,
"Flush type %lu, page no %lu, neighb %lu\n",
flush_type, offset,
page_count - old_page_count); */
......@@ -831,17 +837,16 @@ buf_flush_batch(
buf_flush_buffered_writes();
#ifdef UNIV_DEBUG
if (buf_debug_prints && page_count > 0) {
if (flush_type == BUF_FLUSH_LRU) {
printf("Flushed %lu pages in LRU flush\n",
(ulong) page_count);
} else if (flush_type == BUF_FLUSH_LIST) {
printf("Flushed %lu pages in flush list flush\n",
(ulong) page_count);
} else {
ut_error;
}
ut_a(flush_type == BUF_FLUSH_LRU
|| flush_type == BUF_FLUSH_LIST);
fprintf(stderr, flush_type == BUF_FLUSH_LRU
? "Flushed %lu pages in LRU flush\n"
: "Flushed %lu pages in flush list flush\n",
(ulong) page_count);
}
#endif /* UNIV_DEBUG */
return(page_count);
}
......@@ -933,6 +938,7 @@ buf_flush_free_margin(void)
}
}
#ifdef UNIV_DEBUG
/**********************************************************************
Validates the flush list. */
static
......@@ -982,3 +988,4 @@ buf_flush_validate(void)
return(ret);
}
#endif /* UNIV_DEBUG */
......@@ -97,13 +97,14 @@ scan_again:
}
if (block->space == id) {
#ifdef UNIV_DEBUG
if (buf_debug_prints) {
printf(
"Dropping space %lu page %lu\n",
(ulong) block->space,
(ulong) block->offset);
}
#endif
if (block->is_hashed) {
page_no = block->offset;
......@@ -207,12 +208,16 @@ buf_LRU_search_and_free_block(
while (block != NULL) {
ut_a(block->in_LRU_list);
if (buf_flush_ready_for_replace(block)) {
#ifdef UNIV_DEBUG
if (buf_debug_prints) {
printf(
fprintf(stderr,
"Putting space %lu page %lu to free list\n",
(ulong) block->space,
(ulong) block->offset);
}
#endif /* UNIV_DEBUG */
buf_LRU_block_remove_hashed_page(block);
mutex_exit(&(buf_pool->mutex));
......@@ -404,28 +409,21 @@ loop:
fprintf(stderr,
"InnoDB: Warning: difficult to find free blocks from\n"
"InnoDB: the buffer pool (%lu search iterations)! Consider\n"
"InnoDB: increasing the buffer pool size.\n",
(ulong) n_iterations);
fprintf(stderr,
"InnoDB: increasing the buffer pool size.\n"
"InnoDB: It is also possible that in your Unix version\n"
"InnoDB: fsync is very slow, or completely frozen inside\n"
"InnoDB: the OS kernel. Then upgrading to a newer version\n"
"InnoDB: of your operating system may help. Look at the\n"
"InnoDB: number of fsyncs in diagnostic info below.\n");
fprintf(stderr,
"InnoDB: Pending flushes (fsync) log: %lu; buffer pool: %lu\n",
(ulong) fil_n_pending_log_flushes,
(ulong) fil_n_pending_tablespace_flushes);
fprintf(stderr,
"InnoDB: %lu OS file reads, %lu OS file writes, %lu OS fsyncs\n",
(ulong) os_n_file_reads,
(ulong) os_n_file_writes,
(ulong) os_n_fsyncs);
fprintf(stderr,
"InnoDB: number of fsyncs in diagnostic info below.\n"
"InnoDB: Pending flushes (fsync) log: %lu; buffer pool: %lu\n"
"InnoDB: %lu OS file reads, %lu OS file writes, %lu OS fsyncs\n"
"InnoDB: Starting InnoDB Monitor to print further\n"
"InnoDB: diagnostics to the standard output.\n");
"InnoDB: diagnostics to the standard output.\n",
(ulong) n_iterations,
(ulong) fil_n_pending_log_flushes,
(ulong) fil_n_pending_tablespace_flushes,
(ulong) os_n_file_reads, (ulong) os_n_file_writes,
(ulong) os_n_fsyncs);
mon_value_was = srv_print_innodb_monitor;
started_monitor = TRUE;
......@@ -855,11 +853,12 @@ buf_LRU_block_remove_hashed_page(
(ulong) block);
}
#ifdef UNIV_DEBUG
buf_print();
buf_LRU_print();
buf_validate();
buf_LRU_validate();
#endif
ut_a(0);
}
......@@ -889,6 +888,7 @@ buf_LRU_block_free_hashed_page(
buf_LRU_block_free_non_file_page(block);
}
#ifdef UNIV_DEBUG
/**************************************************************************
Validates the LRU list. */
......@@ -975,7 +975,7 @@ buf_LRU_print(void)
ut_ad(buf_pool);
mutex_enter(&(buf_pool->mutex));
printf("Pool ulint clock %lu\n", (ulong) buf_pool->ulint_clock);
fprintf(stderr, "Pool ulint clock %lu\n", (ulong) buf_pool->ulint_clock);
block = UT_LIST_GET_FIRST(buf_pool->LRU);
......@@ -983,39 +983,40 @@ buf_LRU_print(void)
while (block != NULL) {
printf("BLOCK %lu ", (ulong) block->offset);
fprintf(stderr, "BLOCK %lu ", (ulong) block->offset);
if (block->old) {
printf("old ");
fputs("old ", stderr);
}
if (block->buf_fix_count) {
printf("buffix count %lu ", (ulong) block->buf_fix_count);
fprintf(stderr, "buffix count %lu ",
(ulong) block->buf_fix_count);
}
if (block->io_fix) {
printf("io_fix %lu ", (ulong) block->io_fix);
fprintf(stderr, "io_fix %lu ", (ulong) block->io_fix);
}
if (ut_dulint_cmp(block->oldest_modification,
ut_dulint_zero) > 0) {
printf("modif. ");
fputs("modif. ", stderr);
}
printf("LRU pos %lu ", (ulong) block->LRU_position);
frame = buf_block_get_frame(block);
printf("type %lu ", (ulong) fil_page_get_type(frame));
printf("index id %lu ", (ulong) ut_dulint_get_low(
btr_page_get_index_id(frame)));
fprintf(stderr, "LRU pos %lu type %lu index id %lu ",
(ulong) block->LRU_position,
(ulong) fil_page_get_type(frame),
(ulong) ut_dulint_get_low(btr_page_get_index_id(frame)));
block = UT_LIST_GET_NEXT(LRU, block);
len++;
if (len % 10 == 0) {
printf("\n");
if (++len == 10) {
len = 0;
putc('\n', stderr);
}
}
mutex_exit(&(buf_pool->mutex));
}
#endif /* UNIV_DEBUG */
......@@ -97,7 +97,8 @@ buf_read_page_low(
log mutex: the read must be handled before other reads
which might incur ibuf operations and thus write to the log */
printf("Log debug: reading replicate page in sync mode\n");
fputs("Log debug: reading replicate page in sync mode\n",
stderr);
sync = TRUE;
}
......@@ -117,7 +118,6 @@ buf_read_page_low(
or is being dropped; if we succeed in initing the page in the buffer
pool for read, then DISCARD cannot proceed until the read has
completed */
block = buf_page_init_for_read(err, mode, space, tablespace_version,
offset);
if (block == NULL) {
......@@ -125,11 +125,14 @@ buf_read_page_low(
return(0);
}
#ifdef UNIV_DEBUG
if (buf_debug_prints) {
printf("Posting read request for page %lu, sync %lu\n",
fprintf(stderr,
"Posting read request for page %lu, sync %lu\n",
(ulong) offset,
(ulong) sync);
}
#endif
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
......@@ -281,12 +284,14 @@ buf_read_ahead_random(
os_aio_simulated_wake_handler_threads();
#ifdef UNIV_DEBUG
if (buf_debug_prints && (count > 0)) {
printf("Random read-ahead space %lu offset %lu pages %lu\n",
fprintf(stderr,
"Random read-ahead space %lu offset %lu pages %lu\n",
(ulong) space, (ulong) offset,
(ulong) count);
}
#endif /* UNIV_DEBUG */
return(count);
}
......@@ -566,11 +571,13 @@ buf_read_ahead_linear(
/* Flush pages from the end of the LRU list if necessary */
buf_flush_free_margin();
#ifdef UNIV_DEBUG
if (buf_debug_prints && (count > 0)) {
printf(
fprintf(stderr,
"LINEAR read-ahead space %lu offset %lu pages %lu\n",
(ulong) space, (ulong) offset, (ulong) count);
}
#endif /* UNIV_DEBUG */
return(count);
}
......@@ -629,9 +636,13 @@ buf_read_ibuf_merge_pages(
/* Flush pages from the end of the LRU list if necessary */
buf_flush_free_margin();
#ifdef UNIV_DEBUG
if (buf_debug_prints) {
printf("Ibuf merge read-ahead pages %lu\n", (ulong) n_stored);
fprintf(stderr,
"Ibuf merge read-ahead space %lu pages %lu\n",
(ulong) space, (ulong) n_stored);
}
#endif /* UNIV_DEBUG */
}
/************************************************************************
......@@ -695,8 +706,10 @@ buf_read_recv_pages(
/* Flush pages from the end of the LRU list if necessary */
buf_flush_free_margin();
#ifdef UNIV_DEBUG
if (buf_debug_prints) {
printf("Recovery applies read-ahead pages %lu\n",
(ulong) n_stored);
fprintf(stderr,
"Recovery applies read-ahead pages %lu\n", (ulong) n_stored);
}
#endif /* UNIV_DEBUG */
}
......@@ -12,7 +12,6 @@ Created 5/30/1994 Heikki Tuuri
#include "data0data.ic"
#endif
#include "ut0rnd.h"
#include "rem0rec.h"
#include "rem0cmp.h"
#include "page0page.h"
......@@ -22,12 +21,10 @@ Created 5/30/1994 Heikki Tuuri
byte data_error; /* data pointers of tuple fields are initialized
to point here for error checking */
#ifdef UNIV_DEBUG
ulint data_dummy; /* this is used to fool the compiler in
dtuple_validate */
byte data_buf[8192]; /* used in generating test tuples */
ulint data_rnd = 756511;
#endif /* UNIV_DEBUG */
/* Some non-inlined functions used in the MySQL interface: */
void
......@@ -215,16 +212,15 @@ dtuple_check_typed_no_assert(
{
dfield_t* field;
ulint i;
char err_buf[1000];
if (dtuple_get_n_fields(tuple) > REC_MAX_N_FIELDS) {
fprintf(stderr,
"InnoDB: Error: index entry has %lu fields\n",
(ulong) dtuple_get_n_fields(tuple));
dtuple_sprintf(err_buf, 900, tuple);
fprintf(stderr,
"InnoDB: Tuple contents: %s\n", err_buf);
dump:
fputs("InnoDB: Tuple contents: ", stderr);
dtuple_print(stderr, tuple);
putc('\n', stderr);
return(FALSE);
}
......@@ -234,12 +230,7 @@ dtuple_check_typed_no_assert(
field = dtuple_get_nth_field(tuple, i);
if (!dfield_check_typed_no_assert(field)) {
dtuple_sprintf(err_buf, 900, tuple);
fprintf(stderr,
"InnoDB: Tuple contents: %s\n", err_buf);
return(FALSE);
goto dump;
}
}
......@@ -291,6 +282,7 @@ dtuple_check_typed(
return(TRUE);
}
#ifdef UNIV_DEBUG
/**************************************************************
Validates the consistency of a tuple which must be complete, i.e,
all fields must have been set. */
......@@ -338,6 +330,7 @@ dtuple_validate(
return(TRUE);
}
#endif /* UNIV_DEBUG */
/*****************************************************************
Pretty prints a dfield value according to its data type. */
......@@ -356,7 +349,7 @@ dfield_print(
data = dfield_get_data(dfield);
if (len == UNIV_SQL_NULL) {
printf("NULL");
fputs("NULL", stderr);
return;
}
......@@ -366,18 +359,12 @@ dfield_print(
if ((mtype == DATA_CHAR) || (mtype == DATA_VARCHAR)) {
for (i = 0; i < len; i++) {
if (isprint((char)(*data))) {
printf("%c", (char)*data);
} else {
printf(" ");
}
data++;
int c = *data++;
putc(isprint(c) ? c : ' ', stderr);
}
} else if (mtype == DATA_INT) {
ut_a(len == 4); /* only works for 32-bit integers */
printf("%i", (int)mach_read_from_4(data));
fprintf(stderr, "%d", (int)mach_read_from_4(data));
} else {
ut_error;
}
......@@ -402,7 +389,7 @@ dfield_print_also_hex(
data = dfield_get_data(dfield);
if (len == UNIV_SQL_NULL) {
printf("NULL");
fputs("NULL", stderr);
return;
}
......@@ -414,15 +401,12 @@ dfield_print_also_hex(
print_also_hex = FALSE;
for (i = 0; i < len; i++) {
if (isprint((char)(*data))) {
printf("%c", (char)*data);
} else {
int c = *data++;
if (!isprint(c)) {
print_also_hex = TRUE;
printf(" ");
c = ' ';
}
data++;
putc(c, stderr);
}
if (!print_also_hex) {
......@@ -430,18 +414,18 @@ dfield_print_also_hex(
return;
}
printf(" Hex: ");
fputs(" Hex: ", stderr);
data = dfield_get_data(dfield);
for (i = 0; i < len; i++) {
printf("%02lx", (ulong)*data);
fprintf(stderr, "%02lx", (ulint)*data);
data++;
}
} else if (mtype == DATA_INT) {
ut_a(len == 4); /* inly works for 32-bit integers */
printf("%i", (int)mach_read_from_4(data));
ut_a(len == 4); /* only works for 32-bit integers */
fprintf(stderr, "%d", (int)mach_read_from_4(data));
} else {
ut_error;
}
......@@ -453,6 +437,7 @@ The following function prints the contents of a tuple. */
void
dtuple_print(
/*=========*/
FILE* f, /* in: output stream */
dtuple_t* tuple) /* in: tuple */
{
dfield_t* field;
......@@ -461,73 +446,24 @@ dtuple_print(
n_fields = dtuple_get_n_fields(tuple);
printf("DATA TUPLE: %lu fields;\n", (ulong) n_fields);
for (i = 0; i < n_fields; i++) {
printf(" %lu:", (ulong) i);
field = dtuple_get_nth_field(tuple, i);
if (field->len != UNIV_SQL_NULL) {
ut_print_buf(field->data, field->len);
} else {
printf(" SQL NULL");
}
printf(";");
}
printf("\n");
dtuple_validate(tuple);
}
/**************************************************************
The following function prints the contents of a tuple to a buffer. */
ulint
dtuple_sprintf(
/*===========*/
/* out: printed length in bytes */
char* buf, /* in: print buffer */
ulint buf_len,/* in: buf length in bytes */
dtuple_t* tuple) /* in: tuple */
{
dfield_t* field;
ulint n_fields;
ulint len;
ulint i;
len = 0;
n_fields = dtuple_get_n_fields(tuple);
fprintf(f, "DATA TUPLE: %lu fields;\n", (ulong) n_fields);
for (i = 0; i < n_fields; i++) {
if (len + 30 > buf_len) {
return(len);
}
len += sprintf(buf + len, " %lu:", (ulong) i);
fprintf(f, " %lu:", (ulong) i);
field = dtuple_get_nth_field(tuple, i);
if (field->len != UNIV_SQL_NULL) {
if (5 * field->len + len + 30 > buf_len) {
return(len);
}
len += ut_sprintf_buf(buf + len, field->data,
field->len);
ut_print_buf(f, field->data, field->len);
} else {
len += sprintf(buf + len, " SQL NULL");
fputs(" SQL NULL", f);
}
len += sprintf(buf + len, ";");
putc(';', f);
}
return(len);
putc('\n', f);
ut_ad(dtuple_validate(tuple));
}
/******************************************************************
......@@ -561,7 +497,6 @@ dtuple_convert_big_rec(
ibool is_externally_stored;
ulint i;
ulint j;
char err_buf[1000];
ut_a(dtuple_check_typed_no_assert(entry));
......@@ -570,10 +505,9 @@ dtuple_convert_big_rec(
if (size > 1000000000) {
fprintf(stderr,
"InnoDB: Warning: tuple size very big: %lu\n", (ulong) size);
dtuple_sprintf(err_buf, 900, entry);
fprintf(stderr,
"InnoDB: Tuple contents: %s\n", err_buf);
fputs("InnoDB: Tuple contents: ", stderr);
dtuple_print(stderr, entry);
putc('\n', stderr);
}
heap = mem_heap_create(size + dtuple_get_n_fields(entry)
......
......@@ -104,6 +104,7 @@ dtype_form_prtype(
return(old_prtype + (charset_coll << 16));
}
#ifdef UNIV_DEBUG
/*************************************************************************
Validates a data type structure. */
......@@ -122,6 +123,7 @@ dtype_validate(
return(TRUE);
}
#endif /* UNIV_DEBUG */
/*************************************************************************
Prints a data type structure. */
......@@ -140,19 +142,19 @@ dtype_print(
mtype = type->mtype;
prtype = type->prtype;
if (mtype == DATA_VARCHAR) {
printf("DATA_VARCHAR");
fputs("DATA_VARCHAR", stderr);
} else if (mtype == DATA_CHAR) {
printf("DATA_CHAR");
fputs("DATA_CHAR", stderr);
} else if (mtype == DATA_BINARY) {
printf("DATA_BINARY");
fputs("DATA_BINARY", stderr);
} else if (mtype == DATA_INT) {
printf("DATA_INT");
fputs("DATA_INT", stderr);
} else if (mtype == DATA_MYSQL) {
printf("DATA_MYSQL");
fputs("DATA_MYSQL", stderr);
} else if (mtype == DATA_SYS) {
printf("DATA_SYS");
fputs("DATA_SYS", stderr);
} else {
printf("type %lu", (ulong) mtype);
fprintf(stderr, "type %lu", (ulong) mtype);
}
len = type->len;
......@@ -160,24 +162,24 @@ dtype_print(
if ((type->mtype == DATA_SYS)
|| (type->mtype == DATA_VARCHAR)
|| (type->mtype == DATA_CHAR)) {
printf(" ");
putc(' ', stderr);
if (prtype == DATA_ROW_ID) {
printf("DATA_ROW_ID");
fputs("DATA_ROW_ID", stderr);
len = DATA_ROW_ID_LEN;
} else if (prtype == DATA_ROLL_PTR) {
printf("DATA_ROLL_PTR");
fputs("DATA_ROLL_PTR", stderr);
len = DATA_ROLL_PTR_LEN;
} else if (prtype == DATA_TRX_ID) {
printf("DATA_TRX_ID");
fputs("DATA_TRX_ID", stderr);
len = DATA_TRX_ID_LEN;
} else if (prtype == DATA_MIX_ID) {
printf("DATA_MIX_ID");
fputs("DATA_MIX_ID", stderr);
} else if (prtype == DATA_ENGLISH) {
printf("DATA_ENGLISH");
fputs("DATA_ENGLISH", stderr);
} else {
printf("prtype %lu", (ulong) mtype);
fprintf(stderr, "prtype %lu", (ulong) mtype);
}
}
printf(" len %lu prec %lu", (ulong) len, (ulong) type->prec);
fprintf(stderr, " len %lu prec %lu", (ulong) len, (ulong) type->prec);
}
......@@ -71,7 +71,8 @@ dict_hdr_get_new_id(
compile wrong */
if (0 == ut_dulint_cmp(id, ut_dulint_max)) {
printf("Max id\n");
/* TO DO: remove this code, or make it conditional */
ut_dbg_null_ptr = 0;
}
id = ut_dulint_add(id, 1);
......
This diff is collapsed.
This diff is collapsed.
......@@ -40,7 +40,6 @@ dict_get_first_table_name_in_db(
rec_t* rec;
byte* field;
ulint len;
char* table_name;
mtr_t mtr;
#ifdef UNIV_SYNC_DEBUG
......@@ -92,9 +91,7 @@ loop:
/* We found one */
table_name = mem_alloc(len + 1);
ut_memcpy(table_name, field, len);
table_name[len] = '\0';
char* table_name = mem_strdupl(field, len);
btr_pcur_close(&pcur);
mtr_commit(&mtr);
......@@ -124,7 +121,6 @@ dict_print(void)
byte* field;
ulint len;
mtr_t mtr;
char table_name[10000];
mutex_enter(&(dict_sys->mutex));
......@@ -157,18 +153,19 @@ loop:
/* We found one */
ut_memcpy(table_name, field, len);
table_name[len] = '\0';
char* table_name = mem_strdupl(field, len);
btr_pcur_store_position(&pcur, &mtr);
mtr_commit(&mtr);
table = dict_table_get_low(table_name);
mem_free(table_name);
if (table == NULL) {
fprintf(stderr, "InnoDB: Failed to load table %s\n",
table_name);
fputs("InnoDB: Failed to load table ", stderr);
ut_print_namel(stderr, field, len);
putc('\n', stderr);
} else {
/* The table definition was corrupt if there
is no index */
......@@ -300,7 +297,6 @@ dict_load_columns(
byte* field;
ulint len;
byte* buf;
char* name_buf;
char* name;
ulint mtype;
ulint prtype;
......@@ -351,12 +347,7 @@ dict_load_columns(
dict_table_get_first_index(sys_columns), 4))->name));
field = rec_get_nth_field(rec, 4, &len);
name_buf = mem_heap_alloc(heap, len + 1);
ut_memcpy(name_buf, field, len);
name_buf[len] = '\0';
name = name_buf;
name = mem_heap_strdupl(heap, field, len);
field = rec_get_nth_field(rec, 5, &len);
mtype = mach_read_from_4(field);
......@@ -393,6 +384,27 @@ dict_load_columns(
mtr_commit(&mtr);
}
/************************************************************************
Report that an index field or index for a table has been delete marked. */
static
void
dict_load_report_deleted_index(
char* name, /* in: table name */
ulint field) /* in: index field, or ULINT_UNDEFINED */
{
fputs("InnoDB: Error: data dictionary entry"
" for table ", stderr);
ut_print_name(stderr, name);
fputs(" is corrupt!\n", stderr);
if (field != ULINT_UNDEFINED) {
fprintf(stderr,
"InnoDB: Index field %lu is delete marked.\n", field);
}
else {
fputs("InnoDB: An index is delete marked.\n", stderr);
}
}
/************************************************************************
Loads definitions for index fields. */
static
......@@ -408,7 +420,6 @@ dict_load_fields(
btr_pcur_t pcur;
dtuple_t* tuple;
dfield_t* dfield;
char* col_name;
ulint pos_and_prefix_len;
ulint prefix_len;
rec_t* rec;
......@@ -446,10 +457,7 @@ dict_load_fields(
ut_a(btr_pcur_is_on_user_rec(&pcur, &mtr));
if (rec_get_deleted_flag(rec)) {
fprintf(stderr,
"InnoDB: Error: data dictionary entry for table %s is corrupt!\n"
"InnoDB: An index field is delete marked.\n",
table->name);
dict_load_report_deleted_index(table->name, i);
}
field = rec_get_nth_field(rec, 0, &len);
......@@ -487,11 +495,8 @@ dict_load_fields(
field = rec_get_nth_field(rec, 4, &len);
col_name = mem_heap_alloc(heap, len + 1);
ut_memcpy(col_name, field, len);
col_name[len] = '\0';
dict_mem_index_add_field(index, col_name, 0, prefix_len);
dict_mem_index_add_field(index,
mem_heap_strdupl(heap, field, len), 0, prefix_len);
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
}
......@@ -575,10 +580,8 @@ dict_load_indexes(
}
if (rec_get_deleted_flag(rec)) {
fprintf(stderr,
"InnoDB: Error: data dictionary entry for table %s is corrupt!\n"
"InnoDB: An index is delete marked.\n",
table->name);
dict_load_report_deleted_index(table->name,
ULINT_UNDEFINED);
btr_pcur_close(&pcur);
mtr_commit(&mtr);
......@@ -596,10 +599,7 @@ dict_load_indexes(
dict_table_get_first_index(sys_indexes), 4))->name));
field = rec_get_nth_field(rec, 4, &name_len);
name_buf = mem_heap_alloc(heap, name_len + 1);
ut_memcpy(name_buf, field, name_len);
name_buf[name_len] = '\0';
name_buf = mem_heap_strdupl(heap, field, name_len);
field = rec_get_nth_field(rec, 5, &len);
n_fields = mach_read_from_4(field);
......@@ -620,11 +620,13 @@ dict_load_indexes(
if (page_no == FIL_NULL) {
fprintf(stderr,
"InnoDB: Error: trying to load index %s for table %s\n"
"InnoDB: but the index tree has been freed!\n",
name_buf, table->name);
fputs("InnoDB: Error: trying to load index ", stderr);
ut_print_name(stderr, name_buf);
fputs(" for table ", stderr);
ut_print_name(stderr, table->name);
fputs("\n"
"InnoDB: but the index tree has been freed!\n", stderr);
btr_pcur_close(&pcur);
mtr_commit(&mtr);
......@@ -634,10 +636,12 @@ dict_load_indexes(
if ((type & DICT_CLUSTERED) == 0
&& NULL == dict_table_get_first_index(table)) {
fprintf(stderr,
"InnoDB: Error: trying to load index %s for table %s\n"
"InnoDB: but the first index was not clustered!\n",
name_buf, table->name);
fputs("InnoDB: Error: trying to load index ", stderr);
ut_print_namel(stderr, name_buf, name_len);
fputs(" for table ", stderr);
ut_print_name(stderr, table->name);
fputs("\n"
"InnoDB: but the first index is not clustered!\n", stderr);
btr_pcur_close(&pcur);
mtr_commit(&mtr);
......@@ -648,7 +652,7 @@ dict_load_indexes(
if (is_sys_table
&& ((type & DICT_CLUSTERED)
|| ((table == dict_sys->sys_tables)
&& (name_len == ut_strlen("ID_IND"))
&& (name_len == (sizeof "ID_IND") - 1)
&& (0 == ut_memcmp(name_buf, (char*) "ID_IND",
name_len))))) {
......@@ -702,7 +706,6 @@ dict_load_table(
rec_t* rec;
byte* field;
ulint len;
char* buf;
ulint space;
ulint n_cols;
ulint err;
......@@ -802,15 +805,13 @@ dict_load_table(
if (table->type == DICT_TABLE_CLUSTER_MEMBER) {
ut_error;
#if 0 /* clustered tables have not been implemented yet */
field = rec_get_nth_field(rec, 6, &len);
table->mix_id = mach_read_from_8(field);
field = rec_get_nth_field(rec, 8, &len);
buf = mem_heap_alloc(heap, len);
ut_memcpy(buf, field, len);
table->cluster_name = buf;
table->cluster_name = mem_heap_strdupl(heap, field, len);
#endif
}
if ((table->type == DICT_TABLE_CLUSTER)
......@@ -879,7 +880,6 @@ dict_load_table_on_id(
byte* field;
ulint len;
dict_table_t* table;
char* name;
mtr_t mtr;
#ifdef UNIV_SYNC_DEBUG
......@@ -942,13 +942,8 @@ dict_load_table_on_id(
/* Now we get the table name from the record */
field = rec_get_nth_field(rec, 1, &len);
name = mem_heap_alloc(heap, len + 1);
ut_memcpy(name, field, len);
name[len] = '\0';
/* Load the table definition to memory */
table = dict_load_table(name);
table = dict_load_table(mem_heap_strdupl(heap, field, len));
btr_pcur_close(&pcur);
mtr_commit(&mtr);
......@@ -995,7 +990,6 @@ dict_load_foreign_cols(
btr_pcur_t pcur;
dtuple_t* tuple;
dfield_t* dfield;
char* col_name;
rec_t* rec;
byte* field;
ulint len;
......@@ -1040,21 +1034,13 @@ dict_load_foreign_cols(
ut_a(i == mach_read_from_4(field));
field = rec_get_nth_field(rec, 4, &len);
col_name = mem_heap_alloc(foreign->heap, len + 1);
ut_memcpy(col_name, field, len);
col_name[len] = '\0';
foreign->foreign_col_names[i] = col_name;
foreign->foreign_col_names[i] =
mem_heap_strdupl(foreign->heap, field, len);
field = rec_get_nth_field(rec, 5, &len);
foreign->referenced_col_names[i] =
mem_heap_strdupl(foreign->heap, field, len);
col_name = mem_heap_alloc(foreign->heap, len + 1);
ut_memcpy(col_name, field, len);
col_name[len] = '\0';
foreign->referenced_col_names[i] = col_name;
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
}
......@@ -1110,8 +1096,10 @@ dict_load_foreign(
|| rec_get_deleted_flag(rec)) {
/* Not found */
fprintf(stderr,
"InnoDB: Error A: cannot load foreign constraint %s\n", id);
fputs("InnoDB: Error A: cannot load foreign constraint ",
stderr);
ut_print_name(stderr, id);
putc('\n', stderr);
btr_pcur_close(&pcur);
mtr_commit(&mtr);
......@@ -1125,8 +1113,10 @@ dict_load_foreign(
/* Check if the id in record is the searched one */
if (len != ut_strlen(id) || ut_memcmp(id, field, len) != 0) {
fprintf(stderr,
"InnoDB: Error B: cannot load foreign constraint %s\n", id);
fputs("InnoDB: Error B: cannot load foreign constraint ",
stderr);
ut_print_name(stderr, id);
putc('\n', stderr);
btr_pcur_close(&pcur);
mtr_commit(&mtr);
......@@ -1151,23 +1141,15 @@ dict_load_foreign(
foreign->type = foreign->n_fields >> 24;
foreign->n_fields = foreign->n_fields & 0xFFFFFFUL;
foreign->id = mem_heap_alloc(foreign->heap, ut_strlen(id) + 1);
ut_memcpy(foreign->id, id, ut_strlen(id) + 1);
foreign->id = mem_heap_strdup(foreign->heap, id);
field = rec_get_nth_field(rec, 3, &len);
foreign->foreign_table_name = mem_heap_alloc(foreign->heap, 1 + len);
ut_memcpy(foreign->foreign_table_name, field, len);
foreign->foreign_table_name[len] = '\0';
foreign->foreign_table_name =
mem_heap_strdupl(foreign->heap, field, len);
field = rec_get_nth_field(rec, 4, &len);
foreign->referenced_table_name = mem_heap_alloc(foreign->heap,
1 + len);
ut_memcpy(foreign->referenced_table_name, field, len);
foreign->referenced_table_name[len] = '\0';
foreign->referenced_table_name =
mem_heap_strdupl(foreign->heap, field, len);
btr_pcur_close(&pcur);
mtr_commit(&mtr);
......@@ -1281,10 +1263,7 @@ loop:
/* Now we get a foreign key constraint id */
field = rec_get_nth_field(rec, 1, &len);
id = mem_heap_alloc(heap, len + 1);
ut_memcpy(id, field, len);
id[len] = '\0';
id = mem_heap_strdupl(heap, field, len);
btr_pcur_store_position(&pcur, &mtr);
......
......@@ -49,9 +49,7 @@ dict_mem_table_create(
table->heap = heap;
str = mem_heap_alloc(heap, 1 + ut_strlen(name));
ut_strcpy(str, name);
str = mem_heap_strdup(heap, name);
table->type = DICT_TABLE_ORDINARY;
table->name = str;
......@@ -148,7 +146,6 @@ dict_mem_table_add_col(
ulint len, /* in: length */
ulint prec) /* in: precision */
{
char* str;
dict_col_t* col;
dtype_t* type;
......@@ -156,15 +153,11 @@ dict_mem_table_add_col(
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
table->n_def++;
col = dict_table_get_nth_col(table, table->n_def - 1);
str = mem_heap_alloc(table->heap, 1 + ut_strlen(name));
ut_strcpy(str, name);
col = dict_table_get_nth_col(table, table->n_def - 1);
col->ind = table->n_def - 1;
col->name = str;
col->name = mem_heap_strdup(table->heap, name);
col->table = table;
col->ord_part = 0;
......@@ -190,7 +183,6 @@ dict_mem_index_create(
ulint type, /* in: DICT_UNIQUE, DICT_CLUSTERED, ... ORed */
ulint n_fields) /* in: number of fields */
{
char* str;
dict_index_t* index;
mem_heap_t* heap;
......@@ -201,13 +193,9 @@ dict_mem_index_create(
index->heap = heap;
str = mem_heap_alloc(heap, 1 + ut_strlen(index_name));
ut_strcpy(str, index_name);
index->type = type;
index->space = space;
index->name = str;
index->name = mem_heap_strdup(heap, index_name);
index->table_name = table_name;
index->table = NULL;
index->n_def = 0;
......@@ -303,56 +291,3 @@ dict_mem_index_free(
{
mem_heap_free(index->heap);
}
/**************************************************************************
Creates a procedure memory object. */
dict_proc_t*
dict_mem_procedure_create(
/*======================*/
/* out, own: procedure object */
char* name, /* in: procedure name */
char* sql_string, /* in: procedure definition as an SQL
string */
que_fork_t* graph) /* in: parsed procedure graph */
{
dict_proc_t* proc;
proc_node_t* proc_node;
mem_heap_t* heap;
char* str;
ut_ad(name);
heap = mem_heap_create(128);
proc = mem_heap_alloc(heap, sizeof(dict_proc_t));
proc->heap = heap;
str = mem_heap_alloc(heap, 1 + ut_strlen(name));
ut_strcpy(str, name);
proc->name = str;
str = mem_heap_alloc(heap, 1 + ut_strlen(sql_string));
ut_strcpy(str, sql_string);
proc->sql_string = str;
UT_LIST_INIT(proc->graphs);
/* UT_LIST_ADD_LAST(graphs, proc->graphs, graph); */
#ifdef UNIV_DEBUG
UT_LIST_VALIDATE(graphs, que_t, proc->graphs);
#endif
proc->mem_fix = 0;
proc_node = que_fork_get_child(graph);
proc_node->dict_proc = proc;
return(proc);
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -490,6 +490,7 @@ flst_validate(
return(TRUE);
}
#ifdef UNIV_DEBUG
/************************************************************************
Prints info of a file-based list. */
......@@ -509,9 +510,11 @@ flst_print(
len = flst_get_len(base, mtr);
printf("FILE-BASED LIST:\n");
printf("Base node in space %lu page %lu byte offset %lu; len %lu\n",
fprintf(stderr,
"FILE-BASED LIST:\n"
"Base node in space %lu page %lu byte offset %lu; len %lu\n",
(ulong) buf_frame_get_space_id(frame),
(ulong) buf_frame_get_page_no(frame),
(ulong) (base - frame), (ulong) len);
}
#endif /* UNIV_DEBUG */
This diff is collapsed.
This diff is collapsed.
......@@ -392,6 +392,7 @@ btr_page_free_low(
page_t* page, /* in: page to be freed, x-latched */
ulint level, /* in: page level */
mtr_t* mtr); /* in: mtr */
#ifdef UNIV_DEBUG
/*****************************************************************
Prints size info of a B-tree. */
......@@ -408,6 +409,7 @@ btr_print_tree(
dict_tree_t* tree, /* in: tree */
ulint width); /* in: print this many entries from start
and end */
#endif /* UNIV_DEBUG */
/****************************************************************
Checks the size and number of fields in a record based on the definition of
the index. */
......
This diff is collapsed.
This diff is collapsed.
......@@ -97,6 +97,7 @@ buf_flush_ready_for_replace(
/* out: TRUE if can replace immediately */
buf_block_t* block); /* in: buffer control block, must be in state
BUF_BLOCK_FILE_PAGE and in the LRU list */
#ifdef UNIV_DEBUG
/**********************************************************************
Validates the flush list. */
......@@ -104,6 +105,7 @@ ibool
buf_flush_validate(void);
/*====================*/
/* out: TRUE if ok */
#endif /* UNIV_DEBUG */
/* When buf_flush_free_margin is called, it tries to make this many blocks
available to replacement in the free list and at the end of the LRU list (to
......
......@@ -112,6 +112,7 @@ void
buf_LRU_make_block_old(
/*===================*/
buf_block_t* block); /* in: control block */
#ifdef UNIV_DEBUG
/**************************************************************************
Validates the LRU list. */
......@@ -124,6 +125,7 @@ Prints the LRU list. */
void
buf_LRU_print(void);
/*===============*/
#endif /* UNIV_DEBUG */
#ifndef UNIV_NONINL
#include "buf0lru.ic"
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment