~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Barry.Leslie at PrimeBase
  • Date: 2010-10-20 20:41:00 UTC
  • mfrom: (1863 staging)
  • mto: This revision was merged to the branch mainline in revision 1871.
  • Revision ID: barry.leslie@primebase.com-20101020204100-oyj6p5cfssjw3p62
Merged with trunk.

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(
57
 
/*============================*/
58
 
        buf_pool_t*     buf_pool);      /*!< in: buffer pool instance */
 
56
buf_LRU_try_free_flushed_blocks(void);
 
57
/*==================================*/
59
58
/******************************************************************//**
60
59
Returns TRUE if less than 25 % of the buffer pool is available. This can be
61
60
used in heuristics to prevent huge transactions eating up the whole buffer
74
73
#define BUF_LRU_OLD_MIN_LEN     512     /* 8 megabytes of 16k pages */
75
74
 
76
75
/** Maximum LRU list search length in buf_flush_LRU_recommendation() */
77
 
#define BUF_LRU_FREE_SEARCH_LEN(b)      (5 + 2 * BUF_READ_AHEAD_AREA(b))
 
76
#define BUF_LRU_FREE_SEARCH_LEN         (5 + 2 * BUF_READ_AHEAD_AREA)
78
77
 
79
78
/******************************************************************//**
80
79
Invalidates all pages belonging to a given tablespace when we are deleting
98
97
Try to free a block.  If bpage is a descriptor of a compressed-only
99
98
page, the descriptor object will be freed as well.
100
99
 
101
 
NOTE: If this function returns BUF_LRU_FREED, it will temporarily
102
 
release buf_pool->mutex.  Furthermore, the page frame will no longer be
 
100
NOTE: If this function returns BUF_LRU_FREED, it will not temporarily
 
101
release buf_pool_mutex.  Furthermore, the page frame will no longer be
103
102
accessible via bpage.
104
103
 
105
 
The caller must hold buf_pool->mutex and buf_page_get_mutex(bpage) and
 
104
The caller must hold buf_pool_mutex and buf_page_get_mutex(bpage) and
106
105
release these two mutexes after the call.  No other
107
106
buf_page_get_mutex() may be held when calling this function.
108
107
@return BUF_LRU_FREED if freed, BUF_LRU_CANNOT_RELOCATE or
116
115
                                compressed page of an uncompressed page */
117
116
        ibool*          buf_pool_mutex_released);
118
117
                                /*!< in: pointer to a variable that will
119
 
                                be assigned TRUE if buf_pool->mutex
 
118
                                be assigned TRUE if buf_pool_mutex
120
119
                                was temporarily released, or NULL */
121
120
/******************************************************************//**
122
121
Try to free a replaceable block.
125
124
ibool
126
125
buf_LRU_search_and_free_block(
127
126
/*==========================*/
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. */
 
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. */
139
135
/******************************************************************//**
140
136
Returns a free block from the buf_pool.  The block is taken off the
141
137
free list.  If it is empty, returns NULL.
142
138
@return a free control block, or NULL if the buf_block->free list is empty */
143
139
UNIV_INTERN
144
140
buf_block_t*
145
 
buf_LRU_get_free_only(
146
 
/*==================*/
147
 
        buf_pool_t*     buf_pool);      /*!< buffer pool instance */
 
141
buf_LRU_get_free_only(void);
 
142
/*=======================*/
148
143
/******************************************************************//**
149
144
Returns a free block from the buf_pool. The block is taken off the
150
145
free list. If it is empty, blocks are moved from the end of the
154
149
buf_block_t*
155
150
buf_LRU_get_free_block(
156
151
/*===================*/
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 */
 
152
        ulint   zip_size);      /*!< in: compressed page size in bytes,
 
153
                                or 0 if uncompressed tablespace */
160
154
 
161
155
/******************************************************************//**
162
156
Puts a block back to the free list. */
203
197
Updates buf_LRU_old_ratio.
204
198
@return updated old_pct */
205
199
UNIV_INTERN
206
 
ulint
 
200
uint
207
201
buf_LRU_old_ratio_update(
208
202
/*=====================*/
209
203
        uint    old_pct,/*!< in: Reserve this percentage of
239
233
 
240
234
/** @name Heuristics for detecting index scan @{ */
241
235
/** Reserve this much/BUF_LRU_OLD_RATIO_DIV of the buffer pool for
242
 
"old" blocks.  Protected by buf_pool->mutex. */
 
236
"old" blocks.  Protected by buf_pool_mutex. */
243
237
extern uint     buf_LRU_old_ratio;
244
238
/** The denominator of buf_LRU_old_ratio. */
245
239
#define BUF_LRU_OLD_RATIO_DIV   1024
285
279
extern buf_LRU_stat_t   buf_LRU_stat_cur;
286
280
 
287
281
/** Running sum of past values of buf_LRU_stat_cur.
288
 
Updated by buf_LRU_stat_update().  Protected by buf_pool->mutex. */
 
282
Updated by buf_LRU_stat_update().  Protected by buf_pool_mutex. */
289
283
extern buf_LRU_stat_t   buf_LRU_stat_sum;
290
284
 
291
285
/********************************************************************//**