~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Brian Aker
  • Date: 2010-11-06 05:47:12 UTC
  • mto: This revision was merged to the branch mainline in revision 1909.
  • Revision ID: brian@tangent.org-20101106054712-jwxd8e0s0s3nm7qn
Merge in encapsulations in filesort.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (c) 1995, 2010, 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
31
31
#ifndef UNIV_HOTBACKUP
32
32
#include "mtr0types.h"
33
33
#include "buf0types.h"
34
 
#include "log0log.h"
35
34
 
36
35
/********************************************************************//**
37
36
Remove a block from the flush list of modified blocks. */
40
39
buf_flush_remove(
41
40
/*=============*/
42
41
        buf_page_t*     bpage); /*!< in: pointer to the block in question */
43
 
/*******************************************************************//**
44
 
Relocates a buffer control block on the flush_list.
45
 
Note that it is assumed that the contents of bpage has already been
46
 
copied to dpage. */
47
 
UNIV_INTERN
48
 
void
49
 
buf_flush_relocate_on_flush_list(
50
 
/*=============================*/
51
 
        buf_page_t*     bpage,  /*!< in/out: control block being moved */
52
 
        buf_page_t*     dpage); /*!< in/out: destination block */
53
42
/********************************************************************//**
54
43
Updates the flush system data structures when a write is completed. */
55
44
UNIV_INTERN
59
48
        buf_page_t*     bpage); /*!< in: pointer to the block in question */
60
49
/*********************************************************************//**
61
50
Flushes pages from the end of the LRU list if there is too small
62
 
a margin of replaceable pages there. If buffer pool is NULL it
63
 
means flush free margin on all buffer pool instances. */
64
 
UNIV_INTERN
65
 
void
66
 
buf_flush_free_margin(
67
 
/*==================*/
68
 
         buf_pool_t*    buf_pool);
69
 
/*********************************************************************//**
70
 
Flushes pages from the end of all the LRU lists. */
71
 
UNIV_INTERN
72
 
void
73
 
buf_flush_free_margins(void);
74
 
/*=========================*/
 
51
a margin of replaceable pages there. */
 
52
UNIV_INTERN
 
53
void
 
54
buf_flush_free_margin(void);
 
55
/*=======================*/
75
56
#endif /* !UNIV_HOTBACKUP */
76
57
/********************************************************************//**
77
58
Initializes a page for writing to the tablespace. */
85
66
                                        to the page */
86
67
#ifndef UNIV_HOTBACKUP
87
68
/*******************************************************************//**
88
 
This utility flushes dirty blocks from the end of the LRU list.
89
 
NOTE: The calling thread may own latches to pages: to avoid deadlocks,
90
 
this function must be written so that it cannot end up waiting for these
91
 
latches!
92
 
@return number of blocks for which the write request was queued;
93
 
ULINT_UNDEFINED if there was a flush of the same type already running */
94
 
UNIV_INTERN
95
 
ulint
96
 
buf_flush_LRU(
97
 
/*==========*/
98
 
        buf_pool_t*     buf_pool,       /*!< in: buffer pool instance */
99
 
        ulint           min_n);         /*!< in: wished minimum mumber of blocks
100
 
                                        flushed (it is not guaranteed that the
101
 
                                        actual number is that big, though) */
102
 
/*******************************************************************//**
103
 
This utility flushes dirty blocks from the end of the flush_list of
104
 
all buffer pool instances.
105
 
NOTE: The calling thread is not allowed to own any latches on pages!
106
 
@return number of blocks for which the write request was queued;
107
 
ULINT_UNDEFINED if there was a flush of the same type already running */
108
 
UNIV_INTERN
109
 
ulint
110
 
buf_flush_list(
 
69
This utility flushes dirty blocks from the end of the LRU list or flush_list.
 
70
NOTE 1: in the case of an LRU flush the calling thread may own latches to
 
71
pages: to avoid deadlocks, this function must be written so that it cannot
 
72
end up waiting for these latches! NOTE 2: in the case of a flush list flush,
 
73
the calling thread is not allowed to own any latches on pages!
 
74
@return number of blocks for which the write request was queued;
 
75
ULINT_UNDEFINED if there was a flush of the same type already running */
 
76
UNIV_INTERN
 
77
ulint
 
78
buf_flush_batch(
111
79
/*============*/
 
80
        enum buf_flush  flush_type,     /*!< in: BUF_FLUSH_LRU or
 
81
                                        BUF_FLUSH_LIST; if BUF_FLUSH_LIST,
 
82
                                        then the caller must not own any
 
83
                                        latches on pages */
112
84
        ulint           min_n,          /*!< in: wished minimum mumber of blocks
113
85
                                        flushed (it is not guaranteed that the
114
86
                                        actual number is that big, though) */
123
95
void
124
96
buf_flush_wait_batch_end(
125
97
/*=====================*/
126
 
        buf_pool_t*     buf_pool,       /*!< buffer pool instance */
127
 
        enum buf_flush  type);          /*!< in: BUF_FLUSH_LRU
128
 
                                        or BUF_FLUSH_LIST */
 
98
        enum buf_flush  type);  /*!< in: BUF_FLUSH_LRU or BUF_FLUSH_LIST */
129
99
/********************************************************************//**
130
100
This function should be called at a mini-transaction commit, if a page was
131
101
modified in it. Puts the block to the list of modified blocks, if it not
201
171
@return TRUE if ok */
202
172
UNIV_INTERN
203
173
ibool
204
 
buf_flush_validate(
205
 
/*===============*/
206
 
        buf_pool_t*     buf_pool);
 
174
buf_flush_validate(void);
 
175
/*====================*/
207
176
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
208
177
 
209
 
/********************************************************************//**
210
 
Initialize the red-black tree to speed up insertions into the flush_list
211
 
during recovery process. Should be called at the start of recovery
212
 
process before any page has been read/written. */
213
 
UNIV_INTERN
214
 
void
215
 
buf_flush_init_flush_rbt(void);
216
 
/*==========================*/
217
 
 
218
 
/********************************************************************//**
219
 
Frees up the red-black tree. */
220
 
UNIV_INTERN
221
 
void
222
 
buf_flush_free_flush_rbt(void);
223
 
/*==========================*/
224
 
 
225
178
/** When buf_flush_free_margin is called, it tries to make this many blocks
226
179
available to replacement in the free list and at the end of the LRU list (to
227
180
make sure that a read-ahead batch can be read efficiently in a single
228
181
sweep). */
229
 
#define BUF_FLUSH_FREE_BLOCK_MARGIN(b)  (5 + BUF_READ_AHEAD_AREA(b))
 
182
#define BUF_FLUSH_FREE_BLOCK_MARGIN     (5 + BUF_READ_AHEAD_AREA)
230
183
/** Extra margin to apply above BUF_FLUSH_FREE_BLOCK_MARGIN */
231
 
#define BUF_FLUSH_EXTRA_MARGIN(b)       ((BUF_FLUSH_FREE_BLOCK_MARGIN(b) / 4 \
232
 
                                        + 100) / srv_buf_pool_instances)
 
184
#define BUF_FLUSH_EXTRA_MARGIN          (BUF_FLUSH_FREE_BLOCK_MARGIN / 4 + 100)
233
185
#endif /* !UNIV_HOTBACKUP */
234
186
 
235
187
#ifndef UNIV_NONINL