~drizzle-pbxt/drizzle/drizzle-pbxt-2

« back to all changes in this revision

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

  • Committer: Paul McCullagh
  • Date: 2009-11-10 14:18:39 UTC
  • mfrom: (1038.1.7 drizzle-pbxt-pre-merge)
  • Revision ID: paul.mccullagh@primebase.org-20091110141839-2j3k43b17ag6f605
Merged Drizzle trunk and PBXT 1.0.09

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
*****************************************************************************/
18
18
 
19
 
/******************************************************
 
19
/**************************************************//**
 
20
@file include/page0page.h
20
21
Index page routines
21
22
 
22
23
Created 2/2/1994 Heikki Tuuri
66
67
#define PAGE_N_RECS      16     /* number of user records on the page */
67
68
#define PAGE_MAX_TRX_ID  18     /* highest id of a trx which may have modified
68
69
                                a record on the page; a dulint; defined only
69
 
                                in secondary indexes; specifically, not in an
70
 
                                ibuf tree; NOTE: this may be modified only
 
70
                                in secondary indexes and in the insert buffer
 
71
                                tree; NOTE: this may be modified only
71
72
                                when the thread has an x-latch to the page,
72
73
                                and ALSO an x-latch to btr_search_latch
73
74
                                if there is a hash index to the page! */
156
157
#define PAGE_DIR_SLOT_MAX_N_OWNED       8
157
158
#define PAGE_DIR_SLOT_MIN_N_OWNED       4
158
159
 
159
 
/****************************************************************
160
 
Gets the start of a page. */
 
160
/************************************************************//**
 
161
Gets the start of a page.
 
162
@return start of the page */
161
163
UNIV_INLINE
162
164
page_t*
163
165
page_align(
164
166
/*=======*/
165
 
                                /* out: start of the page */
166
 
        const void*     ptr)    /* in: pointer to page frame */
167
 
                __attribute__((__const__));
168
 
/****************************************************************
169
 
Gets the offset within a page. */
 
167
        const void*     ptr)    /*!< in: pointer to page frame */
 
168
                __attribute__((const));
 
169
/************************************************************//**
 
170
Gets the offset within a page.
 
171
@return offset from the start of the page */
170
172
UNIV_INLINE
171
173
ulint
172
174
page_offset(
173
175
/*========*/
174
 
                                /* out: offset from the start of the page */
175
 
        const void*     ptr)    /* in: pointer to page frame */
176
 
                __attribute__((__const__));
177
 
/*****************************************************************
 
176
        const void*     ptr)    /*!< in: pointer to page frame */
 
177
                __attribute__((const));
 
178
/*************************************************************//**
178
179
Returns the max trx id field value. */
179
180
UNIV_INLINE
180
 
dulint
 
181
trx_id_t
181
182
page_get_max_trx_id(
182
183
/*================*/
183
 
        const page_t*   page);  /* in: page */
184
 
/*****************************************************************
 
184
        const page_t*   page);  /*!< in: page */
 
185
/*************************************************************//**
185
186
Sets the max trx id field value. */
186
187
UNIV_INTERN
187
188
void
188
189
page_set_max_trx_id(
189
190
/*================*/
190
 
        buf_block_t*    block,  /* in/out: page */
191
 
        page_zip_des_t* page_zip,/* in/out: compressed page, or NULL */
192
 
        dulint          trx_id);/* in: transaction id */
193
 
/*****************************************************************
 
191
        buf_block_t*    block,  /*!< in/out: page */
 
192
        page_zip_des_t* page_zip,/*!< in/out: compressed page, or NULL */
 
193
        trx_id_t        trx_id, /*!< in: transaction id */
 
194
        mtr_t*          mtr);   /*!< in/out: mini-transaction, or NULL */
 
195
/*************************************************************//**
194
196
Sets the max trx id field value if trx_id is bigger than the previous
195
197
value. */
196
198
UNIV_INLINE
197
199
void
198
200
page_update_max_trx_id(
199
201
/*===================*/
200
 
        buf_block_t*    block,  /* in/out: page */
201
 
        page_zip_des_t* page_zip,/* in/out: compressed page whose
 
202
        buf_block_t*    block,  /*!< in/out: page */
 
203
        page_zip_des_t* page_zip,/*!< in/out: compressed page whose
202
204
                                uncompressed part will be updated, or NULL */
203
 
        dulint          trx_id);/* in: transaction id */
204
 
/*****************************************************************
 
205
        trx_id_t        trx_id, /*!< in: transaction id */
 
206
        mtr_t*          mtr);   /*!< in/out: mini-transaction */
 
207
/*************************************************************//**
205
208
Reads the given header field. */
206
209
UNIV_INLINE
207
210
ulint
208
211
page_header_get_field(
209
212
/*==================*/
210
 
        const page_t*   page,   /* in: page */
211
 
        ulint           field); /* in: PAGE_N_DIR_SLOTS, ... */
212
 
/*****************************************************************
 
213
        const page_t*   page,   /*!< in: page */
 
214
        ulint           field); /*!< in: PAGE_N_DIR_SLOTS, ... */
 
215
/*************************************************************//**
213
216
Sets the given header field. */
214
217
UNIV_INLINE
215
218
void
216
219
page_header_set_field(
217
220
/*==================*/
218
 
        page_t*         page,   /* in/out: page */
219
 
        page_zip_des_t* page_zip,/* in/out: compressed page whose
 
221
        page_t*         page,   /*!< in/out: page */
 
222
        page_zip_des_t* page_zip,/*!< in/out: compressed page whose
220
223
                                uncompressed part will be updated, or NULL */
221
 
        ulint           field,  /* in: PAGE_N_DIR_SLOTS, ... */
222
 
        ulint           val);   /* in: value */
223
 
/*****************************************************************
224
 
Returns the offset stored in the given header field. */
 
224
        ulint           field,  /*!< in: PAGE_N_DIR_SLOTS, ... */
 
225
        ulint           val);   /*!< in: value */
 
226
/*************************************************************//**
 
227
Returns the offset stored in the given header field.
 
228
@return offset from the start of the page, or 0 */
225
229
UNIV_INLINE
226
230
ulint
227
231
page_header_get_offs(
228
232
/*=================*/
229
 
                                /* out: offset from the start of the page,
230
 
                                or 0 */
231
 
        const page_t*   page,   /* in: page */
232
 
        ulint           field)  /* in: PAGE_FREE, ... */
 
233
        const page_t*   page,   /*!< in: page */
 
234
        ulint           field)  /*!< in: PAGE_FREE, ... */
233
235
        __attribute__((nonnull, pure));
234
236
 
235
 
/*****************************************************************
 
237
/*************************************************************//**
236
238
Returns the pointer stored in the given header field, or NULL. */
237
239
#define page_header_get_ptr(page, field)                        \
238
240
        (page_header_get_offs(page, field)                      \
239
241
         ? page + page_header_get_offs(page, field) : NULL)
240
 
/*****************************************************************
 
242
/*************************************************************//**
241
243
Sets the pointer stored in the given header field. */
242
244
UNIV_INLINE
243
245
void
244
246
page_header_set_ptr(
245
247
/*================*/
246
 
        page_t*         page,   /* in/out: page */
247
 
        page_zip_des_t* page_zip,/* in/out: compressed page whose
 
248
        page_t*         page,   /*!< in/out: page */
 
249
        page_zip_des_t* page_zip,/*!< in/out: compressed page whose
248
250
                                uncompressed part will be updated, or NULL */
249
 
        ulint           field,  /* in/out: PAGE_FREE, ... */
250
 
        const byte*     ptr);   /* in: pointer or NULL*/
