~ubuntu-branches/ubuntu/saucy/drizzle/saucy-proposed

« back to all changes in this revision

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

  • 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.ic
 
21
Data dictionary creation and booting
 
22
 
 
23
Created 4/18/1996 Heikki Tuuri
 
24
*******************************************************/
 
25
 
 
26
/**********************************************************************//**
 
27
Writes the current value of the row id counter to the dictionary header file
 
28
page. */
 
29
UNIV_INTERN
 
30
void
 
31
dict_hdr_flush_row_id(void);
 
32
/*=======================*/
 
33
 
 
34
 
 
35
/**********************************************************************//**
 
36
Returns a new row id.
 
37
@return the new id */
 
38
UNIV_INLINE
 
39
dulint
 
40
dict_sys_get_new_row_id(void)
 
41
/*=========================*/
 
42
{
 
43
        dulint  id;
 
44
 
 
45
        mutex_enter(&(dict_sys->mutex));
 
46
 
 
47
        id = dict_sys->row_id;
 
48
 
 
49
        if (0 == (ut_dulint_get_low(id) % DICT_HDR_ROW_ID_WRITE_MARGIN)) {
 
50
 
 
51
                dict_hdr_flush_row_id();
 
52
        }
 
53
 
 
54
        UT_DULINT_INC(dict_sys->row_id);
 
55
 
 
56
        mutex_exit(&(dict_sys->mutex));
 
57
 
 
58
        return(id);
 
59
}
 
60
 
 
61
/**********************************************************************//**
 
62
Reads a row id from a record or other 6-byte stored form.
 
63
@return row id */
 
64
UNIV_INLINE
 
65
dulint
 
66
dict_sys_read_row_id(
 
67
/*=================*/
 
68
        byte*   field)  /*!< in: record field */
 
69
{
 
70
#if DATA_ROW_ID_LEN != 6
 
71
# error "DATA_ROW_ID_LEN != 6"
 
72
#endif
 
73
 
 
74
        return(mach_read_from_6(field));
 
75
}
 
76
 
 
77
/**********************************************************************//**
 
78
Writes a row id to a record or other 6-byte stored form. */
 
79
UNIV_INLINE
 
80
void
 
81
dict_sys_write_row_id(
 
82
/*==================*/
 
83
        byte*   field,  /*!< in: record field */
 
84
        dulint  row_id) /*!< in: row id */
 
85
{
 
86
#if DATA_ROW_ID_LEN != 6
 
87
# error "DATA_ROW_ID_LEN != 6"
 
88
#endif
 
89
 
 
90
        mach_write_to_6(field, row_id);
 
91
}
 
92
 
 
93