mirror of
https://github.com/MariaDB/server.git
synced 2025-09-02 09:41:40 +03:00
Update to innoplug-1.0.4.
This commit is contained in:
@@ -76,6 +76,7 @@ struct buf_buddy_stat_struct {
|
||||
ib_uint64_t relocated_usec;
|
||||
};
|
||||
|
||||
/** Statistics of buddy blocks of a given size. */
|
||||
typedef struct buf_buddy_stat_struct buf_buddy_stat_t;
|
||||
|
||||
/** Statistics of the buddy system, indexed by block size.
|
||||
|
@@ -36,7 +36,7 @@ Created 11/5/1995 Heikki Tuuri
|
||||
#ifndef UNIV_HOTBACKUP
|
||||
#include "os0proc.h"
|
||||
|
||||
/** Modes for buf_page_get_gen */
|
||||
/** @name Modes for buf_page_get_gen */
|
||||
/* @{ */
|
||||
#define BUF_GET 10 /*!< get always */
|
||||
#define BUF_GET_IF_IN_POOL 11 /*!< get if in pool */
|
||||
@@ -47,7 +47,7 @@ Created 11/5/1995 Heikki Tuuri
|
||||
not to set a latch, and it
|
||||
should be used with care */
|
||||
/* @} */
|
||||
/** Modes for buf_page_get_known_nowait */
|
||||
/** @name Modes for buf_page_get_known_nowait */
|
||||
/* @{ */
|
||||
#define BUF_MAKE_YOUNG 51 /*!< Move the block to the
|
||||
start of the LRU list if there
|
||||
@@ -242,7 +242,7 @@ buf_page_get_known_nowait(
|
||||
Given a tablespace id and page number tries to get that page. If the
|
||||
page is not in the buffer pool it is not loaded and NULL is returned.
|
||||
Suitable for using when holding the kernel mutex. */
|
||||
|
||||
UNIV_INTERN
|
||||
const buf_block_t*
|
||||
buf_page_try_get_func(
|
||||
/*==================*/
|
||||
@@ -252,6 +252,12 @@ buf_page_try_get_func(
|
||||
ulint line, /*!< in: line where called */
|
||||
mtr_t* mtr); /*!< in: mini-transaction */
|
||||
|
||||
/** Tries to get a page. If the page is not in the buffer pool it is
|
||||
not loaded. Suitable for using when holding the kernel mutex.
|
||||
@param space_id in: tablespace id
|
||||
@param page_no in: page number
|
||||
@param mtr in: mini-transaction
|
||||
@return the page if in buffer pool, NULL if not */
|
||||
#define buf_page_try_get(space_id, page_no, mtr) \
|
||||
buf_page_try_get_func(space_id, page_no, __FILE__, __LINE__, mtr);
|
||||
|
||||
@@ -928,10 +934,16 @@ buf_pointer_is_block_field(
|
||||
/*=======================*/
|
||||
const void* ptr); /*!< in: pointer not
|
||||
dereferenced */
|
||||
#define buf_pool_is_block_mutex(m) \
|
||||
buf_pointer_is_block_field((void *)(m))
|
||||
#define buf_pool_is_block_lock(l) \
|
||||
buf_pointer_is_block_field((void *)(l))
|
||||
/** Find out if a pointer corresponds to a buf_block_t::mutex.
|
||||
@param m in: mutex candidate
|
||||
@return TRUE if m is a buf_block_t::mutex */
|
||||
#define buf_pool_is_block_mutex(m) \
|
||||
buf_pointer_is_block_field((const void*)(m))
|
||||
/** Find out if a pointer corresponds to a buf_block_t::lock.
|
||||
@param l in: rw-lock candidate
|
||||
@return TRUE if l is a buf_block_t::lock */
|
||||
#define buf_pool_is_block_lock(l) \
|
||||
buf_pointer_is_block_field((const void*)(l))
|
||||
|
||||
#if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
|
||||
/*********************************************************************//**
|
||||
@@ -945,15 +957,6 @@ buf_frame_get_page_zip(
|
||||
const byte* ptr); /*!< in: pointer to the page */
|
||||
#endif /* UNIV_DEBUG || UNIV_ZIP_DEBUG */
|
||||
/********************************************************************//**
|
||||
This function is used to get info if there is an io operation
|
||||
going on on a buffer page.
|
||||
@return TRUE if io going on */
|
||||
UNIV_INLINE
|
||||
ibool
|
||||
buf_page_io_query(
|
||||
/*==============*/
|
||||
buf_page_t* bpage); /*!< in: pool block, must be bufferfixed */
|
||||
/********************************************************************//**
|
||||
Function which inits a page for read to the buffer buf_pool. If the page is
|
||||
(1) already in buf_pool, or
|
||||
(2) if we specify to read only ibuf pages and the page is not an ibuf page, or
|
||||
@@ -1036,10 +1039,12 @@ buf_get_free_list_len(void);
|
||||
for compressed and uncompressed frames */
|
||||
|
||||
struct buf_page_struct{
|
||||
/** None of the following bit-fields must be modified without
|
||||
holding buf_page_get_mutex() [block->mutex or buf_pool_zip_mutex],
|
||||
since they can be stored in the same machine word. Some of them are
|
||||
additionally protected by buf_pool_mutex. */
|
||||
/** @name General fields
|
||||
None of these bit-fields must be modified without holding
|
||||
buf_page_get_mutex() [buf_block_struct::mutex or
|
||||
buf_pool_zip_mutex], since they can be stored in the same
|
||||
machine word. Some of these fields are additionally protected
|
||||
by buf_pool_mutex. */
|
||||
/* @{ */
|
||||
|
||||
unsigned space:32; /*!< tablespace id; also protected
|
||||
@@ -1084,8 +1089,8 @@ struct buf_page_struct{
|
||||
ibool in_zip_hash; /*!< TRUE if in buf_pool->zip_hash */
|
||||
#endif /* UNIV_DEBUG */
|
||||
|
||||
/** @defgroup buf_page_flush Page flushing fields; protected
|
||||
by buf_pool_mutex */
|
||||
/** @name Page flushing fields
|
||||
All these are protected by buf_pool_mutex. */
|
||||
/* @{ */
|
||||
|
||||
UT_LIST_NODE_T(buf_page_t) list;
|
||||
@@ -1094,11 +1099,11 @@ struct buf_page_struct{
|
||||
buf_pool_mutex, in one of the
|
||||
following lists in buf_pool:
|
||||
|
||||
BUF_BLOCK_NOT_USED: free
|
||||
BUF_BLOCK_FILE_PAGE: flush_list
|
||||
BUF_BLOCK_ZIP_DIRTY: flush_list
|
||||
BUF_BLOCK_ZIP_PAGE: zip_clean
|
||||
BUF_BLOCK_ZIP_FREE: zip_free[] */
|
||||
- BUF_BLOCK_NOT_USED: free
|
||||
- BUF_BLOCK_FILE_PAGE: flush_list
|
||||
- BUF_BLOCK_ZIP_DIRTY: flush_list
|
||||
- BUF_BLOCK_ZIP_PAGE: zip_clean
|
||||
- BUF_BLOCK_ZIP_FREE: zip_free[] */
|
||||
#ifdef UNIV_DEBUG
|
||||
ibool in_flush_list; /*!< TRUE if in buf_pool->flush_list;
|
||||
when buf_pool_mutex is free, the
|
||||
@@ -1124,10 +1129,9 @@ struct buf_page_struct{
|
||||
on disk; zero if all
|
||||
modifications are on disk */
|
||||
/* @} */
|
||||
/** @defgroup buf_LRU LRU replacement algorithm */
|
||||
/** @ingroup buf_LRU
|
||||
protected by buf_pool_mutex only (not buf_pool_zip_mutex or
|
||||
buf_block_struct::mutex) */
|
||||
/** @name LRU replacement algorithm fields
|
||||
These fields are protected by buf_pool_mutex only (not
|
||||
buf_pool_zip_mutex or buf_block_struct::mutex). */
|
||||
/* @{ */
|
||||
|
||||
UT_LIST_NODE_T(buf_page_t) LRU;
|
||||
@@ -1158,11 +1162,11 @@ struct buf_page_struct{
|
||||
purposes without holding any
|
||||
mutex or latch */
|
||||
/* @} */
|
||||
#ifdef UNIV_DEBUG_FILE_ACCESSES
|
||||
# ifdef UNIV_DEBUG_FILE_ACCESSES
|
||||
ibool file_page_was_freed;
|
||||
/*!< this is set to TRUE when fsp
|
||||
frees a page in buffer pool */
|
||||
#endif /* UNIV_DEBUG_FILE_ACCESSES */
|
||||
# endif /* UNIV_DEBUG_FILE_ACCESSES */
|
||||
#endif /* !UNIV_HOTBACKUP */
|
||||
};
|
||||
|
||||
@@ -1170,7 +1174,7 @@ struct buf_page_struct{
|
||||
|
||||
struct buf_block_struct{
|
||||
|
||||
/** @defgroup buf_block_general General fields */
|
||||
/** @name General fields */
|
||||
/* @{ */
|
||||
|
||||
buf_page_t page; /*!< page information; this must
|
||||
@@ -1211,7 +1215,7 @@ struct buf_block_struct{
|
||||
but this flag is not set because
|
||||
we do not keep track of all pages */
|
||||
/* @} */
|
||||
/** @defgroup buf_block_search Optimistic search field */
|
||||
/** @name Optimistic search field */
|
||||
/* @{ */
|
||||
|
||||
ib_uint64_t modify_clock; /*!< this clock is incremented every
|
||||
@@ -1226,9 +1230,8 @@ struct buf_block_struct{
|
||||
bufferfixed, or (2) the thread has an
|
||||
x-latch on the block */
|
||||
/* @} */
|
||||
/** @defgroup buf_block_hash Hash search fields */
|
||||
/** @ingroup buf_block_hash
|
||||
NOTE that the first 4 fields are NOT protected by any semaphore! */
|
||||
/** @name Hash search fields (unprotected)
|
||||
NOTE that these fields are NOT protected by any semaphore! */
|
||||
/* @{ */
|
||||
|
||||
ulint n_hash_helps; /*!< counter which controls building
|
||||
@@ -1243,11 +1246,11 @@ struct buf_block_struct{
|
||||
indexed in the hash index */
|
||||
/* @} */
|
||||
|
||||
/** @ingroup buf_block_hash
|
||||
/** @name Hash search fields
|
||||
These 6 fields may only be modified when we have
|
||||
an x-latch on btr_search_latch AND
|
||||
a) we are holding an s-latch or x-latch on buf_block_struct::lock or
|
||||
b) we know that buf_block_struct::buf_fix_count == 0.
|
||||
- we are holding an s-latch or x-latch on buf_block_struct::lock or
|
||||
- we know that buf_block_struct::buf_fix_count == 0.
|
||||
|
||||
An exception to this is when we init or create a page
|
||||
in the buffer pool in buf0buf.c. */
|
||||
@@ -1274,15 +1277,15 @@ struct buf_block_struct{
|
||||
dict_index_t* index; /*!< Index for which the adaptive
|
||||
hash index has been created. */
|
||||
/* @} */
|
||||
/** Debug fields */
|
||||
# ifdef UNIV_SYNC_DEBUG
|
||||
/** @name Debug fields */
|
||||
/* @{ */
|
||||
#ifdef UNIV_SYNC_DEBUG
|
||||
rw_lock_t debug_latch; /*!< in the debug version, each thread
|
||||
which bufferfixes the block acquires
|
||||
an s-latch here; so we can use the
|
||||
debug utilities in sync0rw */
|
||||
#endif
|
||||
/* @} */
|
||||
# endif
|
||||
#endif /* !UNIV_HOTBACKUP */
|
||||
};
|
||||
|
||||
@@ -1300,6 +1303,7 @@ Compute the hash fold value for blocks in buf_pool->zip_hash. */
|
||||
#define BUF_POOL_ZIP_FOLD_PTR(ptr) ((ulint) (ptr) / UNIV_PAGE_SIZE)
|
||||
#define BUF_POOL_ZIP_FOLD(b) BUF_POOL_ZIP_FOLD_PTR((b)->frame)
|
||||
#define BUF_POOL_ZIP_FOLD_BPAGE(b) BUF_POOL_ZIP_FOLD((buf_block_t*) (b))
|
||||
/* @} */
|
||||
|
||||
/** @brief The buffer pool structure.
|
||||
|
||||
@@ -1308,7 +1312,7 @@ directory (buf) to see it. Do not use from outside! */
|
||||
|
||||
struct buf_pool_struct{
|
||||
|
||||
/** @defgroup buf_pool_general General fields */
|
||||
/** @name General fields */
|
||||
/* @{ */
|
||||
|
||||
ulint n_chunks; /*!< number of buffer pool chunks */
|
||||
@@ -1346,7 +1350,7 @@ struct buf_pool_struct{
|
||||
ulint n_pages_created_old;/*!< number of pages created in
|
||||
the pool with no read */
|
||||
/* @} */
|
||||
/** @defgroup buf_pool_flush Page flushing algorithm fields */
|
||||
/** @name Page flushing algorithm fields */
|
||||
/* @{ */
|
||||
|
||||
UT_LIST_BASE_NODE_T(buf_page_t) flush_list;
|
||||
@@ -1381,7 +1385,7 @@ struct buf_pool_struct{
|
||||
allocated */
|
||||
|
||||
/* @} */
|
||||
/** @defgroup buf_LRU LRU replacement algorithm */
|
||||
/** @name LRU replacement algorithm fields */
|
||||
/* @{ */
|
||||
|
||||
UT_LIST_BASE_NODE_T(buf_page_t) free;
|
||||
@@ -1408,7 +1412,10 @@ struct buf_pool_struct{
|
||||
unzip_LRU list */
|
||||
|
||||
/* @} */
|
||||
/** @defgroup buf_buddy Buddy allocator of compressed pages */
|
||||
/** @name Buddy allocator fields
|
||||
The buddy allocator is used for allocating compressed page
|
||||
frames and buf_page_t descriptors of blocks that exist
|
||||
in the buffer pool only in compressed form. */
|
||||
/* @{ */
|
||||
UT_LIST_BASE_NODE_T(buf_page_t) zip_clean;
|
||||
/*!< unmodified compressed pages */
|
||||
@@ -1430,8 +1437,8 @@ extern mutex_t buf_pool_mutex;
|
||||
(of type buf_page_t, not buf_block_t) */
|
||||
extern mutex_t buf_pool_zip_mutex;
|
||||
|
||||
/** Accessors for buf_pool_mutex. Use these instead of accessing
|
||||
buf_pool_mutex directly. */
|
||||
/** @name Accessors for buf_pool_mutex.
|
||||
Use these instead of accessing buf_pool_mutex directly. */
|
||||
/* @{ */
|
||||
|
||||
/** Test if buf_pool_mutex is owned. */
|
||||
|
@@ -779,29 +779,6 @@ buf_page_address_fold(
|
||||
return((space << 20) + space + offset);
|
||||
}
|
||||
|
||||
/********************************************************************//**
|
||||
This function is used to get info if there is an io operation
|
||||
going on on a buffer page.
|
||||
@return TRUE if io going on */
|
||||
UNIV_INLINE
|
||||
ibool
|
||||
buf_page_io_query(
|
||||
/*==============*/
|
||||
buf_page_t* bpage) /*!< in: buf_pool block, must be bufferfixed */
|
||||
{
|
||||
ibool io_fixed;
|
||||
|
||||
buf_pool_mutex_enter();
|
||||
|
||||
ut_ad(buf_page_in_file(bpage));
|
||||
ut_ad(bpage->buf_fix_count > 0);
|
||||
|
||||
io_fixed = buf_page_get_io_fix(bpage) != BUF_IO_NONE;
|
||||
buf_pool_mutex_exit();
|
||||
|
||||
return(io_fixed);
|
||||
}
|
||||
|
||||
/********************************************************************//**
|
||||
Gets the youngest modification log sequence number for a frame.
|
||||
Returns zero if not file page or no modification occurred yet.
|
||||
|
@@ -127,6 +127,44 @@ buf_flush_ready_for_replace(
|
||||
/*========================*/
|
||||
buf_page_t* bpage); /*!< in: buffer control block, must be
|
||||
buf_page_in_file(bpage) and in the LRU list */
|
||||
|
||||
/** @brief Statistics for selecting flush rate based on redo log
|
||||
generation speed.
|
||||
|
||||
These statistics are generated for heuristics used in estimating the
|
||||
rate at which we should flush the dirty blocks to avoid bursty IO
|
||||
activity. Note that the rate of flushing not only depends on how many
|
||||
dirty pages we have in the buffer pool but it is also a fucntion of
|
||||
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. */
|
||||
};
|
||||
|
||||
/** Statistics for selecting flush rate of dirty pages. */
|
||||
typedef struct buf_flush_stat_struct buf_flush_stat_t;
|
||||
/*********************************************************************
|
||||
Update the historical stats that we are collecting for flush rate
|
||||
heuristics at the end of each interval. */
|
||||
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);
|
||||
/*==================================*/
|
||||
|
||||
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
|
||||
/******************************************************************//**
|
||||
Validates the flush list.
|
||||
|
@@ -68,10 +68,10 @@ buf_LRU_buf_pool_running_out(void);
|
||||
These are low-level functions
|
||||
#########################################################################*/
|
||||
|
||||
/* Minimum LRU list length for which the LRU_old pointer is defined */
|
||||
|
||||
/** Minimum LRU list length for which the LRU_old pointer is defined */
|
||||
#define BUF_LRU_OLD_MIN_LEN 80
|
||||
|
||||
/** Maximum LRU list search length in buf_flush_LRU_recommendation() */
|
||||
#define BUF_LRU_FREE_SEARCH_LEN (5 + 2 * BUF_READ_AHEAD_AREA)
|
||||
|
||||
/******************************************************************//**
|
||||
@@ -227,18 +227,18 @@ buf_LRU_print(void);
|
||||
/*===============*/
|
||||
#endif /* UNIV_DEBUG_PRINT || UNIV_DEBUG || UNIV_BUF_DEBUG */
|
||||
|
||||
/******************************************************************//**
|
||||
/** @brief Statistics for selecting the LRU list for eviction.
|
||||
|
||||
These statistics are not 'of' LRU but 'for' LRU. We keep count of I/O
|
||||
and page_zip_decompress() operations. Based on the statistics we decide
|
||||
if we want to evict from buf_pool->unzip_LRU or buf_pool->LRU. */
|
||||
|
||||
/** Statistics for selecting the LRU list for eviction. */
|
||||
struct buf_LRU_stat_struct
|
||||
{
|
||||
ulint io; /**< Counter of buffer pool I/O operations. */
|
||||
ulint unzip; /**< Counter of page_zip_decompress operations. */
|
||||
};
|
||||
|
||||
/** Statistics for selecting the LRU list for eviction. */
|
||||
typedef struct buf_LRU_stat_struct buf_LRU_stat_t;
|
||||
|
||||
/** Current operation counters. Not protected by any mutex.
|
||||
|
@@ -124,14 +124,16 @@ buf_read_recv_pages(
|
||||
ulint n_stored); /*!< in: number of page numbers
|
||||
in the array */
|
||||
|
||||
/* The size in pages of the area which the read-ahead algorithms read if
|
||||
/** The size in pages of the area which the read-ahead algorithms read if
|
||||
invoked */
|
||||
|
||||
#define BUF_READ_AHEAD_AREA \
|
||||
ut_min(64, ut_2_power_up(buf_pool->curr_size / 32))
|
||||
|
||||
/* Modes used in read-ahead */
|
||||
/** @name Modes used in read-ahead @{ */
|
||||
/** read only pages belonging to the insert buffer tree */
|
||||
#define BUF_READ_IBUF_PAGES_ONLY 131
|
||||
/** read any page */
|
||||
#define BUF_READ_ANY_PAGE 132
|
||||
/* @} */
|
||||
|
||||
#endif
|
||||
|
@@ -278,7 +278,8 @@ dtype_get_mblen(
|
||||
ulint* mbmaxlen); /*!< out: maximum length of a
|
||||
multi-byte character */
|
||||
/*********************************************************************//**
|
||||
Gets the MySQL charset-collation code for MySQL string types. */
|
||||
Gets the MySQL charset-collation code for MySQL string types.
|
||||
@return MySQL charset-collation code */
|
||||
UNIV_INLINE
|
||||
ulint
|
||||
dtype_get_charset_coll(
|
||||
@@ -286,7 +287,8 @@ dtype_get_charset_coll(
|
||||
ulint prtype);/*!< in: precise data type */
|
||||
/*********************************************************************//**
|
||||
Forms a precise type from the < 4.1.2 format precise type plus the
|
||||
charset-collation code. */
|
||||
charset-collation code.
|
||||
@return precise type, including the charset-collation code */
|
||||
UNIV_INTERN
|
||||
ulint
|
||||
dtype_form_prtype(
|
||||
|
@@ -28,7 +28,8 @@ Created 1/16/1996 Heikki Tuuri
|
||||
# include "ha_prototypes.h"
|
||||
|
||||
/*********************************************************************//**
|
||||
Gets the MySQL charset-collation code for MySQL string types. */
|
||||
Gets the MySQL charset-collation code for MySQL string types.
|
||||
@return MySQL charset-collation code */
|
||||
UNIV_INLINE
|
||||
ulint
|
||||
dtype_get_charset_coll(
|
||||
|
@@ -32,37 +32,7 @@ Created 12/18/1995 Heikki Tuuri
|
||||
#include "fut0lst.h"
|
||||
#include "ut0byte.h"
|
||||
#include "page0types.h"
|
||||
|
||||
/** If records are inserted in order, there are the following
|
||||
flags to tell this (their type is made byte for the compiler
|
||||
to warn if direction and hint parameters are switched in
|
||||
fseg_alloc_free_page): */
|
||||
/* @{ */
|
||||
#define FSP_UP ((byte)111) /*!< alphabetically upwards */
|
||||
#define FSP_DOWN ((byte)112) /*!< alphabetically downwards */
|
||||
#define FSP_NO_DIR ((byte)113) /*!< no order */
|
||||
/* @} */
|
||||
|
||||
/** File space extent size (one megabyte) in pages */
|
||||
#define FSP_EXTENT_SIZE (1 << (20 - UNIV_PAGE_SIZE_SHIFT))
|
||||
|
||||
/** On a page of any file segment, data may be put starting from this
|
||||
offset */
|
||||
#define FSEG_PAGE_DATA FIL_PAGE_DATA
|
||||
|
||||
/** File segment header which points to the inode describing the file
|
||||
segment */
|
||||
/* @{ */
|
||||
/** Data type for file segment header */
|
||||
typedef byte fseg_header_t;
|
||||
|
||||
#define FSEG_HDR_SPACE 0 /*!< space id of the inode */
|
||||
#define FSEG_HDR_PAGE_NO 4 /*!< page number of the inode */
|
||||
#define FSEG_HDR_OFFSET 8 /*!< byte offset of the inode */
|
||||
|
||||
#define FSEG_HEADER_SIZE 10 /*!< Length of the file system
|
||||
header, in bytes */
|
||||
/* @} */
|
||||
#include "fsp0types.h"
|
||||
|
||||
/**********************************************************************//**
|
||||
Initializes the file space system. */
|
||||
@@ -299,20 +269,6 @@ fseg_free_page(
|
||||
ulint space, /*!< in: space id */
|
||||
ulint page, /*!< in: page offset */
|
||||
mtr_t* mtr); /*!< in: mtr handle */
|
||||
/*******************************************************************//**
|
||||
Frees a segment. The freeing is performed in several mini-transactions,
|
||||
so that there is no danger of bufferfixing too many buffer pages. */
|
||||
UNIV_INTERN
|
||||
void
|
||||
fseg_free(
|
||||
/*======*/
|
||||
ulint space, /*!< in: space id */
|
||||
ulint zip_size,/*!< in: compressed page size in bytes
|
||||
or 0 for uncompressed pages */
|
||||
ulint page_no,/*!< in: page number where the segment header is
|
||||
placed */
|
||||
ulint offset);/*!< in: byte offset of the segment header on that
|
||||
page */
|
||||
/**********************************************************************//**
|
||||
Frees part of a segment. This function can be used to free a segment
|
||||
by repeatedly calling this function in different mini-transactions.
|
||||
@@ -374,6 +330,7 @@ void
|
||||
fsp_print(
|
||||
/*======*/
|
||||
ulint space); /*!< in: space id */
|
||||
#ifdef UNIV_DEBUG
|
||||
/*******************************************************************//**
|
||||
Validates a segment.
|
||||
@return TRUE if ok */
|
||||
@@ -382,7 +339,8 @@ ibool
|
||||
fseg_validate(
|
||||
/*==========*/
|
||||
fseg_header_t* header, /*!< in: segment header */
|
||||
mtr_t* mtr2); /*!< in: mtr */
|
||||
mtr_t* mtr); /*!< in: mtr */
|
||||
#endif /* UNIV_DEBUG */
|
||||
#ifdef UNIV_BTR_PRINT
|
||||
/*******************************************************************//**
|
||||
Writes info of a segment. */
|
||||
@@ -394,41 +352,6 @@ fseg_print(
|
||||
mtr_t* mtr); /*!< in: mtr */
|
||||
#endif /* UNIV_BTR_PRINT */
|
||||
|
||||
/* Flags for fsp_reserve_free_extents */
|
||||
#define FSP_NORMAL 1000000
|
||||
#define FSP_UNDO 2000000
|
||||
#define FSP_CLEANING 3000000
|
||||
|
||||
/* Number of pages described in a single descriptor page: currently each page
|
||||
description takes less than 1 byte; a descriptor page is repeated every
|
||||
this many file pages */
|
||||
/* #define XDES_DESCRIBED_PER_PAGE UNIV_PAGE_SIZE */
|
||||
/* This has been replaced with either UNIV_PAGE_SIZE or page_zip->size. */
|
||||
|
||||
/* The space low address page map */
|
||||
/*--------------------------------------*/
|
||||
/* The following two pages are repeated
|
||||
every XDES_DESCRIBED_PER_PAGE pages in
|
||||
every tablespace. */
|
||||
#define FSP_XDES_OFFSET 0 /* extent descriptor */
|
||||
#define FSP_IBUF_BITMAP_OFFSET 1 /* insert buffer bitmap */
|
||||
/* The ibuf bitmap pages are the ones whose
|
||||
page number is the number above plus a
|
||||
multiple of XDES_DESCRIBED_PER_PAGE */
|
||||
|
||||
#define FSP_FIRST_INODE_PAGE_NO 2 /* in every tablespace */
|
||||
/* The following pages exist
|
||||
in the system tablespace (space 0). */
|
||||
#define FSP_IBUF_HEADER_PAGE_NO 3 /* in tablespace 0 */
|
||||
#define FSP_IBUF_TREE_ROOT_PAGE_NO 4 /* in tablespace 0 */
|
||||
/* The ibuf tree root page number in
|
||||
tablespace 0; its fseg inode is on the page
|
||||
number FSP_FIRST_INODE_PAGE_NO */
|
||||
#define FSP_TRX_SYS_PAGE_NO 5 /* in tablespace 0 */
|
||||
#define FSP_FIRST_RSEG_PAGE_NO 6 /* in tablespace 0 */
|
||||
#define FSP_DICT_HDR_PAGE_NO 7 /* in tablespace 0 */
|
||||
/*--------------------------------------*/
|
||||
|
||||
#ifndef UNIV_NONINL
|
||||
#include "fsp0fsp.ic"
|
||||
#endif
|
||||
|
110
storage/innodb_plugin/include/fsp0types.h
Normal file
110
storage/innodb_plugin/include/fsp0types.h
Normal file
@@ -0,0 +1,110 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1995, 2009, Innobase Oy. 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
|
||||
Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
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
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************
|
||||
@file include/fsp0types.h
|
||||
File space management types
|
||||
|
||||
Created May 26, 2009 Vasil Dimov
|
||||
*******************************************************/
|
||||
|
||||
#ifndef fsp0types_h
|
||||
#define fsp0types_h
|
||||
|
||||
#include "univ.i"
|
||||
|
||||
#include "fil0fil.h" /* for FIL_PAGE_DATA */
|
||||
|
||||
/** @name Flags for inserting records in order
|
||||
If records are inserted in order, there are the following
|
||||
flags to tell this (their type is made byte for the compiler
|
||||
to warn if direction and hint parameters are switched in
|
||||
fseg_alloc_free_page) */
|
||||
/* @{ */
|
||||
#define FSP_UP ((byte)111) /*!< alphabetically upwards */
|
||||
#define FSP_DOWN ((byte)112) /*!< alphabetically downwards */
|
||||
#define FSP_NO_DIR ((byte)113) /*!< no order */
|
||||
/* @} */
|
||||
|
||||
/** File space extent size (one megabyte) in pages */
|
||||
#define FSP_EXTENT_SIZE (1 << (20 - UNIV_PAGE_SIZE_SHIFT))
|
||||
|
||||
/** On a page of any file segment, data may be put starting from this
|
||||
offset */
|
||||
#define FSEG_PAGE_DATA FIL_PAGE_DATA
|
||||
|
||||
/** @name File segment header
|
||||
The file segment header points to the inode describing the file segment. */
|
||||
/* @{ */
|
||||
/** Data type for file segment header */
|
||||
typedef byte fseg_header_t;
|
||||
|
||||
#define FSEG_HDR_SPACE 0 /*!< space id of the inode */
|
||||
#define FSEG_HDR_PAGE_NO 4 /*!< page number of the inode */
|
||||
#define FSEG_HDR_OFFSET 8 /*!< byte offset of the inode */
|
||||
|
||||
#define FSEG_HEADER_SIZE 10 /*!< Length of the file system
|
||||
header, in bytes */
|
||||
/* @} */
|
||||
|
||||
/** Flags for fsp_reserve_free_extents @{ */
|
||||
#define FSP_NORMAL 1000000
|
||||
#define FSP_UNDO 2000000
|
||||
#define FSP_CLEANING 3000000
|
||||
/* @} */
|
||||
|
||||
/* Number of pages described in a single descriptor page: currently each page
|
||||
description takes less than 1 byte; a descriptor page is repeated every
|
||||
this many file pages */
|
||||
/* #define XDES_DESCRIBED_PER_PAGE UNIV_PAGE_SIZE */
|
||||
/* This has been replaced with either UNIV_PAGE_SIZE or page_zip->size. */
|
||||
|
||||
/** @name The space low address page map
|
||||
The pages at FSP_XDES_OFFSET and FSP_IBUF_BITMAP_OFFSET are repeated
|
||||
every XDES_DESCRIBED_PER_PAGE pages in every tablespace. */
|
||||
/* @{ */
|
||||
/*--------------------------------------*/
|
||||
#define FSP_XDES_OFFSET 0 /* !< extent descriptor */
|
||||
#define FSP_IBUF_BITMAP_OFFSET 1 /* !< insert buffer bitmap */
|
||||
/* The ibuf bitmap pages are the ones whose
|
||||
page number is the number above plus a
|
||||
multiple of XDES_DESCRIBED_PER_PAGE */
|
||||
|
||||
#define FSP_FIRST_INODE_PAGE_NO 2 /*!< in every tablespace */
|
||||
/* The following pages exist
|
||||
in the system tablespace (space 0). */
|
||||
#define FSP_IBUF_HEADER_PAGE_NO 3 /*!< insert buffer
|
||||
header page, in
|
||||
tablespace 0 */
|
||||
#define FSP_IBUF_TREE_ROOT_PAGE_NO 4 /*!< insert buffer
|
||||
B-tree root page in
|
||||
tablespace 0 */
|
||||
/* The ibuf tree root page number in
|
||||
tablespace 0; its fseg inode is on the page
|
||||
number FSP_FIRST_INODE_PAGE_NO */
|
||||
#define FSP_TRX_SYS_PAGE_NO 5 /*!< transaction
|
||||
system header, in
|
||||
tablespace 0 */
|
||||
#define FSP_FIRST_RSEG_PAGE_NO 6 /*!< first rollback segment
|
||||
page, in tablespace 0 */
|
||||
#define FSP_DICT_HDR_PAGE_NO 7 /*!< data dictionary header
|
||||
page, in tablespace 0 */
|
||||
/*--------------------------------------*/
|
||||
/* @} */
|
||||
|
||||
#endif /* fsp0types_h */
|
@@ -164,16 +164,6 @@ is inserted.
|
||||
# define ha_insert_for_fold(t,f,b,d) ha_insert_for_fold_func(t,f,d)
|
||||
#endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
|
||||
|
||||
/*************************************************************//**
|
||||
Deletes an entry from a hash table. */
|
||||
UNIV_INTERN
|
||||
void
|
||||
ha_delete(
|
||||
/*======*/
|
||||
hash_table_t* table, /*!< in: hash table */
|
||||
ulint fold, /*!< in: folded value of data */
|
||||
void* data); /*!< in: data, must not be NULL and must exist
|
||||
in the hash table */
|
||||
/*********************************************************//**
|
||||
Looks for an element when we know the pointer to the data and deletes
|
||||
it from the hash table if found.
|
||||
|
@@ -461,14 +461,6 @@ lock_table(
|
||||
dict_table_t* table, /*!< in: database table in dictionary cache */
|
||||
enum lock_mode mode, /*!< in: lock mode */
|
||||
que_thr_t* thr); /*!< in: query thread */
|
||||
/*********************************************************************//**
|
||||
Checks if there are any locks set on the table.
|
||||
@return TRUE if there are lock(s) */
|
||||
UNIV_INTERN
|
||||
ibool
|
||||
lock_is_on_table(
|
||||
/*=============*/
|
||||
dict_table_t* table); /*!< in: database table in dictionary cache */
|
||||
/*************************************************************//**
|
||||
Removes a granted record lock of a transaction from the queue and grants
|
||||
locks to other transactions waiting in the queue if they now are entitled
|
||||
@@ -483,14 +475,6 @@ lock_rec_unlock(
|
||||
const rec_t* rec, /*!< in: record */
|
||||
enum lock_mode lock_mode);/*!< in: LOCK_S or LOCK_X */
|
||||
/*********************************************************************//**
|
||||
Releases a table lock.
|
||||
Releases possible other transactions waiting for this lock. */
|
||||
UNIV_INTERN
|
||||
void
|
||||
lock_table_unlock(
|
||||
/*==============*/
|
||||
lock_t* lock); /*!< in: lock */
|
||||
/*********************************************************************//**
|
||||
Releases transaction locks, and releases possible other transactions waiting
|
||||
because of these locks. */
|
||||
UNIV_INTERN
|
||||
|
@@ -14,6 +14,30 @@ 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
|
||||
|
||||
*****************************************************************************/
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
|
||||
Copyright (c) 2009, Google Inc.
|
||||
|
||||
Portions of this file contain modifications contributed and copyrighted by
|
||||
Google, Inc. Those modifications are gratefully acknowledged and are described
|
||||
briefly in the InnoDB documentation. The contributions by Google are
|
||||
incorporated with their permission, and subject to the conditions contained in
|
||||
the file COPYING.Google.
|
||||
|
||||
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
|
||||
Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
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
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/**************************************************//**
|
||||
@@ -145,6 +169,14 @@ UNIV_INLINE
|
||||
ib_uint64_t
|
||||
log_get_lsn(void);
|
||||
/*=============*/
|
||||
/****************************************************************
|
||||
Gets the log group capacity. It is OK to read the value without
|
||||
holding log_sys->mutex because it is constant.
|
||||
@return log group capacity */
|
||||
UNIV_INLINE
|
||||
ulint
|
||||
log_get_capacity(void);
|
||||
/*==================*/
|
||||
/******************************************************//**
|
||||
Initializes the log. */
|
||||
UNIV_INTERN
|
||||
@@ -199,6 +231,16 @@ void
|
||||
log_buffer_flush_to_disk(void);
|
||||
/*==========================*/
|
||||
/****************************************************************//**
|
||||
This functions writes the log buffer to the log file and if 'flush'
|
||||
is set it forces a flush of the log file as well. This is meant to be
|
||||
called from background master thread only as it does not wait for
|
||||
the write (+ possible flush) to finish. */
|
||||
UNIV_INTERN
|
||||
void
|
||||
log_buffer_sync_in_background(
|
||||
/*==========================*/
|
||||
ibool flush); /*<! in: flush the logs to disk */
|
||||
/****************************************************************//**
|
||||
Advances the smallest lsn for which there are unflushed dirty blocks in the
|
||||
buffer pool and also may make a new checkpoint. NOTE: this function may only
|
||||
be called if the calling thread owns no synchronization objects!
|
||||
|
@@ -385,6 +385,18 @@ log_get_lsn(void)
|
||||
return(lsn);
|
||||
}
|
||||
|
||||
/****************************************************************
|
||||
Gets the log group capacity. It is OK to read the value without
|
||||
holding log_sys->mutex because it is constant.
|
||||
@return log group capacity */
|
||||
UNIV_INLINE
|
||||
ulint
|
||||
log_get_capacity(void)
|
||||
/*==================*/
|
||||
{
|
||||
return(log_sys->log_group_capacity);
|
||||
}
|
||||
|
||||
/***********************************************************************//**
|
||||
Checks if there is need for a log buffer flush or a new checkpoint, and does
|
||||
this if yes. Any database operation should call this when it has modified
|
||||
|
@@ -312,19 +312,6 @@ mem_heap_dup(
|
||||
const void* data, /*!< in: data to be copied */
|
||||
ulint len); /*!< in: length of data, in bytes */
|
||||
|
||||
/**********************************************************************//**
|
||||
Concatenate two memory blocks and return the result, using a memory heap.
|
||||
@return own: the result */
|
||||
UNIV_INTERN
|
||||
void*
|
||||
mem_heap_cat(
|
||||
/*=========*/
|
||||
mem_heap_t* heap, /*!< in: memory heap where result is allocated */
|
||||
const void* b1, /*!< in: block 1 */
|
||||
ulint len1, /*!< in: length of b1, in bytes */
|
||||
const void* b2, /*!< in: block 2 */
|
||||
ulint len2); /*!< in: length of b2, in bytes */
|
||||
|
||||
/****************************************************************//**
|
||||
A simple (s)printf replacement that dynamically allocates the space for the
|
||||
formatted string from the given heap. This supports a very limited set of
|
||||
|
@@ -168,7 +168,7 @@ mlog_write_initial_log_record_fast(
|
||||
mtr_t* mtr); /*!< in: mtr */
|
||||
#else /* !UNIV_HOTBACKUP */
|
||||
# define mlog_write_initial_log_record(ptr,type,mtr) ((void) 0)
|
||||
# define mlog_write_initial_log_record_fast(ptr,type,log_ptr,mtr) ((void) 0)
|
||||
# define mlog_write_initial_log_record_fast(ptr,type,log_ptr,mtr) ((byte *) 0)
|
||||
#endif /* !UNIV_HOTBACKUP */
|
||||
/********************************************************//**
|
||||
Parses an initial log record written by mlog_write_initial_log_record.
|
||||
@@ -218,7 +218,7 @@ byte*
|
||||
mlog_open_and_write_index(
|
||||
/*======================*/
|
||||
mtr_t* mtr, /*!< in: mtr */
|
||||
byte* rec, /*!< in: index record or page */
|
||||
const byte* rec, /*!< in: index record or page */
|
||||
dict_index_t* index, /*!< in: record descriptor */
|
||||
byte type, /*!< in: log item type */
|
||||
ulint size); /*!< in: requested buffer size in bytes
|
||||
|
@@ -23,10 +23,11 @@ Mini-transaction logging routines
|
||||
Created 12/7/1995 Heikki Tuuri
|
||||
*******************************************************/
|
||||
|
||||
#ifndef UNIV_HOTBACKUP
|
||||
#include "mach0data.h"
|
||||
#include "ut0lst.h"
|
||||
#include "buf0buf.h"
|
||||
#include "fsp0types.h"
|
||||
#include "trx0sys.h"
|
||||
|
||||
/********************************************************//**
|
||||
Opens a buffer to mlog. It must be closed with mlog_close.
|
||||
@@ -71,6 +72,7 @@ mlog_close(
|
||||
dyn_array_close(mlog, ptr);
|
||||
}
|
||||
|
||||
#ifndef UNIV_HOTBACKUP
|
||||
/********************************************************//**
|
||||
Catenates 1 - 4 bytes to the mtr log. The value is not compressed. */
|
||||
UNIV_INLINE
|
||||
@@ -195,6 +197,28 @@ mlog_write_initial_log_record_fast(
|
||||
space = mach_read_from_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
|
||||
offset = mach_read_from_4(page + FIL_PAGE_OFFSET);
|
||||
|
||||
/* check whether the page is in the doublewrite buffer;
|
||||
the doublewrite buffer is located in pages
|
||||
FSP_EXTENT_SIZE, ..., 3 * FSP_EXTENT_SIZE - 1 in the
|
||||
system tablespace */
|
||||
if (space == TRX_SYS_SPACE
|
||||
&& offset >= FSP_EXTENT_SIZE && offset < 3 * FSP_EXTENT_SIZE) {
|
||||
if (trx_doublewrite_buf_is_being_created) {
|
||||
/* Do nothing: we only come to this branch in an
|
||||
InnoDB database creation. We do not redo log
|
||||
anything for the doublewrite buffer pages. */
|
||||
return(log_ptr);
|
||||
} else {
|
||||
fprintf(stderr,
|
||||
"Error: trying to redo log a record of type "
|
||||
"%d on page %lu of space %lu in the "
|
||||
"doublewrite buffer, continuing anyway.\n"
|
||||
"Please post a bug report to "
|
||||
"bugs.mysql.com.\n",
|
||||
type, offset, space);
|
||||
}
|
||||
}
|
||||
|
||||
mach_write_to_1(log_ptr, type);
|
||||
log_ptr++;
|
||||
log_ptr += mach_write_compressed(log_ptr, space);
|
||||
|
@@ -54,118 +54,137 @@ first 3 values must be RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH */
|
||||
#define MTR_MEMO_S_LOCK 55
|
||||
#define MTR_MEMO_X_LOCK 56
|
||||
|
||||
/* Log item types: we have made them to be of the type 'byte'
|
||||
for the compiler to warn if val and type parameters are switched
|
||||
in a call to mlog_write_ulint. NOTE! For 1 - 8 bytes, the
|
||||
flag value must give the length also! */
|
||||
#define MLOG_SINGLE_REC_FLAG 128 /* if the mtr contains only
|
||||
/** @name Log item types
|
||||
The log items are declared 'byte' so that the compiler can warn if val
|
||||
and type parameters are switched in a call to mlog_write_ulint. NOTE!
|
||||
For 1 - 8 bytes, the flag value must give the length also! @{ */
|
||||
#define MLOG_SINGLE_REC_FLAG 128 /*!< if the mtr contains only
|
||||
one log record for one page,
|
||||
i.e., write_initial_log_record
|
||||
has been called only once,
|
||||
this flag is ORed to the type
|
||||
of that first log record */
|
||||
#define MLOG_1BYTE (1) /* one byte is written */
|
||||
#define MLOG_2BYTES (2) /* 2 bytes ... */
|
||||
#define MLOG_4BYTES (4) /* 4 bytes ... */
|
||||
#define MLOG_8BYTES (8) /* 8 bytes ... */
|
||||
#define MLOG_REC_INSERT ((byte)9) /* record insert */
|
||||
#define MLOG_REC_CLUST_DELETE_MARK ((byte)10) /* mark clustered index record
|
||||
#define MLOG_1BYTE (1) /*!< one byte is written */
|
||||
#define MLOG_2BYTES (2) /*!< 2 bytes ... */
|
||||
#define MLOG_4BYTES (4) /*!< 4 bytes ... */
|
||||
#define MLOG_8BYTES (8) /*!< 8 bytes ... */
|
||||
#define MLOG_REC_INSERT ((byte)9) /*!< record insert */
|
||||
#define MLOG_REC_CLUST_DELETE_MARK ((byte)10) /*!< mark clustered index record
|
||||
deleted */
|
||||
#define MLOG_REC_SEC_DELETE_MARK ((byte)11) /* mark secondary index record
|
||||
#define MLOG_REC_SEC_DELETE_MARK ((byte)11) /*!< mark secondary index record
|
||||
deleted */
|
||||
#define MLOG_REC_UPDATE_IN_PLACE ((byte)13) /* update of a record,
|
||||
#define MLOG_REC_UPDATE_IN_PLACE ((byte)13) /*!< update of a record,
|
||||
preserves record field sizes */
|
||||
#define MLOG_REC_DELETE ((byte)14) /* delete a record from a
|
||||
#define MLOG_REC_DELETE ((byte)14) /*!< delete a record from a
|
||||
page */
|
||||
#define MLOG_LIST_END_DELETE ((byte)15) /* delete record list end on
|
||||
#define MLOG_LIST_END_DELETE ((byte)15) /*!< delete record list end on
|
||||
index page */
|
||||
#define MLOG_LIST_START_DELETE ((byte)16) /* delete record list start on
|
||||
#define MLOG_LIST_START_DELETE ((byte)16) /*!< delete record list start on
|
||||
index page */
|
||||
#define MLOG_LIST_END_COPY_CREATED ((byte)17) /* copy record list end to a
|
||||
#define MLOG_LIST_END_COPY_CREATED ((byte)17) /*!< copy record list end to a
|
||||
new created index page */
|
||||
#define MLOG_PAGE_REORGANIZE ((byte)18) /* reorganize an index page */
|
||||
#define MLOG_PAGE_CREATE ((byte)19) /* create an index page */
|
||||
#define MLOG_UNDO_INSERT ((byte)20) /* insert entry in an undo
|
||||
#define MLOG_PAGE_REORGANIZE ((byte)18) /*!< reorganize an
|
||||
index page in
|
||||
ROW_FORMAT=REDUNDANT */
|
||||
#define MLOG_PAGE_CREATE ((byte)19) /*!< create an index page */
|
||||
#define MLOG_UNDO_INSERT ((byte)20) /*!< insert entry in an undo
|
||||
log */
|
||||
#define MLOG_UNDO_ERASE_END ((byte)21) /* erase an undo log
|
||||
#define MLOG_UNDO_ERASE_END ((byte)21) /*!< erase an undo log
|
||||
page end */
|
||||
#define MLOG_UNDO_INIT ((byte)22) /* initialize a page in an
|
||||
#define MLOG_UNDO_INIT ((byte)22) /*!< initialize a page in an
|
||||
undo log */
|
||||
#define MLOG_UNDO_HDR_DISCARD ((byte)23) /* discard an update undo log
|
||||
#define MLOG_UNDO_HDR_DISCARD ((byte)23) /*!< discard an update undo log
|
||||
header */
|
||||
#define MLOG_UNDO_HDR_REUSE ((byte)24) /* reuse an insert undo log
|
||||
#define MLOG_UNDO_HDR_REUSE ((byte)24) /*!< reuse an insert undo log
|
||||
header */
|
||||
#define MLOG_UNDO_HDR_CREATE ((byte)25) /* create an undo log header */
|
||||
#define MLOG_REC_MIN_MARK ((byte)26) /* mark an index record as the
|
||||
predefined minimum record */
|
||||
#define MLOG_IBUF_BITMAP_INIT ((byte)27) /* initialize an ibuf bitmap
|
||||
page */
|
||||
#define MLOG_UNDO_HDR_CREATE ((byte)25) /*!< create an undo
|
||||
log header */
|
||||
#define MLOG_REC_MIN_MARK ((byte)26) /*!< mark an index
|
||||
record as the
|
||||
predefined minimum
|
||||
record */
|
||||
#define MLOG_IBUF_BITMAP_INIT ((byte)27) /*!< initialize an
|
||||
ibuf bitmap page */
|
||||
/*#define MLOG_FULL_PAGE ((byte)28) full contents of a page */
|
||||
#define MLOG_INIT_FILE_PAGE ((byte)29) /* this means that a file page
|
||||
is taken into use and the prior
|
||||
contents of the page should be
|
||||
ignored: in recovery we must
|
||||
not trust the lsn values stored
|
||||
to the file page */
|
||||
#define MLOG_WRITE_STRING ((byte)30) /* write a string to a page */
|
||||
#define MLOG_MULTI_REC_END ((byte)31) /* if a single mtr writes
|
||||
#define MLOG_INIT_FILE_PAGE ((byte)29) /*!< this means that a
|
||||
file page is taken
|
||||
into use and the prior
|
||||
contents of the page
|
||||
should be ignored: in
|
||||
recovery we must not
|
||||
trust the lsn values
|
||||
stored to the file
|
||||
page */
|
||||
#define MLOG_WRITE_STRING ((byte)30) /*!< write a string to
|
||||
a page */
|
||||
#define MLOG_MULTI_REC_END ((byte)31) /*!< if a single mtr writes
|
||||
log records for several pages,
|
||||
this log record ends the
|
||||
sequence of these records */
|
||||
#define MLOG_DUMMY_RECORD ((byte)32) /* dummy log record used to
|
||||
#define MLOG_DUMMY_RECORD ((byte)32) /*!< dummy log record used to
|
||||
pad a log block full */
|
||||
#define MLOG_FILE_CREATE ((byte)33) /* log record about an .ibd
|
||||
#define MLOG_FILE_CREATE ((byte)33) /*!< log record about an .ibd
|
||||
file creation */
|
||||
#define MLOG_FILE_RENAME ((byte)34) /* log record about an .ibd
|
||||
#define MLOG_FILE_RENAME ((byte)34) /*!< log record about an .ibd
|
||||
file rename */
|
||||
#define MLOG_FILE_DELETE ((byte)35) /* log record about an .ibd
|
||||
#define MLOG_FILE_DELETE ((byte)35) /*!< log record about an .ibd
|
||||
file deletion */
|
||||
#define MLOG_COMP_REC_MIN_MARK ((byte)36) /* mark a compact index record
|
||||
as the predefined minimum
|
||||
#define MLOG_COMP_REC_MIN_MARK ((byte)36) /*!< mark a compact
|
||||
index record as the
|
||||
predefined minimum
|
||||
record */
|
||||
#define MLOG_COMP_PAGE_CREATE ((byte)37) /* create a compact
|
||||
#define MLOG_COMP_PAGE_CREATE ((byte)37) /*!< create a compact
|
||||
index page */
|
||||
#define MLOG_COMP_REC_INSERT ((byte)38) /* compact record insert */
|
||||
#define MLOG_COMP_REC_INSERT ((byte)38) /*!< compact record insert */
|
||||
#define MLOG_COMP_REC_CLUST_DELETE_MARK ((byte)39)
|
||||
/* mark compact clustered index
|
||||
record deleted */
|
||||
#define MLOG_COMP_REC_SEC_DELETE_MARK ((byte)40)/* mark compact secondary index
|
||||
record deleted; this log
|
||||
record type is redundant, as
|
||||
MLOG_REC_SEC_DELETE_MARK is
|
||||
independent of the record
|
||||
format. */
|
||||
#define MLOG_COMP_REC_UPDATE_IN_PLACE ((byte)41)/* update of a compact record,
|
||||
preserves record field sizes */
|
||||
#define MLOG_COMP_REC_DELETE ((byte)42) /* delete a compact record
|
||||
/*!< mark compact
|
||||
clustered index record
|
||||
deleted */
|
||||
#define MLOG_COMP_REC_SEC_DELETE_MARK ((byte)40)/*!< mark compact
|
||||
secondary index record
|
||||
deleted; this log
|
||||
record type is
|
||||
redundant, as
|
||||
MLOG_REC_SEC_DELETE_MARK
|
||||
is independent of the
|
||||
record format. */
|
||||
#define MLOG_COMP_REC_UPDATE_IN_PLACE ((byte)41)/*!< update of a
|
||||
compact record,
|
||||
preserves record field
|
||||
sizes */
|
||||
#define MLOG_COMP_REC_DELETE ((byte)42) /*!< delete a compact record
|
||||
from a page */
|
||||
#define MLOG_COMP_LIST_END_DELETE ((byte)43) /* delete compact record list
|
||||
#define MLOG_COMP_LIST_END_DELETE ((byte)43) /*!< delete compact record list
|
||||
end on index page */
|
||||
#define MLOG_COMP_LIST_START_DELETE ((byte)44) /* delete compact record list
|
||||
#define MLOG_COMP_LIST_START_DELETE ((byte)44) /*!< delete compact record list
|
||||
start on index page */
|
||||
#define MLOG_COMP_LIST_END_COPY_CREATED ((byte)45)
|
||||
/* copy compact record list end
|
||||
to a new created index page */
|
||||
#define MLOG_COMP_PAGE_REORGANIZE ((byte)46) /* reorganize an index page */
|
||||
#define MLOG_FILE_CREATE2 ((byte)47) /* log record about creating
|
||||
/*!< copy compact
|
||||
record list end to a
|
||||
new created index
|
||||
page */
|
||||
#define MLOG_COMP_PAGE_REORGANIZE ((byte)46) /*!< reorganize an index page */
|
||||
#define MLOG_FILE_CREATE2 ((byte)47) /*!< log record about creating
|
||||
an .ibd file, with format */
|
||||
#define MLOG_ZIP_WRITE_NODE_PTR ((byte)48) /* write the node pointer of
|
||||
#define MLOG_ZIP_WRITE_NODE_PTR ((byte)48) /*!< write the node pointer of
|
||||
a record on a compressed
|
||||
non-leaf B-tree page */
|
||||
#define MLOG_ZIP_WRITE_BLOB_PTR ((byte)49) /* write the BLOB pointer
|
||||
#define MLOG_ZIP_WRITE_BLOB_PTR ((byte)49) /*!< write the BLOB pointer
|
||||
of an externally stored column
|
||||
on a compressed page */
|
||||
#define MLOG_ZIP_WRITE_HEADER ((byte)50) /* write to compressed page
|
||||
#define MLOG_ZIP_WRITE_HEADER ((byte)50) /*!< write to compressed page
|
||||
header */
|
||||
#define MLOG_ZIP_PAGE_COMPRESS ((byte)51) /* compress an index page */
|
||||
#define MLOG_BIGGEST_TYPE ((byte)51) /* biggest value (used in
|
||||
asserts) */
|
||||
#define MLOG_ZIP_PAGE_COMPRESS ((byte)51) /*!< compress an index page */
|
||||
#define MLOG_BIGGEST_TYPE ((byte)51) /*!< biggest value (used in
|
||||
assertions) */
|
||||
/* @} */
|
||||
|
||||
/* Flags for MLOG_FILE operations (stored in the page number
|
||||
parameter, called log_flags in the functions). The page number
|
||||
parameter was initially written as 0. */
|
||||
#define MLOG_FILE_FLAG_TEMP 1 /* identifies TEMPORARY TABLE in
|
||||
/** @name Flags for MLOG_FILE operations
|
||||
(stored in the page number parameter, called log_flags in the
|
||||
functions). The page number parameter was originally written as 0. @{ */
|
||||
#define MLOG_FILE_FLAG_TEMP 1 /*!< identifies TEMPORARY TABLE in
|
||||
MLOG_FILE_CREATE, MLOG_FILE_CREATE2 */
|
||||
/* @} */
|
||||
|
||||
/***************************************************************//**
|
||||
Starts a mini-transaction and creates a mini-transaction handle
|
||||
|
@@ -15,6 +15,32 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*****************************************************************************/
|
||||
/***********************************************************************
|
||||
|
||||
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
|
||||
Copyright (c) 2009, Percona Inc.
|
||||
|
||||
Portions of this file contain modifications contributed and copyrighted
|
||||
by Percona Inc.. Those modifications are
|
||||
gratefully acknowledged and are described briefly in the InnoDB
|
||||
documentation. The contributions by Percona Inc. are incorporated with
|
||||
their permission, and subject to the conditions contained in the file
|
||||
COPYING.Percona.
|
||||
|
||||
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 Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT 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
|
||||
|
||||
***********************************************************************/
|
||||
|
||||
/**************************************************//**
|
||||
@file include/os0file.h
|
||||
@@ -398,6 +424,7 @@ ibool
|
||||
os_file_close(
|
||||
/*==========*/
|
||||
os_file_t file); /*!< in, own: handle to a file */
|
||||
#ifdef UNIV_HOTBACKUP
|
||||
/***********************************************************************//**
|
||||
Closes a file handle.
|
||||
@return TRUE if success */
|
||||
@@ -406,6 +433,7 @@ ibool
|
||||
os_file_close_no_error_handling(
|
||||
/*============================*/
|
||||
os_file_t file); /*!< in, own: handle to a file */
|
||||
#endif /* UNIV_HOTBACKUP */
|
||||
/***********************************************************************//**
|
||||
Gets a file size.
|
||||
@return TRUE if success */
|
||||
@@ -574,23 +602,23 @@ ibool
|
||||
os_file_create_subdirs_if_needed(
|
||||
/*=============================*/
|
||||
const char* path); /*!< in: path name */
|
||||
/************************************************************************//**
|
||||
Initializes the asynchronous io system. Creates separate aio array for
|
||||
non-ibuf read and write, a third aio array for the ibuf i/o, with just one
|
||||
segment, two aio arrays for log reads and writes with one segment, and a
|
||||
synchronous aio array of the specified size. The combined number of segments
|
||||
in the three first aio arrays is the parameter n_segments given to the
|
||||
function. The caller must create an i/o handler thread for each segment in
|
||||
the four first arrays, but not for the sync aio array. */
|
||||
/***********************************************************************
|
||||
Initializes the asynchronous io system. Creates one array each for ibuf
|
||||
and log i/o. Also creates one array each for read and write where each
|
||||
array is divided logically into n_read_segs and n_write_segs
|
||||
respectively. The caller must create an i/o handler thread for each
|
||||
segment in these arrays. This function also creates the sync array.
|
||||
No i/o handler thread needs to be created for that */
|
||||
UNIV_INTERN
|
||||
void
|
||||
os_aio_init(
|
||||
/*========*/
|
||||
ulint n, /*!< in: maximum number of pending aio operations
|
||||
allowed; n must be divisible by n_segments */
|
||||
ulint n_segments, /*!< in: combined number of segments in the four
|
||||
first aio arrays; must be >= 4 */
|
||||
ulint n_slots_sync); /*!< in: number of slots in the sync aio array */
|
||||
ulint n_per_seg, /*<! in: maximum number of pending aio
|
||||
operations allowed per segment */
|
||||
ulint n_read_segs, /*<! in: number of reader threads */
|
||||
ulint n_write_segs, /*<! in: number of writer threads */
|
||||
ulint n_slots_sync); /*<! in: number of slots in the sync aio
|
||||
array */
|
||||
/*******************************************************************//**
|
||||
Requests an asynchronous i/o operation.
|
||||
@return TRUE if request was queued successfully, FALSE if fail */
|
||||
|
@@ -69,15 +69,6 @@ os_mem_free_large(
|
||||
os_mem_alloc_large() */
|
||||
ulint size); /*!< in: size returned by
|
||||
os_mem_alloc_large() */
|
||||
/****************************************************************//**
|
||||
Sets the priority boost for threads released from waiting within the current
|
||||
process. */
|
||||
UNIV_INTERN
|
||||
void
|
||||
os_process_set_priority_boost(
|
||||
/*==========================*/
|
||||
ibool do_boost); /*!< in: TRUE if priority boost should be done,
|
||||
FALSE if not */
|
||||
|
||||
#ifndef UNIV_NONINL
|
||||
#include "os0proc.ic"
|
||||
|
@@ -128,18 +128,6 @@ os_event_create(
|
||||
/*============*/
|
||||
const char* name); /*!< in: the name of the event, if NULL
|
||||
the event is created without a name */
|
||||
#ifdef __WIN__
|
||||
/*********************************************************//**
|
||||
Creates an auto-reset event semaphore, i.e., an event which is automatically
|
||||
reset when a single thread is released. Works only in Windows.
|
||||
@return the event handle */
|
||||
UNIV_INTERN
|
||||
os_event_t
|
||||
os_event_create_auto(
|
||||
/*=================*/
|
||||
const char* name); /*!< in: the name of the event, if NULL
|
||||
the event is created without a name */
|
||||
#endif
|
||||
/**********************************************************//**
|
||||
Sets an event semaphore to the signaled state: lets waiting threads
|
||||
proceed. */
|
||||
|
@@ -44,7 +44,7 @@ can wait inside InnoDB */
|
||||
|
||||
#ifdef __WIN__
|
||||
typedef void* os_thread_t;
|
||||
typedef unsigned long os_thread_id_t; /*!< In Windows the thread id
|
||||
typedef unsigned long os_thread_id_t; /*!< In Windows the thread id
|
||||
is an unsigned long int */
|
||||
#else
|
||||
typedef pthread_t os_thread_t;
|
||||
|
@@ -444,9 +444,17 @@ page_zip_calc_checksum(
|
||||
__attribute__((nonnull));
|
||||
|
||||
#ifndef UNIV_HOTBACKUP
|
||||
/** Check if a pointer to an uncompressed page matches a compressed page.
|
||||
@param ptr pointer to an uncompressed page frame
|
||||
@param page_zip compressed page descriptor
|
||||
@return TRUE if ptr and page_zip refer to the same block */
|
||||
# define PAGE_ZIP_MATCH(ptr, page_zip) \
|
||||
(buf_frame_get_page_zip(ptr) == (page_zip))
|
||||
#else /* !UNIV_HOTBACKUP */
|
||||
/** Check if a pointer to an uncompressed page matches a compressed page.
|
||||
@param ptr pointer to an uncompressed page frame
|
||||
@param page_zip compressed page descriptor
|
||||
@return TRUE if ptr and page_zip refer to the same block */
|
||||
# define PAGE_ZIP_MATCH(ptr, page_zip) \
|
||||
(page_align(ptr) + UNIV_PAGE_SIZE == (page_zip)->data)
|
||||
#endif /* !UNIV_HOTBACKUP */
|
||||
|
@@ -98,15 +98,15 @@ In summary, the compressed page looks like this:
|
||||
- deleted records (free list) in link order
|
||||
*/
|
||||
|
||||
/* Start offset of the area that will be compressed */
|
||||
/** Start offset of the area that will be compressed */
|
||||
#define PAGE_ZIP_START PAGE_NEW_SUPREMUM_END
|
||||
/* Size of an compressed page directory entry */
|
||||
/** Size of an compressed page directory entry */
|
||||
#define PAGE_ZIP_DIR_SLOT_SIZE 2
|
||||
/* Mask of record offsets */
|
||||
/** Mask of record offsets */
|
||||
#define PAGE_ZIP_DIR_SLOT_MASK 0x3fff
|
||||
/* 'owned' flag */
|
||||
/** 'owned' flag */
|
||||
#define PAGE_ZIP_DIR_SLOT_OWNED 0x4000
|
||||
/* 'deleted' flag */
|
||||
/** 'deleted' flag */
|
||||
#define PAGE_ZIP_DIR_SLOT_DEL 0x8000
|
||||
|
||||
/**********************************************************************//**
|
||||
|
@@ -93,16 +93,6 @@ que_thr_create(
|
||||
que_fork_t* parent, /*!< in: parent node, i.e., a fork node */
|
||||
mem_heap_t* heap); /*!< in: memory heap where created */
|
||||
/**********************************************************************//**
|
||||
Checks if the query graph is in a state where it should be freed, and
|
||||
frees it in that case. If the session is in a state where it should be
|
||||
closed, also this is done.
|
||||
@return TRUE if freed */
|
||||
UNIV_INTERN
|
||||
ibool
|
||||
que_graph_try_free(
|
||||
/*===============*/
|
||||
que_t* graph); /*!< in: query graph */
|
||||
/**********************************************************************//**
|
||||
Frees a query graph, but not the heap where it was created. Does not free
|
||||
explicit cursor declarations, they are freed in que_graph_free. */
|
||||
UNIV_INTERN
|
||||
|
@@ -215,21 +215,6 @@ row_build_row_ref_in_tuple(
|
||||
or NULL */
|
||||
trx_t* trx); /*!< in: transaction */
|
||||
/*******************************************************************//**
|
||||
From a row build a row reference with which we can search the clustered
|
||||
index record. */
|
||||
UNIV_INTERN
|
||||
void
|
||||
row_build_row_ref_from_row(
|
||||
/*=======================*/
|
||||
dtuple_t* ref, /*!< in/out: row reference built;
|
||||
see the NOTE below!
|
||||
ref must have the right number
|
||||
of fields! */
|
||||
const dict_table_t* table, /*!< in: table */
|
||||
const dtuple_t* row); /*!< in: row
|
||||
NOTE: the data fields in ref will point
|
||||
directly into data of this row */
|
||||
/*******************************************************************//**
|
||||
Builds from a secondary index record a row reference with which we can
|
||||
search the clustered index record. */
|
||||
UNIV_INLINE
|
||||
|
@@ -30,34 +30,8 @@ Created 6/5/1996 Heikki Tuuri
|
||||
#include "que0types.h"
|
||||
|
||||
/**********************************************************************//**
|
||||
Checks if there is work to do in the server task queue. If there is, the
|
||||
thread starts processing a task. Before leaving, it again checks the task
|
||||
queue and picks a new task if any exists. This is called by a SRV_WORKER
|
||||
thread. */
|
||||
UNIV_INTERN
|
||||
void
|
||||
srv_que_task_queue_check(void);
|
||||
/*==========================*/
|
||||
/**********************************************************************//**
|
||||
Performs round-robin on the server tasks. This is called by a SRV_WORKER
|
||||
thread every second or so.
|
||||
@return the new (may be == thr) query thread to run */
|
||||
UNIV_INTERN
|
||||
que_thr_t*
|
||||
srv_que_round_robin(
|
||||
/*================*/
|
||||
que_thr_t* thr); /*!< in: query thread */
|
||||
/**********************************************************************//**
|
||||
Enqueues a task to server task queue and releases a worker thread, if
|
||||
there exists one suspended. */
|
||||
UNIV_INTERN
|
||||
void
|
||||
srv_que_task_enqueue(
|
||||
/*=================*/
|
||||
que_thr_t* thr); /*!< in: query thread */
|
||||
/**********************************************************************//**
|
||||
Enqueues a task to server task queue and releases a worker thread, if
|
||||
there exists one suspended. */
|
||||
Enqueues a task to server task queue and releases a worker thread, if there
|
||||
is a suspended one. */
|
||||
UNIV_INTERN
|
||||
void
|
||||
srv_que_task_enqueue_low(
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
|
||||
Copyright (c) 2008, Google Inc.
|
||||
Copyright (c) 2008, 2009, Google Inc.
|
||||
|
||||
Portions of this file contain modifications contributed and copyrighted by
|
||||
Google, Inc. Those modifications are gratefully acknowledged and are described
|
||||
@@ -22,6 +22,32 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*****************************************************************************/
|
||||
/***********************************************************************
|
||||
|
||||
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
|
||||
Copyright (c) 2009, Percona Inc.
|
||||
|
||||
Portions of this file contain modifications contributed and copyrighted
|
||||
by Percona Inc.. Those modifications are
|
||||
gratefully acknowledged and are described briefly in the InnoDB
|
||||
documentation. The contributions by Percona Inc. are incorporated with
|
||||
their permission, and subject to the conditions contained in the file
|
||||
COPYING.Percona.
|
||||
|
||||
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 Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT 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
|
||||
|
||||
***********************************************************************/
|
||||
|
||||
/**************************************************//**
|
||||
@file include/srv0srv.h
|
||||
@@ -42,7 +68,7 @@ Created 10/10/1995 Heikki Tuuri
|
||||
|
||||
extern const char* srv_main_thread_op_info;
|
||||
|
||||
/* Prefix used by MySQL to indicate pre-5.1 table name encoding */
|
||||
/** Prefix used by MySQL to indicate pre-5.1 table name encoding */
|
||||
extern const char srv_mysql50_table_name_prefix[9];
|
||||
|
||||
/* When this event is set the lock timeout and InnoDB monitor
|
||||
@@ -81,14 +107,20 @@ extern char* srv_data_home;
|
||||
extern char* srv_arch_dir;
|
||||
#endif /* UNIV_LOG_ARCHIVE */
|
||||
|
||||
/* store to its own file each table created by an user; data
|
||||
/** store to its own file each table created by an user; data
|
||||
dictionary tables are in the system tablespace 0 */
|
||||
#ifndef UNIV_HOTBACKUP
|
||||
extern my_bool srv_file_per_table;
|
||||
/* The file format to use on new *.ibd files. */
|
||||
#else
|
||||
extern ibool srv_file_per_table;
|
||||
#endif /* UNIV_HOTBACKUP */
|
||||
/** The file format to use on new *.ibd files. */
|
||||
extern ulint srv_file_format;
|
||||
/* Whether to check file format during startup.*/
|
||||
/** Whether to check file format during startup. A value of
|
||||
DICT_TF_FORMAT_MAX + 1 means no checking ie. FALSE. The default is to
|
||||
set it to the highest format we support. */
|
||||
extern ulint srv_check_file_format_at_startup;
|
||||
/* Place locks to records only i.e. do not use next-key locking except
|
||||
/** Place locks to records only i.e. do not use next-key locking except
|
||||
on duplicate key checking and foreign key checking */
|
||||
extern ibool srv_locks_unsafe_for_binlog;
|
||||
#endif /* !UNIV_HOTBACKUP */
|
||||
@@ -111,11 +143,17 @@ extern ulint srv_n_log_files;
|
||||
extern ulint srv_log_file_size;
|
||||
extern ulint srv_log_buffer_size;
|
||||
extern ulong srv_flush_log_at_trx_commit;
|
||||
extern char srv_adaptive_flushing;
|
||||
|
||||
|
||||
/* The sort order table of the MySQL latin1_swedish_ci character set
|
||||
collation */
|
||||
extern const byte* srv_latin1_ordering;
|
||||
#ifndef UNIV_HOTBACKUP
|
||||
extern my_bool srv_use_sys_malloc;
|
||||
#else
|
||||
extern ibool srv_use_sys_malloc;
|
||||
#endif /* UNIV_HOTBACKUP */
|
||||
extern ulint srv_buf_pool_size; /*!< requested size in bytes */
|
||||
extern ulint srv_buf_pool_old_size; /*!< previously requested size */
|
||||
extern ulint srv_buf_pool_curr_size; /*!< current size in bytes */
|
||||
@@ -123,6 +161,16 @@ extern ulint srv_mem_pool_size;
|
||||
extern ulint srv_lock_table_size;
|
||||
|
||||
extern ulint srv_n_file_io_threads;
|
||||
extern ulong srv_read_ahead_threshold;
|
||||
extern ulint srv_n_read_io_threads;
|
||||
extern ulint srv_n_write_io_threads;
|
||||
|
||||
/* Number of IO operations per second the server can do */
|
||||
extern ulong srv_io_capacity;
|
||||
/* Returns the number of IO operations that is X percent of the
|
||||
capacity. PCT_IO(5) -> returns the number of IO operations that
|
||||
is 5% of the max where max is srv_io_capacity. */
|
||||
#define PCT_IO(p) ((ulong) (srv_io_capacity * ((double) p / 100.0)))
|
||||
|
||||
#ifdef UNIV_LOG_ARCHIVE
|
||||
extern ibool srv_log_archive_on;
|
||||
@@ -215,7 +263,7 @@ extern mutex_t* kernel_mutex_temp;/* mutex protecting the server, trx structs,
|
||||
same DRAM page as other hotspot semaphores */
|
||||
#define kernel_mutex (*kernel_mutex_temp)
|
||||
|
||||
#define SRV_MAX_N_IO_THREADS 100
|
||||
#define SRV_MAX_N_IO_THREADS 130
|
||||
|
||||
/* Array of English strings describing the current state of an
|
||||
i/o handler thread */
|
||||
@@ -533,10 +581,10 @@ void
|
||||
srv_export_innodb_status(void);
|
||||
/*==========================*/
|
||||
|
||||
/* Thread slot in the thread table */
|
||||
/** Thread slot in the thread table */
|
||||
typedef struct srv_slot_struct srv_slot_t;
|
||||
|
||||
/* Thread table is an array of slots */
|
||||
/** Thread table is an array of slots */
|
||||
typedef srv_slot_t srv_table_t;
|
||||
|
||||
/** Status variables to be passed to MySQL */
|
||||
|
@@ -41,7 +41,9 @@ Created 9/5/1995 Heikki Tuuri
|
||||
#include "os0sync.h"
|
||||
#include "sync0arr.h"
|
||||
|
||||
#if defined(UNIV_DEBUG) && !defined(UNIV_HOTBACKUP)
|
||||
extern my_bool timed_mutexes;
|
||||
#endif /* UNIV_DEBUG && !UNIV_HOTBACKUP */
|
||||
|
||||
#ifdef HAVE_WINDOWS_ATOMICS
|
||||
typedef LONG lock_word_t; /*!< On Windows, InterlockedExchange operates
|
||||
|
@@ -24,6 +24,7 @@ Created 3/26/1996 Heikki Tuuri
|
||||
*******************************************************/
|
||||
|
||||
#include "srv0srv.h"
|
||||
#include "mtr0log.h"
|
||||
|
||||
/******************************************************************//**
|
||||
Gets a rollback segment header.
|
||||
|
@@ -29,13 +29,11 @@ Created 3/26/1996 Heikki Tuuri
|
||||
#include "univ.i"
|
||||
|
||||
#include "trx0types.h"
|
||||
#include "fsp0fsp.h"
|
||||
#include "fsp0types.h"
|
||||
#include "fil0fil.h"
|
||||
#include "fut0lst.h"
|
||||
#include "buf0buf.h"
|
||||
#ifndef UNIV_HOTBACKUP
|
||||
#include "mtr0mtr.h"
|
||||
#include "mtr0log.h"
|
||||
#include "ut0byte.h"
|
||||
#include "mem0mem.h"
|
||||
#include "sync0sync.h"
|
||||
@@ -72,6 +70,8 @@ extern trx_doublewrite_t* trx_doublewrite;
|
||||
/** The following is set to TRUE when we are upgrading from pre-4.1
|
||||
format data files to the multiple tablespaces format data files */
|
||||
extern ibool trx_doublewrite_must_reset_space_ids;
|
||||
/** Set to TRUE when the doublewrite buffer is being created */
|
||||
extern ibool trx_doublewrite_buf_is_being_created;
|
||||
/** The following is TRUE when we are using the database in the
|
||||
post-4.1 format, i.e., we have successfully upgraded, or have created
|
||||
a new database installation */
|
||||
@@ -388,12 +388,47 @@ trx_sys_print_mysql_binlog_offset_from_page(
|
||||
const byte* page); /*!< in: buffer containing the trx
|
||||
system header page, i.e., page number
|
||||
TRX_SYS_PAGE_NO in the tablespace */
|
||||
/*****************************************************************//**
|
||||
Reads the file format id from the first system table space file.
|
||||
Even if the call succeeds and returns TRUE, the returned format id
|
||||
may be ULINT_UNDEFINED signalling that the format id was not present
|
||||
in the data file.
|
||||
@return TRUE if call succeeds */
|
||||
UNIV_INTERN
|
||||
ibool
|
||||
trx_sys_read_file_format_id(
|
||||
/*========================*/
|
||||
const char *pathname, /*!< in: pathname of the first system
|
||||
table space file */
|
||||
ulint *format_id); /*!< out: file format of the system table
|
||||
space */
|
||||
/*****************************************************************//**
|
||||
Reads the file format id from the given per-table data file.
|
||||
@return TRUE if call succeeds */
|
||||
UNIV_INTERN
|
||||
ibool
|
||||
trx_sys_read_pertable_file_format_id(
|
||||
/*=================================*/
|
||||
const char *pathname, /*!< in: pathname of a per-table
|
||||
datafile */
|
||||
ulint *format_id); /*!< out: file format of the per-table
|
||||
data file */
|
||||
/*****************************************************************//**
|
||||
Get the name representation of the file format from its id.
|
||||
@return pointer to the name */
|
||||
UNIV_INTERN
|
||||
const char*
|
||||
trx_sys_file_format_id_to_name(
|
||||
/*===========================*/
|
||||
const ulint id); /*!< in: id of the file format */
|
||||
|
||||
#endif /* !UNIV_HOTBACKUP */
|
||||
/* The automatically created system rollback segment has this id */
|
||||
#define TRX_SYS_SYSTEM_RSEG_ID 0
|
||||
|
||||
/* Space id and page no where the trx system file copy resides */
|
||||
#define TRX_SYS_SPACE 0 /* the SYSTEM tablespace */
|
||||
#include "fsp0fsp.h"
|
||||
#define TRX_SYS_PAGE_NO FSP_TRX_SYS_PAGE_NO
|
||||
|
||||
/* The offset of the transaction system header on the page */
|
||||
|
@@ -27,6 +27,7 @@ Created 3/26/1996 Heikki Tuuri
|
||||
#include "data0type.h"
|
||||
#ifndef UNIV_HOTBACKUP
|
||||
# include "srv0srv.h"
|
||||
# include "mtr0log.h"
|
||||
|
||||
/* The typedef for rseg slot in the file copy */
|
||||
typedef byte trx_sysf_rseg_t;
|
||||
|
@@ -497,10 +497,12 @@ struct trx_struct{
|
||||
FALSE, one can save CPU time and about
|
||||
150 bytes in the undo log size as then
|
||||
we skip XA steps */
|
||||
unsigned flush_log_later:1;/* when we commit the transaction
|
||||
in MySQL's binlog write, we will
|
||||
flush the log to disk later in
|
||||
a separate call */
|
||||
unsigned flush_log_later:1;/* In 2PC, we hold the
|
||||
prepare_commit mutex across
|
||||
both phases. In that case, we
|
||||
defer flush of the logs to disk
|
||||
until after we release the
|
||||
mutex. */
|
||||
unsigned must_flush_log_later:1;/* this flag is set to TRUE in
|
||||
trx_commit_off_kernel() if
|
||||
flush_log_later was TRUE, and there
|
||||
|
@@ -28,14 +28,14 @@ Created 3/26/1996 Heikki Tuuri
|
||||
|
||||
#include "ut0byte.h"
|
||||
|
||||
/* prepare trx_t::id for being printed via printf(3) */
|
||||
/** prepare trx_t::id for being printed via printf(3) */
|
||||
#define TRX_ID_PREP_PRINTF(id) (ullint) ut_conv_dulint_to_longlong(id)
|
||||
|
||||
/* printf(3) format used for printing TRX_ID_PRINTF_PREP() */
|
||||
/** printf(3) format used for printing TRX_ID_PRINTF_PREP() */
|
||||
#define TRX_ID_FMT "%llX"
|
||||
|
||||
/* maximum length that a formatted trx_t::id could take, not including
|
||||
the terminating '\0'. */
|
||||
/** maximum length that a formatted trx_t::id could take, not including
|
||||
the terminating NUL character. */
|
||||
#define TRX_ID_MAX_LEN 17
|
||||
|
||||
/** Memory objects */
|
||||
|
@@ -2,6 +2,7 @@
|
||||
|
||||
Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
|
||||
Copyright (c) 2008, Google Inc.
|
||||
Copyright (c) 2009, Sun Microsystems, Inc.
|
||||
|
||||
Portions of this file contain modifications contributed and copyrighted by
|
||||
Google, Inc. Those modifications are gratefully acknowledged and are described
|
||||
@@ -9,6 +10,12 @@ briefly in the InnoDB documentation. The contributions by Google are
|
||||
incorporated with their permission, and subject to the conditions contained in
|
||||
the file COPYING.Google.
|
||||
|
||||
Portions of this file contain modifications contributed and copyrighted by
|
||||
Sun Microsystems, Inc. Those modifications are gratefully acknowledged and
|
||||
are described briefly in the InnoDB documentation. The contributions by
|
||||
Sun Microsystems are incorporated with their permission, and subject to the
|
||||
conditions contained in the file COPYING.Sun_Microsystems.
|
||||
|
||||
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
|
||||
Foundation; version 2 of the License.
|
||||
@@ -33,6 +40,10 @@ Created 1/20/1994 Heikki Tuuri
|
||||
#ifndef univ_i
|
||||
#define univ_i
|
||||
|
||||
#ifdef UNIV_HOTBACKUP
|
||||
#include "hb_univ.i"
|
||||
#endif /* UNIV_HOTBACKUP */
|
||||
|
||||
#define INNODB_VERSION_MAJOR 1
|
||||
#define INNODB_VERSION_MINOR 0
|
||||
#define INNODB_VERSION_BUGFIX 4
|
||||
@@ -89,8 +100,10 @@ the virtual method table (vtable) in GCC 3. */
|
||||
in compiling more Posix-compatible. These headers also define __WIN__
|
||||
if we are compiling on Windows. */
|
||||
|
||||
#ifndef UNIV_HOTBACKUP
|
||||
# include <my_global.h>
|
||||
# include <my_pthread.h>
|
||||
#endif /* UNIV_HOTBACKUP */
|
||||
|
||||
/* Include <sys/stat.h> to get S_I... macros defined for os0file.c */
|
||||
# include <sys/stat.h>
|
||||
@@ -103,7 +116,9 @@ if we are compiling on Windows. */
|
||||
|
||||
/* Include the header file generated by GNU autoconf */
|
||||
# ifndef __WIN__
|
||||
# include "config.h"
|
||||
#ifndef UNIV_HOTBACKUP
|
||||
# include "config.h"
|
||||
#endif /* UNIV_HOTBACKUP */
|
||||
# endif
|
||||
|
||||
# ifdef HAVE_SCHED_H
|
||||
@@ -136,9 +151,9 @@ from Makefile.in->ut0auxconf.h */
|
||||
#endif /* HAVE_ATOMIC_BUILTINS */
|
||||
|
||||
/* We only try to do explicit inlining of functions with gcc and
|
||||
Microsoft Visual C++ */
|
||||
Sun Studio */
|
||||
|
||||
# if !defined(__GNUC__)
|
||||
# if !defined(__GNUC__) && !(defined(__SUNPRO_C) || defined(__SUNPRO_CC))
|
||||
# undef UNIV_MUST_NOT_INLINE /* Remove compiler warning */
|
||||
# define UNIV_MUST_NOT_INLINE
|
||||
# endif
|
||||
@@ -236,10 +251,8 @@ by one. */
|
||||
|
||||
/* Linkage specifier for non-static InnoDB symbols (variables and functions)
|
||||
that are only referenced from within InnoDB, not from MySQL */
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 4)
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(UNIV_HOTBACKUP)
|
||||
# define UNIV_INTERN __attribute__((visibility ("hidden")))
|
||||
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
|
||||
# define UNIV_INTERN __hidden
|
||||
#else
|
||||
# define UNIV_INTERN
|
||||
#endif
|
||||
@@ -248,9 +261,11 @@ that are only referenced from within InnoDB, not from MySQL */
|
||||
/* Definition for inline version */
|
||||
|
||||
#ifdef __WIN__
|
||||
#define UNIV_INLINE __inline
|
||||
# define UNIV_INLINE __inline
|
||||
#elif defined(__SUNPRO_CC) || defined(__SUNPRO_C)
|
||||
# define UNIV_INLINE static inline
|
||||
#else
|
||||
#define UNIV_INLINE static __inline__
|
||||
# define UNIV_INLINE static __inline__
|
||||
#endif
|
||||
|
||||
#else
|
||||
@@ -327,13 +342,15 @@ typedef long int lint;
|
||||
#ifdef __WIN__
|
||||
typedef __int64 ib_int64_t;
|
||||
typedef unsigned __int64 ib_uint64_t;
|
||||
#else
|
||||
#elif !defined(UNIV_HOTBACKUP)
|
||||
/* Note: longlong and ulonglong come from MySQL headers. */
|
||||
typedef longlong ib_int64_t;
|
||||
typedef ulonglong ib_uint64_t;
|
||||
#endif
|
||||
|
||||
#ifndef UNIV_HOTBACKUP
|
||||
typedef unsigned long long int ullint;
|
||||
#endif /* UNIV_HOTBACKUP */
|
||||
|
||||
#ifndef __WIN__
|
||||
#if SIZEOF_LONG != SIZEOF_VOIDP
|
||||
@@ -391,6 +408,17 @@ it is read. */
|
||||
/* Minimize cache-miss latency by moving data at addr into a cache before
|
||||
it is read or written. */
|
||||
# define UNIV_PREFETCH_RW(addr) __builtin_prefetch(addr, 1, 3)
|
||||
#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
|
||||
# include <sun_prefetch.h>
|
||||
#if __SUNPRO_C >= 0x550
|
||||
# undef UNIV_INTERN
|
||||
# define UNIV_INTERN __hidden
|
||||
#endif /* __SUNPRO_C >= 0x550 */
|
||||
/* Use sun_prefetch when compile with Sun Studio */
|
||||
# define UNIV_EXPECT(expr,value) (expr)
|
||||
# define UNIV_LIKELY_NULL(expr) (expr)
|
||||
# define UNIV_PREFETCH_R(addr) sun_prefetch_read_many(addr)
|
||||
# define UNIV_PREFETCH_RW(addr) sun_prefetch_write_many(addr)
|
||||
#else
|
||||
/* Dummy versions of the macros */
|
||||
# define UNIV_EXPECT(expr,value) (expr)
|
||||
|
@@ -2,7 +2,7 @@
|
||||
This file is included in univ.i and will cause compilation failure
|
||||
if not present.
|
||||
A custom check has been added in the generated
|
||||
storage/innobase/Makefile.in that is shipped with with the InnoDB Plugin
|
||||
storage/innobase/Makefile.in that is shipped with the InnoDB Plugin
|
||||
source archive. This check tries to compile a test program and if
|
||||
successful then adds "#define HAVE_ATOMIC_PTHREAD_T" to this file.
|
||||
This is a hack that has been developed in order to check for pthread_t
|
||||
|
@@ -1,6 +1,13 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
|
||||
Copyright (c) 2009, Sun Microsystems, Inc.
|
||||
|
||||
Portions of this file contain modifications contributed and copyrighted by
|
||||
Sun Microsystems, Inc. Those modifications are gratefully acknowledged and
|
||||
are described briefly in the InnoDB documentation. The contributions by
|
||||
Sun Microsystems are incorporated with their permission, and subject to the
|
||||
conditions contained in the file COPYING.Sun_Microsystems.
|
||||
|
||||
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
|
||||
@@ -40,6 +47,28 @@ Created 1/20/1994 Heikki Tuuri
|
||||
/** Time stamp */
|
||||
typedef time_t ib_time_t;
|
||||
|
||||
#if defined(IB_HAVE_PAUSE_INSTRUCTION)
|
||||
# ifdef WIN32
|
||||
/* In the Win32 API, the x86 PAUSE instruction is executed by calling
|
||||
the YieldProcessor macro defined in WinNT.h. It is a CPU architecture-
|
||||
independent way by using YieldProcessor.*/
|
||||
# define UT_RELAX_CPU() YieldProcessor()
|
||||
# else
|
||||
/* According to the gcc info page, asm volatile means that the
|
||||
instruction has important side-effects and must not be removed.
|
||||
Also asm volatile may trigger a memory barrier (spilling all registers
|
||||
to memory). */
|
||||
# define UT_RELAX_CPU() __asm__ __volatile__ ("pause")
|
||||
# endif
|
||||
#elif defined(HAVE_ATOMIC_BUILTINS)
|
||||
# define UT_RELAX_CPU() do { \
|
||||
volatile lint volatile_var; \
|
||||
os_compare_and_swap_lint(&volatile_var, 0, 1); \
|
||||
} while (0)
|
||||
#else
|
||||
# define UT_RELAX_CPU() ((void)0) /* avoid warning for an empty statement */
|
||||
#endif
|
||||
|
||||
/*********************************************************************//**
|
||||
Delays execution for at most max_wait_us microseconds or returns earlier
|
||||
if cond becomes true.
|
||||
|
Reference in New Issue
Block a user