Drizzled Public API Documentation

dict0boot.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (C) 1996, 2010, Innobase Oy. 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., 51 Franklin
15 St, Fifth Floor, Boston, MA 02110-1301 USA
16 
17 *****************************************************************************/
18 
19 /**************************************************/
26 #pragma once
27 #ifndef dict0boot_h
28 #define dict0boot_h
29 
30 #include "univ.i"
31 
32 #include "mtr0mtr.h"
33 #include "mtr0log.h"
34 #include "ut0byte.h"
35 #include "buf0buf.h"
36 #include "fsp0fsp.h"
37 #include "dict0dict.h"
38 
39 typedef byte dict_hdr_t;
40 
41 /**********************************************************************/
44 UNIV_INTERN
45 dict_hdr_t*
46 dict_hdr_get(
47 /*=========*/
48  mtr_t* mtr);
49 /**********************************************************************/
51 UNIV_INTERN
52 void
53 dict_hdr_get_new_id(
54 /*================*/
55  table_id_t* table_id,
57  index_id_t* index_id,
59  ulint* space_id);
61 /**********************************************************************/
64 UNIV_INLINE
67 /*=========================*/
68 /**********************************************************************/
71 UNIV_INLINE
74 /*=================*/
75  const byte* field);
76 /**********************************************************************/
78 UNIV_INLINE
79 void
81 /*==================*/
82  byte* field,
83  row_id_t row_id);
84 /*****************************************************************/
87 UNIV_INTERN
88 void
89 dict_boot(void);
90 /*===========*/
91 /*****************************************************************/
93 UNIV_INTERN
94 void
95 dict_create(void);
96 /*=============*/
97 
98 
99 /* Space id and page no where the dictionary header resides */
100 #define DICT_HDR_SPACE 0 /* the SYSTEM tablespace */
101 #define DICT_HDR_PAGE_NO FSP_DICT_HDR_PAGE_NO
102 
103 /* The ids for the basic system tables and their indexes */
104 #define DICT_TABLES_ID 1
105 #define DICT_COLUMNS_ID 2
106 #define DICT_INDEXES_ID 3
107 #define DICT_FIELDS_ID 4
108 /* The following is a secondary index on SYS_TABLES */
109 #define DICT_TABLE_IDS_ID 5
110 
111 #define DICT_HDR_FIRST_ID 10 /* the ids for tables etc. start
112  from this number, except for basic
113  system tables and their above defined
114  indexes; ibuf tables and indexes are
115  assigned as the id the number
116  DICT_IBUF_ID_MIN plus the space id */
117 #define DICT_IBUF_ID_MIN 0xFFFFFFFF00000000ULL
118 
119 /* The offset of the dictionary header on the page */
120 #define DICT_HDR FSEG_PAGE_DATA
121 
122 /*-------------------------------------------------------------*/
123 /* Dictionary header offsets */
124 #define DICT_HDR_ROW_ID 0 /* The latest assigned row id */
125 #define DICT_HDR_TABLE_ID 8 /* The latest assigned table id */
126 #define DICT_HDR_INDEX_ID 16 /* The latest assigned index id */
127 #define DICT_HDR_MAX_SPACE_ID 24 /* The latest assigned space id, or 0*/
128 #define DICT_HDR_MIX_ID_LOW 28 /* Obsolete,always DICT_HDR_FIRST_ID */
129 #define DICT_HDR_TABLES 32 /* Root of the table index tree */
130 #define DICT_HDR_TABLE_IDS 36 /* Root of the table index tree */
131 #define DICT_HDR_COLUMNS 40 /* Root of the column index tree */
132 #define DICT_HDR_INDEXES 44 /* Root of the index index tree */
133 #define DICT_HDR_FIELDS 48 /* Root of the index field
134  index tree */
135 
136 #define DICT_HDR_FSEG_HEADER 56 /* Segment header for the tablespace
137  segment into which the dictionary
138  header is created */
139 /*-------------------------------------------------------------*/
140 
141 /* The field number of the page number field in the sys_indexes table
142 clustered index */
143 #define DICT_SYS_INDEXES_PAGE_NO_FIELD 8
144 #define DICT_SYS_INDEXES_SPACE_NO_FIELD 7
145 #define DICT_SYS_INDEXES_TYPE_FIELD 6
146 #define DICT_SYS_INDEXES_NAME_FIELD 4
147 
148 /* When a row id which is zero modulo this number (which must be a power of
149 two) is assigned, the field DICT_HDR_ROW_ID on the dictionary header page is
150 updated */
151 #define DICT_HDR_ROW_ID_WRITE_MARGIN 256
152 
153 #ifndef UNIV_NONINL
154 #include "dict0boot.ic"
155 #endif
156 
157 #endif