251
 
/*****************************************************************
 
251
        ulint           field,  /*!< in/out: PAGE_FREE, ... */
 
252
        const byte*     ptr);   /*!< in: pointer or NULL*/
 
253
#ifndef UNIV_HOTBACKUP
 
254
/*************************************************************//**
252
255
Resets the last insert info field in the page header. Writes to mlog
253
256
about this operation. */
254
257
UNIV_INLINE
255
258
void
256
259
page_header_reset_last_insert(
257
260
/*==========================*/
258
 
        page_t*         page,   /* in: page */
259
 
        page_zip_des_t* page_zip,/* in/out: compressed page whose
 
261
        page_t*         page,   /*!< in: page */
 
262
        page_zip_des_t* page_zip,/*!< in/out: compressed page whose
260
263
                                uncompressed part will be updated, or NULL */
261
 
        mtr_t*          mtr);   /* in: mtr */
262
 
/****************************************************************
263
 
Gets the offset of the first record on the page. */
 
264
        mtr_t*          mtr);   /*!< in: mtr */
 
265
#endif /* !UNIV_HOTBACKUP */
 
266
/************************************************************//**
 
267
Gets the offset of the first record on the page.
 
268
@return offset of the first record in record list, relative from page */
264
269
UNIV_INLINE
265
270
ulint
266
271
page_get_infimum_offset(
267
272
/*====================*/
268
 
                                /* out: offset of the first record
269
 
                                in record list, relative from page */
270
 
        const page_t*   page);  /* in: page which must have record(s) */
271
 
/****************************************************************
272
 
Gets the offset of the last record on the page. */
 
273
        const page_t*   page);  /*!< in: page which must have record(s) */
 
274
/************************************************************//**
 
275
Gets the offset of the last record on the page.
 
276
@return offset of the last record in record list, relative from page */
273
277
UNIV_INLINE
274
278
ulint
275
279
page_get_supremum_offset(
276
280
/*=====================*/
277
 
                                /* out: offset of the last record in
278
 
                                record list, relative from page */
279
 
        const page_t*   page);  /* in: page which must have record(s) */
 
281
        const page_t*   page);  /*!< in: page which must have record(s) */
280
282
#define page_get_infimum_rec(page) ((page) + page_get_infimum_offset(page))
281
283
#define page_get_supremum_rec(page) ((page) + page_get_supremum_offset(page))
282
 
/****************************************************************
 
284
/************************************************************//**
283
285
Returns the middle record of record list. If there are an even number
284
 
of records in the list, returns the first record of upper half-list. */
 
286
of records in the list, returns the first record of upper half-list.
 
287
@return middle record */
285
288
UNIV_INTERN
286
289
rec_t*
287
290
page_get_middle_rec(
288
291
/*================*/
289
 
                        /* out: middle record */
290
 
        page_t* page);  /* in: page */
291
 
/*****************************************************************
 
292
        page_t* page);  /*!< in: page */
 
293
#ifndef UNIV_HOTBACKUP
 
294
/*************************************************************//**
292
295
Compares a data tuple to a physical record. Differs from the function
293
296
cmp_dtuple_rec_with_match in the way that the record must reside on an
294
297
index page, and also page infimum and supremum records can be given in
295
298
the parameter rec. These are considered as the negative infinity and
296
 
the positive infinity in the alphabetical order. */
 
299
the positive infinity in the alphabetical order.
 
300
@return 1, 0, -1, if dtuple is greater, equal, less than rec,
 
301
respectively, when only the common first fields are compared */
297
302
UNIV_INLINE
298
303
int
299
304
page_cmp_dtuple_rec_with_match(
300
305
/*===========================*/
301
 
                                /* out: 1, 0, -1, if dtuple is greater, equal,
302
 
                                less than rec, respectively, when only the
303
 
                                common first fields are compared */
304
 
        const dtuple_t* dtuple, /* in: data tuple */
305
 
        const rec_t*    rec,    /* in: physical record on a page; may also
 
306
        const dtuple_t* dtuple, /*!< in: data tuple */
 
307
        const rec_t*    rec,    /*!< in: physical record on a page; may also
306
308
                                be page infimum or supremum, in which case
307
309
                                matched-parameter values below are not
308
310
                                affected */
309
 
        const ulint*    offsets,/* in: array returned by rec_get_offsets() */
310
 
        ulint*          matched_fields, /* in/out: number of already completely
 
311
        const ulint*    offsets,/*!< in: array returned by rec_get_offsets() */
 
312
        ulint*          matched_fields, /*!< in/out: number of already completely
311
313
                                matched fields; when function returns
312
314
                                contains the value for current comparison */
313
 
        ulint*          matched_bytes); /* in/out: number of already matched
 
315
        ulint*          matched_bytes); /*!< in/out: number of already matched
314
316
                                bytes within the first field not completely
315
317
                                matched; when function returns contains the
316
318
                                value for current comparison */
317
 
/*****************************************************************
318
 
Gets the page number. */
 
319
#endif /* !UNIV_HOTBACKUP */
 
320
/*************************************************************//**
 
321
Gets the page number.
 
322
@return page number */
319
323
UNIV_INLINE
320
324
ulint
321
325
page_get_page_no(
322
326
/*=============*/
323
 
                                /* out: page number */
324
 
        const page_t*   page);  /* in: page */
325
 
/*****************************************************************
326
 
Gets the tablespace identifier. */
 
327
        const page_t*   page);  /*!< in: page */
 
328
/*************************************************************//**
 
329
Gets the tablespace identifier.
 
330
@return space id */
327
331
UNIV_INLINE
328
332
ulint
329
333
page_get_space_id(
330
334
/*==============*/
331
 
                                /* out: space id */
332
 
        const page_t*   page);  /* in: page */
333
 
/*****************************************************************
 
335
        const page_t*   page);  /*!< in: page */
 
336
/*************************************************************//**
334
337
Gets the number of user records on page (the infimum and supremum records
335
 
are not user records). */
 
338
are not user records).
 
339
@return number of user records */
336
340
UNIV_INLINE
337
341
ulint
338
342
page_get_n_recs(
339
343
/*============*/
340
 
                                /* out: number of user records */
341
 
        const page_t*   page);  /* in: index page */
342
 
/*******************************************************************
 
344
        const page_t*   page);  /*!< in: index page */
 
345
/***************************************************************//**
343
346
Returns the number of records before the given record in chain.
344
 
The number includes infimum and supremum records. */
 
347
The number includes infimum and supremum records.
 
348
@return number of records */
345
349
UNIV_INTERN
346
350
ulint
347
351
page_rec_get_n_recs_before(
348
352
/*=======================*/
349
 
                                /* out: number of records */
350
 
        const rec_t*    rec);   /* in: the physical record */
351
 
/*****************************************************************
352
 
Gets the number of records in the heap. */
 
353
        const rec_t*    rec);   /*!< in: the physical record */
 
354
/*************************************************************//**
 
355
Gets the number of records in the heap.
 
356
@return number of user records */
353
357
UNIV_INLINE
354
358
ulint
355
359
page_dir_get_n_heap(
356
360
/*================*/
357
 
                                /* out: number of user records */
358
 
        const page_t*   page);  /* in: index page */
359
 
/*****************************************************************
 
361
        const page_t*   page);  /*!< in: index page */
 
