Commit 06f7b09f authored by marko's avatar marko

Implement InnoDB assertions (ut_a and ut_error) with abort() when

the code is compiled with GCC 3 or later on other platforms than
Windows or Netware.  Also disable the variable ut_dbg_stop_threads
and the function ut_dbg_stop_thread() in this case, unless
UNIV_SYNC_DEBUG is defined.  This should allow the compiler to
generate more compact code for assertions.
parent d575c513
......@@ -41,12 +41,21 @@ void ut_dbg_panic(void);
/* Stop threads in ut_a(). */
# define UT_DBG_STOP while (0) /* We do not do this on NetWare */
#else /* __NETWARE__ */
/* Flag for indicating that all threads should stop. This will be set
by ut_dbg_assertion_failed(). */
extern ibool ut_dbg_stop_threads;
# if defined(__WIN__) || defined(__INTEL_COMPILER)
# undef UT_DBG_USE_ABORT
# elif defined(__GNUC__) && (__GNUC__ > 2)
# define UT_DBG_USE_ABORT
# endif
# ifndef UT_DBG_USE_ABORT
/* A null pointer that will be dereferenced to trigger a memory trap */
extern ulint* ut_dbg_null_ptr;
# endif
# if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
/* Flag for indicating that all threads should stop. This will be set
by ut_dbg_assertion_failed(). */
extern ibool ut_dbg_stop_threads;
/*****************************************************************
Stop a thread after assertion failure. */
......@@ -56,15 +65,23 @@ ut_dbg_stop_thread(
/*===============*/
const char* file,
ulint line);
# endif
# ifdef UT_DBG_USE_ABORT
/* Abort the execution. */
# define UT_DBG_PANIC abort()
/* Stop threads (null operation) */
# define UT_DBG_STOP while (0)
# else /* UT_DBG_USE_ABORT */
/* Abort the execution. */
# define UT_DBG_PANIC \
# define UT_DBG_PANIC \
if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = NULL
/* Stop threads in ut_a(). */
# define UT_DBG_STOP do \
# define UT_DBG_STOP do \
if (UNIV_UNLIKELY(ut_dbg_stop_threads)) { \
ut_dbg_stop_thread(__FILE__, (ulint) __LINE__); \
} while (0)
# endif /* UT_DBG_USE_ABORT */
#endif /* __NETWARE__ */
/* Abort execution if EXPR does not evaluate to nonzero. */
......
......@@ -14,19 +14,21 @@ Created 1/30/1994 Heikki Tuuri
ulint ut_dbg_zero = 0;
#endif
#if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
/* If this is set to TRUE all threads will stop into the next assertion
and assert */
ibool ut_dbg_stop_threads = FALSE;
#endif
#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. */
#else /* __NETWARE__ */
#elif !defined(UT_DBG_USE_ABORT)
/* Null pointer used to generate memory trap */
ulint* ut_dbg_null_ptr = NULL;
#endif /* __NETWARE__ */
#endif
/*****************************************************************
Report a failed assertion. */
......@@ -56,7 +58,9 @@ ut_dbg_assertion_failed(
"InnoDB: corruption in the InnoDB tablespace. Please refer to\n"
"InnoDB: http://dev.mysql.com/doc/mysql/en/Forcing_recovery.html\n"
"InnoDB: about forcing recovery.\n", stderr);
#if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
ut_dbg_stop_threads = TRUE;
#endif
}
#ifdef __NETWARE__
......@@ -74,6 +78,7 @@ ut_dbg_panic(void)
exit(1);
}
#else /* __NETWARE__ */
# if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
/*****************************************************************
Stop a thread after assertion failure. */
......@@ -87,4 +92,5 @@ ut_dbg_stop_thread(
os_thread_pf(os_thread_get_curr_id()), file, line);
os_thread_sleep(1000000000);
}
# endif
#endif /* __NETWARE__ */
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