1
/*****************************************************************************
3
Copyright (C) 1996, 2010, Innobase Oy. All Rights Reserved.
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.
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.
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., 51 Franklin
15
St, Fifth Floor, Boston, MA 02110-1301 USA
17
*****************************************************************************/
19
/**************************************************//**
20
@file include/dict0boot.h
21
Data dictionary creation and booting
23
Created 4/18/1996 Heikki Tuuri
24
*******************************************************/
36
#include "dict0dict.h"
38
typedef byte dict_hdr_t;
40
/**********************************************************************//**
41
Gets a pointer to the dictionary header and x-latches its page.
42
@return pointer to the dictionary header, page x-latched */
47
mtr_t* mtr); /*!< in: mtr */
48
/**********************************************************************//**
49
Returns a new table, index, or space id. */
54
table_id_t* table_id, /*!< out: table id
55
(not assigned if NULL) */
56
index_id_t* index_id, /*!< out: index id
57
(not assigned if NULL) */
58
ulint* space_id); /*!< out: space id
59
(not assigned if NULL) */
60
/**********************************************************************//**
65
dict_sys_get_new_row_id(void);
66
/*=========================*/
67
/**********************************************************************//**
68
Reads a row id from a record or other 6-byte stored form.
74
const byte* field); /*!< in: record field */
75
/**********************************************************************//**
76
Writes a row id to a record or other 6-byte stored form. */
79
dict_sys_write_row_id(
80
/*==================*/
81
byte* field, /*!< in: record field */
82
row_id_t row_id);/*!< in: row id */
83
/*****************************************************************//**
84
Initializes the data dictionary memory structures when the database is
85
started. This function is also called when the data dictionary is created. */
90
/*****************************************************************//**
91
Creates and initializes the data dictionary at the database creation. */
98
/* Space id and page no where the dictionary header resides */
99
#define DICT_HDR_SPACE 0 /* the SYSTEM tablespace */
100
#define DICT_HDR_PAGE_NO FSP_DICT_HDR_PAGE_NO
102
/* The ids for the basic system tables and their indexes */
103
#define DICT_TABLES_ID 1
104
#define DICT_COLUMNS_ID 2
105
#define DICT_INDEXES_ID 3
106
#define DICT_FIELDS_ID 4
107
/* The following is a secondary index on SYS_TABLES */
108
#define DICT_TABLE_IDS_ID 5
110
#define DICT_HDR_FIRST_ID 10 /* the ids for tables etc. start
111
from this number, except for basic
112
system tables and their above defined
113
indexes; ibuf tables and indexes are
114
assigned as the id the number
115
DICT_IBUF_ID_MIN plus the space id */
116
#define DICT_IBUF_ID_MIN 0xFFFFFFFF00000000ULL
118
/* The offset of the dictionary header on the page */
119
#define DICT_HDR FSEG_PAGE_DATA
121
/*-------------------------------------------------------------*/
122
/* Dictionary header offsets */
123
#define DICT_HDR_ROW_ID 0 /* The latest assigned row id */
124
#define DICT_HDR_TABLE_ID 8 /* The latest assigned table id */
125
#define DICT_HDR_INDEX_ID 16 /* The latest assigned index id */
126
#define DICT_HDR_MAX_SPACE_ID 24 /* The latest assigned space id, or 0*/
127
#define DICT_HDR_MIX_ID_LOW 28 /* Obsolete,always DICT_HDR_FIRST_ID */
128
#define DICT_HDR_TABLES 32 /* Root of the table index tree */
129
#define DICT_HDR_TABLE_IDS 36 /* Root of the table index tree */
130
#define DICT_HDR_COLUMNS 40 /* Root of the column index tree */
131
#define DICT_HDR_INDEXES 44 /* Root of the index index tree */
132
#define DICT_HDR_FIELDS 48 /* Root of the index field
135
#define DICT_HDR_FSEG_HEADER 56 /* Segment header for the tablespace
136
segment into which the dictionary
138
/*-------------------------------------------------------------*/
140
/* The field number of the page number field in the sys_indexes table
142
#define DICT_SYS_INDEXES_PAGE_NO_FIELD 8
143
#define DICT_SYS_INDEXES_SPACE_NO_FIELD 7
144
#define DICT_SYS_INDEXES_TYPE_FIELD 6
145
#define DICT_SYS_INDEXES_NAME_FIELD 4
147
/* When a row id which is zero modulo this number (which must be a power of
148
two) is assigned, the field DICT_HDR_ROW_ID on the dictionary header page is
150
#define DICT_HDR_ROW_ID_WRITE_MARGIN 256
153
#include "dict0boot.ic"