MySQL 9.1.0
Source Code Documentation
rem0types.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (c) 1994, 2024, Oracle and/or its affiliates.
4
5This program is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License, version 2.0, as published by the
7Free Software Foundation.
8
9This program is designed to work with certain software (including
10but not limited to OpenSSL) that is licensed under separate terms,
11as designated in a particular file or component or in included license
12documentation. The authors of MySQL hereby grant you an additional
13permission to link the program and your derivative works with the
14separately licensed software that they have either included with
15the program or referenced in the documentation.
16
17This program is distributed in the hope that it will be useful, but WITHOUT
18ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
20for more details.
21
22You should have received a copy of the GNU General Public License along with
23this program; if not, write to the Free Software Foundation, Inc.,
2451 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
26*****************************************************************************/
27
28/** @file include/rem0types.h
29 Record manager global types
30
31 Created 5/30/1994 Heikki Tuuri
32 *************************************************************************/
33
34#ifndef rem0types_h
35#define rem0types_h
36
37#include "data0type.h"
38#include "univ.i"
39
40/* We define the physical record simply as an array of bytes */
41typedef byte rec_t;
42
43/* Maximum number of rows version allowed when columns are added/dropped
44INSTANTly. After this limit is reached, any attempt to do ADD/DROP INSTANT
45column will result in error. */
46const uint8_t MAX_ROW_VERSION = 255;
47
48/* Type of Row version which is stamped on rows inserted/updated after an
49INSTANT ADD/DROP column is done. Maximum allowed row version is MAX_ROW_VERSION
50which is 255. This is stamped on rows header on disk in 1 byte. But in-memory,
51we use uint16_t to represent a row version to accommodate invalid row versions
52which is defined as INVALID_ROW_VERSION. */
53using row_version_t = uint16_t;
54
55/* Invalid row version */
57
58/* Maximum values for various fields (for non-blob tuples) */
59constexpr uint32_t REC_MAX_N_FIELDS = 1024 - 1;
60constexpr uint32_t REC_MAX_HEAP_NO = 2 * 8192 - 1;
61constexpr uint32_t REC_MAX_N_OWNED = 16 - 1;
62
63/* Maximum number of user defined fields/columns. The reserved columns
64are the ones InnoDB adds internally: DB_ROW_ID, DB_TRX_ID, DB_ROLL_PTR.
65We need "* 2" because mlog_parse_index() creates a dummy table object
66possibly, with some of the system columns in it, and then adds the 3
67system columns (again) using dict_table_add_system_columns(). The problem
68is that mlog_parse_index() cannot recognize the system columns by
69just having n_fields, n_uniq and the lengths of the columns. */
70constexpr uint32_t REC_MAX_N_USER_FIELDS =
72
73/* REC_ANTELOPE_MAX_INDEX_COL_LEN is measured in bytes and is the maximum
74indexed field length (or indexed prefix length) for indexes on tables of
75ROW_FORMAT=REDUNDANT and ROW_FORMAT=COMPACT format.
76Before we support UTF-8 encodings with mbmaxlen = 4, a UTF-8 character
77may take at most 3 bytes. So the limit was set to 3*256, so that one
78can create a column prefix index on 256 characters of a TEXT or VARCHAR
79column also in the UTF-8 charset.
80This constant MUST NOT BE CHANGED, or the compatibility of InnoDB data
81files would be at risk! */
82constexpr uint32_t REC_ANTELOPE_MAX_INDEX_COL_LEN = 768;
83
84/** Maximum indexed field length for tables that have atomic BLOBs.
85This (3072) is the maximum index row length allowed, so we cannot create index
86prefix column longer than that. */
87constexpr uint32_t REC_VERSION_56_MAX_INDEX_COL_LEN = 3072;
88
89/** Innodb row types are a subset of the MySQL global enum row_type.
90They are made into their own enum so that switch statements can account
91for each of them. */
93 REC_FORMAT_REDUNDANT = 0, /*!< REDUNDANT row format */
94 REC_FORMAT_COMPACT = 1, /*!< COMPACT row format */
95 REC_FORMAT_COMPRESSED = 2, /*!< COMPRESSED row format */
96 REC_FORMAT_DYNAMIC = 3 /*!< DYNAMIC row format */
97};
99
100#endif
Data types.
constexpr uint32_t DATA_N_SYS_COLS
number of system columns defined above
Definition: data0type.h:194
const uint8_t MAX_ROW_VERSION
Definition: rem0types.h:46
rec_format_enum
Innodb row types are a subset of the MySQL global enum row_type.
Definition: rem0types.h:92
@ REC_FORMAT_REDUNDANT
REDUNDANT row format.
Definition: rem0types.h:93
@ REC_FORMAT_COMPRESSED
COMPRESSED row format.
Definition: rem0types.h:95
@ REC_FORMAT_COMPACT
COMPACT row format.
Definition: rem0types.h:94
@ REC_FORMAT_DYNAMIC
DYNAMIC row format.
Definition: rem0types.h:96
constexpr uint32_t REC_ANTELOPE_MAX_INDEX_COL_LEN
Definition: rem0types.h:82
constexpr uint32_t REC_VERSION_56_MAX_INDEX_COL_LEN
Maximum indexed field length for tables that have atomic BLOBs.
Definition: rem0types.h:87
const row_version_t INVALID_ROW_VERSION
Definition: rem0types.h:56
byte rec_t
Definition: rem0types.h:41
enum rec_format_enum rec_format_t
Definition: rem0types.h:98
constexpr uint32_t REC_MAX_N_USER_FIELDS
Definition: rem0types.h:70
constexpr uint32_t REC_MAX_N_FIELDS
Definition: rem0types.h:59
constexpr uint32_t REC_MAX_N_OWNED
Definition: rem0types.h:61
uint16_t row_version_t
Definition: rem0types.h:53
constexpr uint32_t REC_MAX_HEAP_NO
Definition: rem0types.h:60
Version control for database, common definitions, and include files.
constexpr uint16_t UINT16_UNDEFINED
The 'undefined' value for a 16-bit unsigned integer.
Definition: univ.i:431