362
/*************************************************************//**
360
363
Sets the number of records in the heap. */
361
364
UNIV_INLINE
362
365
void
363
366
page_dir_set_n_heap(
364
367
/*================*/
365
 
        page_t*         page,   /* in/out: index page */
366
 
        page_zip_des_t* page_zip,/* in/out: compressed page whose
 
368
        page_t*         page,   /*!< in/out: index page */
 
369
        page_zip_des_t* page_zip,/*!< in/out: compressed page whose
367
370
                                uncompressed part will be updated, or NULL.
368
371
                                Note that the size of the dense page directory
369
372
                                in the compressed page trailer is
370
373
                                n_heap * PAGE_ZIP_DIR_SLOT_SIZE. */
371
 
        ulint           n_heap);/* in: number of records */
372
 
/*****************************************************************
373
 
Gets the number of dir slots in directory. */
 
374
        ulint           n_heap);/*!< in: number of records */
 
375
/*************************************************************//**
 
376
Gets the number of dir slots in directory.
 
377
@return number of slots */
374
378
UNIV_INLINE
375
379
ulint
376
380
page_dir_get_n_slots(
377
381
/*=================*/
378
 
                                /* out: number of slots */
379
 
        const page_t*   page);  /* in: index page */
380
 
/*****************************************************************
 
382
        const page_t*   page);  /*!< in: index page */
 
383
/*************************************************************//**
381
384
Sets the number of dir slots in directory. */
382
385
UNIV_INLINE
383
386
void
384
387
page_dir_set_n_slots(
385
388
/*=================*/
386
 
        page_t*         page,   /* in/out: page */
387
 
        page_zip_des_t* page_zip,/* in/out: compressed page whose
 
389
        page_t*         page,   /*!< in/out: page */
 
390
        page_zip_des_t* page_zip,/*!< in/out: compressed page whose
388
391
                                uncompressed part will be updated, or NULL */
389
 
        ulint           n_slots);/* in: number of slots */
 
392
        ulint           n_slots);/*!< in: number of slots */
390
393
#ifdef UNIV_DEBUG
391
 
/*****************************************************************
392
 
Gets pointer to nth directory slot. */
 
394
/*************************************************************//**
 
395
Gets pointer to nth directory slot.
 
396
@return pointer to dir slot */
393
397
UNIV_INLINE
394
398
page_dir_slot_t*
395
399
page_dir_get_nth_slot(
396
400
/*==================*/
397
 
                                /* out: pointer to dir slot */
398
 
        const page_t*   page,   /* in: index page */
399
 
        ulint           n);     /* in: position */
 
401
        const page_t*   page,   /*!< in: index page */
 
402
        ulint           n);     /*!< in: position */
400
403
#else /* UNIV_DEBUG */
401
404
# define page_dir_get_nth_slot(page, n)         \
402
405
        ((page) + UNIV_PAGE_SIZE - PAGE_DIR     \
403
406
         - (n + 1) * PAGE_DIR_SLOT_SIZE)
404
407
#endif /* UNIV_DEBUG */
405
 
/******************************************************************
406
 
Used to check the consistency of a record on a page. */
 
408
/**************************************************************//**
 
409
Used to check the consistency of a record on a page.
 
410
@return TRUE if succeed */
407
411
UNIV_INLINE
408
412
ibool
409
413
page_rec_check(
410
414
/*===========*/
411
 
                                /* out: TRUE if succeed */
412
 
        const rec_t*    rec);   /* in: record */
413
 
/*******************************************************************
414
 
Gets the record pointed to by a directory slot. */
 
415
        const rec_t*    rec);   /*!< in: record */
 
416
/***************************************************************//**
 
417
Gets the record pointed to by a directory slot.
 
418
@return pointer to record */
415
419
UNIV_INLINE
416
420
const rec_t*
417
421
page_dir_slot_get_rec(
418
422
/*==================*/
419
 
                                        /* out: pointer to record */
420
 
        const page_dir_slot_t*  slot);  /* in: directory slot */
421
 
/*******************************************************************
 
423
        const page_dir_slot_t*  slot);  /*!< in: directory slot */
 
424
/***************************************************************//**
422
425
This is used to set the record offset in a directory slot. */
423
426
UNIV_INLINE
424
427
void
425
428
page_dir_slot_set_rec(
426
429
/*==================*/
427
 
        page_dir_slot_t* slot,  /* in: directory slot */
428
 
        rec_t*           rec);  /* in: record on the page */
429
 
/*******************************************************************
430
 
Gets the number of records owned by a directory slot. */
 
430
        page_dir_slot_t* slot,  /*!< in: directory slot */
 
431
        rec_t*           rec);  /*!< in: record on the page */
 
432
/***************************************************************//**
 
433
Gets the number of records owned by a directory slot.
 
434
@return number of records */
431
435
UNIV_INLINE
432
436
ulint
433
437
page_dir_slot_get_n_owned(
434
438
/*======================*/
435
 
                                        /* out: number of records */
436
 
        const page_dir_slot_t*  slot);  /* in: page directory slot */
437
 
/*******************************************************************
 
439
        const page_dir_slot_t*  slot);  /*!< in: page directory slot */
 
440
/***************************************************************//**
438
441
This is used to set the owned records field of a directory slot. */
439
442
UNIV_INLINE
440
443
void
441
444
page_dir_slot_set_n_owned(
442
445
/*======================*/
443
 
        page_dir_slot_t*slot,   /* in/out: directory slot */
444
 
        page_zip_des_t* page_zip,/* in/out: compressed page, or NULL */
445
 
        ulint           n);     /* in: number of records owned by the slot */
446
 
/****************************************************************
 
446
        page_dir_slot_t*slot,   /*!< in/out: directory slot */
 
447
        page_zip_des_t* page_zip,/*!< in/out: compressed page, or NULL */
 
448
        ulint           n);     /*!< in: number of records owned by the slot */
 
449
/************************************************************//**
447
450
Calculates the space reserved for directory slots of a given
448
451
number of records. The exact value is a fraction number
449
452
n * PAGE_DIR_SLOT_SIZE / PAGE_DIR_SLOT_MIN_N_OWNED, and it is
452
455
ulint
453
456
page_dir_calc_reserved_space(
454
457
/*=========================*/
455
 
        ulint   n_recs);        /* in: number of records */
456
 
/*******************************************************************
457
 
Looks for the directory slot which owns the given record. */
 
458
        ulint   n_recs);        /*!< in: number of records */
 
459
/***************************************************************//**
 
460
Looks for the directory slot which owns the given record.
 
461
@return the directory slot number */
458
462
UNIV_INTERN
459
463
ulint
460
464
page_dir_find_owner_slot(
461
465
/*=====================*/
462
 
                                /* out: the directory slot number */
463
 
        const rec_t*    rec);   /* in: the physical record */
464
 
/****************************************************************
465
 
Determine whether the page is in new-style compact format. */
 
466
        const rec_t*    rec);   /*!< in: the physical record */
 
467
/************************************************************//**
 
468
Determine whether the page is in new-style compact format.
 
469
@return nonzero if the page is in compact format, zero if it is in
 
470
old-style format */
466
471
UNIV_INLINE
467
472
ulint
468
473
page_is_comp(
469
474
/*=========*/
470
 
                                /* out: nonzero if the page is in compact
471
 
                                format, zero if it is in old-style format */
472
 
        const page_t*   page);  /* in: index page */
473
 
/****************************************************************
474
 
TRUE if the record is on a page in compact format. */
 
