| 1 | /***************************************************************************** |
| 2 | |
| 3 | Copyright (c) 1994, 2015, 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 as published by the Free Software |
| 7 | Foundation; version 2 of the License. |
| 8 | |
| 9 | This program is distributed in the hope that it will be useful, but WITHOUT |
| 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 11 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
| 12 | |
| 13 | You should have received a copy of the GNU General Public License along with |
| 14 | this program; if not, write to the Free Software Foundation, Inc., |
| 15 | 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA |
| 16 | |
| 17 | *****************************************************************************/ |
| 18 | |
| 19 | /********************************************************************//** |
| 20 | @file include/rem0types.h |
| 21 | Record manager global types |
| 22 | |
| 23 | Created 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 */ |
| 30 | typedef 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 |
| 38 | are the ones InnoDB adds internally: DB_ROW_ID, DB_TRX_ID, DB_ROLL_PTR. |
| 39 | We need "* 2" because mlog_parse_index() creates a dummy table object |
| 40 | possibly, with some of the system columns in it, and then adds the 3 |
| 41 | system columns (again) using dict_table_add_system_columns(). The problem |
| 42 | is that mlog_parse_index() cannot recognize the system columns by |
| 43 | just 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 |
| 47 | indexed field length (or indexed prefix length) for indexes on tables of |
| 48 | ROW_FORMAT=REDUNDANT and ROW_FORMAT=COMPACT format. |
| 49 | Before we support UTF-8 encodings with mbmaxlen = 4, a UTF-8 character |
| 50 | may take at most 3 bytes. So the limit was set to 3*256, so that one |
| 51 | can create a column prefix index on 256 characters of a TEXT or VARCHAR |
| 52 | column also in the UTF-8 charset. |
| 53 | This constant MUST NOT BE CHANGED, or the compatibility of InnoDB data |
| 54 | files 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. |
| 58 | This (3072) is the maximum index row length allowed, so we cannot create index |
| 59 | prefix 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. |
| 63 | They are made into their own enum so that switch statements can account |
| 64 | for each of them. */ |
| 65 | enum 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 | }; |
| 71 | typedef enum rec_format_enum rec_format_t; |
| 72 | |
| 73 | #endif |
| 74 | |