~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Brian Aker
  • Date: 2009-01-24 09:43:35 UTC
  • Revision ID: brian@gir-3.local-20090124094335-6qdtvc35gl5fvivz
Adding in an example singe thread scheduler

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*****************************************************************************
2
 
 
3
 
Copyright (c) 2005, 2009, 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/page0zip.h
 
1
/******************************************************
21
2
Compressed page interface
22
3
 
 
4
(c) 2005 Innobase Oy
 
5
 
23
6
Created June 2005 by Marko Makela
24
7
*******************************************************/
25
8
 
35
18
#include "page0types.h"
36
19
#include "buf0types.h"
37
20
#include "dict0types.h"
38
 
#include "trx0types.h"
39
21
#include "mem0mem.h"
40
22
 
41
 
/**********************************************************************//**
42
 
Determine the size of a compressed page in bytes.
43
 
@return size in bytes */
 
23
/**************************************************************************
 
24
Determine the size of a compressed page in bytes. */
44
25
UNIV_INLINE
45
26
ulint
46
27
page_zip_get_size(
47
28
/*==============*/
48
 
        const page_zip_des_t*   page_zip)       /*!< in: compressed page */
 
29
                                                /* out: size in bytes */
 
30
        const page_zip_des_t*   page_zip)       /* in: compressed page */
49
31
        __attribute__((nonnull, pure));
50
 
/**********************************************************************//**
 
32
/**************************************************************************
51
33
Set the size of a compressed page in bytes. */
52
34
UNIV_INLINE
53
35
void
54
36
page_zip_set_size(
55
37
/*==============*/
56
 
        page_zip_des_t* page_zip,       /*!< in/out: compressed page */
57
 
        ulint           size);          /*!< in: size in bytes */
 
38
        page_zip_des_t* page_zip,       /* in/out: compressed page */
 
39
        ulint           size);          /* in: size in bytes */
58
40
 
59
 
#ifndef UNIV_HOTBACKUP
60
 
/**********************************************************************//**
61
 
Determine if a record is so big that it needs to be stored externally.
62
 
@return FALSE if the entire record can be stored locally on the page */
 
41
/**************************************************************************
 
42
Determine if a record is so big that it needs to be stored externally. */
63
43
UNIV_INLINE
64
44
ibool
65
45
page_zip_rec_needs_ext(
66
46
/*===================*/
67
 
        ulint   rec_size,       /*!< in: length of the record in bytes */
68
 
        ulint   comp,           /*!< in: nonzero=compact format */
69
 
        ulint   n_fields,       /*!< in: number of fields in the record;
 
47
                                /* out: FALSE if the entire record
 
48
                                can be stored locally on the page */
 
49
        ulint   rec_size,       /* in: length of the record in bytes */
 
50
        ulint   comp,           /* in: nonzero=compact format */
 
51
        ulint   n_fields,       /* in: number of fields in the record;
70
52
                                ignored if zip_size == 0 */
71
 
        ulint   zip_size)       /*!< in: compressed page size in bytes, or 0 */
72
 
        __attribute__((const));
 
53
        ulint   zip_size)       /* in: compressed page size in bytes, or 0 */
 
54
        __attribute__((__const__));
73
55
 
74
 
/**********************************************************************//**
75
 
Determine the guaranteed free space on an empty page.
76
 
@return minimum payload size on the page */
 
56
/**************************************************************************
 
57
Determine the guaranteed free space on an empty page. */
77
58
UNIV_INTERN
78
59
ulint
79
60
page_zip_empty_size(
80
61
/*================*/
81
 
        ulint   n_fields,       /*!< in: number of columns in the index */
82
 
        ulint   zip_size)       /*!< in: compressed page size in bytes */
 
62
                                /* out: minimum payload size on the page */
 
63
        ulint   n_fields,       /* in: number of columns in the index */
 
64
        ulint   zip_size)       /* in: compressed page size in bytes */
83
65
        __attribute__((const));
84
 
#endif /* !UNIV_HOTBACKUP */
85
66
 
86
 
/**********************************************************************//**
 
67
/**************************************************************************
87
68
Initialize a compressed page descriptor. */
88
69
UNIV_INLINE
89
70
void
90
71
page_zip_des_init(
91
72
/*==============*/
92
 
        page_zip_des_t* page_zip);      /*!< in/out: compressed page
 
73
        page_zip_des_t* page_zip);      /* in/out: compressed page
93
74
                                        descriptor */
94
75
 
95
 
/**********************************************************************//**
 
76
/**************************************************************************
96
77
Configure the zlib allocator to use the given memory heap. */
97
78
UNIV_INTERN
98
79
void
99
80
page_zip_set_alloc(
100
81
/*===============*/
101
 
        void*           stream,         /*!< in/out: zlib stream */
102
 
        mem_heap_t*     heap);          /*!< in: memory heap to use */
 
82
        void*           stream,         /* in/out: zlib stream */
 
83
        mem_heap_t*     heap);          /* in: memory heap to use */
103
84
 
104
 
/**********************************************************************//**
105
 
Compress a page.
106
 
@return TRUE on success, FALSE on failure; page_zip will be left
107
 
intact on failure. */
 
85
/**************************************************************************
 
86
Compress a page. */
108
87
UNIV_INTERN
109
88
ibool
110
89
page_zip_compress(
111
90
/*==============*/
112
 
        page_zip_des_t* page_zip,/*!< in: size; out: data, n_blobs,
 
91
                                /* out: TRUE on success, FALSE on failure;
 
92
                                page_zip will be left intact on failure. */
 
93
        page_zip_des_t* page_zip,/* in: size; out: data, n_blobs,
113
94
                                m_start, m_end, m_nonempty */
114
 
        const page_t*   page,   /*!< in: uncompressed page */
115
 
        dict_index_t*   index,  /*!< in: index of the B-tree node */
116
 
        mtr_t*          mtr)    /*!< in: mini-transaction, or NULL */
 
95
        const page_t*   page,   /* in: uncompressed page */
 
96
        dict_index_t*   index,  /* in: index of the B-tree node */
 
97
        mtr_t*          mtr)    /* in: mini-transaction, or NULL */
117
98
        __attribute__((nonnull(1,2,3)));
118
99
 
119
 
/**********************************************************************//**
 
100
/**************************************************************************
120
101
Decompress a page.  This function should tolerate errors on the compressed
121
102
page.  Instead of letting assertions fail, it will return FALSE if an
122
 
inconsistency is detected.
123
 
@return TRUE on success, FALSE on failure */
 
103
inconsistency is detected. */
124
104
UNIV_INTERN
125
105
ibool
126
106
page_zip_decompress(
127
107
/*================*/
128
 
        page_zip_des_t* page_zip,/*!< in: data, ssize;
 
108
                                /* out: TRUE on success, FALSE on failure */
 
109
        page_zip_des_t* page_zip,/* in: data, ssize;
129
110
                                out: m_start, m_end, m_nonempty, n_blobs */
130
 
        page_t*         page,   /*!< out: uncompressed page, may be trashed */
131
 
        ibool           all)    /*!< in: TRUE=decompress the whole page;
132
 
                                FALSE=verify but do not copy some
133
 
                                page header fields that should not change
134
 
                                after page creation */
135
 
        __attribute__((nonnull(1,2)));
 
111
        page_t*         page)   /* out: uncompressed page, may be trashed */
 
112
        __attribute__((nonnull));
136
113
 
137
114
#ifdef UNIV_DEBUG
138
 
/**********************************************************************//**
139
 
Validate a compressed page descriptor.
140
 
@return TRUE if ok */
 
115
/**************************************************************************
 
116
Validate a compressed page descriptor. */
141
117
UNIV_INLINE
142
118
ibool
143
119
page_zip_simple_validate(
144
120
/*=====================*/
145
 
        const page_zip_des_t*   page_zip);      /*!< in: compressed page
 
121
                                                /* out: TRUE if ok */
 
