Commit 29deba81 authored by Marko Mäkelä's avatar Marko Mäkelä

Merge mysql-5.1-innodb to mysql-5.5-innodb.

parents 2a0bcbc9 c6ee5666
...@@ -981,7 +981,7 @@ btr_page_reorganize_low( ...@@ -981,7 +981,7 @@ btr_page_reorganize_low(
log_mode = mtr_set_log_mode(mtr, MTR_LOG_NONE); log_mode = mtr_set_log_mode(mtr, MTR_LOG_NONE);
#ifndef UNIV_HOTBACKUP #ifndef UNIV_HOTBACKUP
temp_block = buf_block_alloc(buf_pool, 0); temp_block = buf_block_alloc(buf_pool);
#else /* !UNIV_HOTBACKUP */ #else /* !UNIV_HOTBACKUP */
ut_ad(block == back_block1); ut_ad(block == back_block1);
temp_block = back_block2; temp_block = back_block2;
......
...@@ -4046,13 +4046,12 @@ btr_blob_free( ...@@ -4046,13 +4046,12 @@ btr_blob_free(
&& buf_block_get_space(block) == space && buf_block_get_space(block) == space
&& buf_block_get_page_no(block) == page_no) { && buf_block_get_page_no(block) == page_no) {
if (buf_LRU_free_block(&block->page, all, NULL) if (buf_LRU_free_block(&block->page, all) != BUF_LRU_FREED
!= BUF_LRU_FREED
&& all && block->page.zip.data) { && all && block->page.zip.data) {
/* Attempt to deallocate the uncompressed page /* Attempt to deallocate the uncompressed page
if the whole block cannot be deallocted. */ if the whole block cannot be deallocted. */
buf_LRU_free_block(&block->page, FALSE, NULL); buf_LRU_free_block(&block->page, FALSE);
} }
} }
......
...@@ -151,7 +151,7 @@ btr_search_check_free_space_in_heap(void) ...@@ -151,7 +151,7 @@ btr_search_check_free_space_in_heap(void)
be enough free space in the hash table. */ be enough free space in the hash table. */
if (heap->free_block == NULL) { if (heap->free_block == NULL) {
buf_block_t* block = buf_block_alloc(NULL, 0); buf_block_t* block = buf_block_alloc(NULL);
rw_lock_x_lock(&btr_search_latch); rw_lock_x_lock(&btr_search_latch);
......
...@@ -327,7 +327,7 @@ buf_buddy_alloc_low( ...@@ -327,7 +327,7 @@ buf_buddy_alloc_low(
/* Try replacing an uncompressed page in the buffer pool. */ /* Try replacing an uncompressed page in the buffer pool. */
buf_pool_mutex_exit(buf_pool); buf_pool_mutex_exit(buf_pool);
block = buf_LRU_get_free_block(buf_pool, 0); block = buf_LRU_get_free_block(buf_pool);
*lru = TRUE; *lru = TRUE;
buf_pool_mutex_enter(buf_pool); buf_pool_mutex_enter(buf_pool);
......
...@@ -416,9 +416,9 @@ UNIV_INTERN ...@@ -416,9 +416,9 @@ UNIV_INTERN
buf_block_t* buf_block_t*
buf_block_alloc( buf_block_alloc(
/*============*/ /*============*/
buf_pool_t* buf_pool, /*!< in: buffer pool instance */ buf_pool_t* buf_pool) /*!< in/out: buffer pool instance,
ulint zip_size) /*!< in: compressed page size in bytes, or NULL for round-robin selection
or 0 if uncompressed tablespace */ of the buffer pool */
{ {
buf_block_t* block; buf_block_t* block;
ulint index; ulint index;
...@@ -431,7 +431,7 @@ buf_block_alloc( ...@@ -431,7 +431,7 @@ buf_block_alloc(
buf_pool = buf_pool_from_array(index); buf_pool = buf_pool_from_array(index);
} }
block = buf_LRU_get_free_block(buf_pool, zip_size); block = buf_LRU_get_free_block(buf_pool);
buf_block_set_state(block, BUF_BLOCK_MEMORY); buf_block_set_state(block, BUF_BLOCK_MEMORY);
...@@ -1623,7 +1623,7 @@ buf_pool_shrink_instance( ...@@ -1623,7 +1623,7 @@ buf_pool_shrink_instance(
buf_LRU_make_block_old(&block->page); buf_LRU_make_block_old(&block->page);
dirty++; dirty++;
} else if (buf_LRU_free_block(&block->page, TRUE, NULL) } else if (buf_LRU_free_block(&block->page, TRUE)
!= BUF_LRU_FREED) { != BUF_LRU_FREED) {
nonfree++; nonfree++;
} }
...@@ -2366,8 +2366,7 @@ buf_page_get_zip( ...@@ -2366,8 +2366,7 @@ buf_page_get_zip(
mutex_enter(block_mutex); mutex_enter(block_mutex);
/* Discard the uncompressed page frame if possible. */ /* Discard the uncompressed page frame if possible. */
if (buf_LRU_free_block(bpage, FALSE, NULL) if (buf_LRU_free_block(bpage, FALSE) == BUF_LRU_FREED) {
== BUF_LRU_FREED) {
mutex_exit(block_mutex); mutex_exit(block_mutex);
goto lookup; goto lookup;
...@@ -2883,7 +2882,7 @@ buf_page_get_gen( ...@@ -2883,7 +2882,7 @@ buf_page_get_gen(
buf_pool_mutex_exit(buf_pool); buf_pool_mutex_exit(buf_pool);
mutex_exit(&buf_pool->zip_mutex); mutex_exit(&buf_pool->zip_mutex);
block = buf_LRU_get_free_block(buf_pool, 0); block = buf_LRU_get_free_block(buf_pool);
ut_a(block); ut_a(block);
buf_pool_mutex_enter(buf_pool); buf_pool_mutex_enter(buf_pool);
...@@ -3013,8 +3012,7 @@ buf_page_get_gen( ...@@ -3013,8 +3012,7 @@ buf_page_get_gen(
/* Try to evict the block from the buffer pool, to use the /* Try to evict the block from the buffer pool, to use the
insert buffer (change buffer) as much as possible. */ insert buffer (change buffer) as much as possible. */
if (buf_LRU_free_block(&block->page, TRUE, NULL) if (buf_LRU_free_block(&block->page, TRUE) == BUF_LRU_FREED) {
== BUF_LRU_FREED) {
mutex_exit(&block->mutex); mutex_exit(&block->mutex);
if (mode == BUF_GET_IF_IN_POOL_OR_WATCH) { if (mode == BUF_GET_IF_IN_POOL_OR_WATCH) {
/* Set the watch, as it would have /* Set the watch, as it would have
...@@ -3588,7 +3586,7 @@ buf_page_init_for_read( ...@@ -3588,7 +3586,7 @@ buf_page_init_for_read(
&& UNIV_LIKELY(!recv_recovery_is_on())) { && UNIV_LIKELY(!recv_recovery_is_on())) {
block = NULL; block = NULL;
} else { } else {
block = buf_LRU_get_free_block(buf_pool, 0); block = buf_LRU_get_free_block(buf_pool);
ut_ad(block); ut_ad(block);
ut_ad(buf_pool_from_block(block) == buf_pool); ut_ad(buf_pool_from_block(block) == buf_pool);
} }
...@@ -3794,7 +3792,7 @@ buf_page_create( ...@@ -3794,7 +3792,7 @@ buf_page_create(
ut_ad(mtr->state == MTR_ACTIVE); ut_ad(mtr->state == MTR_ACTIVE);
ut_ad(space || !zip_size); ut_ad(space || !zip_size);
free_block = buf_LRU_get_free_block(buf_pool, 0); free_block = buf_LRU_get_free_block(buf_pool);
fold = buf_page_address_fold(space, offset); fold = buf_page_address_fold(space, offset);
......
...@@ -603,7 +603,7 @@ buf_LRU_free_from_unzip_LRU_list( ...@@ -603,7 +603,7 @@ buf_LRU_free_from_unzip_LRU_list(
ut_ad(block->page.in_LRU_list); ut_ad(block->page.in_LRU_list);
mutex_enter(&block->mutex); mutex_enter(&block->mutex);
freed = buf_LRU_free_block(&block->page, FALSE, NULL); freed = buf_LRU_free_block(&block->page, FALSE);
mutex_exit(&block->mutex); mutex_exit(&block->mutex);
switch (freed) { switch (freed) {
...@@ -666,7 +666,7 @@ buf_LRU_free_from_common_LRU_list( ...@@ -666,7 +666,7 @@ buf_LRU_free_from_common_LRU_list(
mutex_enter(block_mutex); mutex_enter(block_mutex);
accessed = buf_page_is_accessed(bpage); accessed = buf_page_is_accessed(bpage);
freed = buf_LRU_free_block(bpage, TRUE, NULL); freed = buf_LRU_free_block(bpage, TRUE);
mutex_exit(block_mutex); mutex_exit(block_mutex);
switch (freed) { switch (freed) {
...@@ -858,9 +858,7 @@ UNIV_INTERN ...@@ -858,9 +858,7 @@ UNIV_INTERN
buf_block_t* buf_block_t*
buf_LRU_get_free_block( buf_LRU_get_free_block(
/*===================*/ /*===================*/
buf_pool_t* buf_pool, /*!< in: buffer pool instance */ buf_pool_t* buf_pool) /*!< in/out: buffer pool instance */
ulint zip_size) /*!< in: compressed page size in bytes,
or 0 if uncompressed tablespace */
{ {
buf_block_t* block = NULL; buf_block_t* block = NULL;
ibool freed; ibool freed;
...@@ -936,31 +934,11 @@ buf_LRU_get_free_block( ...@@ -936,31 +934,11 @@ buf_LRU_get_free_block(
/* If there is a block in the free list, take it */ /* If there is a block in the free list, take it */
block = buf_LRU_get_free_only(buf_pool); block = buf_LRU_get_free_only(buf_pool);
if (block) { buf_pool_mutex_exit(buf_pool);
if (block) {
ut_ad(buf_pool_from_block(block) == buf_pool); ut_ad(buf_pool_from_block(block) == buf_pool);
memset(&block->page.zip, 0, sizeof block->page.zip);
#ifdef UNIV_DEBUG
block->page.zip.m_start =
#endif /* UNIV_DEBUG */
block->page.zip.m_end =
block->page.zip.m_nonempty =
block->page.zip.n_blobs = 0;
if (UNIV_UNLIKELY(zip_size)) {
ibool lru;
page_zip_set_size(&block->page.zip, zip_size);
block->page.zip.data = buf_buddy_alloc(
buf_pool, zip_size, &lru);
UNIV_MEM_DESC(block->page.zip.data, zip_size, block);
} else {
page_zip_set_size(&block->page.zip, 0);
block->page.zip.data = NULL;
}
buf_pool_mutex_exit(buf_pool);
if (started_monitor) { if (started_monitor) {
srv_print_innodb_monitor = mon_value_was; srv_print_innodb_monitor = mon_value_was;
...@@ -972,8 +950,6 @@ buf_LRU_get_free_block( ...@@ -972,8 +950,6 @@ buf_LRU_get_free_block(
/* If no block was in the free list, search from the end of the LRU /* If no block was in the free list, search from the end of the LRU
list and try to free a block there */ list and try to free a block there */
buf_pool_mutex_exit(buf_pool);
freed = buf_LRU_search_and_free_block(buf_pool, n_iterations); freed = buf_LRU_search_and_free_block(buf_pool, n_iterations);
if (freed > 0) { if (freed > 0) {
...@@ -1456,12 +1432,8 @@ enum buf_lru_free_block_status ...@@ -1456,12 +1432,8 @@ enum buf_lru_free_block_status
buf_LRU_free_block( buf_LRU_free_block(
/*===============*/ /*===============*/
buf_page_t* bpage, /*!< in: block to be freed */ buf_page_t* bpage, /*!< in: block to be freed */
ibool zip, /*!< in: TRUE if should remove also the ibool zip) /*!< in: TRUE if should remove also the
compressed page of an uncompressed page */ compressed page of an uncompressed page */
ibool* buf_pool_mutex_released)
/*!< in: pointer to a variable that will
be assigned TRUE if buf_pool_mutex
was temporarily released, or NULL */
{ {
buf_page_t* b = NULL; buf_page_t* b = NULL;
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage); buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
...@@ -1638,10 +1610,6 @@ buf_LRU_free_block( ...@@ -1638,10 +1610,6 @@ buf_LRU_free_block(
b->io_fix = BUF_IO_READ; b->io_fix = BUF_IO_READ;
} }
if (buf_pool_mutex_released) {
*buf_pool_mutex_released = TRUE;
}
buf_pool_mutex_exit(buf_pool); buf_pool_mutex_exit(buf_pool);
mutex_exit(block_mutex); mutex_exit(block_mutex);
......
...@@ -276,9 +276,9 @@ UNIV_INTERN ...@@ -276,9 +276,9 @@ UNIV_INTERN
buf_block_t* buf_block_t*
buf_block_alloc( buf_block_alloc(
/*============*/ /*============*/
buf_pool_t* buf_pool, /*!< buffer pool instance */ buf_pool_t* buf_pool); /*!< in: buffer pool instance,
ulint zip_size); /*!< in: compressed page size in bytes, or NULL for round-robin selection
or 0 if uncompressed tablespace */ of the buffer pool */
/********************************************************************//** /********************************************************************//**
Frees a buffer block which does not contain a file page. */ Frees a buffer block which does not contain a file page. */
UNIV_INLINE UNIV_INLINE
......
...@@ -111,12 +111,9 @@ enum buf_lru_free_block_status ...@@ -111,12 +111,9 @@ enum buf_lru_free_block_status
buf_LRU_free_block( buf_LRU_free_block(
/*===============*/ /*===============*/
buf_page_t* bpage, /*!< in: block to be freed */ buf_page_t* bpage, /*!< in: block to be freed */
ibool zip, /*!< in: TRUE if should remove also the ibool zip) /*!< in: TRUE if should remove also the
compressed page of an uncompressed page */ compressed page of an uncompressed page */
ibool* buf_pool_mutex_released); __attribute__((nonnull));
/*!< in: pointer to a variable that will
be assigned TRUE if buf_pool->mutex
was temporarily released, or NULL */
/******************************************************************//** /******************************************************************//**
Try to free a replaceable block. Try to free a replaceable block.
@return TRUE if found and freed */ @return TRUE if found and freed */
...@@ -153,9 +150,8 @@ UNIV_INTERN ...@@ -153,9 +150,8 @@ UNIV_INTERN
buf_block_t* buf_block_t*
buf_LRU_get_free_block( buf_LRU_get_free_block(
/*===================*/ /*===================*/
buf_pool_t* buf_pool, /*!< in: preferred buffer pool */ buf_pool_t* buf_pool) /*!< in/out: buffer pool instance */
ulint zip_size); /*!< in: compressed page size in bytes, __attribute__((nonnull,warn_unused_result));
or 0 if uncompressed tablespace */
/******************************************************************//** /******************************************************************//**
Puts a block back to the free list. */ Puts a block back to the free list. */
......
...@@ -347,7 +347,7 @@ mem_heap_create_block( ...@@ -347,7 +347,7 @@ mem_heap_create_block(
return(NULL); return(NULL);
} }
} else { } else {
buf_block = buf_block_alloc(NULL, 0); buf_block = buf_block_alloc(NULL);
} }
block = (mem_block_t*) buf_block->frame; block = (mem_block_t*) buf_block->frame;
......
...@@ -4440,7 +4440,7 @@ page_zip_reorganize( ...@@ -4440,7 +4440,7 @@ page_zip_reorganize(
log_mode = mtr_set_log_mode(mtr, MTR_LOG_NONE); log_mode = mtr_set_log_mode(mtr, MTR_LOG_NONE);
#ifndef UNIV_HOTBACKUP #ifndef UNIV_HOTBACKUP
temp_block = buf_block_alloc(buf_pool, 0); temp_block = buf_block_alloc(buf_pool);
btr_search_drop_page_hash_index(block); btr_search_drop_page_hash_index(block);
block->check_index_page_at_flush = TRUE; block->check_index_page_at_flush = TRUE;
#else /* !UNIV_HOTBACKUP */ #else /* !UNIV_HOTBACKUP */
......
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