Commit ef18b137 authored by monty@mishka.local's avatar monty@mishka.local

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

into mishka.local:/home/my/mysql-4.1
parents 5bbc955a e9cfe01d
......@@ -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>
......@@ -132,9 +132,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 +145,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,6 +157,10 @@ 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,
......@@ -483,7 +484,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 +860,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 +898,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 +982,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 +1178,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 +1419,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 +1438,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 +1448,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 +1492,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) {
page_mode = PAGE_CUR_LE;
} else if (mode == PAGE_CUR_LE) {
break;
case PAGE_CUR_G:
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 @@ btr_cur_search_to_nth_level(
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 @@ btr_cur_search_to_nth_level(
/* 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 @@ btr_cur_optimistic_insert(
*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 @@ btr_cur_optimistic_insert(
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 @@ btr_search_update_hash_on_insert(
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,9 +1566,9 @@ 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",
"ptr mem address %p index id %lu %lu, node fold %lu, rec fold %lu\n",
(ulong) buf_frame_get_page_no(page),
(ulong)(node->data),
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,
......@@ -1577,16 +1577,12 @@ btr_search_validate(void)
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"
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,
page, (ulong) block->is_hashed,
(ulong) block->curr_n_fields,
(ulong) block->curr_n_bytes, (ulong) block->curr_side);
......
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",
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);
} else if (flush_type == BUF_FLUSH_LIST) {
printf("Flushed %lu pages in flush list flush\n",
(ulong) page_count);
} else {
ut_error;
}
}
#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 @@ buf_LRU_invalidate_tablespace(
}
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,29 +409,22 @@ buf_LRU_get_free_block(void)
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",
"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",
(ulong) n_iterations,
(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) fil_n_pending_tablespace_flushes,
(ulong) os_n_file_reads, (ulong) os_n_file_writes,
(ulong) os_n_fsyncs);
fprintf(stderr,
"InnoDB: Starting InnoDB Monitor to print further\n"
"InnoDB: diagnostics to the standard output.\n");
mon_value_was = srv_print_innodb_monitor;
started_monitor = TRUE;
srv_print_innodb_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 @@ dict_get_first_table_name_in_db(
/* 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 @@ dict_print(void)
/* 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,10 +620,12 @@ 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,20 +1034,12 @@ 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);
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;
foreign->referenced_col_names[i] =
mem_heap_strdupl(foreign->heap, field, len);
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 @@ dict_load_foreigns(
/* 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;
......@@ -159,12 +156,8 @@ dict_mem_table_add_col(
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->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);
}
......@@ -311,12 +311,13 @@ eval_predefined_2(
arg = que_node_get_next(arg);
}
printf("\n");
putc('\n', stderr);
} else if (func == PARS_ASSERT_TOKEN) {
if (!eval_node_get_ibool_val(arg1)) {
printf("SQL assertion fails in a stored procedure!\n");
fputs("SQL assertion fails in a stored procedure!\n",
stderr);
}
ut_a(eval_node_get_ibool_val(arg1));
......@@ -667,7 +668,6 @@ eval_predefined(
{
que_node_t* arg1;
lint int_val;
byte* str1;
byte* data;
int func;
......@@ -681,21 +681,63 @@ eval_predefined(
} else if (func == PARS_TO_CHAR_TOKEN) {
/* Convert number to character string as a
signed decimal integer. */
ulint uint_val;
int int_len;
int_val = eval_node_get_int_val(arg1);
data = eval_node_ensure_val_buf(func_node, 11);
/* Determine the length of the string. */
if (int_val == 0) {
int_len = 1; /* the number 0 occupies 1 byte */
} else {
int_len = 0;
if (int_val < 0) {
uint_val = ((ulint) -int_val - 1) + 1;
int_len++; /* reserve space for minus sign */
} else {
uint_val = (ulint) int_val;
}
for (; uint_val > 0; int_len++) {
uint_val /= 10;
}
}
/* allocate the string */
data = eval_node_ensure_val_buf(func_node, int_len + 1);
sprintf((char*)data, "%10li", int_val);
/* add terminating NUL character */
data[int_len] = 0;
dfield_set_len(que_node_get_val(func_node), 10);
/* convert the number */
if (int_val == 0) {
data[0] = '0';
} else {
int tmp;
if (int_val < 0) {
data[0] = '-'; /* preceding minus sign */
uint_val = ((ulint) -int_val - 1) + 1;
} else {
uint_val = (ulint) int_val;
}
for (tmp = int_len; uint_val > 0; uint_val /= 10) {
data[--tmp] = '0' + (uint_val % 10);
}
}
dfield_set_len((dfield_t*) que_node_get_val(func_node),
int_len);
return;
} else if (func == PARS_TO_NUMBER_TOKEN) {
str1 = dfield_get_data(que_node_get_val(arg1));
int_val = atoi((char*)str1);
int_val = atoi((char*)
dfield_get_data(que_node_get_val(arg1)));
} else if (func == PARS_SYSDATE_TOKEN) {
int_val = (lint)ut_time();
......
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 */
......@@ -317,23 +317,14 @@ Prints info of a hash table. */
void
ha_print_info(
/*==========*/
char* buf, /* in/out: buffer where to print */
char* buf_end,/* in: buffer end */
FILE* file, /* in: file where to print */
hash_table_t* table) /* in: hash table */
{
hash_cell_t* cell;
/* ha_node_t* node;
ulint nodes = 0;
ulint len = 0;
ulint max_len = 0; */
ulint cells = 0;
ulint n_bufs;
ulint i;
if (buf_end - buf < 200) {
return;
}
for (i = 0; i < hash_get_n_cells(table); i++) {
cell = hash_get_nth_cell(table, i);
......@@ -341,33 +332,12 @@ ha_print_info(
if (cell->node) {
cells++;
/*
len = 0;
node = cell->node;
for (;;) {
len++;
nodes++;
if (ha_chain_get_next(table, node) == NULL) {
break;
}
node = node->next;
}
if (len > max_len) {
max_len = len;
}
*/
}
}
buf += sprintf(buf,
"Hash table size %lu, used cells %lu", (ulong) hash_get_n_cells(table),
(ulong) cells);
fprintf(file,
"Hash table size %lu, used cells %lu",
(ulong) hash_get_n_cells(table), (ulong) cells);
if (table->heaps == NULL && table->heap != NULL) {
......@@ -380,6 +350,6 @@ ha_print_info(
n_bufs++;
}
buf += sprintf(buf, ", node heap has %lu buffer(s)\n", (ulong) n_bufs);
fprintf(file, ", node heap has %lu buffer(s)\n", (ulong) n_bufs);
}
}
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.
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.
......@@ -15,7 +15,6 @@ typedef struct dict_field_struct dict_field_t;
typedef struct dict_index_struct dict_index_t;
typedef struct dict_tree_struct dict_tree_t;
typedef struct dict_table_struct dict_table_t;
typedef struct dict_proc_struct dict_proc_t;
typedef struct dict_foreign_struct dict_foreign_t;
/* A cluster object is a table object with the type field set to
......
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