122
        const page_zip_des_t*   page_zip);      /* in: compressed page
146
123
                                                descriptor */
147
124
#endif /* UNIV_DEBUG */
148
125
 
149
126
#ifdef UNIV_ZIP_DEBUG
150
 
/**********************************************************************//**
151
 
Check that the compressed and decompressed pages match.
152
 
@return TRUE if valid, FALSE if not */
 
127
/**************************************************************************
 
128
Check that the compressed and decompressed pages match. */
153
129
UNIV_INTERN
154
130
ibool
155
131
page_zip_validate_low(
156
132
/*==================*/
157
 
        const page_zip_des_t*   page_zip,/*!< in: compressed page */
158
 
        const page_t*           page,   /*!< in: uncompressed page */
159
 
        ibool                   sloppy) /*!< in: FALSE=strict,
 
133
                                        /* out: TRUE if valid, FALSE if not */
 
134
        const page_zip_des_t*   page_zip,/* in: compressed page */
 
135
        const page_t*           page,   /* in: uncompressed page */
 
136
        ibool                   sloppy) /* in: FALSE=strict,
160
137
                                        TRUE=ignore the MIN_REC_FLAG */
161
138
        __attribute__((nonnull));
162
 
/**********************************************************************//**
 
139
/**************************************************************************
163
140
Check that the compressed and decompressed pages match. */
164
141
UNIV_INTERN
165
142
ibool
166
143
page_zip_validate(
167
144
/*==============*/
168
 
        const page_zip_des_t*   page_zip,/*!< in: compressed page */
169
 
        const page_t*           page)   /*!< in: uncompressed page */
 
145
        const page_zip_des_t*   page_zip,/* in: compressed page */
 
146
        const page_t*           page)   /* in: uncompressed page */
170
147
        __attribute__((nonnull));
171
148
#endif /* UNIV_ZIP_DEBUG */
172
149
 
173
 
/**********************************************************************//**
174
 
Determine how big record can be inserted without recompressing the page.
175
 
@return a positive number indicating the maximum size of a record
176
 
whose insertion is guaranteed to succeed, or zero or negative */
 
150
/**************************************************************************
 
151
Determine how big record can be inserted without recompressing the page. */
177
152
UNIV_INLINE
178
153
lint
179
154
page_zip_max_ins_size(
180
155
/*==================*/
181
 
        const page_zip_des_t*   page_zip,/*!< in: compressed page */
182
 
        ibool                   is_clust)/*!< in: TRUE if clustered index */
 
156
                                        /* out: a positive number
 
157
                                        indicating the maximum size of
 
158
                                        a record whose insertion is
 
159
                                        guaranteed to succeed, or
 
160
                                        zero or negative */
 
161
        const page_zip_des_t*   page_zip,/* in: compressed page */
 
162
        ibool                   is_clust)/* in: TRUE if clustered index */
183
163
        __attribute__((nonnull, pure));
184
164
 
185
 
/**********************************************************************//**
186
 
Determine if enough space is available in the modification log.
187
 
@return TRUE if page_zip_write_rec() will succeed */
 
165
/**************************************************************************
 
166
Determine if enough space is available in the modification log. */
188
167
UNIV_INLINE
189
168
ibool
190
169
page_zip_available(
191
170
/*===============*/
192
 
        const page_zip_des_t*   page_zip,/*!< in: compressed page */
193
 
        ibool                   is_clust,/*!< in: TRUE if clustered index */
194
 
        ulint                   length, /*!< in: combined size of the record */
195
 
        ulint                   create) /*!< in: nonzero=add the record to
 
171
                                        /* out: TRUE if page_zip_write_rec()
 
172
                                        will succeed */
 
173
        const page_zip_des_t*   page_zip,/* in: compressed page */
 
174
        ibool                   is_clust,/* in: TRUE if clustered index */
 
175
        ulint                   length, /* in: combined size of the record */
 
176
        ulint                   create) /* in: nonzero=add the record to
196
177
                                        the heap */
197
178
        __attribute__((nonnull, pure));
198
179
 
199
 
