1
by brian
clean slate |
1 |
/******************************************************
|
2 |
Data dictionary creation and booting
|
|
3 |
||
4 |
(c) 1996 Innobase Oy
|
|
5 |
||
6 |
Created 4/18/1996 Heikki Tuuri
|
|
7 |
*******************************************************/
|
|
8 |
||
9 |
/**************************************************************************
|
|
10 |
Writes the current value of the row id counter to the dictionary header file
|
|
11 |
page. */
|
|
12 |
||
13 |
void |
|
14 |
dict_hdr_flush_row_id(void); |
|
15 |
/*=======================*/
|
|
16 |
||
17 |
||
18 |
/**************************************************************************
|
|
19 |
Returns a new row id. */
|
|
20 |
UNIV_INLINE |
|
21 |
dulint |
|
22 |
dict_sys_get_new_row_id(void) |
|
23 |
/*=========================*/
|
|
24 |
/* out: the new id */ |
|
25 |
{
|
|
26 |
dulint id; |
|
27 |
||
28 |
mutex_enter(&(dict_sys->mutex)); |
|
29 |
||
30 |
id = dict_sys->row_id; |
|
31 |
||
32 |
if (0 == (ut_dulint_get_low(id) % DICT_HDR_ROW_ID_WRITE_MARGIN)) { |
|
33 |
||
34 |
dict_hdr_flush_row_id(); |
|
35 |
} |
|
36 |
||
37 |
UT_DULINT_INC(dict_sys->row_id); |
|
38 |
||
39 |
mutex_exit(&(dict_sys->mutex)); |
|
40 |
||
41 |
return(id); |
|
42 |
}
|
|
43 |
||
44 |
/**************************************************************************
|
|
45 |
Reads a row id from a record or other 6-byte stored form. */
|
|
46 |
UNIV_INLINE |
|
47 |
dulint |
|
48 |
dict_sys_read_row_id(
|
|
49 |
/*=================*/
|
|
50 |
/* out: row id */ |
|
51 |
byte* field) /* in: record field */ |
|
52 |
{
|
|
53 |
#if DATA_ROW_ID_LEN != 6 |
|
54 |
# error "DATA_ROW_ID_LEN != 6" |
|
55 |
#endif
|
|
56 |
||
57 |
return(mach_read_from_6(field)); |
|
58 |
}
|
|
59 |
||
60 |
/**************************************************************************
|
|
61 |
Writes a row id to a record or other 6-byte stored form. */
|
|
62 |
UNIV_INLINE |
|
63 |
void |
|
64 |
dict_sys_write_row_id(
|
|
65 |
/*==================*/
|
|
66 |
byte* field, /* in: record field */ |
|
67 |
dulint row_id) /* in: row id */ |
|
68 |
{
|
|
69 |
#if DATA_ROW_ID_LEN != 6 |
|
70 |
# error "DATA_ROW_ID_LEN != 6" |
|
71 |
#endif
|
|
72 |
||
73 |
mach_write_to_6(field, row_id); |
|
74 |
}
|
|
75 |
||
76 |