475
        const page_t*   page);  /*!< in: index page */
 
476
/************************************************************//**
 
477
TRUE if the record is on a page in compact format.
 
478
@return nonzero if in compact format */
475
479
UNIV_INLINE
476
480
ulint
477
481
page_rec_is_comp(
478
482
/*=============*/
479
 
                                /* out: nonzero if in compact format */
480
 
        const rec_t*    rec);   /* in: record */
481
 
/*******************************************************************
482
 
Returns the heap number of a record. */
 
483
        const rec_t*    rec);   /*!< in: record */
 
484
/***************************************************************//**
 
485
Returns the heap number of a record.
 
486
@return heap number */
483
487
UNIV_INLINE
484
488
ulint
485
489
page_rec_get_heap_no(
486
490
/*=================*/
487
 
                                /* out: heap number */
488
 
        const rec_t*    rec);   /* in: the physical record */
489
 
/****************************************************************
490
 
Determine whether the page is a B-tree leaf. */
 
491
        const rec_t*    rec);   /*!< in: the physical record */
 
492
/************************************************************//**
 
493
Determine whether the page is a B-tree leaf.
 
494
@return TRUE if the page is a B-tree leaf */
491
495
UNIV_INLINE
492
496
ibool
493
497
page_is_leaf(
494
498
/*=========*/
495
 
                                /* out: TRUE if the page is a B-tree leaf */
496
 
        const page_t*   page)   /* in: page */
 
499
        const page_t*   page)   /*!< in: page */
497
500
        __attribute__((nonnull, pure));
498
 
/****************************************************************
499
 
Gets the pointer to the next record on the page. */
 
501
/************************************************************//**
 
502
Gets the pointer to the next record on the page.
 
503
@return pointer to next record */
500
504
UNIV_INLINE
501
505
const rec_t*
502
506
page_rec_get_next_low(
503
507
/*==================*/
504
 
                                /* out: pointer to next record */
505
 
        const rec_t*    rec,    /* in: pointer to record */
506
 
        ulint           comp);  /* in: nonzero=compact page layout */
507
 
/****************************************************************
508
 
Gets the pointer to the next record on the page. */
 
508
        const rec_t*    rec,    /*!< in: pointer to record */
 
509
        ulint           comp);  /*!< in: nonzero=compact page layout */
 
510
/************************************************************//**
 
511
Gets the pointer to the next record on the page.
 
512
@return pointer to next record */
509
513
UNIV_INLINE
510
514
rec_t*
511
515
page_rec_get_next(
512
516
/*==============*/
513
 
                        /* out: pointer to next record */
514
 
        rec_t*  rec);   /* in: pointer to record */
515
 
/****************************************************************
516
 
Gets the pointer to the next record on the page. */
 
517
        rec_t*  rec);   /*!< in: pointer to record */
 
518
/************************************************************//**
 
519
Gets the pointer to the next record on the page.
 
520
@return pointer to next record */
517
521
UNIV_INLINE
518
522
const rec_t*
519
523
page_rec_get_next_const(
520
524
/*====================*/
521
 
                                /* out: pointer to next record */
522
 
        const rec_t*    rec);   /* in: pointer to record */
523
 
/****************************************************************
 
525
        const rec_t*    rec);   /*!< in: pointer to record */
 
526
/************************************************************//**
524
527
Sets the pointer to the next record on the page. */
525
528
UNIV_INLINE
526
529
void
527
530
page_rec_set_next(
528
531
/*==============*/
529
 
        rec_t*  rec,    /* in: pointer to record,
 
532
        rec_t*  rec,    /*!< in: pointer to record,
530
533
                        must not be page supremum */
531
 
        rec_t*  next);  /* in: pointer to next record,
 
534
        rec_t*  next);  /*!< in: pointer to next record,
532
535
                        must not be page infimum */
533
 
/****************************************************************
534
 
Gets the pointer to the previous record. */
 
536
/************************************************************//**
 
537
Gets the pointer to the previous record.
 
538
@return pointer to previous record */
535
539
UNIV_INLINE
536
540
const rec_t*
537
541
page_rec_get_prev_const(
538
542
/*====================*/
539
 
                                /* out: pointer to previous record */
540
 
        const rec_t*    rec);   /* in: pointer to record, must not be page
 
543
        const rec_t*    rec);   /*!< in: pointer to record, must not be page
541
544
                                infimum */
542
 
/****************************************************************
543
 
Gets the pointer to the previous record. */
 
545
/************************************************************//**
 
546
Gets the pointer to the previous record.
 
547
@return pointer to previous record */
544
548
UNIV_INLINE
545
549
rec_t*
546
550
page_rec_get_prev(
547
551
/*==============*/
548
 
                                /* out: pointer to previous record */
549
 
        rec_t*          rec);   /* in: pointer to record,
 
552
        rec_t*          rec);   /*!< in: pointer to record,
550
553
                                must not be page infimum */
551
 
/****************************************************************
552
 
TRUE if the record is a user record on the page. */
 
554
/************************************************************//**
 
555
TRUE if the record is a user record on the page.
 
556
@return TRUE if a user record */
553
557
UNIV_INLINE
554
558
ibool
555
559
page_rec_is_user_rec_low(
556
560
/*=====================*/
557
 
                        /* out: TRUE if a user record */
558
 
        ulint   offset) /* in: record offset on page */
559
 
        __attribute__((__const__));
560
 
/****************************************************************
561
 
TRUE if the record is the supremum record on a page. */
 
561
        ulint   offset) /*!< in: record offset on page */
 
562
        __attribute__((const));
 
563
/************************************************************//**
 
564
TRUE if the record is the supremum record on a page.
 
565
@return TRUE if the supremum record */
562
566
UNIV_INLINE
563
567
ibool
564
568
page_rec_is_supremum_low(
565
569
/*=====================*/
566
 
                        /* out: TRUE if the supremum record */
567
 
        ulint   offset) /* in: record offset on page */
568
 
        __attribute__((__const__));
569
 
/****************************************************************
570
 
TRUE if the record is the infimum record on a page. */
 
570
        ulint   offset) /*!< in: record offset on page */
 
571
        __attribute__((const));
 
572
/************************************************************//**
 
573
TRUE if the record is the infimum record on a page.
 
574
@return TRUE if the infimum record */
571
575
UNIV_INLINE
572
576
ibool
573
577
page_rec_is_infimum_low(
574
578
/*====================*/
575
 
                        /* out: TRUE if the infimum record */
576
 
        ulint   offset) /* in: record offset on page */
577
 
        __attribute__((__const__));
 
579
        ulint   offset) /*!< in: record offset on page */
 
580
        __attribute__((const));
578
581
 
579
 
/****************************************************************
580
 
TRUE if the record is a user record on the page. */
 
582
/************************************************************//**
 
583
TRUE if the record is a user record on the page.
 
584
@return TRUE if a user record */
581
585
UNIV_INLINE
582
586
ibool
583
587
page_rec_is_user_rec(
584
588
/*=================*/
585
 
                                /* out: TRUE if a user record */
586
 
        const rec_t*    rec)    /* in: record */
587
 
        __attribute__((__const__));
588
 
/****************************************************************
589
 
TRUE if the record is the supremum record on a page. */
 
589
        const rec_t*    rec)    /*!< in: record */
 
590
        __attribute__((const));
 
