Commit 7545f866 authored by Marko Mäkelä's avatar Marko Mäkelä

Merge mysql-5.1 to mysql-5.5.

This patch was already pushed to mysql-5.5 by Inaam Rana.
parents d09b999f e60e6505
...@@ -79,7 +79,6 @@ buf_buddy_add_to_free( ...@@ -79,7 +79,6 @@ buf_buddy_add_to_free(
ut_ad(buf_page_get_state(bpage) == BUF_BLOCK_ZIP_FREE); ut_ad(buf_page_get_state(bpage) == BUF_BLOCK_ZIP_FREE);
ut_ad(buf_pool->zip_free[i].start != bpage); ut_ad(buf_pool->zip_free[i].start != bpage);
UT_LIST_ADD_FIRST(list, buf_pool->zip_free[i], bpage); UT_LIST_ADD_FIRST(list, buf_pool->zip_free[i], bpage);
} }
/**********************************************************************//** /**********************************************************************//**
...@@ -104,7 +103,6 @@ buf_buddy_remove_from_free( ...@@ -104,7 +103,6 @@ buf_buddy_remove_from_free(
ut_ad(buf_pool_mutex_own(buf_pool)); ut_ad(buf_pool_mutex_own(buf_pool));
ut_ad(buf_page_get_state(bpage) == BUF_BLOCK_ZIP_FREE); ut_ad(buf_page_get_state(bpage) == BUF_BLOCK_ZIP_FREE);
UT_LIST_REMOVE(list, buf_pool->zip_free[i], bpage); UT_LIST_REMOVE(list, buf_pool->zip_free[i], bpage);
} }
/**********************************************************************//** /**********************************************************************//**
...@@ -262,19 +260,19 @@ buf_buddy_alloc_from( ...@@ -262,19 +260,19 @@ buf_buddy_alloc_from(
Allocate a block. The thread calling this function must hold Allocate a block. The thread calling this function must hold
buf_pool->mutex and must not hold buf_pool->zip_mutex or any block->mutex. buf_pool->mutex and must not hold buf_pool->zip_mutex or any block->mutex.
The buf_pool_mutex may be released and reacquired. The buf_pool_mutex may be released and reacquired.
@return allocated block, never NULL */ @return allocated block, never NULL */
UNIV_INTERN UNIV_INTERN
void* void*
buf_buddy_alloc_low( buf_buddy_alloc_low(
/*================*/ /*================*/
buf_pool_t* buf_pool, /*!< in: buffer pool instance */ buf_pool_t* buf_pool, /*!< in/out: buffer pool instance */
ulint i, /*!< in: index of buf_pool->zip_free[], ulint i, /*!< in: index of buf_pool->zip_free[],
or BUF_BUDDY_SIZES */ or BUF_BUDDY_SIZES */
ibool* lru) /*!< in: pointer to a variable that ibool* lru) /*!< in: pointer to a variable that
will be assigned TRUE if storage was will be assigned TRUE if storage was
allocated from the LRU list and allocated from the LRU list and
buf_pool->mutex was temporarily buf_pool->mutex was temporarily
released, */ released */
{ {
buf_block_t* block; buf_block_t* block;
...@@ -353,7 +351,6 @@ buf_buddy_relocate( ...@@ -353,7 +351,6 @@ buf_buddy_relocate(
header. Should the fields be invalid, we will be unable to header. Should the fields be invalid, we will be unable to
relocate the block. */ relocate the block. */
/* The src block may be split into smaller blocks, /* The src block may be split into smaller blocks,
some of which may be free. Thus, the some of which may be free. Thus, the
mach_read_from_4() calls below may attempt to read mach_read_from_4() calls below may attempt to read
...@@ -362,10 +359,10 @@ buf_buddy_relocate( ...@@ -362,10 +359,10 @@ buf_buddy_relocate(
pool), so there is nothing wrong about this. The pool), so there is nothing wrong about this. The
mach_read_from_4() calls here will only trigger bogus mach_read_from_4() calls here will only trigger bogus
Valgrind memcheck warnings in UNIV_DEBUG_VALGRIND builds. */ Valgrind memcheck warnings in UNIV_DEBUG_VALGRIND builds. */
space = mach_read_from_4((const byte*) src + space = mach_read_from_4((const byte *) src
FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID); + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
page_no = mach_read_from_4((const byte*) src + page_no = mach_read_from_4((const byte *) src
FIL_PAGE_OFFSET); + FIL_PAGE_OFFSET);
/* Suppress Valgrind warnings about conditional jump /* Suppress Valgrind warnings about conditional jump
on uninitialized value. */ on uninitialized value. */
UNIV_MEM_VALID(&space, sizeof space); UNIV_MEM_VALID(&space, sizeof space);
...@@ -381,8 +378,6 @@ buf_buddy_relocate( ...@@ -381,8 +378,6 @@ buf_buddy_relocate(
return(FALSE); return(FALSE);
} }
ut_ad(!buf_pool_watch_is_sentinel(buf_pool, bpage));
if (page_zip_get_size(&bpage->zip) != size) { if (page_zip_get_size(&bpage->zip) != size) {
/* The block is of different size. We would /* The block is of different size. We would
have to relocate all blocks covered by src. have to relocate all blocks covered by src.
...@@ -462,21 +457,21 @@ recombine: ...@@ -462,21 +457,21 @@ recombine:
if (UT_LIST_GET_LEN(buf_pool->zip_free[i]) < 16) { if (UT_LIST_GET_LEN(buf_pool->zip_free[i]) < 16) {
goto func_exit; goto func_exit;
} }
/* Try to combine adjacent blocks. */ /* Try to combine adjacent blocks. */
buddy = (buf_page_t*) buf_buddy_get(((byte*) buf), BUF_BUDDY_LOW << i); buddy = (buf_page_t*) buf_buddy_get(((byte*) buf), BUF_BUDDY_LOW << i);
#ifndef UNIV_DEBUG_VALGRIND #ifndef UNIV_DEBUG_VALGRIND
/* When Valgrind instrumentation is not enabled, we can read /* When Valgrind instrumentation is not enabled, we can read
buddy->state to quickly determine that a block is not free. buddy->state to quickly determine that a block is not free.
When the block is not free, buddy->state belongs to a compressed When the block is not free, buddy->state belongs to a compressed
page frame that may be flagged uninitialized in our Valgrind page frame that may be flagged uninitialized in our Valgrind
instrumentation. */ instrumentation. */
if (buddy->state != BUF_BLOCK_ZIP_FREE) { if (buddy->state != BUF_BLOCK_ZIP_FREE) {
goto buddy_nonfree; goto buddy_nonfree;
} }
#endif /* !UNIV_DEBUG_VALGRIND */ #endif /* !UNIV_DEBUG_VALGRIND */
for (bpage = UT_LIST_GET_FIRST(buf_pool->zip_free[i]); bpage; ) { for (bpage = UT_LIST_GET_FIRST(buf_pool->zip_free[i]); bpage; ) {
...@@ -503,12 +498,13 @@ buddy_is_free: ...@@ -503,12 +498,13 @@ buddy_is_free:
buddy_nonfree: buddy_nonfree:
#endif /* !UNIV_DEBUG_VALGRIND */ #endif /* !UNIV_DEBUG_VALGRIND */
ut_d(BUF_BUDDY_LIST_VALIDATE(buf_pool, i)); ut_d(BUF_BUDDY_LIST_VALIDATE(buf_pool, i));
/* The buddy is not free. Is there a free block of this size? */ /* The buddy is not free. Is there a free block of this size? */
bpage = UT_LIST_GET_FIRST(buf_pool->zip_free[i]); bpage = UT_LIST_GET_FIRST(buf_pool->zip_free[i]);
if (bpage) { if (bpage) {
/* Remove the block from the free list, because a successful /* Remove the block from the free list, because a successful
buf_buddy_relocate() will overwrite bpage->list. */ buf_buddy_relocate() will overwrite bpage->list. */
buf_buddy_remove_from_free(buf_pool, bpage, i); buf_buddy_remove_from_free(buf_pool, bpage, i);
......
...@@ -3272,7 +3272,6 @@ err_exit: ...@@ -3272,7 +3272,6 @@ err_exit:
bpage->space = space; bpage->space = space;
bpage->offset = offset; bpage->offset = offset;
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
bpage->in_page_hash = FALSE; bpage->in_page_hash = FALSE;
bpage->in_zip_hash = FALSE; bpage->in_zip_hash = FALSE;
......
...@@ -1819,7 +1819,6 @@ buf_LRU_block_remove_hashed_page( ...@@ -1819,7 +1819,6 @@ buf_LRU_block_remove_hashed_page(
buf_pool_mutex_exit_allow(buf_pool); buf_pool_mutex_exit_allow(buf_pool);
buf_page_free_descriptor(bpage); buf_page_free_descriptor(bpage);
return(BUF_BLOCK_ZIP_FREE); return(BUF_BLOCK_ZIP_FREE);
case BUF_BLOCK_FILE_PAGE: case BUF_BLOCK_FILE_PAGE:
......
...@@ -37,14 +37,14 @@ Created December 2006 by Marko Makela ...@@ -37,14 +37,14 @@ Created December 2006 by Marko Makela
/**********************************************************************//** /**********************************************************************//**
Allocate a block. The thread calling this function must hold Allocate a block. The thread calling this function must hold
buf_pool->mutex and must not hold buf_pool->zip_mutex or any buf_pool->mutex and must not hold buf_pool->zip_mutex or any
block->mutex. The buf_pool_mutex may be released and reacquired. block->mutex. The buf_pool->mutex may be released and reacquired.
This function should only be used for allocating compressed page frames. This function should only be used for allocating compressed page frames.
@return allocated block, never NULL */ @return allocated block, never NULL */
UNIV_INLINE UNIV_INLINE
void* byte*
buf_buddy_alloc( buf_buddy_alloc(
/*============*/ /*============*/
buf_pool_t* buf_pool, /*!< in: buffer pool in which buf_pool_t* buf_pool, /*!< in/out: buffer pool in which
the page resides */ the page resides */
ulint size, /*!< in: compressed page size ulint size, /*!< in: compressed page size
(between PAGE_ZIP_MIN_SIZE and (between PAGE_ZIP_MIN_SIZE and
...@@ -57,16 +57,17 @@ buf_buddy_alloc( ...@@ -57,16 +57,17 @@ buf_buddy_alloc(
__attribute__((malloc, nonnull)); __attribute__((malloc, nonnull));
/**********************************************************************//** /**********************************************************************//**
Release a block. */ Deallocate a block. */
UNIV_INLINE UNIV_INLINE
void void
buf_buddy_free( buf_buddy_free(
/*===========*/ /*===========*/
buf_pool_t* buf_pool, buf_pool_t* buf_pool, /*!< in/out: buffer pool in which
/*!< buffer pool in which the block resides */ the block resides */
void* buf, /*!< in: block to be freed, must not be void* buf, /*!< in: block to be freed, must not
pointed to by the buffer pool */ be pointed to by the buffer pool */
ulint size) /*!< in: block size, up to UNIV_PAGE_SIZE */ ulint size) /*!< in: block size,
up to UNIV_PAGE_SIZE */
__attribute__((nonnull)); __attribute__((nonnull));
#ifndef UNIV_NONINL #ifndef UNIV_NONINL
......
...@@ -42,13 +42,14 @@ UNIV_INTERN ...@@ -42,13 +42,14 @@ UNIV_INTERN
void* void*
buf_buddy_alloc_low( buf_buddy_alloc_low(
/*================*/ /*================*/
buf_pool_t* buf_pool, buf_pool_t* buf_pool, /*!< in/out: buffer pool instance */
/*!< in: buffer pool in which the page resides */ ulint i, /*!< in: index of buf_pool->zip_free[],
ulint i, /*!< in: index of buf_pool->zip_free[], or BUF_BUDDY_SIZES */
or BUF_BUDDY_SIZES */ ibool* lru) /*!< in: pointer to a variable that
ibool* lru) /*!< in: pointer to a variable that will be assigned will be assigned TRUE if storage was
TRUE if storage was allocated from the LRU list allocated from the LRU list and
and buf_pool_mutex was temporarily released */ buf_pool->mutex was temporarily
released */
__attribute__((malloc, nonnull)); __attribute__((malloc, nonnull));
/**********************************************************************//** /**********************************************************************//**
...@@ -88,14 +89,14 @@ buf_buddy_get_slot( ...@@ -88,14 +89,14 @@ buf_buddy_get_slot(
/**********************************************************************//** /**********************************************************************//**
Allocate a block. The thread calling this function must hold Allocate a block. The thread calling this function must hold
buf_pool->mutex and must not hold buf_pool->zip_mutex or any buf_pool->mutex and must not hold buf_pool->zip_mutex or any
block->mutex. The buf_pool_mutex may be released and reacquired. block->mutex. The buf_pool->mutex may be released and reacquired.
This function should only be used for allocating compressed page frames. This function should only be used for allocating compressed page frames.
@return allocated block, never NULL */ @return allocated block, never NULL */
UNIV_INLINE UNIV_INLINE
void* byte*
buf_buddy_alloc( buf_buddy_alloc(
/*============*/ /*============*/
buf_pool_t* buf_pool, /*!< in: buffer pool in which buf_pool_t* buf_pool, /*!< in/out: buffer pool in which
the page resides */ the page resides */
ulint size, /*!< in: compressed page size ulint size, /*!< in: compressed page size
(between PAGE_ZIP_MIN_SIZE and (between PAGE_ZIP_MIN_SIZE and
...@@ -111,7 +112,8 @@ buf_buddy_alloc( ...@@ -111,7 +112,8 @@ buf_buddy_alloc(
ut_ad(size >= PAGE_ZIP_MIN_SIZE); ut_ad(size >= PAGE_ZIP_MIN_SIZE);
ut_ad(size <= UNIV_PAGE_SIZE); ut_ad(size <= UNIV_PAGE_SIZE);
return(buf_buddy_alloc_low(buf_pool, buf_buddy_get_slot(size), lru)); return((byte*) buf_buddy_alloc_low(buf_pool, buf_buddy_get_slot(size),
lru));
} }
/**********************************************************************//** /**********************************************************************//**
...@@ -120,11 +122,12 @@ UNIV_INLINE ...@@ -120,11 +122,12 @@ UNIV_INLINE
void void
buf_buddy_free( buf_buddy_free(
/*===========*/ /*===========*/
buf_pool_t* buf_pool, /*!< in: buffer pool instance */ buf_pool_t* buf_pool, /*!< in/out: buffer pool in which
void* buf, /*!< in: block to be freed, must not be the block resides */
pointed to by the buffer pool */ void* buf, /*!< in: block to be freed, must not
ulint size) /*!< in: block size, up to be pointed to by the buffer pool */
UNIV_PAGE_SIZE */ ulint size) /*!< in: block size,
up to UNIV_PAGE_SIZE */
{ {
ut_ad(buf_pool_mutex_own(buf_pool)); ut_ad(buf_pool_mutex_own(buf_pool));
ut_ad(ut_is_2pow(size)); ut_ad(ut_is_2pow(size));
......
...@@ -284,6 +284,7 @@ buf_page_free_descriptor( ...@@ -284,6 +284,7 @@ buf_page_free_descriptor(
/*=====================*/ /*=====================*/
buf_page_t* bpage) /*!< in: bpage descriptor to free. */ buf_page_t* bpage) /*!< in: bpage descriptor to free. */
__attribute__((nonnull)); __attribute__((nonnull));
/********************************************************************//** /********************************************************************//**
Allocates a buffer block. Allocates a buffer block.
@return own: the allocated block, in state BUF_BLOCK_MEMORY */ @return own: the allocated block, in state BUF_BLOCK_MEMORY */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment