~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/include/mem0dbg.h

Merge Revision revid:marko.makela@oracle.com-20100514133144-fe0l0b89tea4x4uu from MySQL InnoDB

Original revid:marko.makela@oracle.com-20100514133144-fe0l0b89tea4x4uu

Original Authors: Marko Mkel <marko.makela@oracle.com>
Original commit message:
Merge from mysql-5.1-innodb:

Post-merge fixes: Remove the MYSQL_VERSION_ID checks, because they only
apply to the InnoDB Plugin. Fix potential race condition accessing
trx->op_info and trx->detailed_error.
------------------------------------------------------------
revno: 3466
revision-id: marko.makela@oracle.com-20100514130815-ym7j7cfu88ro6km4
parent: marko.makela@oracle.com-20100514130228-n3n42nw7ht78k0wn
committer: Marko Mkel <marko.makela@oracle.com>
branch nick: mysql-5.1-innodb2
timestamp: Fri 2010-05-14 16:08:15 +0300
message:
  Make the InnoDB FOREIGN KEY parser understand multi-statements. (Bug #48024)
  Also make InnoDB thinks that /*/ only starts a comment. (Bug #53644).

  This fixes the bugs in the InnoDB Plugin.

  ha_innodb.h: Use trx_query_string() instead of trx_query() when
  available (MySQL 5.1.42 or later).

  innobase_get_stmt(): New function, to retrieve the currently running
  SQL statement.

  struct trx_struct: Remove mysql_query_str. Use innobase_get_stmt() instead.

  dict_strip_comments(): Add and observe the parameter sql_length. Treat
  /*/ as the start of a comment.

  dict_create_foreign_constraints(), row_table_add_foreign_constraints():
  Add the parameter sql_length.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*****************************************************************************
 
2
 
 
3
Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved.
 
4
 
 
5
This program is free software; you can redistribute it and/or modify it under
 
6
the terms of the GNU General Public License as published by the Free Software
 
7
Foundation; version 2 of the License.
 
8
 
 
9
This program is distributed in the hope that it will be useful, but WITHOUT
 
10
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 
11
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 
12
 
 
13
You should have received a copy of the GNU General Public License along with
 
14
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
 
15
St, Fifth Floor, Boston, MA 02110-1301 USA
 
16
 
 
17
*****************************************************************************/
 
18
 
 
19
/**************************************************//**
 
20
@file include/mem0dbg.h
 
21
The memory management: the debug code. This is not a compilation module,
 
22
but is included in mem0mem.* !
 
23
 
 
24
Created 6/9/1994 Heikki Tuuri
 
25
*******************************************************/
 
26
 
 
27
/* In the debug version each allocated field is surrounded with
 
28
check fields whose sizes are given below */
 
29
 
 
30
#ifdef UNIV_MEM_DEBUG
 
31
# ifndef UNIV_HOTBACKUP
 
32
/* The mutex which protects in the debug version the hash table
 
33
containing the list of live memory heaps, and also the global
 
34
variables in mem0dbg.c. */
 
35
extern mutex_t  mem_hash_mutex;
 
36
# endif /* !UNIV_HOTBACKUP */
 
37
 
 
38
#define MEM_FIELD_HEADER_SIZE   ut_calc_align(2 * sizeof(ulint),\
 
39
                                                UNIV_MEM_ALIGNMENT)
 
40
#define MEM_FIELD_TRAILER_SIZE  sizeof(ulint)
 
41
#else
 
42
#define MEM_FIELD_HEADER_SIZE   0
 
43
#endif
 
44
 
 
45
 
 
46
/* Space needed when allocating for a user a field of
 
47
length N. The space is allocated only in multiples of
 
48
UNIV_MEM_ALIGNMENT. In the debug version there are also
 
49
check fields at the both ends of the field. */
 
50
#ifdef UNIV_MEM_DEBUG
 
51
#define MEM_SPACE_NEEDED(N) ut_calc_align((N) + MEM_FIELD_HEADER_SIZE\
 
52
                 + MEM_FIELD_TRAILER_SIZE, UNIV_MEM_ALIGNMENT)
 
53
#else
 
54
#define MEM_SPACE_NEEDED(N) ut_calc_align((N), UNIV_MEM_ALIGNMENT)
 
55
#endif
 
56
 
 
57
#if defined UNIV_MEM_DEBUG || defined UNIV_DEBUG
 
58
/***************************************************************//**
 
59
Checks a memory heap for consistency and prints the contents if requested.
 
60
Outputs the sum of sizes of buffers given to the user (only in
 
61
the debug version), the physical size of the heap and the number of
 
62
blocks in the heap. In case of error returns 0 as sizes and number
 
63
of blocks. */
 
64
UNIV_INTERN
 
65
void
 
66
mem_heap_validate_or_print(
 
67
/*=======================*/
 
68
        mem_heap_t*     heap,   /*!< in: memory heap */
 
69
        byte*           top,    /*!< in: calculate and validate only until
 
70
                                this top pointer in the heap is reached,
 
71
                                if this pointer is NULL, ignored */
 
72
        ibool            print,  /*!< in: if TRUE, prints the contents
 
73
                                of the heap; works only in
 
74
                                the debug version */
 
75
        ibool*           error,  /*!< out: TRUE if error */
 
76
        ulint*          us_size,/*!< out: allocated memory
 
77
                                (for the user) in the heap,
 
78
                                if a NULL pointer is passed as this
 
79
                                argument, it is ignored; in the
 
80
                                non-debug version this is always -1 */
 
81
        ulint*          ph_size,/*!< out: physical size of the heap,
 
82
                                if a NULL pointer is passed as this
 
83
                                argument, it is ignored */
 
84
        ulint*          n_blocks); /*!< out: number of blocks in the heap,
 
85
                                if a NULL pointer is passed as this
 
86
                                argument, it is ignored */
 
87
/**************************************************************//**
 
88
Validates the contents of a memory heap.
 
89
@return TRUE if ok */
 
90
UNIV_INTERN
 
91
ibool
 
92
mem_heap_validate(
 
93
/*==============*/
 
94
        mem_heap_t*   heap);    /*!< in: memory heap */
 
95
#endif /* UNIV_MEM_DEBUG || UNIV_DEBUG */
 
96
#ifdef UNIV_DEBUG
 
97
/**************************************************************//**
 
98
Checks that an object is a memory heap (or a block of it)
 
99
@return TRUE if ok */
 
100
UNIV_INTERN
 
101
ibool
 
102
mem_heap_check(
 
103
/*===========*/
 
104
        mem_heap_t*   heap);    /*!< in: memory heap */
 
105
#endif /* UNIV_DEBUG */
 
106
#ifdef UNIV_MEM_DEBUG
 
107
/*****************************************************************//**
 
108
TRUE if no memory is currently allocated.
 
109
@return TRUE if no heaps exist */
 
110
UNIV_INTERN
 
111
ibool
 
112
mem_all_freed(void);
 
113
/*===============*/
 
114
/*****************************************************************//**
 
115
Validates the dynamic memory
 
116
@return TRUE if error */
 
117
UNIV_INTERN
 
118
ibool
 
119
mem_validate_no_assert(void);
 
120
/*=========================*/
 
121
/************************************************************//**
 
122
Validates the dynamic memory
 
123
@return TRUE if ok */
 
124
UNIV_INTERN
 
125
ibool
 
126
mem_validate(void);
 
127
/*===============*/
 
128
#endif /* UNIV_MEM_DEBUG */
 
129
/************************************************************//**
 
130
Tries to find neigboring memory allocation blocks and dumps to stderr
 
131
the neighborhood of a given pointer. */
 
132
UNIV_INTERN
 
133
void
 
134
mem_analyze_corruption(
 
135
/*===================*/
 
136
        void*   ptr);   /*!< in: pointer to place of possible corruption */
 
137
/*****************************************************************//**
 
138
Prints information of dynamic memory usage and currently allocated memory
 
139
heaps or buffers. Can only be used in the debug version. */
 
140
UNIV_INTERN
 
141
void
 
142
mem_print_info(void);
 
143
/*================*/
 
144
/*****************************************************************//**
 
145
Prints information of dynamic memory usage and currently allocated memory
 
146
heaps or buffers since the last ..._print_info or..._print_new_info. */
 
147
UNIV_INTERN
 
148
void
 
149
mem_print_new_info(void);
 
150
/*====================*/