591
/************************************************************//**
 
592
TRUE if the record is the supremum record on a page.
 
593
@return TRUE if the supremum record */
590
594
UNIV_INLINE
591
595
ibool
592
596
page_rec_is_supremum(
593
597
/*=================*/
594
 
                                /* out: TRUE if the supremum record */
595
 
        const rec_t*    rec)    /* in: record */
596
 
        __attribute__((__const__));
 
598
        const rec_t*    rec)    /*!< in: record */
 
599
        __attribute__((const));
597
600
 
598
 
/****************************************************************
599
 
TRUE if the record is the infimum record on a page. */
 
601
/************************************************************//**
 
602
TRUE if the record is the infimum record on a page.
 
603
@return TRUE if the infimum record */
600
604
UNIV_INLINE
601
605
ibool
602
606
page_rec_is_infimum(
603
607
/*================*/
604
 
                                /* out: TRUE if the infimum record */
605
 
        const rec_t*    rec)    /* in: record */
606
 
        __attribute__((__const__));
607
 
/*******************************************************************
608
 
Looks for the record which owns the given record. */
 
608
        const rec_t*    rec)    /*!< in: record */
 
609
        __attribute__((const));
 
610
/***************************************************************//**
 
611
Looks for the record which owns the given record.
 
612
@return the owner record */
609
613
UNIV_INLINE
610
614
rec_t*
611
615
page_rec_find_owner_rec(
612
616
/*====================*/
613
 
                        /* out: the owner record */
614
 
        rec_t*  rec);   /* in: the physical record */
615
 
/***************************************************************************
 
617
        rec_t*  rec);   /*!< in: the physical record */
 
618
/***********************************************************************//**
616
619
This is a low-level operation which is used in a database index creation
617
620
to update the page number of a created B-tree to a data dictionary
618
621
record. */
620
623
void
621
624
page_rec_write_index_page_no(
622
625
/*=========================*/
623
 
        rec_t*  rec,    /* in: record to update */
624
 
        ulint   i,      /* in: index of the field to update */
625
 
        ulint   page_no,/* in: value to write */
626
 
        mtr_t*  mtr);   /* in: mtr */
627
 
/****************************************************************
 
626
        rec_t*  rec,    /*!< in: record to update */
 
627
        ulint   i,      /*!< in: index of the field to update */
 
628
        ulint   page_no,/*!< in: value to write */
 
629
        mtr_t*  mtr);   /*!< in: mtr */
 
630
/************************************************************//**
628
631
Returns the maximum combined size of records which can be inserted on top
629
 
of record heap. */
 
632
of record heap.
 
633
@return maximum combined size for inserted records */
630
634
UNIV_INLINE
631
635
ulint
632
636
page_get_max_insert_size(
633
637
/*=====================*/
634
 
                                /* out: maximum combined size for
635
 
                                inserted records */
636
 
        const page_t*   page,   /* in: index page */
637
 
        ulint           n_recs);/* in: number of records */
638
 
/****************************************************************
 
638
        const page_t*   page,   /*!< in: index page */
 
639
        ulint           n_recs);/*!< in: number of records */
 
640
/************************************************************//**
639
641
Returns the maximum combined size of records which can be inserted on top
640
 
of record heap if page is first reorganized. */
 
642
of record heap if page is first reorganized.
 
643
@return maximum combined size for inserted records */
641
644
UNIV_INLINE
642
645
ulint
643
646
page_get_max_insert_size_after_reorganize(
644
647
/*======================================*/
645
 
                                /* out: maximum combined size for
646
 
                                inserted records */
647
 
        const page_t*   page,   /* in: index page */
648
 
        ulint           n_recs);/* in: number of records */
649
 
/*****************************************************************
650
 
Calculates free space if a page is emptied. */
 
648
        const page_t*   page,   /*!< in: index page */
 
649
        ulint           n_recs);/*!< in: number of records */
 
650
/*************************************************************//**
 
651
Calculates free space if a page is emptied.
 
652
@return free space */
651
653
UNIV_INLINE
652
654
ulint
653
655
page_get_free_space_of_empty(
654
656
/*=========================*/
655
 
                        /* out: free space */
656
 
        ulint   comp)   /* in: nonzero=compact page format */
657
 
                __attribute__((__const__));
658
 
/**************************************************************
 
657
        ulint   comp)   /*!< in: nonzero=compact page format */
 
658
                __attribute__((const));
 
659
/**********************************************************//**
659
660
Returns the base extra size of a physical record.  This is the
660
 
size of the fixed header, independent of the record size. */
 
661
size of the fixed header, independent of the record size.
 
662
@return REC_N_NEW_EXTRA_BYTES or REC_N_OLD_EXTRA_BYTES */
661
663
UNIV_INLINE
662
664
ulint
663
665
page_rec_get_base_extra_size(
664
666
/*=========================*/
665
 
                                /* out: REC_N_NEW_EXTRA_BYTES
666
 
                                or REC_N_OLD_EXTRA_BYTES */
667
 
        const rec_t*    rec);   /* in: physical record */
668
 
/****************************************************************
 
667
        const rec_t*    rec);   /*!< in: physical record */
 
668
/************************************************************//**
669
669
Returns the sum of the sizes of the records in the record list
670
 
excluding the infimum and supremum records. */
 
670
excluding the infimum and supremum records.
 
671
@return data in bytes */
671
672
UNIV_INLINE
672
673
ulint
673
674
page_get_data_size(
674
675
/*===============*/
675
 
                                /* out: data in bytes */
676
 
        const page_t*   page);  /* in: index page */
677
 
/****************************************************************
 
676
        const page_t*   page);  /*!< in: index page */
 
677
/************************************************************//**
678
678
Allocates a block of memory from the head of the free list
679
679
of an index page. */
680
680
UNIV_INLINE
681
681
void
682
682
page_mem_alloc_free(
683
683
/*================*/
684
 
        page_t*         page,   /* in/out: index page */
685
 
        page_zip_des_t* page_zip,/* in/out: compressed page with enough
 
684
        page_t*         page,   /*!< in/out: index page */
 
685
        page_zip_des_t* page_zip,/*!< in/out: compressed page with enough
686
686
                                space available for inserting the record,
687
687
                                or NULL */
688
 
        rec_t*          next_rec,/* in: pointer to the new head of the
 
688
        rec_t*          next_rec,/*!< in: pointer to the new head of the
689
689
                                free record list */
690
 
        ulint           need);  /* in: number of bytes allocated */
691
 
/****************************************************************
692
 
Allocates a block of memory from the heap of an index page. */
 
690
        ulint           need);  /*!< in: number of bytes allocated */
 
691
/************************************************************//**
 
692
Allocates a block of memory from the heap of an index page.
 
693
@return pointer to start of allocated buffer, or NULL if allocation fails */
693
694
UNIV_INTERN
694
695
byte*
695
696
page_mem_alloc_heap(
696
697
/*================*/
697
 
                                /* out: pointer to start of allocated
698
 
                                buffer, or NULL if allocation fails */
699
 
        page_t*         page,   /* in/out: index page */
700
 
        page_zip_des_t* page_zip,/* in/out: compressed page with enough
 
698
        page_t*         page,   /*!< in/out: index page */
 
699
        page_zip_des_t* page_zip,/*!< in/out: compressed page with enough
701
700
                                space available for inserting the record,
702
701
                                or NULL */
703
 
        ulint           need,   /* in: total number of bytes needed */
704
 
        ulint*          heap_no);/* out: this contains the heap number
 
702
        ulint           need,   /*!< in: total number of bytes needed */
 
703
        ulint*          heap_no);/*!< out: this contains the heap number
705
704
                                of the allocated record
706
705
                                if allocation succeeds */
