summaryrefslogtreecommitdiff
path: root/innobase/os
diff options
context:
space:
mode:
authorunknown <marko@hundin.mysql.fi>2004-04-06 16:14:43 +0300
committerunknown <marko@hundin.mysql.fi>2004-04-06 16:14:43 +0300
commit80fe399fee3a7752aecdfc888edfcf56a2be7b0a (patch)
treef7bc427aa7ce4a54802d6e8931ca1dfe64c7bfa8 /innobase/os
parentd809c4413e9f991bde407690aafdaaa3eaae9232 (diff)
downloadmariadb-git-80fe399fee3a7752aecdfc888edfcf56a2be7b0a.tar.gz
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
Diffstat (limited to 'innobase/os')
-rw-r--r--innobase/os/os0file.c84
-rw-r--r--innobase/os/os0proc.c5
-rw-r--r--innobase/os/os0thread.c2
3 files changed, 41 insertions, 50 deletions
diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c
index acc6492fefc..50c15bcbd41 100644
--- a/innobase/os/os0file.c
+++ b/innobase/os/os0file.c
@@ -212,7 +212,7 @@ os_file_get_last_error(void)
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Operating system error number %lu in a file operation.\n"
- "InnoDB: See http://www.innodb.com/ibman.html for installation help.\n",
+ "InnoDB: See http://www.innodb.com/ibman.php for installation help.\n",
err);
if (err == ERROR_PATH_NOT_FOUND) {
@@ -227,7 +227,7 @@ os_file_get_last_error(void)
"InnoDB: of the same name as a data file.\n");
} else {
fprintf(stderr,
- "InnoDB: See section 13.2 at http://www.innodb.com/ibman.html\n"
+ "InnoDB: See section 13.2 at http://www.innodb.com/ibman.php\n"
"InnoDB: about operating system error numbers.\n");
}
}
@@ -251,7 +251,7 @@ os_file_get_last_error(void)
fprintf(stderr,
" InnoDB: Operating system error number %lu in a file operation.\n"
- "InnoDB: See http://www.innodb.com/ibman.html for installation help.\n",
+ "InnoDB: See http://www.innodb.com/ibman.php for installation help.\n",
err);
if (err == ENOENT) {
@@ -270,7 +270,7 @@ os_file_get_last_error(void)
}
fprintf(stderr,
- "InnoDB: See also section 13.2 at http://www.innodb.com/ibman.html\n"
+ "InnoDB: See also section 13.2 at http://www.innodb.com/ibman.php\n"
"InnoDB: about operating system error numbers.\n");
}
}
@@ -733,7 +733,7 @@ try_again:
ut_error;
}
-/* printf("Opening file %s, mode %s, type %s, purpose %s\n",
+/* fprintf(stderr, "Opening file %s, mode %s, type %s, purpose %s\n",
name, mode_str, type_str, purpose_str); */
#ifdef O_SYNC
/* We let O_SYNC only affect log files; note that we map O_DSYNC to
@@ -742,7 +742,7 @@ try_again:
if (type == OS_LOG_FILE
&& srv_unix_file_flush_method == SRV_UNIX_O_DSYNC) {
-/* printf("Using O_SYNC for file %s\n", name); */
+/* fprintf(stderr, "Using O_SYNC for file %s\n", name); */
create_flag = create_flag | O_SYNC;
}
@@ -752,7 +752,7 @@ try_again:
if (type != OS_LOG_FILE
&& srv_unix_file_flush_method == SRV_UNIX_O_DIRECT) {
-/* printf("Using O_DIRECT for file %s\n", name); */
+/* fprintf(stderr, "Using O_DIRECT for file %s\n", name); */
create_flag = create_flag | O_DIRECT;
}
@@ -1025,7 +1025,7 @@ os_file_flush(
#ifdef HAVE_FDATASYNC
ret = fdatasync(file);
#else
-/* printf("Flushing to file %lu\n", (ulint)file); */
+/* fprintf(stderr, "Flushing to file %p\n", file); */
ret = fsync(file);
#endif
os_n_fsyncs++;
@@ -1382,7 +1382,7 @@ retry:
fprintf(stderr,
" InnoDB: Error: File pointer positioning to file %s failed at\n"
"InnoDB: offset %lu %lu. Operating system error number %lu.\n"
-"InnoDB: Look from section 13.2 at http://www.innodb.com/ibman.html\n"
+"InnoDB: Look from section 13.2 at http://www.innodb.com/ibman.php\n"
"InnoDB: what the error number means.\n",
name, offset_high, offset,
(ulint)GetLastError());
@@ -1440,7 +1440,7 @@ retry:
}
fprintf(stderr,
-"InnoDB: See also section 13.2 at http://www.innodb.com/ibman.html\n"
+"InnoDB: See also section 13.2 at http://www.innodb.com/ibman.php\n"
"InnoDB: about operating system error numbers.\n");
os_has_said_disk_full = TRUE;
@@ -1475,7 +1475,7 @@ retry:
}
fprintf(stderr,
-"InnoDB: See also section 13.2 at http://www.innodb.com/ibman.html\n"
+"InnoDB: See also section 13.2 at http://www.innodb.com/ibman.php\n"
"InnoDB: about operating system error numbers.\n");
os_has_said_disk_full = TRUE;
@@ -1593,7 +1593,7 @@ os_aio_init(
n_write_segs = (n_segments - 2) / 2;
n_read_segs = n_segments - 2 - n_write_segs;
- /* printf("Array n per seg %lu\n", n_per_seg); */
+ /* fprintf(stderr, "Array n per seg %lu\n", n_per_seg); */
os_aio_ibuf_array = os_aio_array_create(n_per_seg, 1);
@@ -1944,7 +1944,8 @@ loop:
SIGRTMIN + 1 + os_aio_get_array_no(array);
/* TODO: How to choose the signal numbers? */
/*
- printf("AIO signal number %lu\n", (ulint) control->aio_sigevent.sigev_signo);
+ fprintf(stderr, "AIO signal number %lu\n",
+ (ulint) control->aio_sigevent.sigev_signo);
*/
control->aio_sigevent.sigev_value.sival_ptr = slot;
#endif
@@ -2198,7 +2199,7 @@ try_again:
#elif defined(POSIX_ASYNC_IO)
slot->control.aio_lio_opcode = LIO_READ;
err = (ulint) aio_read(&(slot->control));
- printf("Starting Posix aio read %lu\n", err);
+ fprintf(stderr, "Starting POSIX aio read %lu\n", err);
#endif
} else {
if (!wake_later) {
@@ -2215,7 +2216,7 @@ try_again:
#elif defined(POSIX_ASYNC_IO)
slot->control.aio_lio_opcode = LIO_WRITE;
err = (ulint) aio_write(&(slot->control));
- printf("Starting Posix aio write %lu\n", err);
+ fprintf(stderr, "Starting POSIX aio write %lu\n", err);
#endif
} else {
if (!wake_later) {
@@ -2411,7 +2412,7 @@ os_aio_posix_handle(
pthread_sigmask(0, NULL, &thr_sigset);
for (i = 32 ; i < 40; i++) {
- printf("%lu : %lu %lu\n", (ulint)i,
+ fprintf(stderr, "%lu : %lu %lu\n", (ulint)i,
(ulint)sigismember(&proc_sigset, i),
(ulint)sigismember(&thr_sigset, i));
}
@@ -2426,7 +2427,7 @@ os_aio_posix_handle(
return(FALSE);
}
- printf("Handling Posix aio\n");
+ fputs("Handling POSIX aio\n", stderr);
array = os_aio_get_array_from_no(array_no);
@@ -2719,9 +2720,9 @@ consecutive_loop:
ut_a(ret);
srv_set_io_thread_op_info(global_segment, "file i/o done");
-/* printf("aio: %lu consecutive %lu:th segment, first offs %lu blocks\n",
- n_consecutive, global_segment, slot->offset
- / UNIV_PAGE_SIZE); */
+/* fprintf(stderr,
+ "aio: %lu consecutive %lu:th segment, first offs %lu blocks\n",
+ n_consecutive, global_segment, slot->offset / UNIV_PAGE_SIZE); */
if (slot->type == OS_FILE_READ && n_consecutive > 1) {
/* Copy the combined buffer to individual buffers */
@@ -2847,8 +2848,7 @@ Prints info of the aio arrays. */
void
os_aio_print(
/*=========*/
- char* buf, /* in/out: buffer where to print */
- char* buf_end)/* in: buffer end */
+ FILE* file) /* in: file where to print */
{
os_aio_array_t* array;
os_aio_slot_t* slot;
@@ -2858,18 +2858,13 @@ os_aio_print(
double avg_bytes_read;
ulint i;
- if (buf_end - buf < 1200) {
-
- return;
- }
-
for (i = 0; i < srv_n_file_io_threads; i++) {
- buf += sprintf(buf, "I/O thread %lu state: %s (%s)\n", i,
+ fprintf(file, "I/O thread %lu state: %s (%s)\n", i,
srv_io_thread_op_info[i],
srv_io_thread_function[i]);
}
- buf += sprintf(buf, "Pending normal aio reads:");
+ fputs("Pending normal aio reads:", file);
array = os_aio_read_array;
loop:
@@ -2887,21 +2882,20 @@ loop:
if (slot->reserved) {
n_reserved++;
- /* printf("Reserved slot, messages %lx %lx\n",
- (ulint)slot->message1,
- (ulint)slot->message2);
- */ ut_a(slot->len > 0);
+ /* fprintf(stderr, "Reserved slot, messages %p %p\n",
+ slot->message1, slot->message2); */
+ ut_a(slot->len > 0);
}
}
ut_a(array->n_reserved == n_reserved);
- buf += sprintf(buf, " %lu", n_reserved);
+ fprintf(file, " %lu", n_reserved);
os_mutex_exit(array->mutex);
if (array == os_aio_read_array) {
- buf += sprintf(buf, ", aio writes:");
+ fputs(", aio writes:", file);
array = os_aio_write_array;
@@ -2909,40 +2903,38 @@ loop:
}
if (array == os_aio_write_array) {
- buf += sprintf(buf, ",\n ibuf aio reads:");
+ fputs(",\n ibuf aio reads:", file);
array = os_aio_ibuf_array;
goto loop;
}
if (array == os_aio_ibuf_array) {
- buf += sprintf(buf, ", log i/o's:");
+ fputs(", log i/o's:", file);
array = os_aio_log_array;
goto loop;
}
if (array == os_aio_log_array) {
- buf += sprintf(buf, ", sync i/o's:");
+ fputs(", sync i/o's:", file);
array = os_aio_sync_array;
goto loop;
}
- buf += sprintf(buf, "\n");
-
+ putc('\n', file);
current_time = time(NULL);
time_elapsed = 0.001 + difftime(current_time, os_last_printout);
- buf += sprintf(buf,
- "Pending flushes (fsync) log: %lu; buffer pool: %lu\n",
- fil_n_pending_log_flushes, fil_n_pending_tablespace_flushes);
- buf += sprintf(buf,
+ fprintf(file,
+ "Pending flushes (fsync) log: %lu; buffer pool: %lu\n"
"%lu OS file reads, %lu OS file writes, %lu OS fsyncs\n",
+ fil_n_pending_log_flushes, fil_n_pending_tablespace_flushes,
os_n_file_reads, os_n_file_writes, os_n_fsyncs);
if (os_file_n_pending_preads != 0 || os_file_n_pending_pwrites != 0) {
- buf += sprintf(buf,
+ fprintf(file,
"%lu pending preads, %lu pending pwrites\n",
os_file_n_pending_preads, os_file_n_pending_pwrites);
}
@@ -2954,7 +2946,7 @@ loop:
(os_n_file_reads - os_n_file_reads_old);
}
- buf += sprintf(buf,
+ fprintf(file,
"%.2f reads/s, %lu avg bytes/read, %.2f writes/s, %.2f fsyncs/s\n",
(os_n_file_reads - os_n_file_reads_old)
/ time_elapsed,
diff --git a/innobase/os/os0proc.c b/innobase/os/os0proc.c
index 2099d62e7fd..87a0bfb9e92 100644
--- a/innobase/os/os0proc.c
+++ b/innobase/os/os0proc.c
@@ -81,9 +81,8 @@ os_process_set_priority_boost(
/* Does not do anything currently!
SetProcessPriorityBoost(GetCurrentProcess(), no_boost);
*/
- printf(
- "Warning: process priority boost setting currently not functional!\n"
- );
+ fputs("Warning: process priority boost setting currently not functional!\n",
+ stderr);
#else
UT_NOT_USED(do_boost);
#endif
diff --git a/innobase/os/os0thread.c b/innobase/os/os0thread.c
index 1252cc5e4b7..59d0fdbd8c9 100644
--- a/innobase/os/os0thread.c
+++ b/innobase/os/os0thread.c
@@ -187,7 +187,7 @@ os_thread_exit(
is cast as a DWORD */
{
#ifdef UNIV_DEBUG_THREAD_CREATION
- printf("Thread exits, id %lu\n",
+ fprintf(stderr, "Thread exits, id %lu\n",
os_thread_pf(os_thread_get_curr_id()));
#endif
os_mutex_enter(os_sync_mutex);