1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

log0log.c InnoDB now prints timestamp at startup and shutdown

srv0start.c	InnoDB now prints timestamp at startup and shutdown
ut0ut.h 	InnoDB now prints timestamp at startup and shutdown
ut0ut.c 	InnoDB now prints timestamp at startup and shutdown


innobase/ut/ut0ut.c:
  InnoDB now prints timestamp at startup and shutdown
innobase/include/ut0ut.h:
  InnoDB now prints timestamp at startup and shutdown
innobase/srv/srv0start.c:
  InnoDB now prints timestamp at startup and shutdown
innobase/log/log0log.c:
  InnoDB now prints timestamp at startup and shutdown
This commit is contained in:
unknown
2001-05-24 22:35:14 +03:00
parent 32d369378e
commit b609818666
4 changed files with 53 additions and 5 deletions

View File

@ -136,6 +136,13 @@ ut_difftime(
/* out: time2 - time1 expressed in seconds */
ib_time_t time2, /* in: time */
ib_time_t time1); /* in: time */
/**************************************************************
Prints a timestamp to a file. */
void
ut_print_timestamp(
/*===============*/
FILE* file); /* in: file where to print */
/*****************************************************************
Runs an idle loop on CPU. The argument gives the desired delay
in microseconds on 100 MHz Pentium + Visual C++. */

View File

@ -2634,8 +2634,9 @@ logs_empty_and_mark_files_at_shutdown(void)
{
dulint lsn;
ulint arch_log_no;
fprintf(stderr, "InnoDB: Starting shutdown...\n");
ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB: Starting shutdown...\n");
/* Wait until the master thread and all other operations are idle: our
algorithm only works if the server is idle at shutdown */
@ -2725,7 +2726,8 @@ loop:
fil_flush_file_spaces(FIL_TABLESPACE);
fprintf(stderr, "InnoDB: Shutdown completed\n");
ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB: Shutdown completed\n");
}
/**********************************************************

View File

@ -813,7 +813,8 @@ innobase_start_or_create_for_mysql(void)
/* Create the thread which watches the timeouts for lock waits */
os_thread_create(&srv_lock_timeout_monitor_thread, NULL,
thread_ids + 2 + SRV_MAX_N_IO_THREADS);
fprintf(stderr, "InnoDB: Started\n");
ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB: Started\n");
srv_was_started = TRUE;
srv_is_being_started = FALSE;
@ -835,8 +836,9 @@ innobase_shutdown_for_mysql(void)
{
if (!srv_was_started) {
if (srv_is_being_started) {
ut_print_timestamp(stderr);
fprintf(stderr,
"InnoDB: Warning: shutting down not properly started database\n");
" InnoDB: Warning: shutting down a not properly started database\n");
}
return(DB_SUCCESS);
}

View File

@ -49,6 +49,43 @@ ut_difftime(
return(difftime(time2, time1));
}
/**************************************************************
Prints a timestamp to a file. */
void
ut_print_timestamp(
/*===============*/
FILE* file) /* in: file where to print */
{
struct tm* cal_tm_ptr;
struct tm cal_tm;
time_t tm;
try_again:
time(&tm);
cal_tm_ptr = localtime(&tm);
memcpy(&cal_tm, cal_tm_ptr, sizeof(struct tm));
/* In theory localtime may return a wrong result because its return
struct is not protected with a mutex */
if (difftime(tm, mktime(&cal_tm)) > 0.5
|| difftime(tm, mktime(&cal_tm)) < -0.5) {
goto try_again;
}
fprintf(file,"%02d%02d%02d %2d:%02d:%02d",
cal_tm.tm_year % 100,
cal_tm.tm_mon+1,
cal_tm.tm_mday,
cal_tm.tm_hour,
cal_tm.tm_min,
cal_tm.tm_sec);
}
/*****************************************************************
Runs an idle loop on CPU. The argument gives the desired delay
in microseconds on 100 MHz Pentium + Visual C++. */