MySQL 8.4.3
Source Code Documentation
|
Version control for database, common definitions, and include files. More...
#include "m_string.h"
#include "my_thread.h"
#include <limits>
#include <sys/stat.h>
#include "my_psi_config.h"
#include <sched.h>
#include <sys/mman.h>
#include "my_config.h"
#include <inttypes.h>
#include <stdint.h>
#include <unistd.h>
#include "mysql/psi/mysql_file.h"
#include "mysql/psi/mysql_mutex.h"
#include "mysql/psi/mysql_rwlock.h"
#include "mysql/psi/mysql_thread.h"
#include "pfs_file_provider.h"
#include "pfs_mutex_provider.h"
#include "pfs_rwlock_provider.h"
#include "pfs_thread_provider.h"
#include <stdio.h>
#include "db0err.h"
#include "sync0types.h"
#include "ut0dbg.h"
#include "ut0lst.h"
#include "ut0ut.h"
Macros | |
#define | univ_i |
#define | _IB_TO_STR(s) #s |
#define | IB_TO_STR(s) _IB_TO_STR(s) |
#define | INNODB_VERSION_MAJOR MYSQL_VERSION_MAJOR |
#define | INNODB_VERSION_MINOR MYSQL_VERSION_MINOR |
#define | INNODB_VERSION_BUGFIX MYSQL_VERSION_PATCH |
#define | INNODB_VERSION_SHORT (INNODB_VERSION_MAJOR << 8 | INNODB_VERSION_MINOR) |
#define | INNODB_VERSION_STR |
#define | REFMAN |
#define | UNIV_PFS_MUTEX |
#define | UNIV_PFS_RWLOCK |
#define | UNIV_PFS_IO |
#define | UNIV_PFS_THREAD |
#define | UNIV_PFS_MEMORY |
#define | UNIV_BTR_DEBUG /* check B-tree links */ |
#define | UNIV_LIGHT_MEM_DEBUG /* light memory debugging */ |
#define | UNIV_COLD /* empty */ |
#define | UNIV_PAGE_SIZE_SHIFT srv_page_size_shift |
The 2-logarithm of UNIV_PAGE_SIZE: More... | |
#define | UNIV_PAGE_SIZE ((ulint)srv_page_size) |
The universal page size of the database. More... | |
#define | UNIV_PAGE_SSIZE_MAX static_cast<ulint>(UNIV_PAGE_SIZE_SHIFT - UNIV_ZIP_SIZE_SHIFT_MIN + 1) |
Largest possible ssize for an uncompressed page. More... | |
#define | UNIV_PAGE_SSIZE_MIN static_cast<ulint>(UNIV_PAGE_SIZE_SHIFT_MIN - UNIV_ZIP_SIZE_SHIFT_MIN + 1) |
Smallest possible ssize for an uncompressed page. More... | |
#define | UINT16PF "%" PRIu16 |
#define | UINT32PF "%" PRIu32 |
#define | UINT32PFS PRIu32 |
#define | UINT64PF "%" PRIu64 |
#define | UINT64PFx "%016" PRIx64 |
#define | IB_ID_FMT UINT64PF |
#define | ULINTPFS "lu" |
#define | ULINTPF "%" ULINTPFS |
#define | SPACE_ID_PF UINT32PF |
#define | SPACE_ID_PFS UINT32PFS |
#define | PAGE_NO_PF UINT32PF |
#define | PAGE_ID_PF "page " SPACE_ID_PF ":" PAGE_NO_PF |
#define | UNIV_NOTHROW |
#define | UNIV_EXPECT(expr, value) expr |
#define | UNIV_LIKELY_NULL(expr) expr |
#define | UNIV_PREFETCH_R(addr) ((void)0) |
#define | UNIV_PREFETCH_RW(addr) ((void)0) |
#define | UNIV_LIKELY(cond) UNIV_EXPECT(cond, true) |
#define | UNIV_UNLIKELY(cond) UNIV_EXPECT(cond, false) |
#define | UT_ARR_SIZE(a) (sizeof(a) / sizeof((a)[0])) |
#define | OS_PATH_SEPARATOR_STR "/" |
#define | OS_PATH_SEPARATOR '/' |
#define | OS_PATH_SEPARATOR_ALT '\\' |
#define | UNIV_MEM_VALID(addr, size) |
#define | UNIV_MEM_INVALID(addr, size) |
#define | UNIV_MEM_FREE(addr, size) |
#define | UNIV_MEM_ALLOC(addr, size) |
#define | UNIV_MEM_DESC(addr, size) |
#define | UNIV_MEM_UNDESC(b) |
#define | UNIV_MEM_ASSERT_RW_LOW(addr, size, should_abort) |
#define | UNIV_MEM_ASSERT_RW(addr, size) |
#define | UNIV_MEM_ASSERT_RW_ABORT(addr, size) |
#define | UNIV_MEM_ASSERT_W(addr, size) |
#define | UNIV_MEM_TRASH(addr, c, size) |
#define | UNIV_MEM_ASSERT_AND_FREE(addr, size) |
#define | UNIV_MEM_ASSERT_AND_ALLOC(addr, size) |
#define | INNODB_DD_TABLE(name, n_indexes) { name, n_indexes } |
Hard-coded data dictionary entry. More... | |
#define | IF_DEBUG(...) __VA_ARGS__ |
#define | IF_ENABLED(s, ...) |
#define | IF_AHI_DEBUG(...) __VA_ARGS__ |
Typedefs | |
using | byte = unsigned char |
typedef unsigned long int | ulint |
typedef long int | lint |
typedef uint64_t | ib_id_t |
The generic InnoDB system object identifier data type. More... | |
typedef uint32_t | page_no_t |
Page number. More... | |
typedef uint32_t | space_id_t |
Tablespace identifier. More... | |
typedef void * | os_thread_ret_t |
using | Col_offsets_t = ulint |
Functions | |
template<typename T > | |
void | call_destructor (T *p) |
Explicitly call the destructor, this is to get around Clang bug#12350. More... | |
template<typename T > | |
constexpr auto | to_int (T v) -> typename std::underlying_type< T >::type |
Variables | |
constexpr size_t | UNIV_WORD_SIZE = SIZEOF_LONG |
MySQL config.h generated by CMake will define SIZEOF_LONG in Posix. More... | |
constexpr uint32_t | UNIV_MEM_ALIGNMENT = 8 |
The following alignment is used in memory allocations in memory heap management to ensure correct alignment for doubles etc. More... | |
constexpr uint32_t | UNIV_ZIP_SIZE_SHIFT_MIN = 10 |
log2 of smallest compressed page size (1<<10 == 1024 bytes) Note: This must never change! More... | |
constexpr uint32_t | UNIV_ZIP_SIZE_SHIFT_MAX = 14 |
log2 of largest compressed page size (1<<14 == 16384 bytes). More... | |
constexpr uint32_t | UNIV_PAGE_SIZE_SHIFT_MIN = 12 |
Minimum Page Size Shift (power of 2) More... | |
constexpr uint32_t | UNIV_PAGE_SIZE_SHIFT_MAX = 16 |
Maximum Page Size Shift (power of 2) More... | |
constexpr uint32_t | UNIV_PAGE_SIZE_SHIFT_DEF = 14 |
Default Page Size Shift (power of 2) More... | |
constexpr uint32_t | UNIV_PAGE_SIZE_SHIFT_ORIG = 14 |
Original 16k InnoDB Page Size Shift, in case the default changes. More... | |
constexpr uint32_t | UNIV_PAGE_SSIZE_ORIG = UNIV_PAGE_SIZE_SHIFT_ORIG - 9 |
Original 16k InnoDB Page Size as an ssize (log2 - 9) More... | |
constexpr uint32_t | UNIV_PAGE_SIZE_MIN = 1 << UNIV_PAGE_SIZE_SHIFT_MIN |
Minimum page size InnoDB currently supports. More... | |
constexpr size_t | UNIV_PAGE_SIZE_MAX = 1 << UNIV_PAGE_SIZE_SHIFT_MAX |
Maximum page size InnoDB currently supports. More... | |
constexpr uint32_t | UNIV_PAGE_SIZE_DEF = 1 << UNIV_PAGE_SIZE_SHIFT_DEF |
Default page size for InnoDB tablespaces. More... | |
constexpr uint32_t | UNIV_PAGE_SIZE_ORIG = 1 << UNIV_PAGE_SIZE_SHIFT_ORIG |
Original 16k page size for InnoDB tablespaces. More... | |
constexpr uint32_t | UNIV_ZIP_SIZE_MIN = 1 << UNIV_ZIP_SIZE_SHIFT_MIN |
Smallest compressed page size. More... | |
constexpr uint32_t | UNIV_ZIP_SIZE_MAX = 1 << UNIV_ZIP_SIZE_SHIFT_MAX |
Largest compressed page size. More... | |
constexpr uint32_t | UNIV_MAX_PARALLELISM = 32 |
Maximum number of parallel threads in a parallelized operation. More... | |
constexpr uint32_t | FILENAME_CHARSET_MAXNAMLEN = 5 |
This is the "mbmaxlen" for my_charset_filename (defined in strings/ctype-utf8.c), which is used to encode File and Database names. More... | |
constexpr uint32_t | MAX_TABLE_NAME_LEN = 320 |
The maximum length of an encode table name in bytes. More... | |
constexpr uint32_t | MAX_DATABASE_NAME_LEN = MAX_TABLE_NAME_LEN |
The maximum length of a database name. More... | |
constexpr uint32_t | MAX_FULL_NAME_LEN |
MAX_FULL_NAME_LEN defines the full name path including the database name and table name. More... | |
constexpr uint32_t | MAX_COMPRESSION_LEN = 4 |
Maximum length of the compression algorithm string. More... | |
constexpr ulint | ULINT_UNDEFINED = ~ulint{0U} |
The 'undefined' value for a ulint. More... | |
constexpr ulong | ULONG_UNDEFINED = ~0UL |
constexpr uint64_t | UINT64_UNDEFINED = ~0ULL |
The 'undefined' value for a 64-bit unsigned integer. More... | |
constexpr uint32_t | UINT32_UNDEFINED = ~0U |
The 'undefined' value for a 32-bit unsigned integer. More... | |
constexpr uint16_t | UINT16_UNDEFINED = std::numeric_limits<uint16_t>::max() |
The 'undefined' value for a 16-bit unsigned integer. More... | |
constexpr uint8_t | UINT8_UNDEFINED = std::numeric_limits<uint8_t>::max() |
The 'undefined' value for a 8-bit unsigned integer. More... | |
constexpr uint32_t | UINT32_MASK = 0xFFFFFFFF |
The bitmask of 32-bit unsigned integer. More... | |
constexpr ulint | ULINT_MAX = std::numeric_limits<ulint>::max() - 1 |
Maximum value for a ulint. More... | |
constexpr ib_id_t | IB_ID_MAX = std::numeric_limits<uint64_t>::max() |
constexpr uint32_t | UNIV_SQL_NULL = UINT32_UNDEFINED |
The following number as the length of a logical field means that the field has the SQL NULL as its value. More... | |
constexpr auto | UNIV_SQL_ADD_COL_DEFAULT = UNIV_SQL_NULL - 1 |
Flag to indicate a field which was added instantly. More... | |
constexpr auto | UNIV_NO_INDEX_VALUE = UNIV_SQL_ADD_COL_DEFAULT - 1 |
The following number as the length of a logical field means that no attribute value for the multi-value index exists in the JSON doc. More... | |
const uint32_t | UNIV_MULTI_VALUE_ARRAY_MARKER = UNIV_NO_INDEX_VALUE - 1 |
The following number as the length marker of a logical field, which is only used for multi-value field data, means the data itself of the field is actually an array. More... | |
constexpr auto | UNIV_SQL_INSTANT_DROP_COL = UNIV_MULTI_VALUE_ARRAY_MARKER - 1 |
Flag to indicate a field which was dropped instantly. More... | |
constexpr uint32_t | UNIV_EXTERN_STORAGE_FIELD |
Lengths which are not UNIV_SQL_NULL, but bigger than the following number indicate that a field contains a reference to an externally stored part of the field in the tablespace. More... | |
ulong | srv_page_size_shift |
ulong | srv_page_size |
static const size_t | UNIV_SECTOR_SIZE = 512 |
constexpr uint32_t | SPDIMS = 2 |
static constexpr std::chrono::seconds | PRINT_INTERVAL {10} |
If we are doing something that takes longer than this many seconds then print an informative message. More... | |
Version control for database, common definitions, and include files.
Created 1/20/1994 Heikki Tuuri
#define _IB_TO_STR | ( | s | ) | #s |
#define IB_ID_FMT UINT64PF |
#define IB_TO_STR | ( | s | ) | _IB_TO_STR(s) |
#define IF_AHI_DEBUG | ( | ... | ) | __VA_ARGS__ |
#define IF_DEBUG | ( | ... | ) | __VA_ARGS__ |
#define IF_ENABLED | ( | s, | |
... | |||
) |
#define INNODB_VERSION_BUGFIX MYSQL_VERSION_PATCH |
#define INNODB_VERSION_MAJOR MYSQL_VERSION_MAJOR |
#define INNODB_VERSION_MINOR MYSQL_VERSION_MINOR |
#define INNODB_VERSION_SHORT (INNODB_VERSION_MAJOR << 8 | INNODB_VERSION_MINOR) |
#define INNODB_VERSION_STR |
#define OS_PATH_SEPARATOR '/' |
#define OS_PATH_SEPARATOR_ALT '\\' |
#define OS_PATH_SEPARATOR_STR "/" |
#define PAGE_ID_PF "page " SPACE_ID_PF ":" PAGE_NO_PF |
#define PAGE_NO_PF UINT32PF |
#define REFMAN |
#define SPACE_ID_PF UINT32PF |
#define SPACE_ID_PFS UINT32PFS |
#define UINT16PF "%" PRIu16 |
#define UINT32PF "%" PRIu32 |
#define UINT32PFS PRIu32 |
#define UINT64PF "%" PRIu64 |
#define UINT64PFx "%016" PRIx64 |
#define ULINTPF "%" ULINTPFS |
#define ULINTPFS "lu" |
#define UNIV_BTR_DEBUG /* check B-tree links */ |
#define UNIV_COLD /* empty */ |
#define UNIV_EXPECT | ( | expr, | |
value | |||
) | expr |
#define univ_i |
#define UNIV_LIGHT_MEM_DEBUG /* light memory debugging */ |
#define UNIV_LIKELY | ( | cond | ) | UNIV_EXPECT(cond, true) |
#define UNIV_LIKELY_NULL | ( | expr | ) | expr |
#define UNIV_MEM_ALLOC | ( | addr, | |
size | |||
) |
#define UNIV_MEM_ASSERT_AND_ALLOC | ( | addr, | |
size | |||
) |
#define UNIV_MEM_ASSERT_AND_FREE | ( | addr, | |
size | |||
) |
#define UNIV_MEM_ASSERT_RW | ( | addr, | |
size | |||
) |
#define UNIV_MEM_ASSERT_RW_ABORT | ( | addr, | |
size | |||
) |
#define UNIV_MEM_ASSERT_RW_LOW | ( | addr, | |
size, | |||
should_abort | |||
) |
#define UNIV_MEM_ASSERT_W | ( | addr, | |
size | |||
) |
#define UNIV_MEM_DESC | ( | addr, | |
size | |||
) |
#define UNIV_MEM_FREE | ( | addr, | |
size | |||
) |
#define UNIV_MEM_INVALID | ( | addr, | |
size | |||
) |
#define UNIV_MEM_TRASH | ( | addr, | |
c, | |||
size | |||
) |
#define UNIV_MEM_UNDESC | ( | b | ) |
#define UNIV_MEM_VALID | ( | addr, | |
size | |||
) |
#define UNIV_NOTHROW |
#define UNIV_PAGE_SIZE ((ulint)srv_page_size) |
The universal page size of the database.
#define UNIV_PAGE_SIZE_SHIFT srv_page_size_shift |
The 2-logarithm of UNIV_PAGE_SIZE:
#define UNIV_PAGE_SSIZE_MAX static_cast<ulint>(UNIV_PAGE_SIZE_SHIFT - UNIV_ZIP_SIZE_SHIFT_MIN + 1) |
Largest possible ssize for an uncompressed page.
(The convention 'ssize' is used for 'log2 minus 9' or the number of shifts starting with 512.) This max number varies depending on UNIV_PAGE_SIZE.
#define UNIV_PAGE_SSIZE_MIN static_cast<ulint>(UNIV_PAGE_SIZE_SHIFT_MIN - UNIV_ZIP_SIZE_SHIFT_MIN + 1) |
Smallest possible ssize for an uncompressed page.
#define UNIV_PFS_IO |
#define UNIV_PFS_MEMORY |
#define UNIV_PFS_MUTEX |
#define UNIV_PFS_RWLOCK |
#define UNIV_PFS_THREAD |
#define UNIV_PREFETCH_R | ( | addr | ) | ((void)0) |
#define UNIV_PREFETCH_RW | ( | addr | ) | ((void)0) |
#define UNIV_UNLIKELY | ( | cond | ) | UNIV_EXPECT(cond, false) |
#define UT_ARR_SIZE | ( | a | ) | (sizeof(a) / sizeof((a)[0])) |
using byte = unsigned char |
using Col_offsets_t = ulint |
typedef uint64_t ib_id_t |
The generic InnoDB system object identifier data type.
typedef long int lint |
typedef void* os_thread_ret_t |
typedef uint32_t page_no_t |
Page number.
typedef uint32_t space_id_t |
Tablespace identifier.
typedef unsigned long int ulint |
void call_destructor | ( | T * | p | ) |
Explicitly call the destructor, this is to get around Clang bug#12350.
[in,out] | p | Instance on which to call the destructor |
|
constexpr |
|
constexpr |
This is the "mbmaxlen" for my_charset_filename (defined in strings/ctype-utf8.c), which is used to encode File and Database names.
|
constexpr |
|
constexpr |
Maximum length of the compression algorithm string.
Currently we support only (NONE | ZLIB | LZ4).
|
constexpr |
The maximum length of a database name.
Like MAX_TABLE_NAME_LEN this is the MySQL's NAME_LEN, see check_and_convert_db_name().
|
constexpr |
MAX_FULL_NAME_LEN defines the full name path including the database name and table name.
In addition, 14 bytes is added for: 2 for surrounding quotes around table name 1 for the separating dot (.) 9 for the mysql50# prefix
|
constexpr |
The maximum length of an encode table name in bytes.
The max table and database names are NAME_CHAR_LEN (64) characters. After the encoding, the max length would be NAME_CHAR_LEN (64) * FILENAME_CHARSET_MAXNAMLEN (5) = 320 bytes. The number does not include a terminating '\0'. InnoDB can handle longer names internally
|
staticconstexpr |
If we are doing something that takes longer than this many seconds then print an informative message.
|
constexpr |
|
extern |
|
extern |
|
constexpr |
The 'undefined' value for a 16-bit unsigned integer.
|
constexpr |
The bitmask of 32-bit unsigned integer.
|
constexpr |
The 'undefined' value for a 32-bit unsigned integer.
|
constexpr |
The 'undefined' value for a 64-bit unsigned integer.
|
constexpr |
The 'undefined' value for a 8-bit unsigned integer.
Maximum value for a ulint.
|
constexpr |
|
constexpr |
Lengths which are not UNIV_SQL_NULL, but bigger than the following number indicate that a field contains a reference to an externally stored part of the field in the tablespace.
The length field then contains the sum of the following flag and the locally stored len.
|
constexpr |
Maximum number of parallel threads in a parallelized operation.
|
constexpr |
The following alignment is used in memory allocations in memory heap management to ensure correct alignment for doubles etc.
const uint32_t UNIV_MULTI_VALUE_ARRAY_MARKER = UNIV_NO_INDEX_VALUE - 1 |
The following number as the length marker of a logical field, which is only used for multi-value field data, means the data itself of the field is actually an array.
|
constexpr |
The following number as the length of a logical field means that no attribute value for the multi-value index exists in the JSON doc.
|
constexpr |
Default page size for InnoDB tablespaces.
|
constexpr |
Maximum page size InnoDB currently supports.
|
constexpr |
Minimum page size InnoDB currently supports.
|
constexpr |
Original 16k page size for InnoDB tablespaces.
|
constexpr |
Default Page Size Shift (power of 2)
|
constexpr |
Maximum Page Size Shift (power of 2)
|
constexpr |
Minimum Page Size Shift (power of 2)
|
constexpr |
Original 16k InnoDB Page Size Shift, in case the default changes.
|
constexpr |
Original 16k InnoDB Page Size as an ssize (log2 - 9)
|
static |
|
constexpr |
Flag to indicate a field which was added instantly.
|
constexpr |
Flag to indicate a field which was dropped instantly.
|
constexpr |
The following number as the length of a logical field means that the field has the SQL NULL as its value.
NOTE that because we assume that the length of a field is a 32-bit integer when we store it, for example, to an undo log on disk, we must have also this number fit in 32 bits, also in 64-bit computers!
|
constexpr |
MySQL config.h generated by CMake will define SIZEOF_LONG in Posix.
|
constexpr |
Largest compressed page size.
|
constexpr |
Smallest compressed page size.
|
constexpr |
log2 of largest compressed page size (1<<14 == 16384 bytes).
A compressed page directory entry reserves 14 bits for the start offset and 2 bits for flags. This limits the uncompressed page size to 16k. Even though a 16k uncompressed page can theoretically be compressed into a larger compressed page, it is not a useful feature so we will limit both with this same constant.
|
constexpr |
log2 of smallest compressed page size (1<<10 == 1024 bytes) Note: This must never change!