MySQL 8.0.31
Source Code Documentation
page0types.h File Reference

Index page routines. More...

#include "dict0types.h"
#include "fsp0types.h"
#include "mtr0types.h"
#include "univ.i"
#include "ut0new.h"
#include <map>

Go to the source code of this file.

Classes

struct  page_zip_des_t
 Compressed page descriptor. More...
 
struct  page_zip_stat_t
 Compression statistics for a given page size. More...
 

Macros

#define PAGE_OLD_INFIMUM   (PAGE_DATA + 1 + REC_N_OLD_EXTRA_BYTES)
 offset of the page infimum record on an old-style page More...
 
#define PAGE_OLD_SUPREMUM   (PAGE_DATA + 2 + 2 * REC_N_OLD_EXTRA_BYTES + 8)
 offset of the page supremum record on an old-style page More...
 
#define PAGE_OLD_SUPREMUM_END   (PAGE_OLD_SUPREMUM + 9)
 offset of the page supremum record end on an old-style page More...
 
#define PAGE_NEW_INFIMUM   (PAGE_DATA + REC_N_NEW_EXTRA_BYTES)
 offset of the page infimum record on a new-style compact page More...
 
#define PAGE_NEW_SUPREMUM   (PAGE_DATA + 2 * REC_N_NEW_EXTRA_BYTES + 8)
 offset of the page supremum record on a new-style compact page More...
 
#define PAGE_NEW_SUPREMUM_END   (PAGE_NEW_SUPREMUM + 8)
 offset of the page supremum record end on a new-style compact page More...
 
#define page_t   ib_page_t
 Eliminates a name collision on HP-UX. More...
 

Typedefs

typedef byte page_header_t
 
typedef byte page_t
 Type of the index page. More...
 
typedef byte page_zip_t
 Compressed index page. More...
 
typedef std::map< index_id_t, page_zip_stat_t, std::less< index_id_t >, ut::allocator< std::pair< const index_id_t, page_zip_stat_t > > > page_zip_stat_per_index_t
 Compression statistics types. More...
 

Enumerations

enum  cursor_direction_t : uint8_t {
  PAGE_LEFT = 1 , PAGE_RIGHT = 2 , PAGE_SAME_REC = 3 , PAGE_SAME_PAGE = 4 ,
  PAGE_NO_DIRECTION = 5
}
 
enum  page_cur_mode_t {
  PAGE_CUR_UNSUPP = 0 , PAGE_CUR_G = 1 , PAGE_CUR_GE = 2 , PAGE_CUR_L = 3 ,
  PAGE_CUR_LE = 4 , PAGE_CUR_CONTAIN = 7 , PAGE_CUR_INTERSECT = 8 , PAGE_CUR_WITHIN = 9 ,
  PAGE_CUR_DISJOINT = 10 , PAGE_CUR_MBR_EQUAL = 11 , PAGE_CUR_RTREE_INSERT = 12 , PAGE_CUR_RTREE_LOCATE = 13 ,
  PAGE_CUR_RTREE_GET_FATHER = 14
}
 

Functions

void page_zip_rec_set_deleted (page_zip_des_t *page_zip, const byte *rec, bool flag)
 Write the "deleted" flag of a record on a compressed page. More...
 
void page_zip_rec_set_owned (page_zip_des_t *page_zip, const byte *rec, ulint flag)
 Write the "owned" flag of a record on a compressed page. More...
 
void page_zip_dir_delete (page_zip_des_t *page_zip, byte *rec, dict_index_t *index, const ulint *offsets, const byte *free)
 Shift the dense page directory when a record is deleted. More...
 
void page_zip_dir_add_slot (page_zip_des_t *page_zip, bool is_clustered)
 Add a slot to the dense page directory. More...
 

Variables

constexpr uint32_t PAGE_HEADER = FSEG_PAGE_DATA
 index page header starts at this offset More...
 
constexpr uint32_t PAGE_N_DIR_SLOTS = 0
 number of slots in page directory More...
 
constexpr uint32_t PAGE_HEAP_TOP = 2
 pointer to record heap top More...
 
constexpr uint32_t PAGE_N_HEAP = 4
 number of records in the heap, bit 15=flag: new-style compact page format More...
 
constexpr uint32_t PAGE_FREE = 6
 pointer to start of page free record list More...
 
constexpr uint32_t PAGE_GARBAGE = 8
 number of bytes in deleted records More...
 
constexpr uint32_t PAGE_LAST_INSERT = 10
 pointer to the last inserted record, or NULL if this info has been reset by a delete, for example More...
 
constexpr uint32_t PAGE_DIRECTION = 12
 last insert direction: PAGE_LEFT, ... More...
 
constexpr uint32_t PAGE_N_DIRECTION = 14
 number of consecutive inserts to the same direction More...
 
constexpr uint32_t PAGE_N_RECS = 16
 number of user records on the page More...
 
constexpr uint32_t PAGE_MAX_TRX_ID = 18
 highest id of a trx which may have modified a record on the page; trx_id_t; defined only in secondary indexes and in the insert buffer tree More...
 
constexpr uint32_t PAGE_HEADER_PRIV_END = 26
 end of private data structure of the page header which are set in a page create More...
 
constexpr uint32_t PAGE_LEVEL = 26
 level of the node in an index tree; the leaf level is the level 0. More...
 
constexpr uint32_t PAGE_INDEX_ID = 28
 index id where the page belongs. More...
 
constexpr uint32_t PAGE_BTR_SEG_LEAF = 36
 file segment header for the leaf pages in a B-tree: defined only on the root page of a B-tree, but not in the root of an ibuf tree More...
 
constexpr uint32_t PAGE_BTR_IBUF_FREE_LIST = PAGE_BTR_SEG_LEAF
 
constexpr uint32_t PAGE_BTR_IBUF_FREE_LIST_NODE = PAGE_BTR_SEG_LEAF
 
constexpr uint32_t PAGE_BTR_SEG_TOP = 36 + FSEG_HEADER_SIZE
 
constexpr uint32_t PAGE_DATA = PAGE_HEADER + 36 + 2 * FSEG_HEADER_SIZE
 start of data on the page More...
 
constexpr ulint PAGE_HEAP_NO_INFIMUM = 0
 Page infimum. More...
 
constexpr ulint PAGE_HEAP_NO_SUPREMUM = 1
 Page supremum. More...
 
constexpr ulint PAGE_HEAP_NO_USER_LOW = 2
 First user record in creation (insertion) order, not necessarily collation order; this record may have been deleted. More...
 
constexpr uint8_t PAGE_ZIP_SSIZE_BITS = 3
 Number of bits needed for representing different compressed page sizes. More...
 
constexpr uint32_t PAGE_ZIP_SSIZE_MAX
 Maximum compressed page shift size. More...
 
page_zip_stat_t page_zip_stat [PAGE_ZIP_SSIZE_MAX]
 Statistics on compression, indexed by page_zip_des_t::ssize - 1. More...
 
page_zip_stat_per_index_t page_zip_stat_per_index
 Statistics on compression, indexed by dict_index_t::id. More...
 

Detailed Description

Index page routines.

Created 2/2/1994 Heikki Tuuri

Macro Definition Documentation

◆ PAGE_NEW_INFIMUM

#define PAGE_NEW_INFIMUM   (PAGE_DATA + REC_N_NEW_EXTRA_BYTES)

offset of the page infimum record on a new-style compact page

◆ PAGE_NEW_SUPREMUM

#define PAGE_NEW_SUPREMUM   (PAGE_DATA + 2 * REC_N_NEW_EXTRA_BYTES + 8)

offset of the page supremum record on a new-style compact page

◆ PAGE_NEW_SUPREMUM_END

#define PAGE_NEW_SUPREMUM_END   (PAGE_NEW_SUPREMUM + 8)

offset of the page supremum record end on a new-style compact page

◆ PAGE_OLD_INFIMUM

#define PAGE_OLD_INFIMUM   (PAGE_DATA + 1 + REC_N_OLD_EXTRA_BYTES)

offset of the page infimum record on an old-style page

◆ PAGE_OLD_SUPREMUM

#define PAGE_OLD_SUPREMUM   (PAGE_DATA + 2 + 2 * REC_N_OLD_EXTRA_BYTES + 8)

offset of the page supremum record on an old-style page

◆ PAGE_OLD_SUPREMUM_END

#define PAGE_OLD_SUPREMUM_END   (PAGE_OLD_SUPREMUM + 9)

offset of the page supremum record end on an old-style page

◆ page_t

#define page_t   ib_page_t

Eliminates a name collision on HP-UX.

Typedef Documentation

◆ page_header_t

◆ page_t

typedef byte page_t

Type of the index page.

◆ page_zip_stat_per_index_t

Compression statistics types.

◆ page_zip_t

typedef byte page_zip_t

Compressed index page.

Enumeration Type Documentation

◆ cursor_direction_t

enum cursor_direction_t : uint8_t
Enumerator
PAGE_LEFT 
PAGE_RIGHT 
PAGE_SAME_REC 
PAGE_SAME_PAGE 
PAGE_NO_DIRECTION 

◆ page_cur_mode_t

Enumerator
PAGE_CUR_UNSUPP 
PAGE_CUR_G 
PAGE_CUR_GE 
PAGE_CUR_L 
PAGE_CUR_LE 
PAGE_CUR_CONTAIN 
PAGE_CUR_INTERSECT 
PAGE_CUR_WITHIN 
PAGE_CUR_DISJOINT 
PAGE_CUR_MBR_EQUAL 
PAGE_CUR_RTREE_INSERT 
PAGE_CUR_RTREE_LOCATE 
PAGE_CUR_RTREE_GET_FATHER 

Function Documentation

◆ page_zip_dir_add_slot()

void page_zip_dir_add_slot ( page_zip_des_t page_zip,
bool  is_clustered 
)

Add a slot to the dense page directory.

Parameters
[in,out]page_zipCompressed page
[in]is_clusteredNonzero for clustered index, zero for others

◆ page_zip_dir_delete()

void page_zip_dir_delete ( page_zip_des_t page_zip,
byte rec,
dict_index_t index,
const ulint offsets,
const byte free 
)

Shift the dense page directory when a record is deleted.

Parameters
[in,out]page_zipcompressed page
[in]recdeleted record
[in]indexindex of rec
[in]offsetsrec_get_offsets(rec)
[in]freeprevious start of the free list

◆ page_zip_rec_set_deleted()

void page_zip_rec_set_deleted ( page_zip_des_t page_zip,
const byte rec,
bool  flag 
)

Write the "deleted" flag of a record on a compressed page.

The flag must already have been written on the uncompressed page. in: the deleted flag (nonzero=true)

The flag must already have been written on the uncompressed page.

Parameters
page_zipin/out: compressed page
recin: record on the uncompressed page
flagin: the deleted flag (nonzero=true)

◆ page_zip_rec_set_owned()

void page_zip_rec_set_owned ( page_zip_des_t page_zip,
const byte rec,
ulint  flag 
)

Write the "owned" flag of a record on a compressed page.

The n_owned field must already have been written on the uncompressed page.

Parameters
[in,out]page_zipCompressed page
[in]recRecord on the uncompressed page
[in]flagThe owned flag (nonzero=true)

Variable Documentation

◆ PAGE_BTR_IBUF_FREE_LIST

constexpr uint32_t PAGE_BTR_IBUF_FREE_LIST = PAGE_BTR_SEG_LEAF
constexpr

◆ PAGE_BTR_IBUF_FREE_LIST_NODE

constexpr uint32_t PAGE_BTR_IBUF_FREE_LIST_NODE = PAGE_BTR_SEG_LEAF
constexpr

◆ PAGE_BTR_SEG_LEAF

constexpr uint32_t PAGE_BTR_SEG_LEAF = 36
constexpr

file segment header for the leaf pages in a B-tree: defined only on the root page of a B-tree, but not in the root of an ibuf tree

◆ PAGE_BTR_SEG_TOP

constexpr uint32_t PAGE_BTR_SEG_TOP = 36 + FSEG_HEADER_SIZE
constexpr

◆ PAGE_DATA

constexpr uint32_t PAGE_DATA = PAGE_HEADER + 36 + 2 * FSEG_HEADER_SIZE
constexpr

