~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/ut/ut0dbg.c

  • Committer: Monty Taylor
  • Date: 2009-08-12 06:25:19 UTC
  • mto: (1114.1.1 innodb-plugin-merge)
  • mto: This revision was merged to the branch mainline in revision 1183.
  • Revision ID: mordred@inaugust.com-20090812062519-cij02mrrunvnxblt
Tags: innodb-plugin-1.0.4
InnoDB Plugin 1.0.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
*****************************************************************************/
18
18
 
19
 
/*********************************************************************
 
19
/*****************************************************************//**
 
20
@file ut/ut0dbg.c
20
21
Debug utilities for Innobase.
21
22
 
22
23
Created 1/30/1994 Heikki Tuuri
27
28
 
28
29
#if defined(__GNUC__) && (__GNUC__ > 2)
29
30
#else
30
 
/* This is used to eliminate compiler warnings */
 
31
/** This is used to eliminate compiler warnings */
31
32
UNIV_INTERN ulint       ut_dbg_zero     = 0;
32
33
#endif
33
34
 
34
35
#if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
35
 
/* If this is set to TRUE all threads will stop into the next assertion
36
 
and assert */
 
36
/** If this is set to TRUE by ut_dbg_assertion_failed(), all threads
 
37
will stop at the next ut_a() or ut_ad(). */
37
38
UNIV_INTERN ibool       ut_dbg_stop_threads     = FALSE;
38
39
#endif
39
40
#ifdef __NETWARE__
40
 
/* This is set to TRUE when on NetWare there happens an InnoDB
41
 
assertion failure or other fatal error condition that requires an
42
 
immediate shutdown. */
 
41
/** Flag for ignoring further assertion failures.  This is set to TRUE
 
42
when on NetWare there happens an InnoDB assertion failure or other
 
43
fatal error condition that requires an immediate shutdown. */
43
44
UNIV_INTERN ibool panic_shutdown = FALSE;
44
45
#elif !defined(UT_DBG_USE_ABORT)
45
 
/* Null pointer used to generate memory trap */
 
46
/** A null pointer that will be dereferenced to trigger a memory trap */
46
47
UNIV_INTERN ulint*      ut_dbg_null_ptr         = NULL;
47
48
#endif
48
49
 
49
 
/*****************************************************************
 
50
/*************************************************************//**
50
51
Report a failed assertion. */
51
52
UNIV_INTERN
52
53
void
53
54
ut_dbg_assertion_failed(
54
55
/*====================*/
55
 
        const char* expr,       /* in: the failed assertion (optional) */
56
 
        const char* file,       /* in: source file containing the assertion */
57
 
        ulint line)             /* in: line number of the assertion */
 
56
        const char* expr,       /*!< in: the failed assertion (optional) */
 
57
        const char* file,       /*!< in: source file containing the assertion */
 
58
        ulint line)             /*!< in: line number of the assertion */
58
59
{
59
60
        ut_print_timestamp(stderr);
 
61
#ifdef UNIV_HOTBACKUP
 
62
        fprintf(stderr, "  InnoDB: Assertion failure in file %s line %lu\n",
 
63
                file, line);
 
64
#else /* UNIV_HOTBACKUP */
60
65
        fprintf(stderr,
61
66
                "  InnoDB: Assertion failure in thread %lu"
62
67
                " in file %s line %lu\n",
63
68
                os_thread_pf(os_thread_get_curr_id()), file, line);
 
69
#endif /* UNIV_HOTBACKUP */
64
70
        if (expr) {
65
71
                fprintf(stderr,
66
72
                        "InnoDB: Failing assertion: %s\n", expr);
73
79
              " or crashes, even\n"
74
80
              "InnoDB: immediately after the mysqld startup, there may be\n"
75
81
              "InnoDB: corruption in the InnoDB tablespace. Please refer to\n"
76
 
              "InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
77
 
              "forcing-recovery.html\n"
 
82
              "InnoDB: " REFMAN "forcing-recovery.html\n"
78
83
              "InnoDB: about forcing recovery.\n", stderr);
79
84
#if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
80
85
        ut_dbg_stop_threads = TRUE;
82
87
}
83
88
 
84
89
#ifdef __NETWARE__
85
 
/*****************************************************************
 
90
/*************************************************************//**
86
91
Shut down MySQL/InnoDB after assertion failure. */
87
92
UNIV_INTERN
88
93
void
97
102
}
98
103
#else /* __NETWARE__ */
99
104
# if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
100
 
/*****************************************************************
 
105
/*************************************************************//**
101
106
Stop a thread after assertion failure. */
102
107
UNIV_INTERN
103
108
void
106
111
        const char*     file,
107
112
        ulint           line)
108
113
{
 
114
#ifndef UNIV_HOTBACKUP
109
115
        fprintf(stderr, "InnoDB: Thread %lu stopped in file %s line %lu\n",
110
116
                os_thread_pf(os_thread_get_curr_id()), file, line);
111
117
        os_thread_sleep(1000000000);
 
118
#endif /* !UNIV_HOTBACKUP */
112
119
}
113
120
# endif
114
121
#endif /* __NETWARE__ */
133
140
        } while (0)
134
141
#endif /* timersub */
135
142
 
136
 
/***********************************************************************
 
143
/*******************************************************************//**
137
144
Resets a speedo (records the current time in it). */
138
145
UNIV_INTERN
139
146
void
140
147
speedo_reset(
141
148
/*=========*/
142
 
        speedo_t*       speedo) /* out: speedo */
 
149
        speedo_t*       speedo) /*!< out: speedo */
143
150
{
144
151
        gettimeofday(&speedo->tv, NULL);
145
152
 
146
153
        getrusage(RUSAGE_SELF, &speedo->ru);
147
154
}
148
155
 
149
 
/***********************************************************************
 
156
/*******************************************************************//**
150
157
Shows the time elapsed and usage statistics since the last reset of a
151
158
speedo. */
152
159
UNIV_INTERN
153
160
void
154
161
speedo_show(
155
162
/*========*/
156
 
        const speedo_t* speedo) /* in: speedo */
 
163
        const speedo_t* speedo) /*!< in: speedo */
157
164
{
158
165
        struct rusage   ru_now;
159
166
        struct timeval  tv_now;