/**********************************************************************//**
200
 
Write data to the uncompressed header portion of a page.  The data must
201
 
already have been written to the uncompressed page. */
202
 
UNIV_INLINE
203
 
void
204
 
page_zip_write_header(
205
 
/*==================*/
206
 
        page_zip_des_t* page_zip,/*!< in/out: compressed page */
207
 
        const byte*     str,    /*!< in: address on the uncompressed page */
208
 
        ulint           length, /*!< in: length of the data */
209
 
        mtr_t*          mtr)    /*!< in: mini-transaction, or NULL */
210
 
        __attribute__((nonnull(1,2)));
211
 
 
212
 
/**********************************************************************//**
 
180
/**************************************************************************
213
181
Write an entire record on the compressed page.  The data must already
214
182
have been written to the uncompressed page. */
215
183
UNIV_INTERN
216
184
void
217
185
page_zip_write_rec(
218
186
/*===============*/
219
 
        page_zip_des_t* page_zip,/*!< in/out: compressed page */
220
 
        const byte*     rec,    /*!< in: record being written */
221
 
        dict_index_t*   index,  /*!< in: the index the record belongs to */
222
 
        const ulint*    offsets,/*!< in: rec_get_offsets(rec, index) */
223
 
        ulint           create) /*!< in: nonzero=insert, zero=update */
 
187
        page_zip_des_t* page_zip,/* in/out: compressed page */
 
188
        const byte*     rec,    /* in: record being written */
 
189
        dict_index_t*   index,  /* in: the index the record belongs to */
 
190
        const ulint*    offsets,/* in: rec_get_offsets(rec, index) */
 
191
        ulint           create) /* in: nonzero=insert, zero=update */
224
192
        __attribute__((nonnull));
225
193
 
226
 
/***********************************************************//**
227
 
Parses a log record of writing a BLOB pointer of a record.
228
 
@return end of log record or NULL */
 
194
/***************************************************************
 
195
Parses a log record of writing a BLOB pointer of a record. */
229
196
UNIV_INTERN
230
197
byte*
231
198
page_zip_parse_write_blob_ptr(
232
199
/*==========================*/
233
 
        byte*           ptr,    /*!< in: redo log buffer */
234
 
        byte*           end_ptr,/*!< in: redo log buffer end */
235
 
        page_t*         page,   /*!< in/out: uncompressed page */
236
 
        page_zip_des_t* page_zip);/*!< in/out: compressed page */
 
200
                                /* out: end of log record or NULL */
 
201
        byte*           ptr,    /* in: redo log buffer */
 
202
        byte*           end_ptr,/* in: redo log buffer end */
 
203
        page_t*         page,   /* in/out: uncompressed page */
 
204
        page_zip_des_t* page_zip);/* in/out: compressed page */
237
205
 
238
 
/**********************************************************************//**
 
206
/**************************************************************************
239
207
Write a BLOB pointer of a record on the leaf page of a clustered index.
240
208
The information must already have been updated on the uncompressed page. */
241
209
UNIV_INTERN
242
210
void
243
211
page_zip_write_blob_ptr(
244
212
/*====================*/
245
 
        page_zip_des_t* page_zip,/*!< in/out: compressed page */
246
 
        const byte*     rec,    /*!< in/out: record whose data is being
 
213
        page_zip_des_t* page_zip,/* in/out: compressed page */
 
214
        const byte*     rec,    /* in/out: record whose data is being
247
215
                                written */
248
 
        dict_index_t*   index,  /*!< in: index of the page */
249
 
        const ulint*    offsets,/*!< in: rec_get_offsets(rec, index) */
250
 
        ulint           n,      /*!< in: column index */
251
 
        mtr_t*          mtr)    /*!< in: mini-transaction handle,
 
216
        dict_index_t*   index,  /* in: index of the page */
 
217
        const ulint*    offsets,/* in: rec_get_offsets(rec, index) */
 
218
        ulint           n,      /* in: column index */
 
219
        mtr_t*          mtr)    /* in: mini-transaction handle,
252
220
                                or NULL if no logging is needed */
