1/*****************************************************************************
2
3Copyright (c) 1994, 2015, Oracle and/or its affiliates. All Rights Reserved.
4
5This program is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License as published by the Free Software
7Foundation; version 2 of the License.
8
9This program is distributed in the hope that it will be useful, but WITHOUT
10ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
13You should have received a copy of the GNU General Public License along with
14this program; if not, write to the Free Software Foundation, Inc.,
1551 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
16
17*****************************************************************************/
18
19/********************************************************************//**
20@file include/rem0types.h
21Record manager global types
22
23Created 5/30/1994 Heikki Tuuri
24*************************************************************************/
25
26#ifndef rem0types_h
27#define rem0types_h
28
29/* We define the physical record simply as an array of bytes */
30typedef byte rec_t;
31
32/* Maximum values for various fields (for non-blob tuples) */
33#define REC_MAX_N_FIELDS (1024 - 1)
34#define REC_MAX_HEAP_NO (2 * 8192 - 1)
35#define REC_MAX_N_OWNED (16 - 1)
36
37/* Maximum number of user defined fields/columns. The reserved columns
38are the ones InnoDB adds internally: DB_ROW_ID, DB_TRX_ID, DB_ROLL_PTR.
39We need "* 2" because mlog_parse_index() creates a dummy table object
40possibly, with some of the system columns in it, and then adds the 3
41system columns (again) using dict_table_add_system_columns(). The problem
42is that mlog_parse_index() cannot recognize the system columns by
43just having n_fields, n_uniq and the lengths of the columns. */
44#define REC_MAX_N_USER_FIELDS (REC_MAX_N_FIELDS - DATA_N_SYS_COLS * 2)
45
46/* REC_ANTELOPE_MAX_INDEX_COL_LEN is measured in bytes and is the maximum
47indexed field length (or indexed prefix length) for indexes on tables of
48ROW_FORMAT=REDUNDANT and ROW_FORMAT=COMPACT format.
49Before we support UTF-8 encodings with mbmaxlen = 4, a UTF-8 character
50may take at most 3 bytes. So the limit was set to 3*256, so that one
51can create a column prefix index on 256 characters of a TEXT or VARCHAR
52column also in the UTF-8 charset.
53This constant MUST NOT BE CHANGED, or the compatibility of InnoDB data
54files would be at risk! */
55#define REC_ANTELOPE_MAX_INDEX_COL_LEN 768
56
57/** Maximum indexed field length for tables that have atomic BLOBs.
58This (3072) is the maximum index row length allowed, so we cannot create index
59prefix column longer than that. */
60#define REC_VERSION_56_MAX_INDEX_COL_LEN 3072
61
62/** Innodb row types are a subset of the MySQL global enum row_type.
63They are made into their own enum so that switch statements can account
64for each of them. */
65enum rec_format_enum {
66 REC_FORMAT_REDUNDANT = 0, /*!< REDUNDANT row format */
67 REC_FORMAT_COMPACT = 1, /*!< COMPACT row format */
68 REC_FORMAT_COMPRESSED = 2, /*!< COMPRESSED row format */
69 REC_FORMAT_DYNAMIC = 3 /*!< DYNAMIC row format */
70};
71typedef enum rec_format_enum rec_format_t;
72
73#endif
74