~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Brian Aker
  • Date: 2010-05-27 01:25:56 UTC
  • mfrom: (1567.1.4 new-staging)
  • Revision ID: brian@gaz-20100527012556-5zgkirkl7swbigd6
Merge of Brian, Paul. PBXT compile issue, and test framework cleanup. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/******************************************************
2
 
Data dictionary creation and booting
3
 
 
4
 
(c) 1996 Innobase Oy
5
 
 
6
 
Created 4/18/1996 Heikki Tuuri
7
 
*******************************************************/
8
 
 
9
 
#ifndef dict0boot_h
10
 
#define dict0boot_h
11
 
 
12
 
#include "univ.i"
13
 
 
14
 
#include "mtr0mtr.h"
15
 
#include "mtr0log.h"
16
 
#include "ut0byte.h"
17
 
#include "buf0buf.h"
18
 
#include "fsp0fsp.h"
19
 
#include "dict0dict.h"
20
 
 
21
 
typedef byte    dict_hdr_t;
22
 
 
23
 
/**************************************************************************
24
 
Gets a pointer to the dictionary header and x-latches its page. */
25
 
 
26
 
dict_hdr_t*
27
 
dict_hdr_get(
28
 
/*=========*/
29
 
                        /* out: pointer to the dictionary header,
30
 
                        page x-latched */
31
 
        mtr_t*  mtr);   /* in: mtr */
32
 
/**************************************************************************
33
 
Returns a new row, table, index, or tree id. */
34
 
 
35
 
dulint
36
 
dict_hdr_get_new_id(
37
 
/*================*/
38
 
                        /* out: the new id */
39
 
        ulint   type);  /* in: DICT_HDR_ROW_ID, ... */
40
 
/**************************************************************************
41
 
Returns a new row id. */
42
 
UNIV_INLINE
43
 
dulint
44
 
dict_sys_get_new_row_id(void);
45
 
/*=========================*/
46
 
                        /* out: the new id */
47
 
/**************************************************************************
48
 
Reads a row id from a record or other 6-byte stored form. */
49
 
UNIV_INLINE
50
 
dulint
51
 
dict_sys_read_row_id(
52
 
/*=================*/
53
 
                        /* out: row id */
54
 
        byte*   field); /* in: record field */
55
 
/**************************************************************************
56
 
Writes a row id to a record or other 6-byte stored form. */
57
 
UNIV_INLINE
58
 
void
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. */
66
 
 
67
 
void
68
 
dict_boot(void);
69
 
/*===========*/
70
 
/*********************************************************************
71
 
Creates and initializes the data dictionary at the database creation. */
72
 
 
73
 
void
74
 
dict_create(void);
75
 
/*=============*/
76
 
 
77
 
 
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
81
 
 
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)
89
 
 
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)
97
 
 
98
 
/* The offset of the dictionary header on the page */
99
 
#define DICT_HDR                FSEG_PAGE_DATA
100
 
 
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
112
 
                                        index tree */
113
 
 
114
 
#define DICT_HDR_FSEG_HEADER    56      /* Segment header for the tablespace
115
 
                                        segment into which the dictionary
116
 
                                        header is created */
117
 
/*-------------------------------------------------------------*/
118
 
 
119
 
/* The field number of the page number field in the sys_indexes table
120
 
clustered index */
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
124
 
 
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
127
 
updated */
128
 
#define DICT_HDR_ROW_ID_WRITE_MARGIN    256
129
 
 
130
 
#ifndef UNIV_NONINL
131
 
#include "dict0boot.ic"
132
 
#endif
133
 
 
134
 
#endif