707
 
/****************************************************************
 
706
/************************************************************//**
708
707
Puts a record to free list. */
709
708
UNIV_INLINE
710
709
void
711
710
page_mem_free(
712
711
/*==========*/
713
 
        page_t*         page,   /* in/out: index page */
714
 
        page_zip_des_t* page_zip,/* in/out: compressed page, or NULL */
715
 
        rec_t*          rec,    /* in: pointer to the (origin of) record */
716
 
        dict_index_t*   index,  /* in: index of rec */
717
 
        const ulint*    offsets);/* in: array returned by rec_get_offsets() */
718
 
/**************************************************************
719
 
Create an uncompressed B-tree index page. */
 
712
        page_t*         page,   /*!< in/out: index page */
 
713
        page_zip_des_t* page_zip,/*!< in/out: compressed page, or NULL */
 
714
        rec_t*          rec,    /*!< in: pointer to the (origin of) record */
 
715
        dict_index_t*   index,  /*!< in: index of rec */
 
716
        const ulint*    offsets);/*!< in: array returned by rec_get_offsets() */
 
717
/**********************************************************//**
 
718
Create an uncompressed B-tree index page.
 
719
@return pointer to the page */
720
720
UNIV_INTERN
721
721
page_t*
722
722
page_create(
723
723
/*========*/
724
 
                                        /* out: pointer to the page */
725
 
        buf_block_t*    block,          /* in: a buffer block where the
 
724
        buf_block_t*    block,          /*!< in: a buffer block where the
726
725
                                        page is created */
727
 
        mtr_t*          mtr,            /* in: mini-transaction handle */
728
 
        ulint           comp);          /* in: nonzero=compact page format */
729
 
/**************************************************************
730
 
Create a compressed B-tree index page. */
 
726
        mtr_t*          mtr,            /*!< in: mini-transaction handle */
 
727
        ulint           comp);          /*!< in: nonzero=compact page format */
 
728
/**********************************************************//**
 
729
Create a compressed B-tree index page.
 
730
@return pointer to the page */
731
731
UNIV_INTERN
732
732
page_t*
733
733
page_create_zip(
734
734
/*============*/
735
 
                                        /* out: pointer to the page */
736
 
        buf_block_t*    block,          /* in/out: a buffer frame where the
 
735
        buf_block_t*    block,          /*!< in/out: a buffer frame where the
737
736
                                        page is created */
738
 
        dict_index_t*   index,          /* in: the index of the page */
739
 
        ulint           level,          /* in: the B-tree level of the page */
740
 
        mtr_t*          mtr);           /* in: mini-transaction handle */
 
737
        dict_index_t*   index,          /*!< in: the index of the page */
 
738
        ulint           level,          /*!< in: the B-tree level of the page */
 
739
        mtr_t*          mtr);           /*!< in: mini-transaction handle */
741
740
 
742
 
/*****************************************************************
 
741
/*************************************************************//**
743
742
Differs from page_copy_rec_list_end, because this function does not
744
743
touch the lock table and max trx id on page or compress the page. */
745
744
UNIV_INTERN
746
745
void
747
746
page_copy_rec_list_end_no_locks(
748
747
/*============================*/
749
 
        buf_block_t*    new_block,      /* in: index page to copy to */
750
 
        buf_block_t*    block,          /* in: index page of rec */
751
 
        rec_t*          rec,            /* in: record on page */
752
 
        dict_index_t*   index,          /* in: record descriptor */
753
 
        mtr_t*          mtr);           /* in: mtr */
754
 
/*****************************************************************
 
748
        buf_block_t*    new_block,      /*!< in: index page to copy to */
 
749
        buf_block_t*    block,          /*!< in: index page of rec */
 
750
        rec_t*          rec,            /*!< in: record on page */
 
751
        dict_index_t*   index,          /*!< in: record descriptor */
 
752
        mtr_t*          mtr);           /*!< in: mtr */
 
753
/*************************************************************//**
755
754
Copies records from page to new_page, from the given record onward,
756
755
including that record. Infimum and supremum records are not copied.
757
 
The records are copied to the start of the record list on new_page. */
 
756
The records are copied to the start of the record list on new_page.
 
757
@return pointer to the original successor of the infimum record on
 
758
new_page, or NULL on zip overflow (new_block will be decompressed) */
758
759
UNIV_INTERN
759
760
rec_t*
760
761
page_copy_rec_list_end(
761
762
/*===================*/
762
 
                                        /* out: pointer to the original
763
 
                                        successor of the infimum record
764
 
                                        on new_page, or NULL on zip overflow
765
 
                                        (new_block will be decompressed) */
766
 
        buf_block_t*    new_block,      /* in/out: index page to copy to */
767
 
        buf_block_t*    block,          /* in: index page containing rec */
768
 
        rec_t*          rec,            /* in: record on page */
769
 
        dict_index_t*   index,          /* in: record descriptor */
770
 
        mtr_t*          mtr)            /* in: mtr */
 
763
        buf_block_t*    new_block,      /*!< in/out: index page to copy to */
 
764
        buf_block_t*    block,          /*!< in: index page containing rec */
 
765
        rec_t*          rec,            /*!< in: record on page */
 
766
        dict_index_t*   index,          /*!< in: record descriptor */
 
767
        mtr_t*          mtr)            /*!< in: mtr */
771
768
        __attribute__((nonnull));
772
 
/*****************************************************************
 
769
/*************************************************************//**
773
770
Copies records from page to new_page, up to the given record, NOT
774
771
including that record. Infimum and supremum records are not copied.
775
 
The records are copied to the end of the record list on new_page. */
 
772
The records are copied to the end of the record list on new_page.
 
773
@return pointer to the original predecessor of the supremum record on
 
774
new_page, or NULL on zip overflow (new_block will be decompressed) */
776
775
UNIV_INTERN
777
776
rec_t*
778
777
page_copy_rec_list_start(
779
778
/*=====================*/
780
 
                                        /* out: pointer to the original
781
 
                                        predecessor of the supremum record
782
 
                                        on new_page, or NULL on zip overflow
783
 
                                        (new_block will be decompressed) */
784
 
        buf_block_t*    new_block,      /* in/out: index page to copy to */
785
 
        buf_block_t*    block,          /* in: index page containing rec */
786
 
        rec_t*          rec,            /* in: record on page */
787
 
        dict_index_t*   index,          /* in: record descriptor */
788
 
        mtr_t*          mtr)            /* in: mtr */
 
779
        buf_block_t*    new_block,      /*!< in/out: index page to copy to */
 
780
        buf_block_t*    block,          /*!< in: index page containing rec */
 
781
        rec_t*          rec,            /*!< in: record on page */
 
782
        dict_index_t*   index,          /*!< in: record descriptor */
 
783
        mtr_t*          mtr)            /*!< in: mtr */
789
784
        __attribute__((nonnull));
790
 
