2001-02-17 13:19:19 +01:00
|
|
|
/*********************************************************************
|
|
|
|
Debug utilities for Innobase.
|
|
|
|
|
|
|
|
(c) 1994, 1995 Innobase Oy
|
|
|
|
|
|
|
|
Created 1/30/1994 Heikki Tuuri
|
|
|
|
**********************************************************************/
|
|
|
|
|
|
|
|
#include "univ.i"
|
|
|
|
|
2005-06-10 11:22:23 +02:00
|
|
|
#if defined(__GNUC__) && (__GNUC__ > 2)
|
|
|
|
#else
|
|
|
|
/* This is used to eliminate compiler warnings */
|
|
|
|
ulint ut_dbg_zero = 0;
|
|
|
|
#endif
|
|
|
|
|
2001-02-17 13:19:19 +01:00
|
|
|
/* If this is set to TRUE all threads will stop into the next assertion
|
|
|
|
and assert */
|
|
|
|
ibool ut_dbg_stop_threads = FALSE;
|
srv0start.c, ut0mem.c, ut0dbg.c, ut0dbg.h, srv0start.h:
Changes for NetWare to exit the InnoDB gracefully instead of crashing the server (patch by PRam@novell.com, polished a little by Heikki Tuuri)
mysqld.cc, ha_innodb.cc:
Changes for NetWare to exit the InnoDB gracefully instead of crashing the server (patch by PRam@novell.com, polished a little by Heikki Tuuri)
sql/ha_innodb.cc:
Changes for NetWare to exit the InnoDB gracefully instead of crashing the server (patch by PRam@novell.com, polished a little by Heikki Tuuri)
sql/mysqld.cc:
Changes for NetWare to exit the InnoDB gracefully instead of crashing the server (patch by PRam@novell.com, polished a little by Heikki Tuuri)
innobase/include/srv0start.h:
Changes for NetWare to exit the InnoDB gracefully instead of crashing the server (patch by PRam@novell.com, polished a little by Heikki Tuuri)
innobase/include/ut0dbg.h:
Changes for NetWare to exit the InnoDB gracefully instead of crashing the server (patch by PRam@novell.com, polished a little by Heikki Tuuri)
innobase/ut/ut0dbg.c:
Changes for NetWare to exit the InnoDB gracefully instead of crashing the server (patch by PRam@novell.com, polished a little by Heikki Tuuri)
innobase/ut/ut0mem.c:
Changes for NetWare to exit the InnoDB gracefully instead of crashing the server (patch by PRam@novell.com, polished a little by Heikki Tuuri)
innobase/srv/srv0start.c:
Changes for NetWare to exit the InnoDB gracefully instead of crashing the server (patch by PRam@novell.com, polished a little by Heikki Tuuri)
2004-08-18 00:48:01 +02:00
|
|
|
#ifdef __NETWARE__
|
|
|
|
ibool panic_shutdown = FALSE; /* This is set to TRUE when on NetWare there
|
|
|
|
happens an InnoDB assertion failure or other
|
|
|
|
fatal error condition that requires an
|
|
|
|
immediate shutdown. */
|
2005-06-10 11:22:23 +02:00
|
|
|
#else /* __NETWARE__ */
|
2001-02-17 13:19:19 +01:00
|
|
|
/* Null pointer used to generate memory trap */
|
|
|
|
|
|
|
|
ulint* ut_dbg_null_ptr = NULL;
|
2005-06-10 11:22:23 +02:00
|
|
|
#endif /* __NETWARE__ */
|
2004-03-12 12:46:26 +01:00
|
|
|
|
2005-06-10 11:22:23 +02:00
|
|
|
/*****************************************************************
|
|
|
|
Report a failed assertion. */
|
|
|
|
|
|
|
|
void
|
|
|
|
ut_dbg_assertion_failed(
|
|
|
|
/*====================*/
|
|
|
|
const char* expr, /* in: the failed assertion (optional) */
|
|
|
|
const char* file, /* in: source file containing the assertion */
|
|
|
|
ulint line) /* in: line number of the assertion */
|
|
|
|
{
|
|
|
|
ut_print_timestamp(stderr);
|
|
|
|
fprintf(stderr,
|
|
|
|
"InnoDB: Assertion failure in thread %lu"
|
|
|
|
" in file %s line %lu\n",
|
|
|
|
os_thread_pf(os_thread_get_curr_id()), file, line);
|
|
|
|
if (expr) {
|
|
|
|
fprintf(stderr,
|
|
|
|
"InnoDB: Failing assertion: %s\n", expr);
|
|
|
|
}
|
|
|
|
|
|
|
|
fputs(
|
2004-03-12 12:46:26 +01:00
|
|
|
"InnoDB: We intentionally generate a memory trap.\n"
|
2004-05-11 10:05:02 +02:00
|
|
|
"InnoDB: Submit a detailed bug report to http://bugs.mysql.com.\n"
|
2004-03-12 12:46:26 +01:00
|
|
|
"InnoDB: If you get repeated assertion failures or crashes, even\n"
|
|
|
|
"InnoDB: immediately after the mysqld startup, there may be\n"
|
2004-09-08 13:24:13 +02:00
|
|
|
"InnoDB: corruption in the InnoDB tablespace. Please refer to\n"
|
2006-08-18 14:16:11 +02:00
|
|
|
"InnoDB: http://dev.mysql.com/doc/refman/5.0/en/forcing-recovery.html\n"
|
2005-06-10 11:22:23 +02:00
|
|
|
"InnoDB: about forcing recovery.\n", stderr);
|
|
|
|
ut_dbg_stop_threads = TRUE;
|
|
|
|
}
|
|
|
|
|
2005-06-16 14:00:25 +02:00
|
|
|
#ifdef __NETWARE__
|
|
|
|
/*****************************************************************
|
|
|
|
Shut down MySQL/InnoDB after assertion failure. */
|
|
|
|
|
|
|
|
void
|
|
|
|
ut_dbg_panic(void)
|
|
|
|
/*==============*/
|
|
|
|
{
|
|
|
|
if (!panic_shutdown) {
|
|
|
|
panic_shutdown = TRUE;
|
|
|
|
innobase_shutdown_for_mysql();
|
|
|
|
}
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
#else /* __NETWARE__ */
|
2005-06-10 11:22:23 +02:00
|
|
|
/*****************************************************************
|
|
|
|
Stop a thread after assertion failure. */
|
2004-03-12 12:46:26 +01:00
|
|
|
|
2005-06-10 11:22:23 +02:00
|
|
|
void
|
|
|
|
ut_dbg_stop_thread(
|
|
|
|
/*===============*/
|
|
|
|
const char* file,
|
|
|
|
ulint line)
|
|
|
|
{
|
|
|
|
fprintf(stderr, "InnoDB: Thread %lu stopped in file %s line %lu\n",
|
|
|
|
os_thread_pf(os_thread_get_curr_id()), file, line);
|
|
|
|
os_thread_sleep(1000000000);
|
|
|
|
}
|
|
|
|
#endif /* __NETWARE__ */
|