2005-10-27 07:29:40 +00:00
|
|
|
/******************************************************
|
|
|
|
The database buffer buf_pool
|
|
|
|
|
|
|
|
(c) 1995 Innobase Oy
|
|
|
|
|
|
|
|
Created 11/5/1995 Heikki Tuuri
|
|
|
|
*******************************************************/
|
|
|
|
|
|
|
|
#include "buf0flu.h"
|
|
|
|
#include "buf0lru.h"
|
|
|
|
#include "buf0rea.h"
|
|
|
|
#include "mtr0mtr.h"
|
|
|
|
|
2006-11-30 12:27:49 +00:00
|
|
|
/************************************************************************
|
|
|
|
Reads the freed_page_clock of a buffer block. */
|
|
|
|
UNIV_INLINE
|
|
|
|
ulint
|
|
|
|
buf_page_get_freed_page_clock(
|
|
|
|
/*==========================*/
|
|
|
|
/* out: freed_page_clock */
|
|
|
|
const buf_page_t* bpage) /* in: block */
|
|
|
|
{
|
branches/innodb+: Merge revisions 3602:3931 from branches/zip:
------------------------------------------------------------------------
r3607 | marko | 2008-12-30 22:33:31 +0200 (Tue, 30 Dec 2008) | 20 lines
branches/zip: Remove the dependency on the MySQL HASH table implementation.
Use the InnoDB hash table for keeping track of INNOBASE_SHARE objects.
struct st_innobase_share: Make table_name const uchar*. Add the member
table_name_hash.
innobase_open_tables: Change the type from HASH to hash_table_t*.
innobase_get_key(): Remove.
innobase_fold_name(): New function, for computing the fold value for the
InnoDB hash table.
get_share(), free_share(): Use the InnoDB hash functions.
innobase_end(): Free innobase_open_tables before shutting down InnoDB.
Shutting down InnoDB will invalidate all memory allocated via InnoDB.
rb://65 approved by Heikki Tuuri. This addresses Issue #104.
------------------------------------------------------------------------
r3608 | marko | 2008-12-30 22:45:04 +0200 (Tue, 30 Dec 2008) | 22 lines
branches/zip: When setting the PAGE_LEVEL of a compressed B-tree page
from or to 0, compress the page at the same time. This is necessary,
because the column information stored on the compressed page will
differ between leaf and non-leaf pages. Leaf pages are identified by
PAGE_LEVEL=0. This bug was reported as Issue #150.
Document the similarity between btr_page_create() and
btr_page_empty(). Make the function signature of btr_page_empty()
identical with btr_page_create(). (This will add the parameter "level".)
btr_root_raise_and_insert(): Replace some code with a call to
btr_page_empty().
btr_attach_half_pages(): Assert that the page level has already been
set on both block and new_block. Do not set it again.
btr_discard_only_page_on_level(): Document that this function is
probably never called. Make it work on any height tree. (Tested on
2-high tree by disabling btr_lift_page_up().)
rb://68
------------------------------------------------------------------------
r3612 | marko | 2009-01-02 11:02:44 +0200 (Fri, 02 Jan 2009) | 14 lines
branches/zip: Merge c2998 from branches/6.0, so that the same InnoDB Plugin
source tree will work both under 5.1 and 6.0. Do not add the test case
innodb_ctype_ldml.test, because it would not work under MySQL 5.1.
Refuse to create tables whose columns contain collation IDs above 255.
This removes an assertion failure that was introduced in WL#4164
(Two-byte collation IDs).
create_table_def(): Do not fail an assertion if a column contains a
charset-collation ID greater than 256. Instead, issue an error and
refuse to create the table.
The original change (branches/6.0 r2998) was rb://51 approved by Calvin Sun.
------------------------------------------------------------------------
r3613 | inaam | 2009-01-02 15:10:50 +0200 (Fri, 02 Jan 2009) | 6 lines
branches/zip: Implement the parameter innodb_use_sys_malloc
(false by default), for disabling InnoDB's internal memory allocator
and using system malloc/free instead.
rb://62 approved by Marko
------------------------------------------------------------------------
r3614 | marko | 2009-01-02 15:55:12 +0200 (Fri, 02 Jan 2009) | 1 line
branches/zip: ChangeLog: Document r3608 and r3613.
------------------------------------------------------------------------
r3615 | marko | 2009-01-02 15:57:51 +0200 (Fri, 02 Jan 2009) | 1 line
branches/zip: ChangeLog: Clarify the impact of r3608.
------------------------------------------------------------------------
r3616 | marko | 2009-01-03 00:23:30 +0200 (Sat, 03 Jan 2009) | 1 line
branches/zip: srv_suspend_mysql_thread(): Add some clarifying comments.
------------------------------------------------------------------------
r3618 | marko | 2009-01-05 12:54:53 +0200 (Mon, 05 Jan 2009) | 15 lines
branches/zip: Merge revisions 3598:3601 from branches/5.1:
------------------------------------------------------------------------
r3601 | marko | 2008-12-22 16:05:19 +0200 (Mon, 22 Dec 2008) | 9 lines
branches/5.1: Make
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED
a true replacement of SET GLOBAL INNODB_LOCKS_UNSAFE_FOR_BINLOG=1.
This fixes an error that was introduced in r370, causing
semi-consistent read not to not unlock rows in READ COMMITTED mode.
(Bug #41671, Issue #146)
rb://67 approved by Heikki Tuuri
------------------------------------------------------------------------
------------------------------------------------------------------------
r3623 | vasil | 2009-01-06 09:56:32 +0200 (Tue, 06 Jan 2009) | 7 lines
branches/zip:
Add patch to fix the failing main.variables mysql-test. It started failing
after the variable innodb_use_sys_malloc was added because it matches
'%alloc%' and the test is badly written and expects that no new variables
like that will ever be added.
------------------------------------------------------------------------
r3795 | marko | 2009-01-07 16:17:47 +0200 (Wed, 07 Jan 2009) | 7 lines
branches/zip: row_merge_tuple_cmp(): Do not report a duplicate key value
if any of the fields are NULL. While the tuples are equal in the
sorting order, SQL NULL is defined to be logically inequal to
anything else. (Bug #41904)
rb://70 approved by Heikki Tuuri
------------------------------------------------------------------------
r3796 | marko | 2009-01-07 16:19:32 +0200 (Wed, 07 Jan 2009) | 1 line
branches/zip: Add the tests that were forgotten from r3795.
------------------------------------------------------------------------
r3797 | marko | 2009-01-07 16:22:18 +0200 (Wed, 07 Jan 2009) | 22 lines
branches/zip: Do not call trx_allocate_for_mysql() directly, but use
helper functions that initialize some members of the transaction struct.
(Bug #41680)
innobase_trx_init(): New function: initialize some fields of a
transaction struct from a MySQL THD object.
innobase_trx_allocate(): New function: allocate and initialize a
transaction struct.
check_trx_exists(): Use the above two functions.
ha_innobase::delete_table(), ha_innobase::rename_table(),
ha_innobase::add_index(), ha_innobase::final_drop_index():
Use innobase_trx_allocate().
innobase_drop_database(): In the Windows plugin, initialize the trx_t
specially, because the THD is not available. Otherwise, use
innobase_trx_allocate().
rb://69 accepted by Heikki Tuuri
------------------------------------------------------------------------
r3798 | marko | 2009-01-07 16:42:42 +0200 (Wed, 07 Jan 2009) | 8 lines
branches/zip: row_merge_drop_temp_indexes(): Do not lock the rows of
SYS_INDEXES when looking for partially created indexes. Use the
transaction isolation level READ UNCOMMITTED to avoid interfering with
locks held by incomplete transactions that will be rolled back in a
subsequent step in the recovery. (Issue #152)
Approved by Heikki Tuuri
------------------------------------------------------------------------
r3852 | vasil | 2009-01-08 22:10:10 +0200 (Thu, 08 Jan 2009) | 4 lines
branches/zip:
Add ChangeLog entries for r3795 r3796 r3797 r3798.
------------------------------------------------------------------------
r3866 | marko | 2009-01-09 15:09:51 +0200 (Fri, 09 Jan 2009) | 2 lines
branches/zip: buf_flush_try_page(): Move some common code from each
switch case before the switch block.
------------------------------------------------------------------------
r3867 | marko | 2009-01-09 15:13:14 +0200 (Fri, 09 Jan 2009) | 2 lines
branches/zip: buf_flush_try_page(): Introduce the variable is_compressed
for caching the result of buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE.
------------------------------------------------------------------------
r3868 | marko | 2009-01-09 15:40:11 +0200 (Fri, 09 Jan 2009) | 4 lines
branches/zip: buf_flush_insert_into_flush_list(),
buf_flush_insert_sorted_into_flush_list(): Remove unused code.
Change the parameter to buf_block_t* block and assert that
block->state == BUF_BLOCK_FILE_PAGE. This is part of Issue #155.
------------------------------------------------------------------------
r3873 | marko | 2009-01-09 22:27:40 +0200 (Fri, 09 Jan 2009) | 17 lines
branches/zip: Some non-functional changes related to Issue #155.
buf_page_struct: Note that space and offset are also protected by
buf_pool_mutex. They are only assigned to by
buf_block_set_file_page(). Thus, it suffices for buf_flush_batch() to
hold just buf_pool_mutex when checking these fields.
buf_flush_try_page(): Rename "locked" to "is_s_latched", per Heikki's request.
buf_flush_batch(): Move the common statement mutex_exit(block_mutex)
from all if-else if-else branches before the if block. Remove the
redundant test (buf_pool->init_flush[flush_type] == FALSE) that was
apparently copied from buf_flush_write_complete().
buf_flush_write_block_low(): Note why it is safe not to hold buf_pool_mutex
or block_mutex. Enumerate the assumptions in debug assertions.
------------------------------------------------------------------------
r3874 | marko | 2009-01-09 23:09:06 +0200 (Fri, 09 Jan 2009) | 4 lines
branches/zip: Add comments related to Issue #155.
buf_flush_try_page(): Note why it is safe to access bpage without
holding buf_pool_mutex or block_mutex.
------------------------------------------------------------------------
r3875 | marko | 2009-01-09 23:15:12 +0200 (Fri, 09 Jan 2009) | 11 lines
branches/zip: Non-functional change: Tighten debug assertions and
remove dead code.
buf_flush_ready_for_flush(), buf_flush_try_page(): Assert that
flush_type is one of BUF_FLUSH_LRU or BUF_FLUSH_LIST. The flush_type
comes from buf_flush_batch(), which already asserts this. The
assertion holds for all calls in the source code.
buf_flush_try_page(): Remove the dead case BUF_FLUSH_SINGLE_PAGE
of switch (flush_type).
------------------------------------------------------------------------
r3879 | marko | 2009-01-12 12:46:44 +0200 (Mon, 12 Jan 2009) | 14 lines
branches/zip: Simplify the flushing of dirty pages from the buffer pool.
buf_flush_try_page(): Rename to buf_flush_page(), and change the
return type to void. Replace the parameters space, offset with bpage,
and remove the second page hash lookup. Note and assert that both
buf_pool_mutex and block_mutex must now be held upon entering the
function. They will still be released by this function.
buf_flush_try_neighbors(): Replace buf_flush_try_page() with
buf_flush_page(). Make the logic easier to follow by not negating the
precondition of buf_flush_page().
rb://73 approved by Sunny Bains. This is related to Issue #157.
------------------------------------------------------------------------
r3880 | marko | 2009-01-12 13:24:37 +0200 (Mon, 12 Jan 2009) | 2 lines
branches/zip: buf_flush_page(): Fix a comment that should have been fixed
in r3879. Spotted by Sunny.
------------------------------------------------------------------------
r3881 | marko | 2009-01-12 14:25:22 +0200 (Mon, 12 Jan 2009) | 2 lines
branches/zip: buf_page_get_newest_modification(): Use the block mutex
instead of the buffer pool mutex. This is related to Issue #157.
------------------------------------------------------------------------
r3882 | marko | 2009-01-12 14:40:08 +0200 (Mon, 12 Jan 2009) | 3 lines
branches/zip: struct mtr_struct: Remove the unused field magic_n
unless UNIV_DEBUG is defined. mtr->magic_n is only assigned to
and checked in UNIV_DEBUG builds.
------------------------------------------------------------------------
r3883 | marko | 2009-01-12 14:48:59 +0200 (Mon, 12 Jan 2009) | 1 line
branches/zip: Non-functional change: Use ut_d when assigning to mtr->state.
------------------------------------------------------------------------
r3884 | marko | 2009-01-12 18:56:11 +0200 (Mon, 12 Jan 2009) | 16 lines
branches/zip: Non-functional change: Add some debug assertions and comments.
buf_page_t: Note that the LRU fields are protected by buf_pool_mutex
only, not block->mutex or buf_pool_zip_mutex.
buf_page_get_freed_page_clock(): Note that this is sometimes invoked
without mutex protection.
buf_pool_get_oldest_modification(): Note that the result may be out of
date.
buf_page_get_LRU_position(), buf_page_is_old(): Assert that the buffer
pool mutex is being held.
buf_page_release(): Assert that dirty blocks are in the flush list.
------------------------------------------------------------------------
r3896 | marko | 2009-01-13 09:30:26 +0200 (Tue, 13 Jan 2009) | 2 lines
branches/zip: buf_flush_try_neighbors(): Fix a bug
that was introduced in r3879 (rb://73).
------------------------------------------------------------------------
r3900 | marko | 2009-01-13 10:32:24 +0200 (Tue, 13 Jan 2009) | 1 line
branches/zip: Fix some comments to say buf_pool_mutex.
------------------------------------------------------------------------
r3907 | marko | 2009-01-13 11:54:01 +0200 (Tue, 13 Jan 2009) | 3 lines
branches/zip: row_merge_create_temporary_table(): On error,
row_create_table_for_mysql() already frees new_table.
Do not attempt to free it again.
------------------------------------------------------------------------
r3908 | marko | 2009-01-13 12:34:32 +0200 (Tue, 13 Jan 2009) | 1 line
branches/zip: Enable HASH_ASSERT_OWNED independently of UNIV_SYNC_DEBUG.
------------------------------------------------------------------------
r3914 | marko | 2009-01-13 21:46:22 +0200 (Tue, 13 Jan 2009) | 37 lines
branches/zip: In hash table lookups, assert that the traversed items
satisfy some conditions when UNIV_DEBUG is defined.
HASH_SEARCH(): New parameter: ASSERTION. All users will pass an appropriate
ut_ad() or nothing.
dict_table_add_to_columns(): Assert that the table being added to the data
dictionary cache is not already being pointed to by the name_hash and
id_hash tables.
HASH_SEARCH_ALL(): New macro, for use in dict_table_add_to_columns().
dict_mem_table_free(): Set ut_d(table->cached = FALSE), so that we can
check ut_ad(table->cached) when traversing the hash tables, as in
HASH_SEARCH(name_hash, dict_sys->table_hash, ...) and
HASH_SEARCH(id_hash, dict_sys->table_id_hash, ...).
dict_table_get_low(), dict_table_get_on_id_low(): Assert
ut_ad(!table || table->cached).
fil_space_get_by_id(): Check ut_ad(space->magic_n == FIL_SPACE_MAGIC_N)
in HASH_SEARCH(hash, fil_system->spaces, ...).
fil_space_get_by_name(): Check ut_ad(space->magic_n == FIL_SPACE_MAGIC_N)
in HASH_SEARCH(name_hash, fil_system->name_hash, ...).
buf_buddy_block_free(): Check that the blocks are in valid state in
HASH_SEARCH(hash, buf_pool->zip_hash, ...).
buf_page_hash_get(): Check that the blocks are in valid state in
HASH_SEARCH(hash, buf_pool->page_hash, ...).
get_share(), free_share(): Check ut_ad(share->use_count > 0) in
HASH_SEARCH(table_name_hash, innobase_open_tables, ...).
This was posted as rb://75 for tracking down errors similar to Issue #153.
------------------------------------------------------------------------
r3931 | marko | 2009-01-14 16:06:22 +0200 (Wed, 14 Jan 2009) | 26 lines
branches/zip: Merge revisions 3601:3930 from branches/5.1:
------------------------------------------------------------------------
r3911 | sunny | 2009-01-13 14:15:24 +0200 (Tue, 13 Jan 2009) | 13 lines
branches/5.1: Fix Bug#38187 Error 153 when creating savepoints
InnoDB previously treated savepoints as a stack e.g.,
SAVEPOINT a;
SAVEPOINT b;
SAVEPOINT c;
SAVEPOINT b; <- This would delete b and c.
This fix changes the behavior to:
SAVEPOINT a;
SAVEPOINT b;
SAVEPOINT c;
SAVEPOINT b; <- Does not delete savepoint c
------------------------------------------------------------------------
r3930 | marko | 2009-01-14 15:51:30 +0200 (Wed, 14 Jan 2009) | 4 lines
branches/5.1: dict_load_table(): If dict_load_indexes() fails,
invoke dict_table_remove_from_cache() instead of dict_mem_table_free(),
so that the data dictionary will not point to freed data.
(Bug #42075, Issue #153, rb://76 approved by Heikki Tuuri)
------------------------------------------------------------------------
------------------------------------------------------------------------
2009-01-14 14:25:45 +00:00
|
|
|
/* This is sometimes read without holding buf_pool_mutex. */
|
2006-11-30 12:27:49 +00:00
|
|
|
return(bpage->freed_page_clock);
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
Reads the freed_page_clock of a buffer block. */
|
|
|
|
UNIV_INLINE
|
|
|
|
ulint
|
|
|
|
buf_block_get_freed_page_clock(
|
|
|
|
/*===========================*/
|
|
|
|
/* out: freed_page_clock */
|
|
|
|
const buf_block_t* block) /* in: block */
|
|
|
|
{
|
|
|
|
return(buf_page_get_freed_page_clock(&block->page));
|
|
|
|
}
|
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
/************************************************************************
|
|
|
|
Recommends a move of a block to the start of the LRU list if there is danger
|
|
|
|
of dropping from the buffer pool. NOTE: does not reserve the buffer pool
|
2007-09-11 00:38:13 +00:00
|
|
|
mutex. */
|
2005-10-27 07:29:40 +00:00
|
|
|
UNIV_INLINE
|
|
|
|
ibool
|
2007-08-01 11:18:43 +00:00
|
|
|
buf_page_peek_if_too_old(
|
|
|
|
/*=====================*/
|
2006-11-30 12:27:49 +00:00
|
|
|
/* out: TRUE if should be made
|
|
|
|
younger */
|
2007-08-01 11:18:43 +00:00
|
|
|
const buf_page_t* bpage) /* in: block to make younger */
|
2005-10-27 07:29:40 +00:00
|
|
|
{
|
2007-09-11 00:38:13 +00:00
|
|
|
return(buf_pool->freed_page_clock
|
|
|
|
>= buf_page_get_freed_page_clock(bpage)
|
|
|
|
+ 1 + (buf_pool->curr_size / 4));
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
2006-10-30 13:48:08 +00:00
|
|
|
Gets the current size of buffer buf_pool in bytes. */
|
2005-10-27 07:29:40 +00:00
|
|
|
UNIV_INLINE
|
|
|
|
ulint
|
|
|
|
buf_pool_get_curr_size(void)
|
|
|
|
/*========================*/
|
|
|
|
/* out: size in bytes */
|
|
|
|
{
|
2006-10-30 15:15:19 +00:00
|
|
|
return(buf_pool->curr_size * UNIV_PAGE_SIZE);
|
2006-02-23 19:25:29 +00:00
|
|
|
}
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
Gets the smallest oldest_modification lsn for any page in the pool. Returns
|
2006-11-24 13:05:01 +00:00
|
|
|
zero if all modified pages have been flushed to disk. */
|
2005-10-27 07:29:40 +00:00
|
|
|
UNIV_INLINE
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t
|
2005-10-27 07:29:40 +00:00
|
|
|
buf_pool_get_oldest_modification(void)
|
|
|
|
/*==================================*/
|
|
|
|
/* out: oldest modification in pool,
|
2006-11-24 13:05:01 +00:00
|
|
|
zero if none */
|
2005-10-27 07:29:40 +00:00
|
|
|
{
|
2006-11-27 14:12:09 +00:00
|
|
|
buf_page_t* bpage;
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t lsn;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2008-01-10 09:37:13 +00:00
|
|
|
buf_pool_mutex_enter();
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-11-27 14:12:09 +00:00
|
|
|
bpage = UT_LIST_GET_LAST(buf_pool->flush_list);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-11-27 14:12:09 +00:00
|
|
|
if (bpage == NULL) {
|
2006-11-24 13:05:01 +00:00
|
|
|
lsn = 0;
|
2005-10-27 07:29:40 +00:00
|
|
|
} else {
|
2007-01-09 12:35:42 +00:00
|
|
|
ut_ad(bpage->in_flush_list);
|
2006-11-27 14:12:09 +00:00
|
|
|
lsn = bpage->oldest_modification;
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
2008-01-10 09:37:13 +00:00
|
|
|
buf_pool_mutex_exit();
|
2005-10-27 07:29:40 +00:00
|
|
|
|
branches/innodb+: Merge revisions 3602:3931 from branches/zip:
------------------------------------------------------------------------
r3607 | marko | 2008-12-30 22:33:31 +0200 (Tue, 30 Dec 2008) | 20 lines
branches/zip: Remove the dependency on the MySQL HASH table implementation.
Use the InnoDB hash table for keeping track of INNOBASE_SHARE objects.
struct st_innobase_share: Make table_name const uchar*. Add the member
table_name_hash.
innobase_open_tables: Change the type from HASH to hash_table_t*.
innobase_get_key(): Remove.
innobase_fold_name(): New function, for computing the fold value for the
InnoDB hash table.
get_share(), free_share(): Use the InnoDB hash functions.
innobase_end(): Free innobase_open_tables before shutting down InnoDB.
Shutting down InnoDB will invalidate all memory allocated via InnoDB.
rb://65 approved by Heikki Tuuri. This addresses Issue #104.
------------------------------------------------------------------------
r3608 | marko | 2008-12-30 22:45:04 +0200 (Tue, 30 Dec 2008) | 22 lines
branches/zip: When setting the PAGE_LEVEL of a compressed B-tree page
from or to 0, compress the page at the same time. This is necessary,
because the column information stored on the compressed page will
differ between leaf and non-leaf pages. Leaf pages are identified by
PAGE_LEVEL=0. This bug was reported as Issue #150.
Document the similarity between btr_page_create() and
btr_page_empty(). Make the function signature of btr_page_empty()
identical with btr_page_create(). (This will add the parameter "level".)
btr_root_raise_and_insert(): Replace some code with a call to
btr_page_empty().
btr_attach_half_pages(): Assert that the page level has already been
set on both block and new_block. Do not set it again.
btr_discard_only_page_on_level(): Document that this function is
probably never called. Make it work on any height tree. (Tested on
2-high tree by disabling btr_lift_page_up().)
rb://68
------------------------------------------------------------------------
r3612 | marko | 2009-01-02 11:02:44 +0200 (Fri, 02 Jan 2009) | 14 lines
branches/zip: Merge c2998 from branches/6.0, so that the same InnoDB Plugin
source tree will work both under 5.1 and 6.0. Do not add the test case
innodb_ctype_ldml.test, because it would not work under MySQL 5.1.
Refuse to create tables whose columns contain collation IDs above 255.
This removes an assertion failure that was introduced in WL#4164
(Two-byte collation IDs).
create_table_def(): Do not fail an assertion if a column contains a
charset-collation ID greater than 256. Instead, issue an error and
refuse to create the table.
The original change (branches/6.0 r2998) was rb://51 approved by Calvin Sun.
------------------------------------------------------------------------
r3613 | inaam | 2009-01-02 15:10:50 +0200 (Fri, 02 Jan 2009) | 6 lines
branches/zip: Implement the parameter innodb_use_sys_malloc
(false by default), for disabling InnoDB's internal memory allocator
and using system malloc/free instead.
rb://62 approved by Marko
------------------------------------------------------------------------
r3614 | marko | 2009-01-02 15:55:12 +0200 (Fri, 02 Jan 2009) | 1 line
branches/zip: ChangeLog: Document r3608 and r3613.
------------------------------------------------------------------------
r3615 | marko | 2009-01-02 15:57:51 +0200 (Fri, 02 Jan 2009) | 1 line
branches/zip: ChangeLog: Clarify the impact of r3608.
------------------------------------------------------------------------
r3616 | marko | 2009-01-03 00:23:30 +0200 (Sat, 03 Jan 2009) | 1 line
branches/zip: srv_suspend_mysql_thread(): Add some clarifying comments.
------------------------------------------------------------------------
r3618 | marko | 2009-01-05 12:54:53 +0200 (Mon, 05 Jan 2009) | 15 lines
branches/zip: Merge revisions 3598:3601 from branches/5.1:
------------------------------------------------------------------------
r3601 | marko | 2008-12-22 16:05:19 +0200 (Mon, 22 Dec 2008) | 9 lines
branches/5.1: Make
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED
a true replacement of SET GLOBAL INNODB_LOCKS_UNSAFE_FOR_BINLOG=1.
This fixes an error that was introduced in r370, causing
semi-consistent read not to not unlock rows in READ COMMITTED mode.
(Bug #41671, Issue #146)
rb://67 approved by Heikki Tuuri
------------------------------------------------------------------------
------------------------------------------------------------------------
r3623 | vasil | 2009-01-06 09:56:32 +0200 (Tue, 06 Jan 2009) | 7 lines
branches/zip:
Add patch to fix the failing main.variables mysql-test. It started failing
after the variable innodb_use_sys_malloc was added because it matches
'%alloc%' and the test is badly written and expects that no new variables
like that will ever be added.
------------------------------------------------------------------------
r3795 | marko | 2009-01-07 16:17:47 +0200 (Wed, 07 Jan 2009) | 7 lines
branches/zip: row_merge_tuple_cmp(): Do not report a duplicate key value
if any of the fields are NULL. While the tuples are equal in the
sorting order, SQL NULL is defined to be logically inequal to
anything else. (Bug #41904)
rb://70 approved by Heikki Tuuri
------------------------------------------------------------------------
r3796 | marko | 2009-01-07 16:19:32 +0200 (Wed, 07 Jan 2009) | 1 line
branches/zip: Add the tests that were forgotten from r3795.
------------------------------------------------------------------------
r3797 | marko | 2009-01-07 16:22:18 +0200 (Wed, 07 Jan 2009) | 22 lines
branches/zip: Do not call trx_allocate_for_mysql() directly, but use
helper functions that initialize some members of the transaction struct.
(Bug #41680)
innobase_trx_init(): New function: initialize some fields of a
transaction struct from a MySQL THD object.
innobase_trx_allocate(): New function: allocate and initialize a
transaction struct.
check_trx_exists(): Use the above two functions.
ha_innobase::delete_table(), ha_innobase::rename_table(),
ha_innobase::add_index(), ha_innobase::final_drop_index():
Use innobase_trx_allocate().
innobase_drop_database(): In the Windows plugin, initialize the trx_t
specially, because the THD is not available. Otherwise, use
innobase_trx_allocate().
rb://69 accepted by Heikki Tuuri
------------------------------------------------------------------------
r3798 | marko | 2009-01-07 16:42:42 +0200 (Wed, 07 Jan 2009) | 8 lines
branches/zip: row_merge_drop_temp_indexes(): Do not lock the rows of
SYS_INDEXES when looking for partially created indexes. Use the
transaction isolation level READ UNCOMMITTED to avoid interfering with
locks held by incomplete transactions that will be rolled back in a
subsequent step in the recovery. (Issue #152)
Approved by Heikki Tuuri
------------------------------------------------------------------------
r3852 | vasil | 2009-01-08 22:10:10 +0200 (Thu, 08 Jan 2009) | 4 lines
branches/zip:
Add ChangeLog entries for r3795 r3796 r3797 r3798.
------------------------------------------------------------------------
r3866 | marko | 2009-01-09 15:09:51 +0200 (Fri, 09 Jan 2009) | 2 lines
branches/zip: buf_flush_try_page(): Move some common code from each
switch case before the switch block.
------------------------------------------------------------------------
r3867 | marko | 2009-01-09 15:13:14 +0200 (Fri, 09 Jan 2009) | 2 lines
branches/zip: buf_flush_try_page(): Introduce the variable is_compressed
for caching the result of buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE.
------------------------------------------------------------------------
r3868 | marko | 2009-01-09 15:40:11 +0200 (Fri, 09 Jan 2009) | 4 lines
branches/zip: buf_flush_insert_into_flush_list(),
buf_flush_insert_sorted_into_flush_list(): Remove unused code.
Change the parameter to buf_block_t* block and assert that
block->state == BUF_BLOCK_FILE_PAGE. This is part of Issue #155.
------------------------------------------------------------------------
r3873 | marko | 2009-01-09 22:27:40 +0200 (Fri, 09 Jan 2009) | 17 lines
branches/zip: Some non-functional changes related to Issue #155.
buf_page_struct: Note that space and offset are also protected by
buf_pool_mutex. They are only assigned to by
buf_block_set_file_page(). Thus, it suffices for buf_flush_batch() to
hold just buf_pool_mutex when checking these fields.
buf_flush_try_page(): Rename "locked" to "is_s_latched", per Heikki's request.
buf_flush_batch(): Move the common statement mutex_exit(block_mutex)
from all if-else if-else branches before the if block. Remove the
redundant test (buf_pool->init_flush[flush_type] == FALSE) that was
apparently copied from buf_flush_write_complete().
buf_flush_write_block_low(): Note why it is safe not to hold buf_pool_mutex
or block_mutex. Enumerate the assumptions in debug assertions.
------------------------------------------------------------------------
r3874 | marko | 2009-01-09 23:09:06 +0200 (Fri, 09 Jan 2009) | 4 lines
branches/zip: Add comments related to Issue #155.
buf_flush_try_page(): Note why it is safe to access bpage without
holding buf_pool_mutex or block_mutex.
------------------------------------------------------------------------
r3875 | marko | 2009-01-09 23:15:12 +0200 (Fri, 09 Jan 2009) | 11 lines
branches/zip: Non-functional change: Tighten debug assertions and
remove dead code.
buf_flush_ready_for_flush(), buf_flush_try_page(): Assert that
flush_type is one of BUF_FLUSH_LRU or BUF_FLUSH_LIST. The flush_type
comes from buf_flush_batch(), which already asserts this. The
assertion holds for all calls in the source code.
buf_flush_try_page(): Remove the dead case BUF_FLUSH_SINGLE_PAGE
of switch (flush_type).
------------------------------------------------------------------------
r3879 | marko | 2009-01-12 12:46:44 +0200 (Mon, 12 Jan 2009) | 14 lines
branches/zip: Simplify the flushing of dirty pages from the buffer pool.
buf_flush_try_page(): Rename to buf_flush_page(), and change the
return type to void. Replace the parameters space, offset with bpage,
and remove the second page hash lookup. Note and assert that both
buf_pool_mutex and block_mutex must now be held upon entering the
function. They will still be released by this function.
buf_flush_try_neighbors(): Replace buf_flush_try_page() with
buf_flush_page(). Make the logic easier to follow by not negating the
precondition of buf_flush_page().
rb://73 approved by Sunny Bains. This is related to Issue #157.
------------------------------------------------------------------------
r3880 | marko | 2009-01-12 13:24:37 +0200 (Mon, 12 Jan 2009) | 2 lines
branches/zip: buf_flush_page(): Fix a comment that should have been fixed
in r3879. Spotted by Sunny.
------------------------------------------------------------------------
r3881 | marko | 2009-01-12 14:25:22 +0200 (Mon, 12 Jan 2009) | 2 lines
branches/zip: buf_page_get_newest_modification(): Use the block mutex
instead of the buffer pool mutex. This is related to Issue #157.
------------------------------------------------------------------------
r3882 | marko | 2009-01-12 14:40:08 +0200 (Mon, 12 Jan 2009) | 3 lines
branches/zip: struct mtr_struct: Remove the unused field magic_n
unless UNIV_DEBUG is defined. mtr->magic_n is only assigned to
and checked in UNIV_DEBUG builds.
------------------------------------------------------------------------
r3883 | marko | 2009-01-12 14:48:59 +0200 (Mon, 12 Jan 2009) | 1 line
branches/zip: Non-functional change: Use ut_d when assigning to mtr->state.
------------------------------------------------------------------------
r3884 | marko | 2009-01-12 18:56:11 +0200 (Mon, 12 Jan 2009) | 16 lines
branches/zip: Non-functional change: Add some debug assertions and comments.
buf_page_t: Note that the LRU fields are protected by buf_pool_mutex
only, not block->mutex or buf_pool_zip_mutex.
buf_page_get_freed_page_clock(): Note that this is sometimes invoked
without mutex protection.
buf_pool_get_oldest_modification(): Note that the result may be out of
date.
buf_page_get_LRU_position(), buf_page_is_old(): Assert that the buffer
pool mutex is being held.
buf_page_release(): Assert that dirty blocks are in the flush list.
------------------------------------------------------------------------
r3896 | marko | 2009-01-13 09:30:26 +0200 (Tue, 13 Jan 2009) | 2 lines
branches/zip: buf_flush_try_neighbors(): Fix a bug
that was introduced in r3879 (rb://73).
------------------------------------------------------------------------
r3900 | marko | 2009-01-13 10:32:24 +0200 (Tue, 13 Jan 2009) | 1 line
branches/zip: Fix some comments to say buf_pool_mutex.
------------------------------------------------------------------------
r3907 | marko | 2009-01-13 11:54:01 +0200 (Tue, 13 Jan 2009) | 3 lines
branches/zip: row_merge_create_temporary_table(): On error,
row_create_table_for_mysql() already frees new_table.
Do not attempt to free it again.
------------------------------------------------------------------------
r3908 | marko | 2009-01-13 12:34:32 +0200 (Tue, 13 Jan 2009) | 1 line
branches/zip: Enable HASH_ASSERT_OWNED independently of UNIV_SYNC_DEBUG.
------------------------------------------------------------------------
r3914 | marko | 2009-01-13 21:46:22 +0200 (Tue, 13 Jan 2009) | 37 lines
branches/zip: In hash table lookups, assert that the traversed items
satisfy some conditions when UNIV_DEBUG is defined.
HASH_SEARCH(): New parameter: ASSERTION. All users will pass an appropriate
ut_ad() or nothing.
dict_table_add_to_columns(): Assert that the table being added to the data
dictionary cache is not already being pointed to by the name_hash and
id_hash tables.
HASH_SEARCH_ALL(): New macro, for use in dict_table_add_to_columns().
dict_mem_table_free(): Set ut_d(table->cached = FALSE), so that we can
check ut_ad(table->cached) when traversing the hash tables, as in
HASH_SEARCH(name_hash, dict_sys->table_hash, ...) and
HASH_SEARCH(id_hash, dict_sys->table_id_hash, ...).
dict_table_get_low(), dict_table_get_on_id_low(): Assert
ut_ad(!table || table->cached).
fil_space_get_by_id(): Check ut_ad(space->magic_n == FIL_SPACE_MAGIC_N)
in HASH_SEARCH(hash, fil_system->spaces, ...).
fil_space_get_by_name(): Check ut_ad(space->magic_n == FIL_SPACE_MAGIC_N)
in HASH_SEARCH(name_hash, fil_system->name_hash, ...).
buf_buddy_block_free(): Check that the blocks are in valid state in
HASH_SEARCH(hash, buf_pool->zip_hash, ...).
buf_page_hash_get(): Check that the blocks are in valid state in
HASH_SEARCH(hash, buf_pool->page_hash, ...).
get_share(), free_share(): Check ut_ad(share->use_count > 0) in
HASH_SEARCH(table_name_hash, innobase_open_tables, ...).
This was posted as rb://75 for tracking down errors similar to Issue #153.
------------------------------------------------------------------------
r3931 | marko | 2009-01-14 16:06:22 +0200 (Wed, 14 Jan 2009) | 26 lines
branches/zip: Merge revisions 3601:3930 from branches/5.1:
------------------------------------------------------------------------
r3911 | sunny | 2009-01-13 14:15:24 +0200 (Tue, 13 Jan 2009) | 13 lines
branches/5.1: Fix Bug#38187 Error 153 when creating savepoints
InnoDB previously treated savepoints as a stack e.g.,
SAVEPOINT a;
SAVEPOINT b;
SAVEPOINT c;
SAVEPOINT b; <- This would delete b and c.
This fix changes the behavior to:
SAVEPOINT a;
SAVEPOINT b;
SAVEPOINT c;
SAVEPOINT b; <- Does not delete savepoint c
------------------------------------------------------------------------
r3930 | marko | 2009-01-14 15:51:30 +0200 (Wed, 14 Jan 2009) | 4 lines
branches/5.1: dict_load_table(): If dict_load_indexes() fails,
invoke dict_table_remove_from_cache() instead of dict_mem_table_free(),
so that the data dictionary will not point to freed data.
(Bug #42075, Issue #153, rb://76 approved by Heikki Tuuri)
------------------------------------------------------------------------
------------------------------------------------------------------------
2009-01-14 14:25:45 +00:00
|
|
|
/* The returned answer may be out of date: the flush_list can
|
|
|
|
change after the mutex has been released. */
|
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
return(lsn);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
Increments the buf_pool clock by one and returns its new value. Remember
|
|
|
|
that in the 32 bit version the clock wraps around at 4 billion! */
|
|
|
|
UNIV_INLINE
|
|
|
|
ulint
|
|
|
|
buf_pool_clock_tic(void)
|
|
|
|
/*====================*/
|
|
|
|
/* out: new clock value */
|
|
|
|
{
|
2008-01-10 09:37:13 +00:00
|
|
|
ut_ad(buf_pool_mutex_own());
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
buf_pool->ulint_clock++;
|
|
|
|
|
|
|
|
return(buf_pool->ulint_clock);
|
|
|
|
}
|
|
|
|
|
2006-11-23 13:26:01 +00:00
|
|
|
/*************************************************************************
|
|
|
|
Gets the state of a block. */
|
|
|
|
UNIV_INLINE
|
2006-11-24 08:32:18 +00:00
|
|
|
enum buf_page_state
|
2006-11-27 14:12:09 +00:00
|
|
|
buf_page_get_state(
|
|
|
|
/*===============*/
|
2006-11-23 13:26:01 +00:00
|
|
|
/* out: state */
|
2006-11-27 14:12:09 +00:00
|
|
|
const buf_page_t* bpage) /* in: pointer to the control block */
|
2006-11-23 13:26:01 +00:00
|
|
|
{
|
2007-08-01 10:38:07 +00:00
|
|
|
enum buf_page_state state = (enum buf_page_state) bpage->state;
|
2006-11-23 13:26:01 +00:00
|
|
|
|
|
|
|
#ifdef UNIV_DEBUG
|
|
|
|
switch (state) {
|
2006-12-05 12:10:30 +00:00
|
|
|
case BUF_BLOCK_ZIP_FREE:
|
2006-11-24 08:32:18 +00:00
|
|
|
case BUF_BLOCK_ZIP_PAGE:
|
2006-12-05 12:10:30 +00:00
|
|
|
case BUF_BLOCK_ZIP_DIRTY:
|
2006-11-23 13:26:01 +00:00
|
|
|
case BUF_BLOCK_NOT_USED:
|
|
|
|
case BUF_BLOCK_READY_FOR_USE:
|
|
|
|
case BUF_BLOCK_FILE_PAGE:
|
|
|
|
case BUF_BLOCK_MEMORY:
|
|
|
|
case BUF_BLOCK_REMOVE_HASH:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ut_error;
|
|
|
|
}
|
|
|
|
#endif /* UNIV_DEBUG */
|
|
|
|
|
|
|
|
return(state);
|
|
|
|
}
|
2006-11-23 14:12:58 +00:00
|
|
|
/*************************************************************************
|
2006-11-27 14:12:09 +00:00
|
|
|
Gets the state of a block. */
|
|
|
|
UNIV_INLINE
|
|
|
|
enum buf_page_state
|
|
|
|
buf_block_get_state(
|
|
|
|
/*================*/
|
|
|
|
/* out: state */
|
|
|
|
const buf_block_t* block) /* in: pointer to the control block */
|
|
|
|
{
|
|
|
|
return(buf_page_get_state(&block->page));
|
|
|
|
}
|
|
|
|
/*************************************************************************
|
2006-11-23 14:12:58 +00:00
|
|
|
Sets the state of a block. */
|
|
|
|
UNIV_INLINE
|
|
|
|
void
|
2006-11-30 12:27:49 +00:00
|
|
|
buf_page_set_state(
|
|
|
|
/*===============*/
|
|
|
|
buf_page_t* bpage, /* in/out: pointer to control block */
|
2006-11-24 08:32:18 +00:00
|
|
|
enum buf_page_state state) /* in: state */
|
2006-11-23 14:12:58 +00:00
|
|
|
{
|
|
|
|
#ifdef UNIV_DEBUG
|
2006-11-30 12:27:49 +00:00
|
|
|
enum buf_page_state old_state = buf_page_get_state(bpage);
|
2006-11-23 14:12:58 +00:00
|
|
|
|
|
|
|
switch (old_state) {
|
2006-12-05 12:10:30 +00:00
|
|
|
case BUF_BLOCK_ZIP_FREE:
|
2006-12-15 14:47:04 +00:00
|
|
|
ut_error;
|
|
|
|
break;
|
2006-11-24 08:32:18 +00:00
|
|
|
case BUF_BLOCK_ZIP_PAGE:
|
2006-12-15 14:47:04 +00:00
|
|
|
ut_a(state == BUF_BLOCK_ZIP_DIRTY);
|
|
|
|
break;
|
2006-12-05 12:10:30 +00:00
|
|
|
case BUF_BLOCK_ZIP_DIRTY:
|
2006-12-15 14:47:04 +00:00
|
|
|
ut_a(state == BUF_BLOCK_ZIP_PAGE);
|
2006-11-24 08:32:18 +00:00
|
|
|
break;
|
2006-11-23 14:12:58 +00:00
|
|
|
case BUF_BLOCK_NOT_USED:
|
|
|
|
ut_a(state == BUF_BLOCK_READY_FOR_USE);
|
|
|
|
break;
|
|
|
|
case BUF_BLOCK_READY_FOR_USE:
|
|
|
|
ut_a(state == BUF_BLOCK_MEMORY
|
2006-11-23 15:12:53 +00:00
|
|
|
|| state == BUF_BLOCK_FILE_PAGE
|
|
|
|
|| state == BUF_BLOCK_NOT_USED);
|
2006-11-23 14:12:58 +00:00
|
|
|
break;
|
|
|
|
case BUF_BLOCK_MEMORY:
|
|
|
|
ut_a(state == BUF_BLOCK_NOT_USED);
|
|
|
|
break;
|
|
|
|
case BUF_BLOCK_FILE_PAGE:
|
|
|
|
ut_a(state == BUF_BLOCK_NOT_USED
|
2006-11-23 15:12:53 +00:00
|
|
|
|| state == BUF_BLOCK_REMOVE_HASH);
|
2006-11-23 14:12:58 +00:00
|
|
|
break;
|
|
|
|
case BUF_BLOCK_REMOVE_HASH:
|
|
|
|
ut_a(state == BUF_BLOCK_MEMORY);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif /* UNIV_DEBUG */
|
2006-11-30 12:27:49 +00:00
|
|
|
bpage->state = state;
|
|
|
|
ut_ad(buf_page_get_state(bpage) == state);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
Sets the state of a block. */
|
|
|
|
UNIV_INLINE
|
|
|
|
void
|
|
|
|
buf_block_set_state(
|
|
|
|
/*================*/
|
|
|
|
buf_block_t* block, /* in/out: pointer to control block */
|
|
|
|
enum buf_page_state state) /* in: state */
|
|
|
|
{
|
|
|
|
buf_page_set_state(&block->page, state);
|
2006-11-23 14:12:58 +00:00
|
|
|
}
|
2006-11-27 14:12:09 +00:00
|
|
|
|
2006-11-29 13:23:28 +00:00
|
|
|
/*************************************************************************
|
|
|
|
Determines if a block is mapped to a tablespace. */
|
|
|
|
UNIV_INLINE
|
|
|
|
ibool
|
|
|
|
buf_page_in_file(
|
|
|
|
/*=============*/
|
|
|
|
/* out: TRUE if mapped */
|
|
|
|
const buf_page_t* bpage) /* in: pointer to control block */
|
|
|
|
{
|
|
|
|
switch (buf_page_get_state(bpage)) {
|
2006-12-05 12:10:30 +00:00
|
|
|
case BUF_BLOCK_ZIP_FREE:
|
|
|
|
/* This is a free page in buf_pool->zip_free[].
|
|
|
|
Such pages should only be accessed by the buddy allocator. */
|
|
|
|
ut_error;
|
|
|
|
break;
|
2006-11-29 13:23:28 +00:00
|
|
|
case BUF_BLOCK_ZIP_PAGE:
|
2006-12-05 12:10:30 +00:00
|
|
|
case BUF_BLOCK_ZIP_DIRTY:
|
2006-11-29 13:23:28 +00:00
|
|
|
case BUF_BLOCK_FILE_PAGE:
|
|
|
|
return(TRUE);
|
|
|
|
case BUF_BLOCK_NOT_USED:
|
|
|
|
case BUF_BLOCK_READY_FOR_USE:
|
|
|
|
case BUF_BLOCK_MEMORY:
|
|
|
|
case BUF_BLOCK_REMOVE_HASH:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return(FALSE);
|
|
|
|
}
|
|
|
|
|
2008-03-03 12:57:07 +00:00
|
|
|
/*************************************************************************
|
|
|
|
Determines if a block should be on unzip_LRU list. */
|
|
|
|
UNIV_INLINE
|
|
|
|
ibool
|
|
|
|
buf_page_belongs_to_unzip_LRU(
|
|
|
|
/*==========================*/
|
|
|
|
/* out: TRUE if block belongs
|
|
|
|
to unzip_LRU */
|
|
|
|
const buf_page_t* bpage) /* in: pointer to control block */
|
|
|
|
{
|
|
|
|
ut_ad(buf_page_in_file(bpage));
|
|
|
|
|
|
|
|
return(bpage->zip.data
|
|
|
|
&& buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE);
|
|
|
|
}
|
|
|
|
|
2006-11-30 12:27:49 +00:00
|
|
|
/*************************************************************************
|
|
|
|
Determine the approximate LRU list position of a block. */
|
|
|
|
UNIV_INLINE
|
|
|
|
ulint
|
|
|
|
buf_page_get_LRU_position(
|
|
|
|
/*======================*/
|
|
|
|
/* out: LRU list position */
|
|
|
|
const buf_page_t* bpage) /* in: control block */
|
|
|
|
{
|
|
|
|
ut_ad(buf_page_in_file(bpage));
|
branches/innodb+: Merge revisions 3602:3931 from branches/zip:
------------------------------------------------------------------------
r3607 | marko | 2008-12-30 22:33:31 +0200 (Tue, 30 Dec 2008) | 20 lines
branches/zip: Remove the dependency on the MySQL HASH table implementation.
Use the InnoDB hash table for keeping track of INNOBASE_SHARE objects.
struct st_innobase_share: Make table_name const uchar*. Add the member
table_name_hash.
innobase_open_tables: Change the type from HASH to hash_table_t*.
innobase_get_key(): Remove.
innobase_fold_name(): New function, for computing the fold value for the
InnoDB hash table.
get_share(), free_share(): Use the InnoDB hash functions.
innobase_end(): Free innobase_open_tables before shutting down InnoDB.
Shutting down InnoDB will invalidate all memory allocated via InnoDB.
rb://65 approved by Heikki Tuuri. This addresses Issue #104.
------------------------------------------------------------------------
r3608 | marko | 2008-12-30 22:45:04 +0200 (Tue, 30 Dec 2008) | 22 lines
branches/zip: When setting the PAGE_LEVEL of a compressed B-tree page
from or to 0, compress the page at the same time. This is necessary,
because the column information stored on the compressed page will
differ between leaf and non-leaf pages. Leaf pages are identified by
PAGE_LEVEL=0. This bug was reported as Issue #150.
Document the similarity between btr_page_create() and
btr_page_empty(). Make the function signature of btr_page_empty()
identical with btr_page_create(). (This will add the parameter "level".)
btr_root_raise_and_insert(): Replace some code with a call to
btr_page_empty().
btr_attach_half_pages(): Assert that the page level has already been
set on both block and new_block. Do not set it again.
btr_discard_only_page_on_level(): Document that this function is
probably never called. Make it work on any height tree. (Tested on
2-high tree by disabling btr_lift_page_up().)
rb://68
------------------------------------------------------------------------
r3612 | marko | 2009-01-02 11:02:44 +0200 (Fri, 02 Jan 2009) | 14 lines
branches/zip: Merge c2998 from branches/6.0, so that the same InnoDB Plugin
source tree will work both under 5.1 and 6.0. Do not add the test case
innodb_ctype_ldml.test, because it would not work under MySQL 5.1.
Refuse to create tables whose columns contain collation IDs above 255.
This removes an assertion failure that was introduced in WL#4164
(Two-byte collation IDs).
create_table_def(): Do not fail an assertion if a column contains a
charset-collation ID greater than 256. Instead, issue an error and
refuse to create the table.
The original change (branches/6.0 r2998) was rb://51 approved by Calvin Sun.
------------------------------------------------------------------------
r3613 | inaam | 2009-01-02 15:10:50 +0200 (Fri, 02 Jan 2009) | 6 lines
branches/zip: Implement the parameter innodb_use_sys_malloc
(false by default), for disabling InnoDB's internal memory allocator
and using system malloc/free instead.
rb://62 approved by Marko
------------------------------------------------------------------------
r3614 | marko | 2009-01-02 15:55:12 +0200 (Fri, 02 Jan 2009) | 1 line
branches/zip: ChangeLog: Document r3608 and r3613.
------------------------------------------------------------------------
r3615 | marko | 2009-01-02 15:57:51 +0200 (Fri, 02 Jan 2009) | 1 line
branches/zip: ChangeLog: Clarify the impact of r3608.
------------------------------------------------------------------------
r3616 | marko | 2009-01-03 00:23:30 +0200 (Sat, 03 Jan 2009) | 1 line
branches/zip: srv_suspend_mysql_thread(): Add some clarifying comments.
------------------------------------------------------------------------
r3618 | marko | 2009-01-05 12:54:53 +0200 (Mon, 05 Jan 2009) | 15 lines
branches/zip: Merge revisions 3598:3601 from branches/5.1:
------------------------------------------------------------------------
r3601 | marko | 2008-12-22 16:05:19 +0200 (Mon, 22 Dec 2008) | 9 lines
branches/5.1: Make
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED
a true replacement of SET GLOBAL INNODB_LOCKS_UNSAFE_FOR_BINLOG=1.
This fixes an error that was introduced in r370, causing
semi-consistent read not to not unlock rows in READ COMMITTED mode.
(Bug #41671, Issue #146)
rb://67 approved by Heikki Tuuri
------------------------------------------------------------------------
------------------------------------------------------------------------
r3623 | vasil | 2009-01-06 09:56:32 +0200 (Tue, 06 Jan 2009) | 7 lines
branches/zip:
Add patch to fix the failing main.variables mysql-test. It started failing
after the variable innodb_use_sys_malloc was added because it matches
'%alloc%' and the test is badly written and expects that no new variables
like that will ever be added.
------------------------------------------------------------------------
r3795 | marko | 2009-01-07 16:17:47 +0200 (Wed, 07 Jan 2009) | 7 lines
branches/zip: row_merge_tuple_cmp(): Do not report a duplicate key value
if any of the fields are NULL. While the tuples are equal in the
sorting order, SQL NULL is defined to be logically inequal to
anything else. (Bug #41904)
rb://70 approved by Heikki Tuuri
------------------------------------------------------------------------
r3796 | marko | 2009-01-07 16:19:32 +0200 (Wed, 07 Jan 2009) | 1 line
branches/zip: Add the tests that were forgotten from r3795.
------------------------------------------------------------------------
r3797 | marko | 2009-01-07 16:22:18 +0200 (Wed, 07 Jan 2009) | 22 lines
branches/zip: Do not call trx_allocate_for_mysql() directly, but use
helper functions that initialize some members of the transaction struct.
(Bug #41680)
innobase_trx_init(): New function: initialize some fields of a
transaction struct from a MySQL THD object.
innobase_trx_allocate(): New function: allocate and initialize a
transaction struct.
check_trx_exists(): Use the above two functions.
ha_innobase::delete_table(), ha_innobase::rename_table(),
ha_innobase::add_index(), ha_innobase::final_drop_index():
Use innobase_trx_allocate().
innobase_drop_database(): In the Windows plugin, initialize the trx_t
specially, because the THD is not available. Otherwise, use
innobase_trx_allocate().
rb://69 accepted by Heikki Tuuri
------------------------------------------------------------------------
r3798 | marko | 2009-01-07 16:42:42 +0200 (Wed, 07 Jan 2009) | 8 lines
branches/zip: row_merge_drop_temp_indexes(): Do not lock the rows of
SYS_INDEXES when looking for partially created indexes. Use the
transaction isolation level READ UNCOMMITTED to avoid interfering with
locks held by incomplete transactions that will be rolled back in a
subsequent step in the recovery. (Issue #152)
Approved by Heikki Tuuri
------------------------------------------------------------------------
r3852 | vasil | 2009-01-08 22:10:10 +0200 (Thu, 08 Jan 2009) | 4 lines
branches/zip:
Add ChangeLog entries for r3795 r3796 r3797 r3798.
------------------------------------------------------------------------
r3866 | marko | 2009-01-09 15:09:51 +0200 (Fri, 09 Jan 2009) | 2 lines
branches/zip: buf_flush_try_page(): Move some common code from each
switch case before the switch block.
------------------------------------------------------------------------
r3867 | marko | 2009-01-09 15:13:14 +0200 (Fri, 09 Jan 2009) | 2 lines
branches/zip: buf_flush_try_page(): Introduce the variable is_compressed
for caching the result of buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE.
------------------------------------------------------------------------
r3868 | marko | 2009-01-09 15:40:11 +0200 (Fri, 09 Jan 2009) | 4 lines
branches/zip: buf_flush_insert_into_flush_list(),
buf_flush_insert_sorted_into_flush_list(): Remove unused code.
Change the parameter to buf_block_t* block and assert that
block->state == BUF_BLOCK_FILE_PAGE. This is part of Issue #155.
------------------------------------------------------------------------
r3873 | marko | 2009-01-09 22:27:40 +0200 (Fri, 09 Jan 2009) | 17 lines
branches/zip: Some non-functional changes related to Issue #155.
buf_page_struct: Note that space and offset are also protected by
buf_pool_mutex. They are only assigned to by
buf_block_set_file_page(). Thus, it suffices for buf_flush_batch() to
hold just buf_pool_mutex when checking these fields.
buf_flush_try_page(): Rename "locked" to "is_s_latched", per Heikki's request.
buf_flush_batch(): Move the common statement mutex_exit(block_mutex)
from all if-else if-else branches before the if block. Remove the
redundant test (buf_pool->init_flush[flush_type] == FALSE) that was
apparently copied from buf_flush_write_complete().
buf_flush_write_block_low(): Note why it is safe not to hold buf_pool_mutex
or block_mutex. Enumerate the assumptions in debug assertions.
------------------------------------------------------------------------
r3874 | marko | 2009-01-09 23:09:06 +0200 (Fri, 09 Jan 2009) | 4 lines
branches/zip: Add comments related to Issue #155.
buf_flush_try_page(): Note why it is safe to access bpage without
holding buf_pool_mutex or block_mutex.
------------------------------------------------------------------------
r3875 | marko | 2009-01-09 23:15:12 +0200 (Fri, 09 Jan 2009) | 11 lines
branches/zip: Non-functional change: Tighten debug assertions and
remove dead code.
buf_flush_ready_for_flush(), buf_flush_try_page(): Assert that
flush_type is one of BUF_FLUSH_LRU or BUF_FLUSH_LIST. The flush_type
comes from buf_flush_batch(), which already asserts this. The
assertion holds for all calls in the source code.
buf_flush_try_page(): Remove the dead case BUF_FLUSH_SINGLE_PAGE
of switch (flush_type).
------------------------------------------------------------------------
r3879 | marko | 2009-01-12 12:46:44 +0200 (Mon, 12 Jan 2009) | 14 lines
branches/zip: Simplify the flushing of dirty pages from the buffer pool.
buf_flush_try_page(): Rename to buf_flush_page(), and change the
return type to void. Replace the parameters space, offset with bpage,
and remove the second page hash lookup. Note and assert that both
buf_pool_mutex and block_mutex must now be held upon entering the
function. They will still be released by this function.
buf_flush_try_neighbors(): Replace buf_flush_try_page() with
buf_flush_page(). Make the logic easier to follow by not negating the
precondition of buf_flush_page().
rb://73 approved by Sunny Bains. This is related to Issue #157.
------------------------------------------------------------------------
r3880 | marko | 2009-01-12 13:24:37 +0200 (Mon, 12 Jan 2009) | 2 lines
branches/zip: buf_flush_page(): Fix a comment that should have been fixed
in r3879. Spotted by Sunny.
------------------------------------------------------------------------
r3881 | marko | 2009-01-12 14:25:22 +0200 (Mon, 12 Jan 2009) | 2 lines
branches/zip: buf_page_get_newest_modification(): Use the block mutex
instead of the buffer pool mutex. This is related to Issue #157.
------------------------------------------------------------------------
r3882 | marko | 2009-01-12 14:40:08 +0200 (Mon, 12 Jan 2009) | 3 lines
branches/zip: struct mtr_struct: Remove the unused field magic_n
unless UNIV_DEBUG is defined. mtr->magic_n is only assigned to
and checked in UNIV_DEBUG builds.
------------------------------------------------------------------------
r3883 | marko | 2009-01-12 14:48:59 +0200 (Mon, 12 Jan 2009) | 1 line
branches/zip: Non-functional change: Use ut_d when assigning to mtr->state.
------------------------------------------------------------------------
r3884 | marko | 2009-01-12 18:56:11 +0200 (Mon, 12 Jan 2009) | 16 lines
branches/zip: Non-functional change: Add some debug assertions and comments.
buf_page_t: Note that the LRU fields are protected by buf_pool_mutex
only, not block->mutex or buf_pool_zip_mutex.
buf_page_get_freed_page_clock(): Note that this is sometimes invoked
without mutex protection.
buf_pool_get_oldest_modification(): Note that the result may be out of
date.
buf_page_get_LRU_position(), buf_page_is_old(): Assert that the buffer
pool mutex is being held.
buf_page_release(): Assert that dirty blocks are in the flush list.
------------------------------------------------------------------------
r3896 | marko | 2009-01-13 09:30:26 +0200 (Tue, 13 Jan 2009) | 2 lines
branches/zip: buf_flush_try_neighbors(): Fix a bug
that was introduced in r3879 (rb://73).
------------------------------------------------------------------------
r3900 | marko | 2009-01-13 10:32:24 +0200 (Tue, 13 Jan 2009) | 1 line
branches/zip: Fix some comments to say buf_pool_mutex.
------------------------------------------------------------------------
r3907 | marko | 2009-01-13 11:54:01 +0200 (Tue, 13 Jan 2009) | 3 lines
branches/zip: row_merge_create_temporary_table(): On error,
row_create_table_for_mysql() already frees new_table.
Do not attempt to free it again.
------------------------------------------------------------------------
r3908 | marko | 2009-01-13 12:34:32 +0200 (Tue, 13 Jan 2009) | 1 line
branches/zip: Enable HASH_ASSERT_OWNED independently of UNIV_SYNC_DEBUG.
------------------------------------------------------------------------
r3914 | marko | 2009-01-13 21:46:22 +0200 (Tue, 13 Jan 2009) | 37 lines
branches/zip: In hash table lookups, assert that the traversed items
satisfy some conditions when UNIV_DEBUG is defined.
HASH_SEARCH(): New parameter: ASSERTION. All users will pass an appropriate
ut_ad() or nothing.
dict_table_add_to_columns(): Assert that the table being added to the data
dictionary cache is not already being pointed to by the name_hash and
id_hash tables.
HASH_SEARCH_ALL(): New macro, for use in dict_table_add_to_columns().
dict_mem_table_free(): Set ut_d(table->cached = FALSE), so that we can
check ut_ad(table->cached) when traversing the hash tables, as in
HASH_SEARCH(name_hash, dict_sys->table_hash, ...) and
HASH_SEARCH(id_hash, dict_sys->table_id_hash, ...).
dict_table_get_low(), dict_table_get_on_id_low(): Assert
ut_ad(!table || table->cached).
fil_space_get_by_id(): Check ut_ad(space->magic_n == FIL_SPACE_MAGIC_N)
in HASH_SEARCH(hash, fil_system->spaces, ...).
fil_space_get_by_name(): Check ut_ad(space->magic_n == FIL_SPACE_MAGIC_N)
in HASH_SEARCH(name_hash, fil_system->name_hash, ...).
buf_buddy_block_free(): Check that the blocks are in valid state in
HASH_SEARCH(hash, buf_pool->zip_hash, ...).
buf_page_hash_get(): Check that the blocks are in valid state in
HASH_SEARCH(hash, buf_pool->page_hash, ...).
get_share(), free_share(): Check ut_ad(share->use_count > 0) in
HASH_SEARCH(table_name_hash, innobase_open_tables, ...).
This was posted as rb://75 for tracking down errors similar to Issue #153.
------------------------------------------------------------------------
r3931 | marko | 2009-01-14 16:06:22 +0200 (Wed, 14 Jan 2009) | 26 lines
branches/zip: Merge revisions 3601:3930 from branches/5.1:
------------------------------------------------------------------------
r3911 | sunny | 2009-01-13 14:15:24 +0200 (Tue, 13 Jan 2009) | 13 lines
branches/5.1: Fix Bug#38187 Error 153 when creating savepoints
InnoDB previously treated savepoints as a stack e.g.,
SAVEPOINT a;
SAVEPOINT b;
SAVEPOINT c;
SAVEPOINT b; <- This would delete b and c.
This fix changes the behavior to:
SAVEPOINT a;
SAVEPOINT b;
SAVEPOINT c;
SAVEPOINT b; <- Does not delete savepoint c
------------------------------------------------------------------------
r3930 | marko | 2009-01-14 15:51:30 +0200 (Wed, 14 Jan 2009) | 4 lines
branches/5.1: dict_load_table(): If dict_load_indexes() fails,
invoke dict_table_remove_from_cache() instead of dict_mem_table_free(),
so that the data dictionary will not point to freed data.
(Bug #42075, Issue #153, rb://76 approved by Heikki Tuuri)
------------------------------------------------------------------------
------------------------------------------------------------------------
2009-01-14 14:25:45 +00:00
|
|
|
ut_ad(buf_pool_mutex_own());
|
2006-11-30 12:27:49 +00:00
|
|
|
|
|
|
|
return(bpage->LRU_position);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
Gets the mutex of a block. */
|
|
|
|
UNIV_INLINE
|
|
|
|
mutex_t*
|
|
|
|
buf_page_get_mutex(
|
2006-12-05 12:10:30 +00:00
|
|
|
/*===============*/
|
branches/zip: Remove const warnings reported by GCC 4.2.1.
page_cur_set_before_first(), page_cur_set_after_last(),
page_cur_position(): Add const qualifiers to buf_block_t and rec.
A better solution would be to define a const_page_cur_t and a
set of accessors, but it would lead to severe code duplication.
page_rec_get_n_recs_before(): Add const qualifiers.
page_dir_get_nth_slot(): Define as a const-preserving macro.
page_dir_slot_get_rec(), page_dir_slot_get_n_owned(),
page_dir_find_owner_slot(), page_check_dir(): Add const qualifiers.
page_rec_get_next_low(): Add const qualifiers.
page_rec_get_next_const(), page_rec_get_prev_const(): New functions,
based on the const-less page_rec_get_next() and page_rec_get_prev().
page_cur_get_page(), page_cur_get_block(), page_cur_get_page_zip(),
page_cur_get_rec(): Define as const-preserving macros.
page_cur_try_search_shortcut(), page_cur_search_with_match():
Add const qualifiers.
buf_page_get_mutex(): Add a const qualifier to buf_page_t*.
rec_get_next_ptr_const(): Const variant of rec_get_next_ptr().
2007-10-18 07:12:05 +00:00
|
|
|
/* out: pointer to mutex
|
|
|
|
protecting bpage */
|
|
|
|
const buf_page_t* bpage) /* in: pointer to control block */
|
2006-11-30 12:27:49 +00:00
|
|
|
{
|
|
|
|
switch (buf_page_get_state(bpage)) {
|
2006-12-05 12:10:30 +00:00
|
|
|
case BUF_BLOCK_ZIP_FREE:
|
|
|
|
ut_error;
|
2008-05-14 15:43:19 +00:00
|
|
|
return(NULL);
|
2006-11-30 12:27:49 +00:00
|
|
|
case BUF_BLOCK_ZIP_PAGE:
|
2006-12-05 12:10:30 +00:00
|
|
|
case BUF_BLOCK_ZIP_DIRTY:
|
2008-01-10 09:37:13 +00:00
|
|
|
return(&buf_pool_zip_mutex);
|
2006-11-30 12:27:49 +00:00
|
|
|
default:
|
|
|
|
return(&((buf_block_t*) bpage)->mutex);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-11-27 14:12:09 +00:00
|
|
|
/*************************************************************************
|
|
|
|
Get the flush type of a page. */
|
|
|
|
UNIV_INLINE
|
|
|
|
enum buf_flush
|
|
|
|
buf_page_get_flush_type(
|
|
|
|
/*====================*/
|
|
|
|
/* out: flush type */
|
|
|
|
const buf_page_t* bpage) /* in: buffer page */
|
|
|
|
{
|
2007-08-01 10:38:07 +00:00
|
|
|
enum buf_flush flush_type = (enum buf_flush) bpage->flush_type;
|
2006-11-27 14:12:09 +00:00
|
|
|
|
|
|
|
#ifdef UNIV_DEBUG
|
|
|
|
switch (flush_type) {
|
|
|
|
case BUF_FLUSH_LRU:
|
|
|
|
case BUF_FLUSH_SINGLE_PAGE:
|
|
|
|
case BUF_FLUSH_LIST:
|
|
|
|
return(flush_type);
|
|
|
|
case BUF_FLUSH_N_TYPES:
|
2006-11-28 11:08:33 +00:00
|
|
|
break;
|
2006-11-27 14:12:09 +00:00
|
|
|
}
|
|
|
|
ut_error;
|
|
|
|
#endif /* UNIV_DEBUG */
|
|
|
|
return(flush_type);
|
|
|
|
}
|
|
|
|
/*************************************************************************
|
|
|
|
Set the flush type of a page. */
|
|
|
|
UNIV_INLINE
|
|
|
|
void
|
|
|
|
buf_page_set_flush_type(
|
|
|
|
/*====================*/
|
|
|
|
buf_page_t* bpage, /* in: buffer page */
|
|
|
|
enum buf_flush flush_type) /* in: flush type */
|
|
|
|
{
|
2006-11-30 10:33:35 +00:00
|
|
|
bpage->flush_type = flush_type;
|
2006-11-27 14:12:09 +00:00
|
|
|
ut_ad(buf_page_get_flush_type(bpage) == flush_type);
|
|
|
|
}
|
|
|
|
|
2006-11-23 14:12:58 +00:00
|
|
|
/*************************************************************************
|
|
|
|
Map a block to a file page. */
|
|
|
|
UNIV_INLINE
|
|
|
|
void
|
|
|
|
buf_block_set_file_page(
|
|
|
|
/*====================*/
|
|
|
|
buf_block_t* block, /* in/out: pointer to control block */
|
|
|
|
ulint space, /* in: tablespace id */
|
|
|
|
ulint page_no)/* in: page number */
|
|
|
|
{
|
|
|
|
buf_block_set_state(block, BUF_BLOCK_FILE_PAGE);
|
2006-11-24 08:32:18 +00:00
|
|
|
block->page.space = space;
|
|
|
|
block->page.offset = page_no;
|
2006-11-23 14:12:58 +00:00
|
|
|
}
|
2006-11-23 13:26:01 +00:00
|
|
|
|
2006-11-30 12:27:49 +00:00
|
|
|
/*************************************************************************
|
|
|
|
Gets the io_fix state of a block. */
|
|
|
|
UNIV_INLINE
|
|
|
|
enum buf_io_fix
|
|
|
|
buf_page_get_io_fix(
|
|
|
|
/*================*/
|
|
|
|
/* out: io_fix state */
|
|
|
|
const buf_page_t* bpage) /* in: pointer to the control block */
|
|
|
|
{
|
2007-08-01 10:38:07 +00:00
|
|
|
enum buf_io_fix io_fix = (enum buf_io_fix) bpage->io_fix;
|
2006-11-30 12:27:49 +00:00
|
|
|
#ifdef UNIV_DEBUG
|
|
|
|
switch (io_fix) {
|
|
|
|
case BUF_IO_NONE:
|
|
|
|
case BUF_IO_READ:
|
|
|
|
case BUF_IO_WRITE:
|
|
|
|
return(io_fix);
|
|
|
|
}
|
|
|
|
ut_error;
|
|
|
|
#endif /* UNIV_DEBUG */
|
|
|
|
return(io_fix);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
Gets the io_fix state of a block. */
|
|
|
|
UNIV_INLINE
|
|
|
|
enum buf_io_fix
|
|
|
|
buf_block_get_io_fix(
|
|
|
|
/*================*/
|
|
|
|
/* out: io_fix state */
|
|
|
|
const buf_block_t* block) /* in: pointer to the control block */
|
|
|
|
{
|
|
|
|
return(buf_page_get_io_fix(&block->page));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
Sets the io_fix state of a block. */
|
|
|
|
UNIV_INLINE
|
|
|
|
void
|
|
|
|
buf_page_set_io_fix(
|
|
|
|
/*================*/
|
|
|
|
buf_page_t* bpage, /* in/out: control block */
|
|
|
|
enum buf_io_fix io_fix) /* in: io_fix state */
|
|
|
|
{
|
2008-01-10 09:37:13 +00:00
|
|
|
ut_ad(buf_pool_mutex_own());
|
2007-01-18 18:29:12 +00:00
|
|
|
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
|
|
|
|
|
2006-11-30 12:27:49 +00:00
|
|
|
bpage->io_fix = io_fix;
|
|
|
|
ut_ad(buf_page_get_io_fix(bpage) == io_fix);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
Sets the io_fix state of a block. */
|
|
|
|
UNIV_INLINE
|
|
|
|
void
|
|
|
|
buf_block_set_io_fix(
|
|
|
|
/*=================*/
|
|
|
|
buf_block_t* block, /* in/out: control block */
|
|
|
|
enum buf_io_fix io_fix) /* in: io_fix state */
|
|
|
|
{
|
|
|
|
buf_page_set_io_fix(&block->page, io_fix);
|
|
|
|
}
|
|
|
|
|
2007-01-04 21:40:10 +00:00
|
|
|
/************************************************************************
|
|
|
|
Determine if a buffer block can be relocated in memory. The block
|
|
|
|
can be dirty, but it must not be I/O-fixed or bufferfixed. */
|
|
|
|
UNIV_INLINE
|
|
|
|
ibool
|
|
|
|
buf_page_can_relocate(
|
|
|
|
/*==================*/
|
|
|
|
const buf_page_t* bpage) /* control block being relocated */
|
|
|
|
{
|
2008-01-10 09:37:13 +00:00
|
|
|
ut_ad(buf_pool_mutex_own());
|
branches/zip: Remove const warnings reported by GCC 4.2.1.
page_cur_set_before_first(), page_cur_set_after_last(),
page_cur_position(): Add const qualifiers to buf_block_t and rec.
A better solution would be to define a const_page_cur_t and a
set of accessors, but it would lead to severe code duplication.
page_rec_get_n_recs_before(): Add const qualifiers.
page_dir_get_nth_slot(): Define as a const-preserving macro.
page_dir_slot_get_rec(), page_dir_slot_get_n_owned(),
page_dir_find_owner_slot(), page_check_dir(): Add const qualifiers.
page_rec_get_next_low(): Add const qualifiers.
page_rec_get_next_const(), page_rec_get_prev_const(): New functions,
based on the const-less page_rec_get_next() and page_rec_get_prev().
page_cur_get_page(), page_cur_get_block(), page_cur_get_page_zip(),
page_cur_get_rec(): Define as const-preserving macros.
page_cur_try_search_shortcut(), page_cur_search_with_match():
Add const qualifiers.
buf_page_get_mutex(): Add a const qualifier to buf_page_t*.
rec_get_next_ptr_const(): Const variant of rec_get_next_ptr().
2007-10-18 07:12:05 +00:00
|
|
|
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
|
2007-01-04 21:40:10 +00:00
|
|
|
ut_ad(buf_page_in_file(bpage));
|
|
|
|
ut_ad(bpage->in_LRU_list);
|
|
|
|
|
|
|
|
return(buf_page_get_io_fix(bpage) == BUF_IO_NONE
|
|
|
|
&& bpage->buf_fix_count == 0);
|
|
|
|
}
|
|
|
|
|
2006-11-30 12:27:49 +00:00
|
|
|
/*************************************************************************
|
|
|
|
Determine if a block has been flagged old. */
|
|
|
|
UNIV_INLINE
|
|
|
|
ibool
|
|
|
|
buf_page_is_old(
|
|
|
|
/*============*/
|
|
|
|
/* out: TRUE if old */
|
|
|
|
const buf_page_t* bpage) /* in: control block */
|
|
|
|
{
|
|
|
|
ut_ad(buf_page_in_file(bpage));
|
branches/innodb+: Merge revisions 3602:3931 from branches/zip:
------------------------------------------------------------------------
r3607 | marko | 2008-12-30 22:33:31 +0200 (Tue, 30 Dec 2008) | 20 lines
branches/zip: Remove the dependency on the MySQL HASH table implementation.
Use the InnoDB hash table for keeping track of INNOBASE_SHARE objects.
struct st_innobase_share: Make table_name const uchar*. Add the member
table_name_hash.
innobase_open_tables: Change the type from HASH to hash_table_t*.
innobase_get_key(): Remove.
innobase_fold_name(): New function, for computing the fold value for the
InnoDB hash table.
get_share(), free_share(): Use the InnoDB hash functions.
innobase_end(): Free innobase_open_tables before shutting down InnoDB.
Shutting down InnoDB will invalidate all memory allocated via InnoDB.
rb://65 approved by Heikki Tuuri. This addresses Issue #104.
------------------------------------------------------------------------
r3608 | marko | 2008-12-30 22:45:04 +0200 (Tue, 30 Dec 2008) | 22 lines
branches/zip: When setting the PAGE_LEVEL of a compressed B-tree page
from or to 0, compress the page at the same time. This is necessary,
because the column information stored on the compressed page will
differ between leaf and non-leaf pages. Leaf pages are identified by
PAGE_LEVEL=0. This bug was reported as Issue #150.
Document the similarity between btr_page_create() and
btr_page_empty(). Make the function signature of btr_page_empty()
identical with btr_page_create(). (This will add the parameter "level".)
btr_root_raise_and_insert(): Replace some code with a call to
btr_page_empty().
btr_attach_half_pages(): Assert that the page level has already been
set on both block and new_block. Do not set it again.
btr_discard_only_page_on_level(): Document that this function is
probably never called. Make it work on any height tree. (Tested on
2-high tree by disabling btr_lift_page_up().)
rb://68
------------------------------------------------------------------------
r3612 | marko | 2009-01-02 11:02:44 +0200 (Fri, 02 Jan 2009) | 14 lines
branches/zip: Merge c2998 from branches/6.0, so that the same InnoDB Plugin
source tree will work both under 5.1 and 6.0. Do not add the test case
innodb_ctype_ldml.test, because it would not work under MySQL 5.1.
Refuse to create tables whose columns contain collation IDs above 255.
This removes an assertion failure that was introduced in WL#4164
(Two-byte collation IDs).
create_table_def(): Do not fail an assertion if a column contains a
charset-collation ID greater than 256. Instead, issue an error and
refuse to create the table.
The original change (branches/6.0 r2998) was rb://51 approved by Calvin Sun.
------------------------------------------------------------------------
r3613 | inaam | 2009-01-02 15:10:50 +0200 (Fri, 02 Jan 2009) | 6 lines
branches/zip: Implement the parameter innodb_use_sys_malloc
(false by default), for disabling InnoDB's internal memory allocator
and using system malloc/free instead.
rb://62 approved by Marko
------------------------------------------------------------------------
r3614 | marko | 2009-01-02 15:55:12 +0200 (Fri, 02 Jan 2009) | 1 line
branches/zip: ChangeLog: Document r3608 and r3613.
------------------------------------------------------------------------
r3615 | marko | 2009-01-02 15:57:51 +0200 (Fri, 02 Jan 2009) | 1 line
branches/zip: ChangeLog: Clarify the impact of r3608.
------------------------------------------------------------------------
r3616 | marko | 2009-01-03 00:23:30 +0200 (Sat, 03 Jan 2009) | 1 line
branches/zip: srv_suspend_mysql_thread(): Add some clarifying comments.
------------------------------------------------------------------------
r3618 | marko | 2009-01-05 12:54:53 +0200 (Mon, 05 Jan 2009) | 15 lines
branches/zip: Merge revisions 3598:3601 from branches/5.1:
------------------------------------------------------------------------
r3601 | marko | 2008-12-22 16:05:19 +0200 (Mon, 22 Dec 2008) | 9 lines
branches/5.1: Make
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED
a true replacement of SET GLOBAL INNODB_LOCKS_UNSAFE_FOR_BINLOG=1.
This fixes an error that was introduced in r370, causing
semi-consistent read not to not unlock rows in READ COMMITTED mode.
(Bug #41671, Issue #146)
rb://67 approved by Heikki Tuuri
------------------------------------------------------------------------
------------------------------------------------------------------------
r3623 | vasil | 2009-01-06 09:56:32 +0200 (Tue, 06 Jan 2009) | 7 lines
branches/zip:
Add patch to fix the failing main.variables mysql-test. It started failing
after the variable innodb_use_sys_malloc was added because it matches
'%alloc%' and the test is badly written and expects that no new variables
like that will ever be added.
------------------------------------------------------------------------
r3795 | marko | 2009-01-07 16:17:47 +0200 (Wed, 07 Jan 2009) | 7 lines
branches/zip: row_merge_tuple_cmp(): Do not report a duplicate key value
if any of the fields are NULL. While the tuples are equal in the
sorting order, SQL NULL is defined to be logically inequal to
anything else. (Bug #41904)
rb://70 approved by Heikki Tuuri
------------------------------------------------------------------------
r3796 | marko | 2009-01-07 16:19:32 +0200 (Wed, 07 Jan 2009) | 1 line
branches/zip: Add the tests that were forgotten from r3795.
------------------------------------------------------------------------
r3797 | marko | 2009-01-07 16:22:18 +0200 (Wed, 07 Jan 2009) | 22 lines
branches/zip: Do not call trx_allocate_for_mysql() directly, but use
helper functions that initialize some members of the transaction struct.
(Bug #41680)
innobase_trx_init(): New function: initialize some fields of a
transaction struct from a MySQL THD object.
innobase_trx_allocate(): New function: allocate and initialize a
transaction struct.
check_trx_exists(): Use the above two functions.
ha_innobase::delete_table(), ha_innobase::rename_table(),
ha_innobase::add_index(), ha_innobase::final_drop_index():
Use innobase_trx_allocate().
innobase_drop_database(): In the Windows plugin, initialize the trx_t
specially, because the THD is not available. Otherwise, use
innobase_trx_allocate().
rb://69 accepted by Heikki Tuuri
------------------------------------------------------------------------
r3798 | marko | 2009-01-07 16:42:42 +0200 (Wed, 07 Jan 2009) | 8 lines
branches/zip: row_merge_drop_temp_indexes(): Do not lock the rows of
SYS_INDEXES when looking for partially created indexes. Use the
transaction isolation level READ UNCOMMITTED to avoid interfering with
locks held by incomplete transactions that will be rolled back in a
subsequent step in the recovery. (Issue #152)
Approved by Heikki Tuuri
------------------------------------------------------------------------
r3852 | vasil | 2009-01-08 22:10:10 +0200 (Thu, 08 Jan 2009) | 4 lines
branches/zip:
Add ChangeLog entries for r3795 r3796 r3797 r3798.
------------------------------------------------------------------------
r3866 | marko | 2009-01-09 15:09:51 +0200 (Fri, 09 Jan 2009) | 2 lines
branches/zip: buf_flush_try_page(): Move some common code from each
switch case before the switch block.
------------------------------------------------------------------------
r3867 | marko | 2009-01-09 15:13:14 +0200 (Fri, 09 Jan 2009) | 2 lines
branches/zip: buf_flush_try_page(): Introduce the variable is_compressed
for caching the result of buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE.
------------------------------------------------------------------------
r3868 | marko | 2009-01-09 15:40:11 +0200 (Fri, 09 Jan 2009) | 4 lines
branches/zip: buf_flush_insert_into_flush_list(),
buf_flush_insert_sorted_into_flush_list(): Remove unused code.
Change the parameter to buf_block_t* block and assert that
block->state == BUF_BLOCK_FILE_PAGE. This is part of Issue #155.
------------------------------------------------------------------------
r3873 | marko | 2009-01-09 22:27:40 +0200 (Fri, 09 Jan 2009) | 17 lines
branches/zip: Some non-functional changes related to Issue #155.
buf_page_struct: Note that space and offset are also protected by
buf_pool_mutex. They are only assigned to by
buf_block_set_file_page(). Thus, it suffices for buf_flush_batch() to
hold just buf_pool_mutex when checking these fields.
buf_flush_try_page(): Rename "locked" to "is_s_latched", per Heikki's request.
buf_flush_batch(): Move the common statement mutex_exit(block_mutex)
from all if-else if-else branches before the if block. Remove the
redundant test (buf_pool->init_flush[flush_type] == FALSE) that was
apparently copied from buf_flush_write_complete().
buf_flush_write_block_low(): Note why it is safe not to hold buf_pool_mutex
or block_mutex. Enumerate the assumptions in debug assertions.
------------------------------------------------------------------------
r3874 | marko | 2009-01-09 23:09:06 +0200 (Fri, 09 Jan 2009) | 4 lines
branches/zip: Add comments related to Issue #155.
buf_flush_try_page(): Note why it is safe to access bpage without
holding buf_pool_mutex or block_mutex.
------------------------------------------------------------------------
r3875 | marko | 2009-01-09 23:15:12 +0200 (Fri, 09 Jan 2009) | 11 lines
branches/zip: Non-functional change: Tighten debug assertions and
remove dead code.
buf_flush_ready_for_flush(), buf_flush_try_page(): Assert that
flush_type is one of BUF_FLUSH_LRU or BUF_FLUSH_LIST. The flush_type
comes from buf_flush_batch(), which already asserts this. The
assertion holds for all calls in the source code.
buf_flush_try_page(): Remove the dead case BUF_FLUSH_SINGLE_PAGE
of switch (flush_type).
------------------------------------------------------------------------
r3879 | marko | 2009-01-12 12:46:44 +0200 (Mon, 12 Jan 2009) | 14 lines
branches/zip: Simplify the flushing of dirty pages from the buffer pool.
buf_flush_try_page(): Rename to buf_flush_page(), and change the
return type to void. Replace the parameters space, offset with bpage,
and remove the second page hash lookup. Note and assert that both
buf_pool_mutex and block_mutex must now be held upon entering the
function. They will still be released by this function.
buf_flush_try_neighbors(): Replace buf_flush_try_page() with
buf_flush_page(). Make the logic easier to follow by not negating the
precondition of buf_flush_page().
rb://73 approved by Sunny Bains. This is related to Issue #157.
------------------------------------------------------------------------
r3880 | marko | 2009-01-12 13:24:37 +0200 (Mon, 12 Jan 2009) | 2 lines
branches/zip: buf_flush_page(): Fix a comment that should have been fixed
in r3879. Spotted by Sunny.
------------------------------------------------------------------------
r3881 | marko | 2009-01-12 14:25:22 +0200 (Mon, 12 Jan 2009) | 2 lines
branches/zip: buf_page_get_newest_modification(): Use the block mutex
instead of the buffer pool mutex. This is related to Issue #157.
------------------------------------------------------------------------
r3882 | marko | 2009-01-12 14:40:08 +0200 (Mon, 12 Jan 2009) | 3 lines
branches/zip: struct mtr_struct: Remove the unused field magic_n
unless UNIV_DEBUG is defined. mtr->magic_n is only assigned to
and checked in UNIV_DEBUG builds.
------------------------------------------------------------------------
r3883 | marko | 2009-01-12 14:48:59 +0200 (Mon, 12 Jan 2009) | 1 line
branches/zip: Non-functional change: Use ut_d when assigning to mtr->state.
------------------------------------------------------------------------
r3884 | marko | 2009-01-12 18:56:11 +0200 (Mon, 12 Jan 2009) | 16 lines
branches/zip: Non-functional change: Add some debug assertions and comments.
buf_page_t: Note that the LRU fields are protected by buf_pool_mutex
only, not block->mutex or buf_pool_zip_mutex.
buf_page_get_freed_page_clock(): Note that this is sometimes invoked
without mutex protection.
buf_pool_get_oldest_modification(): Note that the result may be out of
date.
buf_page_get_LRU_position(), buf_page_is_old(): Assert that the buffer
pool mutex is being held.
buf_page_release(): Assert that dirty blocks are in the flush list.
------------------------------------------------------------------------
r3896 | marko | 2009-01-13 09:30:26 +0200 (Tue, 13 Jan 2009) | 2 lines
branches/zip: buf_flush_try_neighbors(): Fix a bug
that was introduced in r3879 (rb://73).
------------------------------------------------------------------------
r3900 | marko | 2009-01-13 10:32:24 +0200 (Tue, 13 Jan 2009) | 1 line
branches/zip: Fix some comments to say buf_pool_mutex.
------------------------------------------------------------------------
r3907 | marko | 2009-01-13 11:54:01 +0200 (Tue, 13 Jan 2009) | 3 lines
branches/zip: row_merge_create_temporary_table(): On error,
row_create_table_for_mysql() already frees new_table.
Do not attempt to free it again.
------------------------------------------------------------------------
r3908 | marko | 2009-01-13 12:34:32 +0200 (Tue, 13 Jan 2009) | 1 line
branches/zip: Enable HASH_ASSERT_OWNED independently of UNIV_SYNC_DEBUG.
------------------------------------------------------------------------
r3914 | marko | 2009-01-13 21:46:22 +0200 (Tue, 13 Jan 2009) | 37 lines
branches/zip: In hash table lookups, assert that the traversed items
satisfy some conditions when UNIV_DEBUG is defined.
HASH_SEARCH(): New parameter: ASSERTION. All users will pass an appropriate
ut_ad() or nothing.
dict_table_add_to_columns(): Assert that the table being added to the data
dictionary cache is not already being pointed to by the name_hash and
id_hash tables.
HASH_SEARCH_ALL(): New macro, for use in dict_table_add_to_columns().
dict_mem_table_free(): Set ut_d(table->cached = FALSE), so that we can
check ut_ad(table->cached) when traversing the hash tables, as in
HASH_SEARCH(name_hash, dict_sys->table_hash, ...) and
HASH_SEARCH(id_hash, dict_sys->table_id_hash, ...).
dict_table_get_low(), dict_table_get_on_id_low(): Assert
ut_ad(!table || table->cached).
fil_space_get_by_id(): Check ut_ad(space->magic_n == FIL_SPACE_MAGIC_N)
in HASH_SEARCH(hash, fil_system->spaces, ...).
fil_space_get_by_name(): Check ut_ad(space->magic_n == FIL_SPACE_MAGIC_N)
in HASH_SEARCH(name_hash, fil_system->name_hash, ...).
buf_buddy_block_free(): Check that the blocks are in valid state in
HASH_SEARCH(hash, buf_pool->zip_hash, ...).
buf_page_hash_get(): Check that the blocks are in valid state in
HASH_SEARCH(hash, buf_pool->page_hash, ...).
get_share(), free_share(): Check ut_ad(share->use_count > 0) in
HASH_SEARCH(table_name_hash, innobase_open_tables, ...).
This was posted as rb://75 for tracking down errors similar to Issue #153.
------------------------------------------------------------------------
r3931 | marko | 2009-01-14 16:06:22 +0200 (Wed, 14 Jan 2009) | 26 lines
branches/zip: Merge revisions 3601:3930 from branches/5.1:
------------------------------------------------------------------------
r3911 | sunny | 2009-01-13 14:15:24 +0200 (Tue, 13 Jan 2009) | 13 lines
branches/5.1: Fix Bug#38187 Error 153 when creating savepoints
InnoDB previously treated savepoints as a stack e.g.,
SAVEPOINT a;
SAVEPOINT b;
SAVEPOINT c;
SAVEPOINT b; <- This would delete b and c.
This fix changes the behavior to:
SAVEPOINT a;
SAVEPOINT b;
SAVEPOINT c;
SAVEPOINT b; <- Does not delete savepoint c
------------------------------------------------------------------------
r3930 | marko | 2009-01-14 15:51:30 +0200 (Wed, 14 Jan 2009) | 4 lines
branches/5.1: dict_load_table(): If dict_load_indexes() fails,
invoke dict_table_remove_from_cache() instead of dict_mem_table_free(),
so that the data dictionary will not point to freed data.
(Bug #42075, Issue #153, rb://76 approved by Heikki Tuuri)
------------------------------------------------------------------------
------------------------------------------------------------------------
2009-01-14 14:25:45 +00:00
|
|
|
ut_ad(buf_pool_mutex_own());
|
2006-11-30 12:27:49 +00:00
|
|
|
|
|
|
|
return(bpage->old);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
Flag a block old. */
|
|
|
|
UNIV_INLINE
|
|
|
|
void
|
|
|
|
buf_page_set_old(
|
|
|
|
/*=============*/
|
|
|
|
buf_page_t* bpage, /* in/out: control block */
|
|
|
|
ibool old) /* in: old */
|
|
|
|
{
|
|
|
|
ut_a(buf_page_in_file(bpage));
|
2008-01-10 09:37:13 +00:00
|
|
|
ut_ad(buf_pool_mutex_own());
|
2008-09-17 19:52:30 +00:00
|
|
|
ut_ad(bpage->in_LRU_list);
|
|
|
|
|
|
|
|
#ifdef UNIV_LRU_DEBUG
|
|
|
|
if (UT_LIST_GET_PREV(LRU, bpage) && UT_LIST_GET_NEXT(LRU, bpage)
|
|
|
|
&& UT_LIST_GET_PREV(LRU, bpage)->old
|
|
|
|
== UT_LIST_GET_NEXT(LRU, bpage)->old) {
|
|
|
|
ut_a(UT_LIST_GET_PREV(LRU, bpage)->old == old);
|
|
|
|
}
|
|
|
|
#endif /* UNIV_LRU_DEBUG */
|
2006-11-30 12:27:49 +00:00
|
|
|
|
|
|
|
bpage->old = old;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
Determine if a block has been accessed in the buffer pool. */
|
|
|
|
UNIV_INLINE
|
|
|
|
ibool
|
|
|
|
buf_page_is_accessed(
|
|
|
|
/*=================*/
|
|
|
|
/* out: TRUE if accessed */
|
|
|
|
const buf_page_t* bpage) /* in: control block */
|
|
|
|
{
|
|
|
|
ut_ad(buf_page_in_file(bpage));
|
|
|
|
|
|
|
|
return(bpage->accessed);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
Flag a block accessed. */
|
|
|
|
UNIV_INLINE
|
|
|
|
void
|
|
|
|
buf_page_set_accessed(
|
|
|
|
/*==================*/
|
|
|
|
buf_page_t* bpage, /* in/out: control block */
|
|
|
|
ibool accessed) /* in: accessed */
|
|
|
|
{
|
|
|
|
ut_a(buf_page_in_file(bpage));
|
2007-01-18 18:29:12 +00:00
|
|
|
ut_ad(mutex_own(buf_page_get_mutex(bpage)));
|
2006-11-30 12:27:49 +00:00
|
|
|
|
|
|
|
bpage->accessed = accessed;
|
|
|
|
}
|
|
|
|
|
2007-09-28 12:04:04 +00:00
|
|
|
/*************************************************************************
|
|
|
|
Gets the buf_block_t handle of a buffered file block if an uncompressed
|
|
|
|
page frame exists, or NULL. */
|
|
|
|
UNIV_INLINE
|
2007-10-01 07:32:45 +00:00
|
|
|
buf_block_t*
|
2007-09-28 12:04:04 +00:00
|
|
|
buf_page_get_block(
|
|
|
|
/*===============*/
|
2007-10-01 07:32:45 +00:00
|
|
|
/* out: control block, or NULL */
|
|
|
|
buf_page_t* bpage) /* in: control block, or NULL */
|
2007-09-28 12:04:04 +00:00
|
|
|
{
|
2007-10-01 07:32:45 +00:00
|
|
|
if (UNIV_LIKELY(bpage != NULL)) {
|
|
|
|
ut_ad(buf_page_in_file(bpage));
|
2007-09-28 12:04:04 +00:00
|
|
|
|
2007-10-01 07:32:45 +00:00
|
|
|
if (buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE) {
|
|
|
|
return((buf_block_t*) bpage);
|
|
|
|
}
|
2007-09-28 12:04:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return(NULL);
|
|
|
|
}
|
|
|
|
|
2007-09-28 06:26:21 +00:00
|
|
|
#ifdef UNIV_DEBUG
|
2005-10-27 07:29:40 +00:00
|
|
|
/*************************************************************************
|
|
|
|
Gets a pointer to the memory frame of a block. */
|
|
|
|
UNIV_INLINE
|
|
|
|
buf_frame_t*
|
|
|
|
buf_block_get_frame(
|
|
|
|
/*================*/
|
2007-09-28 06:26:21 +00:00
|
|
|
/* out: pointer to the frame */
|
|
|
|
const buf_block_t* block) /* in: pointer to the control block */
|
2005-10-27 07:29:40 +00:00
|
|
|
{
|
|
|
|
ut_ad(block);
|
2007-09-28 06:26:21 +00:00
|
|
|
|
2006-11-30 15:09:33 +00:00
|
|
|
switch (buf_block_get_state(block)) {
|
2006-12-05 12:10:30 +00:00
|
|
|
case BUF_BLOCK_ZIP_FREE:
|
2006-11-30 15:09:33 +00:00
|
|
|
case BUF_BLOCK_ZIP_PAGE:
|
2006-12-05 12:10:30 +00:00
|
|
|
case BUF_BLOCK_ZIP_DIRTY:
|
|
|
|
case BUF_BLOCK_NOT_USED:
|
2006-11-30 15:09:33 +00:00
|
|
|
ut_error;
|
|
|
|
break;
|
|
|
|
case BUF_BLOCK_FILE_PAGE:
|
|
|
|
ut_a(block->page.buf_fix_count > 0);
|
|
|
|
/* fall through */
|
|
|
|
case BUF_BLOCK_READY_FOR_USE:
|
|
|
|
case BUF_BLOCK_MEMORY:
|
|
|
|
case BUF_BLOCK_REMOVE_HASH:
|
|
|
|
goto ok;
|
|
|
|
}
|
|
|
|
ut_error;
|
|
|
|
ok:
|
2007-09-28 06:26:21 +00:00
|
|
|
return((buf_frame_t*) block->frame);
|
2006-02-23 19:25:29 +00:00
|
|
|
}
|
2007-09-28 06:26:21 +00:00
|
|
|
#endif /* UNIV_DEBUG */
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-11-30 12:27:49 +00:00
|
|
|
/*************************************************************************
|
|
|
|
Gets the space id of a block. */
|
|
|
|
UNIV_INLINE
|
|
|
|
ulint
|
|
|
|
buf_page_get_space(
|
|
|
|
/*===============*/
|
|
|
|
/* out: space id */
|
|
|
|
const buf_page_t* bpage) /* in: pointer to the control block */
|
|
|
|
{
|
|
|
|
ut_ad(bpage);
|
|
|
|
ut_a(buf_page_in_file(bpage));
|
|
|
|
|
|
|
|
return(bpage->space);
|
|
|
|
}
|
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
/*************************************************************************
|
|
|
|
Gets the space id of a block. */
|
|
|
|
UNIV_INLINE
|
|
|
|
ulint
|
|
|
|
buf_block_get_space(
|
|
|
|
/*================*/
|
2006-10-20 12:45:53 +00:00
|
|
|
/* out: space id */
|
|
|
|
const buf_block_t* block) /* in: pointer to the control block */
|
2005-10-27 07:29:40 +00:00
|
|
|
{
|
|
|
|
ut_ad(block);
|
2006-11-23 14:12:58 +00:00
|
|
|
ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2006-11-24 08:32:18 +00:00
|
|
|
return(block->page.space);
|
2006-02-23 19:25:29 +00:00
|
|
|
}
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-11-30 12:27:49 +00:00
|
|
|
/*************************************************************************
|
|
|
|
Gets the page number of a block. */
|
|
|
|
UNIV_INLINE
|
|
|
|
ulint
|
|
|
|
buf_page_get_page_no(
|
|
|
|
/*=================*/
|
|
|
|
/* out: page number */
|
|
|
|
const buf_page_t* bpage) /* in: pointer to the control block */
|
|
|
|
{
|
|
|
|
ut_ad(bpage);
|
|
|
|
ut_a(buf_page_in_file(bpage));
|
|
|
|
|
|
|
|
return(bpage->offset);
|
|
|
|
}
|
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
/*************************************************************************
|
|
|
|
Gets the page number of a block. */
|
|
|
|
UNIV_INLINE
|
|
|
|
ulint
|
|
|
|
buf_block_get_page_no(
|
|
|
|
/*==================*/
|
2006-10-20 12:45:53 +00:00
|
|
|
/* out: page number */
|
|
|
|
const buf_block_t* block) /* in: pointer to the control block */
|
2005-10-27 07:29:40 +00:00
|
|
|
{
|
|
|
|
ut_ad(block);
|
2006-11-23 14:12:58 +00:00
|
|
|
ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2006-11-24 08:32:18 +00:00
|
|
|
return(block->page.offset);
|
2006-02-23 19:25:29 +00:00
|
|
|
}
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-11-30 12:27:49 +00:00
|
|
|
/*************************************************************************
|
|
|
|
Gets the compressed page size of a block. */
|
|
|
|
UNIV_INLINE
|
|
|
|
ulint
|
|
|
|
buf_page_get_zip_size(
|
|
|
|
/*==================*/
|
|
|
|
/* out: compressed page size, or 0 */
|
|
|
|
const buf_page_t* bpage) /* in: pointer to the control block */
|
|
|
|
{
|
|
|
|
return(bpage->zip.ssize ? 512 << bpage->zip.ssize : 0);
|
|
|
|
}
|
|
|
|
|
2006-10-12 11:05:22 +00:00
|
|
|
/*************************************************************************
|
|
|
|
Gets the compressed page size of a block. */
|
|
|
|
UNIV_INLINE
|
|
|
|
ulint
|
|
|
|
buf_block_get_zip_size(
|
|
|
|
/*===================*/
|
|
|
|
/* out: compressed page size, or 0 */
|
|
|
|
const buf_block_t* block) /* in: pointer to the control block */
|
|
|
|
{
|
2006-11-27 13:44:32 +00:00
|
|
|
return(block->page.zip.ssize ? 512 << block->page.zip.ssize : 0);
|
2006-10-12 11:05:22 +00:00
|
|
|
}
|
|
|
|
|
2006-11-02 09:06:49 +00:00
|
|
|
#if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
|
2006-10-12 11:05:22 +00:00
|
|
|
/*************************************************************************
|
|
|
|
Gets the compressed page descriptor corresponding to an uncompressed page
|
|
|
|
if applicable. */
|
|
|
|
UNIV_INLINE
|
2007-10-03 12:22:29 +00:00
|
|
|
const page_zip_des_t*
|
2006-10-12 11:05:22 +00:00
|
|
|
buf_frame_get_page_zip(
|
|
|
|
/*===================*/
|
2007-10-03 12:22:29 +00:00
|
|
|
/* out: compressed page descriptor, or NULL */
|
|
|
|
const byte* ptr) /* in: pointer to the page */
|
2006-10-12 11:05:22 +00:00
|
|
|
{
|
branches/innodb+: Merge revisions 4006:4060 from branches/zip:
------------------------------------------------------------------------
r4008 | vasil | 2009-01-20 17:01:08 +0200 (Tue, 20 Jan 2009) | 4 lines
branches/zip:
Add ChangeLog entries for the bugfixes in r4004 and r4005.
------------------------------------------------------------------------
r4027 | marko | 2009-01-23 11:04:49 +0200 (Fri, 23 Jan 2009) | 1 line
branches/zip: Remove some redundant #include statements.
------------------------------------------------------------------------
r4028 | marko | 2009-01-23 11:26:10 +0200 (Fri, 23 Jan 2009) | 13 lines
branches/zip: Enclose some more unused code in #ifdef UNIV_LOG_ARCHIVE.
This will help trim the dependencies of InnoDB Hot Backup.
recv_recovery_from_checkpoint_start(): Rename to
recv_recovery_from_checkpoint_start_func(), and remove the two first
parameters unless UNIV_LOG_ARCHIVE is defined. Define and use
the auxiliary macros TYPE_CHECKPOINT and LIMIT_LSN in the function.
struct recv_sys_struct: Remove archive_group unless UNIV_LOG_ARCHIVE
is defined.
Do not define LOG_ARCHIVE unless UNIV_LOG_ARCHIVE is defined.
------------------------------------------------------------------------
r4029 | marko | 2009-01-23 14:07:38 +0200 (Fri, 23 Jan 2009) | 1 line
branches/zip: Remove some redundant #include directives.
------------------------------------------------------------------------
r4030 | marko | 2009-01-23 15:31:36 +0200 (Fri, 23 Jan 2009) | 2 lines
branches/zip: buf_page_get_gen(): Remove the unused mode BUF_GET_NOWAIT.
This was noticed while investigating Issue #160.
------------------------------------------------------------------------
r4033 | marko | 2009-01-23 15:49:04 +0200 (Fri, 23 Jan 2009) | 16 lines
branches/zip: Merge revisions 4005:4032 from branches/5.1:
------------------------------------------------------------------------
r4032 | marko | 2009-01-23 15:43:51 +0200 (Fri, 23 Jan 2009) | 10 lines
branches/5.1: Merge r4031 from branches/5.0:
btr_search_drop_page_hash_when_freed(): Check if buf_page_get_gen()
returns NULL. The page may have been evicted from the buffer pool
between buf_page_peek_if_search_hashed() and buf_page_get_gen(),
because the buffer pool mutex will be released between these two calls.
(Bug #42279, Issue #160)
rb://82 approved by Heikki Tuuri
------------------------------------------------------------------------
------------------------------------------------------------------------
r4034 | marko | 2009-01-26 16:16:39 +0200 (Mon, 26 Jan 2009) | 2 lines
branches/zip: buf_page_get_gen(): Fix a "possibly uninitialized" warning
that was introduced in r4030.
------------------------------------------------------------------------
r4036 | marko | 2009-01-26 22:33:20 +0200 (Mon, 26 Jan 2009) | 22 lines
branches/zip: In r988, the function buf_block_align() was enclosed
within UNIV_DEBUG. The two remaining callers in non-debug builds,
btr_search_guess_on_hash() and btr_search_validate(), were rewritten
to call buf_page_hash_get().
To implement support for a resizeable buffer pool, the function
buf_block_align() had been rewritten to perform a page hash lookup in
the buffer pool. The caller was also made responsible for holding the
buffer pool mutex.
Because the page hash lookup is expensive and it has to be done while
holding the buffer pool mutex, implement buf_block_align() by pointer
arithmetics again, and make btr_search_guess_on_hash() call it. Note
that this will have to be adjusted if the interface to the resizeable
buffer pool is actually implemented.
rb://83 approved by Heikki Tuuri, to address Issue #161.
As a deviation from the approved patch, this patch also makes
btr_search_validate() (invoked by CHECK TABLE) check that
buf_pool->page_hash is consistent with buf_block_align().
------------------------------------------------------------------------
r4039 | vasil | 2009-01-27 08:04:17 +0200 (Tue, 27 Jan 2009) | 5 lines
branches/zip:
Adjust the paths in innodb_file_per_table.diff with a recent rename of
the test/result files in the MySQL tree.
------------------------------------------------------------------------
r4042 | marko | 2009-01-27 10:05:24 +0200 (Tue, 27 Jan 2009) | 2 lines
branches/zip: buf_LRU_invalidate_tablespace(): Fix a race condition:
read zip_size while still holding block_mutex.
------------------------------------------------------------------------
r4045 | marko | 2009-01-28 00:31:17 +0200 (Wed, 28 Jan 2009) | 8 lines
branches/zip: btr_search_validate(): Fix a bogus UNIV_DEBUG
assertion failure that was accidentally introduced in r4036.
Instead of calling buf_block_get_frame(), which asserts that the
block must be buffer-fixed, access block->frame directly. That
is safe, because changes of block->page.state are protected by
the buffer pool mutex, which we are holding.
This bug was reported by Michael.
------------------------------------------------------------------------
r4046 | marko | 2009-01-28 00:33:20 +0200 (Wed, 28 Jan 2009) | 2 lines
branches/zip: Revert the change to univ.i that was accidentally
committed in r4045.
------------------------------------------------------------------------
r4047 | marko | 2009-01-28 00:46:13 +0200 (Wed, 28 Jan 2009) | 6 lines
branches/zip: btr_search_validate(): Fix an assertion failure that was
introduced in r4036.
Do not call buf_block_get_space(), buf_block_get_page_no()
unless the block state is BUF_BLOCK_FILE_PAGE.
This bug was reported by Michael.
------------------------------------------------------------------------
r4050 | vasil | 2009-01-28 08:21:44 +0200 (Wed, 28 Jan 2009) | 5 lines
branches/zip:
Adjust the paths in innodb_lock_wait_timeout.diff with a recent rename of
the test/result files in the MySQL tree.
------------------------------------------------------------------------
r4051 | marko | 2009-01-28 14:35:49 +0200 (Wed, 28 Jan 2009) | 1 line
branches/zip: trx0sys.ic: Remove unnecessary #include <data0type.h>.
------------------------------------------------------------------------
r4052 | marko | 2009-01-28 15:21:45 +0200 (Wed, 28 Jan 2009) | 5 lines
branches/zip: Enclose some functions inside #ifdef UNIV_HOTBACKUP:
ut_sprintf_timestamp_without_extra_chars(), ut_get_year_month_day(),
log_reset_first_header_and_checkpoint(): These functions are only used
in InnoDB Hot Backup.
------------------------------------------------------------------------
r4056 | calvin | 2009-01-29 03:06:41 +0200 (Thu, 29 Jan 2009) | 33 lines
branches/zip: Merge revisions 4032:4035 from branches/5.1
All InnoDB related tests passed on Windows, except
known failure in partition_innodb_semi_consistent.
The inadvertent change to btr0sea.c in this commit is reverted in r4060.
------------------------------------------------------------------------
r4035 | vasil | 2009-01-26 09:26:25 -0600 (Mon, 26 Jan 2009) | 23 lines
branches/5.1:
Merge a change from MySQL:
------------------------------------------------------------
revno: 2646.161.4
committer: Tatiana A. Nurnberg <azundris@mysql.com>
branch nick: 51-31177v2
timestamp: Mon 2009-01-12 06:32:49 +0100
message:
Bug#31177: Server variables can't be set to their current values
Bounds-checks and blocksize corrections were applied to user-input,
but constants in the server were trusted implicitly. If these values
did not actually meet the requirements, the user could not set change
a variable, then set it back to the (wonky) factory default or maximum
by explicitly specifying it (SET <var>=<value> vs SET <var>=DEFAULT).
Now checks also apply to the server's presets. Wonky values and maxima
get corrected at startup. Consequently all non-offsetted values the user
sees are valid, and users can set the variable to that exact value if
they so desire.
------------------------------------------------------------------------
r4060 | marko | 2009-01-29 09:39:04 +0200 (Thu, 29 Jan 2009) | 1 line
branches/zip: btr0sea.c: Revert the inadvertent change made in r4056.
------------------------------------------------------------------------
2009-01-29 09:47:07 +00:00
|
|
|
return(buf_block_get_page_zip(buf_block_align(ptr)));
|
2006-10-12 11:05:22 +00:00
|
|
|
}
|
2006-10-18 11:39:31 +00:00
|
|
|
#endif /* UNIV_DEBUG || UNIV_ZIP_DEBUG */
|
2006-10-12 11:05:22 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
/**************************************************************************
|
|
|
|
Gets the space id, page offset, and byte offset within page of a
|
|
|
|
pointer pointing to a buffer frame containing a file page. */
|
|
|
|
UNIV_INLINE
|
|
|
|
void
|
|
|
|
buf_ptr_get_fsp_addr(
|
|
|
|
/*=================*/
|
2006-10-13 13:03:06 +00:00
|
|
|
const void* ptr, /* in: pointer to a buffer frame */
|
2005-10-27 07:29:40 +00:00
|
|
|
ulint* space, /* out: space id */
|
|
|
|
fil_addr_t* addr) /* out: page offset and byte offset */
|
|
|
|
{
|
2007-10-03 12:22:29 +00:00
|
|
|
const page_t* page = (const page_t*) ut_align_down(ptr,
|
2007-08-01 10:38:07 +00:00
|
|
|
UNIV_PAGE_SIZE);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-10-13 13:03:06 +00:00
|
|
|
*space = mach_read_from_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
|
|
|
|
addr->page = mach_read_from_4(page + FIL_PAGE_OFFSET);
|
2006-10-09 16:22:47 +00:00
|
|
|
addr->boffset = ut_align_offset(ptr, UNIV_PAGE_SIZE);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
Gets the hash value of the page the pointer is pointing to. This can be used
|
|
|
|
in searches in the lock hash table. */
|
|
|
|
UNIV_INLINE
|
|
|
|
ulint
|
2006-10-13 11:55:27 +00:00
|
|
|
buf_block_get_lock_hash_val(
|
2005-10-27 07:29:40 +00:00
|
|
|
/*========================*/
|
2006-10-13 11:55:27 +00:00
|
|
|
/* out: lock hash value */
|
|
|
|
const buf_block_t* block) /* in: block */
|
2005-10-27 07:29:40 +00:00
|
|
|
{
|
|
|
|
return(block->lock_hash_val);
|
|
|
|
}
|
|
|
|
|
2006-08-17 11:57:51 +00:00
|
|
|
/************************************************************************
|
|
|
|
Allocates a buffer block. */
|
|
|
|
UNIV_INLINE
|
|
|
|
buf_block_t*
|
|
|
|
buf_block_alloc(
|
|
|
|
/*============*/
|
2006-12-13 14:58:54 +00:00
|
|
|
/* out, own: the allocated block,
|
|
|
|
in state BUF_BLOCK_MEMORY */
|
2006-08-17 11:57:51 +00:00
|
|
|
ulint zip_size) /* in: compressed page size in bytes,
|
|
|
|
or 0 if uncompressed tablespace */
|
|
|
|
{
|
|
|
|
buf_block_t* block;
|
|
|
|
|
|
|
|
block = buf_LRU_get_free_block(zip_size);
|
|
|
|
|
2006-12-13 14:58:54 +00:00
|
|
|
buf_block_set_state(block, BUF_BLOCK_MEMORY);
|
|
|
|
|
2006-08-17 11:57:51 +00:00
|
|
|
return(block);
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
Frees a buffer block which does not contain a file page. */
|
|
|
|
UNIV_INLINE
|
|
|
|
void
|
|
|
|
buf_block_free(
|
|
|
|
/*===========*/
|
|
|
|
buf_block_t* block) /* in, own: block to be freed */
|
|
|
|
{
|
2008-01-10 09:37:13 +00:00
|
|
|
buf_pool_mutex_enter();
|
2006-08-17 11:57:51 +00:00
|
|
|
|
2006-11-10 11:15:59 +00:00
|
|
|
mutex_enter(&block->mutex);
|
|
|
|
|
2006-11-23 13:26:01 +00:00
|
|
|
ut_a(buf_block_get_state(block) != BUF_BLOCK_FILE_PAGE);
|
2006-11-10 11:15:59 +00:00
|
|
|
|
2006-08-17 11:57:51 +00:00
|
|
|
buf_LRU_block_free_non_file_page(block);
|
|
|
|
|
2006-11-10 11:15:59 +00:00
|
|
|
mutex_exit(&block->mutex);
|
|
|
|
|
2008-01-10 09:37:13 +00:00
|
|
|
buf_pool_mutex_exit();
|
2006-08-17 11:57:51 +00:00
|
|
|
}
|
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
/*************************************************************************
|
|
|
|
Copies contents of a buffer frame to a given buffer. */
|
|
|
|
UNIV_INLINE
|
|
|
|
byte*
|
|
|
|
buf_frame_copy(
|
|
|
|
/*===========*/
|
2006-10-18 11:39:31 +00:00
|
|
|
/* out: buf */
|
|
|
|
byte* buf, /* in: buffer to copy to */
|
|
|
|
const buf_frame_t* frame) /* in: buffer frame */
|
2005-10-27 07:29:40 +00:00
|
|
|
{
|
|
|
|
ut_ad(buf && frame);
|
|
|
|
|
|
|
|
ut_memcpy(buf, frame, UNIV_PAGE_SIZE);
|
|
|
|
|
|
|
|
return(buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
Calculates a folded value of a file page address to use in the page hash
|
|
|
|
table. */
|
|
|
|
UNIV_INLINE
|
|
|
|
ulint
|
|
|
|
buf_page_address_fold(
|
|
|
|
/*==================*/
|
|
|
|
/* out: the folded value */
|
|
|
|
ulint space, /* in: space id */
|
|
|
|
ulint offset) /* in: offset of the page within space */
|
|
|
|
{
|
|
|
|
return((space << 20) + space + offset);
|
2006-02-23 19:25:29 +00:00
|
|
|
}
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
This function is used to get info if there is an io operation
|
|
|
|
going on on a buffer page. */
|
|
|
|
UNIV_INLINE
|
|
|
|
ibool
|
|
|
|
buf_page_io_query(
|
|
|
|
/*==============*/
|
|
|
|
/* out: TRUE if io going on */
|
2006-11-30 12:27:49 +00:00
|
|
|
buf_page_t* bpage) /* in: buf_pool block, must be bufferfixed */
|
2005-10-27 07:29:40 +00:00
|
|
|
{
|
2007-05-06 12:30:10 +00:00
|
|
|
ibool io_fixed;
|
|
|
|
|
2008-01-10 09:37:13 +00:00
|
|
|
buf_pool_mutex_enter();
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-11-30 12:27:49 +00:00
|
|
|
ut_ad(buf_page_in_file(bpage));
|
|
|
|
ut_ad(bpage->buf_fix_count > 0);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2007-05-06 12:30:10 +00:00
|
|
|
io_fixed = buf_page_get_io_fix(bpage) != BUF_IO_NONE;
|
2008-01-10 09:37:13 +00:00
|
|
|
buf_pool_mutex_exit();
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2007-05-06 12:30:10 +00:00
|
|
|
return(io_fixed);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
2006-11-24 13:05:01 +00:00
|
|
|
Gets the youngest modification log sequence number for a frame.
|
|
|
|
Returns zero if not file page or no modification occurred yet. */
|
2005-10-27 07:29:40 +00:00
|
|
|
UNIV_INLINE
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t
|
2006-11-30 15:09:33 +00:00
|
|
|
buf_page_get_newest_modification(
|
|
|
|
/*=============================*/
|
|
|
|
/* out: newest modification to page */
|
|
|
|
const buf_page_t* bpage) /* in: block containing the
|
|
|
|
page frame */
|
2005-10-27 07:29:40 +00:00
|
|
|
{
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t lsn;
|
branches/innodb+: Merge revisions 3602:3931 from branches/zip:
------------------------------------------------------------------------
r3607 | marko | 2008-12-30 22:33:31 +0200 (Tue, 30 Dec 2008) | 20 lines
branches/zip: Remove the dependency on the MySQL HASH table implementation.
Use the InnoDB hash table for keeping track of INNOBASE_SHARE objects.
struct st_innobase_share: Make table_name const uchar*. Add the member
table_name_hash.
innobase_open_tables: Change the type from HASH to hash_table_t*.
innobase_get_key(): Remove.
innobase_fold_name(): New function, for computing the fold value for the
InnoDB hash table.
get_share(), free_share(): Use the InnoDB hash functions.
innobase_end(): Free innobase_open_tables before shutting down InnoDB.
Shutting down InnoDB will invalidate all memory allocated via InnoDB.
rb://65 approved by Heikki Tuuri. This addresses Issue #104.
------------------------------------------------------------------------
r3608 | marko | 2008-12-30 22:45:04 +0200 (Tue, 30 Dec 2008) | 22 lines
branches/zip: When setting the PAGE_LEVEL of a compressed B-tree page
from or to 0, compress the page at the same time. This is necessary,
because the column information stored on the compressed page will
differ between leaf and non-leaf pages. Leaf pages are identified by
PAGE_LEVEL=0. This bug was reported as Issue #150.
Document the similarity between btr_page_create() and
btr_page_empty(). Make the function signature of btr_page_empty()
identical with btr_page_create(). (This will add the parameter "level".)
btr_root_raise_and_insert(): Replace some code with a call to
btr_page_empty().
btr_attach_half_pages(): Assert that the page level has already been
set on both block and new_block. Do not set it again.
btr_discard_only_page_on_level(): Document that this function is
probably never called. Make it work on any height tree. (Tested on
2-high tree by disabling btr_lift_page_up().)
rb://68
------------------------------------------------------------------------
r3612 | marko | 2009-01-02 11:02:44 +0200 (Fri, 02 Jan 2009) | 14 lines
branches/zip: Merge c2998 from branches/6.0, so that the same InnoDB Plugin
source tree will work both under 5.1 and 6.0. Do not add the test case
innodb_ctype_ldml.test, because it would not work under MySQL 5.1.
Refuse to create tables whose columns contain collation IDs above 255.
This removes an assertion failure that was introduced in WL#4164
(Two-byte collation IDs).
create_table_def(): Do not fail an assertion if a column contains a
charset-collation ID greater than 256. Instead, issue an error and
refuse to create the table.
The original change (branches/6.0 r2998) was rb://51 approved by Calvin Sun.
------------------------------------------------------------------------
r3613 | inaam | 2009-01-02 15:10:50 +0200 (Fri, 02 Jan 2009) | 6 lines
branches/zip: Implement the parameter innodb_use_sys_malloc
(false by default), for disabling InnoDB's internal memory allocator
and using system malloc/free instead.
rb://62 approved by Marko
------------------------------------------------------------------------
r3614 | marko | 2009-01-02 15:55:12 +0200 (Fri, 02 Jan 2009) | 1 line
branches/zip: ChangeLog: Document r3608 and r3613.
------------------------------------------------------------------------
r3615 | marko | 2009-01-02 15:57:51 +0200 (Fri, 02 Jan 2009) | 1 line
branches/zip: ChangeLog: Clarify the impact of r3608.
------------------------------------------------------------------------
r3616 | marko | 2009-01-03 00:23:30 +0200 (Sat, 03 Jan 2009) | 1 line
branches/zip: srv_suspend_mysql_thread(): Add some clarifying comments.
------------------------------------------------------------------------
r3618 | marko | 2009-01-05 12:54:53 +0200 (Mon, 05 Jan 2009) | 15 lines
branches/zip: Merge revisions 3598:3601 from branches/5.1:
------------------------------------------------------------------------
r3601 | marko | 2008-12-22 16:05:19 +0200 (Mon, 22 Dec 2008) | 9 lines
branches/5.1: Make
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED
a true replacement of SET GLOBAL INNODB_LOCKS_UNSAFE_FOR_BINLOG=1.
This fixes an error that was introduced in r370, causing
semi-consistent read not to not unlock rows in READ COMMITTED mode.
(Bug #41671, Issue #146)
rb://67 approved by Heikki Tuuri
------------------------------------------------------------------------
------------------------------------------------------------------------
r3623 | vasil | 2009-01-06 09:56:32 +0200 (Tue, 06 Jan 2009) | 7 lines
branches/zip:
Add patch to fix the failing main.variables mysql-test. It started failing
after the variable innodb_use_sys_malloc was added because it matches
'%alloc%' and the test is badly written and expects that no new variables
like that will ever be added.
------------------------------------------------------------------------
r3795 | marko | 2009-01-07 16:17:47 +0200 (Wed, 07 Jan 2009) | 7 lines
branches/zip: row_merge_tuple_cmp(): Do not report a duplicate key value
if any of the fields are NULL. While the tuples are equal in the
sorting order, SQL NULL is defined to be logically inequal to
anything else. (Bug #41904)
rb://70 approved by Heikki Tuuri
------------------------------------------------------------------------
r3796 | marko | 2009-01-07 16:19:32 +0200 (Wed, 07 Jan 2009) | 1 line
branches/zip: Add the tests that were forgotten from r3795.
------------------------------------------------------------------------
r3797 | marko | 2009-01-07 16:22:18 +0200 (Wed, 07 Jan 2009) | 22 lines
branches/zip: Do not call trx_allocate_for_mysql() directly, but use
helper functions that initialize some members of the transaction struct.
(Bug #41680)
innobase_trx_init(): New function: initialize some fields of a
transaction struct from a MySQL THD object.
innobase_trx_allocate(): New function: allocate and initialize a
transaction struct.
check_trx_exists(): Use the above two functions.
ha_innobase::delete_table(), ha_innobase::rename_table(),
ha_innobase::add_index(), ha_innobase::final_drop_index():
Use innobase_trx_allocate().
innobase_drop_database(): In the Windows plugin, initialize the trx_t
specially, because the THD is not available. Otherwise, use
innobase_trx_allocate().
rb://69 accepted by Heikki Tuuri
------------------------------------------------------------------------
r3798 | marko | 2009-01-07 16:42:42 +0200 (Wed, 07 Jan 2009) | 8 lines
branches/zip: row_merge_drop_temp_indexes(): Do not lock the rows of
SYS_INDEXES when looking for partially created indexes. Use the
transaction isolation level READ UNCOMMITTED to avoid interfering with
locks held by incomplete transactions that will be rolled back in a
subsequent step in the recovery. (Issue #152)
Approved by Heikki Tuuri
------------------------------------------------------------------------
r3852 | vasil | 2009-01-08 22:10:10 +0200 (Thu, 08 Jan 2009) | 4 lines
branches/zip:
Add ChangeLog entries for r3795 r3796 r3797 r3798.
------------------------------------------------------------------------
r3866 | marko | 2009-01-09 15:09:51 +0200 (Fri, 09 Jan 2009) | 2 lines
branches/zip: buf_flush_try_page(): Move some common code from each
switch case before the switch block.
------------------------------------------------------------------------
r3867 | marko | 2009-01-09 15:13:14 +0200 (Fri, 09 Jan 2009) | 2 lines
branches/zip: buf_flush_try_page(): Introduce the variable is_compressed
for caching the result of buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE.
------------------------------------------------------------------------
r3868 | marko | 2009-01-09 15:40:11 +0200 (Fri, 09 Jan 2009) | 4 lines
branches/zip: buf_flush_insert_into_flush_list(),
buf_flush_insert_sorted_into_flush_list(): Remove unused code.
Change the parameter to buf_block_t* block and assert that
block->state == BUF_BLOCK_FILE_PAGE. This is part of Issue #155.
------------------------------------------------------------------------
r3873 | marko | 2009-01-09 22:27:40 +0200 (Fri, 09 Jan 2009) | 17 lines
branches/zip: Some non-functional changes related to Issue #155.
buf_page_struct: Note that space and offset are also protected by
buf_pool_mutex. They are only assigned to by
buf_block_set_file_page(). Thus, it suffices for buf_flush_batch() to
hold just buf_pool_mutex when checking these fields.
buf_flush_try_page(): Rename "locked" to "is_s_latched", per Heikki's request.
buf_flush_batch(): Move the common statement mutex_exit(block_mutex)
from all if-else if-else branches before the if block. Remove the
redundant test (buf_pool->init_flush[flush_type] == FALSE) that was
apparently copied from buf_flush_write_complete().
buf_flush_write_block_low(): Note why it is safe not to hold buf_pool_mutex
or block_mutex. Enumerate the assumptions in debug assertions.
------------------------------------------------------------------------
r3874 | marko | 2009-01-09 23:09:06 +0200 (Fri, 09 Jan 2009) | 4 lines
branches/zip: Add comments related to Issue #155.
buf_flush_try_page(): Note why it is safe to access bpage without
holding buf_pool_mutex or block_mutex.
------------------------------------------------------------------------
r3875 | marko | 2009-01-09 23:15:12 +0200 (Fri, 09 Jan 2009) | 11 lines
branches/zip: Non-functional change: Tighten debug assertions and
remove dead code.
buf_flush_ready_for_flush(), buf_flush_try_page(): Assert that
flush_type is one of BUF_FLUSH_LRU or BUF_FLUSH_LIST. The flush_type
comes from buf_flush_batch(), which already asserts this. The
assertion holds for all calls in the source code.
buf_flush_try_page(): Remove the dead case BUF_FLUSH_SINGLE_PAGE
of switch (flush_type).
------------------------------------------------------------------------
r3879 | marko | 2009-01-12 12:46:44 +0200 (Mon, 12 Jan 2009) | 14 lines
branches/zip: Simplify the flushing of dirty pages from the buffer pool.
buf_flush_try_page(): Rename to buf_flush_page(), and change the
return type to void. Replace the parameters space, offset with bpage,
and remove the second page hash lookup. Note and assert that both
buf_pool_mutex and block_mutex must now be held upon entering the
function. They will still be released by this function.
buf_flush_try_neighbors(): Replace buf_flush_try_page() with
buf_flush_page(). Make the logic easier to follow by not negating the
precondition of buf_flush_page().
rb://73 approved by Sunny Bains. This is related to Issue #157.
------------------------------------------------------------------------
r3880 | marko | 2009-01-12 13:24:37 +0200 (Mon, 12 Jan 2009) | 2 lines
branches/zip: buf_flush_page(): Fix a comment that should have been fixed
in r3879. Spotted by Sunny.
------------------------------------------------------------------------
r3881 | marko | 2009-01-12 14:25:22 +0200 (Mon, 12 Jan 2009) | 2 lines
branches/zip: buf_page_get_newest_modification(): Use the block mutex
instead of the buffer pool mutex. This is related to Issue #157.
------------------------------------------------------------------------
r3882 | marko | 2009-01-12 14:40:08 +0200 (Mon, 12 Jan 2009) | 3 lines
branches/zip: struct mtr_struct: Remove the unused field magic_n
unless UNIV_DEBUG is defined. mtr->magic_n is only assigned to
and checked in UNIV_DEBUG builds.
------------------------------------------------------------------------
r3883 | marko | 2009-01-12 14:48:59 +0200 (Mon, 12 Jan 2009) | 1 line
branches/zip: Non-functional change: Use ut_d when assigning to mtr->state.
------------------------------------------------------------------------
r3884 | marko | 2009-01-12 18:56:11 +0200 (Mon, 12 Jan 2009) | 16 lines
branches/zip: Non-functional change: Add some debug assertions and comments.
buf_page_t: Note that the LRU fields are protected by buf_pool_mutex
only, not block->mutex or buf_pool_zip_mutex.
buf_page_get_freed_page_clock(): Note that this is sometimes invoked
without mutex protection.
buf_pool_get_oldest_modification(): Note that the result may be out of
date.
buf_page_get_LRU_position(), buf_page_is_old(): Assert that the buffer
pool mutex is being held.
buf_page_release(): Assert that dirty blocks are in the flush list.
------------------------------------------------------------------------
r3896 | marko | 2009-01-13 09:30:26 +0200 (Tue, 13 Jan 2009) | 2 lines
branches/zip: buf_flush_try_neighbors(): Fix a bug
that was introduced in r3879 (rb://73).
------------------------------------------------------------------------
r3900 | marko | 2009-01-13 10:32:24 +0200 (Tue, 13 Jan 2009) | 1 line
branches/zip: Fix some comments to say buf_pool_mutex.
------------------------------------------------------------------------
r3907 | marko | 2009-01-13 11:54:01 +0200 (Tue, 13 Jan 2009) | 3 lines
branches/zip: row_merge_create_temporary_table(): On error,
row_create_table_for_mysql() already frees new_table.
Do not attempt to free it again.
------------------------------------------------------------------------
r3908 | marko | 2009-01-13 12:34:32 +0200 (Tue, 13 Jan 2009) | 1 line
branches/zip: Enable HASH_ASSERT_OWNED independently of UNIV_SYNC_DEBUG.
------------------------------------------------------------------------
r3914 | marko | 2009-01-13 21:46:22 +0200 (Tue, 13 Jan 2009) | 37 lines
branches/zip: In hash table lookups, assert that the traversed items
satisfy some conditions when UNIV_DEBUG is defined.
HASH_SEARCH(): New parameter: ASSERTION. All users will pass an appropriate
ut_ad() or nothing.
dict_table_add_to_columns(): Assert that the table being added to the data
dictionary cache is not already being pointed to by the name_hash and
id_hash tables.
HASH_SEARCH_ALL(): New macro, for use in dict_table_add_to_columns().
dict_mem_table_free(): Set ut_d(table->cached = FALSE), so that we can
check ut_ad(table->cached) when traversing the hash tables, as in
HASH_SEARCH(name_hash, dict_sys->table_hash, ...) and
HASH_SEARCH(id_hash, dict_sys->table_id_hash, ...).
dict_table_get_low(), dict_table_get_on_id_low(): Assert
ut_ad(!table || table->cached).
fil_space_get_by_id(): Check ut_ad(space->magic_n == FIL_SPACE_MAGIC_N)
in HASH_SEARCH(hash, fil_system->spaces, ...).
fil_space_get_by_name(): Check ut_ad(space->magic_n == FIL_SPACE_MAGIC_N)
in HASH_SEARCH(name_hash, fil_system->name_hash, ...).
buf_buddy_block_free(): Check that the blocks are in valid state in
HASH_SEARCH(hash, buf_pool->zip_hash, ...).
buf_page_hash_get(): Check that the blocks are in valid state in
HASH_SEARCH(hash, buf_pool->page_hash, ...).
get_share(), free_share(): Check ut_ad(share->use_count > 0) in
HASH_SEARCH(table_name_hash, innobase_open_tables, ...).
This was posted as rb://75 for tracking down errors similar to Issue #153.
------------------------------------------------------------------------
r3931 | marko | 2009-01-14 16:06:22 +0200 (Wed, 14 Jan 2009) | 26 lines
branches/zip: Merge revisions 3601:3930 from branches/5.1:
------------------------------------------------------------------------
r3911 | sunny | 2009-01-13 14:15:24 +0200 (Tue, 13 Jan 2009) | 13 lines
branches/5.1: Fix Bug#38187 Error 153 when creating savepoints
InnoDB previously treated savepoints as a stack e.g.,
SAVEPOINT a;
SAVEPOINT b;
SAVEPOINT c;
SAVEPOINT b; <- This would delete b and c.
This fix changes the behavior to:
SAVEPOINT a;
SAVEPOINT b;
SAVEPOINT c;
SAVEPOINT b; <- Does not delete savepoint c
------------------------------------------------------------------------
r3930 | marko | 2009-01-14 15:51:30 +0200 (Wed, 14 Jan 2009) | 4 lines
branches/5.1: dict_load_table(): If dict_load_indexes() fails,
invoke dict_table_remove_from_cache() instead of dict_mem_table_free(),
so that the data dictionary will not point to freed data.
(Bug #42075, Issue #153, rb://76 approved by Heikki Tuuri)
------------------------------------------------------------------------
------------------------------------------------------------------------
2009-01-14 14:25:45 +00:00
|
|
|
mutex_t* block_mutex = buf_page_get_mutex(bpage);
|
2006-02-23 19:25:29 +00:00
|
|
|
|
branches/innodb+: Merge revisions 3602:3931 from branches/zip:
------------------------------------------------------------------------
r3607 | marko | 2008-12-30 22:33:31 +0200 (Tue, 30 Dec 2008) | 20 lines
branches/zip: Remove the dependency on the MySQL HASH table implementation.
Use the InnoDB hash table for keeping track of INNOBASE_SHARE objects.
struct st_innobase_share: Make table_name const uchar*. Add the member
table_name_hash.
innobase_open_tables: Change the type from HASH to hash_table_t*.
innobase_get_key(): Remove.
innobase_fold_name(): New function, for computing the fold value for the
InnoDB hash table.
get_share(), free_share(): Use the InnoDB hash functions.
innobase_end(): Free innobase_open_tables before shutting down InnoDB.
Shutting down InnoDB will invalidate all memory allocated via InnoDB.
rb://65 approved by Heikki Tuuri. This addresses Issue #104.
------------------------------------------------------------------------
r3608 | marko | 2008-12-30 22:45:04 +0200 (Tue, 30 Dec 2008) | 22 lines
branches/zip: When setting the PAGE_LEVEL of a compressed B-tree page
from or to 0, compress the page at the same time. This is necessary,
because the column information stored on the compressed page will
differ between leaf and non-leaf pages. Leaf pages are identified by
PAGE_LEVEL=0. This bug was reported as Issue #150.
Document the similarity between btr_page_create() and
btr_page_empty(). Make the function signature of btr_page_empty()
identical with btr_page_create(). (This will add the parameter "level".)
btr_root_raise_and_insert(): Replace some code with a call to
btr_page_empty().
btr_attach_half_pages(): Assert that the page level has already been
set on both block and new_block. Do not set it again.
btr_discard_only_page_on_level(): Document that this function is
probably never called. Make it work on any height tree. (Tested on
2-high tree by disabling btr_lift_page_up().)
rb://68
------------------------------------------------------------------------
r3612 | marko | 2009-01-02 11:02:44 +0200 (Fri, 02 Jan 2009) | 14 lines
branches/zip: Merge c2998 from branches/6.0, so that the same InnoDB Plugin
source tree will work both under 5.1 and 6.0. Do not add the test case
innodb_ctype_ldml.test, because it would not work under MySQL 5.1.
Refuse to create tables whose columns contain collation IDs above 255.
This removes an assertion failure that was introduced in WL#4164
(Two-byte collation IDs).
create_table_def(): Do not fail an assertion if a column contains a
charset-collation ID greater than 256. Instead, issue an error and
refuse to create the table.
The original change (branches/6.0 r2998) was rb://51 approved by Calvin Sun.
------------------------------------------------------------------------
r3613 | inaam | 2009-01-02 15:10:50 +0200 (Fri, 02 Jan 2009) | 6 lines
branches/zip: Implement the parameter innodb_use_sys_malloc
(false by default), for disabling InnoDB's internal memory allocator
and using system malloc/free instead.
rb://62 approved by Marko
------------------------------------------------------------------------
r3614 | marko | 2009-01-02 15:55:12 +0200 (Fri, 02 Jan 2009) | 1 line
branches/zip: ChangeLog: Document r3608 and r3613.
------------------------------------------------------------------------
r3615 | marko | 2009-01-02 15:57:51 +0200 (Fri, 02 Jan 2009) | 1 line
branches/zip: ChangeLog: Clarify the impact of r3608.
------------------------------------------------------------------------
r3616 | marko | 2009-01-03 00:23:30 +0200 (Sat, 03 Jan 2009) | 1 line
branches/zip: srv_suspend_mysql_thread(): Add some clarifying comments.
------------------------------------------------------------------------
r3618 | marko | 2009-01-05 12:54:53 +0200 (Mon, 05 Jan 2009) | 15 lines
branches/zip: Merge revisions 3598:3601 from branches/5.1:
------------------------------------------------------------------------
r3601 | marko | 2008-12-22 16:05:19 +0200 (Mon, 22 Dec 2008) | 9 lines
branches/5.1: Make
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED
a true replacement of SET GLOBAL INNODB_LOCKS_UNSAFE_FOR_BINLOG=1.
This fixes an error that was introduced in r370, causing
semi-consistent read not to not unlock rows in READ COMMITTED mode.
(Bug #41671, Issue #146)
rb://67 approved by Heikki Tuuri
------------------------------------------------------------------------
------------------------------------------------------------------------
r3623 | vasil | 2009-01-06 09:56:32 +0200 (Tue, 06 Jan 2009) | 7 lines
branches/zip:
Add patch to fix the failing main.variables mysql-test. It started failing
after the variable innodb_use_sys_malloc was added because it matches
'%alloc%' and the test is badly written and expects that no new variables
like that will ever be added.
------------------------------------------------------------------------
r3795 | marko | 2009-01-07 16:17:47 +0200 (Wed, 07 Jan 2009) | 7 lines
branches/zip: row_merge_tuple_cmp(): Do not report a duplicate key value
if any of the fields are NULL. While the tuples are equal in the
sorting order, SQL NULL is defined to be logically inequal to
anything else. (Bug #41904)
rb://70 approved by Heikki Tuuri
------------------------------------------------------------------------
r3796 | marko | 2009-01-07 16:19:32 +0200 (Wed, 07 Jan 2009) | 1 line
branches/zip: Add the tests that were forgotten from r3795.
------------------------------------------------------------------------
r3797 | marko | 2009-01-07 16:22:18 +0200 (Wed, 07 Jan 2009) | 22 lines
branches/zip: Do not call trx_allocate_for_mysql() directly, but use
helper functions that initialize some members of the transaction struct.
(Bug #41680)
innobase_trx_init(): New function: initialize some fields of a
transaction struct from a MySQL THD object.
innobase_trx_allocate(): New function: allocate and initialize a
transaction struct.
check_trx_exists(): Use the above two functions.
ha_innobase::delete_table(), ha_innobase::rename_table(),
ha_innobase::add_index(), ha_innobase::final_drop_index():
Use innobase_trx_allocate().
innobase_drop_database(): In the Windows plugin, initialize the trx_t
specially, because the THD is not available. Otherwise, use
innobase_trx_allocate().
rb://69 accepted by Heikki Tuuri
------------------------------------------------------------------------
r3798 | marko | 2009-01-07 16:42:42 +0200 (Wed, 07 Jan 2009) | 8 lines
branches/zip: row_merge_drop_temp_indexes(): Do not lock the rows of
SYS_INDEXES when looking for partially created indexes. Use the
transaction isolation level READ UNCOMMITTED to avoid interfering with
locks held by incomplete transactions that will be rolled back in a
subsequent step in the recovery. (Issue #152)
Approved by Heikki Tuuri
------------------------------------------------------------------------
r3852 | vasil | 2009-01-08 22:10:10 +0200 (Thu, 08 Jan 2009) | 4 lines
branches/zip:
Add ChangeLog entries for r3795 r3796 r3797 r3798.
------------------------------------------------------------------------
r3866 | marko | 2009-01-09 15:09:51 +0200 (Fri, 09 Jan 2009) | 2 lines
branches/zip: buf_flush_try_page(): Move some common code from each
switch case before the switch block.
------------------------------------------------------------------------
r3867 | marko | 2009-01-09 15:13:14 +0200 (Fri, 09 Jan 2009) | 2 lines
branches/zip: buf_flush_try_page(): Introduce the variable is_compressed
for caching the result of buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE.
------------------------------------------------------------------------
r3868 | marko | 2009-01-09 15:40:11 +0200 (Fri, 09 Jan 2009) | 4 lines
branches/zip: buf_flush_insert_into_flush_list(),
buf_flush_insert_sorted_into_flush_list(): Remove unused code.
Change the parameter to buf_block_t* block and assert that
block->state == BUF_BLOCK_FILE_PAGE. This is part of Issue #155.
------------------------------------------------------------------------
r3873 | marko | 2009-01-09 22:27:40 +0200 (Fri, 09 Jan 2009) | 17 lines
branches/zip: Some non-functional changes related to Issue #155.
buf_page_struct: Note that space and offset are also protected by
buf_pool_mutex. They are only assigned to by
buf_block_set_file_page(). Thus, it suffices for buf_flush_batch() to
hold just buf_pool_mutex when checking these fields.
buf_flush_try_page(): Rename "locked" to "is_s_latched", per Heikki's request.
buf_flush_batch(): Move the common statement mutex_exit(block_mutex)
from all if-else if-else branches before the if block. Remove the
redundant test (buf_pool->init_flush[flush_type] == FALSE) that was
apparently copied from buf_flush_write_complete().
buf_flush_write_block_low(): Note why it is safe not to hold buf_pool_mutex
or block_mutex. Enumerate the assumptions in debug assertions.
------------------------------------------------------------------------
r3874 | marko | 2009-01-09 23:09:06 +0200 (Fri, 09 Jan 2009) | 4 lines
branches/zip: Add comments related to Issue #155.
buf_flush_try_page(): Note why it is safe to access bpage without
holding buf_pool_mutex or block_mutex.
------------------------------------------------------------------------
r3875 | marko | 2009-01-09 23:15:12 +0200 (Fri, 09 Jan 2009) | 11 lines
branches/zip: Non-functional change: Tighten debug assertions and
remove dead code.
buf_flush_ready_for_flush(), buf_flush_try_page(): Assert that
flush_type is one of BUF_FLUSH_LRU or BUF_FLUSH_LIST. The flush_type
comes from buf_flush_batch(), which already asserts this. The
assertion holds for all calls in the source code.
buf_flush_try_page(): Remove the dead case BUF_FLUSH_SINGLE_PAGE
of switch (flush_type).
------------------------------------------------------------------------
r3879 | marko | 2009-01-12 12:46:44 +0200 (Mon, 12 Jan 2009) | 14 lines
branches/zip: Simplify the flushing of dirty pages from the buffer pool.
buf_flush_try_page(): Rename to buf_flush_page(), and change the
return type to void. Replace the parameters space, offset with bpage,
and remove the second page hash lookup. Note and assert that both
buf_pool_mutex and block_mutex must now be held upon entering the
function. They will still be released by this function.
buf_flush_try_neighbors(): Replace buf_flush_try_page() with
buf_flush_page(). Make the logic easier to follow by not negating the
precondition of buf_flush_page().
rb://73 approved by Sunny Bains. This is related to Issue #157.
------------------------------------------------------------------------
r3880 | marko | 2009-01-12 13:24:37 +0200 (Mon, 12 Jan 2009) | 2 lines
branches/zip: buf_flush_page(): Fix a comment that should have been fixed
in r3879. Spotted by Sunny.
------------------------------------------------------------------------
r3881 | marko | 2009-01-12 14:25:22 +0200 (Mon, 12 Jan 2009) | 2 lines
branches/zip: buf_page_get_newest_modification(): Use the block mutex
instead of the buffer pool mutex. This is related to Issue #157.
------------------------------------------------------------------------
r3882 | marko | 2009-01-12 14:40:08 +0200 (Mon, 12 Jan 2009) | 3 lines
branches/zip: struct mtr_struct: Remove the unused field magic_n
unless UNIV_DEBUG is defined. mtr->magic_n is only assigned to
and checked in UNIV_DEBUG builds.
------------------------------------------------------------------------
r3883 | marko | 2009-01-12 14:48:59 +0200 (Mon, 12 Jan 2009) | 1 line
branches/zip: Non-functional change: Use ut_d when assigning to mtr->state.
------------------------------------------------------------------------
r3884 | marko | 2009-01-12 18:56:11 +0200 (Mon, 12 Jan 2009) | 16 lines
branches/zip: Non-functional change: Add some debug assertions and comments.
buf_page_t: Note that the LRU fields are protected by buf_pool_mutex
only, not block->mutex or buf_pool_zip_mutex.
buf_page_get_freed_page_clock(): Note that this is sometimes invoked
without mutex protection.
buf_pool_get_oldest_modification(): Note that the result may be out of
date.
buf_page_get_LRU_position(), buf_page_is_old(): Assert that the buffer
pool mutex is being held.
buf_page_release(): Assert that dirty blocks are in the flush list.
------------------------------------------------------------------------
r3896 | marko | 2009-01-13 09:30:26 +0200 (Tue, 13 Jan 2009) | 2 lines
branches/zip: buf_flush_try_neighbors(): Fix a bug
that was introduced in r3879 (rb://73).
------------------------------------------------------------------------
r3900 | marko | 2009-01-13 10:32:24 +0200 (Tue, 13 Jan 2009) | 1 line
branches/zip: Fix some comments to say buf_pool_mutex.
------------------------------------------------------------------------
r3907 | marko | 2009-01-13 11:54:01 +0200 (Tue, 13 Jan 2009) | 3 lines
branches/zip: row_merge_create_temporary_table(): On error,
row_create_table_for_mysql() already frees new_table.
Do not attempt to free it again.
------------------------------------------------------------------------
r3908 | marko | 2009-01-13 12:34:32 +0200 (Tue, 13 Jan 2009) | 1 line
branches/zip: Enable HASH_ASSERT_OWNED independently of UNIV_SYNC_DEBUG.
------------------------------------------------------------------------
r3914 | marko | 2009-01-13 21:46:22 +0200 (Tue, 13 Jan 2009) | 37 lines
branches/zip: In hash table lookups, assert that the traversed items
satisfy some conditions when UNIV_DEBUG is defined.
HASH_SEARCH(): New parameter: ASSERTION. All users will pass an appropriate
ut_ad() or nothing.
dict_table_add_to_columns(): Assert that the table being added to the data
dictionary cache is not already being pointed to by the name_hash and
id_hash tables.
HASH_SEARCH_ALL(): New macro, for use in dict_table_add_to_columns().
dict_mem_table_free(): Set ut_d(table->cached = FALSE), so that we can
check ut_ad(table->cached) when traversing the hash tables, as in
HASH_SEARCH(name_hash, dict_sys->table_hash, ...) and
HASH_SEARCH(id_hash, dict_sys->table_id_hash, ...).
dict_table_get_low(), dict_table_get_on_id_low(): Assert
ut_ad(!table || table->cached).
fil_space_get_by_id(): Check ut_ad(space->magic_n == FIL_SPACE_MAGIC_N)
in HASH_SEARCH(hash, fil_system->spaces, ...).
fil_space_get_by_name(): Check ut_ad(space->magic_n == FIL_SPACE_MAGIC_N)
in HASH_SEARCH(name_hash, fil_system->name_hash, ...).
buf_buddy_block_free(): Check that the blocks are in valid state in
HASH_SEARCH(hash, buf_pool->zip_hash, ...).
buf_page_hash_get(): Check that the blocks are in valid state in
HASH_SEARCH(hash, buf_pool->page_hash, ...).
get_share(), free_share(): Check ut_ad(share->use_count > 0) in
HASH_SEARCH(table_name_hash, innobase_open_tables, ...).
This was posted as rb://75 for tracking down errors similar to Issue #153.
------------------------------------------------------------------------
r3931 | marko | 2009-01-14 16:06:22 +0200 (Wed, 14 Jan 2009) | 26 lines
branches/zip: Merge revisions 3601:3930 from branches/5.1:
------------------------------------------------------------------------
r3911 | sunny | 2009-01-13 14:15:24 +0200 (Tue, 13 Jan 2009) | 13 lines
branches/5.1: Fix Bug#38187 Error 153 when creating savepoints
InnoDB previously treated savepoints as a stack e.g.,
SAVEPOINT a;
SAVEPOINT b;
SAVEPOINT c;
SAVEPOINT b; <- This would delete b and c.
This fix changes the behavior to:
SAVEPOINT a;
SAVEPOINT b;
SAVEPOINT c;
SAVEPOINT b; <- Does not delete savepoint c
------------------------------------------------------------------------
r3930 | marko | 2009-01-14 15:51:30 +0200 (Wed, 14 Jan 2009) | 4 lines
branches/5.1: dict_load_table(): If dict_load_indexes() fails,
invoke dict_table_remove_from_cache() instead of dict_mem_table_free(),
so that the data dictionary will not point to freed data.
(Bug #42075, Issue #153, rb://76 approved by Heikki Tuuri)
------------------------------------------------------------------------
------------------------------------------------------------------------
2009-01-14 14:25:45 +00:00
|
|
|
mutex_enter(block_mutex);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-11-30 15:09:33 +00:00
|
|
|
if (buf_page_in_file(bpage)) {
|
|
|
|
lsn = bpage->newest_modification;
|
2005-10-27 07:29:40 +00:00
|
|
|
} else {
|
2006-11-24 13:05:01 +00:00
|
|
|
lsn = 0;
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
branches/innodb+: Merge revisions 3602:3931 from branches/zip:
------------------------------------------------------------------------
r3607 | marko | 2008-12-30 22:33:31 +0200 (Tue, 30 Dec 2008) | 20 lines
branches/zip: Remove the dependency on the MySQL HASH table implementation.
Use the InnoDB hash table for keeping track of INNOBASE_SHARE objects.
struct st_innobase_share: Make table_name const uchar*. Add the member
table_name_hash.
innobase_open_tables: Change the type from HASH to hash_table_t*.
innobase_get_key(): Remove.
innobase_fold_name(): New function, for computing the fold value for the
InnoDB hash table.
get_share(), free_share(): Use the InnoDB hash functions.
innobase_end(): Free innobase_open_tables before shutting down InnoDB.
Shutting down InnoDB will invalidate all memory allocated via InnoDB.
rb://65 approved by Heikki Tuuri. This addresses Issue #104.
------------------------------------------------------------------------
r3608 | marko | 2008-12-30 22:45:04 +0200 (Tue, 30 Dec 2008) | 22 lines
branches/zip: When setting the PAGE_LEVEL of a compressed B-tree page
from or to 0, compress the page at the same time. This is necessary,
because the column information stored on the compressed page will
differ between leaf and non-leaf pages. Leaf pages are identified by
PAGE_LEVEL=0. This bug was reported as Issue #150.
Document the similarity between btr_page_create() and
btr_page_empty(). Make the function signature of btr_page_empty()
identical with btr_page_create(). (This will add the parameter "level".)
btr_root_raise_and_insert(): Replace some code with a call to
btr_page_empty().
btr_attach_half_pages(): Assert that the page level has already been
set on both block and new_block. Do not set it again.
btr_discard_only_page_on_level(): Document that this function is
probably never called. Make it work on any height tree. (Tested on
2-high tree by disabling btr_lift_page_up().)
rb://68
------------------------------------------------------------------------
r3612 | marko | 2009-01-02 11:02:44 +0200 (Fri, 02 Jan 2009) | 14 lines
branches/zip: Merge c2998 from branches/6.0, so that the same InnoDB Plugin
source tree will work both under 5.1 and 6.0. Do not add the test case
innodb_ctype_ldml.test, because it would not work under MySQL 5.1.
Refuse to create tables whose columns contain collation IDs above 255.
This removes an assertion failure that was introduced in WL#4164
(Two-byte collation IDs).
create_table_def(): Do not fail an assertion if a column contains a
charset-collation ID greater than 256. Instead, issue an error and
refuse to create the table.
The original change (branches/6.0 r2998) was rb://51 approved by Calvin Sun.
------------------------------------------------------------------------
r3613 | inaam | 2009-01-02 15:10:50 +0200 (Fri, 02 Jan 2009) | 6 lines
branches/zip: Implement the parameter innodb_use_sys_malloc
(false by default), for disabling InnoDB's internal memory allocator
and using system malloc/free instead.
rb://62 approved by Marko
------------------------------------------------------------------------
r3614 | marko | 2009-01-02 15:55:12 +0200 (Fri, 02 Jan 2009) | 1 line
branches/zip: ChangeLog: Document r3608 and r3613.
------------------------------------------------------------------------
r3615 | marko | 2009-01-02 15:57:51 +0200 (Fri, 02 Jan 2009) | 1 line
branches/zip: ChangeLog: Clarify the impact of r3608.
------------------------------------------------------------------------
r3616 | marko | 2009-01-03 00:23:30 +0200 (Sat, 03 Jan 2009) | 1 line
branches/zip: srv_suspend_mysql_thread(): Add some clarifying comments.
------------------------------------------------------------------------
r3618 | marko | 2009-01-05 12:54:53 +0200 (Mon, 05 Jan 2009) | 15 lines
branches/zip: Merge revisions 3598:3601 from branches/5.1:
------------------------------------------------------------------------
r3601 | marko | 2008-12-22 16:05:19 +0200 (Mon, 22 Dec 2008) | 9 lines
branches/5.1: Make
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED
a true replacement of SET GLOBAL INNODB_LOCKS_UNSAFE_FOR_BINLOG=1.
This fixes an error that was introduced in r370, causing
semi-consistent read not to not unlock rows in READ COMMITTED mode.
(Bug #41671, Issue #146)
rb://67 approved by Heikki Tuuri
------------------------------------------------------------------------
------------------------------------------------------------------------
r3623 | vasil | 2009-01-06 09:56:32 +0200 (Tue, 06 Jan 2009) | 7 lines
branches/zip:
Add patch to fix the failing main.variables mysql-test. It started failing
after the variable innodb_use_sys_malloc was added because it matches
'%alloc%' and the test is badly written and expects that no new variables
like that will ever be added.
------------------------------------------------------------------------
r3795 | marko | 2009-01-07 16:17:47 +0200 (Wed, 07 Jan 2009) | 7 lines
branches/zip: row_merge_tuple_cmp(): Do not report a duplicate key value
if any of the fields are NULL. While the tuples are equal in the
sorting order, SQL NULL is defined to be logically inequal to
anything else. (Bug #41904)
rb://70 approved by Heikki Tuuri
------------------------------------------------------------------------
r3796 | marko | 2009-01-07 16:19:32 +0200 (Wed, 07 Jan 2009) | 1 line
branches/zip: Add the tests that were forgotten from r3795.
------------------------------------------------------------------------
r3797 | marko | 2009-01-07 16:22:18 +0200 (Wed, 07 Jan 2009) | 22 lines
branches/zip: Do not call trx_allocate_for_mysql() directly, but use
helper functions that initialize some members of the transaction struct.
(Bug #41680)
innobase_trx_init(): New function: initialize some fields of a
transaction struct from a MySQL THD object.
innobase_trx_allocate(): New function: allocate and initialize a
transaction struct.
check_trx_exists(): Use the above two functions.
ha_innobase::delete_table(), ha_innobase::rename_table(),
ha_innobase::add_index(), ha_innobase::final_drop_index():
Use innobase_trx_allocate().
innobase_drop_database(): In the Windows plugin, initialize the trx_t
specially, because the THD is not available. Otherwise, use
innobase_trx_allocate().
rb://69 accepted by Heikki Tuuri
------------------------------------------------------------------------
r3798 | marko | 2009-01-07 16:42:42 +0200 (Wed, 07 Jan 2009) | 8 lines
branches/zip: row_merge_drop_temp_indexes(): Do not lock the rows of
SYS_INDEXES when looking for partially created indexes. Use the
transaction isolation level READ UNCOMMITTED to avoid interfering with
locks held by incomplete transactions that will be rolled back in a
subsequent step in the recovery. (Issue #152)
Approved by Heikki Tuuri
------------------------------------------------------------------------
r3852 | vasil | 2009-01-08 22:10:10 +0200 (Thu, 08 Jan 2009) | 4 lines
branches/zip:
Add ChangeLog entries for r3795 r3796 r3797 r3798.
------------------------------------------------------------------------
r3866 | marko | 2009-01-09 15:09:51 +0200 (Fri, 09 Jan 2009) | 2 lines
branches/zip: buf_flush_try_page(): Move some common code from each
switch case before the switch block.
------------------------------------------------------------------------
r3867 | marko | 2009-01-09 15:13:14 +0200 (Fri, 09 Jan 2009) | 2 lines
branches/zip: buf_flush_try_page(): Introduce the variable is_compressed
for caching the result of buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE.
------------------------------------------------------------------------
r3868 | marko | 2009-01-09 15:40:11 +0200 (Fri, 09 Jan 2009) | 4 lines
branches/zip: buf_flush_insert_into_flush_list(),
buf_flush_insert_sorted_into_flush_list(): Remove unused code.
Change the parameter to buf_block_t* block and assert that
block->state == BUF_BLOCK_FILE_PAGE. This is part of Issue #155.
------------------------------------------------------------------------
r3873 | marko | 2009-01-09 22:27:40 +0200 (Fri, 09 Jan 2009) | 17 lines
branches/zip: Some non-functional changes related to Issue #155.
buf_page_struct: Note that space and offset are also protected by
buf_pool_mutex. They are only assigned to by
buf_block_set_file_page(). Thus, it suffices for buf_flush_batch() to
hold just buf_pool_mutex when checking these fields.
buf_flush_try_page(): Rename "locked" to "is_s_latched", per Heikki's request.
buf_flush_batch(): Move the common statement mutex_exit(block_mutex)
from all if-else if-else branches before the if block. Remove the
redundant test (buf_pool->init_flush[flush_type] == FALSE) that was
apparently copied from buf_flush_write_complete().
buf_flush_write_block_low(): Note why it is safe not to hold buf_pool_mutex
or block_mutex. Enumerate the assumptions in debug assertions.
------------------------------------------------------------------------
r3874 | marko | 2009-01-09 23:09:06 +0200 (Fri, 09 Jan 2009) | 4 lines
branches/zip: Add comments related to Issue #155.
buf_flush_try_page(): Note why it is safe to access bpage without
holding buf_pool_mutex or block_mutex.
------------------------------------------------------------------------
r3875 | marko | 2009-01-09 23:15:12 +0200 (Fri, 09 Jan 2009) | 11 lines
branches/zip: Non-functional change: Tighten debug assertions and
remove dead code.
buf_flush_ready_for_flush(), buf_flush_try_page(): Assert that
flush_type is one of BUF_FLUSH_LRU or BUF_FLUSH_LIST. The flush_type
comes from buf_flush_batch(), which already asserts this. The
assertion holds for all calls in the source code.
buf_flush_try_page(): Remove the dead case BUF_FLUSH_SINGLE_PAGE
of switch (flush_type).
------------------------------------------------------------------------
r3879 | marko | 2009-01-12 12:46:44 +0200 (Mon, 12 Jan 2009) | 14 lines
branches/zip: Simplify the flushing of dirty pages from the buffer pool.
buf_flush_try_page(): Rename to buf_flush_page(), and change the
return type to void. Replace the parameters space, offset with bpage,
and remove the second page hash lookup. Note and assert that both
buf_pool_mutex and block_mutex must now be held upon entering the
function. They will still be released by this function.
buf_flush_try_neighbors(): Replace buf_flush_try_page() with
buf_flush_page(). Make the logic easier to follow by not negating the
precondition of buf_flush_page().
rb://73 approved by Sunny Bains. This is related to Issue #157.
------------------------------------------------------------------------
r3880 | marko | 2009-01-12 13:24:37 +0200 (Mon, 12 Jan 2009) | 2 lines
branches/zip: buf_flush_page(): Fix a comment that should have been fixed
in r3879. Spotted by Sunny.
------------------------------------------------------------------------
r3881 | marko | 2009-01-12 14:25:22 +0200 (Mon, 12 Jan 2009) | 2 lines
branches/zip: buf_page_get_newest_modification(): Use the block mutex
instead of the buffer pool mutex. This is related to Issue #157.
------------------------------------------------------------------------
r3882 | marko | 2009-01-12 14:40:08 +0200 (Mon, 12 Jan 2009) | 3 lines
branches/zip: struct mtr_struct: Remove the unused field magic_n
unless UNIV_DEBUG is defined. mtr->magic_n is only assigned to
and checked in UNIV_DEBUG builds.
------------------------------------------------------------------------
r3883 | marko | 2009-01-12 14:48:59 +0200 (Mon, 12 Jan 2009) | 1 line
branches/zip: Non-functional change: Use ut_d when assigning to mtr->state.
------------------------------------------------------------------------
r3884 | marko | 2009-01-12 18:56:11 +0200 (Mon, 12 Jan 2009) | 16 lines
branches/zip: Non-functional change: Add some debug assertions and comments.
buf_page_t: Note that the LRU fields are protected by buf_pool_mutex
only, not block->mutex or buf_pool_zip_mutex.
buf_page_get_freed_page_clock(): Note that this is sometimes invoked
without mutex protection.
buf_pool_get_oldest_modification(): Note that the result may be out of
date.
buf_page_get_LRU_position(), buf_page_is_old(): Assert that the buffer
pool mutex is being held.
buf_page_release(): Assert that dirty blocks are in the flush list.
------------------------------------------------------------------------
r3896 | marko | 2009-01-13 09:30:26 +0200 (Tue, 13 Jan 2009) | 2 lines
branches/zip: buf_flush_try_neighbors(): Fix a bug
that was introduced in r3879 (rb://73).
------------------------------------------------------------------------
r3900 | marko | 2009-01-13 10:32:24 +0200 (Tue, 13 Jan 2009) | 1 line
branches/zip: Fix some comments to say buf_pool_mutex.
------------------------------------------------------------------------
r3907 | marko | 2009-01-13 11:54:01 +0200 (Tue, 13 Jan 2009) | 3 lines
branches/zip: row_merge_create_temporary_table(): On error,
row_create_table_for_mysql() already frees new_table.
Do not attempt to free it again.
------------------------------------------------------------------------
r3908 | marko | 2009-01-13 12:34:32 +0200 (Tue, 13 Jan 2009) | 1 line
branches/zip: Enable HASH_ASSERT_OWNED independently of UNIV_SYNC_DEBUG.
------------------------------------------------------------------------
r3914 | marko | 2009-01-13 21:46:22 +0200 (Tue, 13 Jan 2009) | 37 lines
branches/zip: In hash table lookups, assert that the traversed items
satisfy some conditions when UNIV_DEBUG is defined.
HASH_SEARCH(): New parameter: ASSERTION. All users will pass an appropriate
ut_ad() or nothing.
dict_table_add_to_columns(): Assert that the table being added to the data
dictionary cache is not already being pointed to by the name_hash and
id_hash tables.
HASH_SEARCH_ALL(): New macro, for use in dict_table_add_to_columns().
dict_mem_table_free(): Set ut_d(table->cached = FALSE), so that we can
check ut_ad(table->cached) when traversing the hash tables, as in
HASH_SEARCH(name_hash, dict_sys->table_hash, ...) and
HASH_SEARCH(id_hash, dict_sys->table_id_hash, ...).
dict_table_get_low(), dict_table_get_on_id_low(): Assert
ut_ad(!table || table->cached).
fil_space_get_by_id(): Check ut_ad(space->magic_n == FIL_SPACE_MAGIC_N)
in HASH_SEARCH(hash, fil_system->spaces, ...).
fil_space_get_by_name(): Check ut_ad(space->magic_n == FIL_SPACE_MAGIC_N)
in HASH_SEARCH(name_hash, fil_system->name_hash, ...).
buf_buddy_block_free(): Check that the blocks are in valid state in
HASH_SEARCH(hash, buf_pool->zip_hash, ...).
buf_page_hash_get(): Check that the blocks are in valid state in
HASH_SEARCH(hash, buf_pool->page_hash, ...).
get_share(), free_share(): Check ut_ad(share->use_count > 0) in
HASH_SEARCH(table_name_hash, innobase_open_tables, ...).
This was posted as rb://75 for tracking down errors similar to Issue #153.
------------------------------------------------------------------------
r3931 | marko | 2009-01-14 16:06:22 +0200 (Wed, 14 Jan 2009) | 26 lines
branches/zip: Merge revisions 3601:3930 from branches/5.1:
------------------------------------------------------------------------
r3911 | sunny | 2009-01-13 14:15:24 +0200 (Tue, 13 Jan 2009) | 13 lines
branches/5.1: Fix Bug#38187 Error 153 when creating savepoints
InnoDB previously treated savepoints as a stack e.g.,
SAVEPOINT a;
SAVEPOINT b;
SAVEPOINT c;
SAVEPOINT b; <- This would delete b and c.
This fix changes the behavior to:
SAVEPOINT a;
SAVEPOINT b;
SAVEPOINT c;
SAVEPOINT b; <- Does not delete savepoint c
------------------------------------------------------------------------
r3930 | marko | 2009-01-14 15:51:30 +0200 (Wed, 14 Jan 2009) | 4 lines
branches/5.1: dict_load_table(): If dict_load_indexes() fails,
invoke dict_table_remove_from_cache() instead of dict_mem_table_free(),
so that the data dictionary will not point to freed data.
(Bug #42075, Issue #153, rb://76 approved by Heikki Tuuri)
------------------------------------------------------------------------
------------------------------------------------------------------------
2009-01-14 14:25:45 +00:00
|
|
|
mutex_exit(block_mutex);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
return(lsn);
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
Increments the modify clock of a frame by 1. The caller must (1) own the
|
|
|
|
buf_pool mutex and block bufferfix count has to be zero, (2) or own an x-lock
|
|
|
|
on the block. */
|
|
|
|
UNIV_INLINE
|
2006-10-13 11:55:27 +00:00
|
|
|
void
|
2005-10-27 07:29:40 +00:00
|
|
|
buf_block_modify_clock_inc(
|
|
|
|
/*=======================*/
|
|
|
|
buf_block_t* block) /* in: block */
|
|
|
|
{
|
|
|
|
#ifdef UNIV_SYNC_DEBUG
|
2008-01-10 09:37:13 +00:00
|
|
|
ut_ad((buf_pool_mutex_own()
|
2006-11-30 12:27:49 +00:00
|
|
|
&& (block->page.buf_fix_count == 0))
|
2006-08-29 09:30:31 +00:00
|
|
|
|| rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE));
|
2005-10-27 07:29:40 +00:00
|
|
|
#endif /* UNIV_SYNC_DEBUG */
|
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
block->modify_clock++;
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************************
|
2006-02-23 19:25:29 +00:00
|
|
|
Returns the value of the modify clock. The caller must have an s-lock
|
2005-10-27 07:29:40 +00:00
|
|
|
or x-lock on the block. */
|
|
|
|
UNIV_INLINE
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t
|
2005-10-27 07:29:40 +00:00
|
|
|
buf_block_get_modify_clock(
|
|
|
|
/*=======================*/
|
|
|
|
/* out: value */
|
|
|
|
buf_block_t* block) /* in: block */
|
|
|
|
{
|
|
|
|
#ifdef UNIV_SYNC_DEBUG
|
|
|
|
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED)
|
2006-08-29 09:30:31 +00:00
|
|
|
|| rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE));
|
2005-10-27 07:29:40 +00:00
|
|
|
#endif /* UNIV_SYNC_DEBUG */
|
|
|
|
|
|
|
|
return(block->modify_clock);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
Increments the bufferfix count. */
|
|
|
|
UNIV_INLINE
|
|
|
|
void
|
2006-11-30 09:24:57 +00:00
|
|
|
buf_block_buf_fix_inc_func(
|
|
|
|
/*=======================*/
|
|
|
|
#ifdef UNIV_SYNC_DEBUG
|
2006-08-16 09:35:36 +00:00
|
|
|
const char* file, /* in: file name */
|
2006-11-30 09:24:57 +00:00
|
|
|
ulint line, /* in: line */
|
|
|
|
#endif /* UNIV_SYNC_DEBUG */
|
|
|
|
buf_block_t* block) /* in: block to bufferfix */
|
2005-10-27 07:29:40 +00:00
|
|
|
{
|
2006-11-30 09:24:57 +00:00
|
|
|
#ifdef UNIV_SYNC_DEBUG
|
2005-10-27 07:29:40 +00:00
|
|
|
ibool ret;
|
|
|
|
|
|
|
|
ret = rw_lock_s_lock_func_nowait(&(block->debug_latch), file, line);
|
2006-08-16 09:35:36 +00:00
|
|
|
ut_a(ret);
|
2006-11-30 09:24:57 +00:00
|
|
|
#endif /* UNIV_SYNC_DEBUG */
|
2007-01-18 18:29:12 +00:00
|
|
|
ut_ad(mutex_own(&block->mutex));
|
|
|
|
|
2006-11-30 12:27:49 +00:00
|
|
|
block->page.buf_fix_count++;
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
2006-11-30 09:24:57 +00:00
|
|
|
#ifdef UNIV_SYNC_DEBUG
|
|
|
|
# define buf_block_buf_fix_inc(b,f,l) buf_block_buf_fix_inc_func(f,l,b)
|
2005-10-27 07:29:40 +00:00
|
|
|
#else /* UNIV_SYNC_DEBUG */
|
2006-11-30 09:24:57 +00:00
|
|
|
# define buf_block_buf_fix_inc(b,f,l) buf_block_buf_fix_inc_func(b)
|
2005-10-27 07:29:40 +00:00
|
|
|
#endif /* UNIV_SYNC_DEBUG */
|
2006-11-30 09:24:57 +00:00
|
|
|
|
2007-10-01 07:25:02 +00:00
|
|
|
/***********************************************************************
|
|
|
|
Decrements the bufferfix count. */
|
|
|
|
UNIV_INLINE
|
|
|
|
void
|
|
|
|
buf_block_buf_fix_dec(
|
|
|
|
/*==================*/
|
|
|
|
buf_block_t* block) /* in: block to bufferunfix */
|
|
|
|
{
|
|
|
|
ut_ad(mutex_own(&block->mutex));
|
|
|
|
|
|
|
|
block->page.buf_fix_count--;
|
|
|
|
#ifdef UNIV_SYNC_DEBUG
|
|
|
|
rw_lock_s_unlock(&block->debug_latch);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
/**********************************************************************
|
|
|
|
Returns the control block of a file page, NULL if not found. */
|
|
|
|
UNIV_INLINE
|
2006-11-29 13:23:28 +00:00
|
|
|
buf_page_t*
|
2005-10-27 07:29:40 +00:00
|
|
|
buf_page_hash_get(
|
|
|
|
/*==============*/
|
|
|
|
/* out: block, NULL if not found */
|
|
|
|
ulint space, /* in: space id */
|
|
|
|
ulint offset) /* in: offset of the page within space */
|
|
|
|
{
|
2006-11-29 13:23:28 +00:00
|
|
|
buf_page_t* bpage;
|
2005-10-27 07:29:40 +00:00
|
|
|
ulint fold;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
ut_ad(buf_pool);
|
2008-01-10 09:37:13 +00:00
|
|
|
ut_ad(buf_pool_mutex_own());
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
/* Look for the page in the hash table */
|
|
|
|
|
|
|
|
fold = buf_page_address_fold(space, offset);
|
|
|
|
|
2007-08-01 08:13:22 +00:00
|
|
|
HASH_SEARCH(hash, buf_pool->page_hash, fold, buf_page_t*, bpage,
|
branches/innodb+: Merge revisions 3602:3931 from branches/zip:
------------------------------------------------------------------------
r3607 | marko | 2008-12-30 22:33:31 +0200 (Tue, 30 Dec 2008) | 20 lines
branches/zip: Remove the dependency on the MySQL HASH table implementation.
Use the InnoDB hash table for keeping track of INNOBASE_SHARE objects.
struct st_innobase_share: Make table_name const uchar*. Add the member
table_name_hash.
innobase_open_tables: Change the type from HASH to hash_table_t*.
innobase_get_key(): Remove.
innobase_fold_name(): New function, for computing the fold value for the
InnoDB hash table.
get_share(), free_share(): Use the InnoDB hash functions.
innobase_end(): Free innobase_open_tables before shutting down InnoDB.
Shutting down InnoDB will invalidate all memory allocated via InnoDB.
rb://65 approved by Heikki Tuuri. This addresses Issue #104.
------------------------------------------------------------------------
r3608 | marko | 2008-12-30 22:45:04 +0200 (Tue, 30 Dec 2008) | 22 lines
branches/zip: When setting the PAGE_LEVEL of a compressed B-tree page
from or to 0, compress the page at the same time. This is necessary,
because the column information stored on the compressed page will
differ between leaf and non-leaf pages. Leaf pages are identified by
PAGE_LEVEL=0. This bug was reported as Issue #150.
Document the similarity between btr_page_create() and
btr_page_empty(). Make the function signature of btr_page_empty()
identical with btr_page_create(). (This will add the parameter "level".)
btr_root_raise_and_insert(): Replace some code with a call to
btr_page_empty().
btr_attach_half_pages(): Assert that the page level has already been
set on both block and new_block. Do not set it again.
btr_discard_only_page_on_level(): Document that this function is
probably never called. Make it work on any height tree. (Tested on
2-high tree by disabling btr_lift_page_up().)
rb://68
------------------------------------------------------------------------
r3612 | marko | 2009-01-02 11:02:44 +0200 (Fri, 02 Jan 2009) | 14 lines
branches/zip: Merge c2998 from branches/6.0, so that the same InnoDB Plugin
source tree will work both under 5.1 and 6.0. Do not add the test case
innodb_ctype_ldml.test, because it would not work under MySQL 5.1.
Refuse to create tables whose columns contain collation IDs above 255.
This removes an assertion failure that was introduced in WL#4164
(Two-byte collation IDs).
create_table_def(): Do not fail an assertion if a column contains a
charset-collation ID greater than 256. Instead, issue an error and
refuse to create the table.
The original change (branches/6.0 r2998) was rb://51 approved by Calvin Sun.
------------------------------------------------------------------------
r3613 | inaam | 2009-01-02 15:10:50 +0200 (Fri, 02 Jan 2009) | 6 lines
branches/zip: Implement the parameter innodb_use_sys_malloc
(false by default), for disabling InnoDB's internal memory allocator
and using system malloc/free instead.
rb://62 approved by Marko
------------------------------------------------------------------------
r3614 | marko | 2009-01-02 15:55:12 +0200 (Fri, 02 Jan 2009) | 1 line
branches/zip: ChangeLog: Document r3608 and r3613.
------------------------------------------------------------------------
r3615 | marko | 2009-01-02 15:57:51 +0200 (Fri, 02 Jan 2009) | 1 line
branches/zip: ChangeLog: Clarify the impact of r3608.
------------------------------------------------------------------------
r3616 | marko | 2009-01-03 00:23:30 +0200 (Sat, 03 Jan 2009) | 1 line
branches/zip: srv_suspend_mysql_thread(): Add some clarifying comments.
------------------------------------------------------------------------
r3618 | marko | 2009-01-05 12:54:53 +0200 (Mon, 05 Jan 2009) | 15 lines
branches/zip: Merge revisions 3598:3601 from branches/5.1:
------------------------------------------------------------------------
r3601 | marko | 2008-12-22 16:05:19 +0200 (Mon, 22 Dec 2008) | 9 lines
branches/5.1: Make
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED
a true replacement of SET GLOBAL INNODB_LOCKS_UNSAFE_FOR_BINLOG=1.
This fixes an error that was introduced in r370, causing
semi-consistent read not to not unlock rows in READ COMMITTED mode.
(Bug #41671, Issue #146)
rb://67 approved by Heikki Tuuri
------------------------------------------------------------------------
------------------------------------------------------------------------
r3623 | vasil | 2009-01-06 09:56:32 +0200 (Tue, 06 Jan 2009) | 7 lines
branches/zip:
Add patch to fix the failing main.variables mysql-test. It started failing
after the variable innodb_use_sys_malloc was added because it matches
'%alloc%' and the test is badly written and expects that no new variables
like that will ever be added.
------------------------------------------------------------------------
r3795 | marko | 2009-01-07 16:17:47 +0200 (Wed, 07 Jan 2009) | 7 lines
branches/zip: row_merge_tuple_cmp(): Do not report a duplicate key value
if any of the fields are NULL. While the tuples are equal in the
sorting order, SQL NULL is defined to be logically inequal to
anything else. (Bug #41904)
rb://70 approved by Heikki Tuuri
------------------------------------------------------------------------
r3796 | marko | 2009-01-07 16:19:32 +0200 (Wed, 07 Jan 2009) | 1 line
branches/zip: Add the tests that were forgotten from r3795.
------------------------------------------------------------------------
r3797 | marko | 2009-01-07 16:22:18 +0200 (Wed, 07 Jan 2009) | 22 lines
branches/zip: Do not call trx_allocate_for_mysql() directly, but use
helper functions that initialize some members of the transaction struct.
(Bug #41680)
innobase_trx_init(): New function: initialize some fields of a
transaction struct from a MySQL THD object.
innobase_trx_allocate(): New function: allocate and initialize a
transaction struct.
check_trx_exists(): Use the above two functions.
ha_innobase::delete_table(), ha_innobase::rename_table(),
ha_innobase::add_index(), ha_innobase::final_drop_index():
Use innobase_trx_allocate().
innobase_drop_database(): In the Windows plugin, initialize the trx_t
specially, because the THD is not available. Otherwise, use
innobase_trx_allocate().
rb://69 accepted by Heikki Tuuri
------------------------------------------------------------------------
r3798 | marko | 2009-01-07 16:42:42 +0200 (Wed, 07 Jan 2009) | 8 lines
branches/zip: row_merge_drop_temp_indexes(): Do not lock the rows of
SYS_INDEXES when looking for partially created indexes. Use the
transaction isolation level READ UNCOMMITTED to avoid interfering with
locks held by incomplete transactions that will be rolled back in a
subsequent step in the recovery. (Issue #152)
Approved by Heikki Tuuri
------------------------------------------------------------------------
r3852 | vasil | 2009-01-08 22:10:10 +0200 (Thu, 08 Jan 2009) | 4 lines
branches/zip:
Add ChangeLog entries for r3795 r3796 r3797 r3798.
------------------------------------------------------------------------
r3866 | marko | 2009-01-09 15:09:51 +0200 (Fri, 09 Jan 2009) | 2 lines
branches/zip: buf_flush_try_page(): Move some common code from each
switch case before the switch block.
------------------------------------------------------------------------
r3867 | marko | 2009-01-09 15:13:14 +0200 (Fri, 09 Jan 2009) | 2 lines
branches/zip: buf_flush_try_page(): Introduce the variable is_compressed
for caching the result of buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE.
------------------------------------------------------------------------
r3868 | marko | 2009-01-09 15:40:11 +0200 (Fri, 09 Jan 2009) | 4 lines
branches/zip: buf_flush_insert_into_flush_list(),
buf_flush_insert_sorted_into_flush_list(): Remove unused code.
Change the parameter to buf_block_t* block and assert that
block->state == BUF_BLOCK_FILE_PAGE. This is part of Issue #155.
------------------------------------------------------------------------
r3873 | marko | 2009-01-09 22:27:40 +0200 (Fri, 09 Jan 2009) | 17 lines
branches/zip: Some non-functional changes related to Issue #155.
buf_page_struct: Note that space and offset are also protected by
buf_pool_mutex. They are only assigned to by
buf_block_set_file_page(). Thus, it suffices for buf_flush_batch() to
hold just buf_pool_mutex when checking these fields.
buf_flush_try_page(): Rename "locked" to "is_s_latched", per Heikki's request.
buf_flush_batch(): Move the common statement mutex_exit(block_mutex)
from all if-else if-else branches before the if block. Remove the
redundant test (buf_pool->init_flush[flush_type] == FALSE) that was
apparently copied from buf_flush_write_complete().
buf_flush_write_block_low(): Note why it is safe not to hold buf_pool_mutex
or block_mutex. Enumerate the assumptions in debug assertions.
------------------------------------------------------------------------
r3874 | marko | 2009-01-09 23:09:06 +0200 (Fri, 09 Jan 2009) | 4 lines
branches/zip: Add comments related to Issue #155.
buf_flush_try_page(): Note why it is safe to access bpage without
holding buf_pool_mutex or block_mutex.
------------------------------------------------------------------------
r3875 | marko | 2009-01-09 23:15:12 +0200 (Fri, 09 Jan 2009) | 11 lines
branches/zip: Non-functional change: Tighten debug assertions and
remove dead code.
buf_flush_ready_for_flush(), buf_flush_try_page(): Assert that
flush_type is one of BUF_FLUSH_LRU or BUF_FLUSH_LIST. The flush_type
comes from buf_flush_batch(), which already asserts this. The
assertion holds for all calls in the source code.
buf_flush_try_page(): Remove the dead case BUF_FLUSH_SINGLE_PAGE
of switch (flush_type).
------------------------------------------------------------------------
r3879 | marko | 2009-01-12 12:46:44 +0200 (Mon, 12 Jan 2009) | 14 lines
branches/zip: Simplify the flushing of dirty pages from the buffer pool.
buf_flush_try_page(): Rename to buf_flush_page(), and change the
return type to void. Replace the parameters space, offset with bpage,
and remove the second page hash lookup. Note and assert that both
buf_pool_mutex and block_mutex must now be held upon entering the
function. They will still be released by this function.
buf_flush_try_neighbors(): Replace buf_flush_try_page() with
buf_flush_page(). Make the logic easier to follow by not negating the
precondition of buf_flush_page().
rb://73 approved by Sunny Bains. This is related to Issue #157.
------------------------------------------------------------------------
r3880 | marko | 2009-01-12 13:24:37 +0200 (Mon, 12 Jan 2009) | 2 lines
branches/zip: buf_flush_page(): Fix a comment that should have been fixed
in r3879. Spotted by Sunny.
------------------------------------------------------------------------
r3881 | marko | 2009-01-12 14:25:22 +0200 (Mon, 12 Jan 2009) | 2 lines
branches/zip: buf_page_get_newest_modification(): Use the block mutex
instead of the buffer pool mutex. This is related to Issue #157.
------------------------------------------------------------------------
r3882 | marko | 2009-01-12 14:40:08 +0200 (Mon, 12 Jan 2009) | 3 lines
branches/zip: struct mtr_struct: Remove the unused field magic_n
unless UNIV_DEBUG is defined. mtr->magic_n is only assigned to
and checked in UNIV_DEBUG builds.
------------------------------------------------------------------------
r3883 | marko | 2009-01-12 14:48:59 +0200 (Mon, 12 Jan 2009) | 1 line
branches/zip: Non-functional change: Use ut_d when assigning to mtr->state.
------------------------------------------------------------------------
r3884 | marko | 2009-01-12 18:56:11 +0200 (Mon, 12 Jan 2009) | 16 lines
branches/zip: Non-functional change: Add some debug assertions and comments.
buf_page_t: Note that the LRU fields are protected by buf_pool_mutex
only, not block->mutex or buf_pool_zip_mutex.
buf_page_get_freed_page_clock(): Note that this is sometimes invoked
without mutex protection.
buf_pool_get_oldest_modification(): Note that the result may be out of
date.
buf_page_get_LRU_position(), buf_page_is_old(): Assert that the buffer
pool mutex is being held.
buf_page_release(): Assert that dirty blocks are in the flush list.
------------------------------------------------------------------------
r3896 | marko | 2009-01-13 09:30:26 +0200 (Tue, 13 Jan 2009) | 2 lines
branches/zip: buf_flush_try_neighbors(): Fix a bug
that was introduced in r3879 (rb://73).
------------------------------------------------------------------------
r3900 | marko | 2009-01-13 10:32:24 +0200 (Tue, 13 Jan 2009) | 1 line
branches/zip: Fix some comments to say buf_pool_mutex.
------------------------------------------------------------------------
r3907 | marko | 2009-01-13 11:54:01 +0200 (Tue, 13 Jan 2009) | 3 lines
branches/zip: row_merge_create_temporary_table(): On error,
row_create_table_for_mysql() already frees new_table.
Do not attempt to free it again.
------------------------------------------------------------------------
r3908 | marko | 2009-01-13 12:34:32 +0200 (Tue, 13 Jan 2009) | 1 line
branches/zip: Enable HASH_ASSERT_OWNED independently of UNIV_SYNC_DEBUG.
------------------------------------------------------------------------
r3914 | marko | 2009-01-13 21:46:22 +0200 (Tue, 13 Jan 2009) | 37 lines
branches/zip: In hash table lookups, assert that the traversed items
satisfy some conditions when UNIV_DEBUG is defined.
HASH_SEARCH(): New parameter: ASSERTION. All users will pass an appropriate
ut_ad() or nothing.
dict_table_add_to_columns(): Assert that the table being added to the data
dictionary cache is not already being pointed to by the name_hash and
id_hash tables.
HASH_SEARCH_ALL(): New macro, for use in dict_table_add_to_columns().
dict_mem_table_free(): Set ut_d(table->cached = FALSE), so that we can
check ut_ad(table->cached) when traversing the hash tables, as in
HASH_SEARCH(name_hash, dict_sys->table_hash, ...) and
HASH_SEARCH(id_hash, dict_sys->table_id_hash, ...).
dict_table_get_low(), dict_table_get_on_id_low(): Assert
ut_ad(!table || table->cached).
fil_space_get_by_id(): Check ut_ad(space->magic_n == FIL_SPACE_MAGIC_N)
in HASH_SEARCH(hash, fil_system->spaces, ...).
fil_space_get_by_name(): Check ut_ad(space->magic_n == FIL_SPACE_MAGIC_N)
in HASH_SEARCH(name_hash, fil_system->name_hash, ...).
buf_buddy_block_free(): Check that the blocks are in valid state in
HASH_SEARCH(hash, buf_pool->zip_hash, ...).
buf_page_hash_get(): Check that the blocks are in valid state in
HASH_SEARCH(hash, buf_pool->page_hash, ...).
get_share(), free_share(): Check ut_ad(share->use_count > 0) in
HASH_SEARCH(table_name_hash, innobase_open_tables, ...).
This was posted as rb://75 for tracking down errors similar to Issue #153.
------------------------------------------------------------------------
r3931 | marko | 2009-01-14 16:06:22 +0200 (Wed, 14 Jan 2009) | 26 lines
branches/zip: Merge revisions 3601:3930 from branches/5.1:
------------------------------------------------------------------------
r3911 | sunny | 2009-01-13 14:15:24 +0200 (Tue, 13 Jan 2009) | 13 lines
branches/5.1: Fix Bug#38187 Error 153 when creating savepoints
InnoDB previously treated savepoints as a stack e.g.,
SAVEPOINT a;
SAVEPOINT b;
SAVEPOINT c;
SAVEPOINT b; <- This would delete b and c.
This fix changes the behavior to:
SAVEPOINT a;
SAVEPOINT b;
SAVEPOINT c;
SAVEPOINT b; <- Does not delete savepoint c
------------------------------------------------------------------------
r3930 | marko | 2009-01-14 15:51:30 +0200 (Wed, 14 Jan 2009) | 4 lines
branches/5.1: dict_load_table(): If dict_load_indexes() fails,
invoke dict_table_remove_from_cache() instead of dict_mem_table_free(),
so that the data dictionary will not point to freed data.
(Bug #42075, Issue #153, rb://76 approved by Heikki Tuuri)
------------------------------------------------------------------------
------------------------------------------------------------------------
2009-01-14 14:25:45 +00:00
|
|
|
ut_ad(bpage->in_page_hash && !bpage->in_zip_hash
|
|
|
|
&& buf_page_in_file(bpage)),
|
2006-11-29 13:23:28 +00:00
|
|
|
bpage->space == space && bpage->offset == offset);
|
2007-10-30 09:27:09 +00:00
|
|
|
if (bpage) {
|
|
|
|
ut_a(buf_page_in_file(bpage));
|
|
|
|
ut_ad(bpage->in_page_hash);
|
2007-11-05 10:17:38 +00:00
|
|
|
ut_ad(!bpage->in_zip_hash);
|
2007-10-30 09:27:09 +00:00
|
|
|
UNIV_MEM_ASSERT_RW(bpage, sizeof *bpage);
|
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2006-11-29 13:23:28 +00:00
|
|
|
return(bpage);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
2007-10-01 07:32:45 +00:00
|
|
|
/**********************************************************************
|
|
|
|
Returns the control block of a file page, NULL if not found
|
|
|
|
or an uncompressed page frame does not exist. */
|
|
|
|
UNIV_INLINE
|
|
|
|
buf_block_t*
|
|
|
|
buf_block_hash_get(
|
|
|
|
/*===============*/
|
|
|
|
/* out: block, NULL if not found */
|
|
|
|
ulint space, /* in: space id */
|
|
|
|
ulint offset) /* in: offset of the page within space */
|
|
|
|
{
|
|
|
|
return(buf_page_get_block(buf_page_hash_get(space, offset)));
|
|
|
|
}
|
|
|
|
|
2007-01-05 11:19:56 +00:00
|
|
|
/************************************************************************
|
|
|
|
Returns TRUE if the page can be found in the buffer pool hash table. NOTE
|
|
|
|
that it is possible that the page is not yet read from disk, though. */
|
|
|
|
UNIV_INLINE
|
|
|
|
ibool
|
|
|
|
buf_page_peek(
|
|
|
|
/*==========*/
|
|
|
|
/* out: TRUE if found from page hash table,
|
|
|
|
NOTE that the page is not necessarily yet read
|
|
|
|
from disk! */
|
|
|
|
ulint space, /* in: space id */
|
|
|
|
ulint offset) /* in: page number */
|
|
|
|
{
|
|
|
|
const buf_page_t* bpage;
|
|
|
|
|
2008-01-10 09:37:13 +00:00
|
|
|
buf_pool_mutex_enter();
|
2007-01-05 11:19:56 +00:00
|
|
|
|
|
|
|
bpage = buf_page_hash_get(space, offset);
|
|
|
|
|
2008-01-10 09:37:13 +00:00
|
|
|
buf_pool_mutex_exit();
|
2007-01-05 11:19:56 +00:00
|
|
|
|
|
|
|
return(bpage != NULL);
|
|
|
|
}
|
|
|
|
|
2007-01-18 23:10:49 +00:00
|
|
|
/************************************************************************
|
|
|
|
Releases a compressed-only page acquired with buf_page_get_zip(). */
|
|
|
|
UNIV_INLINE
|
|
|
|
void
|
|
|
|
buf_page_release_zip(
|
|
|
|
/*=================*/
|
|
|
|
buf_page_t* bpage) /* in: buffer block */
|
|
|
|
{
|
|
|
|
buf_block_t* block;
|
|
|
|
|
|
|
|
ut_ad(bpage);
|
|
|
|
ut_a(bpage->buf_fix_count > 0);
|
|
|
|
|
|
|
|
switch (buf_page_get_state(bpage)) {
|
|
|
|
case BUF_BLOCK_ZIP_PAGE:
|
|
|
|
case BUF_BLOCK_ZIP_DIRTY:
|
2008-01-10 09:37:13 +00:00
|
|
|
mutex_enter(&buf_pool_zip_mutex);
|
2007-01-18 23:10:49 +00:00
|
|
|
bpage->buf_fix_count--;
|
2008-01-10 09:37:13 +00:00
|
|
|
mutex_exit(&buf_pool_zip_mutex);
|
2007-01-18 23:10:49 +00:00
|
|
|
return;
|
|
|
|
case BUF_BLOCK_FILE_PAGE:
|
|
|
|
block = (buf_block_t*) bpage;
|
|
|
|
mutex_enter(&block->mutex);
|
|
|
|
#ifdef UNIV_SYNC_DEBUG
|
|
|
|
rw_lock_s_unlock(&block->debug_latch);
|
|
|
|
#endif
|
|
|
|
bpage->buf_fix_count--;
|
|
|
|
mutex_exit(&block->mutex);
|
|
|
|
return;
|
|
|
|
case BUF_BLOCK_ZIP_FREE:
|
|
|
|
case BUF_BLOCK_NOT_USED:
|
|
|
|
case BUF_BLOCK_READY_FOR_USE:
|
|
|
|
case BUF_BLOCK_MEMORY:
|
|
|
|
case BUF_BLOCK_REMOVE_HASH:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ut_error;
|
|
|
|
}
|
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
/************************************************************************
|
|
|
|
Decrements the bufferfix count of a buffer control block and releases
|
|
|
|
a latch, if specified. */
|
|
|
|
UNIV_INLINE
|
|
|
|
void
|
|
|
|
buf_page_release(
|
|
|
|
/*=============*/
|
|
|
|
buf_block_t* block, /* in: buffer block */
|
|
|
|
ulint rw_latch, /* in: RW_S_LATCH, RW_X_LATCH,
|
|
|
|
RW_NO_LATCH */
|
|
|
|
mtr_t* mtr) /* in: mtr */
|
|
|
|
{
|
|
|
|
ut_ad(block);
|
|
|
|
|
2006-11-23 13:26:01 +00:00
|
|
|
ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
|
2006-11-30 12:27:49 +00:00
|
|
|
ut_a(block->page.buf_fix_count > 0);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
if (rw_latch == RW_X_LATCH && mtr->modifications) {
|
2008-01-10 09:37:13 +00:00
|
|
|
buf_pool_mutex_enter();
|
2005-10-27 07:29:40 +00:00
|
|
|
buf_flush_note_modification(block, mtr);
|
2008-01-10 09:37:13 +00:00
|
|
|
buf_pool_mutex_exit();
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
2006-11-10 11:15:59 +00:00
|
|
|
mutex_enter(&block->mutex);
|
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
#ifdef UNIV_SYNC_DEBUG
|
|
|
|
rw_lock_s_unlock(&(block->debug_latch));
|
|
|
|
#endif
|
2006-11-30 12:27:49 +00:00
|
|
|
block->page.buf_fix_count--;
|
2005-10-27 07:29:40 +00:00
|
|
|
|
branches/innodb+: Merge revisions 3602:3931 from branches/zip:
------------------------------------------------------------------------
r3607 | marko | 2008-12-30 22:33:31 +0200 (Tue, 30 Dec 2008) | 20 lines
branches/zip: Remove the dependency on the MySQL HASH table implementation.
Use the InnoDB hash table for keeping track of INNOBASE_SHARE objects.
struct st_innobase_share: Make table_name const uchar*. Add the member
table_name_hash.
innobase_open_tables: Change the type from HASH to hash_table_t*.
innobase_get_key(): Remove.
innobase_fold_name(): New function, for computing the fold value for the
InnoDB hash table.
get_share(), free_share(): Use the InnoDB hash functions.
innobase_end(): Free innobase_open_tables before shutting down InnoDB.
Shutting down InnoDB will invalidate all memory allocated via InnoDB.
rb://65 approved by Heikki Tuuri. This addresses Issue #104.
------------------------------------------------------------------------
r3608 | marko | 2008-12-30 22:45:04 +0200 (Tue, 30 Dec 2008) | 22 lines
branches/zip: When setting the PAGE_LEVEL of a compressed B-tree page
from or to 0, compress the page at the same time. This is necessary,
because the column information stored on the compressed page will
differ between leaf and non-leaf pages. Leaf pages are identified by
PAGE_LEVEL=0. This bug was reported as Issue #150.
Document the similarity between btr_page_create() and
btr_page_empty(). Make the function signature of btr_page_empty()
identical with btr_page_create(). (This will add the parameter "level".)
btr_root_raise_and_insert(): Replace some code with a call to
btr_page_empty().
btr_attach_half_pages(): Assert that the page level has already been
set on both block and new_block. Do not set it again.
btr_discard_only_page_on_level(): Document that this function is
probably never called. Make it work on any height tree. (Tested on
2-high tree by disabling btr_lift_page_up().)
rb://68
------------------------------------------------------------------------
r3612 | marko | 2009-01-02 11:02:44 +0200 (Fri, 02 Jan 2009) | 14 lines
branches/zip: Merge c2998 from branches/6.0, so that the same InnoDB Plugin
source tree will work both under 5.1 and 6.0. Do not add the test case
innodb_ctype_ldml.test, because it would not work under MySQL 5.1.
Refuse to create tables whose columns contain collation IDs above 255.
This removes an assertion failure that was introduced in WL#4164
(Two-byte collation IDs).
create_table_def(): Do not fail an assertion if a column contains a
charset-collation ID greater than 256. Instead, issue an error and
refuse to create the table.
The original change (branches/6.0 r2998) was rb://51 approved by Calvin Sun.
------------------------------------------------------------------------
r3613 | inaam | 2009-01-02 15:10:50 +0200 (Fri, 02 Jan 2009) | 6 lines
branches/zip: Implement the parameter innodb_use_sys_malloc
(false by default), for disabling InnoDB's internal memory allocator
and using system malloc/free instead.
rb://62 approved by Marko
------------------------------------------------------------------------
r3614 | marko | 2009-01-02 15:55:12 +0200 (Fri, 02 Jan 2009) | 1 line
branches/zip: ChangeLog: Document r3608 and r3613.
------------------------------------------------------------------------
r3615 | marko | 2009-01-02 15:57:51 +0200 (Fri, 02 Jan 2009) | 1 line
branches/zip: ChangeLog: Clarify the impact of r3608.
------------------------------------------------------------------------
r3616 | marko | 2009-01-03 00:23:30 +0200 (Sat, 03 Jan 2009) | 1 line
branches/zip: srv_suspend_mysql_thread(): Add some clarifying comments.
------------------------------------------------------------------------
r3618 | marko | 2009-01-05 12:54:53 +0200 (Mon, 05 Jan 2009) | 15 lines
branches/zip: Merge revisions 3598:3601 from branches/5.1:
------------------------------------------------------------------------
r3601 | marko | 2008-12-22 16:05:19 +0200 (Mon, 22 Dec 2008) | 9 lines
branches/5.1: Make
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED
a true replacement of SET GLOBAL INNODB_LOCKS_UNSAFE_FOR_BINLOG=1.
This fixes an error that was introduced in r370, causing
semi-consistent read not to not unlock rows in READ COMMITTED mode.
(Bug #41671, Issue #146)
rb://67 approved by Heikki Tuuri
------------------------------------------------------------------------
------------------------------------------------------------------------
r3623 | vasil | 2009-01-06 09:56:32 +0200 (Tue, 06 Jan 2009) | 7 lines
branches/zip:
Add patch to fix the failing main.variables mysql-test. It started failing
after the variable innodb_use_sys_malloc was added because it matches
'%alloc%' and the test is badly written and expects that no new variables
like that will ever be added.
------------------------------------------------------------------------
r3795 | marko | 2009-01-07 16:17:47 +0200 (Wed, 07 Jan 2009) | 7 lines
branches/zip: row_merge_tuple_cmp(): Do not report a duplicate key value
if any of the fields are NULL. While the tuples are equal in the
sorting order, SQL NULL is defined to be logically inequal to
anything else. (Bug #41904)
rb://70 approved by Heikki Tuuri
------------------------------------------------------------------------
r3796 | marko | 2009-01-07 16:19:32 +0200 (Wed, 07 Jan 2009) | 1 line
branches/zip: Add the tests that were forgotten from r3795.
------------------------------------------------------------------------
r3797 | marko | 2009-01-07 16:22:18 +0200 (Wed, 07 Jan 2009) | 22 lines
branches/zip: Do not call trx_allocate_for_mysql() directly, but use
helper functions that initialize some members of the transaction struct.
(Bug #41680)
innobase_trx_init(): New function: initialize some fields of a
transaction struct from a MySQL THD object.
innobase_trx_allocate(): New function: allocate and initialize a
transaction struct.
check_trx_exists(): Use the above two functions.
ha_innobase::delete_table(), ha_innobase::rename_table(),
ha_innobase::add_index(), ha_innobase::final_drop_index():
Use innobase_trx_allocate().
innobase_drop_database(): In the Windows plugin, initialize the trx_t
specially, because the THD is not available. Otherwise, use
innobase_trx_allocate().
rb://69 accepted by Heikki Tuuri
------------------------------------------------------------------------
r3798 | marko | 2009-01-07 16:42:42 +0200 (Wed, 07 Jan 2009) | 8 lines
branches/zip: row_merge_drop_temp_indexes(): Do not lock the rows of
SYS_INDEXES when looking for partially created indexes. Use the
transaction isolation level READ UNCOMMITTED to avoid interfering with
locks held by incomplete transactions that will be rolled back in a
subsequent step in the recovery. (Issue #152)
Approved by Heikki Tuuri
------------------------------------------------------------------------
r3852 | vasil | 2009-01-08 22:10:10 +0200 (Thu, 08 Jan 2009) | 4 lines
branches/zip:
Add ChangeLog entries for r3795 r3796 r3797 r3798.
------------------------------------------------------------------------
r3866 | marko | 2009-01-09 15:09:51 +0200 (Fri, 09 Jan 2009) | 2 lines
branches/zip: buf_flush_try_page(): Move some common code from each
switch case before the switch block.
------------------------------------------------------------------------
r3867 | marko | 2009-01-09 15:13:14 +0200 (Fri, 09 Jan 2009) | 2 lines
branches/zip: buf_flush_try_page(): Introduce the variable is_compressed
for caching the result of buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE.
------------------------------------------------------------------------
r3868 | marko | 2009-01-09 15:40:11 +0200 (Fri, 09 Jan 2009) | 4 lines
branches/zip: buf_flush_insert_into_flush_list(),
buf_flush_insert_sorted_into_flush_list(): Remove unused code.
Change the parameter to buf_block_t* block and assert that
block->state == BUF_BLOCK_FILE_PAGE. This is part of Issue #155.
------------------------------------------------------------------------
r3873 | marko | 2009-01-09 22:27:40 +0200 (Fri, 09 Jan 2009) | 17 lines
branches/zip: Some non-functional changes related to Issue #155.
buf_page_struct: Note that space and offset are also protected by
buf_pool_mutex. They are only assigned to by
buf_block_set_file_page(). Thus, it suffices for buf_flush_batch() to
hold just buf_pool_mutex when checking these fields.
buf_flush_try_page(): Rename "locked" to "is_s_latched", per Heikki's request.
buf_flush_batch(): Move the common statement mutex_exit(block_mutex)
from all if-else if-else branches before the if block. Remove the
redundant test (buf_pool->init_flush[flush_type] == FALSE) that was
apparently copied from buf_flush_write_complete().
buf_flush_write_block_low(): Note why it is safe not to hold buf_pool_mutex
or block_mutex. Enumerate the assumptions in debug assertions.
------------------------------------------------------------------------
r3874 | marko | 2009-01-09 23:09:06 +0200 (Fri, 09 Jan 2009) | 4 lines
branches/zip: Add comments related to Issue #155.
buf_flush_try_page(): Note why it is safe to access bpage without
holding buf_pool_mutex or block_mutex.
------------------------------------------------------------------------
r3875 | marko | 2009-01-09 23:15:12 +0200 (Fri, 09 Jan 2009) | 11 lines
branches/zip: Non-functional change: Tighten debug assertions and
remove dead code.
buf_flush_ready_for_flush(), buf_flush_try_page(): Assert that
flush_type is one of BUF_FLUSH_LRU or BUF_FLUSH_LIST. The flush_type
comes from buf_flush_batch(), which already asserts this. The
assertion holds for all calls in the source code.
buf_flush_try_page(): Remove the dead case BUF_FLUSH_SINGLE_PAGE
of switch (flush_type).
------------------------------------------------------------------------
r3879 | marko | 2009-01-12 12:46:44 +0200 (Mon, 12 Jan 2009) | 14 lines
branches/zip: Simplify the flushing of dirty pages from the buffer pool.
buf_flush_try_page(): Rename to buf_flush_page(), and change the
return type to void. Replace the parameters space, offset with bpage,
and remove the second page hash lookup. Note and assert that both
buf_pool_mutex and block_mutex must now be held upon entering the
function. They will still be released by this function.
buf_flush_try_neighbors(): Replace buf_flush_try_page() with
buf_flush_page(). Make the logic easier to follow by not negating the
precondition of buf_flush_page().
rb://73 approved by Sunny Bains. This is related to Issue #157.
------------------------------------------------------------------------
r3880 | marko | 2009-01-12 13:24:37 +0200 (Mon, 12 Jan 2009) | 2 lines
branches/zip: buf_flush_page(): Fix a comment that should have been fixed
in r3879. Spotted by Sunny.
------------------------------------------------------------------------
r3881 | marko | 2009-01-12 14:25:22 +0200 (Mon, 12 Jan 2009) | 2 lines
branches/zip: buf_page_get_newest_modification(): Use the block mutex
instead of the buffer pool mutex. This is related to Issue #157.
------------------------------------------------------------------------
r3882 | marko | 2009-01-12 14:40:08 +0200 (Mon, 12 Jan 2009) | 3 lines
branches/zip: struct mtr_struct: Remove the unused field magic_n
unless UNIV_DEBUG is defined. mtr->magic_n is only assigned to
and checked in UNIV_DEBUG builds.
------------------------------------------------------------------------
r3883 | marko | 2009-01-12 14:48:59 +0200 (Mon, 12 Jan 2009) | 1 line
branches/zip: Non-functional change: Use ut_d when assigning to mtr->state.
------------------------------------------------------------------------
r3884 | marko | 2009-01-12 18:56:11 +0200 (Mon, 12 Jan 2009) | 16 lines
branches/zip: Non-functional change: Add some debug assertions and comments.
buf_page_t: Note that the LRU fields are protected by buf_pool_mutex
only, not block->mutex or buf_pool_zip_mutex.
buf_page_get_freed_page_clock(): Note that this is sometimes invoked
without mutex protection.
buf_pool_get_oldest_modification(): Note that the result may be out of
date.
buf_page_get_LRU_position(), buf_page_is_old(): Assert that the buffer
pool mutex is being held.
buf_page_release(): Assert that dirty blocks are in the flush list.
------------------------------------------------------------------------
r3896 | marko | 2009-01-13 09:30:26 +0200 (Tue, 13 Jan 2009) | 2 lines
branches/zip: buf_flush_try_neighbors(): Fix a bug
that was introduced in r3879 (rb://73).
------------------------------------------------------------------------
r3900 | marko | 2009-01-13 10:32:24 +0200 (Tue, 13 Jan 2009) | 1 line
branches/zip: Fix some comments to say buf_pool_mutex.
------------------------------------------------------------------------
r3907 | marko | 2009-01-13 11:54:01 +0200 (Tue, 13 Jan 2009) | 3 lines
branches/zip: row_merge_create_temporary_table(): On error,
row_create_table_for_mysql() already frees new_table.
Do not attempt to free it again.
------------------------------------------------------------------------
r3908 | marko | 2009-01-13 12:34:32 +0200 (Tue, 13 Jan 2009) | 1 line
branches/zip: Enable HASH_ASSERT_OWNED independently of UNIV_SYNC_DEBUG.
------------------------------------------------------------------------
r3914 | marko | 2009-01-13 21:46:22 +0200 (Tue, 13 Jan 2009) | 37 lines
branches/zip: In hash table lookups, assert that the traversed items
satisfy some conditions when UNIV_DEBUG is defined.
HASH_SEARCH(): New parameter: ASSERTION. All users will pass an appropriate
ut_ad() or nothing.
dict_table_add_to_columns(): Assert that the table being added to the data
dictionary cache is not already being pointed to by the name_hash and
id_hash tables.
HASH_SEARCH_ALL(): New macro, for use in dict_table_add_to_columns().
dict_mem_table_free(): Set ut_d(table->cached = FALSE), so that we can
check ut_ad(table->cached) when traversing the hash tables, as in
HASH_SEARCH(name_hash, dict_sys->table_hash, ...) and
HASH_SEARCH(id_hash, dict_sys->table_id_hash, ...).
dict_table_get_low(), dict_table_get_on_id_low(): Assert
ut_ad(!table || table->cached).
fil_space_get_by_id(): Check ut_ad(space->magic_n == FIL_SPACE_MAGIC_N)
in HASH_SEARCH(hash, fil_system->spaces, ...).
fil_space_get_by_name(): Check ut_ad(space->magic_n == FIL_SPACE_MAGIC_N)
in HASH_SEARCH(name_hash, fil_system->name_hash, ...).
buf_buddy_block_free(): Check that the blocks are in valid state in
HASH_SEARCH(hash, buf_pool->zip_hash, ...).
buf_page_hash_get(): Check that the blocks are in valid state in
HASH_SEARCH(hash, buf_pool->page_hash, ...).
get_share(), free_share(): Check ut_ad(share->use_count > 0) in
HASH_SEARCH(table_name_hash, innobase_open_tables, ...).
This was posted as rb://75 for tracking down errors similar to Issue #153.
------------------------------------------------------------------------
r3931 | marko | 2009-01-14 16:06:22 +0200 (Wed, 14 Jan 2009) | 26 lines
branches/zip: Merge revisions 3601:3930 from branches/5.1:
------------------------------------------------------------------------
r3911 | sunny | 2009-01-13 14:15:24 +0200 (Tue, 13 Jan 2009) | 13 lines
branches/5.1: Fix Bug#38187 Error 153 when creating savepoints
InnoDB previously treated savepoints as a stack e.g.,
SAVEPOINT a;
SAVEPOINT b;
SAVEPOINT c;
SAVEPOINT b; <- This would delete b and c.
This fix changes the behavior to:
SAVEPOINT a;
SAVEPOINT b;
SAVEPOINT c;
SAVEPOINT b; <- Does not delete savepoint c
------------------------------------------------------------------------
r3930 | marko | 2009-01-14 15:51:30 +0200 (Wed, 14 Jan 2009) | 4 lines
branches/5.1: dict_load_table(): If dict_load_indexes() fails,
invoke dict_table_remove_from_cache() instead of dict_mem_table_free(),
so that the data dictionary will not point to freed data.
(Bug #42075, Issue #153, rb://76 approved by Heikki Tuuri)
------------------------------------------------------------------------
------------------------------------------------------------------------
2009-01-14 14:25:45 +00:00
|
|
|
/* Dirty blocks should be in the flush list. */
|
|
|
|
ut_ad(!block->page.oldest_modification
|
|
|
|
|| block->page.in_flush_list);
|
|
|
|
|
2006-11-10 11:15:59 +00:00
|
|
|
mutex_exit(&block->mutex);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
if (rw_latch == RW_S_LATCH) {
|
|
|
|
rw_lock_s_unlock(&(block->lock));
|
|
|
|
} else if (rw_latch == RW_X_LATCH) {
|
|
|
|
rw_lock_x_unlock(&(block->lock));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef UNIV_SYNC_DEBUG
|
|
|
|
/*************************************************************************
|
|
|
|
Adds latch level info for the rw-lock protecting the buffer frame. This
|
|
|
|
should be called in the debug version after a successful latching of a
|
2006-10-12 11:05:22 +00:00
|
|
|
page if we know the latching order level of the acquired latch. */
|
2005-10-27 07:29:40 +00:00
|
|
|
UNIV_INLINE
|
|
|
|
void
|
2006-10-12 11:05:22 +00:00
|
|
|
buf_block_dbg_add_level(
|
|
|
|
/*====================*/
|
|
|
|
buf_block_t* block, /* in: buffer page
|
2006-02-23 19:25:29 +00:00
|
|
|
where we have acquired latch */
|
2006-10-12 11:05:22 +00:00
|
|
|
ulint level) /* in: latching order level */
|
2005-10-27 07:29:40 +00:00
|
|
|
{
|
2006-10-12 11:05:22 +00:00
|
|
|
sync_thread_add_level(&block->lock, level);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
#endif /* UNIV_SYNC_DEBUG */
|