~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Marisa Plumb
  • Date: 2010-12-04 02:38:29 UTC
  • mto: This revision was merged to the branch mainline in revision 1984.
  • Revision ID: marisa.plumb@gmail.com-20101204023829-2khzxh30wxi256db
updates to a few sql docs 

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, 2010, 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
 
/*******************************************************************//**
 
42
/********************************************************************//**
44
43
Relocates a buffer control block on the flush_list.
45
44
Note that it is assumed that the contents of bpage has already been
46
45
copied to dpage. */
59
58
        buf_page_t*     bpage); /*!< in: pointer to the block in question */
60
59
/*********************************************************************//**
61
60
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
 
/*=========================*/
 
61
a margin of replaceable pages there. */
 
62
UNIV_INTERN
 
63
void
 
64
buf_flush_free_margin(void);
 
65
/*=======================*/
75
66
#endif /* !UNIV_HOTBACKUP */
76
67
/********************************************************************//**
77
68
Initializes a page for writing to the tablespace. */
84
75
        ib_uint64_t     newest_lsn);    /*!< in: newest modification lsn
85
76
                                        to the page */
86
77
#ifndef UNIV_HOTBACKUP
87
 
# if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
88
 
/********************************************************************//**
89
 
Writes a flushable page asynchronously from the buffer pool to a file.
90
 
NOTE: buf_pool->mutex and block->mutex must be held upon entering this
91
 
function, and they will be released by this function after flushing.
92
 
This is loosely based on buf_flush_batch() and buf_flush_page().
93
 
@return TRUE if the page was flushed and the mutexes released */
94
 
UNIV_INTERN
95
 
ibool
96
 
buf_flush_page_try(
97
 
/*===============*/
98
 
        buf_pool_t*     buf_pool,       /*!< in/out: buffer pool instance */
99
 
        buf_block_t*    block)          /*!< in/out: buffer control block */
100
 
        __attribute__((nonnull, warn_unused_result));
101
 
# endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
102
 
/*******************************************************************//**
103
 
This utility flushes dirty blocks from the end of the LRU list.
104
 
NOTE: The calling thread may own latches to pages: to avoid deadlocks,
105
 
this function must be written so that it cannot end up waiting for these
106
 
latches!
107
 
@return number of blocks for which the write request was queued;
108
 
ULINT_UNDEFINED if there was a flush of the same type already running */
109
 
UNIV_INTERN
110
 
ulint
111
 
buf_flush_LRU(
112
 
/*==========*/
113
 
        buf_pool_t*     buf_pool,       /*!< in: buffer pool instance */
114
 
        ulint           min_n);         /*!< in: wished minimum mumber of blocks
115
 
                                        flushed (it is not guaranteed that the
116
 
                                        actual number is that big, though) */
117
 
/*******************************************************************//**
118
 
This utility flushes dirty blocks from the end of the flush_list of
119
 
all buffer pool instances.
120
 
NOTE: The calling thread is not allowed to own any latches on pages!
121
 
@return number of blocks for which the write request was queued;
122
 
ULINT_UNDEFINED if there was a flush of the same type already running */
123
 
UNIV_INTERN
124
 
ulint
125
 
buf_flush_list(
 
78
/*******************************************************************//**
 
79
This utility flushes dirty blocks from the end of the LRU list or flush_list.
 
80
NOTE 1: in the case of an LRU flush the calling thread may own latches to
 
81
pages: to avoid deadlocks, this function must be written so that it cannot
 
82
end up waiting for these latches! NOTE 2: in the case of a flush list flush,
 
83
the calling thread is not allowed to own any latches on pages!
 
84
@return number of blocks for which the write request was queued;
 
85
ULINT_UNDEFINED if there was a flush of the same type already running */
 
86
UNIV_INTERN
 
87
ulint
 
88
buf_flush_batch(
126
89
/*============*/
 
90
        enum buf_flush  flush_type,     /*!< in: BUF_FLUSH_LRU or
 
91
                                        BUF_FLUSH_LIST; if BUF_FLUSH_LIST,
 
92
                                        then the caller must not own any
 
93
                                        latches on pages */
127
94
        ulint           min_n,          /*!< in: wished minimum mumber of blocks
128
95
                                        flushed (it is not guaranteed that the
129
96
                                        actual number is that big, though) */
138
105
void
139
106
buf_flush_wait_batch_end(
140
107
/*=====================*/
141
 
        buf_pool_t*     buf_pool,       /*!< buffer pool instance */
142
 
        enum buf_flush  type);          /*!< in: BUF_FLUSH_LRU
143
 
                                        or BUF_FLUSH_LIST */
 
108
        enum buf_flush  type);  /*!< in: BUF_FLUSH_LRU or BUF_FLUSH_LIST */
144
109
/********************************************************************//**
145
110
This function should be called at a mini-transaction commit, if a page was
146
111
modified in it. Puts the block to the list of modified blocks, if it not
184
149
 
185
150
struct buf_flush_stat_struct
186
151
{
187
 
        ib_uint64_t     redo;           /**< amount of redo generated. */
188
 
        ulint           n_flushed;      /**< number of pages flushed. */
 
152
        ib_uint64_t     redo;           /*!< amount of redo generated. */
 
153
        ulint           n_flushed;      /*!< number of pages flushed. */
189
154
};
190
155
 
191
156
/** Statistics for selecting flush rate of dirty pages. */
216
181
@return TRUE if ok */
217
182
UNIV_INTERN
218
183
ibool
219
 
buf_flush_validate(
220
 
/*===============*/
221
 
        buf_pool_t*     buf_pool);
 
184
buf_flush_validate(void);
 
185
/*====================*/
222
186
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
223
187
 
224
 
/********************************************************************//**
 
188
/******************************************************************//**
225
189
Initialize the red-black tree to speed up insertions into the flush_list
226
190
during recovery process. Should be called at the start of recovery
227
191
process before any page has been read/written. */
230
194
buf_flush_init_flush_rbt(void);
231
195
/*==========================*/
232
196
 
233
 
/********************************************************************//**
 
197
/******************************************************************//**
234
198
Frees up the red-black tree. */
235
199
UNIV_INTERN
236
200
void
241
205
available to replacement in the free list and at the end of the LRU list (to
242
206
make sure that a read-ahead batch can be read efficiently in a single
243
207
sweep). */
244
 
#define BUF_FLUSH_FREE_BLOCK_MARGIN(b)  (5 + BUF_READ_AHEAD_AREA(b))
 
208
#define BUF_FLUSH_FREE_BLOCK_MARGIN     (5 + BUF_READ_AHEAD_AREA)
245
209
/** Extra margin to apply above BUF_FLUSH_FREE_BLOCK_MARGIN */
246
 
#define BUF_FLUSH_EXTRA_MARGIN(b)       ((BUF_FLUSH_FREE_BLOCK_MARGIN(b) / 4 \
247
 
                                        + 100) / srv_buf_pool_instances)
 
210
#define BUF_FLUSH_EXTRA_MARGIN          (BUF_FLUSH_FREE_BLOCK_MARGIN / 4 + 100)
248
211
#endif /* !UNIV_HOTBACKUP */
249
212
 
250
213
#ifndef UNIV_NONINL