~vlad-lesin/percona-server/mysql-5.0.33-original

« back to all changes in this revision

Viewing changes to innobase/ut/ut0dbg.c

  • Committer: Vlad Lesin
  • Date: 2012-07-31 09:21:34 UTC
  • Revision ID: vladislav.lesin@percona.com-20120731092134-zfodx022b7992wsi
VirginĀ 5.0.33

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*********************************************************************
 
2
Debug utilities for Innobase.
 
3
 
 
4
(c) 1994, 1995 Innobase Oy
 
5
 
 
6
Created 1/30/1994 Heikki Tuuri
 
7
**********************************************************************/
 
8
 
 
9
#include "univ.i"
 
10
 
 
11
#if defined(__GNUC__) && (__GNUC__ > 2)
 
12
#else
 
13
/* This is used to eliminate compiler warnings */
 
14
ulint   ut_dbg_zero     = 0;
 
15
#endif
 
16
 
 
17
/* If this is set to TRUE all threads will stop into the next assertion
 
18
and assert */
 
19
ibool   ut_dbg_stop_threads     = FALSE;
 
20
#ifdef __NETWARE__ 
 
21
ibool panic_shutdown = FALSE;   /* This is set to TRUE when on NetWare there
 
22
                                happens an InnoDB assertion failure or other
 
23
                                fatal error condition that requires an
 
24
                                immediate shutdown. */
 
25
#else /* __NETWARE__ */
 
26
/* Null pointer used to generate memory trap */
 
27
 
 
28
ulint*  ut_dbg_null_ptr         = NULL;
 
29
#endif /* __NETWARE__ */
 
30
 
 
31
/*****************************************************************
 
32
Report a failed assertion. */
 
33
 
 
34
void
 
35
ut_dbg_assertion_failed(
 
36
/*====================*/
 
37
        const char* expr,       /* in: the failed assertion (optional) */
 
38
        const char* file,       /* in: source file containing the assertion */
 
39
        ulint line)             /* in: line number of the assertion */
 
40
{
 
41
        ut_print_timestamp(stderr);
 
42
        fprintf(stderr,
 
43
                "InnoDB: Assertion failure in thread %lu"
 
44
                " in file %s line %lu\n",
 
45
                os_thread_pf(os_thread_get_curr_id()), file, line);
 
46
        if (expr) {
 
47
                fprintf(stderr,
 
48
                        "InnoDB: Failing assertion: %s\n", expr);
 
49
        }
 
50
 
 
51
        fputs(
 
52
"InnoDB: We intentionally generate a memory trap.\n"
 
53
"InnoDB: Submit a detailed bug report to http://bugs.mysql.com.\n"
 
54
"InnoDB: If you get repeated assertion failures or crashes, even\n"
 
55
"InnoDB: immediately after the mysqld startup, there may be\n"
 
56
"InnoDB: corruption in the InnoDB tablespace. Please refer to\n"
 
57
"InnoDB: http://dev.mysql.com/doc/refman/5.0/en/forcing-recovery.html\n"
 
58
"InnoDB: about forcing recovery.\n", stderr);
 
59
        ut_dbg_stop_threads = TRUE;
 
60
}
 
61
 
 
62
#ifdef __NETWARE__
 
63
/*****************************************************************
 
64
Shut down MySQL/InnoDB after assertion failure. */
 
65
 
 
66
void
 
67
ut_dbg_panic(void)
 
68
/*==============*/
 
69
{
 
70
        if (!panic_shutdown) {
 
71
                panic_shutdown = TRUE;
 
72
                innobase_shutdown_for_mysql();
 
73
        }
 
74
        exit(1);
 
75
}
 
76
#else /* __NETWARE__ */
 
77
/*****************************************************************
 
78
Stop a thread after assertion failure. */
 
79
 
 
80
void
 
81
ut_dbg_stop_thread(
 
82
/*===============*/
 
83
        const char*     file,
 
84
        ulint           line)
 
85
{
 
86
        fprintf(stderr, "InnoDB: Thread %lu stopped in file %s line %lu\n",
 
87
                os_thread_pf(os_thread_get_curr_id()), file, line);
 
88
        os_thread_sleep(1000000000);
 
89
}
 
90
#endif /* __NETWARE__ */