start of data on the page

◆ PAGE_DIRECTION

constexpr uint32_t PAGE_DIRECTION = 12
constexpr

last insert direction: PAGE_LEFT, ...

◆ PAGE_FREE

constexpr uint32_t PAGE_FREE = 6
constexpr

pointer to start of page free record list

◆ PAGE_GARBAGE

constexpr uint32_t PAGE_GARBAGE = 8
constexpr

number of bytes in deleted records

◆ PAGE_HEADER

constexpr uint32_t PAGE_HEADER = FSEG_PAGE_DATA
constexpr

index page header starts at this offset

◆ PAGE_HEADER_PRIV_END

constexpr uint32_t PAGE_HEADER_PRIV_END = 26
constexpr

end of private data structure of the page header which are set in a page create

◆ PAGE_HEAP_NO_INFIMUM

constexpr ulint PAGE_HEAP_NO_INFIMUM = 0
constexpr

Page infimum.

◆ PAGE_HEAP_NO_SUPREMUM

constexpr ulint PAGE_HEAP_NO_SUPREMUM = 1
constexpr

Page supremum.

◆ PAGE_HEAP_NO_USER_LOW

constexpr ulint PAGE_HEAP_NO_USER_LOW = 2
constexpr

First user record in creation (insertion) order, not necessarily collation order; this record may have been deleted.

◆ PAGE_HEAP_TOP

constexpr uint32_t PAGE_HEAP_TOP = 2
constexpr

pointer to record heap top

◆ PAGE_INDEX_ID

constexpr uint32_t PAGE_INDEX_ID = 28
constexpr

index id where the page belongs.

This field should not be written to after page creation.

◆ PAGE_LAST_INSERT

constexpr uint32_t PAGE_LAST_INSERT = 10
constexpr

pointer to the last inserted record, or NULL if this info has been reset by a delete, for example

◆ PAGE_LEVEL

constexpr uint32_t PAGE_LEVEL = 26
constexpr

level of the node in an index tree; the leaf level is the level 0.

This field should not be written to after page creation.

◆ PAGE_MAX_TRX_ID

constexpr uint32_t PAGE_MAX_TRX_ID = 18
constexpr

highest id of a trx which may have modified a record on the page; trx_id_t; defined only in secondary indexes and in the insert buffer tree

◆ PAGE_N_DIR_SLOTS

constexpr uint32_t PAGE_N_DIR_SLOTS = 0
constexpr

number of slots in page directory

◆ PAGE_N_DIRECTION

constexpr uint32_t PAGE_N_DIRECTION = 14
constexpr

number of consecutive inserts to the same direction

◆ PAGE_N_HEAP

constexpr uint32_t PAGE_N_HEAP = 4
constexpr

number of records in the heap, bit 15=flag: new-style compact page format

◆ PAGE_N_RECS

constexpr uint32_t PAGE_N_RECS = 16
constexpr

number of user records on the page

◆ PAGE_ZIP_SSIZE_BITS

constexpr uint8_t PAGE_ZIP_SSIZE_BITS = 3
constexpr

Number of bits needed for representing different compressed page sizes.

◆ PAGE_ZIP_SSIZE_MAX

constexpr uint32_t PAGE_ZIP_SSIZE_MAX
constexpr
Initial value:
=
constexpr uint32_t UNIV_ZIP_SIZE_SHIFT_MIN
log2 of smallest compressed page size (1<<10 == 1024 bytes) Note: This must never change!
Definition: univ.i:299
constexpr uint32_t UNIV_ZIP_SIZE_SHIFT_MAX
log2 of largest compressed page size (1<<14 == 16384 bytes).
Definition: univ.i:307

Maximum compressed page shift size.

◆ page_zip_stat

page_zip_stat_t page_zip_stat[PAGE_ZIP_SSIZE_MAX]
extern

Statistics on compression, indexed by page_zip_des_t::ssize - 1.

◆ page_zip_stat_per_index

page_zip_stat_per_index_t page_zip_stat_per_index
extern

Statistics on compression, indexed by dict_index_t::id.

Statistics on compression, indexed by dict_index_t::id.