MySQL  8.0.19
Source Code Documentation
page0page.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (c) 1994, 2019, Oracle and/or its affiliates. All Rights Reserved.
4 
5 This program is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License, version 2.0, as published by the
7 Free Software Foundation.
8 
9 This program is also distributed with certain software (including but not
10 limited to OpenSSL) that is licensed under separate terms, as designated in a
11 particular file or component or in included license documentation. The authors
12 of MySQL hereby grant you an additional permission to link the program and
13 your derivative works with the separately licensed software that they have
14 included with MySQL.
15 
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
19 for more details.
20 
21 You should have received a copy of the GNU General Public License along with
22 this program; if not, write to the Free Software Foundation, Inc.,
23 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 
25 *****************************************************************************/
26 
27 #include <stddef.h>
28 #include <sys/types.h>
29 
30 /** @file include/page0page.h
31  Index page routines
32 
33  Created 2/2/1994 Heikki Tuuri
34  *******************************************************/
35 
36 #ifndef page0page_h
37 #define page0page_h
38 
39 #include "univ.i"
40 
41 #include "buf0buf.h"
42 #include "data0data.h"
43 #include "dict0dict.h"
44 #include "fil0fil.h"
45 #include "fsp0fsp.h"
46 #include "mtr0mtr.h"
47 #include "page0types.h"
48 #include "rem0rec.h"
49 
50 #ifdef UNIV_MATERIALIZE
51 #undef UNIV_INLINE
52 #define UNIV_INLINE
53 #endif
54 
55 /* PAGE DIRECTORY
56  ==============
57 */
58 
59 typedef byte page_dir_slot_t;
61 
62 /* Offset of the directory start down from the page end. We call the
63 slot with the highest file address directory start, as it points to
64 the first record in the list of records. */
65 #define PAGE_DIR FIL_PAGE_DATA_END
66 
67 /* We define a slot in the page directory as two bytes */
68 #define PAGE_DIR_SLOT_SIZE 2
69 
70 /* The offset of the physically lower end of the directory, counted from
71 page end, when the page is empty */
72 #define PAGE_EMPTY_DIR_START (PAGE_DIR + 2 * PAGE_DIR_SLOT_SIZE)
73 
74 /* The maximum and minimum number of records owned by a directory slot. The
75 number may drop below the minimum in the first and the last slot in the
76 directory. */
77 #define PAGE_DIR_SLOT_MAX_N_OWNED 8
78 #define PAGE_DIR_SLOT_MIN_N_OWNED 4
79 
80 /* The infimum and supremum records are omitted from the compressed page.
81 On compress, we compare that the records are there, and on uncompress we
82 restore the records. */
83 /** Extra bytes of an infimum record */
84 static const byte infimum_extra[] = {
85  0x01, /* info_bits=0, n_owned=1 */
86  0x00, 0x02 /* heap_no=0, status=2 */
87  /* ?, ? */ /* next=(first user rec, or supremum) */
88 };
89 /** Data bytes of an infimum record */
90 static const byte infimum_data[] = {
91  0x69, 0x6e, 0x66, 0x69, 0x6d, 0x75, 0x6d, 0x00 /* "infimum\0" */
92 };
93 /** Extra bytes and data bytes of a supremum record */
94 static const byte supremum_extra_data[] = {
95  /* 0x0?, */ /* info_bits=0, n_owned=1..8 */
96  0x00,
97  0x0b, /* heap_no=1, status=3 */
98  0x00,
99  0x00, /* next=0 */
100  0x73,
101  0x75,
102  0x70,
103  0x72,
104  0x65,
105  0x6d,
106  0x75,
107  0x6d /* "supremum" */
108 };
109 
110 /** Gets the start of a page.
111  @return start of the page */
112 UNIV_INLINE
113 page_t *page_align(const void *ptr) /*!< in: pointer to page frame */
114  MY_ATTRIBUTE((const));
115 /** Gets the offset within a page.
116  @return offset from the start of the page */
117 UNIV_INLINE
118 ulint page_offset(const void *ptr) /*!< in: pointer to page frame */
119  MY_ATTRIBUTE((const));
120 /** Returns the max trx id field value. */
121 UNIV_INLINE
122 trx_id_t page_get_max_trx_id(const page_t *page); /*!< in: page */
123 /** Sets the max trx id field value. */
125  buf_block_t *block, /*!< in/out: page */
126  page_zip_des_t *page_zip, /*!< in/out: compressed page, or NULL */
127  trx_id_t trx_id, /*!< in: transaction id */
128  mtr_t *mtr); /*!< in/out: mini-transaction, or NULL */
129 
130 /** Sets the max trx id field value if trx_id is bigger than the previous
131 value.
132 @param[in,out] block page
133 @param[in,out] page_zip compressed page whose uncompressed part will
134  be updated, or NULL
135 @param[in] trx_id transaction id
136 @param[in,out] mtr mini-transaction */
137 UNIV_INLINE
138 void page_update_max_trx_id(buf_block_t *block, page_zip_des_t *page_zip,
139  trx_id_t trx_id, mtr_t *mtr);
140 
141 /** Returns the RTREE SPLIT SEQUENCE NUMBER (FIL_RTREE_SPLIT_SEQ_NUM).
142 @param[in] page page
143 @return SPLIT SEQUENCE NUMBER */
144 UNIV_INLINE
146 
147 /** Sets the RTREE SPLIT SEQUENCE NUMBER field value
148 @param[in,out] block page
149 @param[in,out] page_zip compressed page whose uncompressed part will
150  be updated, or NULL
151 @param[in] ssn_id split sequence id
152 @param[in,out] mtr mini-transaction */
153 UNIV_INLINE
154 void page_set_ssn_id(buf_block_t *block, page_zip_des_t *page_zip,
155  node_seq_t ssn_id, mtr_t *mtr);
156 
157 /** Reads the given header field.
158 @param[in] page page
159 @param[in] field PAGE_N_DIR_SLOTS, ... */
160 UNIV_INLINE
161 ulint page_header_get_field(const page_t *page, ulint field);
162 
163 /** Sets the given header field.
164 @param[in,out] page page
165 @param[in,out] page_zip compressed page whose uncompressed part will
166  be updated, or NULL
167 @param[in] field PAGE_N_DIR_SLOTS, ...
168 @param[in] val value */
169 UNIV_INLINE
170 void page_header_set_field(page_t *page, page_zip_des_t *page_zip, ulint field,
171  ulint val);
172 
173 /** Returns the offset stored in the given header field.
174  @return offset from the start of the page, or 0 */
175 UNIV_INLINE
176 ulint page_header_get_offs(const page_t *page, /*!< in: page */
177  ulint field) /*!< in: PAGE_FREE, ... */
178  MY_ATTRIBUTE((warn_unused_result));
179 
180 /** Returns the pointer stored in the given header field, or NULL. */
181 #define page_header_get_ptr(page, field) \
182  (page_header_get_offs(page, field) \
183  ? page + page_header_get_offs(page, field) \
184  : NULL)
185 
186 /** Sets the pointer stored in the given header field.
187 @param[in,out] page page
188 @param[in,out] page_zip compressed page whose uncompressed part will
189  be updated, or NULL
190 @param[in,out] field PAGE_FREE, ...
191 @param[in] ptr pointer or NULL */
192 UNIV_INLINE
193 void page_header_set_ptr(page_t *page, page_zip_des_t *page_zip, ulint field,
194  const byte *ptr);
195 #ifndef UNIV_HOTBACKUP
196 
197 /** Resets the last insert info field in the page header. Writes to mlog about
198 this operation.
199 @param[in] page page
200 @param[in,out] page_zip compressed page whose uncompressed part will
201  be updated, or NULL
202 @param[in] mtr mtr */
203 UNIV_INLINE
205  mtr_t *mtr);
206 #endif /* !UNIV_HOTBACKUP */
207 
208 /** Gets the offset of the first record on the page.
209  @return offset of the first record in record list, relative from page */
210 UNIV_INLINE
212  const page_t *page); /*!< in: page which must have record(s) */
213 /** Gets the offset of the last record on the page.
214  @return offset of the last record in record list, relative from page */
215 UNIV_INLINE
217  const page_t *page); /*!< in: page which must have record(s) */
218 #define page_get_infimum_rec(page) ((page) + page_get_infimum_offset(page))
219 #define page_get_supremum_rec(page) ((page) + page_get_supremum_offset(page))
220 
221 /** Returns the nth record of the record list.
222  This is the inverse function of page_rec_get_n_recs_before().
223  @return nth record */
224 const rec_t *page_rec_get_nth_const(const page_t *page, /*!< in: page */
225  ulint nth) /*!< in: nth record */
226  MY_ATTRIBUTE((warn_unused_result));
227 
228 /** Returns the nth record of the record list.
229 This is the inverse function of page_rec_get_n_recs_before().
230 @param[in] page page
231 @param[in] nth nth record
232 @return nth record */
233 UNIV_INLINE
234 rec_t *page_rec_get_nth(page_t *page, ulint nth)
235  MY_ATTRIBUTE((warn_unused_result));
236 
237 #ifndef UNIV_HOTBACKUP
238 /** Returns the middle record of the records on the page. If there is an
239  even number of records in the list, returns the first record of the
240  upper half-list.
241  @return middle record */
242 UNIV_INLINE
243 rec_t *page_get_middle_rec(page_t *page) /*!< in: page */
244  MY_ATTRIBUTE((warn_unused_result));
245 #endif /* !UNIV_HOTBACKUP */
246 /** Gets the page number.
247  @return page number */
248 UNIV_INLINE
249 page_no_t page_get_page_no(const page_t *page); /*!< in: page */
250 /** Gets the tablespace identifier.
251  @return space id */
252 UNIV_INLINE
253 space_id_t page_get_space_id(const page_t *page); /*!< in: page */
254 /** Gets the number of user records on page (the infimum and supremum records
255  are not user records).
256  @return number of user records */
257 UNIV_INLINE
258 ulint page_get_n_recs(const page_t *page); /*!< in: index page */
259 /** Returns the number of records before the given record in chain.
260  The number includes infimum and supremum records.
261  This is the inverse function of page_rec_get_nth().
262  @return number of records */
264  const rec_t *rec); /*!< in: the physical record */
265 /** Gets the number of records in the heap.
266  @return number of user records */
267 UNIV_INLINE
268 ulint page_dir_get_n_heap(const page_t *page); /*!< in: index page */
269 
270 /** Sets the number of records in the heap.
271 @param[in,out] page index page
272 @param[in,out] page_zip compressed page whose uncompressed part will
273  be updated, or NULL. Note that the size of the
274  dense page directory in the compressed page
275  trailer is n_heap * PAGE_ZIP_DIR_SLOT_SIZE.
276 @param[in] n_heap number of records*/
277 UNIV_INLINE
278 void page_dir_set_n_heap(page_t *page, page_zip_des_t *page_zip, ulint n_heap);
279 
280 /** Gets the number of dir slots in directory.
281  @return number of slots */
282 UNIV_INLINE
283 ulint page_dir_get_n_slots(const page_t *page); /*!< in: index page */
284 
285 /** Sets the number of dir slots in directory.
286 @param[in,out] page page
287 @param[in,out] page_zip compressed page whose uncompressed part will
288  be updated, or NULL
289 @param[in] n_slots number of slots */
290 UNIV_INLINE
292  ulint n_slots);
293 
294 #ifdef UNIV_DEBUG
295 /** Gets pointer to nth directory slot.
296 @param[in] page index page
297 @param[in] n position
298 @return pointer to dir slot */
299 UNIV_INLINE
301 #else /* UNIV_DEBUG */
302 #define page_dir_get_nth_slot(page, n) \
303  ((page) + (UNIV_PAGE_SIZE - PAGE_DIR - (n + 1) * PAGE_DIR_SLOT_SIZE))
304 #endif /* UNIV_DEBUG */
305 
306 /** Used to check the consistency of a record on a page.
307  @return true if succeed */
308 UNIV_INLINE
309 ibool page_rec_check(const rec_t *rec); /*!< in: record */
310 /** Gets the record pointed to by a directory slot.
311  @return pointer to record */
312 UNIV_INLINE
314  const page_dir_slot_t *slot); /*!< in: directory slot */
315 
316 /** This is used to set the record offset in a directory slot.
317 @param[in] rec record on the page
318 @param[in] slot directory slot */
319 UNIV_INLINE
321 
322 /** Gets the number of records owned by a directory slot.
323  @return number of records */
324 UNIV_INLINE
326  const page_dir_slot_t *slot); /*!< in: page directory slot */
327 
328 /** This is used to set the owned records field of a directory slot.
329 @param[in,out] slot directory slot
330 @param[in,out] page_zip compressed page, or NULL
331 @param[in] n number of records owned by the slot */
332 UNIV_INLINE
334  ulint n);
335 
336 /** Calculates the space reserved for directory slots of a given
337  number of records. The exact value is a fraction number
338  n * PAGE_DIR_SLOT_SIZE / PAGE_DIR_SLOT_MIN_N_OWNED, and it is
339  rounded upwards to an integer. */
340 UNIV_INLINE
341 ulint page_dir_calc_reserved_space(ulint n_recs); /*!< in: number of records */
342 /** Looks for the directory slot which owns the given record.
343  @return the directory slot number */
345  const rec_t *rec); /*!< in: the physical record */
346 /** Determine whether the page is in new-style compact format.
347  @return nonzero if the page is in compact format, zero if it is in
348  old-style format */
349 UNIV_INLINE
350 ulint page_is_comp(const page_t *page); /*!< in: index page */
351 /** TRUE if the record is on a page in compact format.
352  @return nonzero if in compact format */
353 UNIV_INLINE
354 ulint page_rec_is_comp(const rec_t *rec); /*!< in: record */
355 /** Returns the heap number of a record.
356  @return heap number */
357 UNIV_INLINE
358 ulint page_rec_get_heap_no(const rec_t *rec); /*!< in: the physical record */
359 /** Determine whether the page is a B-tree leaf.
360  @return true if the page is a B-tree leaf (PAGE_LEVEL = 0) */
361 UNIV_INLINE
362 bool page_is_leaf(const page_t *page) /*!< in: page */
363  MY_ATTRIBUTE((warn_unused_result));
364 /** Determine whether the page is empty.
365  @return true if the page is empty (PAGE_N_RECS = 0) */
366 UNIV_INLINE
367 bool page_is_empty(const page_t *page) /*!< in: page */
368  MY_ATTRIBUTE((warn_unused_result));
369 /** Determine whether a page is an index root page.
370 @param[in] page page frame
371 @return true if the page is a root page of an index */
372 UNIV_INLINE
373 bool page_is_root(const page_t *page) MY_ATTRIBUTE((warn_unused_result));
374 /** Determine whether the page contains garbage.
375  @return true if the page contains garbage (PAGE_GARBAGE is not 0) */
376 UNIV_INLINE
377 bool page_has_garbage(const page_t *page) /*!< in: page */
378  MY_ATTRIBUTE((warn_unused_result));
379 
380 /** Gets the pointer to the next record on the page.
381 @param[in] rec pointer to record
382 @param[in] comp nonzero=compact page layout
383 @return pointer to next record */
384 UNIV_INLINE
385 const rec_t *page_rec_get_next_low(const rec_t *rec, ulint comp);
386 
387 /** Gets the pointer to the next record on the page.
388  @return pointer to next record */
389 UNIV_INLINE
390 rec_t *page_rec_get_next(rec_t *rec); /*!< in: pointer to record */
391 /** Gets the pointer to the next record on the page.
392  @return pointer to next record */
393 UNIV_INLINE
395  const rec_t *rec); /*!< in: pointer to record */
396 /** Gets the pointer to the next non delete-marked record on the page.
397  If all subsequent records are delete-marked, then this function
398  will return the supremum record.
399  @return pointer to next non delete-marked record or pointer to supremum */
400 UNIV_INLINE
402  const rec_t *rec); /*!< in: pointer to record */
403 
404 /** Sets the pointer to the next record on the page.
405 @param[in] rec pointer to record, must not be page supremum
406 @param[in] next pointer to next record, must not be page infimum */
407 UNIV_INLINE
408 void page_rec_set_next(rec_t *rec, const rec_t *next);
409 
410 /** Gets the pointer to the previous record.
411  @return pointer to previous record */
412 UNIV_INLINE
414  const rec_t *rec); /*!< in: pointer to record, must not be page
415  infimum */
416 /** Gets the pointer to the previous record.
417  @return pointer to previous record */
418 UNIV_INLINE
419 rec_t *page_rec_get_prev(rec_t *rec); /*!< in: pointer to record,
420  must not be page infimum */
421 /** TRUE if the record is a user record on the page.
422  @return true if a user record */
423 UNIV_INLINE
424 ibool page_rec_is_user_rec_low(ulint offset) /*!< in: record offset on page */
425  MY_ATTRIBUTE((const));
426 /** TRUE if the record is the supremum record on a page.
427  @return true if the supremum record */
428 UNIV_INLINE
429 ibool page_rec_is_supremum_low(ulint offset) /*!< in: record offset on page */
430  MY_ATTRIBUTE((const));
431 /** TRUE if the record is the infimum record on a page.
432  @return true if the infimum record */
433 UNIV_INLINE
434 ibool page_rec_is_infimum_low(ulint offset) /*!< in: record offset on page */
435  MY_ATTRIBUTE((const));
436 
437 /** TRUE if the record is a user record on the page.
438  @return true if a user record */
439 UNIV_INLINE
440 ibool page_rec_is_user_rec(const rec_t *rec) /*!< in: record */
441  MY_ATTRIBUTE((warn_unused_result));
442 /** TRUE if the record is the supremum record on a page.
443  @return true if the supremum record */
444 UNIV_INLINE
445 ibool page_rec_is_supremum(const rec_t *rec) /*!< in: record */
446  MY_ATTRIBUTE((warn_unused_result));
447 
448 /** TRUE if the record is the infimum record on a page.
449  @return true if the infimum record */
450 UNIV_INLINE
451 ibool page_rec_is_infimum(const rec_t *rec) /*!< in: record */
452  MY_ATTRIBUTE((warn_unused_result));
453 
454 /** true if the record is the first user record on a page.
455  @return true if the first user record */
456 UNIV_INLINE
457 bool page_rec_is_first(const rec_t *rec, /*!< in: record */
458  const page_t *page) /*!< in: page */
459  MY_ATTRIBUTE((warn_unused_result));
460 
461 /** true if the record is the second user record on a page.
462  @return true if the second user record */
463 UNIV_INLINE
464 bool page_rec_is_second(const rec_t *rec, /*!< in: record */
465  const page_t *page) /*!< in: page */
466  MY_ATTRIBUTE((warn_unused_result));
467 
468 /** true if the record is the last user record on a page.
469  @return true if the last user record */
470 UNIV_INLINE
471 bool page_rec_is_last(const rec_t *rec, /*!< in: record */
472  const page_t *page) /*!< in: page */
473  MY_ATTRIBUTE((warn_unused_result));
474 
475 /** true if distance between the records (measured in number of times we have to
476 move to the next record) is at most the specified value
477 @param[in] left_rec lefter record
478 @param[in] right_rec righter record
479 @param[in] val specified value to compare
480 @return true if the distance is smaller than the value */
481 UNIV_INLINE
482 bool page_rec_distance_is_at_most(const rec_t *left_rec, const rec_t *right_rec,
483  ulint val) MY_ATTRIBUTE((warn_unused_result));
484 
485 /** true if the record is the second last user record on a page.
486  @return true if the second last user record */
487 UNIV_INLINE
488 bool page_rec_is_second_last(const rec_t *rec, /*!< in: record */
489  const page_t *page) /*!< in: page */
490  MY_ATTRIBUTE((warn_unused_result));
491 
492 /** Looks for the record which owns the given record.
493  @return the owner record */
494 UNIV_INLINE
495 rec_t *page_rec_find_owner_rec(rec_t *rec); /*!< in: the physical record */
496 #ifndef UNIV_HOTBACKUP
497 
498 /** Write a 32-bit field in a data dictionary record.
499 @param[in,out] rec record to update
500 @param[in] i index of the field to update
501 @param[in] val value to write
502 @param[in,out] mtr mini-transaction */
503 UNIV_INLINE
504 void page_rec_write_field(rec_t *rec, ulint i, ulint val, mtr_t *mtr);
505 #endif /* !UNIV_HOTBACKUP */
506 
507 /** Returns the maximum combined size of records which can be inserted on top
508 of record heap.
509 @param[in] page index page
510 @param[in] n_recs number of records
511 @return maximum combined size for inserted records */
512 UNIV_INLINE
513 ulint page_get_max_insert_size(const page_t *page, ulint n_recs);
514 
515 /** Returns the maximum combined size of records which can be inserted on top
516 of record heap if page is first reorganized.
517 @param[in] page index page
518 @param[in] n_recs number of records
519 @return maximum combined size for inserted records */
520 UNIV_INLINE
522  ulint n_recs);
523 
524 /** Calculates free space if a page is emptied.
525  @return free space */
526 UNIV_INLINE
528  ulint comp) /*!< in: nonzero=compact page format */
529  MY_ATTRIBUTE((const));
530 /** Returns the base extra size of a physical record. This is the
531  size of the fixed header, independent of the record size.
532  @return REC_N_NEW_EXTRA_BYTES or REC_N_OLD_EXTRA_BYTES */
533 UNIV_INLINE
535  const rec_t *rec); /*!< in: physical record */
536 /** Returns the sum of the sizes of the records in the record list
537  excluding the infimum and supremum records.
538  @return data in bytes */
539 UNIV_INLINE
540 ulint page_get_data_size(const page_t *page); /*!< in: index page */
541 
542 /** Allocates a block of memory from the head of the free list of an index
543 page.
544 @param[in,out] page index page
545 @param[in,out] page_zip compressed page with enough space available
546  for inserting the record, or NULL
547 @param[in] next_rec pointer to the new head of the free record
548  list
549 @param[in] need number of bytes allocated */
550 UNIV_INLINE
552  rec_t *next_rec, ulint need);
553 
554 /** Allocates a block of memory from the heap of an index page.
555  @return pointer to start of allocated buffer, or NULL if allocation fails */
556 byte *page_mem_alloc_heap(
557  page_t *page, /*!< in/out: index page */
558  page_zip_des_t *page_zip, /*!< in/out: compressed page with enough
559  space available for inserting the record,
560  or NULL */
561  ulint need, /*!< in: total number of bytes needed */
562  ulint *heap_no); /*!< out: this contains the heap number
563  of the allocated record
564  if allocation succeeds */
565 
566 /** Puts a record to free list.
567 @param[in,out] page index page
568 @param[in,out] page_zip compressed page, or NULL
569 @param[in] rec pointer to the (origin of) record
570 @param[in] index index of rec
571 @param[in] offsets array returned by rec_get_offsets() */
572 UNIV_INLINE
573 void page_mem_free(page_t *page, page_zip_des_t *page_zip, rec_t *rec,
574  const dict_index_t *index, const ulint *offsets);
575 
576 /** Create an uncompressed B-tree or R-tree or SDI index page.
577 @param[in] block a buffer block where the page is created
578 @param[in] mtr mini-transaction handle
579 @param[in] comp nonzero=compact page format
580 @param[in] page_type page type
581 @return pointer to the page */
582 page_t *page_create(buf_block_t *block, mtr_t *mtr, ulint comp,
583  page_type_t page_type);
584 
585 /** Create a compressed B-tree index page.
586 @param[in,out] block buffer frame where the page is created
587 @param[in] index index of the page, or NULL when applying
588  TRUNCATE log record during recovery
589 @param[in] level the B-tree level of the page
590 @param[in] max_trx_id PAGE_MAX_TRX_ID
591 @param[in] mtr mini-transaction handle
592 @param[in] page_type page_type to be created. Only FIL_PAGE_INDEX,
593  FIL_PAGE_RTREE, FIL_PAGE_SDI allowed */
594 page_t *page_create_zip(buf_block_t *block, dict_index_t *index, ulint level,
595  trx_id_t max_trx_id, mtr_t *mtr, page_type_t page_type);
596 
597 /** Empty a previously created B-tree index page. */
598 void page_create_empty(buf_block_t *block, /*!< in/out: B-tree block */
599  dict_index_t *index, /*!< in: the index of the page */
600  mtr_t *mtr); /*!< in/out: mini-transaction */
601 /** Differs from page_copy_rec_list_end, because this function does not
602  touch the lock table and max trx id on page or compress the page.
603 
604  IMPORTANT: The caller will have to update IBUF_BITMAP_FREE
605  if new_block is a compressed leaf page in a secondary index.
606  This has to be done either within the same mini-transaction,
607  or by invoking ibuf_reset_free_bits() before mtr_commit(). */
609  buf_block_t *new_block, /*!< in: index page to copy to */
610  buf_block_t *block, /*!< in: index page of rec */
611  rec_t *rec, /*!< in: record on page */
612  dict_index_t *index, /*!< in: record descriptor */
613  mtr_t *mtr); /*!< in: mtr */
614 /** Copies records from page to new_page, from the given record onward,
615  including that record. Infimum and supremum records are not copied.
616  The records are copied to the start of the record list on new_page.
617 
618  IMPORTANT: The caller will have to update IBUF_BITMAP_FREE
619  if new_block is a compressed leaf page in a secondary index.
620  This has to be done either within the same mini-transaction,
621  or by invoking ibuf_reset_free_bits() before mtr_commit().
622 
623  @return pointer to the original successor of the infimum record on
624  new_page, or NULL on zip overflow (new_block will be decompressed) */
626  buf_block_t *new_block, /*!< in/out: index page to copy to */
627  buf_block_t *block, /*!< in: index page containing rec */
628  rec_t *rec, /*!< in: record on page */
629  dict_index_t *index, /*!< in: record descriptor */
630  mtr_t *mtr); /*!< in: mtr */
631 /** Copies records from page to new_page, up to the given record, NOT
632  including that record. Infimum and supremum records are not copied.
633  The records are copied to the end of the record list on new_page.
634 
635  IMPORTANT: The caller will have to update IBUF_BITMAP_FREE
636  if new_block is a compressed leaf page in a secondary index.
637  This has to be done either within the same mini-transaction,
638  or by invoking ibuf_reset_free_bits() before mtr_commit().
639 
640  @return pointer to the original predecessor of the supremum record on
641  new_page, or NULL on zip overflow (new_block will be decompressed) */
643  buf_block_t *new_block, /*!< in/out: index page to copy to */
644  buf_block_t *block, /*!< in: index page containing rec */
645  rec_t *rec, /*!< in: record on page */
646  dict_index_t *index, /*!< in: record descriptor */
647  mtr_t *mtr); /*!< in: mtr */
648 /** Deletes records from a page from a given record onward, including that
649  record. The infimum and supremum records are not deleted. */
651  rec_t *rec, /*!< in: pointer to record on page */
652  buf_block_t *block, /*!< in: buffer block of the page */
653  dict_index_t *index, /*!< in: record descriptor */
654  ulint n_recs, /*!< in: number of records to delete,
655  or ULINT_UNDEFINED if not known */
656  ulint size, /*!< in: the sum of the sizes of the
657  records in the end of the chain to
658  delete, or ULINT_UNDEFINED if not known */
659  mtr_t *mtr); /*!< in: mtr */
660 /** Deletes records from page, up to the given record, NOT including
661  that record. Infimum and supremum records are not deleted. */
663  rec_t *rec, /*!< in: record on page */
664  buf_block_t *block, /*!< in: buffer block of the page */
665  dict_index_t *index, /*!< in: record descriptor */
666  mtr_t *mtr); /*!< in: mtr */
667 /** Moves record list end to another page. Moved records include
668  split_rec.
669 
670  IMPORTANT: The caller will have to update IBUF_BITMAP_FREE
671  if new_block is a compressed leaf page in a secondary index.
672  This has to be done either within the same mini-transaction,
673  or by invoking ibuf_reset_free_bits() before mtr_commit().
674 
675  @return true on success; false on compression failure (new_block will
676  be decompressed) */
678  buf_block_t *new_block, /*!< in/out: index page where to move */
679  buf_block_t *block, /*!< in: index page from where to move */
680  rec_t *split_rec, /*!< in: first record to move */
681  dict_index_t *index, /*!< in: record descriptor */
682  mtr_t *mtr); /*!< in: mtr */
683 /** Moves record list start to another page. Moved records do not include
684  split_rec.
685 
686  IMPORTANT: The caller will have to update IBUF_BITMAP_FREE
687  if new_block is a compressed leaf page in a secondary index.
688  This has to be done either within the same mini-transaction,
689  or by invoking ibuf_reset_free_bits() before mtr_commit().
690 
691  @return true on success; false on compression failure */
693  buf_block_t *new_block, /*!< in/out: index page where to move */
694  buf_block_t *block, /*!< in/out: page containing split_rec */
695  rec_t *split_rec, /*!< in: first record not to move */
696  dict_index_t *index, /*!< in: record descriptor */
697  mtr_t *mtr); /*!< in: mtr */
698 /** Splits a directory slot which owns too many records. */
700  page_t *page, /*!< in: index page */
701  page_zip_des_t *page_zip, /*!< in/out: compressed page whose
702  uncompressed part will be written, or NULL */
703  ulint slot_no); /*!< in: the directory slot */
704 /** Tries to balance the given directory slot with too few records
705  with the upper neighbor, so that there are at least the minimum number
706  of records owned by the slot; this may result in the merging of
707  two slots. */
709  page_t *page, /*!< in/out: index page */
710  page_zip_des_t *page_zip, /*!< in/out: compressed page, or NULL */
711  ulint slot_no); /*!< in: the directory slot */
712 /** Parses a log record of a record list end or start deletion.
713  @return end of log record or NULL */
715  mlog_id_t type, /*!< in: MLOG_LIST_END_DELETE,
716  MLOG_LIST_START_DELETE,
717  MLOG_COMP_LIST_END_DELETE or
718  MLOG_COMP_LIST_START_DELETE */
719  byte *ptr, /*!< in: buffer */
720  byte *end_ptr, /*!< in: buffer end */
721  buf_block_t *block, /*!< in/out: buffer block or NULL */
722  dict_index_t *index, /*!< in: record descriptor */
723  mtr_t *mtr); /*!< in: mtr or NULL */
724 
725 /** Parses a redo log record of creating a page.
726 @param[in,out] block buffer block, or NULL
727 @param[in] comp nonzero=compact page format
728 @param[in] page_type page type */
729 void page_parse_create(buf_block_t *block, ulint comp, page_type_t page_type);
730 #ifndef UNIV_HOTBACKUP
731 /** Prints record contents including the data relevant only in
732  the index page context. */
733 void page_rec_print(const rec_t *rec, /*!< in: physical record */
734  const ulint *offsets); /*!< in: record descriptor */
735 #ifdef UNIV_BTR_PRINT
736 /** This is used to print the contents of the directory for
737  debugging purposes. */
738 void page_dir_print(page_t *page, /*!< in: index page */
739  ulint pr_n); /*!< in: print n first and n last entries */
740 /** This is used to print the contents of the page record list for
741  debugging purposes. */
742 void page_print_list(
743  buf_block_t *block, /*!< in: index page */
744  dict_index_t *index, /*!< in: dictionary index of the page */
745  ulint pr_n); /*!< in: print n first and n last entries */
746 /** Prints the info in a page header. */
747 void page_header_print(const page_t *page); /*!< in: index page */
748 /** This is used to print the contents of the page for
749  debugging purposes. */
750 void page_print(buf_block_t *block, /*!< in: index page */
751  dict_index_t *index, /*!< in: dictionary index of the page */
752  ulint dn, /*!< in: print dn first and last entries
753  in directory */
754  ulint rn); /*!< in: print rn first and last records
755  in directory */
756 #endif /* UNIV_BTR_PRINT */
757 #endif /* !UNIV_HOTBACKUP */
758 /** The following is used to validate a record on a page. This function
759  differs from rec_validate as it can also check the n_owned field and
760  the heap_no field.
761  @return true if ok */
762 ibool page_rec_validate(
763  const rec_t *rec, /*!< in: physical record */
764  const ulint *offsets); /*!< in: array returned by rec_get_offsets() */
765 #ifdef UNIV_DEBUG
766 /** Checks that the first directory slot points to the infimum record and
767  the last to the supremum. This function is intended to track if the
768  bug fixed in 4.0.14 has caused corruption to users' databases. */
769 void page_check_dir(const page_t *page); /*!< in: index page */
770 #endif /* UNIV_DEBUG */
771 /** This function checks the consistency of an index page when we do not
772  know the index. This is also resilient so that this should never crash
773  even if the page is total garbage.
774  @return true if ok */
776  const page_t *page); /*!< in: index page in ROW_FORMAT=REDUNDANT */
777 /** This function checks the consistency of an index page when we do not
778  know the index. This is also resilient so that this should never crash
779  even if the page is total garbage.
780  @return true if ok */
782  const page_t *page); /*!< in: index page in ROW_FORMAT!=REDUNDANT */
783 /** This function checks the consistency of an index page.
784  @return true if ok */
785 ibool page_validate(
786  const page_t *page, /*!< in: index page */
787  dict_index_t *index); /*!< in: data dictionary index containing
788  the page record type definition */
789 /** Looks in the page record list for a record with the given heap number.
790  @return record, NULL if not found */
792  const page_t *page, /*!< in: index page */
793  ulint heap_no); /*!< in: heap number */
794 /** Get the last non-delete-marked record on a page.
795 @param[in] page index tree leaf page
796 @return the last record, not delete-marked
797 @retval infimum record if all records are delete-marked */
799 
800 /** Issue a warning when the checksum that is stored in the page is valid,
801 but different than the global setting innodb_checksum_algorithm.
802 @param[in] curr_algo current checksum algorithm
803 @param[in] page_checksum page valid checksum
804 @param[in] page_id page identifier */
806  srv_checksum_algorithm_t page_checksum,
807  const page_id_t &page_id);
808 
809 /** Check that a page_size is correct for InnoDB.
810 If correct, set the associated page_size_shift which is the power of 2
811 for this page size.
812 @param[in] page_size Page Size to evaluate
813 @return an associated page_size_shift if valid, 0 if invalid. */
814 inline ulong page_size_validate(ulong page_size);
815 
816 /** This function checks if the page in which record is present is a
817 non-leaf node of a spatial index.
818 param[in] rec Btree record
819 param[in] index index
820 @return TRUE if ok */
822 
823 #ifdef UNIV_MATERIALIZE
824 #undef UNIV_INLINE
825 #define UNIV_INLINE UNIV_INLINE_ORIGINAL
826 #endif
827 
828 #include "page0page.ic"
829 
830 #endif
page_no_t
uint32 page_no_t
Page number.
Definition: api0api.h:57
page_rec_is_supremum
UNIV_INLINE ibool page_rec_is_supremum(const rec_t *rec)
TRUE if the record is the supremum record on a page.
page_mem_alloc_free
UNIV_INLINE void page_mem_alloc_free(page_t *page, page_zip_des_t *page_zip, rec_t *next_rec, ulint need)
Allocates a block of memory from the head of the free list of an index page.
page_is_spatial_non_leaf
bool page_is_spatial_non_leaf(const rec_t *rec, dict_index_t *index)
This function checks if the page in which record is present is a non-leaf node of a spatial index.
Definition: page0page.cc:2124
page_rec_is_infimum_low
UNIV_INLINE ibool page_rec_is_infimum_low(ulint offset)
TRUE if the record is the infimum record on a page.
page_get_infimum_offset
UNIV_INLINE ulint page_get_infimum_offset(const page_t *page)
Gets the offset of the first record on the page.
page_t
byte page_t
Type of the index page.
Definition: page0types.h:133
page_get_max_insert_size
UNIV_INLINE ulint page_get_max_insert_size(const page_t *page, ulint n_recs)
Returns the maximum combined size of records which can be inserted on top of record heap.
page_rec_print
void page_rec_print(const rec_t *rec, const ulint *offsets)
Prints record contents including the data relevant only in the index page context.
Definition: page0page.cc:1523
page_set_ssn_id
UNIV_INLINE void page_set_ssn_id(buf_block_t *block, page_zip_des_t *page_zip, node_seq_t ssn_id, mtr_t *mtr)
Sets the RTREE SPLIT SEQUENCE NUMBER field value.
page_get_max_insert_size_after_reorganize
UNIV_INLINE ulint page_get_max_insert_size_after_reorganize(const page_t *page, ulint n_recs)
Returns the maximum combined size of records which can be inserted on top of record heap if page is f...
trx_id_t
ib_id_t trx_id_t
Transaction identifier (DB_TRX_ID, DATA_TRX_ID)
Definition: trx0types.h:148
node_seq_t
ib_uint32_t node_seq_t
Definition: gis0type.h:57
page_dir_get_n_slots
UNIV_INLINE ulint page_dir_get_n_slots(const page_t *page)
Gets the number of dir slots in directory.
page0types.h
page_parse_delete_rec_list
byte * page_parse_delete_rec_list(mlog_id_t type, byte *ptr, byte *end_ptr, buf_block_t *block, dict_index_t *index, mtr_t *mtr)
Parses a log record of a record list end or start deletion.
Definition: page0page.cc:826
page_validate
ibool page_validate(const page_t *page, dict_index_t *index)
This function checks the consistency of an index page.
Definition: page0page.cc:2130
dict_index_t
Data structure for an index.
Definition: dict0mem.h:869
page_rec_is_user_rec_low
UNIV_INLINE ibool page_rec_is_user_rec_low(ulint offset)
TRUE if the record is a user record on the page.
fsp0fsp.h
mtr_t
Mini-transaction handle and buffer.
Definition: mtr0mtr.h:169
page_is_root
UNIV_INLINE bool page_is_root(const page_t *page)
Determine whether a page is an index root page.
infimum_data
static const byte infimum_data[]
Data bytes of an infimum record.
Definition: page0page.h:90
page_header_set_ptr
UNIV_INLINE void page_header_set_ptr(page_t *page, page_zip_des_t *page_zip, ulint field, const byte *ptr)
Sets the pointer stored in the given header field.
page_dir_set_n_heap
UNIV_INLINE void page_dir_set_n_heap(page_t *page, page_zip_des_t *page_zip, ulint n_heap)
Sets the number of records in the heap.
page_rec_set_next
UNIV_INLINE void page_rec_set_next(rec_t *rec, const rec_t *next)
Sets the pointer to the next record on the page.
page_create_zip
page_t * page_create_zip(buf_block_t *block, dict_index_t *index, ulint level, trx_id_t max_trx_id, mtr_t *mtr, page_type_t page_type)
Create a compressed B-tree index page.
Definition: page0page.cc:391
buf0buf.h
page_find_rec_with_heap_no
const rec_t * page_find_rec_with_heap_no(const page_t *page, ulint heap_no)
Looks in the page record list for a record with the given heap number.
Definition: page0page.cc:2465
page_rec_is_comp
UNIV_INLINE ulint page_rec_is_comp(const rec_t *rec)
TRUE if the record is on a page in compact format.
page_rec_get_next_low
const UNIV_INLINE rec_t * page_rec_get_next_low(const rec_t *rec, ulint comp)
Gets the pointer to the next record on the page.
page_dir_find_owner_slot
ulint page_dir_find_owner_slot(const rec_t *rec)
Looks for the directory slot which owns the given record.
Definition: page0page.cc:93
page_get_data_size
UNIV_INLINE ulint page_get_data_size(const page_t *page)
Returns the sum of the sizes of the records in the record list excluding the infimum and supremum rec...
buf_block_t
The buffer control block structure.
Definition: buf0buf.h:1318
page_rec_get_next_non_del_marked
const UNIV_INLINE rec_t * page_rec_get_next_non_del_marked(const rec_t *rec)
Gets the pointer to the next non delete-marked record on the page.
page_rec_get_heap_no
UNIV_INLINE ulint page_rec_get_heap_no(const rec_t *rec)
Returns the heap number of a record.
page_rec_write_field
UNIV_INLINE void page_rec_write_field(rec_t *rec, ulint i, ulint val, mtr_t *mtr)
Write a 32-bit field in a data dictionary record.
page_offset
UNIV_INLINE ulint page_offset(const void *ptr)
Gets the offset within a page.
page_has_garbage
UNIV_INLINE bool page_has_garbage(const page_t *page)
Determine whether the page contains garbage.
page_rec_get_prev_const
const UNIV_INLINE rec_t * page_rec_get_prev_const(const rec_t *rec)
Gets the pointer to the previous record.
page_is_empty
UNIV_INLINE bool page_is_empty(const page_t *page)
Determine whether the page is empty.
rec_t
byte rec_t
Definition: rem0types.h:39
page_copy_rec_list_start
rec_t * page_copy_rec_list_start(buf_block_t *new_block, buf_block_t *block, rec_t *rec, dict_index_t *index, mtr_t *mtr)
Copies records from page to new_page, up to the given record, NOT including that record.
Definition: page0page.cc:667
page_zip_des_t
Compressed page descriptor.
Definition: page0types.h:182
page_delete_rec_list_end
void page_delete_rec_list_end(rec_t *rec, buf_block_t *block, dict_index_t *index, ulint n_recs, ulint size, mtr_t *mtr)
Deletes records from a page from a given record onward, including that record.
Definition: page0page.cc:873
page_move_rec_list_start
ibool page_move_rec_list_start(buf_block_t *new_block, buf_block_t *block, rec_t *split_rec, dict_index_t *index, mtr_t *mtr)
Moves record list start to another page.
Definition: page0page.cc:1205
page_dir_set_n_slots
UNIV_INLINE void page_dir_set_n_slots(page_t *page, page_zip_des_t *page_zip, ulint n_slots)
Sets the number of dir slots in directory.
page_find_rec_last_not_deleted
const rec_t * page_find_rec_last_not_deleted(const page_t *page)
Get the last non-delete-marked record on a page.
Definition: page0page.cc:2558
page_get_max_trx_id
UNIV_INLINE trx_id_t page_get_max_trx_id(const page_t *page)
Returns the max trx id field value.
page_dir_slot_set_rec
UNIV_INLINE void page_dir_slot_set_rec(page_dir_slot_t *slot, rec_t *rec)
This is used to set the record offset in a directory slot.
page_copy_rec_list_end_no_locks
void page_copy_rec_list_end_no_locks(buf_block_t *new_block, buf_block_t *block, rec_t *rec, dict_index_t *index, mtr_t *mtr)
Differs from page_copy_rec_list_end, because this function does not touch the lock table and max trx ...
Definition: page0page.cc:467
page_get_ssn_id
UNIV_INLINE node_seq_t page_get_ssn_id(const page_t *page)
Returns the RTREE SPLIT SEQUENCE NUMBER (FIL_RTREE_SPLIT_SEQ_NUM).
page_rec_distance_is_at_most
UNIV_INLINE bool page_rec_distance_is_at_most(const rec_t *left_rec, const rec_t *right_rec, ulint val)
true if distance between the records (measured in number of times we have to move to the next record)...
page_get_supremum_offset
UNIV_INLINE ulint page_get_supremum_offset(const page_t *page)
Gets the offset of the last record on the page.
page_dir_t
page_dir_slot_t page_dir_t
Definition: page0page.h:60
page_rec_get_prev
UNIV_INLINE rec_t * page_rec_get_prev(rec_t *rec)
Gets the pointer to the previous record.
page_rec_is_infimum
UNIV_INLINE ibool page_rec_is_infimum(const rec_t *rec)
TRUE if the record is the infimum record on a page.
page_delete_rec_list_start
void page_delete_rec_list_start(rec_t *rec, buf_block_t *block, dict_index_t *index, mtr_t *mtr)
Deletes records from page, up to the given record, NOT including that record.
Definition: page0page.cc:1069
page_is_comp
UNIV_INLINE ulint page_is_comp(const page_t *page)
Determine whether the page is in new-style compact format.
page_rec_get_next_const
const UNIV_INLINE rec_t * page_rec_get_next_const(const rec_t *rec)
Gets the pointer to the next record on the page.
page_rec_get_next
UNIV_INLINE rec_t * page_rec_get_next(rec_t *rec)
Gets the pointer to the next record on the page.
page_is_leaf
UNIV_INLINE bool page_is_leaf(const page_t *page)
Determine whether the page is a B-tree leaf.
page_rec_find_owner_rec
UNIV_INLINE rec_t * page_rec_find_owner_rec(rec_t *rec)
Looks for the record which owns the given record.
page_create_empty
void page_create_empty(buf_block_t *block, dict_index_t *index, mtr_t *mtr)
Empty a previously created B-tree index page.
Definition: page0page.cc:427
page_copy_rec_list_end
rec_t * page_copy_rec_list_end(buf_block_t *new_block, buf_block_t *block, rec_t *rec, dict_index_t *index, mtr_t *mtr)
Copies records from page to new_page, from the given record onward, including that record.
Definition: page0page.cc:530
page_rec_get_nth_const
const rec_t * page_rec_get_nth_const(const page_t *page, ulint nth)
Returns the nth record of the record list.
Definition: page0page.cc:1419
page
int page
Definition: ctype-mb.cc:1232
page_get_middle_rec
UNIV_INLINE rec_t * page_get_middle_rec(page_t *page)
Returns the middle record of the records on the page.
page_rec_validate
ibool page_rec_validate(const rec_t *rec, const ulint *offsets)
The following is used to validate a record on a page.
Definition: page0page.cc:1690
infimum_extra
static const byte infimum_extra[]
Extra bytes of an infimum record.
Definition: page0page.h:84
page_set_max_trx_id
void page_set_max_trx_id(buf_block_t *block, page_zip_des_t *page_zip, trx_id_t trx_id, mtr_t *mtr)
Sets the max trx id field value.
Definition: page0page.cc:192
page_mem_free
UNIV_INLINE void page_mem_free(page_t *page, page_zip_des_t *page_zip, rec_t *rec, const dict_index_t *index, const ulint *offsets)
Puts a record to free list.
page_dir_split_slot
void page_dir_split_slot(page_t *page, page_zip_des_t *page_zip, ulint slot_no)
Splits a directory slot which owns too many records.
Definition: page0page.cc:1295
rem0rec.h
supremum_extra_data
static const byte supremum_extra_data[]
Extra bytes and data bytes of a supremum record.
Definition: page0page.h:94
page_dir_slot_set_n_owned
UNIV_INLINE void page_dir_slot_set_n_owned(page_dir_slot_t *slot, page_zip_des_t *page_zip, ulint n)
This is used to set the owned records field of a directory slot.
page_parse_create
void page_parse_create(buf_block_t *block, ulint comp, page_type_t page_type)
Parses a redo log record of creating a page.
Definition: page0page.cc:363
page_simple_validate_new
ibool page_simple_validate_new(const page_t *page)
This function checks the consistency of an index page when we do not know the index.
Definition: page0page.cc:1941
page_get_page_no
UNIV_INLINE page_no_t page_get_page_no(const page_t *page)
Gets the page number.
page_dir_get_n_heap
UNIV_INLINE ulint page_dir_get_n_heap(const page_t *page)
Gets the number of records in the heap.
page_id_t
Page identifier.
Definition: buf0types.h:153
page_simple_validate_old
ibool page_simple_validate_old(const page_t *page)
This function checks the consistency of an index page when we do not know the index.
Definition: page0page.cc:1760
page_get_free_space_of_empty
UNIV_INLINE ulint page_get_free_space_of_empty(ulint comp)
Calculates free space if a page is emptied.
page_dir_calc_reserved_space
UNIV_INLINE ulint page_dir_calc_reserved_space(ulint n_recs)
Calculates the space reserved for directory slots of a given number of records.
page_type_t
uint16_t page_type_t
Definition: fil0fil.h:946
page_dir_slot_t
byte page_dir_slot_t
Definition: page0page.h:59
page_warn_strict_checksum
void page_warn_strict_checksum(srv_checksum_algorithm_t curr_algo, srv_checksum_algorithm_t page_checksum, const page_id_t &page_id)
Issue a warning when the checksum that is stored in the page is valid, but different than the global ...
Definition: page0page.cc:2588
page_header_reset_last_insert
UNIV_INLINE void page_header_reset_last_insert(page_t *page, page_zip_des_t *page_zip, mtr_t *mtr)
Resets the last insert info field in the page header.
page_header_set_field
UNIV_INLINE void page_header_set_field(page_t *page, page_zip_des_t *page_zip, ulint field, ulint val)
Sets the given header field.
page_check_dir
void page_check_dir(const page_t *page)
Checks that the first directory slot points to the infimum record and the last to the supremum.
Definition: page0page.cc:1733
page_rec_is_first
UNIV_INLINE bool page_rec_is_first(const rec_t *rec, const page_t *page)
true if the record is the first user record on a page.
HttpMethod::type
int type
Definition: http_common.h:411
page_get_n_recs
UNIV_INLINE ulint page_get_n_recs(const page_t *page)
Gets the number of user records on page (the infimum and supremum records are not user records).
fil0fil.h
mlog_id_t
mlog_id_t
Definition: mtr0types.h:59
page_rec_is_supremum_low
UNIV_INLINE ibool page_rec_is_supremum_low(ulint offset)
TRUE if the record is the supremum record on a page.
mtr0mtr.h
page_update_max_trx_id
UNIV_INLINE void page_update_max_trx_id(buf_block_t *block, page_zip_des_t *page_zip, trx_id_t trx_id, mtr_t *mtr)
Sets the max trx id field value if trx_id is bigger than the previous value.
space_id_t
uint32 space_id_t
Tablespace identifier.
Definition: api0api.h:59
page_dir_balance_slot
void page_dir_balance_slot(page_t *page, page_zip_des_t *page_zip, ulint slot_no)
Tries to balance the given directory slot with too few records with the upper neighbor,...
Definition: page0page.cc:1354
page_rec_get_n_recs_before
ulint page_rec_get_n_recs_before(const rec_t *rec)
Returns the number of records before the given record in chain.
Definition: page0page.cc:1466
ulong
unsigned long ulong
Definition: my_inttypes.h:48
data0data.h
page_rec_is_second_last
UNIV_INLINE bool page_rec_is_second_last(const rec_t *rec, const page_t *page)
true if the record is the second last user record on a page.
page_rec_check
UNIV_INLINE ibool page_rec_check(const rec_t *rec)
Used to check the consistency of a record on a page.
page_mem_alloc_heap
byte * page_mem_alloc_heap(page_t *page, page_zip_des_t *page_zip, ulint need, ulint *heap_no)
Allocates a block of memory from the heap of an index page.
Definition: page0page.cc:222
page_rec_is_user_rec
UNIV_INLINE ibool page_rec_is_user_rec(const rec_t *rec)
TRUE if the record is a user record on the page.
page_dir_slot_get_n_owned
UNIV_INLINE ulint page_dir_slot_get_n_owned(const page_dir_slot_t *slot)
Gets the number of records owned by a directory slot.
n
int n
Definition: xcom_base.c:425
page_size_validate
ulong page_size_validate(ulong page_size)
Check that a page_size is correct for InnoDB.
page_rec_get_nth
UNIV_INLINE rec_t * page_rec_get_nth(page_t *page, ulint nth)
Returns the nth record of the record list.
page_get_space_id
UNIV_INLINE space_id_t page_get_space_id(const page_t *page)
Gets the tablespace identifier.
page_rec_is_second
UNIV_INLINE bool page_rec_is_second(const rec_t *rec, const page_t *page)
true if the record is the second user record on a page.
page_header_get_field
UNIV_INLINE ulint page_header_get_field(const page_t *page, ulint field)
Reads the given header field.
page_rec_is_last
UNIV_INLINE bool page_rec_is_last(const rec_t *rec, const page_t *page)
true if the record is the last user record on a page.
page_rec_get_base_extra_size
UNIV_INLINE ulint page_rec_get_base_extra_size(const rec_t *rec)
Returns the base extra size of a physical record.
page_dir_get_nth_slot
UNIV_INLINE page_dir_slot_t * page_dir_get_nth_slot(const page_t *page, ulint n)
Gets pointer to nth directory slot.
dict0dict.h
page_header_get_offs
UNIV_INLINE ulint page_header_get_offs(const page_t *page, ulint field)
Returns the offset stored in the given header field.
page_dir_slot_get_rec
const UNIV_INLINE rec_t * page_dir_slot_get_rec(const page_dir_slot_t *slot)
Gets the record pointed to by a directory slot.
page_move_rec_list_end
ibool page_move_rec_list_end(buf_block_t *new_block, buf_block_t *block, rec_t *split_rec, dict_index_t *index, mtr_t *mtr)
Moves record list end to another page.
Definition: page0page.cc:1152
page_align
UNIV_INLINE page_t * page_align(const void *ptr)
Gets the start of a page.
index
char * index(const char *, int c)
Definition: mysql.cc:2875
srv_checksum_algorithm_t
srv_checksum_algorithm_t
Alternatives for srv_checksum_algorithm, which can be changed by setting innodb_checksum_algorithm.
Definition: buf0types.h:97
page_create
page_t * page_create(buf_block_t *block, mtr_t *mtr, ulint comp, page_type_t page_type)
Create an uncompressed B-tree or R-tree or SDI index page.
Definition: page0page.cc:375