253
221
        __attribute__((nonnull(1,2,3,4)));
254
222
 
255
 
/***********************************************************//**
256
 
Parses a log record of writing the node pointer of a record.
257
 
@return end of log record or NULL */
 
223
/***************************************************************
 
224
Parses a log record of writing the node pointer of a record. */
258
225
UNIV_INTERN
259
226
byte*
260
227
page_zip_parse_write_node_ptr(
261
228
/*==========================*/
262
 
        byte*           ptr,    /*!< in: redo log buffer */
263
 
        byte*           end_ptr,/*!< in: redo log buffer end */
264
 
        page_t*         page,   /*!< in/out: uncompressed page */
265
 
        page_zip_des_t* page_zip);/*!< in/out: compressed page */
 
229
                                /* out: end of log record or NULL */
 
230
        byte*           ptr,    /* in: redo log buffer */
 
231
        byte*           end_ptr,/* in: redo log buffer end */
 
232
        page_t*         page,   /* in/out: uncompressed page */
 
233
        page_zip_des_t* page_zip);/* in/out: compressed page */
266
234
 
267
 
/**********************************************************************//**
 
235
/**************************************************************************
268
236
Write the node pointer of a record on a non-leaf compressed page. */
269
237
UNIV_INTERN
270
238
void
271
239
page_zip_write_node_ptr(
272
240
/*====================*/
273
 
        page_zip_des_t* page_zip,/*!< in/out: compressed page */
274
 
        byte*           rec,    /*!< in/out: record */
275
 
        ulint           size,   /*!< in: data size of rec */
276
 
        ulint           ptr,    /*!< in: node pointer */
277
 
        mtr_t*          mtr)    /*!< in: mini-transaction, or NULL */
 
241
        page_zip_des_t* page_zip,/* in/out: compressed page */
 
242
        byte*           rec,    /* in/out: record */
 
243
        ulint           size,   /* in: data size of rec */
 
244
        ulint           ptr,    /* in: node pointer */
 
245
        mtr_t*          mtr)    /* in: mini-transaction, or NULL */
278
246
        __attribute__((nonnull(1,2)));
279
247
 
280
 
/**********************************************************************//**
 
248
/**************************************************************************
281
249
Write the trx_id and roll_ptr of a record on a B-tree leaf node page. */
282
250
UNIV_INTERN
283
251
void
284
252
page_zip_write_trx_id_and_roll_ptr(
285
253
/*===============================*/
286
 
        page_zip_des_t* page_zip,/*!< in/out: compressed page */
287
 
        byte*           rec,    /*!< in/out: record */
288
 
        const ulint*    offsets,/*!< in: rec_get_offsets(rec, index) */
289
 
        ulint           trx_id_col,/*!< in: column number of TRX_ID in rec */
290
 
        trx_id_t        trx_id, /*!< in: transaction identifier */
291
 
        roll_ptr_t      roll_ptr)/*!< in: roll_ptr */
 
254
        page_zip_des_t* page_zip,/* in/out: compressed page */
 
255
        byte*           rec,    /* in/out: record */
 
256
        const ulint*    offsets,/* in: rec_get_offsets(rec, index) */
 
257
        ulint           trx_id_col,/* in: column number of TRX_ID in rec */
 
258
        dulint          trx_id, /* in: transaction identifier */
 
259
        dulint          roll_ptr)/* in: roll_ptr */
292
260
        __attribute__((nonnull));
293
261
 
294
 
 
295
 
/**********************************************************************//**
 
262
/**************************************************************************
296
263
Insert a record to the dense page directory. */
297
264
UNIV_INTERN
298
265
void
299
266
page_zip_dir_insert(
300
267
/*================*/
301
 
        page_zip_des_t* page_zip,/*!< in/out: compressed page */
302
 
        const byte*     prev_rec,/*!< in: record after which to insert */
303
 
        const byte*     free_rec,/*!< in: record from which rec was
 
268
        page_zip_des_t* page_zip,/* in/out: compressed page */
 
269
        const byte*     prev_rec,/* in: record after which to insert */
 
270
        const byte*     free_rec,/* in: record from which rec was
304
271
                                allocated, or NULL */
305
 
        byte*           rec);   /*!< in: record to insert */
 
