~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Monty Taylor
  • Date: 2009-04-14 19:16:51 UTC
  • mto: (997.2.5 mordred)
  • mto: This revision was merged to the branch mainline in revision 994.
  • Revision ID: mordred@inaugust.com-20090414191651-ltbww6hpqks8k7qk
Clarified instructions in README.

Show diffs side-by-side

added added

removed removed

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