Commit f43adb80 authored by Marko Mäkelä's avatar Marko Mäkelä

Merge mysql-5.1 to mysql-5.5.

parents 3400e0be b0fc27dc
/***************************************************************************** /*****************************************************************************
Copyright (c) 2006, 2010, Innobase Oy. All Rights Reserved. Copyright (c) 2006, 2011, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
...@@ -352,7 +352,9 @@ buf_buddy_relocate_block( ...@@ -352,7 +352,9 @@ buf_buddy_relocate_block(
buf_page_t* bpage, /*!< in: block to relocate */ buf_page_t* bpage, /*!< in: block to relocate */
buf_page_t* dpage) /*!< in: free block to relocate to */ buf_page_t* dpage) /*!< in: free block to relocate to */
{ {
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
buf_page_t* b; buf_page_t* b;
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage); buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
ut_ad(buf_pool_mutex_own(buf_pool)); ut_ad(buf_pool_mutex_own(buf_pool));
...@@ -382,7 +384,7 @@ buf_buddy_relocate_block( ...@@ -382,7 +384,7 @@ buf_buddy_relocate_block(
buf_relocate(bpage, dpage); buf_relocate(bpage, dpage);
ut_d(bpage->state = BUF_BLOCK_ZIP_FREE); ut_d(bpage->state = BUF_BLOCK_ZIP_FREE);
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
/* relocate buf_pool->zip_clean */ /* relocate buf_pool->zip_clean */
b = UT_LIST_GET_PREV(list, dpage); b = UT_LIST_GET_PREV(list, dpage);
UT_LIST_REMOVE(list, buf_pool->zip_clean, dpage); UT_LIST_REMOVE(list, buf_pool->zip_clean, dpage);
...@@ -392,6 +394,7 @@ buf_buddy_relocate_block( ...@@ -392,6 +394,7 @@ buf_buddy_relocate_block(
} else { } else {
UT_LIST_ADD_FIRST(list, buf_pool->zip_clean, dpage); UT_LIST_ADD_FIRST(list, buf_pool->zip_clean, dpage);
} }
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
UNIV_MEM_INVALID(bpage, sizeof *bpage); UNIV_MEM_INVALID(bpage, sizeof *bpage);
......
This diff is collapsed.
/***************************************************************************** /*****************************************************************************
Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved. Copyright (c) 1995, 2011, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
...@@ -524,7 +524,9 @@ buf_flush_remove( ...@@ -524,7 +524,9 @@ buf_flush_remove(
case BUF_BLOCK_ZIP_DIRTY: case BUF_BLOCK_ZIP_DIRTY:
buf_page_set_state(bpage, BUF_BLOCK_ZIP_PAGE); buf_page_set_state(bpage, BUF_BLOCK_ZIP_PAGE);
UT_LIST_REMOVE(list, buf_pool->flush_list, bpage); UT_LIST_REMOVE(list, buf_pool->flush_list, bpage);
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
buf_LRU_insert_zip_clean(bpage); buf_LRU_insert_zip_clean(bpage);
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
break; break;
case BUF_BLOCK_FILE_PAGE: case BUF_BLOCK_FILE_PAGE:
UT_LIST_REMOVE(list, buf_pool->flush_list, bpage); UT_LIST_REMOVE(list, buf_pool->flush_list, bpage);
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved. Copyright (c) 1995, 2011, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
...@@ -525,6 +525,7 @@ buf_LRU_invalidate_tablespace( ...@@ -525,6 +525,7 @@ buf_LRU_invalidate_tablespace(
} }
} }
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
/********************************************************************//** /********************************************************************//**
Insert a compressed block into buf_pool->zip_clean in the LRU order. */ Insert a compressed block into buf_pool->zip_clean in the LRU order. */
UNIV_INTERN UNIV_INTERN
...@@ -557,6 +558,7 @@ buf_LRU_insert_zip_clean( ...@@ -557,6 +558,7 @@ buf_LRU_insert_zip_clean(
UT_LIST_ADD_FIRST(list, buf_pool->zip_clean, bpage); UT_LIST_ADD_FIRST(list, buf_pool->zip_clean, bpage);
} }
} }
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
/******************************************************************//** /******************************************************************//**
Try to free an uncompressed page of a compressed block from the unzip Try to free an uncompressed page of a compressed block from the unzip
...@@ -1598,7 +1600,9 @@ alloc: ...@@ -1598,7 +1600,9 @@ alloc:
} }
if (b->state == BUF_BLOCK_ZIP_PAGE) { if (b->state == BUF_BLOCK_ZIP_PAGE) {
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
buf_LRU_insert_zip_clean(b); buf_LRU_insert_zip_clean(b);
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
} else { } else {
/* Relocate on buf_pool->flush_list. */ /* Relocate on buf_pool->flush_list. */
buf_flush_relocate_on_flush_list(bpage, b); buf_flush_relocate_on_flush_list(bpage, b);
...@@ -1884,7 +1888,9 @@ buf_LRU_block_remove_hashed_page( ...@@ -1884,7 +1888,9 @@ buf_LRU_block_remove_hashed_page(
ut_a(bpage->zip.data); ut_a(bpage->zip.data);
ut_a(buf_page_get_zip_size(bpage)); ut_a(buf_page_get_zip_size(bpage));
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
UT_LIST_REMOVE(list, buf_pool->zip_clean, bpage); UT_LIST_REMOVE(list, buf_pool->zip_clean, bpage);
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
mutex_exit(&buf_pool->zip_mutex); mutex_exit(&buf_pool->zip_mutex);
buf_pool_mutex_exit_forbid(buf_pool); buf_pool_mutex_exit_forbid(buf_pool);
......
...@@ -246,12 +246,6 @@ buf_relocate( ...@@ -246,12 +246,6 @@ buf_relocate(
BUF_BLOCK_ZIP_DIRTY or BUF_BLOCK_ZIP_PAGE */ BUF_BLOCK_ZIP_DIRTY or BUF_BLOCK_ZIP_PAGE */
buf_page_t* dpage) /*!< in/out: destination control block */ buf_page_t* dpage) /*!< in/out: destination control block */
__attribute__((nonnull)); __attribute__((nonnull));
/********************************************************************//**
Resizes the buffer pool. */
UNIV_INTERN
void
buf_pool_resize(void);
/*=================*/
/*********************************************************************//** /*********************************************************************//**
Gets the current size of buffer buf_pool in bytes. Gets the current size of buffer buf_pool in bytes.
@return size in bytes */ @return size in bytes */
...@@ -1221,7 +1215,7 @@ ulint ...@@ -1221,7 +1215,7 @@ ulint
buf_get_free_list_len(void); buf_get_free_list_len(void);
/*=======================*/ /*=======================*/
/******************************************************************** /********************************************************************//**
Determine if a block is a sentinel for a buffer pool watch. Determine if a block is a sentinel for a buffer pool watch.
@return TRUE if a sentinel for a buffer pool watch, FALSE if not */ @return TRUE if a sentinel for a buffer pool watch, FALSE if not */
UNIV_INTERN UNIV_INTERN
...@@ -1757,8 +1751,10 @@ struct buf_pool_struct{ ...@@ -1757,8 +1751,10 @@ struct buf_pool_struct{
frames and buf_page_t descriptors of blocks that exist frames and buf_page_t descriptors of blocks that exist
in the buffer pool only in compressed form. */ in the buffer pool only in compressed form. */
/* @{ */ /* @{ */
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
UT_LIST_BASE_NODE_T(buf_page_t) zip_clean; UT_LIST_BASE_NODE_T(buf_page_t) zip_clean;
/*!< unmodified compressed pages */ /*!< unmodified compressed pages */
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
UT_LIST_BASE_NODE_T(buf_page_t) zip_free[BUF_BUDDY_SIZES]; UT_LIST_BASE_NODE_T(buf_page_t) zip_free[BUF_BUDDY_SIZES];
/*!< buddy free lists */ /*!< buddy free lists */
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. Copyright (c) 1995, 2011, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
...@@ -85,6 +85,7 @@ void ...@@ -85,6 +85,7 @@ void
buf_LRU_invalidate_tablespace( buf_LRU_invalidate_tablespace(
/*==========================*/ /*==========================*/
ulint id); /*!< in: space id */ ulint id); /*!< in: space id */
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
/********************************************************************//** /********************************************************************//**
Insert a compressed block into buf_pool->zip_clean in the LRU order. */ Insert a compressed block into buf_pool->zip_clean in the LRU order. */
UNIV_INTERN UNIV_INTERN
...@@ -92,6 +93,7 @@ void ...@@ -92,6 +93,7 @@ void
buf_LRU_insert_zip_clean( buf_LRU_insert_zip_clean(
/*=====================*/ /*=====================*/
buf_page_t* bpage); /*!< in: pointer to the block in question */ buf_page_t* bpage); /*!< in: pointer to the block in question */
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
/******************************************************************//** /******************************************************************//**
Try to free a block. If bpage is a descriptor of a compressed-only Try to free a block. If bpage is a descriptor of a compressed-only
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 2005, 2009, Innobase Oy. All Rights Reserved. Copyright (c) 2005, 2011, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
...@@ -3912,17 +3912,9 @@ page_zip_write_trx_id_and_roll_ptr( ...@@ -3912,17 +3912,9 @@ page_zip_write_trx_id_and_roll_ptr(
UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip)); UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));
} }
#ifdef UNIV_ZIP_DEBUG
/** Set this variable in a debugger to disable page_zip_clear_rec().
The only observable effect should be the compression ratio due to
deleted records not being zeroed out. In rare cases, there can be
page_zip_validate() failures on the node_ptr, trx_id and roll_ptr
columns if the space is reallocated for a smaller record. */
UNIV_INTERN ibool page_zip_clear_rec_disable;
#endif /* UNIV_ZIP_DEBUG */
/**********************************************************************//** /**********************************************************************//**
Clear an area on the uncompressed and compressed page, if possible. */ Clear an area on the uncompressed and compressed page.
Do not clear the data payload, as that would grow the modification log. */
static static
void void
page_zip_clear_rec( page_zip_clear_rec(
...@@ -3934,6 +3926,9 @@ page_zip_clear_rec( ...@@ -3934,6 +3926,9 @@ page_zip_clear_rec(
{ {
ulint heap_no; ulint heap_no;
page_t* page = page_align(rec); page_t* page = page_align(rec);
byte* storage;
byte* field;
ulint len;
/* page_zip_validate() would fail here if a record /* page_zip_validate() would fail here if a record
containing externally stored columns is being deleted. */ containing externally stored columns is being deleted. */
ut_ad(rec_offs_validate(rec, index, offsets)); ut_ad(rec_offs_validate(rec, index, offsets));
...@@ -3949,60 +3944,46 @@ page_zip_clear_rec( ...@@ -3949,60 +3944,46 @@ page_zip_clear_rec(
UNIV_MEM_ASSERT_RW(rec - rec_offs_extra_size(offsets), UNIV_MEM_ASSERT_RW(rec - rec_offs_extra_size(offsets),
rec_offs_extra_size(offsets)); rec_offs_extra_size(offsets));
if ( if (!page_is_leaf(page)) {
#ifdef UNIV_ZIP_DEBUG /* Clear node_ptr. On the compressed page,
!page_zip_clear_rec_disable && there is an array of node_ptr immediately before the
#endif /* UNIV_ZIP_DEBUG */ dense page directory, at the very end of the page. */
page_zip->m_end storage = page_zip->data
+ 1 + ((heap_no - 1) >= 64)/* size of the log entry */ + page_zip_get_size(page_zip)
+ page_zip_get_trailer_len(page_zip, - (page_dir_get_n_heap(page)
dict_index_is_clust(index), NULL) - PAGE_HEAP_NO_USER_LOW)
< page_zip_get_size(page_zip)) { * PAGE_ZIP_DIR_SLOT_SIZE;
byte* data; ut_ad(dict_index_get_n_unique_in_tree(index) ==
rec_offs_n_fields(offsets) - 1);
/* Clear only the data bytes, because the allocator and field = rec_get_nth_field(rec, offsets,
the decompressor depend on the extra bytes. */ rec_offs_n_fields(offsets) - 1,
memset(rec, 0, rec_offs_data_size(offsets)); &len);
ut_ad(len == REC_NODE_PTR_SIZE);
if (!page_is_leaf(page)) {
/* Clear node_ptr on the compressed page. */
byte* storage = page_zip->data
+ page_zip_get_size(page_zip)
- (page_dir_get_n_heap(page)
- PAGE_HEAP_NO_USER_LOW)
* PAGE_ZIP_DIR_SLOT_SIZE;
memset(storage - (heap_no - 1) * REC_NODE_PTR_SIZE,
0, REC_NODE_PTR_SIZE);
} else if (dict_index_is_clust(index)) {
/* Clear trx_id and roll_ptr on the compressed page. */
byte* storage = page_zip->data
+ page_zip_get_size(page_zip)
- (page_dir_get_n_heap(page)
- PAGE_HEAP_NO_USER_LOW)
* PAGE_ZIP_DIR_SLOT_SIZE;
memset(storage - (heap_no - 1)
* (DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN),
0, DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN);
}
/* Log that the data was zeroed out. */ ut_ad(!rec_offs_any_extern(offsets));
data = page_zip->data + page_zip->m_end; memset(field, 0, REC_NODE_PTR_SIZE);
ut_ad(!*data); memset(storage - (heap_no - 1) * REC_NODE_PTR_SIZE,
if (UNIV_UNLIKELY(heap_no - 1 >= 64)) { 0, REC_NODE_PTR_SIZE);
*data++ = (byte) (0x80 | (heap_no - 1) >> 7); } else if (dict_index_is_clust(index)) {
ut_ad(!*data); /* Clear trx_id and roll_ptr. On the compressed page,
} there is an array of these fields immediately before the
*data++ = (byte) ((heap_no - 1) << 1 | 1); dense page directory, at the very end of the page. */
ut_ad(!*data); const ulint trx_id_pos
ut_ad((ulint) (data - page_zip->data) = dict_col_get_clust_pos(
< page_zip_get_size(page_zip)); dict_table_get_sys_col(
page_zip->m_end = data - page_zip->data; index->table, DATA_TRX_ID), index);
page_zip->m_nonempty = TRUE; storage = page_zip->data
} else if (page_is_leaf(page) && dict_index_is_clust(index)) { + page_zip_get_size(page_zip)
/* Do not clear the record, because there is not enough space - (page_dir_get_n_heap(page)
to log the operation. */ - PAGE_HEAP_NO_USER_LOW)
* PAGE_ZIP_DIR_SLOT_SIZE;
field = rec_get_nth_field(rec, offsets, trx_id_pos, &len);
ut_ad(len == DATA_TRX_ID_LEN);
memset(field, 0, DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN);
memset(storage - (heap_no - 1)
* (DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN),
0, DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN);
if (rec_offs_any_extern(offsets)) { if (rec_offs_any_extern(offsets)) {
ulint i; ulint i;
...@@ -4011,15 +3992,18 @@ page_zip_clear_rec( ...@@ -4011,15 +3992,18 @@ page_zip_clear_rec(
/* Clear all BLOB pointers in order to make /* Clear all BLOB pointers in order to make
page_zip_validate() pass. */ page_zip_validate() pass. */
if (rec_offs_nth_extern(offsets, i)) { if (rec_offs_nth_extern(offsets, i)) {
ulint len; field = rec_get_nth_field(
byte* field = rec_get_nth_field(
rec, offsets, i, &len); rec, offsets, i, &len);
ut_ad(len
== BTR_EXTERN_FIELD_REF_SIZE);
memset(field + len memset(field + len
- BTR_EXTERN_FIELD_REF_SIZE, - BTR_EXTERN_FIELD_REF_SIZE,
0, BTR_EXTERN_FIELD_REF_SIZE); 0, BTR_EXTERN_FIELD_REF_SIZE);
} }
} }
} }
} else {
ut_ad(!rec_offs_any_extern(offsets));
} }
#ifdef UNIV_ZIP_DEBUG #ifdef UNIV_ZIP_DEBUG
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved. Copyright (c) 1994, 2011, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
...@@ -408,7 +408,7 @@ rec_init_offsets( ...@@ -408,7 +408,7 @@ rec_init_offsets(
do { do {
ulint len; ulint len;
if (UNIV_UNLIKELY(i == n_node_ptr_field)) { if (UNIV_UNLIKELY(i == n_node_ptr_field)) {
len = offs += 4; len = offs += REC_NODE_PTR_SIZE;
goto resolved; goto resolved;
} }
...@@ -640,7 +640,7 @@ rec_get_offsets_reverse( ...@@ -640,7 +640,7 @@ rec_get_offsets_reverse(
do { do {
ulint len; ulint len;
if (UNIV_UNLIKELY(i == n_node_ptr_field)) { if (UNIV_UNLIKELY(i == n_node_ptr_field)) {
len = offs += 4; len = offs += REC_NODE_PTR_SIZE;
goto resolved; goto resolved;
} }
...@@ -1131,9 +1131,9 @@ rec_convert_dtuple_to_rec_comp( ...@@ -1131,9 +1131,9 @@ rec_convert_dtuple_to_rec_comp(
if (UNIV_UNLIKELY(i == n_node_ptr_field)) { if (UNIV_UNLIKELY(i == n_node_ptr_field)) {
ut_ad(dtype_get_prtype(type) & DATA_NOT_NULL); ut_ad(dtype_get_prtype(type) & DATA_NOT_NULL);
ut_ad(len == 4); ut_ad(len == REC_NODE_PTR_SIZE);
memcpy(end, dfield_get_data(field), len); memcpy(end, dfield_get_data(field), len);
end += 4; end += REC_NODE_PTR_SIZE;
break; break;
} }
......
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