MySQL  8.0.22
Source Code Documentation
page0page.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (c) 1994, 2020, 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 
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 @param[in] ptr pointer to page frame
112 @return start of the page */
113 UNIV_INLINE
114 page_t *page_align(const void *ptr);
115 
116 /** Gets the offset within a page.
117 @param[in] ptr pointer to page frame
118 @return offset from the start of the page */
119 UNIV_INLINE
120 ulint page_offset(const void *ptr);
121 
122 /** Returns the max trx id field value. */
123 UNIV_INLINE
124 trx_id_t page_get_max_trx_id(const page_t *page); /*!< in: page */
125 
126 /** Sets the max trx id field value.
127 @param[in,out] block Page
128 @param[in,out] page_zip Compressed page, or NULL
129 @param[in] trx_id Transaction id
130 @param[in,out] mtr Mini-transaction, or NULL */
131 void page_set_max_trx_id(buf_block_t *block, page_zip_des_t *page_zip,
132  trx_id_t trx_id, mtr_t *mtr);
133 
134 /** Sets the max trx id field value if trx_id is bigger than the previous
135 value.
136 @param[in,out] block Page
137 @param[in,out] page_zip Compressed page whose uncompressed part will
138  be updated, or NULL
139 @param[in] trx_id Transaction id
140 @param[in,out] mtr Mini-transaction */
141 UNIV_INLINE
142 void page_update_max_trx_id(buf_block_t *block, page_zip_des_t *page_zip,
143  trx_id_t trx_id, mtr_t *mtr);
144 
145 /** Returns the RTREE SPLIT SEQUENCE NUMBER (FIL_RTREE_SPLIT_SEQ_NUM).
146 @param[in] page page
147 @return SPLIT SEQUENCE NUMBER */
148 UNIV_INLINE
150 
151 /** Sets the RTREE SPLIT SEQUENCE NUMBER field value
152 @param[in,out] block Page
153 @param[in,out] page_zip Compressed page whose uncompressed part will
154  be updated, or NULL
155 @param[in] ssn_id Split sequence id
156 @param[in,out] mtr Mini-transaction */
157 UNIV_INLINE
158 void page_set_ssn_id(buf_block_t *block, page_zip_des_t *page_zip,
159  node_seq_t ssn_id, mtr_t *mtr);
160 
161 /** Reads the given header field.
162 @param[in] page page
163 @param[in] field PAGE_N_DIR_SLOTS, ... */
164 UNIV_INLINE
165 ulint page_header_get_field(const page_t *page, ulint field);
166 
167 /** Sets the given header field.
168 @param[in,out] page page
169 @param[in,out] page_zip compressed page whose uncompressed part will
170  be updated, or NULL
171 @param[in] field PAGE_N_DIR_SLOTS, ...
172 @param[in] val value */
173 UNIV_INLINE
174 void page_header_set_field(page_t *page, page_zip_des_t *page_zip, ulint field,
175  ulint val);
176 
177 /** Returns the offset stored in the given header field.
178  @return offset from the start of the page, or 0 */
179 UNIV_INLINE
180 ulint page_header_get_offs(const page_t *page, /*!< in: page */
181  ulint field) /*!< in: PAGE_FREE, ... */
182  MY_ATTRIBUTE((warn_unused_result));
183 
184 /** Returns the pointer stored in the given header field, or NULL. */
185 #define page_header_get_ptr(page, field) \
186  (page_header_get_offs(page, field) \
187  ? page + page_header_get_offs(page, field) \
188  : NULL)
189 
190 /** Sets the pointer stored in the given header field.
191 @param[in,out] page page
192 @param[in,out] page_zip compressed page whose uncompressed part will
193  be updated, or NULL
194 @param[in,out] field PAGE_FREE, ...
195 @param[in] ptr pointer or NULL */
196 UNIV_INLINE
197 void page_header_set_ptr(page_t *page, page_zip_des_t *page_zip, ulint field,
198  const byte *ptr);
199 #ifndef UNIV_HOTBACKUP
200 
201 /** Resets the last insert info field in the page header. Writes to mlog about
202 this operation.
203 @param[in] page page
204 @param[in,out] page_zip compressed page whose uncompressed part will
205  be updated, or NULL
206 @param[in] mtr mtr */
207 UNIV_INLINE
209  mtr_t *mtr);
210 #endif /* !UNIV_HOTBACKUP */
211 
212 /** Gets the offset of the first record on the page.
213  @return offset of the first record in record list, relative from page */
214 UNIV_INLINE
216  const page_t *page); /*!< in: page which must have record(s) */
217 /** Gets the offset of the last record on the page.
218  @return offset of the last record in record list, relative from page */
219 UNIV_INLINE
221  const page_t *page); /*!< in: page which must have record(s) */
222 #define page_get_infimum_rec(page) ((page) + page_get_infimum_offset(page))
223 #define page_get_supremum_rec(page) ((page) + page_get_supremum_offset(page))
224 
225 /** Returns the nth record of the record list.
226  This is the inverse function of page_rec_get_n_recs_before().
227  @return nth record */
228 const rec_t *page_rec_get_nth_const(const page_t *page, /*!< in: page */
229  ulint nth) /*!< in: nth record */
230  MY_ATTRIBUTE((warn_unused_result));
231 
232 /** Returns the nth record of the record list.
233 This is the inverse function of page_rec_get_n_recs_before().
234 @param[in] page page
235 @param[in] nth nth record
236 @return nth record */
237 UNIV_INLINE
238 rec_t *page_rec_get_nth(page_t *page, ulint nth)
239  MY_ATTRIBUTE((warn_unused_result));
240 
241 #ifndef UNIV_HOTBACKUP
242 /** Returns the middle record of the records on the page. If there is an
243  even number of records in the list, returns the first record of the
244  upper half-list.
245  @return middle record */
246 UNIV_INLINE
247 rec_t *page_get_middle_rec(page_t *page) /*!< in: page */
248  MY_ATTRIBUTE((warn_unused_result));
249 #endif /* !UNIV_HOTBACKUP */
250 /** Gets the page number.
251  @return page number */
252 UNIV_INLINE
253 page_no_t page_get_page_no(const page_t *page); /*!< in: page */
254 /** Gets the tablespace identifier.
255  @return space id */
256 UNIV_INLINE
257 space_id_t page_get_space_id(const page_t *page); /*!< in: page */
258 
259 /** Gets the space id and page number identifying the page.
260  @return page number */
261 UNIV_INLINE
263 
264 /** Gets the number of user records on page (the infimum and supremum records
265  are not user records).
266  @return number of user records */
267 UNIV_INLINE
268 ulint page_get_n_recs(const page_t *page); /*!< in: index page */
269 /** Returns the number of records before the given record in chain.
270  The number includes infimum and supremum records.
271  This is the inverse function of page_rec_get_nth().
272  @return number of records */
274  const rec_t *rec); /*!< in: the physical record */
275 /** Gets the number of records in the heap.
276  @return number of user records */
277 UNIV_INLINE
278 ulint page_dir_get_n_heap(const page_t *page); /*!< in: index page */
279 
280 /** Sets the number of records in the heap.
281 @param[in,out] page index page
282 @param[in,out] page_zip compressed page whose uncompressed part will
283  be updated, or NULL. Note that the size of the
284  dense page directory in the compressed page
285  trailer is n_heap * PAGE_ZIP_DIR_SLOT_SIZE.
286 @param[in] n_heap number of records*/
287 UNIV_INLINE
288 void page_dir_set_n_heap(page_t *page, page_zip_des_t *page_zip, ulint n_heap);
289 
290 /** Gets the number of dir slots in directory.
291  @return number of slots */
292 UNIV_INLINE
293 ulint page_dir_get_n_slots(const page_t *page); /*!< in: index page */
294 
295 /** Sets the number of dir slots in directory.
296 @param[in,out] page page
297 @param[in,out] page_zip compressed page whose uncompressed part will
298  be updated, or NULL
299 @param[in] n_slots number of slots */
300 UNIV_INLINE
302  ulint n_slots);
303 
304 #ifdef UNIV_DEBUG
305 /** Gets pointer to nth directory slot.
306 @param[in] page index page
307 @param[in] n position
308 @return pointer to dir slot */
309 UNIV_INLINE
311 #else /* UNIV_DEBUG */
312 #define page_dir_get_nth_slot(page, n) \
313  ((page) + (UNIV_PAGE_SIZE - PAGE_DIR - (n + 1) * PAGE_DIR_SLOT_SIZE))
314 #endif /* UNIV_DEBUG */
315 
316 /** Used to check the consistency of a record on a page.
317  @return true if succeed */
318 UNIV_INLINE
319 ibool page_rec_check(const rec_t *rec); /*!< in: record */
320 /** Gets the record pointed to by a directory slot.
321  @return pointer to record */
322 UNIV_INLINE
324  const page_dir_slot_t *slot); /*!< in: directory slot */
325 
326 /** This is used to set the record offset in a directory slot.
327 @param[in] rec record on the page
328 @param[in] slot directory slot */
329 UNIV_INLINE
331 
332 /** Gets the number of records owned by a directory slot.
333  @return number of records */
334 UNIV_INLINE
336  const page_dir_slot_t *slot); /*!< in: page directory slot */
337 
338 /** This is used to set the owned records field of a directory slot.
339 @param[in,out] slot directory slot
340 @param[in,out] page_zip compressed page, or NULL
341 @param[in] n number of records owned by the slot */
342 UNIV_INLINE
344  ulint n);
345 
346 /** Calculates the space reserved for directory slots of a given
347  number of records. The exact value is a fraction number
348  n * PAGE_DIR_SLOT_SIZE / PAGE_DIR_SLOT_MIN_N_OWNED, and it is
349  rounded upwards to an integer. */
350 UNIV_INLINE
351 ulint page_dir_calc_reserved_space(ulint n_recs); /*!< in: number of records */
352 /** Looks for the directory slot which owns the given record.
353  @return the directory slot number */
355  const rec_t *rec); /*!< in: the physical record */
356 /** Determine whether the page is in new-style compact format.
357  @return nonzero if the page is in compact format, zero if it is in
358  old-style format */
359 UNIV_INLINE
360 ulint page_is_comp(const page_t *page); /*!< in: index page */
361 /** TRUE if the record is on a page in compact format.
362  @return nonzero if in compact format */
363 UNIV_INLINE
364 ulint page_rec_is_comp(const rec_t *rec); /*!< in: record */
365 /** Returns the heap number of a record.
366  @return heap number */
367 UNIV_INLINE
368 ulint page_rec_get_heap_no(const rec_t *rec); /*!< in: the physical record */
369 /** Determine whether the page is a B-tree leaf.
370  @return true if the page is a B-tree leaf (PAGE_LEVEL = 0) */
371 UNIV_INLINE
372 bool page_is_leaf(const page_t *page) /*!< in: page */
373  MY_ATTRIBUTE((warn_unused_result));
374 /** Determine whether the page is empty.
375  @return true if the page is empty (PAGE_N_RECS = 0) */
376 UNIV_INLINE
377 bool page_is_empty(const page_t *page) /*!< in: page */
378  MY_ATTRIBUTE((warn_unused_result));
379 /** Determine whether a page is an index root page.
380 @param[in] page page frame
381 @return true if the page is a root page of an index */
382 UNIV_INLINE
383 bool page_is_root(const page_t *page) MY_ATTRIBUTE((warn_unused_result));
384 /** Determine whether the page contains garbage.
385  @return true if the page contains garbage (PAGE_GARBAGE is not 0) */
386 UNIV_INLINE
387 bool page_has_garbage(const page_t *page) /*!< in: page */
388  MY_ATTRIBUTE((warn_unused_result));
389 
390 /** Gets the pointer to the next record on the page.
391 @param[in] rec pointer to record
392 @param[in] comp nonzero=compact page layout
393 @return pointer to next record */
394 UNIV_INLINE
395 const rec_t *page_rec_get_next_low(const rec_t *rec, ulint comp);
396 
397 /** Gets the pointer to the next record on the page.
398  @return pointer to next record */
399 UNIV_INLINE
400 rec_t *page_rec_get_next(rec_t *rec); /*!< in: pointer to record */
401 /** Gets the pointer to the next record on the page.
402  @return pointer to next record */
403 UNIV_INLINE
405  const rec_t *rec); /*!< in: pointer to record */
406 /** Gets the pointer to the next non delete-marked record on the page.
407  If all subsequent records are delete-marked, then this function
408  will return the supremum record.
409  @return pointer to next non delete-marked record or pointer to supremum */
410 UNIV_INLINE
412  const rec_t *rec); /*!< in: pointer to record */
413 
414 /** Sets the pointer to the next record on the page.
415 @param[in] rec pointer to record, must not be page supremum
416 @param[in] next pointer to next record, must not be page infimum */
417 UNIV_INLINE
418 void page_rec_set_next(rec_t *rec, const rec_t *next);
419 
420 /** Gets the pointer to the previous record.
421  @return pointer to previous record */
422 UNIV_INLINE
424  const rec_t *rec); /*!< in: pointer to record, must not be page
425  infimum */
426 /** Gets the pointer to the previous record.
427  @return pointer to previous record */
428 UNIV_INLINE
429 rec_t *page_rec_get_prev(rec_t *rec); /*!< in: pointer to record,
430  must not be page infimum */
431 /** TRUE if the record is a user record on the page.
432 @param[in] offset record offset on page
433 @return true if a user record */
434 UNIV_INLINE
435 ibool page_rec_is_user_rec_low(ulint offset);
436 
437 /** TRUE if the record is the supremum record on a page.
438 @param[in] offset record offset on page
439 @return true if the supremum record */
440 UNIV_INLINE
441 ibool page_rec_is_supremum_low(ulint offset);
442 
443 /** TRUE if the record is the infimum record on a page.
444 @param[in] offset record offset on page
445 @return true if the infimum record */
446 UNIV_INLINE
447 ibool page_rec_is_infimum_low(ulint offset);
448 
449 /** TRUE if the record is a user record on the page.
450  @return true if a user record */
451 UNIV_INLINE
452 ibool page_rec_is_user_rec(const rec_t *rec) /*!< in: record */
453  MY_ATTRIBUTE((warn_unused_result));
454 /** TRUE if the record is the supremum record on a page.
455  @return true if the supremum record */
456 UNIV_INLINE
457 ibool page_rec_is_supremum(const rec_t *rec) /*!< in: record */
458  MY_ATTRIBUTE((warn_unused_result));
459 
460 /** TRUE if the record is the infimum record on a page.
461  @return true if the infimum record */
462 UNIV_INLINE
463 ibool page_rec_is_infimum(const rec_t *rec) /*!< in: record */
464  MY_ATTRIBUTE((warn_unused_result));
465 
466 /** true if the record is the first user record on a page.
467  @return true if the first user record */
468 UNIV_INLINE
469 bool page_rec_is_first(const rec_t *rec, /*!< in: record */
470  const page_t *page) /*!< in: page */
471  MY_ATTRIBUTE((warn_unused_result));
472 
473 /** true if the record is the second user record on a page.
474  @return true if the second user record */
475 UNIV_INLINE
476 bool page_rec_is_second(const rec_t *rec, /*!< in: record */
477  const page_t *page) /*!< in: page */
478  MY_ATTRIBUTE((warn_unused_result));
479 
480 /** true if the record is the last user record on a page.
481  @return true if the last user record */
482 UNIV_INLINE
483 bool page_rec_is_last(const rec_t *rec, /*!< in: record */
484  const page_t *page) /*!< in: page */
485  MY_ATTRIBUTE((warn_unused_result));
486 
487 /** true if distance between the records (measured in number of times we have to
488 move to the next record) is at most the specified value
489 @param[in] left_rec lefter record
490 @param[in] right_rec righter record
491 @param[in] val specified value to compare
492 @return true if the distance is smaller than the value */
493 UNIV_INLINE
494 bool page_rec_distance_is_at_most(const rec_t *left_rec, const rec_t *right_rec,
495  ulint val) MY_ATTRIBUTE((warn_unused_result));
496 
497 /** true if the record is the second last user record on a page.
498  @return true if the second last user record */
499 UNIV_INLINE
500 bool page_rec_is_second_last(const rec_t *rec, /*!< in: record */
501  const page_t *page) /*!< in: page */
502  MY_ATTRIBUTE((warn_unused_result));
503 
504 /** Looks for the record which owns the given record.
505  @return the owner record */
506 UNIV_INLINE
507 rec_t *page_rec_find_owner_rec(rec_t *rec); /*!< in: the physical record */
508 #ifndef UNIV_HOTBACKUP
509 
510 /** Write a 32-bit field in a data dictionary record.
511 @param[in,out] rec Record to update
512 @param[in] i Index of the field to update
513 @param[in] val Value to write
514 @param[in,out] mtr Mini-transaction */
515 UNIV_INLINE
516 void page_rec_write_field(rec_t *rec, ulint i, ulint val, mtr_t *mtr);
517 #endif /* !UNIV_HOTBACKUP */
518 
519 /** Returns the maximum combined size of records which can be inserted on top
520 of record heap.
521 @param[in] page index page
522 @param[in] n_recs number of records
523 @return maximum combined size for inserted records */
524 UNIV_INLINE
525 ulint page_get_max_insert_size(const page_t *page, ulint n_recs);
526 
527 /** Returns the maximum combined size of records which can be inserted on top
528 of record heap if page is first reorganized.
529 @param[in] page index page
530 @param[in] n_recs number of records
531 @return maximum combined size for inserted records */
532 UNIV_INLINE
534  ulint n_recs);
535 
536 /** Calculates free space if a page is emptied.
537 @param[in] comp nonzero=compact page format
538 @return free space */
539 UNIV_INLINE
540 ulint page_get_free_space_of_empty(ulint comp);
541 
542 /** Returns the base extra size of a physical record. This is the
543  size of the fixed header, independent of the record size.
544  @return REC_N_NEW_EXTRA_BYTES or REC_N_OLD_EXTRA_BYTES */
545 UNIV_INLINE
547  const rec_t *rec); /*!< in: physical record */
548 /** Returns the sum of the sizes of the records in the record list
549  excluding the infimum and supremum records.
550  @return data in bytes */
551 UNIV_INLINE
552 ulint page_get_data_size(const page_t *page); /*!< in: index page */
553 
554 /** Allocates a block of memory from the head of the free list of an index
555 page.
556 @param[in,out] page index page
557 @param[in,out] page_zip compressed page with enough space available
558  for inserting the record, or NULL
559 @param[in] next_rec pointer to the new head of the free record
560  list
561 @param[in] need number of bytes allocated */
562 UNIV_INLINE
564  rec_t *next_rec, ulint need);
565 
566 /** Allocates a block of memory from the heap of an index page.
567  @return pointer to start of allocated buffer, or NULL if allocation fails */
569  page_t *page, /*!< in/out: index page */
570  page_zip_des_t *page_zip, /*!< in/out: compressed page with enough
571  space available for inserting the record,
572  or NULL */
573  ulint need, /*!< in: total number of bytes needed */
574  ulint *heap_no); /*!< out: this contains the heap number
575  of the allocated record
576  if allocation succeeds */
577 
578 /** Puts a record to free list.
579 @param[in,out] page index page
580 @param[in,out] page_zip compressed page, or NULL
581 @param[in] rec pointer to the (origin of) record
582 @param[in] index index of rec
583 @param[in] offsets array returned by rec_get_offsets() */
584 UNIV_INLINE
585 void page_mem_free(page_t *page, page_zip_des_t *page_zip, rec_t *rec,
586  const dict_index_t *index, const ulint *offsets);
587 
588 /** Create an uncompressed B-tree or R-tree or SDI index page.
589 @param[in] block A buffer block where the page is created
590 @param[in] mtr Mini-transaction handle
591 @param[in] comp nonzero=compact page format
592 @param[in] page_type Page type
593 @return pointer to the page */
594 page_t *page_create(buf_block_t *block, mtr_t *mtr, ulint comp,
595  page_type_t page_type);
596 
597 /** Create a compressed B-tree index page.
598 @param[in,out] block Buffer frame where the page is created
599 @param[in] index Index of the page, or NULL when applying
600  TRUNCATE log record during recovery
601 @param[in] level The B-tree level of the page
602 @param[in] max_trx_id PAGE_MAX_TRX_ID
603 @param[in] mtr Mini-transaction handle
604 @param[in] page_type Page type to be created. Only FIL_PAGE_INDEX,
605  FIL_PAGE_RTREE, FIL_PAGE_SDI allowed
606 @return pointer to the page */
607 page_t *page_create_zip(buf_block_t *block, dict_index_t *index, ulint level,
608  trx_id_t max_trx_id, mtr_t *mtr, page_type_t page_type);
609 
610 /** Empty a previously created B-tree index page.
611 @param[in,out] block B-tree block
612 @param[in] index The index of the page
613 @param[in,out] mtr Mini-transaction */
614 void page_create_empty(buf_block_t *block, dict_index_t *index, mtr_t *mtr);
615 
616 /** Differs from page_copy_rec_list_end, because this function does not
617  touch the lock table and max trx id on page or compress the page.
618 
619  IMPORTANT: The caller will have to update IBUF_BITMAP_FREE
620  if new_block is a compressed leaf page in a secondary index.
621  This has to be done either within the same mini-transaction,
622  or by invoking ibuf_reset_free_bits() before mtr_commit(). */
624  buf_block_t *new_block, /*!< in: index page to copy to */
625  buf_block_t *block, /*!< in: index page of rec */
626  rec_t *rec, /*!< in: record on page */
627  dict_index_t *index, /*!< in: record descriptor */
628  mtr_t *mtr); /*!< in: mtr */
629 /** Copies records from page to new_page, from the given record onward,
630  including that record. Infimum and supremum records are not copied.
631  The records are copied to the start of the record list on new_page.
632 
633  IMPORTANT: The caller will have to update IBUF_BITMAP_FREE
634  if new_block is a compressed leaf page in a secondary index.
635  This has to be done either within the same mini-transaction,
636  or by invoking ibuf_reset_free_bits() before mtr_commit().
637 
638  @return pointer to the original successor of the infimum record on
639  new_page, or NULL on zip overflow (new_block will be decompressed) */
641  buf_block_t *new_block, /*!< in/out: index page to copy to */
642  buf_block_t *block, /*!< in: index page containing rec */
643  rec_t *rec, /*!< in: record on page */
644  dict_index_t *index, /*!< in: record descriptor */
645  mtr_t *mtr); /*!< in: mtr */
646 /** Copies records from page to new_page, up to the given record, NOT
647  including that record. Infimum and supremum records are not copied.
648  The records are copied to the end of the record list on new_page.
649 
650  IMPORTANT: The caller will have to update IBUF_BITMAP_FREE
651  if new_block is a compressed leaf page in a secondary index.
652  This has to be done either within the same mini-transaction,
653  or by invoking ibuf_reset_free_bits() before mtr_commit().
654 
655  @return pointer to the original predecessor of the supremum record on
656  new_page, or NULL on zip overflow (new_block will be decompressed) */
658  buf_block_t *new_block, /*!< in/out: index page to copy to */
659  buf_block_t *block, /*!< in: index page containing rec */
660  rec_t *rec, /*!< in: record on page */
661  dict_index_t *index, /*!< in: record descriptor */
662  mtr_t *mtr); /*!< in: mtr */
663 /** Deletes records from a page from a given record onward, including that
664  record. The infimum and supremum records are not deleted. */
666  rec_t *rec, /*!< in: pointer to record on page */
667  buf_block_t *block, /*!< in: buffer block of the page */
668  dict_index_t *index, /*!< in: record descriptor */
669  ulint n_recs, /*!< in: number of records to delete,
670  or ULINT_UNDEFINED if not known */
671  ulint size, /*!< in: the sum of the sizes of the
672  records in the end of the chain to
673  delete, or ULINT_UNDEFINED if not known */
674  mtr_t *mtr); /*!< in: mtr */
675 /** Deletes records from page, up to the given record, NOT including
676  that record. Infimum and supremum records are not deleted. */
678  rec_t *rec, /*!< in: record on page */
679  buf_block_t *block, /*!< in: buffer block of the page */
680  dict_index_t *index, /*!< in: record descriptor */
681  mtr_t *mtr); /*!< in: mtr */
682 /** Moves record list end to another page. Moved records include
683  split_rec.
684 
685  IMPORTANT: The caller will have to update IBUF_BITMAP_FREE
686  if new_block is a compressed leaf page in a secondary index.
687  This has to be done either within the same mini-transaction,
688  or by invoking ibuf_reset_free_bits() before mtr_commit().
689 
690  @return true on success; false on compression failure (new_block will
691  be decompressed) */
693  buf_block_t *new_block, /*!< in/out: index page where to move */
694  buf_block_t *block, /*!< in: index page from where to move */
695  rec_t *split_rec, /*!< in: first record to move */
696  dict_index_t *index, /*!< in: record descriptor */
697  mtr_t *mtr); /*!< in: mtr */
698 /** Moves record list start to another page. Moved records do not include
699  split_rec.
700 
701  IMPORTANT: The caller will have to update IBUF_BITMAP_FREE
702  if new_block is a compressed leaf page in a secondary index.
703  This has to be done either within the same mini-transaction,
704  or by invoking ibuf_reset_free_bits() before mtr_commit().
705 
706  @return true on success; false on compression failure */
708  buf_block_t *new_block, /*!< in/out: index page where to move */
709  buf_block_t *block, /*!< in/out: page containing split_rec */
710  rec_t *split_rec, /*!< in: first record not to move */
711  dict_index_t *index, /*!< in: record descriptor */
712  mtr_t *mtr); /*!< in: mtr */
713 
714 /** Splits a directory slot which owns too many records.
715 @param[in,out] page Index page
716 @param[in,out] page_zip Compressed page whose uncompressed part will be written,
717 or null
718 @param[in] slot_no The directory slot */
719 void page_dir_split_slot(page_t *page, page_zip_des_t *page_zip, ulint slot_no);
720 
721 /** Tries to balance the given directory slot with too few records with the
722  upper neighbor, so that there are at least the minimum number of records
723 owned by the slot; this may result in the merging of two slots.
724 @param[in,out] page Index page
725 @param[in,out] page_zip Compressed page, or null
726 @param[in] slot_no The directory slot */
728  ulint slot_no);
729 
730 /** Parses a log record of a record list end or start deletion.
731  @return end of log record or NULL */
733  mlog_id_t type, /*!< in: MLOG_LIST_END_DELETE,
734  MLOG_LIST_START_DELETE,
735  MLOG_COMP_LIST_END_DELETE or
736  MLOG_COMP_LIST_START_DELETE */
737  byte *ptr, /*!< in: buffer */
738  byte *end_ptr, /*!< in: buffer end */
739  buf_block_t *block, /*!< in/out: buffer block or NULL */
740  dict_index_t *index, /*!< in: record descriptor */
741  mtr_t *mtr); /*!< in: mtr or NULL */
742 
743 /** Parses a redo log record of creating a page.
744 @param[in,out] block buffer block, or NULL
745 @param[in] comp nonzero=compact page format
746 @param[in] page_type page type (FIL_PAGE_INDEX, FIL_PAGE_RTREE
747  or FIL_PAGE_SDI) */
748 void page_parse_create(buf_block_t *block, ulint comp, page_type_t page_type);
749 
750 #ifndef UNIV_HOTBACKUP
751 /** Prints record contents including the data relevant only in
752  the index page context.
753 @param[in] rec Physical record
754 @param[in] offsets Record descriptor */
755 void page_rec_print(const rec_t *rec, const ulint *offsets);
756 #ifdef UNIV_BTR_PRINT
757 /** This is used to print the contents of the directory for
758  debugging purposes. */
759 void page_dir_print(page_t *page, /*!< in: index page */
760  ulint pr_n); /*!< in: print n first and n last entries */
761 /** This is used to print the contents of the page record list for
762  debugging purposes. */
763 void page_print_list(
764  buf_block_t *block, /*!< in: index page */
765  dict_index_t *index, /*!< in: dictionary index of the page */
766  ulint pr_n); /*!< in: print n first and n last entries */
767 /** Prints the info in a page header. */
768 void page_header_print(const page_t *page); /*!< in: index page */
769 /** This is used to print the contents of the page for
770  debugging purposes. */
771 void page_print(buf_block_t *block, /*!< in: index page */
772  dict_index_t *index, /*!< in: dictionary index of the page */
773  ulint dn, /*!< in: print dn first and last entries
774  in directory */
775  ulint rn); /*!< in: print rn first and last records
776  in directory */
777 #endif /* UNIV_BTR_PRINT */
778 #endif /* !UNIV_HOTBACKUP */
779 /** The following is used to validate a record on a page. This function
780  differs from rec_validate as it can also check the n_owned field and
781  the heap_no field.
782  @return true if ok */
783 ibool page_rec_validate(
784  const rec_t *rec, /*!< in: physical record */
785  const ulint *offsets); /*!< in: array returned by rec_get_offsets() */
786 #ifdef UNIV_DEBUG
787 /** Checks that the first directory slot points to the infimum record and
788  the last to the supremum. This function is intended to track if the
789  bug fixed in 4.0.14 has caused corruption to users' databases. */
790 void page_check_dir(const page_t *page); /*!< in: index page */
791 #endif /* UNIV_DEBUG */
792 /** This function checks the consistency of an index page when we do not
793  know the index. This is also resilient so that this should never crash
794  even if the page is total garbage.
795  @return true if ok */
797  const page_t *page); /*!< in: index page in ROW_FORMAT=REDUNDANT */
798 /** This function checks the consistency of an index page when we do not
799  know the index. This is also resilient so that this should never crash
800  even if the page is total garbage.
801  @return true if ok */
803  const page_t *page); /*!< in: index page in ROW_FORMAT!=REDUNDANT */
804 /** This function checks the consistency of an index page.
805  @return true if ok */
806 ibool page_validate(
807  const page_t *page, /*!< in: index page */
808  dict_index_t *index); /*!< in: data dictionary index containing
809  the page record type definition */
810 /** Looks in the page record list for a record with the given heap number.
811  @return record, NULL if not found */
813  const page_t *page, /*!< in: index page */
814  ulint heap_no); /*!< in: heap number */
815 /** Get the last non-delete-marked record on a page.
816 @param[in] page index tree leaf page
817 @return the last record, not delete-marked
818 @retval infimum record if all records are delete-marked */
820 
821 /** Issue a warning when the checksum that is stored in the page is valid,
822 but different than the global setting innodb_checksum_algorithm.
823 @param[in] curr_algo current checksum algorithm
824 @param[in] page_checksum page valid checksum
825 @param[in] page_id page identifier */
827  srv_checksum_algorithm_t page_checksum,
828  const page_id_t &page_id);
829 
830 /** Check that a page_size is correct for InnoDB.
831 If correct, set the associated page_size_shift which is the power of 2
832 for this page size.
833 @param[in] page_size Page Size to evaluate
834 @return an associated page_size_shift if valid, 0 if invalid. */
835 inline ulong page_size_validate(ulong page_size);
836 
837 /** This function checks if the page in which record is present is a
838 non-leaf node of a spatial index.
839 param[in] rec Btree record
840 param[in] index index
841 @return TRUE if ok */
842 bool page_is_spatial_non_leaf(const rec_t *rec, dict_index_t *index);
843 
844 #ifdef UNIV_MATERIALIZE
845 #undef UNIV_INLINE
846 #define UNIV_INLINE UNIV_INLINE_ORIGINAL
847 #endif
848 
849 #include "page0page.ic"
850 
851 #endif
Compressed page descriptor.
Definition: page0types.h:197
static const byte supremum_extra_data[]
Extra bytes and data bytes of a supremum record.
Definition: page0page.h:94
UNIV_INLINE ulint page_is_comp(const page_t *page)
Determine whether the page is in new-style compact format.
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, so that there are at least the minimum number of records owned by the slot; this may result in the merging of two slots.
Definition: page0page.cc:1357
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
UNIV_INLINE ulint page_get_infimum_offset(const page_t *page)
Gets the offset of the first record on the page.
UNIV_INLINE page_id_t page_get_page_id(const page_t *page)
Gets the space id and page number identifying the page.
uint32 page_no_t
Page number.
Definition: api0api.h:57
UNIV_INLINE ulint page_get_free_space_of_empty(ulint comp)
Calculates free space if a page is emptied.
UNIV_INLINE ulint page_rec_get_base_extra_size(const rec_t *rec)
Returns the base extra size of a physical record.
The low-level file system.
ulong page_size_validate(ulong page_size)
Check that a page_size is correct for InnoDB.
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
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.
The buffer control block structure.
Definition: buf0buf.h:1324
Page identifier.
Definition: buf0types.h:158
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.
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:2589
UNIV_INLINE page_t * page_align(const void *ptr)
Gets the start of a page.
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)...
mlog_id_t
Definition: mtr0types.h:62
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_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
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...
UNIV_INLINE ibool page_rec_is_infimum(const rec_t *rec)
TRUE if the record is the infimum record on a page.
UNIV_INLINE trx_id_t page_get_max_trx_id(const page_t *page)
Returns the max trx id field value.
UNIV_INLINE const rec_t * page_rec_get_next_low(const rec_t *rec, ulint comp)
Gets the pointer to the next record on the page.
UNIV_INLINE bool page_is_leaf(const page_t *page)
Determine whether the page is a B-tree leaf.
UNIV_INLINE ulint page_dir_get_n_heap(const page_t *page)
Gets the number of records in the heap.
File space management.
UNIV_INLINE const rec_t * page_dir_slot_get_rec(const page_dir_slot_t *slot)
Gets the record pointed to by a directory slot.
UNIV_INLINE rec_t * page_rec_get_next(rec_t *rec)
Gets the pointer to the next record on the page.
Index page routines.
UNIV_INLINE ulint page_dir_calc_reserved_space(ulint n_recs)
Calculates the space reserved for directory slots of a given number of records.
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.
SQL data field and tuple.
static const byte infimum_data[]
Data bytes of an infimum record.
Definition: page0page.h:90
UNIV_INLINE ulint page_header_get_field(const page_t *page, ulint field)
Reads the given header field.
UNIV_INLINE bool page_has_garbage(const page_t *page)
Determine whether the page contains garbage.
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.
UNIV_INLINE ulint page_offset(const void *ptr)
Gets the offset within a page.
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.
UNIV_INLINE rec_t * page_rec_get_prev(rec_t *rec)
Gets the pointer to the previous record.
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:196
srv_checksum_algorithm_t
Alternatives for srv_checksum_algorithm, which can be changed by setting innodb_checksum_algorithm.
Definition: buf0types.h:102
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
int page
Definition: ctype-mb.cc:1234
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.
Data dictionary system.
UNIV_INLINE const rec_t * page_rec_get_prev_const(const rec_t *rec)
Gets the pointer to the previous record.
UNIV_INLINE ibool page_rec_is_user_rec(const rec_t *rec)
TRUE if the record is a user record on the page.
UNIV_INLINE ibool page_rec_is_supremum(const rec_t *rec)
TRUE if the record is the supremum record on a page.
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_dir_slot_t page_dir_t
Definition: page0page.h:60
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
UNIV_INLINE void page_rec_set_next(rec_t *rec, const rec_t *next)
Sets the pointer to the next record on the page.
byte rec_t
Definition: rem0types.h:39
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
UNIV_INLINE ulint page_rec_is_comp(const rec_t *rec)
TRUE if the record is on a page in compact format.
UNIV_INLINE ibool page_rec_is_infimum_low(ulint offset)
TRUE if the record is the infimum record on a page.
UNIV_INLINE space_id_t page_get_space_id(const page_t *page)
Gets the tablespace identifier.
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...
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...
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
static const byte infimum_extra[]
Extra bytes of an infimum record.
Definition: page0page.h:84
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.
uint16_t page_type_t
Definition: fil0fil.h:990
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.
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
UNIV_INLINE ulint page_get_supremum_offset(const page_t *page)
Gets the offset of the last record on the page.
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.
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
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.
UNIV_INLINE node_seq_t page_get_ssn_id(const page_t *page)
Returns the RTREE SPLIT SEQUENCE NUMBER (FIL_RTREE_SPLIT_SEQ_NUM).
ulint page_dir_find_owner_slot(const rec_t *rec)
Looks for the directory slot which owns the given record.
Definition: page0page.cc:93
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
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.
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)...
UNIV_INLINE ibool page_rec_is_supremum_low(ulint offset)
TRUE if the record is the supremum record on a page.
byte page_dir_slot_t
Definition: page0page.h:59
uint32 space_id_t
Tablespace identifier.
Definition: api0api.h:59
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.
ib_id_t trx_id_t
Transaction identifier (DB_TRX_ID, DATA_TRX_ID)
Definition: trx0types.h:144
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.
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:430
UNIV_INLINE bool page_is_empty(const page_t *page)
Determine whether the page is empty.
UNIV_INLINE rec_t * page_rec_get_nth(page_t *page, ulint nth)
Returns the nth record of the record list.
ibool page_validate(const page_t *page, dict_index_t *index)
This function checks the consistency of an index page.
Definition: page0page.cc:2130
UNIV_INLINE ibool page_rec_is_user_rec_low(ulint offset)
TRUE if the record is a user record on the page.
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
UNIV_INLINE const rec_t * page_rec_get_next_const(const rec_t *rec)
Gets the pointer to the next record on the page.
int n
Definition: xcom_base.cc:442
UNIV_INLINE page_no_t page_get_page_no(const page_t *page)
Gets the page number.
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:1299
UNIV_INLINE ibool page_rec_check(const rec_t *rec)
Used to check the consistency of a record on a page.
byte page_t
Type of the index page.
Definition: page0types.h:148
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:2466
Mini-transaction buffer.
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
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.
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
UNIV_INLINE rec_t * page_rec_find_owner_rec(rec_t *rec)
Looks for the record which owns the given record.
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
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
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.
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:1525
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
unsigned char byte
Blob class.
Definition: common.h:159
UNIV_INLINE ulint page_dir_get_n_slots(const page_t *page)
Gets the number of dir slots in directory.
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.
UNIV_INLINE rec_t * page_get_middle_rec(page_t *page)
Returns the middle record of the records on the page.
Mini-transaction handle and buffer.
Definition: mtr0mtr.h:169
UNIV_INLINE ulint page_header_get_offs(const page_t *page, ulint field)
Returns the offset stored in the given header field.
UNIV_INLINE ulint page_rec_get_heap_no(const rec_t *rec)
Returns the heap number of a record.
UNIV_INLINE page_dir_slot_t * page_dir_get_nth_slot(const page_t *page, ulint n)
Gets pointer to nth directory slot.
The database buffer pool high-level routines.
UNIV_INLINE const 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.
UNIV_INLINE bool page_is_root(const page_t *page)
Determine whether a page is an index root page.
ib_uint32_t node_seq_t
Definition: gis0type.h:57
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
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:2559
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
Record manager.
Data structure for an index.
Definition: dict0mem.h:886