drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
buf0flu.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (C) 1995, 2010, Innobase Oy. All Rights Reserved.
4
5This program is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License as published by the Free Software
7Foundation; version 2 of the License.
8
9This program is distributed in the hope that it will be useful, but WITHOUT
10ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
13You should have received a copy of the GNU General Public License along with
14this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15St, Fifth Floor, Boston, MA 02110-1301 USA
16
17*****************************************************************************/
18
19/**************************************************/
25
26#pragma once
27#ifndef buf0flu_h
28#define buf0flu_h
29
30#include "univ.i"
31#include "ut0byte.h"
32#ifndef UNIV_HOTBACKUP
33#include "mtr0types.h"
34#include "buf0types.h"
35#include "log0log.h"
36
37/********************************************************************/
39UNIV_INTERN
40void
42/*=============*/
43 buf_page_t* bpage);
44/*******************************************************************/
48UNIV_INTERN
49void
51/*=============================*/
52 buf_page_t* bpage,
53 buf_page_t* dpage);
54/********************************************************************/
56UNIV_INTERN
57void
59/*=====================*/
60 buf_page_t* bpage);
61/*********************************************************************/
65UNIV_INTERN
66void
68/*==================*/
69 buf_pool_t* buf_pool);
70/*********************************************************************/
72UNIV_INTERN
73void
75/*=========================*/
76#endif /* !UNIV_HOTBACKUP */
77/********************************************************************/
79UNIV_INTERN
80void
82/*=======================*/
83 byte* page,
84 void* page_zip_,
85 ib_uint64_t newest_lsn);
87#ifndef UNIV_HOTBACKUP
88# if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
89/********************************************************************/
95UNIV_INTERN
96ibool
97buf_flush_page_try(
98/*===============*/
99 buf_pool_t* buf_pool,
100 buf_block_t* block)
101 __attribute__((nonnull, warn_unused_result));
102# endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
103/*******************************************************************/
110UNIV_INTERN
111ulint
113/*==========*/
114 buf_pool_t* buf_pool,
115 ulint min_n);
118/*******************************************************************/
124UNIV_INTERN
125ulint
127/*============*/
128 ulint min_n,
131 ib_uint64_t lsn_limit);
136/******************************************************************/
138UNIV_INTERN
139void
141/*=====================*/
142 buf_pool_t* buf_pool,
143 enum buf_flush type);
145/******************************************************************/
149UNIV_INTERN
150void
152/*===============================*/
153 buf_pool_t* buf_pool,
154 enum buf_flush type);
156/********************************************************************/
160UNIV_INLINE
161void
163/*========================*/
164 buf_block_t* block,
165 mtr_t* mtr);
166/********************************************************************/
168UNIV_INLINE
169void
171/*=============================*/
172 buf_block_t* block,
173 ib_uint64_t start_lsn,
175 ib_uint64_t end_lsn);
177/********************************************************************/
181UNIV_INTERN
182ibool
184/*========================*/
185 buf_page_t* bpage);
187
196
198{
199 ib_uint64_t redo;
200 ulint n_flushed;
201};
202
205/*********************************************************************
206Update the historical stats that we are collecting for flush rate
207heuristics at the end of each interval. */
208UNIV_INTERN
209void
210buf_flush_stat_update(void);
211/*=======================*/
212/*********************************************************************
213Determines the fraction of dirty pages that need to be flushed based
214on the speed at which we generate redo log. Note that if redo log
215is generated at significant rate without a corresponding increase
216in the number of dirty pages (for example, an in-memory workload)
217it can cause IO bursts of flushing. This function implements heuristics
218to avoid this burstiness.
219@return number of dirty pages to be flushed / second */
220UNIV_INTERN
221ulint
222buf_flush_get_desired_flush_rate(void);
223/*==================================*/
224
225#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
226/******************************************************************/
229UNIV_INTERN
230ibool
231buf_flush_validate(
232/*===============*/
233 buf_pool_t* buf_pool);
234#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
235
236/********************************************************************/
240UNIV_INTERN
241void
243/*==========================*/
244
245/********************************************************************/
247UNIV_INTERN
248void
250/*==========================*/
251
256#define BUF_FLUSH_FREE_BLOCK_MARGIN(b) (5 + BUF_READ_AHEAD_AREA(b))
258#define BUF_FLUSH_EXTRA_MARGIN(b) ((BUF_FLUSH_FREE_BLOCK_MARGIN(b) / 4 \
259 + 100) / srv_buf_pool_instances)
260#endif /* !UNIV_HOTBACKUP */
261
262#ifndef UNIV_NONINL
263#include "buf0flu.ic"
264#endif
265
266#endif
UNIV_INTERN ibool buf_flush_ready_for_replace(buf_page_t *bpage)
Definition buf0flu.cc:448
UNIV_INTERN void buf_flush_remove(buf_page_t *bpage)
Definition buf0flu.cc:522
UNIV_INTERN ulint buf_flush_list(ulint min_n, ib_uint64_t lsn_limit)
Definition buf0flu.cc:1925
UNIV_INTERN void buf_flush_free_flush_rbt(void)
Definition buf0flu.cc:251
UNIV_INTERN void buf_flush_free_margins(void)
Definition buf0flu.cc:2074
UNIV_INLINE void buf_flush_recv_note_modification(buf_block_t *block, ib_uint64_t start_lsn, ib_uint64_t end_lsn)
UNIV_INLINE void buf_flush_note_modification(buf_block_t *block, mtr_t *mtr)
struct buf_flush_stat_struct buf_flush_stat_t
Definition buf0flu.h:204
UNIV_INTERN ulint buf_flush_LRU(buf_pool_t *buf_pool, ulint min_n)
Definition buf0flu.cc:1895
UNIV_INTERN void buf_flush_wait_batch_end(buf_pool_t *buf_pool, enum buf_flush type)
Definition buf0flu.cc:1865
UNIV_INTERN void buf_flush_free_margin(buf_pool_t *buf_pool)
Definition buf0flu.cc:2048
UNIV_INTERN void buf_flush_relocate_on_flush_list(buf_page_t *bpage, buf_page_t *dpage)
Definition buf0flu.cc:585
UNIV_INTERN void buf_flush_init_for_writing(byte *page, void *page_zip_, ib_uint64_t newest_lsn)
Definition buf0flu.cc:1013
UNIV_INTERN void buf_flush_init_flush_rbt(void)
Definition buf0flu.cc:227
UNIV_INTERN void buf_flush_write_complete(buf_page_t *bpage)
Definition buf0flu.cc:654
UNIV_INTERN void buf_flush_wait_batch_end_wait_only(buf_pool_t *buf_pool, enum buf_flush type)
struct buf_pool_struct buf_pool_t
Definition buf0types.h:37
buf_flush
Definition buf0types.h:47
struct buf_page_struct buf_page_t
Definition buf0types.h:31
struct buf_block_struct buf_block_t
Definition buf0types.h:33
Statistics for selecting flush rate based on redo log generation speed.
Definition buf0flu.h:198
ib_uint64_t redo
Definition buf0flu.h:199