mariadb/storage/innobase/include/buf0flu.h
Marko Mäkelä a8f2f7af32 Bug #56680 wrong InnoDB results from a case-insensitive covering index
row_search_for_mysql(): When a secondary index record might not be
visible in the current transaction's read view and we consult the
clustered index and optionally some undo log records, return the
relevant columns of the clustered index record to MySQL instead of the
secondary index record.

REC_INFO_DELETED_FLAG: Move the definition from rem0rec.ic to rem0rec.h.

ibuf_insert_to_index_page_low(): New function, refactored from
ibuf_insert_to_index_page().

ibuf_insert_to_index_page(): When we are inserting a record in place
of a delete-marked record and some fields of the record differ, update
that record just like row_ins_sec_index_entry_by_modify() would do.

mysql_row_templ_t: Add clust_rec_field_no.

row_sel_store_mysql_rec(), row_sel_push_cache_row_for_mysql(): Add the
flag rec_clust, for returning data at clust_rec_field_no instead of
rec_field_no. Resurrect the debug assertion that the record not be
marked for deletion. (Bug #55626)

buf_LRU_free_block(): Refactored from
buf_LRU_search_and_free_block(). This is needed for the
innodb_change_buffering_debug diagnostics.

[UNIV_DEBUG || UNIV_IBUF_DEBUG] ibuf_debug, buf_page_get_gen(),
buf_flush_page_try():
Implement innodb_change_buffering_debug=1 for evicting pages from the
buffer pool, so that change buffering will be attempted more
frequently.
2010-10-19 08:58:53 +03:00

134 lines
4.9 KiB
C

/******************************************************
The database buffer pool flush algorithm
(c) 1995 Innobase Oy
Created 11/5/1995 Heikki Tuuri
*******************************************************/
#ifndef buf0flu_h
#define buf0flu_h
#include "univ.i"
#include "buf0types.h"
#include "ut0byte.h"
#include "mtr0types.h"
/************************************************************************
Updates the flush system data structures when a write is completed. */
void
buf_flush_write_complete(
/*=====================*/
buf_block_t* block); /* 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. */
void
buf_flush_free_margin(void);
/*=======================*/
/************************************************************************
Initializes a page for writing to the tablespace. */
void
buf_flush_init_for_writing(
/*=======================*/
byte* page, /* in: page */
dulint newest_lsn, /* in: newest modification lsn to the page */
ulint space, /* in: space id */
ulint page_no); /* in: page number */
# if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
/**********************************************************************
Writes a flushable page asynchronously from the buffer pool to a file.
NOTE: buf_pool_mutex and block->mutex must be held upon entering this
function, and they will be released by this function after flushing.
This is loosely based on buf_flush_batch() and buf_flush_try_page(). */
ibool
buf_flush_page_try(
/*===============*/
/* out: TRUE if flushed and
mutexes released */
buf_block_t* block); /*!< in/out: buffer control block */
#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
/***********************************************************************
This utility flushes dirty blocks from the end of the LRU list or flush_list.
NOTE 1: in the case of an LRU flush 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! NOTE 2: in the case of a flush list flush,
the calling thread is not allowed to own any latches on pages! */
ulint
buf_flush_batch(
/*============*/
/* out: number of blocks for which the write
request was queued */
ulint flush_type, /* in: BUF_FLUSH_LRU or BUF_FLUSH_LIST; if
BUF_FLUSH_LIST, then the caller must not own
any latches on pages */
ulint min_n, /* in: wished minimum mumber of blocks flushed
(it is not guaranteed that the actual number
is that big, though) */
dulint 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 */
/**********************************************************************
Waits until a flush batch of the given type ends */
void
buf_flush_wait_batch_end(
/*=====================*/
ulint type); /* in: BUF_FLUSH_LRU or BUF_FLUSH_LIST */
/************************************************************************
This function should be called at a mini-transaction commit, if a page was
modified in it. Puts the block to the list of modified blocks, if it not
already in it. */
UNIV_INLINE
void
buf_flush_note_modification(
/*========================*/
buf_block_t* block, /* in: block which is modified */
mtr_t* mtr); /* in: mtr */
/************************************************************************
This function should be called when recovery has modified a buffer page. */
UNIV_INLINE
void
buf_flush_recv_note_modification(
/*=============================*/
buf_block_t* block, /* in: block which is modified */
dulint start_lsn, /* in: start lsn of the first mtr in a
set of mtr's */
dulint 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,
i.e., transition FILE_PAGE => NOT_USED allowed. */
ibool
buf_flush_ready_for_replace(
/*========================*/
/* out: TRUE if can replace immediately */
buf_block_t* block); /* in: buffer control block, must be in state
BUF_BLOCK_FILE_PAGE and in the LRU list */
/**********************************************************************
Validates the flush list. */
ibool
buf_flush_validate(void);
/*====================*/
/* out: TRUE if ok */
/* 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 (5 + BUF_READ_AHEAD_AREA)
#define BUF_FLUSH_EXTRA_MARGIN (BUF_FLUSH_FREE_BLOCK_MARGIN / 4 + 100)
#ifndef UNIV_NONINL
#include "buf0flu.ic"
#endif
#endif