~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to plugin/innobase/include/dict0boot.h

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-03-18 12:12:31 UTC
  • Revision ID: james.westby@ubuntu.com-20100318121231-k6g1xe6cshbwa0f8
Tags: upstream-2010.03.1347
ImportĀ upstreamĀ versionĀ 2010.03.1347

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*****************************************************************************
 
2
 
 
3
Copyright (c) 1996, 2009, 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., 59 Temple
 
15
Place, Suite 330, Boston, MA 02111-1307 USA
 
16
 
 
17
*****************************************************************************/
 
18
 
 
19
/**************************************************//**
 
20
@file include/dict0boot.h
 
21
Data dictionary creation and booting
 
22
 
 
23
Created 4/18/1996 Heikki Tuuri
 
24
*******************************************************/
 
25
 
 
26
#ifndef dict0boot_h
 
27
#define dict0boot_h
 
28
 
 
29
#include "univ.i"
 
30
 
 
31
#include "mtr0mtr.h"
 
32
#include "mtr0log.h"
 
33
#include "ut0byte.h"
 
34
#include "buf0buf.h"
 
35
#include "fsp0fsp.h"
 
36
#include "dict0dict.h"
 
37
 
 
38
typedef byte    dict_hdr_t;
 
39
 
 
40
/**********************************************************************//**
 
41
Gets a pointer to the dictionary header and x-latches its page.
 
42
@return pointer to the dictionary header, page x-latched */
 
43
UNIV_INTERN
 
44
dict_hdr_t*
 
45
dict_hdr_get(
 
46
/*=========*/
 
47
        mtr_t*  mtr);   /*!< in: mtr */
 
48
/**********************************************************************//**
 
49
Returns a new row, table, index, or tree id.
 
50
@return the new id */
 
51
UNIV_INTERN
 
52
dulint
 
53
dict_hdr_get_new_id(
 
54
/*================*/
 
55
        ulint   type);  /*!< in: DICT_HDR_ROW_ID, ... */
 
56
/**********************************************************************//**
 
57
Returns a new row id.
 
58
@return the new id */
 
59
UNIV_INLINE
 
60
dulint
 
61
dict_sys_get_new_row_id(void);
 
62
/*=========================*/
 
63
/**********************************************************************//**
 
64
Reads a row id from a record or other 6-byte stored form.
 
65
@return row id */
 
66
UNIV_INLINE
 
67
dulint
 
68
dict_sys_read_row_id(
 
69
/*=================*/
 
70
        byte*   field); /*!< in: record field */
 
71
/**********************************************************************//**
 
72
Writes a row id to a record or other 6-byte stored form. */
 
73
UNIV_INLINE
 
74
void
 
75
dict_sys_write_row_id(
 
76
/*==================*/
 
77
        byte*   field,  /*!< in: record field */
 
78
        dulint  row_id);/*!< in: row id */
 
79
/*****************************************************************//**
 
80
Initializes the data dictionary memory structures when the database is
 
81
started. This function is also called when the data dictionary is created. */
 
82
UNIV_INTERN
 
83
void
 
84
dict_boot(void);
 
85
/*===========*/
 
86
/*****************************************************************//**
 
87
Creates and initializes the data dictionary at the database creation. */
 
88
UNIV_INTERN
 
89
void
 
90
dict_create(void);
 
91
/*=============*/
 
92
 
 
93
 
 
94
/* Space id and page no where the dictionary header resides */
 
95
#define DICT_HDR_SPACE          0       /* the SYSTEM tablespace */
 
96
#define DICT_HDR_PAGE_NO        FSP_DICT_HDR_PAGE_NO
 
97
 
 
98
/* The ids for the basic system tables and their indexes */
 
99
#define DICT_TABLES_ID          ut_dulint_create(0, 1)
 
100
#define DICT_COLUMNS_ID         ut_dulint_create(0, 2)
 
101
#define DICT_INDEXES_ID         ut_dulint_create(0, 3)
 
102
#define DICT_FIELDS_ID          ut_dulint_create(0, 4)
 
103
/* The following is a secondary index on SYS_TABLES */
 
104
#define DICT_TABLE_IDS_ID       ut_dulint_create(0, 5)
 
105
 
 
106
#define DICT_HDR_FIRST_ID       10      /* the ids for tables etc. start
 
107
                                        from this number, except for basic
 
108
                                        system tables and their above defined
 
109
                                        indexes; ibuf tables and indexes are
 
110
                                        assigned as the id the number
 
111
                                        DICT_IBUF_ID_MIN plus the space id */
 
112
#define DICT_IBUF_ID_MIN        ut_dulint_create(0xFFFFFFFFUL, 0)
 
113
 
 
114
/* The offset of the dictionary header on the page */
 
115
#define DICT_HDR                FSEG_PAGE_DATA
 
116
 
 
117
/*-------------------------------------------------------------*/
 
118
/* Dictionary header offsets */
 
119
#define DICT_HDR_ROW_ID         0       /* The latest assigned row id */
 
120
#define DICT_HDR_TABLE_ID       8       /* The latest assigned table id */
 
121
#define DICT_HDR_INDEX_ID       16      /* The latest assigned index id */
 
122
#define DICT_HDR_MIX_ID         24      /* Obsolete, always 0. */
 
123
#define DICT_HDR_TABLES         32      /* Root of the table index tree */
 
124
#define DICT_HDR_TABLE_IDS      36      /* Root of the table index tree */
 
125
#define DICT_HDR_COLUMNS        40      /* Root of the column index tree */
 
126
#define DICT_HDR_INDEXES        44      /* Root of the index index tree */
 
127
#define DICT_HDR_FIELDS         48      /* Root of the index field
 
128
                                        index tree */
 
129
 
 
130
#define DICT_HDR_FSEG_HEADER    56      /* Segment header for the tablespace
 
131
                                        segment into which the dictionary
 
132
                                        header is created */
 
133
/*-------------------------------------------------------------*/
 
134
 
 
135
/* The field number of the page number field in the sys_indexes table
 
136
clustered index */
 
137
#define DICT_SYS_INDEXES_PAGE_NO_FIELD   8
 
138
#define DICT_SYS_INDEXES_SPACE_NO_FIELD  7
 
139
#define DICT_SYS_INDEXES_TYPE_FIELD      6
 
140
 
 
141
/* When a row id which is zero modulo this number (which must be a power of
 
142
two) is assigned, the field DICT_HDR_ROW_ID on the dictionary header page is
 
143
updated */
 
144
#define DICT_HDR_ROW_ID_WRITE_MARGIN    256
 
145
 
 
146
#ifndef UNIV_NONINL
 
147
#include "dict0boot.ic"
 
148
#endif
 
149
 
 
150
#endif