Commit 1065f2bb authored by unknown's avatar unknown

Merge with 4.0


innobase/dict/dict0boot.c:
  Auto merged
innobase/dict/dict0load.c:
  Auto merged
innobase/dict/dict0mem.c:
  Auto merged
innobase/fut/fut0lst.c:
  Auto merged
innobase/include/buf0lru.h:
  Auto merged
innobase/include/dict0mem.h:
  Auto merged
innobase/include/fsp0fsp.h:
  Auto merged
innobase/include/ha0ha.h:
  Auto merged
innobase/include/ibuf0ibuf.h:
  Auto merged
innobase/include/lock0lock.h:
  Auto merged
innobase/include/log0log.h:
  Auto merged
innobase/include/mem0pool.h:
  Auto merged
innobase/include/mtr0mtr.h:
  Auto merged
innobase/include/os0file.h:
  Auto merged
innobase/include/rem0rec.h:
  Auto merged
innobase/include/rem0rec.ic:
  Auto merged
innobase/include/srv0srv.h:
  Auto merged
innobase/include/sync0sync.h:
  Auto merged
innobase/include/trx0sys.h:
  Auto merged
innobase/include/ut0byte.h:
  Auto merged
innobase/include/ut0ut.h:
  Auto merged
innobase/mem/mem0pool.c:
  Auto merged
innobase/mtr/mtr0mtr.c:
  Auto merged
innobase/os/os0proc.c:
  Auto merged
innobase/pars/lexyy.c:
  Auto merged
innobase/pars/pars0opt.c:
  Auto merged
innobase/row/row0ins.c:
  Auto merged
innobase/row/row0purge.c:
  Auto merged
innobase/row/row0uins.c:
  Auto merged
innobase/row/row0umod.c:
  Auto merged
innobase/row/row0undo.c:
  Auto merged
innobase/row/row0upd.c:
  Auto merged
innobase/trx/trx0purge.c:
  Auto merged
innobase/trx/trx0roll.c:
  Auto merged
innobase/trx/trx0sys.c:
  Auto merged
innobase/trx/trx0undo.c:
  Auto merged
innobase/ut/ut0byte.c:
  Auto merged
pstack/bucomm.h:
  Auto merged
pstack/budbg.h:
  Auto merged
sql/item_sum.h:
  Auto merged
sql/slave.cc:
  Auto merged
sql/sql_db.cc:
  Auto merged
support-files/mysql.spec.sh:
  Auto merged
tests/insert_test.c:
  Auto merged
mysql-test/t/func_group.test:
  Merge with 4.0
  Put 4.1 tests lasts
sql/ha_innodb.cc:
  Merge with 4.0
  Added checking of results from my_malloc()
BitKeeper/etc/logging_ok:
  Logging to logging@openlogging.org accepted
