1
/******************************************************
2
Data dictionary creation and booting
6
Created 4/18/1996 Heikki Tuuri
7
*******************************************************/
19
#include "dict0dict.h"
21
typedef byte dict_hdr_t;
23
/**************************************************************************
24
Gets a pointer to the dictionary header and x-latches its page. */
29
/* out: pointer to the dictionary header,
31
mtr_t* mtr); /* in: mtr */
32
/**************************************************************************
33
Returns a new row, table, index, or tree id. */
39
ulint type); /* in: DICT_HDR_ROW_ID, ... */
40
/**************************************************************************
41
Returns a new row id. */
44
dict_sys_get_new_row_id(void);
45
/*=========================*/
47
/**************************************************************************
48
Reads a row id from a record or other 6-byte stored form. */
54
byte* field); /* in: record field */
55
/**************************************************************************
56
Writes a row id to a record or other 6-byte stored form. */
59
dict_sys_write_row_id(
60
/*==================*/
61
byte* field, /* in: record field */
62
dulint row_id);/* in: row id */
63
/*********************************************************************
64
Initializes the data dictionary memory structures when the database is
65
started. This function is also called when the data dictionary is created. */
70
/*********************************************************************
71
Creates and initializes the data dictionary at the database creation. */
78
/* Space id and page no where the dictionary header resides */
79
#define DICT_HDR_SPACE 0 /* the SYSTEM tablespace */
80
#define DICT_HDR_PAGE_NO FSP_DICT_HDR_PAGE_NO
82
/* The ids for the basic system tables and their indexes */
83
#define DICT_TABLES_ID ut_dulint_create(0, 1)
84
#define DICT_COLUMNS_ID ut_dulint_create(0, 2)
85
#define DICT_INDEXES_ID ut_dulint_create(0, 3)
86
#define DICT_FIELDS_ID ut_dulint_create(0, 4)
87
/* The following is a secondary index on SYS_TABLES */
88
#define DICT_TABLE_IDS_ID ut_dulint_create(0, 5)
90
#define DICT_HDR_FIRST_ID 10 /* the ids for tables etc. start
91
from this number, except for basic
92
system tables and their above defined
93
indexes; ibuf tables and indexes are
94
assigned as the id the number
95
DICT_IBUF_ID_MIN plus the space id */
96
#define DICT_IBUF_ID_MIN ut_dulint_create(0xFFFFFFFFUL, 0)
98
/* The offset of the dictionary header on the page */
99
#define DICT_HDR FSEG_PAGE_DATA
101
/*-------------------------------------------------------------*/
102
/* Dictionary header offsets */
103
#define DICT_HDR_ROW_ID 0 /* The latest assigned row id */
104
#define DICT_HDR_TABLE_ID 8 /* The latest assigned table id */
105
#define DICT_HDR_INDEX_ID 16 /* The latest assigned index id */
106
#define DICT_HDR_MIX_ID 24 /* Obsolete, always 0. */
107
#define DICT_HDR_TABLES 32 /* Root of the table index tree */
108
#define DICT_HDR_TABLE_IDS 36 /* Root of the table index tree */
109
#define DICT_HDR_COLUMNS 40 /* Root of the column index tree */
110
#define DICT_HDR_INDEXES 44 /* Root of the index index tree */
111
#define DICT_HDR_FIELDS 48 /* Root of the index field
114
#define DICT_HDR_FSEG_HEADER 56 /* Segment header for the tablespace
115
segment into which the dictionary
117
/*-------------------------------------------------------------*/
119
/* The field number of the page number field in the sys_indexes table
121
#define DICT_SYS_INDEXES_PAGE_NO_FIELD 8
122
#define DICT_SYS_INDEXES_SPACE_NO_FIELD 7
123
#define DICT_SYS_INDEXES_TYPE_FIELD 6
125
/* When a row id which is zero modulo this number (which must be a power of
126
two) is assigned, the field DICT_HDR_ROW_ID on the dictionary header page is
128
#define DICT_HDR_ROW_ID_WRITE_MARGIN 256
131
#include "dict0boot.ic"