272
        byte*           rec);   /* in: record to insert */
306
273
 
 
274
/***************************************************************
 
275
Parses a log record of writing to the header of a page. */
307
276
UNIV_INTERN
308
277
byte*
309
278
page_zip_parse_write_header(
310
279
/*========================*/
311
 
        byte*           ptr,    /*!< in: redo log buffer */
312
 
        byte*           end_ptr,/*!< in: redo log buffer end */
313
 
        page_t*         page,   /*!< in/out: uncompressed page */
314
 
        page_zip_des_t* page_zip);/*!< in/out: compressed page */
315
 
 
316
 
 
317
 
/**********************************************************************//**
 
280
                                /* out: end of log record or NULL */
 
281
        byte*           ptr,    /* in: redo log buffer */
 
282
        byte*           end_ptr,/* in: redo log buffer end */
 
283
        page_t*         page,   /* in/out: uncompressed page */
 
284
        page_zip_des_t* page_zip);/* in/out: compressed page */
 
285
 
 
286
/**************************************************************************
 
287
Write data to the uncompressed header portion of a page.  The data must
 
288
already have been written to the uncompressed page.
 
289
However, the data portion of the uncompressed page may differ from
 
290
the compressed page when a record is being inserted in
 
291
page_cur_insert_rec_low(). */
 
292
UNIV_INLINE
 
293
void
 
294
page_zip_write_header(
 
295
/*==================*/
 
296
        page_zip_des_t* page_zip,/* in/out: compressed page */
 
297
        const byte*     str,    /* in: address on the uncompressed page */
 
298
        ulint           length, /* in: length of the data */
 
299
        mtr_t*          mtr)    /* in: mini-transaction, or NULL */
 
300
        __attribute__((nonnull(1,2)));
 
301
 
 
302
/**************************************************************************
318
303
Reorganize and compress a page.  This is a low-level operation for
319
304
compressed pages, to be used when page_zip_compress() fails.
320
305
On success, a redo log entry MLOG_ZIP_PAGE_COMPRESS will be written.
322
307
IMPORTANT: if page_zip_reorganize() is invoked on a leaf page of a
323
308
non-clustered index, the caller must update the insert buffer free
324
309
bits in the same mini-transaction in such a way that the modification
325
 
will be redo-logged.
326
 
@return TRUE on success, FALSE on failure; page_zip will be left
327
 
intact on failure, but page will be overwritten. */
 
310
will be redo-logged. */
328
311
UNIV_INTERN
329
312
ibool
330
313
page_zip_reorganize(
331
314
/*================*/
332
 
        buf_block_t*    block,  /*!< in/out: page with compressed page;
 
315
                                /* out: TRUE on success, FALSE on failure;
 
316
                                page and page_zip will be left intact
 
317
                                on failure. */
 
318
        buf_block_t*    block,  /* in/out: page with compressed page;
333
319
                                on the compressed page, in: size;
334
320
                                out: data, n_blobs,
335
321
                                m_start, m_end, m_nonempty */
336
 
        dict_index_t*   index,  /*!< in: index of the B-tree node */
337
 
        mtr_t*          mtr)    /*!< in: mini-transaction */
 
322
        dict_index_t*   index,  /* in: index of the B-tree node */
 
323
        mtr_t*          mtr)    /* in: mini-transaction */
338
324
        __attribute__((nonnull));
339
 
#ifndef UNIV_HOTBACKUP
340
 
/**********************************************************************//**
 
325
/**************************************************************************
341
326
Copy the records of a page byte for byte.  Do not copy the page header
342
327
or trailer, except those B-tree header fields that are directly
343
328
related to the storage of records.  Also copy PAGE_MAX_TRX_ID.
346
331
void
347
332
page_zip_copy_recs(
348
333
/*===============*/
349
 
        page_zip_des_t*         page_zip,       /*!< out: copy of src_zip
 
334
        page_zip_des_t*         page_zip,       /* out: copy of src_zip
350
335
                                                (n_blobs, m_start, m_end,
351
336
                                                m_nonempty, data[0..size-1]) */