/*****************************************************************
 
785
/*************************************************************//**
791
786
Deletes records from a page from a given record onward, including that record.
792
787
The infimum and supremum records are not deleted. */
793
788
UNIV_INTERN
794
789
void
795
790
page_delete_rec_list_end(
796
791
/*=====================*/
797
 
        rec_t*          rec,    /* in: pointer to record on page */
798
 
        buf_block_t*    block,  /* in: buffer block of the page */
799
 
        dict_index_t*   index,  /* in: record descriptor */
800
 
        ulint           n_recs, /* in: number of records to delete,
 
792
        rec_t*          rec,    /*!< in: pointer to record on page */
 
793
        buf_block_t*    block,  /*!< in: buffer block of the page */
 
794
        dict_index_t*   index,  /*!< in: record descriptor */
 
795
        ulint           n_recs, /*!< in: number of records to delete,
801
796
                                or ULINT_UNDEFINED if not known */
802
 
        ulint           size,   /* in: the sum of the sizes of the
 
797
        ulint           size,   /*!< in: the sum of the sizes of the
803
798
                                records in the end of the chain to
804
799
                                delete, or ULINT_UNDEFINED if not known */
805
 
        mtr_t*          mtr)    /* in: mtr */
 
800
        mtr_t*          mtr)    /*!< in: mtr */
806
801
        __attribute__((nonnull));
807
 
/*****************************************************************
 
802
/*************************************************************//**
808
803
Deletes records from page, up to the given record, NOT including
809
804
that record. Infimum and supremum records are not deleted. */
810
805
UNIV_INTERN
811
806
void
812
807
page_delete_rec_list_start(
813
808
/*=======================*/
814
 
        rec_t*          rec,    /* in: record on page */
815
 
        buf_block_t*    block,  /* in: buffer block of the page */
816
 
        dict_index_t*   index,  /* in: record descriptor */
817
 
        mtr_t*          mtr)    /* in: mtr */
 
809
        rec_t*          rec,    /*!< in: record on page */
 
810
        buf_block_t*    block,  /*!< in: buffer block of the page */
 
811
        dict_index_t*   index,  /*!< in: record descriptor */
 
812
        mtr_t*          mtr)    /*!< in: mtr */
818
813
        __attribute__((nonnull));
819
 
/*****************************************************************
 
814
/*************************************************************//**
820
815
Moves record list end to another page. Moved records include
821
 
split_rec. */
 
816
split_rec.
 
817
@return TRUE on success; FALSE on compression failure (new_block will
 
818
be decompressed) */
822
819
UNIV_INTERN
823
820
ibool
824
821
page_move_rec_list_end(
825
822
/*===================*/
826
 
                                        /* out: TRUE on success; FALSE on
827
 
                                        compression failure
828
 
                                        (new_block will be decompressed) */
829
 
        buf_block_t*    new_block,      /* in/out: index page where to move */
830
 
        buf_block_t*    block,          /* in: index page from where to move */
831
 
        rec_t*          split_rec,      /* in: first record to move */
832
 
        dict_index_t*   index,          /* in: record descriptor */
833
 
        mtr_t*          mtr)            /* in: mtr */
 
823
        buf_block_t*    new_block,      /*!< in/out: index page where to move */
 
824
        buf_block_t*    block,          /*!< in: index page from where to move */
 
825
        rec_t*          split_rec,      /*!< in: first record to move */
 
826
        dict_index_t*   index,          /*!< in: record descriptor */
 
827
        mtr_t*          mtr)            /*!< in: mtr */
834
828
        __attribute__((nonnull(1, 2, 4, 5)));
835
 
/*****************************************************************
 
829
/*************************************************************//**
836
830
Moves record list start to another page. Moved records do not include
837
 
split_rec. */
 
831
split_rec.
 
832
@return TRUE on success; FALSE on compression failure */
838
833
UNIV_INTERN
839
834
ibool
840
835
page_move_rec_list_start(
841
836
/*=====================*/
842
 
                                        /* out: TRUE on success; FALSE on
843
 
                                        compression failure */
844
 
        buf_block_t*    new_block,      /* in/out: index page where to move */
845
 
        buf_block_t*    block,          /* in/out: page containing split_rec */
846
 
        rec_t*          split_rec,      /* in: first record not to move */
847
 
        dict_index_t*   index,          /* in: record descriptor */
848
 
        mtr_t*          mtr)            /* in: mtr */
 
837
        buf_block_t*    new_block,      /*!< in/out: index page where to move */
 
838
        buf_block_t*    block,          /*!< in/out: page containing split_rec */
 
839
        rec_t*          split_rec,      /*!< in: first record not to move */
 
840
        dict_index_t*   index,          /*!< in: record descriptor */
 
841
        mtr_t*          mtr)            /*!< in: mtr */
849
842
        __attribute__((nonnull(1, 2, 4, 5)));
850
 
/********************************************************************
 
843
/****************************************************************//**
851
844
Splits a directory slot which owns too many records. */
852
845
UNIV_INTERN
853
846
void
854
847
page_dir_split_slot(
855
848
/*================*/
856
 
        page_t*         page,   /* in: index page */
857
 
        page_zip_des_t* page_zip,/* in/out: compressed page whose
 
849
        page_t*         page,   /*!< in: index page */
 
850
        page_zip_des_t* page_zip,/*!< in/out: compressed page whose
858
851
                                uncompressed part will be written, or NULL */
859
 
        ulint           slot_no)/* in: the directory slot */
 
852
        ulint           slot_no)/*!< in: the directory slot */
860
853
        __attribute__((nonnull(1)));
861
 
/*****************************************************************
 
854
/*************************************************************//**
862
855
Tries to balance the given directory slot with too few records
863
856
with the upper neighbor, so that there are at least the minimum number
864
857
of records owned by the slot; this may result in the merging of
867
860
void
868
861
page_dir_balance_slot(
869
862
/*==================*/
870
 
        page_t*         page,   /* in/out: index page */
871
 
        page_zip_des_t* page_zip,/* in/out: compressed page, or NULL */
872
 
        ulint           slot_no)/* in: the directory slot */
 
863
        page_t*         page,   /*!< in/out: index page */
 
864
        page_zip_des_t* page_zip,/*!< in/out: compressed page, or NULL */
 
865
        ulint           slot_no)/*!< in: the directory slot */
873
866
        __attribute__((nonnull(1)));
874
 
/**************************************************************
875
 
Parses a log record of a record list end or start deletion. */
 
867
/**********************************************************//**
 
868
Parses a log record of a record list end or start deletion.
 
869
@return end of log record or NULL */
876
870
UNIV_INTERN
877
871
byte*
878
872
page_parse_delete_rec_list(
879
873
/*=======================*/
880
 
                                /* out: end of log record or NULL */
881
 
        byte            type,   /* in: MLOG_LIST_END_DELETE,
 
874
        byte            type,   /*!< in: MLOG_LIST_END_DELETE,
882
875
                                MLOG_LIST_START_DELETE,
883
876
                                MLOG_COMP_LIST_END_DELETE or
884
877
                                MLOG_COMP_LIST_START_DELETE */
885
 
        byte*           ptr,    /* in: buffer */
886
 
        byte*           end_ptr,/* in: buffer end */
887
 
        buf_block_t*    block,  /* in/out: buffer block or NULL */
888
 
        dict_index_t*   index,  /* in: record descriptor */
889
 
        mtr_t*          mtr);   /* in: mtr or NULL */
890
 
/***************************************************************
891
 
Parses a redo log record of creating a page. */
 
878
        byte*           ptr,    /*!< in: buffer */
 
879
        byte*           end_ptr,/*!< in: buffer end */
 
880
        buf_block_t*    block,  /*!< in/out: buffer block or NULL */
 
881
        dict_index_t*   index,  /*!< in: record descriptor */
 
882
        mtr_t*          mtr);   /*!< in: mtr or NULL */
 
