InnoDB Plugin
1.0
|
#include <my_global.h>
#include <my_pthread.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include "config.h"
#include <inttypes.h>
#include <stdio.h>
#include "ut0dbg.h"
#include "ut0ut.h"
#include "db0err.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 | __STDC_FORMAT_MACROS /* Enable C99 printf format macros */ |
#define | UNIV_BTR_DEBUG /* check B-tree links */ |
#define | UNIV_LIGHT_MEM_DEBUG /* light memory debugging */ |
#define | UNIV_INTERN |
#define | UNIV_COLD /* empty */ |
#define | UNIV_INLINE static inline |
#define | UNIV_WORD_SIZE SIZEOF_LONG |
#define | UNIV_MEM_ALIGNMENT 8 |
#define | UNIV_WORD_ALIGNMENT UNIV_WORD_SIZE |
#define | UNIV_FORMAT_MIN UNIV_FORMAT_A |
#define | UNIV_FORMAT_MAX UNIV_FORMAT_B |
#define | UNIV_PAGE_SIZE_SHIFT srv_page_size_shift |
#define | UNIV_PAGE_SIZE ((ulint) srv_page_size) |
#define | UNIV_ZIP_SIZE_SHIFT_MIN 10 |
#define | UNIV_ZIP_SIZE_SHIFT_MAX 14 |
#define | UNIV_PAGE_SIZE_SHIFT_MIN 12 |
#define | UNIV_PAGE_SIZE_SHIFT_MAX 14 |
#define | UNIV_PAGE_SIZE_SHIFT_DEF 14 |
#define | UNIV_PAGE_SIZE_SHIFT_ORIG 14 |
#define | UNIV_PAGE_SIZE_MIN (1 << UNIV_PAGE_SIZE_SHIFT_MIN) |
#define | UNIV_PAGE_SIZE_MAX (1 << UNIV_PAGE_SIZE_SHIFT_MAX) |
#define | UNIV_PAGE_SIZE_DEF (1 << UNIV_PAGE_SIZE_SHIFT_DEF) |
#define | UNIV_PAGE_SIZE_ORIG (1 << UNIV_PAGE_SIZE_SHIFT_ORIG) |
#define | UNIV_ZIP_SIZE_MIN (1 << UNIV_ZIP_SIZE_SHIFT_MIN) |
#define | UNIV_ZIP_SIZE_MAX (1 << UNIV_ZIP_SIZE_SHIFT_MAX) |
#define | UNIV_PAGE_SSIZE_MAX (UNIV_PAGE_SIZE_SHIFT - UNIV_ZIP_SIZE_SHIFT_MIN + 1) |
#define | UNIV_MAX_PARALLELISM 32 |
#define | FILENAME_CHARSET_MAXNAMLEN 5 |
#define | MAX_TABLE_NAME_LEN 320 |
#define | MAX_DATABASE_NAME_LEN MAX_TABLE_NAME_LEN |
#define | MAX_FULL_NAME_LEN (MAX_TABLE_NAME_LEN + MAX_DATABASE_NAME_LEN + 14) |
#define | MAX_DB_UTF8_LEN (NAME_LEN + 1) |
#define | MAX_TABLE_UTF8_LEN (NAME_LEN + sizeof(srv_mysql50_table_name_prefix)) |
#define | byte unsigned char |
#define | UINT32PF "%" PRIu32 |
#define | INT64PF "%" PRId64 |
#define | UINT64PF "%" PRIu64 |
#define | UINT64PFx "%016" PRIx64 |
#define | DBUG_LSN_PF UINT64PF |
#define | IB_ID_FMT UINT64PF |
#define | ULINTPF "%lu" |
#define | ULINT_UNDEFINED ((ulint)(-1)) |
#define | ULONG_UNDEFINED ((ulong)(-1)) |
#define | UINT64_UNDEFINED ((ib_uint64_t)(-1)) |
#define | ULINT32_MASK 0xFFFFFFFF |
#define | ULINT32_UNDEFINED ULINT32_MASK |
#define | ULINT_MAX ((ulint)(-2)) |
#define | IB_UINT64_MAX ((ib_uint64_t) (~0ULL)) |
#define | IB_ID_MAX IB_UINT64_MAX |
#define | ULLINT_UNDEFINED ((ullint)(-1)) |
#define | ibool ulint |
#define | TRUE 1 |
#define | FALSE 0 |
#define | UNIV_NOTHROW |
#define | UNIV_SQL_NULL ULINT32_UNDEFINED |
#define | UNIV_EXTERN_STORAGE_FIELD (UNIV_SQL_NULL - UNIV_PAGE_SIZE_MAX) |
#define | UNIV_UNUSED |
#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_THREAD_DUMMY_RETURN return(NULL) |
#define | UNIV_MEM_VALID(addr, size) do {} while(0) |
#define | UNIV_MEM_INVALID(addr, size) do {} while(0) |
#define | UNIV_MEM_FREE(addr, size) do {} while(0) |
#define | UNIV_MEM_ALLOC(addr, size) do {} while(0) |
#define | UNIV_MEM_DESC(addr, size) do {} while(0) |
#define | UNIV_MEM_UNDESC(b) do {} while(0) |
#define | UNIV_MEM_ASSERT_RW_LOW(addr, size, should_abort) do {} while(0) |
#define | UNIV_MEM_ASSERT_RW(addr, size) do {} while(0) |
#define | UNIV_MEM_ASSERT_RW_ABORT(addr, size) do {} while(0) |
#define | UNIV_MEM_ASSERT_W(addr, size) do {} while(0) |
#define | UNIV_MEM_TRASH(addr, c, size) do {} while(0) |
#define | UNIV_MEM_ASSERT_AND_FREE(addr, size) |
#define | UNIV_MEM_ASSERT_AND_ALLOC(addr, size) |
Typedefs | |
typedef enum innodb_file_formats_enum | innodb_file_formats_t |
typedef int64_t | ib_int64_t |
typedef uint64_t | ib_uint64_t |
typedef uint32_t | ib_uint32_t |
typedef unsigned long int | ulint |
typedef long int | lint |
typedef unsigned long long int | ullint |
typedef ib_uint64_t | ib_id_t |
typedef void * | os_thread_ret_t |
Enumerations | |
enum | innodb_file_formats_enum { UNIV_FORMAT_A = 0, UNIV_FORMAT_B = 1 } |
Variables | |
ulong | srv_page_size_shift |
ulong | srv_page_size |
Version control for database, common definitions, and include files
Created 1/20/1994 Heikki Tuuri
#define 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.
#define IB_UINT64_MAX ((ib_uint64_t) (~0ULL)) |
Maximum value for ib_uint64_t
#define ibool ulint |
This 'ibool' type is used within Innobase. Remember that different included
headers may define 'bool' differently. Do not assume that 'bool' is a ulint!
#define INNODB_VERSION_STR |
#define MAX_DATABASE_NAME_LEN MAX_TABLE_NAME_LEN |
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().
#define MAX_DB_UTF8_LEN (NAME_LEN + 1) |
The maximum length in bytes that a database name can occupy when stored in
UTF8, including the terminating '\0', see dict_fs2utf8(). You must include mysql_com.h if you are to use this macro.
#define MAX_FULL_NAME_LEN (MAX_TABLE_NAME_LEN + MAX_DATABASE_NAME_LEN + 14) |
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
#define MAX_TABLE_NAME_LEN 320 |
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
#define MAX_TABLE_UTF8_LEN (NAME_LEN + sizeof(srv_mysql50_table_name_prefix)) |
The maximum length in bytes that a table name can occupy when stored in
UTF8, including the terminating '\0', see dict_fs2utf8(). You must include mysql_com.h if you are to use this macro.
#define REFMAN |
#define UINT64_UNDEFINED ((ib_uint64_t)(-1)) |
The 'undefined' value for a ib_uint64_t
#define ULINT32_MASK 0xFFFFFFFF |
The bitmask of 32-bit unsigned integer
#define ULINT32_UNDEFINED ULINT32_MASK |
The undefined 32-bit unsigned integer
#define ULINT_MAX ((ulint)(-2)) |
Maximum value for a ulint
#define ULINT_UNDEFINED ((ulint)(-1)) |
The 'undefined' value for a ulint
#define ULLINT_UNDEFINED ((ullint)(-1)) |
The 'undefined' value for a ullint
#define UNIV_EXTERN_STORAGE_FIELD (UNIV_SQL_NULL - UNIV_PAGE_SIZE_MAX) |
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.
#define UNIV_FORMAT_MAX UNIV_FORMAT_B |
Maximum supported file format
#define UNIV_FORMAT_MIN UNIV_FORMAT_A |
Minimum supported file format
#define UNIV_MAX_PARALLELISM 32 |
Maximum number of parallel threads in a parallelized operation
#define UNIV_MEM_ALIGNMENT 8 |
The following alignment is used in memory allocations in memory heap
management to ensure correct alignment for doubles etc.
#define UNIV_MEM_ASSERT_AND_ALLOC | ( | addr, | |
size | |||
) |
#define UNIV_MEM_ASSERT_AND_FREE | ( | addr, | |
size | |||
) |
#define UNIV_PAGE_SIZE ((ulint) srv_page_size) |
The universal page size of the database
#define UNIV_PAGE_SIZE_DEF (1 << UNIV_PAGE_SIZE_SHIFT_DEF) |
Default page size for InnoDB tablespaces.
#define UNIV_PAGE_SIZE_MAX (1 << UNIV_PAGE_SIZE_SHIFT_MAX) |
Maximum page size InnoDB currently supports.
#define UNIV_PAGE_SIZE_MIN (1 << UNIV_PAGE_SIZE_SHIFT_MIN) |
Minimum page size InnoDB currently supports.
#define UNIV_PAGE_SIZE_ORIG (1 << UNIV_PAGE_SIZE_SHIFT_ORIG) |
Original 16k page size for InnoDB tablespaces.
#define UNIV_PAGE_SIZE_SHIFT srv_page_size_shift |
The 2-logarithm of UNIV_PAGE_SIZE:
#define UNIV_PAGE_SIZE_SHIFT_DEF 14 |
Default Page Size Shift (power of 2)
#define UNIV_PAGE_SIZE_SHIFT_MAX 14 |
Maximum Page Size Shift (power of 2)
#define UNIV_PAGE_SIZE_SHIFT_MIN 12 |
Minimum Page Size Shift (power of 2)
#define UNIV_PAGE_SIZE_SHIFT_ORIG 14 |
Original 16k InnoDB Page Size Shift, in case the default changes
#define UNIV_PAGE_SSIZE_MAX (UNIV_PAGE_SIZE_SHIFT - UNIV_ZIP_SIZE_SHIFT_MIN + 1) |
Number of supported page sizes (The convention 'ssize' is used
for 'log2 minus 9' or the number of shifts starting with 512.) This number varies depending on UNIV_PAGE_SIZE.
#define UNIV_SQL_NULL ULINT32_UNDEFINED |
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!
#define UNIV_WORD_ALIGNMENT UNIV_WORD_SIZE |
The following alignment is used in aligning lints etc.
#define UNIV_WORD_SIZE SIZEOF_LONG |
MySQL config.h generated by GNU autoconf will define SIZEOF_LONG in Posix
#define UNIV_ZIP_SIZE_MAX (1 << UNIV_ZIP_SIZE_SHIFT_MAX) |
Largest compressed page size
#define UNIV_ZIP_SIZE_MIN (1 << UNIV_ZIP_SIZE_SHIFT_MIN) |
Smallest compressed page size
#define UNIV_ZIP_SIZE_SHIFT_MAX 14 |
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.
#define UNIV_ZIP_SIZE_SHIFT_MIN 10 |
log2 of smallest compressed page size (1<<10 == 1024 bytes)
Note: This must never change!
typedef ib_uint64_t ib_id_t |
The generic InnoDB system object identifier data type
There are currently two InnoDB file formats which are used to group
features with similar restrictions and dependencies. Using an enum allows switch statements to give a compiler warning when a new one is introduced.