Debian Codegraph @

storage/innobase/include/rem0types.h

raw
1 /*****************************************************************************
2
3 Copyright (c) 1994, 2026, Oracle and/or its affiliates.
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 designed to work with certain software (including
10 but not limited to OpenSSL) that is licensed under separate terms,
11 as designated in a particular file or component or in included license
12 documentation. The authors of MySQL hereby grant you an additional
13 permission to link the program and your derivative works with the
14 separately licensed software that they have either included with
15 the program or referenced in the documentation.
16
17 This program is distributed in the hope that it will be useful, but WITHOUT
18 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19 FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
20 for more details.
21
22 You should have received a copy of the GNU General Public License along with
23 this program; if not, write to the Free Software Foundation, Inc.,
24 51 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 */
41 typedef byte rec_t;
42
43 /* Maximum values for various fields (for non-blob tuples) */
44 constexpr uint32_t REC_MAX_N_FIELDS = 1024 - 1;
45 constexpr uint32_t REC_MAX_HEAP_NO = 2 * 8192 - 1;
46 constexpr uint32_t REC_MAX_N_OWNED = 16 - 1;
47
48 /* Maximum number of user defined fields/columns. The reserved columns
49 are the ones InnoDB adds internally: DB_ROW_ID, DB_TRX_ID, DB_ROLL_PTR.
50 We need "* 2" because mlog_parse_index() creates a dummy table object
51 possibly, with some of the system columns in it, and then adds the 3
52 system columns (again) using dict_table_add_system_columns(). The problem
53 is that mlog_parse_index() cannot recognize the system columns by
54 just having n_fields, n_uniq and the lengths of the columns. */
55 constexpr uint32_t REC_MAX_N_USER_FIELDS =
56 REC_MAX_N_FIELDS - DATA_N_SYS_COLS * 2;
57
58 /* REC_ANTELOPE_MAX_INDEX_COL_LEN is measured in bytes and is the maximum
59 indexed field length (or indexed prefix length) for indexes on tables of
60 ROW_FORMAT=REDUNDANT and ROW_FORMAT=COMPACT format.
61 Before we support UTF-8 encodings with mbmaxlen = 4, a UTF-8 character
62 may take at most 3 bytes. So the limit was set to 3*256, so that one
63 can create a column prefix index on 256 characters of a TEXT or VARCHAR
64 column also in the UTF-8 charset.
65 This constant MUST NOT BE CHANGED, or the compatibility of InnoDB data
66 files would be at risk! */
67 constexpr uint32_t REC_ANTELOPE_MAX_INDEX_COL_LEN = 768;
68
69 /** Maximum indexed field length for tables that have atomic BLOBs.
70 This (3072) is the maximum index row length allowed, so we cannot create index
71 prefix column longer than that. */
72 constexpr uint32_t REC_VERSION_56_MAX_INDEX_COL_LEN = 3072;
73
74 /** Innodb row types are a subset of the MySQL global enum row_type.
75 They are made into their own enum so that switch statements can account
76 for each of them. */
77 enum rec_format_enum {
78 REC_FORMAT_REDUNDANT = 0, /*!< REDUNDANT row format */
79 REC_FORMAT_COMPACT = 1, /*!< COMPACT row format */
80 REC_FORMAT_COMPRESSED = 2, /*!< COMPRESSED row format */
81 REC_FORMAT_DYNAMIC = 3 /*!< DYNAMIC row format */
82 };
83 typedef enum rec_format_enum rec_format_t;
84
85 #endif