mirror of
https://github.com/MariaDB/server.git
synced 2026-05-10 17:14:30 +02:00
InnoDB: send diagnostic output to stderr or files
instead of stdout or fixed-size memory buffers innobase/btr/btr0btr.c: Output to stderr; quote table and index names innobase/btr/btr0cur.c: Output to stderr; quote table and index names innobase/btr/btr0sea.c: Output to stderr innobase/buf/buf0buf.c: Output to stderr; quote table and index names innobase/buf/buf0flu.c: Output to stderr innobase/buf/buf0lru.c: Output to stderr innobase/buf/buf0rea.c: Output to stderr innobase/data/data0data.c: Remove dtuple_validate() unless #ifdef UNIV_DEBUG Remove unnecessary sprintf() calls Output to stderr innobase/data/data0type.c: Output to stderr innobase/dict/dict0boot.c: Remove dummy call to printf() innobase/dict/dict0crea.c: Output diagnostic information to stream, not to memory innobase/dict/dict0dict.c: Output diagnostics to a file, not to a memory buffer innobase/dict/dict0load.c: Output to stderr; quote table and index names innobase/eval/eval0eval.c: Output to stderr innobase/fil/fil0fil.c: Output to stderr innobase/fsp/fsp0fsp.c: Output to stderr Avoid sprintf() innobase/fut/fut0lst.c: Output to stderr innobase/ha/ha0ha.c: Output to stream, not to memory buffer innobase/ibuf/ibuf0ibuf.c: Output to stderr Avoid sprintf() innobase/include/buf0buf.h: Output to stream, not to memory buffer innobase/include/buf0buf.ic: Use %p for displaying pointers innobase/include/data0data.h: Remove dtuple_sprintf() innobase/include/dict0dict.h: Output to stream, not to memory buffer innobase/include/ha0ha.h: Output to stream, not to memory buffer innobase/include/ibuf0ibuf.h: Output to stream, not to memory buffer innobase/include/lock0lock.h: Output to stream, not to memory buffer innobase/include/log0log.h: Output to stream, not to memory buffer innobase/include/mtr0log.ic: Output to stderr Display pointers with %p innobase/include/os0file.h: Output to stream, not to memory buffer innobase/include/rem0rec.h: Remove rec_sprintf() innobase/include/rem0rec.ic: Output to stderr innobase/include/row0sel.ic: Output to stderr innobase/include/row0upd.ic: Quote table and index names innobase/include/srv0srv.h: Remove srv_sprintf_innodb_monitor() innobase/include/sync0arr.h: Output to stream, not to memory buffer innobase/include/sync0sync.h: Output to stream, not to memory buffer innobase/include/trx0sys.h: Output to stderr innobase/include/trx0trx.h: Output to stream, not to memory buffer innobase/include/ut0ut.h: Remove ut_sprintf_buf() Add ut_print_name(), ut_print_namel() and ut_copy_file() innobase/lock/lock0lock.c: Output to stream, not to memory buffer innobase/log/log0log.c: Output to stderr innobase/log/log0recv.c: Output to stderr innobase/mem/mem0dbg.c: Output to stderr innobase/mtr/mtr0log.c: Display pointers with %p innobase/mtr/mtr0mtr.c: Output to stderr innobase/os/os0file.c: Output to stream, not to memory buffer innobase/os/os0proc.c: Output to stderr innobase/os/os0thread.c: Output to stderr innobase/page/page0cur.c: Output to stderr innobase/page/page0page.c: Avoid sprintf() Output to stderr instead of stdout innobase/pars/pars0opt.c: Output to stderr instead of stdout innobase/rem/rem0rec.c: Remove rec_sprintf() Output to stderr instead of stdout innobase/row/row0ins.c: Output diagnostics to stream instead of memory buffer innobase/row/row0mysql.c: Output to stderr instead of stdout Quote table and index names innobase/row/row0purge.c: Output to stderr instead of stdout innobase/row/row0row.c: Quote table and index names innobase/row/row0sel.c: Output to stderr instead of stdout Quote table and index names innobase/row/row0umod.c: Avoid sprintf() Quote table and index names innobase/row/row0undo.c: Output to stderr instead of stdout innobase/row/row0upd.c: Avoid sprintf() innobase/srv/srv0srv.c: Output to stderr instead of stdout innobase/srv/srv0start.c: Handle srv_monitor_file Make some global variables static innobase/sync/sync0arr.c: Output to stderr instead of stdout Output to stream instead of memory buffer innobase/sync/sync0rw.c: Output to stderr instead of stdout innobase/sync/sync0sync.c: Output to stderr instead of stdout Output to stream instead of memory buffer innobase/trx/trx0purge.c: Output to stderr instead of stdout innobase/trx/trx0rec.c: Quote index and table names Avoid sprintf() innobase/trx/trx0roll.c: Quote identifier names Output to stderr instead of stdout innobase/trx/trx0sys.c: Output to stderr instead of stdout innobase/trx/trx0trx.c: Output to stream instead of memory buffer innobase/trx/trx0undo.c: Output to stderr instead of stdout innobase/ut/ut0ut.c: Declare mysql_get_identifier_quote_char() Remove ut_sprintf_buf() Add ut_print_name() and ut_print_namel() Add ut_copy_file() sql/ha_innodb.cc: innobase_mysql_print_thd(): output to stream, not to memory buffer Add mysql_get_identifier_quote_char() Remove unused function innobase_print_error() Display pointers with %p Buffer InnoDB output via files, not via statically allocated memory
This commit is contained in:
parent
d809c4413e
commit
80fe399fee
73 changed files with 2243 additions and 2578 deletions
|
|
@ -26,10 +26,10 @@ Created 3/26/1996 Heikki Tuuri
|
|||
#include "os0proc.h"
|
||||
|
||||
/* Copy of the prototype for innobase_mysql_print_thd: this
|
||||
copy MUST be equal to the one in mysql/sql/ha_innobase.cc ! */
|
||||
copy MUST be equal to the one in mysql/sql/ha_innodb.cc ! */
|
||||
|
||||
void innobase_mysql_print_thd(
|
||||
char* buf,
|
||||
FILE* f,
|
||||
void* thd);
|
||||
|
||||
/* Dummy session used currently in MySQL interface */
|
||||
|
|
@ -239,19 +239,17 @@ trx_free(
|
|||
/*=====*/
|
||||
trx_t* trx) /* in, own: trx object */
|
||||
{
|
||||
char err_buf[1000];
|
||||
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
ut_ad(mutex_own(&kernel_mutex));
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
||||
if (trx->declared_to_be_inside_innodb) {
|
||||
ut_print_timestamp(stderr);
|
||||
trx_print(err_buf, trx);
|
||||
|
||||
fprintf(stderr,
|
||||
fputs(
|
||||
" InnoDB: Error: Freeing a trx which is declared to be processing\n"
|
||||
"InnoDB: inside InnoDB.\n%s\n", err_buf);
|
||||
"InnoDB: inside InnoDB.\n", stderr);
|
||||
trx_print(stderr, trx);
|
||||
putc('\n', stderr);
|
||||
}
|
||||
|
||||
ut_a(trx->magic_n == TRX_MAGIC_N);
|
||||
|
|
@ -756,7 +754,8 @@ trx_commit_off_kernel(
|
|||
trx->read_view = NULL;
|
||||
}
|
||||
|
||||
/* printf("Trx %lu commit finished\n", ut_dulint_get_low(trx->id)); */
|
||||
/* fprintf(stderr, "Trx %lu commit finished\n",
|
||||
ut_dulint_get_low(trx->id)); */
|
||||
|
||||
if (must_flush_log) {
|
||||
|
||||
|
|
@ -1566,93 +1565,99 @@ own the kernel mutex. */
|
|||
void
|
||||
trx_print(
|
||||
/*======*/
|
||||
char* buf, /* in/out: buffer where to print, must be at least
|
||||
800 bytes */
|
||||
FILE* f, /* in: output stream */
|
||||
trx_t* trx) /* in: transaction */
|
||||
{
|
||||
char* start_of_line;
|
||||
ibool newline;
|
||||
|
||||
buf += sprintf(buf, "TRANSACTION %lu %lu",
|
||||
fprintf(f, "TRANSACTION %lu %lu",
|
||||
ut_dulint_get_high(trx->id),
|
||||
ut_dulint_get_low(trx->id));
|
||||
|
||||
switch (trx->conc_state) {
|
||||
case TRX_NOT_STARTED: buf += sprintf(buf,
|
||||
", not started"); break;
|
||||
case TRX_ACTIVE: buf += sprintf(buf,
|
||||
", ACTIVE %lu sec",
|
||||
(ulint)difftime(time(NULL), trx->start_time)); break;
|
||||
case TRX_COMMITTED_IN_MEMORY: buf += sprintf(buf,
|
||||
", COMMITTED IN MEMORY");
|
||||
case TRX_NOT_STARTED:
|
||||
fputs(", not started", f);
|
||||
break;
|
||||
case TRX_ACTIVE:
|
||||
fprintf(f, ", ACTIVE %lu sec",
|
||||
(ulint)difftime(time(NULL), trx->start_time));
|
||||
break;
|
||||
default: buf += sprintf(buf, " state %lu", trx->conc_state);
|
||||
case TRX_COMMITTED_IN_MEMORY:
|
||||
fputs(", COMMITTED IN MEMORY", f);
|
||||
break;
|
||||
default:
|
||||
fprintf(f, " state %lu", trx->conc_state);
|
||||
}
|
||||
|
||||
#ifdef UNIV_LINUX
|
||||
buf += sprintf(buf, ", process no %lu", trx->mysql_process_no);
|
||||
fprintf(f, ", process no %lu", trx->mysql_process_no);
|
||||
#endif
|
||||
buf += sprintf(buf, ", OS thread id %lu",
|
||||
fprintf(f, ", OS thread id %lu",
|
||||
os_thread_pf(trx->mysql_thread_id));
|
||||
|
||||
if (ut_strlen(trx->op_info) > 0) {
|
||||
buf += sprintf(buf, " %s", trx->op_info);
|
||||
if (*trx->op_info) {
|
||||
putc(' ', f);
|
||||
fputs(trx->op_info, f);
|
||||
}
|
||||
|
||||
if (trx->type != TRX_USER) {
|
||||
buf += sprintf(buf, " purge trx");
|
||||
fputs(" purge trx", f);
|
||||
}
|
||||
|
||||
if (trx->declared_to_be_inside_innodb) {
|
||||
buf += sprintf(buf, ", thread declared inside InnoDB %lu",
|
||||
fprintf(f, ", thread declared inside InnoDB %lu",
|
||||
trx->n_tickets_to_enter_innodb);
|
||||
}
|
||||
|
||||
buf += sprintf(buf, "\n");
|
||||
putc('\n', f);
|
||||
|
||||
if (trx->n_mysql_tables_in_use > 0 || trx->mysql_n_tables_locked > 0) {
|
||||
|
||||
buf += sprintf(buf, "mysql tables in use %lu, locked %lu\n",
|
||||
fprintf(f, "mysql tables in use %lu, locked %lu\n",
|
||||
trx->n_mysql_tables_in_use,
|
||||
trx->mysql_n_tables_locked);
|
||||
}
|
||||
|
||||
start_of_line = buf;
|
||||
newline = TRUE;
|
||||
|
||||
switch (trx->que_state) {
|
||||
case TRX_QUE_RUNNING: break;
|
||||
case TRX_QUE_LOCK_WAIT: buf += sprintf(buf,
|
||||
"LOCK WAIT "); break;
|
||||
case TRX_QUE_ROLLING_BACK: buf += sprintf(buf,
|
||||
"ROLLING BACK "); break;
|
||||
case TRX_QUE_COMMITTING: buf += sprintf(buf,
|
||||
"COMMITTING "); break;
|
||||
default: buf += sprintf(buf, "que state %lu", trx->que_state);
|
||||
case TRX_QUE_RUNNING:
|
||||
newline = FALSE; break;
|
||||
case TRX_QUE_LOCK_WAIT:
|
||||
fputs("LOCK WAIT ", f); break;
|
||||
case TRX_QUE_ROLLING_BACK:
|
||||
fputs("ROLLING BACK ", f); break;
|
||||
case TRX_QUE_COMMITTING:
|
||||
fputs("COMMITTING ", f); break;
|
||||
default:
|
||||
fprintf(f, "que state %lu ", trx->que_state);
|
||||
}
|
||||
|
||||
if (0 < UT_LIST_GET_LEN(trx->trx_locks) ||
|
||||
mem_heap_get_size(trx->lock_heap) > 400) {
|
||||
newline = TRUE;
|
||||
|
||||
buf += sprintf(buf,
|
||||
"%lu lock struct(s), heap size %lu",
|
||||
fprintf(f, "%lu lock struct(s), heap size %lu",
|
||||
UT_LIST_GET_LEN(trx->trx_locks),
|
||||
mem_heap_get_size(trx->lock_heap));
|
||||
}
|
||||
|
||||
if (trx->has_search_latch) {
|
||||
buf += sprintf(buf, ", holds adaptive hash latch");
|
||||
newline = TRUE;
|
||||
fputs(", holds adaptive hash latch", f);
|
||||
}
|
||||
|
||||
if (ut_dulint_cmp(trx->undo_no, ut_dulint_zero) != 0) {
|
||||
buf += sprintf(buf, ", undo log entries %lu",
|
||||
newline = TRUE;
|
||||
fprintf(f, ", undo log entries %lu",
|
||||
ut_dulint_get_low(trx->undo_no));
|
||||
}
|
||||
|
||||
if (buf != start_of_line) {
|
||||
|
||||
buf += sprintf(buf, "\n");
|
||||
if (newline) {
|
||||
putc('\n', f);
|
||||
}
|
||||
|
||||
if (trx->mysql_thd != NULL) {
|
||||
innobase_mysql_print_thd(buf, trx->mysql_thd);
|
||||
innobase_mysql_print_thd(f, trx->mysql_thd);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue