~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/include/mtr0log.h

  • Committer: Daniel Nichter
  • Date: 2011-10-23 16:01:37 UTC
  • mto: This revision was merged to the branch mainline in revision 2448.
  • Revision ID: daniel@percona.com-20111023160137-7ac3blgz8z4tf8za
Add Administration Getting Started and Logging.  Capitalize SQL clause keywords.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/******************************************************
2
 
Mini-transaction logging routines
3
 
 
4
 
(c) 1995 Innobase Oy
5
 
 
6
 
Created 12/7/1995 Heikki Tuuri
7
 
*******************************************************/
8
 
 
9
 
#ifndef mtr0log_h
10
 
#define mtr0log_h
11
 
 
12
 
#include "univ.i"
13
 
#include "mtr0mtr.h"
14
 
#include "dict0types.h"
15
 
 
16
 
/************************************************************
17
 
Writes 1 - 4 bytes to a file page buffered in the buffer pool.
18
 
Writes the corresponding log record to the mini-transaction log. */
19
 
UNIV_INTERN
20
 
void
21
 
mlog_write_ulint(
22
 
/*=============*/
23
 
        byte*   ptr,    /* in: pointer where to write */
24
 
        ulint   val,    /* in: value to write */
25
 
        byte    type,   /* in: MLOG_1BYTE, MLOG_2BYTES, MLOG_4BYTES */
26
 
        mtr_t*  mtr);   /* in: mini-transaction handle */
27
 
/************************************************************
28
 
Writes 8 bytes to a file page buffered in the buffer pool.
29
 
Writes the corresponding log record to the mini-transaction log. */
30
 
UNIV_INTERN
31
 
void
32
 
mlog_write_dulint(
33
 
/*==============*/
34
 
        byte*   ptr,    /* in: pointer where to write */
35
 
        dulint  val,    /* in: value to write */
36
 
        mtr_t*  mtr);   /* in: mini-transaction handle */
37
 
/************************************************************
38
 
Writes a string to a file page buffered in the buffer pool. Writes the
39
 
corresponding log record to the mini-transaction log. */
40
 
UNIV_INTERN
41
 
void
42
 
mlog_write_string(
43
 
/*==============*/
44
 
        byte*           ptr,    /* in: pointer where to write */
45
 
        const byte*     str,    /* in: string to write */
46
 
        ulint           len,    /* in: string length */
47
 
        mtr_t*          mtr);   /* in: mini-transaction handle */
48
 
/************************************************************
49
 
Logs a write of a string to a file page buffered in the buffer pool.
50
 
Writes the corresponding log record to the mini-transaction log. */
51
 
UNIV_INTERN
52
 
void
53
 
mlog_log_string(
54
 
/*============*/
55
 
        byte*   ptr,    /* in: pointer written to */
56
 
        ulint   len,    /* in: string length */
57
 
        mtr_t*  mtr);   /* in: mini-transaction handle */
58
 
/************************************************************
59
 
Writes initial part of a log record consisting of one-byte item
60
 
type and four-byte space and page numbers. */
61
 
UNIV_INTERN
62
 
void
63
 
mlog_write_initial_log_record(
64
 
/*==========================*/
65
 
        const byte*     ptr,    /* in: pointer to (inside) a buffer
66
 
                                frame holding the file page where
67
 
                                modification is made */
68
 
        byte            type,   /* in: log item type: MLOG_1BYTE, ... */
69
 
        mtr_t*          mtr);   /* in: mini-transaction handle */
70
 
/************************************************************
71
 
Writes a log record about an .ibd file create/delete/rename. */
72
 
UNIV_INLINE
73
 
byte*
74
 
mlog_write_initial_log_record_for_file_op(
75
 
/*======================================*/
76
 
                        /* out: new value of log_ptr */
77
 
        ulint   type,   /* in: MLOG_FILE_CREATE, MLOG_FILE_DELETE, or
78
 
                        MLOG_FILE_RENAME */
79
 
        ulint   space_id,/* in: space id, if applicable */
80
 
        ulint   page_no,/* in: page number (not relevant currently) */
81
 
        byte*   log_ptr,/* in: pointer to mtr log which has been opened */
82
 
        mtr_t*  mtr);   /* in: mtr */
83
 
/************************************************************
84
 
Catenates 1 - 4 bytes to the mtr log. */
85
 
UNIV_INLINE
86
 
void
87
 
mlog_catenate_ulint(
88
 
/*================*/
89
 
        mtr_t*  mtr,    /* in: mtr */
90
 
        ulint   val,    /* in: value to write */
91
 
        ulint   type);  /* in: MLOG_1BYTE, MLOG_2BYTES, MLOG_4BYTES */
92
 
/************************************************************
93
 
Catenates n bytes to the mtr log. */
94
 
UNIV_INTERN
95
 
void
96
 
mlog_catenate_string(
97
 
/*=================*/
98
 
        mtr_t*          mtr,    /* in: mtr */
99
 
        const byte*     str,    /* in: string to write */
100
 
        ulint           len);   /* in: string length */
101
 
/************************************************************
102
 
Catenates a compressed ulint to mlog. */
103
 
UNIV_INLINE
104
 
void
105
 
mlog_catenate_ulint_compressed(
106
 
/*===========================*/
107
 
        mtr_t*  mtr,    /* in: mtr */
108
 
        ulint   val);   /* in: value to write */
109
 
/************************************************************
110
 
Catenates a compressed dulint to mlog. */
111
 
UNIV_INLINE
112
 
void
113
 
mlog_catenate_dulint_compressed(
114
 
/*============================*/
115
 
        mtr_t*  mtr,    /* in: mtr */
116
 
        dulint  val);   /* in: value to write */
117
 
/************************************************************
118
 
Opens a buffer to mlog. It must be closed with mlog_close. */
119
 
UNIV_INLINE
120
 
byte*
121
 
mlog_open(
122
 
/*======*/
123
 
                        /* out: buffer, NULL if log mode MTR_LOG_NONE */
124
 
        mtr_t*  mtr,    /* in: mtr */
125
 
        ulint   size);  /* in: buffer size in bytes; MUST be
126
 
                        smaller than DYN_ARRAY_DATA_SIZE! */
127
 
/************************************************************
128
 
Closes a buffer opened to mlog. */
129
 
UNIV_INLINE
130
 
void
131
 
mlog_close(
132
 
/*=======*/
133
 
        mtr_t*  mtr,    /* in: mtr */
134
 
        byte*   ptr);   /* in: buffer space from ptr up was not used */
135
 
/************************************************************
136
 
Writes the initial part of a log record (3..11 bytes).
137
 
If the implementation of this function is changed, all
138
 
size parameters to mlog_open() should be adjusted accordingly! */
139
 
UNIV_INLINE
140
 
byte*
141
 
mlog_write_initial_log_record_fast(
142
 
/*===============================*/
143
 
                                /* out: new value of log_ptr */
144
 
        const byte*     ptr,    /* in: pointer to (inside) a buffer
145
 
                                frame holding the file page where
146
 
                                modification is made */
147
 
        byte            type,   /* in: log item type: MLOG_1BYTE, ... */
148
 
        byte*           log_ptr,/* in: pointer to mtr log which has
149
 
                                been opened */
150
 
        mtr_t*          mtr);   /* in: mtr */
151
 
/************************************************************
152
 
Parses an initial log record written by mlog_write_initial_log_record. */
153
 
UNIV_INTERN
154
 
byte*
155
 
mlog_parse_initial_log_record(
156
 
/*==========================*/
157
 
                        /* out: parsed record end, NULL if not a complete
158
 
                        record */
159
 
        byte*   ptr,    /* in: buffer */
160
 
        byte*   end_ptr,/* in: buffer end */
161
 
        byte*   type,   /* out: log record type: MLOG_1BYTE, ... */
162
 
        ulint*  space,  /* out: space id */
163
 
        ulint*  page_no);/* out: page number */
164
 
/************************************************************
165
 
Parses a log record written by mlog_write_ulint or mlog_write_dulint. */
166
 
UNIV_INTERN
167
 
byte*
168
 
mlog_parse_nbytes(
169
 
/*==============*/
170
 
                        /* out: parsed record end, NULL if not a complete
171
 
                        record */
172
 
        ulint   type,   /* in: log record type: MLOG_1BYTE, ... */
173
 
        byte*   ptr,    /* in: buffer */
174
 
        byte*   end_ptr,/* in: buffer end */
175
 
        byte*   page,   /* in: page where to apply the log record, or NULL */
176
 
        void*   page_zip);/* in/out: compressed page, or NULL */
177
 
/************************************************************
178
 
Parses a log record written by mlog_write_string. */
179
 
UNIV_INTERN
180
 
byte*
181
 
mlog_parse_string(
182
 
/*==============*/
183
 
                        /* out: parsed record end, NULL if not a complete
184
 
                        record */
185
 
        byte*   ptr,    /* in: buffer */
186
 
        byte*   end_ptr,/* in: buffer end */
187
 
        byte*   page,   /* in: page where to apply the log record, or NULL */
188
 
        void*   page_zip);/* in/out: compressed page, or NULL */
189
 
 
190
 
 
191
 
/************************************************************
192
 
Opens a buffer for mlog, writes the initial log record and,
193
 
if needed, the field lengths of an index.  Reserves space
194
 
for further log entries.  The log entry must be closed with
195
 
mtr_close(). */
196
 
UNIV_INTERN
197
 
byte*
198
 
mlog_open_and_write_index(
199
 
/*======================*/
200
 
                                /* out: buffer, NULL if log mode
201
 
                                MTR_LOG_NONE */
202
 
        mtr_t*          mtr,    /* in: mtr */
203
 
        byte*           rec,    /* in: index record or page */
204
 
        dict_index_t*   index,  /* in: record descriptor */
205
 
        byte            type,   /* in: log item type */
206
 
        ulint           size);  /* in: requested buffer size in bytes
207
 
                                (if 0, calls mlog_close() and returns NULL) */
208
 
 
209
 
/************************************************************
210
 
Parses a log record written by mlog_open_and_write_index. */
211
 
UNIV_INTERN
212
 
byte*
213
 
mlog_parse_index(
214
 
/*=============*/
215
 
                                /* out: parsed record end,
216
 
                                NULL if not a complete record */
217
 
        byte*           ptr,    /* in: buffer */
218
 
        byte*           end_ptr,/* in: buffer end */
219
 
                                /* out: new value of log_ptr */
220
 
        ibool           comp,   /* in: TRUE=compact record format */
221
 
        dict_index_t**  index); /* out, own: dummy index */
222
 
 
223
 
/* Insert, update, and maybe other functions may use this value to define an
224
 
extra mlog buffer size for variable size data */
225
 
#define MLOG_BUF_MARGIN 256
226
 
 
227
 
#ifndef UNIV_NONINL
228
 
#include "mtr0log.ic"
229
 
#endif
230
 
 
231
 
#endif