883
/***********************************************************//**
 
884
Parses a redo log record of creating a page.
 
885
@return end of log record or NULL */
892
886
UNIV_INTERN
893
887
byte*
894
888
page_parse_create(
895
889
/*==============*/
896
 
                                /* out: end of log record or NULL */
897
 
        byte*           ptr,    /* in: buffer */
898
 
        byte*           end_ptr,/* in: buffer end */
899
 
        ulint           comp,   /* in: nonzero=compact page format */
900
 
        buf_block_t*    block,  /* in: block or NULL */
901
 
        mtr_t*          mtr);   /* in: mtr or NULL */
902
 
/****************************************************************
 
890
        byte*           ptr,    /*!< in: buffer */
 
891
        byte*           end_ptr,/*!< in: buffer end */
 
892
        ulint           comp,   /*!< in: nonzero=compact page format */
 
893
        buf_block_t*    block,  /*!< in: block or NULL */
 
894
        mtr_t*          mtr);   /*!< in: mtr or NULL */
 
895
/************************************************************//**
903
896
Prints record contents including the data relevant only in
904
897
the index page context. */
905
898
UNIV_INTERN
906
899
void
907
900
page_rec_print(
908
901
/*===========*/
909
 
        const rec_t*    rec,    /* in: physical record */
910
 
        const ulint*    offsets);/* in: record descriptor */
911
 
/*******************************************************************
 
902
        const rec_t*    rec,    /*!< in: physical record */
 
903
        const ulint*    offsets);/*!< in: record descriptor */
 
904
/***************************************************************//**
912
905
This is used to print the contents of the directory for
913
906
debugging purposes. */
914
907
UNIV_INTERN
915
908
void
916
909
page_dir_print(
917
910
/*===========*/
918
 
        page_t* page,   /* in: index page */
919
 
        ulint   pr_n);  /* in: print n first and n last entries */
920
 
/*******************************************************************
 
911
        page_t* page,   /*!< in: index page */
 
912
        ulint   pr_n);  /*!< in: print n first and n last entries */
 
913
/***************************************************************//**
921
914
This is used to print the contents of the page record list for
922
915
debugging purposes. */
923
916
UNIV_INTERN
924
917
void
925
918
page_print_list(
926
919
/*============*/
927
 
        buf_block_t*    block,  /* in: index page */
928
 
        dict_index_t*   index,  /* in: dictionary index of the page */
929
 
        ulint           pr_n);  /* in: print n first and n last entries */
930
 
/*******************************************************************
 
920
        buf_block_t*    block,  /*!< in: index page */
 
921
        dict_index_t*   index,  /*!< in: dictionary index of the page */
 
922
        ulint           pr_n);  /*!< in: print n first and n last entries */
 
923
/***************************************************************//**
931
924
Prints the info in a page header. */
932
925
UNIV_INTERN
933
926
void
934
927
page_header_print(
935
928
/*==============*/
936
 
        const page_t*   page);
937
 
/*******************************************************************
 
929
        const page_t*   page);  /*!< in: index page */
 
930
/***************************************************************//**
938
931
This is used to print the contents of the page for
939
932
debugging purposes. */
940
933
UNIV_INTERN
941
934
void
942
935
page_print(
943
936
/*=======*/
944
 
        buf_block_t*    block,  /* in: index page */
945
 
        dict_index_t*   index,  /* in: dictionary index of the page */
946
 
        ulint           dn,     /* in: print dn first and last entries
947
 
                                in directory */
948
 
        ulint           rn);    /* in: print rn first and last records
949
 
                                in directory */
950
 
/*******************************************************************
 
937
        buf_block_t*    block,  /*!< in: index page */
 
938
        dict_index_t*   index,  /*!< in: dictionary index of the page */
 
939
        ulint           dn,     /*!< in: print dn first and last entries
 
940
                                in directory */
 
941
        ulint           rn);    /*!< in: print rn first and last records
 
942
                                in directory */
 
943
/***************************************************************//**
951
944
The following is used to validate a record on a page. This function
952
945
differs from rec_validate as it can also check the n_owned field and
953
 
the heap_no field. */
 
946
the heap_no field.
 
947
@return TRUE if ok */
954
948
UNIV_INTERN
955
949
ibool
956
950
page_rec_validate(
957
951
/*==============*/
958
 
                                /* out: TRUE if ok */
959
 
        rec_t*          rec,    /* in: physical record */
960
 
        const ulint*    offsets);/* in: array returned by rec_get_offsets() */
961
 
/*******************************************************************
 
952
        rec_t*          rec,    /*!< in: physical record */
 
953
        const ulint*    offsets);/*!< in: array returned by rec_get_offsets() */
 
954
/***************************************************************//**
962
955
Checks that the first directory slot points to the infimum record and
963
956
the last to the supremum. This function is intended to track if the
964
957
bug fixed in 4.0.14 has caused corruption to users' databases. */
966
959
void
967
960
page_check_dir(
968
961
/*===========*/
969
 
        const page_t*   page);  /* in: index page */
970
 
/*******************************************************************
 
962
        const page_t*   page);  /*!< in: index page */
 
963
/***************************************************************//**
971
964
This function checks the consistency of an index page when we do not
972
965
know the index. This is also resilient so that this should never crash
973
 
even if the page is total garbage. */
 
966
even if the page is total garbage.
 
967
@return TRUE if ok */
974
968
UNIV_INTERN
975
969
ibool
976
970
page_simple_validate_old(
977
971
/*=====================*/
978
 
                        /* out: TRUE if ok */
979
 
        page_t* page);  /* in: old-style index page */
980
 
/*******************************************************************
 
972
        page_t* page);  /*!< in: old-style index page */
 
973
/***************************************************************//**
981
974
This function checks the consistency of an index page when we do not
982
975
know the index. This is also resilient so that this should never crash
983
 
even if the page is total garbage. */
 
976
even if the page is total garbage.
 
977
@return TRUE if ok */
984
978
UNIV_INTERN
985
979
ibool
986
980
page_simple_validate_new(
987
981
/*=====================*/
988
 
                        /* out: TRUE if ok */
989
 
        page_t* block); /* in: new-style index page */
990
 
/*******************************************************************
991
 
This function checks the consistency of an index page. */
 
982
        page_t* block); /*!< in: new-style index page */
 
983
/***************************************************************//**
 
984
This function checks the consistency of an index page.
 
985
@return TRUE if ok */
992
986
UNIV_INTERN
993
987
ibool
994
988
page_validate(
995
989
/*==========*/
996
 
                                /* out: TRUE if ok */
997
 
        page_t*         page,   /* in: index page */
998
 
        dict_index_t*   index); /* in: data dictionary index containing
 
990
        page_t*         page,   /*!< in: index page */
 
991
        dict_index_t*   index); /*!< in: data dictionary index containing
999
992
                                the page record type definition */
1000
 
/*******************************************************************
1001
 
Looks in the page record list for a record with the given heap number. */
 
993
/***************************************************************//**
 
994
Looks in the page record list for a record with the given heap number.
 
995
@return record, NULL if not found */
1002
996
 
1003
997
const rec_t*
1004
998
page_find_rec_with_heap_no(
1005
999
/*=======================*/
1006
 
                                /* out: record, NULL if not found */
1007
 
        const page_t*   page,   /* in: index page */
1008
 
        ulint           heap_no);/* in: heap number */
 
1000
        const page_t*   page,   /*!< in: index page */
 
1001
        ulint           heap_no);/*!< in: heap number */
1009
1002
 
1010
1003
#ifdef UNIV_MATERIALIZE
1011
1004
#undef UNIV_INLINE