~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Monty Taylor
  • Date: 2011-02-13 17:26:39 UTC
  • mfrom: (2157.2.2 give-in-to-pkg-config)
  • mto: This revision was merged to the branch mainline in revision 2166.
  • Revision ID: mordred@inaugust.com-20110213172639-nhy7i72sfhoq13ms
Merged in pkg-config fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
 
3
Copyright (C) 1995, 2009, Innobase Oy. All Rights Reserved.
4
4
 
5
5
This program is free software; you can redistribute it and/or modify it under
6
6
the terms of the GNU General Public License as published by the Free Software
53
53
wasted. */
54
54
UNIV_INTERN
55
55
void
56
 
buf_LRU_try_free_flushed_blocks(void);
57
 
/*==================================*/
 
56
buf_LRU_try_free_flushed_blocks(
 
57
/*============================*/
 
58
        buf_pool_t*     buf_pool);      /*!< in: buffer pool instance */
58
59
/******************************************************************//**
59
60
Returns TRUE if less than 25 % of the buffer pool is available. This can be
60
61
used in heuristics to prevent huge transactions eating up the whole buffer
73
74
#define BUF_LRU_OLD_MIN_LEN     512     /* 8 megabytes of 16k pages */
74
75
 
75
76
/** Maximum LRU list search length in buf_flush_LRU_recommendation() */
76
 
#define BUF_LRU_FREE_SEARCH_LEN         (5 + 2 * BUF_READ_AHEAD_AREA)
 
77
#define BUF_LRU_FREE_SEARCH_LEN(b)      (5 + 2 * BUF_READ_AHEAD_AREA(b))
77
78
 
78
79
/******************************************************************//**
79
80
Invalidates all pages belonging to a given tablespace when we are deleting
98
99
page, the descriptor object will be freed as well.
99
100
 
100
101
NOTE: If this function returns BUF_LRU_FREED, it will temporarily
101
 
release buf_pool_mutex.  Furthermore, the page frame will no longer be
 
102
release buf_pool->mutex.  Furthermore, the page frame will no longer be
102
103
accessible via bpage.
103
104
 
104
 
The caller must hold buf_pool_mutex and buf_page_get_mutex(bpage) and
 
105
The caller must hold buf_pool->mutex and buf_page_get_mutex(bpage) and
105
106
release these two mutexes after the call.  No other
106
107
buf_page_get_mutex() may be held when calling this function.
107
108
@return BUF_LRU_FREED if freed, BUF_LRU_CANNOT_RELOCATE or
115
116
                                compressed page of an uncompressed page */
116
117
        ibool*          buf_pool_mutex_released);
117
118
                                /*!< in: pointer to a variable that will
118
 
                                be assigned TRUE if buf_pool_mutex
 
119
                                be assigned TRUE if buf_pool->mutex
119
120
                                was temporarily released, or NULL */
120
121
/******************************************************************//**
121
122
Try to free a replaceable block.
124
125
ibool
125
126
buf_LRU_search_and_free_block(
126
127
/*==========================*/
127
 
        ulint   n_iterations);  /*!< in: how many times this has been called
128
 
                                repeatedly without result: a high value means
129
 
                                that we should search farther; if
130
 
                                n_iterations < 10, then we search
131
 
                                n_iterations / 10 * buf_pool->curr_size
132
 
                                pages from the end of the LRU list; if
133
 
                                n_iterations < 5, then we will also search
134
 
                                n_iterations / 5 of the unzip_LRU list. */
 
128
        buf_pool_t*     buf_pool,       /*!< in: buffer pool instance */
 
129
        ulint           n_iterations);  /*!< in: how many times this has
 
130
                                        been called repeatedly without
 
131
                                        result: a high value means that
 
132
                                        we should search farther; if
 
133
                                        n_iterations < 10, then we search
 
134
                                        n_iterations / 10 * buf_pool->curr_size
 
135
                                        pages from the end of the LRU list; if
 
136
                                        n_iterations < 5, then we will
 
137
                                        also search n_iterations / 5
 
138
                                        of the unzip_LRU list. */
135
139
/******************************************************************//**
136
140
Returns a free block from the buf_pool.  The block is taken off the
137
141
free list.  If it is empty, returns NULL.
138
142
@return a free control block, or NULL if the buf_block->free list is empty */
139
143
UNIV_INTERN
140
144
buf_block_t*
141
 
buf_LRU_get_free_only(void);
142
 
/*=======================*/
 
145
buf_LRU_get_free_only(
 
146
/*==================*/
 
147
        buf_pool_t*     buf_pool);      /*!< buffer pool instance */
143
148
/******************************************************************//**
144
149
Returns a free block from the buf_pool. The block is taken off the
145
150
free list. If it is empty, blocks are moved from the end of the
149
154
buf_block_t*
150
155
buf_LRU_get_free_block(
151
156
/*===================*/
152
 
        ulint   zip_size);      /*!< in: compressed page size in bytes,
153
 
                                or 0 if uncompressed tablespace */
 
157
        buf_pool_t*     buf_pool,       /*!< in: preferred buffer pool */
 
158
        ulint           zip_size);      /*!< in: compressed page size in bytes,
 
159
                                        or 0 if uncompressed tablespace */
154
160
 
155
161
/******************************************************************//**
156
162
Puts a block back to the free list. */
197
203
Updates buf_LRU_old_ratio.
198
204
@return updated old_pct */
199
205
UNIV_INTERN
200
 
uint
 
206
ulint
201
207
buf_LRU_old_ratio_update(
202
208
/*=====================*/
203
209
        uint    old_pct,/*!< in: Reserve this percentage of
233
239
 
234
240
/** @name Heuristics for detecting index scan @{ */
235
241
/** Reserve this much/BUF_LRU_OLD_RATIO_DIV of the buffer pool for
236
 
"old" blocks.  Protected by buf_pool_mutex. */
 
242
"old" blocks.  Protected by buf_pool->mutex. */
237
243
extern uint     buf_LRU_old_ratio;
238
244
/** The denominator of buf_LRU_old_ratio. */
239
245
#define BUF_LRU_OLD_RATIO_DIV   1024
279
285
extern buf_LRU_stat_t   buf_LRU_stat_cur;
280
286
 
281
287
/** Running sum of past values of buf_LRU_stat_cur.
282
 
Updated by buf_LRU_stat_update().  Protected by buf_pool_mutex. */
 
288
Updated by buf_LRU_stat_update().  Protected by buf_pool->mutex. */
283
289
extern buf_LRU_stat_t   buf_LRU_stat_sum;
284
290
 
285
291
/********************************************************************//**