mirror of
https://github.com/MariaDB/server.git
synced 2026-05-16 03:47:17 +02:00
Temporary commit of merge of MariaDB 10.0-base and MySQL 5.6
This commit is contained in:
parent
5a86a61219
commit
1d0f70c2f8
557 changed files with 124529 additions and 30315 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
|
||||
Copyright (c) 1995, 2011, Oracle and/or its affiliates. All Rights Reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
|
|
@ -11,8 +11,8 @@ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
|
|
@ -28,10 +28,13 @@ Created 11/5/1995 Heikki Tuuri
|
|||
|
||||
#include "univ.i"
|
||||
#include "ut0byte.h"
|
||||
#include "log0log.h"
|
||||
#ifndef UNIV_HOTBACKUP
|
||||
#include "mtr0types.h"
|
||||
#include "buf0types.h"
|
||||
#include "log0log.h"
|
||||
|
||||
/** Flag indicating if the page_cleaner is in active state. */
|
||||
extern ibool buf_page_cleaner_is_active;
|
||||
|
||||
/********************************************************************//**
|
||||
Remove a block from the flush list of modified blocks. */
|
||||
|
|
@ -57,21 +60,6 @@ void
|
|||
buf_flush_write_complete(
|
||||
/*=====================*/
|
||||
buf_page_t* bpage); /*!< in: pointer to the block in question */
|
||||
/*********************************************************************//**
|
||||
Flushes pages from the end of the LRU list if there is too small
|
||||
a margin of replaceable pages there. If buffer pool is NULL it
|
||||
means flush free margin on all buffer pool instances. */
|
||||
UNIV_INTERN
|
||||
void
|
||||
buf_flush_free_margin(
|
||||
/*==================*/
|
||||
buf_pool_t* buf_pool);
|
||||
/*********************************************************************//**
|
||||
Flushes pages from the end of all the LRU lists. */
|
||||
UNIV_INTERN
|
||||
void
|
||||
buf_flush_free_margins(void);
|
||||
/*=========================*/
|
||||
#endif /* !UNIV_HOTBACKUP */
|
||||
/********************************************************************//**
|
||||
Initializes a page for writing to the tablespace. */
|
||||
|
|
@ -79,10 +67,10 @@ UNIV_INTERN
|
|||
void
|
||||
buf_flush_init_for_writing(
|
||||
/*=======================*/
|
||||
byte* page, /*!< in/out: page */
|
||||
void* page_zip_, /*!< in/out: compressed page, or NULL */
|
||||
ib_uint64_t newest_lsn); /*!< in: newest modification lsn
|
||||
to the page */
|
||||
byte* page, /*!< in/out: page */
|
||||
void* page_zip_, /*!< in/out: compressed page, or NULL */
|
||||
lsn_t newest_lsn); /*!< in: newest modification lsn
|
||||
to the page */
|
||||
#ifndef UNIV_HOTBACKUP
|
||||
# if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
|
||||
/********************************************************************//**
|
||||
|
|
@ -99,21 +87,13 @@ buf_flush_page_try(
|
|||
buf_block_t* block) /*!< in/out: buffer control block */
|
||||
__attribute__((nonnull, warn_unused_result));
|
||||
# endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
|
||||
/*******************************************************************//**
|
||||
This utility flushes dirty blocks from the end of the LRU list.
|
||||
NOTE: The calling thread may own latches to pages: to avoid deadlocks,
|
||||
this function must be written so that it cannot end up waiting for these
|
||||
latches!
|
||||
@return number of blocks for which the write request was queued;
|
||||
ULINT_UNDEFINED if there was a flush of the same type already running */
|
||||
/********************************************************************//**
|
||||
Flush a batch of writes to the datafiles that have already been
|
||||
written by the OS. */
|
||||
UNIV_INTERN
|
||||
ulint
|
||||
buf_flush_LRU(
|
||||
/*==========*/
|
||||
buf_pool_t* buf_pool, /*!< in: buffer pool instance */
|
||||
ulint min_n); /*!< in: wished minimum mumber of blocks
|
||||
flushed (it is not guaranteed that the
|
||||
actual number is that big, though) */
|
||||
void
|
||||
buf_flush_sync_datafiles(void);
|
||||
/*==========================*/
|
||||
/*******************************************************************//**
|
||||
This utility flushes dirty blocks from the end of the flush_list of
|
||||
all buffer pool instances.
|
||||
|
|
@ -127,12 +107,25 @@ buf_flush_list(
|
|||
ulint min_n, /*!< in: wished minimum mumber of blocks
|
||||
flushed (it is not guaranteed that the
|
||||
actual number is that big, though) */
|
||||
ib_uint64_t lsn_limit); /*!< in the case BUF_FLUSH_LIST all
|
||||
lsn_t lsn_limit); /*!< in the case BUF_FLUSH_LIST all
|
||||
blocks whose oldest_modification is
|
||||
smaller than this should be flushed
|
||||
(if their number does not exceed
|
||||
min_n), otherwise ignored */
|
||||
/******************************************************************//**
|
||||
This function picks up a single dirty page from the tail of the LRU
|
||||
list, flushes it, removes it from page_hash and LRU list and puts
|
||||
it on the free list. It is called from user threads when they are
|
||||
unable to find a replacable page at the tail of the LRU list i.e.:
|
||||
when the background LRU flushing in the page_cleaner thread is not
|
||||
fast enough to keep pace with the workload.
|
||||
@return TRUE if success. */
|
||||
UNIV_INTERN
|
||||
ibool
|
||||
buf_flush_single_page_from_LRU(
|
||||
/*===========================*/
|
||||
buf_pool_t* buf_pool); /*!< in/out: buffer pool instance */
|
||||
/******************************************************************//**
|
||||
Waits until a flush batch of the given type ends */
|
||||
UNIV_INTERN
|
||||
void
|
||||
|
|
@ -169,9 +162,9 @@ void
|
|||
buf_flush_recv_note_modification(
|
||||
/*=============================*/
|
||||
buf_block_t* block, /*!< in: block which is modified */
|
||||
ib_uint64_t start_lsn, /*!< in: start lsn of the first mtr in a
|
||||
lsn_t start_lsn, /*!< in: start lsn of the first mtr in a
|
||||
set of mtr's */
|
||||
ib_uint64_t end_lsn); /*!< in: end lsn of the last mtr in the
|
||||
lsn_t end_lsn); /*!< in: end lsn of the last mtr in the
|
||||
set of mtr's */
|
||||
/********************************************************************//**
|
||||
Returns TRUE if the file page block is immediately suitable for replacement,
|
||||
|
|
@ -195,8 +188,8 @@ how much redo the workload is generating and at what rate. */
|
|||
|
||||
struct buf_flush_stat_struct
|
||||
{
|
||||
ib_uint64_t redo; /**< amount of redo generated. */
|
||||
ulint n_flushed; /**< number of pages flushed. */
|
||||
lsn_t redo; /**< amount of redo generated. */
|
||||
ulint n_flushed; /**< number of pages flushed. */
|
||||
};
|
||||
|
||||
/** Statistics for selecting flush rate of dirty pages. */
|
||||
|
|
@ -208,18 +201,16 @@ UNIV_INTERN
|
|||
void
|
||||
buf_flush_stat_update(void);
|
||||
/*=======================*/
|
||||
/*********************************************************************
|
||||
Determines the fraction of dirty pages that need to be flushed based
|
||||
on the speed at which we generate redo log. Note that if redo log
|
||||
is generated at significant rate without a corresponding increase
|
||||
in the number of dirty pages (for example, an in-memory workload)
|
||||
it can cause IO bursts of flushing. This function implements heuristics
|
||||
to avoid this burstiness.
|
||||
@return number of dirty pages to be flushed / second */
|
||||
UNIV_INTERN
|
||||
ulint
|
||||
buf_flush_get_desired_flush_rate(void);
|
||||
/*==================================*/
|
||||
/******************************************************************//**
|
||||
page_cleaner thread tasked with flushing dirty pages from the buffer
|
||||
pools. As of now we'll have only one instance of this thread.
|
||||
@return a dummy parameter */
|
||||
extern "C" UNIV_INTERN
|
||||
os_thread_ret_t
|
||||
DECLARE_THREAD(buf_flush_page_cleaner_thread)(
|
||||
/*==========================================*/
|
||||
void* arg); /*!< in: a dummy parameter required by
|
||||
os_thread_create */
|
||||
|
||||
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
|
||||
/******************************************************************//**
|
||||
|
|
@ -247,15 +238,6 @@ UNIV_INTERN
|
|||
void
|
||||
buf_flush_free_flush_rbt(void);
|
||||
/*==========================*/
|
||||
|
||||
/** When buf_flush_free_margin is called, it tries to make this many blocks
|
||||
available to replacement in the free list and at the end of the LRU list (to
|
||||
make sure that a read-ahead batch can be read efficiently in a single
|
||||
sweep). */
|
||||
#define BUF_FLUSH_FREE_BLOCK_MARGIN(b) (5 + BUF_READ_AHEAD_AREA(b))
|
||||
/** Extra margin to apply above BUF_FLUSH_FREE_BLOCK_MARGIN */
|
||||
#define BUF_FLUSH_EXTRA_MARGIN(b) ((BUF_FLUSH_FREE_BLOCK_MARGIN(b) / 4 \
|
||||
+ 100) / srv_buf_pool_instances)
|
||||
#endif /* !UNIV_HOTBACKUP */
|
||||
|
||||
#ifndef UNIV_NONINL
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue