InnoDB Plugin  1.0
Data Structures | Macros | Functions
ibuf0ibuf.ic File Reference
#include "page0page.h"
#include "page0zip.h"
#include "buf0lru.h"
Include dependency graph for ibuf0ibuf.ic:
This graph shows which files directly or indirectly include this file:

Data Structures

struct  ibuf_t

Macros

#define IBUF_PAGE_SIZE_PER_FREE_SPACE   32
#define ibuf_set_free_bits(b, v, max)   ibuf_set_free_bits_func(b,v)

Functions

UNIV_INLINE void ibuf_mtr_start (mtr_t *mtr)
UNIV_INLINE void ibuf_mtr_commit (mtr_t *mtr)
UNIV_INTERN void ibuf_set_free_bits_func (buf_block_t *block, ulint val)
UNIV_INLINE ibool ibuf_should_try (dict_index_t *index, ulint ignore_sec_unique)
UNIV_INLINE ibool ibuf_inside (const mtr_t *mtr)
UNIV_INLINE ibool ibuf_bitmap_page (ulint zip_size, ulint page_no)
UNIV_INLINE ulint ibuf_index_page_calc_free_bits (ulint zip_size, ulint max_ins_size)
UNIV_INLINE ulint ibuf_index_page_calc_free_from_bits (ulint zip_size, ulint bits)
UNIV_INLINE ulint ibuf_index_page_calc_free_zip (ulint zip_size, const buf_block_t *block)
UNIV_INLINE ulint ibuf_index_page_calc_free (ulint zip_size, const buf_block_t *block)
UNIV_INLINE void ibuf_update_free_bits_if_full (buf_block_t *block, ulint max_ins_size, ulint increase)

Detailed Description

Insert buffer

Created 7/19/1997 Heikki Tuuri

Macro Definition Documentation

#define IBUF_PAGE_SIZE_PER_FREE_SPACE   32
An index page must contain at least UNIV_PAGE_SIZE /

IBUF_PAGE_SIZE_PER_FREE_SPACE bytes of free space for ibuf to try to buffer inserts to this page. If there is this much of free space, the corresponding bits are set in the ibuf bitmap.

Function Documentation

UNIV_INLINE ibool ibuf_bitmap_page ( ulint  zip_size,
ulint  page_no 
)

Checks if a page address is an ibuf bitmap page address.

Returns
TRUE if a bitmap page
Parameters
zip_sizein: compressed page size in bytes; 0 for uncompressed pages
page_noin: page number
UNIV_INLINE ulint ibuf_index_page_calc_free ( ulint  zip_size,
const buf_block_t block 
)

Translates the free space on a page to a value in the ibuf bitmap.

Returns
value for ibuf bitmap bits
Parameters
zip_sizein: compressed page size in bytes; 0 for uncompressed pages
blockin: buffer block
UNIV_INLINE ulint ibuf_index_page_calc_free_bits ( ulint  zip_size,
ulint  max_ins_size 
)

Translates the free space on a page to a value in the ibuf bitmap.

Returns
value for ibuf bitmap bits
Parameters
zip_sizein: compressed page size in bytes; 0 for uncompressed pages
max_ins_sizein: maximum insert size after reorganize for the page
UNIV_INLINE ulint ibuf_index_page_calc_free_from_bits ( ulint  zip_size,
ulint  bits 
)

Translates the ibuf free bits to the free space on a page in bytes.

Returns
maximum insert size after reorganize for the page
Parameters
zip_sizein: compressed page size in bytes; 0 for uncompressed pages
bitsin: value for ibuf bitmap bits
UNIV_INLINE ulint ibuf_index_page_calc_free_zip ( ulint  zip_size,
const buf_block_t block 
)

Translates the free space on a compressed page to a value in the ibuf bitmap.

Returns
value for ibuf bitmap bits
Parameters
zip_sizein: compressed page size in bytes
blockin: buffer block
UNIV_INLINE ibool ibuf_inside ( const mtr_t mtr)

Returns TRUE if the current OS thread is performing an insert buffer routine.

For instance, a read-ahead of non-ibuf pages is forbidden by threads that are executing an insert buffer routine.

Returns
TRUE if inside an insert buffer routine
Parameters
mtrin: mini-transaction
UNIV_INLINE void ibuf_mtr_commit ( mtr_t mtr)

Commits an insert buffer mini-transaction.

Parameters
mtrin/out: mini-transaction
UNIV_INLINE void ibuf_mtr_start ( mtr_t mtr)

Starts an insert buffer mini-transaction.

Parameters
mtrout: mini-transaction
UNIV_INTERN void ibuf_set_free_bits_func ( buf_block_t block,
ulint  val 
)

Sets the free bit of the page in the ibuf bitmap. This is done in a separate mini-transaction, hence this operation does not restrict further work to only ibuf bitmap operations, which would result if the latch to the bitmap page were kept. in: value to set: < 4

Parameters
blockin: index page of a non-clustered index; free bit is reset if page level is 0
UNIV_INLINE ibool ibuf_should_try ( dict_index_t index,
ulint  ignore_sec_unique 
)

A basic partial test if an insert to the insert buffer could be possible and recommended.

Parameters
indexin: index where to insert
ignore_sec_uniquein: if != 0, we should ignore UNIQUE constraint on a secondary index when we decide
UNIV_INLINE void ibuf_update_free_bits_if_full ( buf_block_t block,
ulint  max_ins_size,
ulint  increase 
)

Updates the free bits of an uncompressed page in the ibuf bitmap if there is not enough free on the page any more. This is done in a separate mini-transaction, hence this operation does not restrict further work to only ibuf bitmap operations, which would result if the latch to the bitmap page were kept. NOTE: The free bits in the insert buffer bitmap must never exceed the free space on a page. It is unsafe to increment the bits in a separately committed mini-transaction, because in crash recovery, the free bits could momentarily be set too high. It is only safe to use this function for decrementing the free bits. Should more free space become available, we must not update the free bits here, because that would break crash recovery.

Parameters
blockin: index page to which we have added new records; the free bits are updated if the index is non-clustered and non-unique and the page level is 0, and the page becomes fuller
max_ins_sizein: value of maximum insert size with reorganize before the latest operation performed to the page
increasein: upper limit for the additional space used in the latest operation, if known, or ULINT_UNDEFINED