352
 
        page_t*                 page,           /*!< out: copy of src */
353
 
        const page_zip_des_t*   src_zip,        /*!< in: compressed page */
354
 
        const page_t*           src,            /*!< in: page */
355
 
        dict_index_t*           index,          /*!< in: index of the B-tree */
356
 
        mtr_t*                  mtr)            /*!< in: mini-transaction */
 
337
        page_t*                 page,           /* out: copy of src */
 
338
        const page_zip_des_t*   src_zip,        /* in: compressed page */
 
339
        const page_t*           src,            /* in: page */
 
340
        dict_index_t*           index,          /* in: index of the B-tree */
 
341
        mtr_t*                  mtr)            /* in: mini-transaction */
357
342
        __attribute__((nonnull(1,2,3,4)));
358
 
#endif /* !UNIV_HOTBACKUP */
359
343
 
360
 
/**********************************************************************//**
361
 
Parses a log record of compressing an index page.
362
 
@return end of log record or NULL */
 
344
/**************************************************************************
 
345
Parses a log record of compressing an index page. */
363
346
UNIV_INTERN
364
347
byte*
365
348
page_zip_parse_compress(
366
349
/*====================*/
367
 
        byte*           ptr,    /*!< in: buffer */
368
 
        byte*           end_ptr,/*!< in: buffer end */
369
 
        page_t*         page,   /*!< out: uncompressed page */
370
 
        page_zip_des_t* page_zip)/*!< out: compressed page */
 
350
                                /* out: end of log record or NULL */
 
351
        byte*           ptr,    /* in: buffer */
 
352
        byte*           end_ptr,/* in: buffer end */
 
353
        page_t*         page,   /* out: uncompressed page */
 
354
        page_zip_des_t* page_zip)/* out: compressed page */
371
355
        __attribute__((nonnull(1,2)));
372
356
 
373
 
/**********************************************************************//**
374
 
Calculate the compressed page checksum.
375
 
@return page checksum */
 
357
/**************************************************************************
 
358
Calculate the compressed page checksum. */
376
359
UNIV_INTERN
377
360
ulint
378
361
page_zip_calc_checksum(
379
362
/*===================*/
380
 
        const void*     data,   /*!< in: compressed page */
381
 
        ulint           size)   /*!< in: size of compressed page */
 
363
                                /* out: page checksum */
 
364
        const void*     data,   /* in: compressed page */
 
365
        ulint           size)   /* in: size of compressed page */
382
366
        __attribute__((nonnull));
383
367
 
384
 
#ifndef UNIV_HOTBACKUP
385
 
/** Check if a pointer to an uncompressed page matches a compressed page.
386
 
@param ptr      pointer to an uncompressed page frame
387
 
@param page_zip compressed page descriptor
388
 
@return         TRUE if ptr and page_zip refer to the same block */
389
 
# define PAGE_ZIP_MATCH(ptr, page_zip)                  \
390
 
        (buf_frame_get_page_zip(ptr) == (page_zip))
391
 
#else /* !UNIV_HOTBACKUP */
392
 
/** Check if a pointer to an uncompressed page matches a compressed page.
393
 
@param ptr      pointer to an uncompressed page frame
394
 
@param page_zip compressed page descriptor
395
 
@return         TRUE if ptr and page_zip refer to the same block */
396
 
# define PAGE_ZIP_MATCH(ptr, page_zip)                          \
397
 
        (page_align(ptr) + UNIV_PAGE_SIZE == (page_zip)->data)
398
 
#endif /* !UNIV_HOTBACKUP */
399
 
 
400
368
#ifdef UNIV_MATERIALIZE
401
369
# undef UNIV_INLINE
402
370
# define UNIV_INLINE    UNIV_INLINE_ORIGINAL