parents 0ba6cb48 6366a909
......@@ -90,6 +90,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.
......
......@@ -859,11 +859,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('"', file);
}
}
fputs(" />\n", xml_file);
......@@ -1413,12 +1413,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 +1432,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 +1442,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 +1486,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 @@ 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,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 */
......@@ -207,12 +207,14 @@ 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 +406,20 @@ 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",
(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;
......@@ -889,6 +883,7 @@ buf_LRU_block_free_hashed_page(
buf_LRU_block_free_non_file_page(block);
}
#ifdef UNIV_DEBUG
/**************************************************************************
Validates the LRU list. */
......@@ -975,7 +970,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 +978,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) {
......@@ -281,12 +281,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 +568,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 +633,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 +703,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);
......@@ -157,18 +154,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 +298,6 @@ dict_load_columns(
byte* field;
ulint len;
byte* buf;
char* name_buf;
char* name;
ulint mtype;
ulint prtype;
......@@ -351,12 +348,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 +385,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 +421,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 +458,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 +496,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 +581,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 +600,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 +621,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 +637,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 +653,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 +707,6 @@ dict_load_table(
rec_t* rec;
byte* field;
ulint len;
char* buf;
ulint space;
ulint n_cols;
ulint err;
......@@ -802,15 +806,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 +881,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 +943,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 +991,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 +1035,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 +1097,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 +1114,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 +1142,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 +1264,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;
......@@ -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);
}
......@@ -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);
sprintf((char*)data, "%10li", int_val);
/* 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);
dfield_set_len(que_node_get_val(func_node), 10);
/* add terminating NUL character */
data[int_len] = 0;
/* 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();
......
......@@ -86,7 +86,7 @@ the count drops to zero. */
/* When mysqld is run, the default directory "." is the mysqld datadir,
but in the MySQL Embedded Server Library and ibbackup it is not the default
directory, and we must set the base file path explicitly */
char* fil_path_to_mysql_datadir = (char*)".";
const char* fil_path_to_mysql_datadir = (char*)".";
ulint fil_n_pending_log_flushes = 0;
ulint fil_n_pending_tablespace_flushes = 0;
......@@ -399,7 +399,6 @@ fil_node_create(
fil_system_t* system = fil_system;
fil_node_t* node;
fil_space_t* space;
char* name2;
ut_a(system);
ut_a(name);
......@@ -408,11 +407,7 @@ fil_node_create(
node = mem_alloc(sizeof(fil_node_t));
name2 = mem_alloc(ut_strlen(name) + 1);
ut_strcpy(name2, name);
node->name = name2;
node->name = mem_strdup(name);
node->open = FALSE;
ut_a(!is_raw || srv_start_raw_disk_in_use);
......@@ -433,7 +428,7 @@ fil_node_create(
fprintf(stderr,
" InnoDB: Error: Could not find tablespace %lu for\n"
"InnoDB: file %s from the tablespace memory cache.\n", (ulong) id, name);
mem_free(name2);
mem_free(node->name);
mem_free(node);
......@@ -816,7 +811,6 @@ fil_space_create(
{
fil_system_t* system = fil_system;
fil_space_t* space;
char* name2;
ulint namesake_id;
try_again:
/*printf(
......@@ -881,11 +875,7 @@ fil_space_create(
space = mem_alloc(sizeof(fil_space_t));
name2 = mem_alloc(ut_strlen(name) + 1);
ut_strcpy(name2, name);
space->name = name2;
space->name = mem_strdup(name);
space->id = id;
system->tablespace_version++;
......@@ -3726,7 +3716,7 @@ fil_aio_wait(
ut_ad(fil_validate());
if (os_aio_use_native_aio) {
srv_io_thread_op_info[segment] = (char *) "handle native aio";
srv_set_io_thread_op_info(segment, "native aio handle");
#ifdef WIN_ASYNC_IO
ret = os_aio_windows_handle(segment, 0, (void**) &fil_node,
&message, &type);
......@@ -3737,7 +3727,7 @@ fil_aio_wait(
ut_error;
#endif
} else {
srv_io_thread_op_info[segment] =(char *)"handle simulated aio";
srv_set_io_thread_op_info(segment, "simulated aio handle");
ret = os_aio_simulated_handle(segment, (void**) &fil_node,
&message, &type);
......@@ -3745,7 +3735,7 @@ fil_aio_wait(
ut_a(ret);
srv_io_thread_op_info[segment] = (char *) "complete io for fil node";
srv_set_io_thread_op_info(segment, "complete io for fil node");
mutex_enter(&(system->mutex));
......@@ -3762,11 +3752,10 @@ fil_aio_wait(
open, and use a special i/o thread to serve insert buffer requests. */
if (buf_pool_is_block(message)) {
srv_io_thread_op_info[segment] =
(char *) "complete io for buf page";
srv_set_io_thread_op_info(segment, "complete io for buf page");
buf_page_io_complete(message);
} else {
srv_io_thread_op_info[segment] =(char *) "complete io for log";
srv_set_io_thread_op_info(segment, "complete io for log");
log_io_complete(message);
}
}
......@@ -3847,7 +3836,9 @@ fil_flush(
mutex_exit(&(system->mutex));
/* printf("Flushing to file %s\n", node->name); */
/* fprintf(stderr, "Flushing to file %s\n",
node->name); */
os_file_flush(file);
mutex_enter(&(system->mutex));
......
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.
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