~stewart/drizzle/embedded-innodb-create-select-transaction-arrgh

« back to all changes in this revision

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

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

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 defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
 
18
/* If this is set to TRUE all threads will stop into the next assertion
 
19
and assert */
 
20
ibool   ut_dbg_stop_threads     = FALSE;
 
21
#endif
 
22
#ifdef __NETWARE__
 
23
ibool panic_shutdown = FALSE;   /* This is set to TRUE when on NetWare there
 
24
                                happens an InnoDB assertion failure or other
 
25
                                fatal error condition that requires an
 
26
                                immediate shutdown. */
 
27
#elif !defined(UT_DBG_USE_ABORT)
 
28
/* Null pointer used to generate memory trap */
 
29
 
 
30
ulint*  ut_dbg_null_ptr         = NULL;
 
31
#endif
 
32
 
 
33
/*****************************************************************
 
34
Report a failed assertion. */
 
35
 
 
36
void
 
37
ut_dbg_assertion_failed(
 
38
/*====================*/
 
39
        const char* expr,       /* in: the failed assertion (optional) */
 
40
        const char* file,       /* in: source file containing the assertion */
 
41
        ulint line)             /* in: line number of the assertion */
 
42
{
 
43
        ut_print_timestamp(stderr);
 
44
        fprintf(stderr,
 
45
                "  InnoDB: Assertion failure in thread %lu"
 
46
                " in file %s line %lu\n",
 
47
                os_thread_pf(os_thread_get_curr_id()), file, line);
 
48
        if (expr) {
 
49
                fprintf(stderr,
 
50
                        "InnoDB: Failing assertion: %s\n", expr);
 
51
        }
 
52
 
 
53
        fputs("InnoDB: We intentionally generate a memory trap.\n"
 
54
              "InnoDB: Submit a detailed bug report"
 
55
              " to http://bugs.mysql.com.\n"
 
56
              "InnoDB: If you get repeated assertion failures"
 
57
              " or crashes, even\n"
 
58
              "InnoDB: immediately after the mysqld startup, there may be\n"
 
59
              "InnoDB: corruption in the InnoDB tablespace. Please refer to\n"
 
60
              "InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
 
61
              "forcing-recovery.html\n"
 
62
              "InnoDB: about forcing recovery.\n", stderr);
 
63
#if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
 
64
        ut_dbg_stop_threads = TRUE;
 
65
#endif
 
66
}
 
67
 
 
68
#ifdef __NETWARE__
 
69
/*****************************************************************
 
70
Shut down MySQL/InnoDB after assertion failure. */
 
71
 
 
72
void
 
73
ut_dbg_panic(void)
 
74
/*==============*/
 
75
{
 
76
        if (!panic_shutdown) {
 
77
                panic_shutdown = TRUE;
 
78
                innobase_shutdown_for_mysql();
 
79
        }
 
80
        exit(1);
 
81
}
 
82
#else /* __NETWARE__ */
 
83
# if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
 
84
/*****************************************************************
 
85
Stop a thread after assertion failure. */
 
86
 
 
87
void
 
88
ut_dbg_stop_thread(
 
89
/*===============*/
 
90
        const char*     file,
 
91
        ulint           line)
 
92
{
 
93
        fprintf(stderr, "InnoDB: Thread %lu stopped in file %s line %lu\n",
 
94
                os_thread_pf(os_thread_get_curr_id()), file, line);
 
95
        os_thread_sleep(1000000000);
 
96
}
 
97
# endif
 
98
#endif /* __NETWARE__ */