~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Brian Aker
  • Date: 2008-12-19 07:02:38 UTC
  • Revision ID: brian@tangent.org-20081219070238-569uxp3vsr6r37v1
Updated/fix to foreign key test.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*****************************************************************************
2
 
 
3
 
Copyright (c) 1995, 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/buf0rea.h
 
1
/******************************************************
21
2
The database buffer read
22
3
 
 
4
(c) 1995 Innobase Oy
 
5
 
23
6
Created 11/5/1995 Heikki Tuuri
24
7
*******************************************************/
25
8
 
29
12
#include "univ.i"
30
13
#include "buf0types.h"
31
14
 
32
 
/********************************************************************//**
 
15
/************************************************************************
33
16
High-level function which reads a page asynchronously from a file to the
34
17
buffer buf_pool if it is not already there. Sets the io_fix flag and sets
35
18
an exclusive lock on the buffer frame. The flag is cleared and the x-lock
36
19
released by the i/o-handler thread. Does a random read-ahead if it seems
37
 
sensible.
38
 
@return number of page read requests issued: this can be greater than
39
 
1 if read-ahead occurred */
 
20
sensible. */
40
21
UNIV_INTERN
41
22
ulint
42
23
buf_read_page(
43
24
/*==========*/
44
 
        ulint   space,  /*!< in: space id */
45
 
        ulint   zip_size,/*!< in: compressed page size in bytes, or 0 */
46
 
        ulint   offset);/*!< in: page number */
47
 
/********************************************************************//**
 
25
                        /* out: number of page read requests issued: this can
 
26
                        be > 1 if read-ahead occurred */
 
27
        ulint   space,  /* in: space id */
 
28
        ulint   zip_size,/* in: compressed page size in bytes, or 0 */
 
29
        ulint   offset);/* in: page number */
 
30
/************************************************************************
48
31
Applies linear read-ahead if in the buf_pool the page is a border page of
49
32
a linear read-ahead area and all the pages in the area have been accessed.
50
33
Does not read any page if the read-ahead mechanism is not activated. Note
66
49
latches!
67
50
NOTE 3: the calling thread must want access to the page given: this rule is
68
51
set to prevent unintended read-aheads performed by ibuf routines, a situation
69
 
which could result in a deadlock if the OS does not support asynchronous io.
70
 
@return number of page read requests issued */
 
52
which could result in a deadlock if the OS does not support asynchronous io. */
71
53
UNIV_INTERN
72
54
ulint
73
55
buf_read_ahead_linear(
74
56
/*==================*/
75
 
        ulint   space,  /*!< in: space id */
76
 
        ulint   zip_size,/*!< in: compressed page size in bytes, or 0 */
77
 
        ulint   offset);/*!< in: page number of a page; NOTE: the current thread
 
57
                        /* out: number of page read requests issued */
 
58
        ulint   space,  /* in: space id */
 
59
        ulint   zip_size,/* in: compressed page size in bytes, or 0 */
 
60
        ulint   offset);/* in: page number of a page; NOTE: the current thread
78
61
                        must want access to this page (see NOTE 3 above) */
79
 
/********************************************************************//**
 
62
/************************************************************************
80
63
Issues read requests for pages which the ibuf module wants to read in, in
81
64
order to contract the insert buffer tree. Technically, this function is like
82
65
a read-ahead function. */
84
67
void
85
68
buf_read_ibuf_merge_pages(
86
69
/*======================*/
87
 
        ibool           sync,           /*!< in: TRUE if the caller
 
70
        ibool           sync,           /* in: TRUE if the caller
88
71
                                        wants this function to wait
89
72
                                        for the highest address page
90
73
                                        to get read in, before this
91
74
                                        function returns */
92
 
        const ulint*    space_ids,      /*!< in: array of space ids */
93
 
        const ib_int64_t* space_versions,/*!< in: the spaces must have
 
75
        const ulint*    space_ids,      /* in: array of space ids */
 
76
        const ib_int64_t* space_versions,/* in: the spaces must have
94
77
                                        this version number
95
78
                                        (timestamp), otherwise we
96
79
                                        discard the read; we use this
97
80
                                        to cancel reads if DISCARD +
98
81
                                        IMPORT may have changed the
99
82
                                        tablespace size */
100
 
        const ulint*    page_nos,       /*!< in: array of page numbers
 
83
        const ulint*    page_nos,       /* in: array of page numbers
101
84
                                        to read, with the highest page
102
85
                                        number the last in the
103
86
                                        array */
104
 
        ulint           n_stored);      /*!< in: number of elements
 
87
        ulint           n_stored);      /* in: number of elements
105
88
                                        in the arrays */
106
 
/********************************************************************//**
 
89
/************************************************************************
107
90
Issues read requests for pages which recovery wants to read in. */
108
91
UNIV_INTERN
109
92
void
110
93
buf_read_recv_pages(
111
94
/*================*/
112
 
        ibool           sync,           /*!< in: TRUE if the caller
 
95
        ibool           sync,           /* in: TRUE if the caller
113
96
                                        wants this function to wait
114
97
                                        for the highest address page
115
98
                                        to get read in, before this
116
99
                                        function returns */
117
 
        ulint           space,          /*!< in: space id */
118
 
        ulint           zip_size,       /*!< in: compressed page size in
 
100
        ulint           space,          /* in: space id */
 
101
        ulint           zip_size,       /* in: compressed page size in
119
102
                                        bytes, or 0 */
120
 
        const ulint*    page_nos,       /*!< in: array of page numbers
 
103
        const ulint*    page_nos,       /* in: array of page numbers
121
104
                                        to read, with the highest page
122
105
                                        number the last in the
123
106
                                        array */
124
 
        ulint           n_stored);      /*!< in: number of page numbers
 
107
        ulint           n_stored);      /* in: number of page numbers
125
108
                                        in the array */
126
109
 
127
 
/** The size in pages of the area which the read-ahead algorithms read if
 
110
/* The size in pages of the area which the read-ahead algorithms read if
128
111
invoked */
 
112
 
129
113
#define BUF_READ_AHEAD_AREA                                     \
130
114
        ut_min(64, ut_2_power_up(buf_pool->curr_size / 32))
131
115
 
132
 
/** @name Modes used in read-ahead @{ */
133
 
/** read only pages belonging to the insert buffer tree */
 
116
/* Modes used in read-ahead */
134
117
#define BUF_READ_IBUF_PAGES_ONLY        131
135
 
/** read any page */
136
118
#define BUF_READ_ANY_PAGE               132
137
 
/* @} */
138
119
 
139
120
#endif