Commit d118d29e authored by marko's avatar marko

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.
  ------------------------------------------------------------------------
parent ac85039b
2009-01-27 The InnoDB Team
* buf/buf0lru.c:
Fix a race condition in buf_LRU_invalidate_tablespace():
The compressed page size (zip_size) was read while the block
descriptor was no longer protected by a mutex. This could lead to
corruption when a table is dropped on a busy system that contains
compressed tables.
2009-01-26 The InnoDB Team
* include/buf0buf.h, include/buf0buf.ic, buf/buf0buf.c,
include/mtr0log.ic, include/row0upd.ic, mtr/mtr0mtr.c,
btr/btr0sea.c:
Implement buf_block_align() with pointer arithmetics, as it is in
the built-in InnoDB distributed with MySQL. Do not acquire the
buffer pool mutex before buf_block_align(). This removes a
scalability bottleneck in the adaptive hash index lookup. In
CHECK TABLE, check that buf_pool->page_hash is consistent with
buf_block_align().
2009-01-23 The InnoDB Team
* btr/btr0sea.c:
Fix Bug#42279 Race condition in btr_search_drop_page_hash_when_freed()
2009-01-23 The InnoDB Team
* include/buf0buf.h, buf/buf0buf.c:
Remove the unused mode BUF_GET_NOWAIT of buf_page_get_gen()
2009-01-20 The InnoDB Team
* include/rem0rec.h, include/rem0rec.ic:
Fix Bug#41571 MySQL segfaults after innodb recovery
2009-01-20 The InnoDB Team
* lock/lock0lock.c:
Fix Bug#42152 Race condition in lock_is_table_exclusive()
2009-01-14 The InnoDB Team
* include/trx0roll.h, trx/trx0roll.c, trx/trx0trx.c:
......
......@@ -758,7 +758,6 @@ btr_search_guess_on_hash(
{
buf_block_t* block;
rec_t* rec;
const page_t* page;
ulint fold;
dulint index_id;
#ifdef notdefined
......@@ -809,29 +808,7 @@ btr_search_guess_on_hash(
goto failure_unlock;
}
page = page_align(rec);
{
ulint page_no = page_get_page_no(page);
ulint space_id = page_get_space_id(page);
buf_pool_mutex_enter();
block = (buf_block_t*) buf_page_hash_get(space_id, page_no);
buf_pool_mutex_exit();
}
if (UNIV_UNLIKELY(!block)
|| UNIV_UNLIKELY(buf_block_get_state(block)
!= BUF_BLOCK_FILE_PAGE)) {
/* The block is most probably being freed.
The function buf_LRU_search_and_free_block()
first removes the block from buf_pool->page_hash
by calling buf_LRU_block_remove_hashed_page().
After that, it invokes btr_search_drop_page_hash_index().
Let us pretend that the block was also removed from
the adaptive hash index. */
goto failure_unlock;
}
block = buf_block_align(rec);
if (UNIV_LIKELY(!has_search_latch)) {
......@@ -848,8 +825,9 @@ btr_search_guess_on_hash(
buf_block_dbg_add_level(block, SYNC_TREE_NODE_FROM_HASH);
}
if (UNIV_UNLIKELY(buf_block_get_state(block)
== BUF_BLOCK_REMOVE_HASH)) {
if (UNIV_UNLIKELY(buf_block_get_state(block) != BUF_BLOCK_FILE_PAGE)) {
ut_ad(buf_block_get_state(block) == BUF_BLOCK_REMOVE_HASH);
if (UNIV_LIKELY(!has_search_latch)) {
btr_leaf_page_release(block, latch_mode, mtr);
......@@ -858,7 +836,6 @@ btr_search_guess_on_hash(
goto failure;
}
ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
ut_ad(page_rec_is_user_rec(rec));
btr_cur_position(index, rec, block, cursor);
......@@ -870,8 +847,8 @@ btr_search_guess_on_hash(
is positioned on. We cannot look at the next of the previous
record to determine if our guess for the cursor position is
right. */
if (UNIV_EXPECT(
ut_dulint_cmp(index_id, btr_page_get_index_id(page)), 0)
if (UNIV_EXPECT
(ut_dulint_cmp(index_id, btr_page_get_index_id(block->frame)), 0)
|| !btr_search_check_guess(cursor,
has_search_latch,
tuple, mode, mtr)) {
......@@ -1155,10 +1132,18 @@ btr_search_drop_page_hash_when_freed(
block = buf_page_get_gen(space, zip_size, page_no, RW_S_LATCH, NULL,
BUF_GET_IF_IN_POOL, __FILE__, __LINE__,
&mtr);
/* Because the buffer pool mutex was released by
buf_page_peek_if_search_hashed(), it is possible that the
block was removed from the buffer pool by another thread
before buf_page_get_gen() got a chance to acquire the buffer
pool mutex again. Thus, we must check for a NULL return. */
buf_block_dbg_add_level(block, SYNC_TREE_NODE_FROM_HASH);
if (UNIV_LIKELY(block != NULL)) {
btr_search_drop_page_hash_index(block);
buf_block_dbg_add_level(block, SYNC_TREE_NODE_FROM_HASH);
btr_search_drop_page_hash_index(block);
}
mtr_commit(&mtr);
}
......@@ -1682,7 +1667,6 @@ btr_search_validate(void)
/*=====================*/
/* out: TRUE if ok */
{
page_t* page;
ha_node_t* node;
ulint n_page_dumps = 0;
ibool ok = TRUE;
......@@ -1717,28 +1701,40 @@ btr_search_validate(void)
node = hash_get_nth_cell(btr_search_sys->hash_index, i)->node;
for (; node != NULL; node = node->next) {
const buf_block_t* block;
page = page_align(node->data);
{
ulint page_no = page_get_page_no(page);
ulint space_id= page_get_space_id(page);
block = buf_block_hash_get(space_id, page_no);
const buf_block_t* block
= buf_block_align(node->data);
const buf_block_t* hash_block;
if (UNIV_LIKELY(buf_block_get_state(block)
== BUF_BLOCK_FILE_PAGE)) {
/* The space and offset are only valid
for file blocks. It is possible that
the block is being freed
(BUF_BLOCK_REMOVE_HASH, see the
assertion and the comment below) */
hash_block = buf_block_hash_get(
buf_block_get_space(block),
buf_block_get_page_no(block));
} else {
hash_block = NULL;
}
if (UNIV_UNLIKELY(!block)) {
/* The block is most probably being freed.
The function buf_LRU_search_and_free_block()
first removes the block from
if (hash_block) {
ut_a(hash_block == block);
} else {
/* When a block is being freed,
buf_LRU_search_and_free_block() first
removes the block from
buf_pool->page_hash by calling
buf_LRU_block_remove_hashed_page().
After that, it invokes
btr_search_drop_page_hash_index().
Let us pretend that the block was also removed
from the adaptive hash index. */
continue;
btr_search_drop_page_hash_index() to
remove the block from
btr_search_sys->hash_index. */
ut_a(buf_block_get_state(block)
== BUF_BLOCK_REMOVE_HASH);
}
ut_a(!dict_index_is_ibuf(block->index));
......@@ -1754,7 +1750,9 @@ btr_search_validate(void)
offsets,
block->curr_n_fields,
block->curr_n_bytes,
btr_page_get_index_id(page))) {
btr_page_get_index_id(block->frame))) {
const page_t* page = block->frame;
ok = FALSE;
ut_print_timestamp(stderr);
......
......@@ -35,7 +35,6 @@ Created 11/5/1995 Heikki Tuuri
#include "ibuf0ibuf.h"
#include "dict0dict.h"
#include "log0recv.h"
#include "log0log.h"
#include "trx0undo.h"
#include "srv0srv.h"
#include "page0zip.h"
......@@ -1812,6 +1811,53 @@ buf_zip_decompress(
return(FALSE);
}
/***********************************************************************
Gets the block to whose frame the pointer is pointing to. */
UNIV_INTERN
buf_block_t*
buf_block_align(
/*============*/
/* out: pointer to block, never NULL */
const byte* ptr) /* in: pointer to a frame */
{
buf_chunk_t* chunk;
ulint i;
/* TODO: protect buf_pool->chunks with a mutex (it will
currently remain constant after buf_pool_init()) */
for (chunk = buf_pool->chunks, i = buf_pool->n_chunks; i--; chunk++) {
lint offs = ptr - chunk->blocks->frame;
if (UNIV_UNLIKELY(offs < 0)) {
continue;
}
offs >>= UNIV_PAGE_SIZE_SHIFT;
if (UNIV_LIKELY((ulint) offs < chunk->size)) {
buf_block_t* block = &chunk->blocks[offs];
/* The function buf_chunk_init() invokes
buf_block_init() so that block[n].frame ==
block->frame + n * UNIV_PAGE_SIZE. Check it. */
ut_ad(block->frame == page_align(ptr));
/* The space id and page number should be
stamped on the page. */
ut_ad(block->page.space
== page_get_space_id(page_align(ptr)));
ut_ad(block->page.offset
== page_get_page_no(page_align(ptr)));
return(block);
}
}
/* The block should always be found. */
ut_error;
return(NULL);
}
/************************************************************************
Find out if a buffer block was created by buf_chunk_init(). */
static
......@@ -1861,7 +1907,7 @@ buf_page_get_gen(
ulint rw_latch,/* in: RW_S_LATCH, RW_X_LATCH, RW_NO_LATCH */
buf_block_t* guess, /* in: guessed block or NULL */
ulint mode, /* in: BUF_GET, BUF_GET_IF_IN_POOL,
BUF_GET_NO_LATCH, BUF_GET_NOWAIT or
BUF_GET_NO_LATCH, or
BUF_GET_IF_IN_POOL_OR_WATCH */
const char* file, /* in: file name */
ulint line, /* in: line where called */
......@@ -1880,7 +1926,6 @@ buf_page_get_gen(
ut_ad(mode == BUF_GET
|| mode == BUF_GET_IF_IN_POOL
|| mode == BUF_GET_NO_LATCH
|| mode == BUF_GET_NOWAIT
|| mode == BUF_GET_IF_IN_POOL_OR_WATCH);
ut_ad(zip_size == fil_space_get_zip_size(space));
#ifndef UNIV_LOG_DEBUG
......@@ -2136,29 +2181,8 @@ wait_until_unfixed:
ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
if (mode == BUF_GET_NOWAIT) {
ibool success;
if (rw_latch == RW_S_LATCH) {
success = rw_lock_s_lock_func_nowait(&(block->lock),
file, line);
fix_type = MTR_MEMO_PAGE_S_FIX;
} else {
ut_ad(rw_latch == RW_X_LATCH);
success = rw_lock_x_lock_func_nowait(&(block->lock),
file, line);
fix_type = MTR_MEMO_PAGE_X_FIX;
}
if (!success) {
mutex_enter(&block->mutex);
buf_block_buf_fix_dec(block);
mutex_exit(&block->mutex);
return(NULL);
}
} else if (rw_latch == RW_NO_LATCH) {
switch (rw_latch) {
case RW_NO_LATCH:
if (must_read) {
/* Let us wait until the read operation
completes */
......@@ -2180,15 +2204,20 @@ wait_until_unfixed:
}
fix_type = MTR_MEMO_BUF_FIX;
} else if (rw_latch == RW_S_LATCH) {
break;
case RW_S_LATCH:
rw_lock_s_lock_func(&(block->lock), 0, file, line);
fix_type = MTR_MEMO_PAGE_S_FIX;
} else {
break;
default:
ut_ad(rw_latch == RW_X_LATCH);
rw_lock_x_lock_func(&(block->lock), 0, file, line);
fix_type = MTR_MEMO_PAGE_X_FIX;
break;
}
mtr_memo_push(mtr, block, fix_type);
......
......@@ -300,7 +300,6 @@ buf_LRU_invalidate_tablespace(
ulint id) /* in: space id */
{
buf_page_t* bpage;
ulint page_no;
ibool all_freed;
/* Before we attempt to drop pages one by one we first
......@@ -351,18 +350,21 @@ scan_again:
#endif
if (buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE
&& ((buf_block_t*) bpage)->is_hashed) {
page_no = buf_page_get_page_no(bpage);
ulint page_no;
ulint zip_size;
buf_pool_mutex_exit();
zip_size = buf_page_get_zip_size(bpage);
page_no = buf_page_get_page_no(bpage);
mutex_exit(block_mutex);
/* Note that the following call will acquire
an S-latch on the page */
btr_search_drop_page_hash_when_freed(
id,
buf_page_get_zip_size(bpage),
page_no);
id, zip_size, page_no);
goto scan_again;
}
......
......@@ -16,8 +16,6 @@ Created 1/8/1996 Heikki Tuuri
#include "data0type.h"
#include "mach0data.h"
#include "dict0dict.h"
#include "que0que.h"
#include "pars0pars.h"
#include "lock0lock.h"
#define DICT_HEAP_SIZE 100 /* initial memory heap size when
......
......@@ -18,7 +18,6 @@ Created 10/25/1995 Heikki Tuuri
#include "buf0buf.h"
#include "buf0flu.h"
#include "buf0lru.h"
#include "log0log.h"
#include "log0recv.h"
#include "fsp0fsp.h"
#include "srv0srv.h"
......
......@@ -9578,7 +9578,7 @@ static MYSQL_SYSVAR_ULONG(replication_delay, srv_replication_delay,
static MYSQL_SYSVAR_LONG(additional_mem_pool_size, innobase_additional_mem_pool_size,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Size of a memory pool InnoDB uses to store data dictionary information and other internal data structures.",
NULL, NULL, 1*1024*1024L, 512*1024L, ~0L, 1024);
NULL, NULL, 1*1024*1024L, 512*1024L, LONG_MAX, 1024);
static MYSQL_SYSVAR_ULONG(autoextend_increment, srv_auto_extend_increment,
PLUGIN_VAR_RQCMDARG,
......@@ -9613,7 +9613,7 @@ static MYSQL_SYSVAR_LONG(force_recovery, innobase_force_recovery,
static MYSQL_SYSVAR_LONG(log_buffer_size, innobase_log_buffer_size,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"The size of the buffer which InnoDB uses to write log to the log files on disk.",
NULL, NULL, 1024*1024L, 256*1024L, ~0L, 1024);
NULL, NULL, 1024*1024L, 256*1024L, LONG_MAX, 1024);
static MYSQL_SYSVAR_LONGLONG(log_file_size, innobase_log_file_size,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
......@@ -9633,7 +9633,7 @@ static MYSQL_SYSVAR_LONG(mirrored_log_groups, innobase_mirrored_log_groups,
static MYSQL_SYSVAR_LONG(open_files, innobase_open_files,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"How many files at the maximum InnoDB keeps open at the same time.",
NULL, NULL, 300L, 10L, ~0L, 0);
NULL, NULL, 300L, 10L, LONG_MAX, 0);
static MYSQL_SYSVAR_ULONG(sync_spin_loops, srv_n_spin_wait_rounds,
PLUGIN_VAR_RQCMDARG,
......
......@@ -14,7 +14,6 @@ Created 6/2/1994 Heikki Tuuri
#include "dict0dict.h"
#include "data0data.h"
#include "page0cur.h"
#include "rem0rec.h"
#include "mtr0mtr.h"
#include "btr0types.h"
......
......@@ -11,7 +11,6 @@ Created 10/16/1994 Heikki Tuuri
#include "univ.i"
#include "dict0dict.h"
#include "data0data.h"
#include "page0cur.h"
#include "btr0types.h"
#include "que0types.h"
......
......@@ -37,8 +37,6 @@ Created 11/5/1995 Heikki Tuuri
/* Modes for buf_page_get_gen */
#define BUF_GET 10 /* get always */
#define BUF_GET_IF_IN_POOL 11 /* get if in pool */
#define BUF_GET_NOWAIT 12 /* get if can set the latch without
waiting */
#define BUF_GET_NO_LATCH 14 /* get and bufferfix, but set no latch;
we have separated this case, because
it is error-prone programming not to
......@@ -177,12 +175,6 @@ with care. */
SP, ZS, OF, RW_NO_LATCH, NULL,\
BUF_GET_NO_LATCH, __FILE__, __LINE__, MTR)
/******************************************************************
NOTE! The following macros should be used instead of buf_page_get_gen, to
improve debugging. Only values RW_S_LATCH and RW_X_LATCH are allowed as LA! */
#define buf_page_get_nowait(SP, ZS, OF, LA, MTR) buf_page_get_gen(\
SP, ZS, OF, LA, NULL,\
BUF_GET_NOWAIT, __FILE__, __LINE__, MTR)
/******************************************************************
NOTE! The following macros should be used instead of
buf_page_optimistic_get_func, to improve debugging. Only values RW_S_LATCH and
RW_X_LATCH are allowed as LA! */
......@@ -872,15 +864,15 @@ Gets the compressed page descriptor corresponding to an uncompressed page
if applicable. */
#define buf_block_get_page_zip(block) \
(UNIV_LIKELY_NULL((block)->page.zip.data) ? &(block)->page.zip : NULL)
#if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
/***********************************************************************
Gets the block to whose frame the pointer is pointing to. */
UNIV_INLINE
const buf_block_t*
UNIV_INTERN
buf_block_t*
buf_block_align(
/*============*/
/* out: pointer to block */
/* out: pointer to block, never NULL */
const byte* ptr); /* in: pointer to a frame */
#if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
/*************************************************************************
Gets the compressed page descriptor corresponding to an uncompressed page
if applicable. */
......
......@@ -631,29 +631,6 @@ buf_block_get_zip_size(
}
#if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
/***********************************************************************
Gets the block to whose frame the pointer is pointing to. */
UNIV_INLINE
const buf_block_t*
buf_block_align(
/*============*/
/* out: pointer to block */
const byte* ptr) /* in: pointer to a frame */
{
const buf_block_t* block;
ulint space_id, page_no;
ptr = (const byte*) ut_align_down(ptr, UNIV_PAGE_SIZE);
page_no = mach_read_from_4(ptr + FIL_PAGE_OFFSET);
space_id = mach_read_from_4(ptr + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
block = (const buf_block_t*) buf_page_hash_get(space_id, page_no);
ut_ad(block);
ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
ut_ad(block->frame == ptr);
return(block);
}
/*************************************************************************
Gets the compressed page descriptor corresponding to an uncompressed page
if applicable. */
......@@ -664,11 +641,7 @@ buf_frame_get_page_zip(
/* out: compressed page descriptor, or NULL */
const byte* ptr) /* in: pointer to the page */
{
const page_zip_des_t* page_zip;
buf_pool_mutex_enter();
page_zip = buf_block_get_page_zip(buf_block_align(ptr));
buf_pool_mutex_exit();
return(page_zip);
return(buf_block_get_page_zip(buf_block_align(ptr)));
}
#endif /* UNIV_DEBUG || UNIV_ZIP_DEBUG */
......
......@@ -18,7 +18,6 @@ Created 1/8/1996 Heikki Tuuri
#include "sync0rw.h"
#include "mem0mem.h"
#include "rem0types.h"
#include "btr0types.h"
#include "ut0mem.h"
#include "ut0lst.h"
#include "hash0hash.h"
......
......@@ -12,7 +12,6 @@ Created 1/8/1996 Heikki Tuuri
#include "univ.i"
#include "dict0types.h"
#include "data0type.h"
#include "data0data.h"
#include "mem0mem.h"
#include "rem0types.h"
#include "btr0types.h"
......
......@@ -12,7 +12,6 @@ Created 7/19/1997 Heikki Tuuri
#include "univ.i"
#include "dict0mem.h"
#include "dict0dict.h"
#include "mtr0mtr.h"
#include "que0types.h"
#include "ibuf0types.h"
......
......@@ -255,6 +255,7 @@ UNIV_INTERN
void
log_groups_write_checkpoint_info(void);
/*==================================*/
#ifdef UNIV_HOTBACKUP
/**********************************************************
Writes info to a buffer of a log group when log files are created in
backup restoration. */
......@@ -267,6 +268,7 @@ log_reset_first_header_and_checkpoint(
ib_uint64_t start); /* in: lsn of the start of the first log file;
we pretend that there is a checkpoint at
start + LOG_BLOCK_HDR_SIZE */
#endif /* UNIV_HOTBACKUP */
/************************************************************************
Starts an archiving operation. */
UNIV_INTERN
......@@ -514,7 +516,9 @@ extern log_t* log_sys;
/* Values used as flags */
#define LOG_FLUSH 7652559
#define LOG_CHECKPOINT 78656949
#define LOG_ARCHIVE 11122331
#ifdef UNIV_LOG_ARCHIVE
# define LOG_ARCHIVE 11122331
#endif /* UNIV_LOG_ARCHIVE */
#define LOG_RECOVER 98887331
/* The counting of lsn's starts from this value: this must be non-zero */
......
......@@ -91,16 +91,25 @@ recv_recovery_from_checkpoint_finish should be called later to complete
the recovery and free the resources used in it. */
UNIV_INTERN
ulint
recv_recovery_from_checkpoint_start(
/*================================*/
recv_recovery_from_checkpoint_start_func(
/*=====================================*/
/* out: error code or DB_SUCCESS */
#ifdef UNIV_LOG_ARCHIVE
ulint type, /* in: LOG_CHECKPOINT or LOG_ARCHIVE */
ib_uint64_t limit_lsn, /* in: recover up to this lsn
if possible */
#endif /* UNIV_LOG_ARCHIVE */
ib_uint64_t min_flushed_lsn,/* in: min flushed lsn from
data files */
ib_uint64_t max_flushed_lsn);/* in: max flushed lsn from
data files */
#ifdef UNIV_LOG_ARCHIVE
# define recv_recovery_from_checkpoint_start(type,lim,min,max) \
recv_recovery_from_checkpoint_start_func(type,lim,min,max)
#else /* UNIV_LOG_ARCHIVE */
# define recv_recovery_from_checkpoint_start(type,lim,min,max) \
recv_recovery_from_checkpoint_start_func(min,max)
#endif /* UNIV_LOG_ARCHIVE */
/************************************************************
Completes recovery from a checkpoint. */
UNIV_INTERN
......@@ -321,9 +330,11 @@ struct recv_sys_struct{
scan find a corrupt log block, or a corrupt
log record, or there is a log parsing
buffer overflow */
#ifdef UNIV_LOG_ARCHIVE
log_group_t* archive_group;
/* in archive recovery: the log group whose
archive is read */
#endif /* !UNIV_LOG_ARCHIVE */
mem_heap_t* heap; /* memory heap of log records and file
addresses*/
hash_table_t* addr_hash;/* hash table of file addresses of pages */
......
......@@ -6,10 +6,7 @@ Recovery
Created 9/20/1997 Heikki Tuuri
*******************************************************/
#include "sync0sync.h"
#include "mem0mem.h"
#include "log0log.h"
#include "os0file.h"
#include "univ.i"
extern ibool recv_recovery_from_backup_on;
......
......@@ -191,10 +191,8 @@ mlog_write_initial_log_record_fast(
#endif
#ifdef UNIV_DEBUG
buf_pool_mutex_enter();
/* We now assume that all x-latched pages have been modified! */
block = (buf_block_t*) buf_block_align(ptr);
buf_pool_mutex_exit();
if (!mtr_memo_contains(mtr, block, MTR_MEMO_MODIFY)) {
......
......@@ -139,9 +139,7 @@ row_upd_rec_sys_fields(
ut_ad(rec_offs_validate(rec, index, offsets));
#ifdef UNIV_SYNC_DEBUG
if (!rw_lock_own(&btr_search_latch, RW_LOCK_EX)) {
buf_pool_mutex_enter();
ut_ad(!buf_block_align(rec)->is_hashed);
buf_pool_mutex_exit();
}
#endif /* UNIV_SYNC_DEBUG */
......
......@@ -13,7 +13,6 @@ Created 3/26/1996 Heikki Tuuri
#include "trx0types.h"
#include "row0types.h"
#include "mtr0mtr.h"
#include "trx0sys.h"
#include "dict0types.h"
#include "que0types.h"
#include "data0data.h"
......
......@@ -8,7 +8,6 @@ Created 3/26/1996 Heikki Tuuri
#include "srv0srv.h"
#include "trx0trx.h"
#include "data0type.h"
/* The typedef for rseg slot in the file copy */
typedef byte trx_sysf_rseg_t;
......
......@@ -9,7 +9,6 @@ Created 3/26/1996 Heikki Tuuri
#ifndef trx0types_h
#define trx0types_h
#include "lock0types.h"
#include "ut0byte.h"
/* prepare trx_t::id for being printed via printf(3) */
......
......@@ -196,6 +196,7 @@ void
ut_sprintf_timestamp(
/*=================*/
char* buf); /* in: buffer where to sprintf */
#ifdef UNIV_HOTBACKUP
/**************************************************************
Sprintfs a timestamp to a buffer with no spaces and with ':' characters
replaced by '_'. */
......@@ -213,6 +214,7 @@ ut_get_year_month_day(
ulint* year, /* out: current year */
ulint* month, /* out: month */
ulint* day); /* out: day */
#endif /* UNIV_HOTBACKUP */
/*****************************************************************
Runs an idle loop on CPU. The argument gives the desired delay
in microseconds on 100 MHz Pentium + Visual C++. */
......
......@@ -1782,6 +1782,7 @@ log_group_checkpoint(
}
}
#ifdef UNIV_HOTBACKUP
/**********************************************************
Writes info to a buffer of a log group when log files are created in
backup restoration. */
......@@ -1833,6 +1834,7 @@ log_reset_first_header_and_checkpoint(
allocated size in the tablespace, but unfortunately we do not
know it here */
}
#endif /* UNIV_HOTBACKUP */
/**********************************************************
Reads a checkpoint info from a log group header to log_sys->checkpoint_buf. */
......
......@@ -18,23 +18,14 @@ Created 9/20/1997 Heikki Tuuri
#include "buf0rea.h"
#include "srv0srv.h"
#include "srv0start.h"
#include "mtr0mtr.h"
#include "mtr0log.h"
#include "page0page.h"
#include "page0cur.h"
#include "page0zip.h"
#include "btr0btr.h"
#include "btr0cur.h"
#include "ibuf0ibuf.h"
#include "trx0undo.h"
#include "trx0rec.h"
#include "trx0roll.h"
#include "btr0cur.h"
#include "btr0cur.h"
#include "btr0cur.h"
#include "dict0boot.h"
#include "fil0fil.h"
#include "sync0sync.h"
#include "row0merge.h"
#ifdef UNIV_HOTBACKUP
......@@ -2568,12 +2559,14 @@ recv_recovery_from_checkpoint_finish should be called later to complete
the recovery and free the resources used in it. */
UNIV_INTERN
ulint
recv_recovery_from_checkpoint_start(
/*================================*/
recv_recovery_from_checkpoint_start_func(
/*=====================================*/
/* out: error code or DB_SUCCESS */
#ifdef UNIV_LOG_ARCHIVE
ulint type, /* in: LOG_CHECKPOINT or LOG_ARCHIVE */
ib_uint64_t limit_lsn, /* in: recover up to this lsn
if possible */
#endif /* UNIV_LOG_ARCHIVE */
ib_uint64_t min_flushed_lsn,/* in: min flushed lsn from
data files */
ib_uint64_t max_flushed_lsn)/* in: max flushed lsn from
......@@ -2589,14 +2582,20 @@ recv_recovery_from_checkpoint_start(
ib_uint64_t group_scanned_lsn;
ib_uint64_t contiguous_lsn;
ib_uint64_t archived_lsn;
ulint capacity;
byte* buf;
byte log_hdr_buf[LOG_FILE_HDR_SIZE];
ulint err;
#ifdef UNIV_LOG_ARCHIVE
ut_ad(type != LOG_CHECKPOINT || limit_lsn == IB_ULONGLONG_MAX);
# define TYPE_CHECKPOINT (type == LOG_CHECKPOINT)
# define LIMIT_LSN limit_lsn
#else /* UNIV_LOG_ARCHIVE */
# define TYPE_CHECKPOINT 1
# define LIMIT_LSN IB_ULONGLONG_MAX
#endif /* UNIV_LOG_ARCHIVE */
if (type == LOG_CHECKPOINT) {
if (TYPE_CHECKPOINT) {
recv_sys_create();
recv_sys_init(FALSE, buf_pool_get_curr_size());
}
......@@ -2612,7 +2611,7 @@ recv_recovery_from_checkpoint_start(
recv_recovery_on = TRUE;
recv_sys->limit_lsn = limit_lsn;
recv_sys->limit_lsn = LIMIT_LSN;
mutex_enter(&(log_sys->mutex));
......@@ -2679,7 +2678,7 @@ recv_recovery_from_checkpoint_start(
}
#endif /* UNIV_LOG_ARCHIVE */
if (type == LOG_CHECKPOINT) {
if (TYPE_CHECKPOINT) {
/* Start reading the log groups from the checkpoint lsn up. The
variable contiguous_lsn contains an lsn up to which the log is
known to be contiguously written to all log groups. */
......@@ -2694,7 +2693,12 @@ recv_recovery_from_checkpoint_start(
contiguous_lsn = ut_uint64_align_down(recv_sys->scanned_lsn,
OS_FILE_LOG_BLOCK_SIZE);
if (type == LOG_ARCHIVE) {
if (TYPE_CHECKPOINT) {
up_to_date_group = max_cp_group;
#ifdef UNIV_LOG_ARCHIVE
} else {
ulint capacity;
/* Try to recover the remaining part from logs: first from
the logs of the archived group */
......@@ -2727,20 +2731,21 @@ recv_recovery_from_checkpoint_start(
group->scanned_lsn = group_scanned_lsn;
up_to_date_group = group;
} else {
up_to_date_group = max_cp_group;
#endif /* UNIV_LOG_ARCHIVE */
}
ut_ad(RECV_SCAN_SIZE <= log_sys->buf_size);
group = UT_LIST_GET_FIRST(log_sys->log_groups);
#ifdef UNIV_LOG_ARCHIVE
if ((type == LOG_ARCHIVE) && (group == recv_sys->archive_group)) {
group = UT_LIST_GET_NEXT(log_groups, group);
}
#endif /* UNIV_LOG_ARCHIVE */
/* Set the flag to publish that we are doing startup scan. */
recv_log_scan_is_startup_type = (type == LOG_CHECKPOINT);
recv_log_scan_is_startup_type = TYPE_CHECKPOINT;
while (group) {
old_scanned_lsn = recv_sys->scanned_lsn;
......@@ -2754,17 +2759,19 @@ recv_recovery_from_checkpoint_start(
up_to_date_group = group;
}
#ifdef UNIV_LOG_ARCHIVE
if ((type == LOG_ARCHIVE)
&& (group == recv_sys->archive_group)) {
group = UT_LIST_GET_NEXT(log_groups, group);
}
#endif /* UNIV_LOG_ARCHIVE */
group = UT_LIST_GET_NEXT(log_groups, group);
}
/* Done with startup scan. Clear the flag. */
recv_log_scan_is_startup_type = FALSE;
if (type == LOG_CHECKPOINT) {
if (TYPE_CHECKPOINT) {
/* NOTE: we always do a 'recovery' at startup, but only if
there is something wrong we will print a message to the
user about recovery: */
......@@ -2842,7 +2849,7 @@ recv_recovery_from_checkpoint_start(
mutex_exit(&(log_sys->mutex));
if (recv_sys->recovered_lsn >= limit_lsn) {
if (recv_sys->recovered_lsn >= LIMIT_LSN) {
return(DB_SUCCESS);
}
......@@ -2905,6 +2912,9 @@ recv_recovery_from_checkpoint_start(
records in the hash table can be run in background. */
return(DB_SUCCESS);
#undef TYPE_CHECKPOINT
#undef LIMIT_LSN
}
/************************************************************
......
......@@ -14,8 +14,6 @@ Created 6/9/1994 Heikki Tuuri
#include "mach0data.h"
#include "buf0buf.h"
#include "btr0sea.h"
#include "srv0srv.h"
#include "mem0dbg.c"
#include <stdarg.h>
......
......@@ -309,12 +309,7 @@ mtr_memo_contains_page(
const byte* ptr, /* in: pointer to buffer frame */
ulint type) /* in: type of object */
{
ibool ret;
buf_pool_mutex_enter();
ret = mtr_memo_contains(mtr, buf_block_align(ptr), type);
buf_pool_mutex_exit();
return(ret);
return(mtr_memo_contains(mtr, buf_block_align(ptr), type));
}
/*************************************************************
......
diff mysql-test/t/innodb_file_per_table_basic.test.orig mysql-test/t/innodb_file_per_table_basic.test
--- mysql-test/t/innodb_file_per_table_basic.test.orig 2008-10-07 11:32:30.000000000 +0300
+++ mysql-test/t/innodb_file_per_table_basic.test 2008-10-07 11:52:14.000000000 +0300
diff mysql-test/suite/sys_vars/t/innodb_file_per_table_basic.test.orig mysql-test/suite/sys_vars/t/innodb_file_per_table_basic.test
--- mysql-test/suite/sys_vars/t/innodb_file_per_table_basic.test.orig 2008-10-07 11:32:30.000000000 +0300
+++ mysql-test/suite/sys_vars/t/innodb_file_per_table_basic.test 2008-10-07 11:52:14.000000000 +0300
@@ -37,10 +37,6 @@
# Check if Value can set #
####################################################################
......@@ -21,9 +21,9 @@ diff mysql-test/t/innodb_file_per_table_basic.test.orig mysql-test/t/innodb_file
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_file_per_table';
--echo 1 Expected
diff mysql-test/t/innodb_file_per_table_basic.result.orig mysql-test/t/innodb_file_per_table_basic.result
--- mysql-test/r/innodb_file_per_table_basic.result.orig 2008-10-07 11:32:02.000000000 +0300
+++ mysql-test/r/innodb_file_per_table_basic.result 2008-10-07 11:52:47.000000000 +0300
diff mysql-test/suite/sys_vars/r/innodb_file_per_table_basic.result.orig mysql-test/suite/sys_vars/r/innodb_file_per_table_basic.result
--- mysql-test/suite/sys_vars/r/innodb_file_per_table_basic.result.orig 2008-10-07 11:32:02.000000000 +0300
+++ mysql-test/suite/sys_vars/r/innodb_file_per_table_basic.result 2008-10-07 11:52:47.000000000 +0300
@@ -4,18 +4,15 @@
1
1 Expected
......
--- mysql-test/t/innodb_lock_wait_timeout_basic.test.orig 2008-08-04 09:28:16.000000000 +0300
+++ mysql-test/t/innodb_lock_wait_timeout_basic.test 2008-10-07 11:14:15.000000000 +0300
--- mysql-test/suite/sys_vars/t/innodb_lock_wait_timeout_basic.test.orig 2008-08-04 09:28:16.000000000 +0300
+++ mysql-test/suite/sys_vars/t/innodb_lock_wait_timeout_basic.test 2008-10-07 11:14:15.000000000 +0300
@@ -37,10 +37,6 @@
# Check if Value can set #
####################################################################
......@@ -25,8 +25,8 @@
SELECT COUNT(@@GLOBAL.innodb_lock_wait_timeout);
--echo 1 Expected
--- mysql-test/r/innodb_lock_wait_timeout_basic.result.orig 2008-08-04 09:27:50.000000000 +0300
+++ mysql-test/r/innodb_lock_wait_timeout_basic.result 2008-10-07 11:15:14.000000000 +0300
--- mysql-test/suite/sys_vars/r/innodb_lock_wait_timeout_basic.result.orig 2008-08-04 09:27:50.000000000 +0300
+++ mysql-test/suite/sys_vars/r/innodb_lock_wait_timeout_basic.result 2008-10-07 11:15:14.000000000 +0300
@@ -4,9 +4,6 @@
1
1 Expected
......
......@@ -12,7 +12,6 @@ Created 10/4/1994 Heikki Tuuri
#endif
#include "page0zip.h"
#include "rem0cmp.h"
#include "mtr0log.h"
#include "log0recv.h"
#include "rem0cmp.h"
......
......@@ -270,6 +270,7 @@ ut_sprintf_timestamp(
#endif
}
#ifdef UNIV_HOTBACKUP
/**************************************************************
Sprintfs a timestamp to a buffer with no spaces and with ':' characters
replaced by '_'. */
......@@ -350,6 +351,7 @@ ut_get_year_month_day(
*day = (ulint)cal_tm_ptr->tm_mday;
#endif
}
#endif /* UNIV_HOTBACKUP */
/*****************************************************************
Runs an idle loop on CPU. The argument gives the desired delay
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment