2005-10-27 07:29:40 +00:00
|
|
|
/******************************************************
|
|
|
|
Recovery
|
|
|
|
|
|
|
|
(c) 1997 Innobase Oy
|
|
|
|
|
|
|
|
Created 9/20/1997 Heikki Tuuri
|
|
|
|
*******************************************************/
|
|
|
|
|
|
|
|
#include "log0recv.h"
|
|
|
|
|
|
|
|
#ifdef UNIV_NONINL
|
|
|
|
#include "log0recv.ic"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "mem0mem.h"
|
|
|
|
#include "buf0buf.h"
|
|
|
|
#include "buf0flu.h"
|
|
|
|
#include "buf0rea.h"
|
|
|
|
#include "srv0srv.h"
|
|
|
|
#include "srv0start.h"
|
|
|
|
#include "mtr0log.h"
|
|
|
|
#include "page0cur.h"
|
2005-10-27 11:48:10 +00:00
|
|
|
#include "page0zip.h"
|
2005-10-27 07:29:40 +00:00
|
|
|
#include "btr0cur.h"
|
|
|
|
#include "ibuf0ibuf.h"
|
|
|
|
#include "trx0undo.h"
|
|
|
|
#include "trx0rec.h"
|
|
|
|
#include "trx0roll.h"
|
2007-09-05 10:18:03 +00:00
|
|
|
#include "row0merge.h"
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
#ifdef UNIV_HOTBACKUP
|
|
|
|
/* This is set to FALSE if the backup was originally taken with the
|
|
|
|
ibbackup --include regexp option: then we do not want to create tables in
|
|
|
|
directories which were not included */
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN ibool recv_replay_file_ops = TRUE;
|
2005-10-27 07:29:40 +00:00
|
|
|
#endif /* UNIV_HOTBACKUP */
|
|
|
|
|
|
|
|
/* Log records are stored in the hash table in chunks at most of this size;
|
|
|
|
this must be less than UNIV_PAGE_SIZE as it is stored in the buffer pool */
|
|
|
|
#define RECV_DATA_BLOCK_SIZE (MEM_MAX_ALLOC_IN_BUF - sizeof(recv_data_t))
|
|
|
|
|
|
|
|
/* Read-ahead area in applying log records to file pages */
|
|
|
|
#define RECV_READ_AHEAD_AREA 32
|
|
|
|
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN recv_sys_t* recv_sys = NULL;
|
|
|
|
UNIV_INTERN ibool recv_recovery_on = FALSE;
|
|
|
|
UNIV_INTERN ibool recv_recovery_from_backup_on = FALSE;
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN ibool recv_needed_recovery = FALSE;
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN ibool recv_lsn_checks_on = FALSE;
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2007-08-01 11:18:43 +00:00
|
|
|
/* There are two conditions under which we scan the logs, the first
|
|
|
|
is normal startup and the second is when we do a recovery from an
|
|
|
|
archive.
|
|
|
|
This flag is set if we are doing a scan from the last checkpoint during
|
|
|
|
startup. If we find log entries that were written after the last checkpoint
|
|
|
|
we know that the server was not cleanly shutdown. We must then initialize
|
|
|
|
the crash recovery environment before attempting to store these entries in
|
|
|
|
the log hash table. */
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN ibool recv_log_scan_is_startup_type = FALSE;
|
2007-08-01 11:18:43 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
/* If the following is TRUE, the buffer pool file pages must be invalidated
|
|
|
|
after recovery and no ibuf operations are allowed; this becomes TRUE if
|
|
|
|
the log record hash table becomes too full, and log records must be merged
|
|
|
|
to file pages already before the recovery is finished: in this case no
|
|
|
|
ibuf operations are allowed, as they could modify the pages read in the
|
|
|
|
buffer pool before the pages have been recovered to the up-to-date state */
|
|
|
|
|
|
|
|
/* Recovery is running and no operations on the log files are allowed
|
|
|
|
yet: the variable name is misleading */
|
|
|
|
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN ibool recv_no_ibuf_operations = FALSE;
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
/* The following counter is used to decide when to print info on
|
|
|
|
log scan */
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN ulint recv_scan_print_counter = 0;
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN ibool recv_is_from_backup = FALSE;
|
2005-10-27 07:29:40 +00:00
|
|
|
#ifdef UNIV_HOTBACKUP
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN ibool recv_is_making_a_backup = FALSE;
|
2005-10-27 07:29:40 +00:00
|
|
|
#else
|
|
|
|
# define recv_is_making_a_backup FALSE
|
|
|
|
#endif /* UNIV_HOTBACKUP */
|
|
|
|
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN ulint recv_previous_parsed_rec_type = 999999;
|
|
|
|
UNIV_INTERN ulint recv_previous_parsed_rec_offset = 0;
|
|
|
|
UNIV_INTERN ulint recv_previous_parsed_rec_is_multi = 0;
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN ulint recv_max_parsed_page_no = 0;
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
/* This many frames must be left free in the buffer pool when we scan
|
|
|
|
the log and store the scanned log records in the buffer pool: we will
|
|
|
|
use these free frames to read in pages when we start applying the
|
2008-11-11 10:31:51 +00:00
|
|
|
log records to the database.
|
|
|
|
This is the default value. If the actual size of the buffer pool is
|
|
|
|
larger than 10 MB we'll set this value to 512. */
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN ulint recv_n_pool_free_frames = 256;
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
/* The maximum lsn we see for a page during the recovery process. If this
|
|
|
|
is bigger than the lsn we are able to scan up to, that is an indication that
|
|
|
|
the recovery failed and the database may be corrupt. */
|
|
|
|
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN ib_uint64_t recv_max_page_lsn;
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2007-08-01 11:18:43 +00:00
|
|
|
/* prototypes */
|
|
|
|
|
|
|
|
/***********************************************************
|
|
|
|
Initialize crash recovery environment. Can be called iff
|
|
|
|
recv_needed_recovery == FALSE. */
|
|
|
|
static
|
|
|
|
void
|
|
|
|
recv_init_crash_recovery(void);
|
|
|
|
/*===========================*/
|
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
/************************************************************
|
|
|
|
Creates the recovery system. */
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
void
|
|
|
|
recv_sys_create(void)
|
|
|
|
/*=================*/
|
|
|
|
{
|
|
|
|
if (recv_sys != NULL) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
recv_sys = mem_alloc(sizeof(recv_sys_t));
|
|
|
|
|
2006-05-08 06:18:59 +00:00
|
|
|
mutex_create(&recv_sys->mutex, SYNC_RECV);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
recv_sys->heap = NULL;
|
|
|
|
recv_sys->addr_hash = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************
|
|
|
|
Inits the recovery system for a recovery operation. */
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
void
|
|
|
|
recv_sys_init(
|
|
|
|
/*==========*/
|
|
|
|
ibool recover_from_backup, /* in: TRUE if this is called
|
|
|
|
to recover from a hot backup */
|
|
|
|
ulint available_memory) /* in: available memory in bytes */
|
|
|
|
{
|
|
|
|
if (recv_sys->heap != NULL) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-11-11 10:31:51 +00:00
|
|
|
/* Initialize red-black tree for fast insertions into the
|
|
|
|
flush_list during recovery process.
|
|
|
|
As this initialization is done while holding the buffer pool
|
|
|
|
mutex we perform it before acquiring recv_sys->mutex. */
|
|
|
|
buf_flush_init_flush_rbt();
|
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
mutex_enter(&(recv_sys->mutex));
|
|
|
|
|
|
|
|
if (!recover_from_backup) {
|
|
|
|
recv_sys->heap = mem_heap_create_in_buffer(256);
|
|
|
|
} else {
|
|
|
|
recv_sys->heap = mem_heap_create(256);
|
|
|
|
recv_is_from_backup = TRUE;
|
|
|
|
}
|
|
|
|
|
2008-11-11 10:31:51 +00:00
|
|
|
/* Set appropriate value of recv_n_pool_free_frames. */
|
|
|
|
if (buf_pool_get_curr_size() >= (10 * 1024 * 1024)) {
|
|
|
|
/* Buffer pool of size greater than 10 MB. */
|
|
|
|
recv_n_pool_free_frames = 512;
|
|
|
|
}
|
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
recv_sys->buf = ut_malloc(RECV_PARSING_BUF_SIZE);
|
|
|
|
recv_sys->len = 0;
|
|
|
|
recv_sys->recovered_offset = 0;
|
|
|
|
|
|
|
|
recv_sys->addr_hash = hash_create(available_memory / 64);
|
|
|
|
recv_sys->n_addrs = 0;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
recv_sys->apply_log_recs = FALSE;
|
|
|
|
recv_sys->apply_batch_on = FALSE;
|
|
|
|
|
|
|
|
recv_sys->last_block_buf_start = mem_alloc(2 * OS_FILE_LOG_BLOCK_SIZE);
|
|
|
|
|
|
|
|
recv_sys->last_block = ut_align(recv_sys->last_block_buf_start,
|
2006-08-29 09:30:31 +00:00
|
|
|
OS_FILE_LOG_BLOCK_SIZE);
|
2005-10-27 07:29:40 +00:00
|
|
|
recv_sys->found_corrupt_log = FALSE;
|
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
recv_max_page_lsn = 0;
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
mutex_exit(&(recv_sys->mutex));
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************
|
|
|
|
Empties the hash table when it has been fully processed. */
|
|
|
|
static
|
|
|
|
void
|
|
|
|
recv_sys_empty_hash(void)
|
|
|
|
/*=====================*/
|
|
|
|
{
|
|
|
|
ut_ad(mutex_own(&(recv_sys->mutex)));
|
2007-01-18 18:29:12 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
if (recv_sys->n_addrs != 0) {
|
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: Error: %lu pages with log records"
|
|
|
|
" were left unprocessed!\n"
|
|
|
|
"InnoDB: Maximum page number with"
|
|
|
|
" log records on it %lu\n",
|
2006-02-23 19:25:29 +00:00
|
|
|
(ulong) recv_sys->n_addrs,
|
2005-10-27 07:29:40 +00:00
|
|
|
(ulong) recv_max_parsed_page_no);
|
|
|
|
ut_error;
|
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
hash_table_free(recv_sys->addr_hash);
|
|
|
|
mem_heap_empty(recv_sys->heap);
|
|
|
|
|
|
|
|
recv_sys->addr_hash = hash_create(buf_pool_get_curr_size() / 256);
|
|
|
|
}
|
|
|
|
|
2007-01-02 14:36:59 +00:00
|
|
|
#ifndef UNIV_LOG_DEBUG
|
2005-10-27 07:29:40 +00:00
|
|
|
/************************************************************
|
|
|
|
Frees the recovery system. */
|
|
|
|
static
|
|
|
|
void
|
|
|
|
recv_sys_free(void)
|
|
|
|
/*===============*/
|
|
|
|
{
|
|
|
|
mutex_enter(&(recv_sys->mutex));
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
hash_table_free(recv_sys->addr_hash);
|
|
|
|
mem_heap_free(recv_sys->heap);
|
|
|
|
ut_free(recv_sys->buf);
|
|
|
|
mem_free(recv_sys->last_block_buf_start);
|
|
|
|
|
|
|
|
recv_sys->addr_hash = NULL;
|
|
|
|
recv_sys->heap = NULL;
|
|
|
|
|
|
|
|
mutex_exit(&(recv_sys->mutex));
|
2008-11-11 10:31:51 +00:00
|
|
|
|
|
|
|
/* Free up the flush_rbt. */
|
|
|
|
buf_flush_free_flush_rbt();
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
2007-01-02 14:36:59 +00:00
|
|
|
#endif /* UNIV_LOG_DEBUG */
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
/************************************************************
|
|
|
|
Truncates possible corrupted or extra records from a log group. */
|
|
|
|
static
|
|
|
|
void
|
|
|
|
recv_truncate_group(
|
|
|
|
/*================*/
|
|
|
|
log_group_t* group, /* in: log group */
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t recovered_lsn, /* in: recovery succeeded up to this
|
2005-10-27 07:29:40 +00:00
|
|
|
lsn */
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t limit_lsn, /* in: this was the limit for
|
2005-10-27 07:29:40 +00:00
|
|
|
recovery */
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t checkpoint_lsn, /* in: recovery was started from this
|
2005-10-27 07:29:40 +00:00
|
|
|
checkpoint */
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t archived_lsn) /* in: the log has been archived up to
|
2005-10-27 07:29:40 +00:00
|
|
|
this lsn */
|
|
|
|
{
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t start_lsn;
|
|
|
|
ib_uint64_t end_lsn;
|
|
|
|
ib_uint64_t finish_lsn1;
|
|
|
|
ib_uint64_t finish_lsn2;
|
|
|
|
ib_uint64_t finish_lsn;
|
2006-11-24 13:05:01 +00:00
|
|
|
ulint len;
|
|
|
|
ulint i;
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
if (archived_lsn == IB_ULONGLONG_MAX) {
|
2005-10-27 07:29:40 +00:00
|
|
|
/* Checkpoint was taken in the NOARCHIVELOG mode */
|
|
|
|
archived_lsn = checkpoint_lsn;
|
|
|
|
}
|
|
|
|
|
2006-11-30 09:23:47 +00:00
|
|
|
finish_lsn1 = ut_uint64_align_down(archived_lsn,
|
|
|
|
OS_FILE_LOG_BLOCK_SIZE)
|
2006-11-24 13:05:01 +00:00
|
|
|
+ log_group_get_capacity(group);
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2006-11-30 09:23:47 +00:00
|
|
|
finish_lsn2 = ut_uint64_align_up(recovered_lsn,
|
|
|
|
OS_FILE_LOG_BLOCK_SIZE)
|
2006-11-24 13:05:01 +00:00
|
|
|
+ recv_sys->last_log_buf_size;
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
if (limit_lsn != IB_ULONGLONG_MAX) {
|
2005-10-27 07:29:40 +00:00
|
|
|
/* We do not know how far we should erase log records: erase
|
|
|
|
as much as possible */
|
|
|
|
|
|
|
|
finish_lsn = finish_lsn1;
|
|
|
|
} else {
|
|
|
|
/* It is enough to erase the length of the log buffer */
|
2006-11-24 13:05:01 +00:00
|
|
|
finish_lsn = finish_lsn1 < finish_lsn2
|
|
|
|
? finish_lsn1 : finish_lsn2;
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
|
|
|
ut_a(RECV_SCAN_SIZE <= log_sys->buf_size);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
/* Write the log buffer full of zeros */
|
|
|
|
for (i = 0; i < RECV_SCAN_SIZE; i++) {
|
|
|
|
|
|
|
|
*(log_sys->buf + i) = '\0';
|
|
|
|
}
|
|
|
|
|
2006-11-30 09:23:47 +00:00
|
|
|
start_lsn = ut_uint64_align_down(recovered_lsn,
|
|
|
|
OS_FILE_LOG_BLOCK_SIZE);
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
if (start_lsn != recovered_lsn) {
|
2005-10-27 07:29:40 +00:00
|
|
|
/* Copy the last incomplete log block to the log buffer and
|
|
|
|
edit its data length: */
|
|
|
|
|
|
|
|
ut_memcpy(log_sys->buf, recv_sys->last_block,
|
2006-08-29 09:30:31 +00:00
|
|
|
OS_FILE_LOG_BLOCK_SIZE);
|
2006-11-24 13:05:01 +00:00
|
|
|
log_block_set_data_len(log_sys->buf,
|
2008-05-14 15:43:19 +00:00
|
|
|
(ulint) (recovered_lsn - start_lsn));
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
if (start_lsn >= finish_lsn) {
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-02-23 19:25:29 +00:00
|
|
|
for (;;) {
|
2006-11-24 13:05:01 +00:00
|
|
|
end_lsn = start_lsn + RECV_SCAN_SIZE;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
if (end_lsn > finish_lsn) {
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
end_lsn = finish_lsn;
|
|
|
|
}
|
|
|
|
|
2008-05-14 15:43:19 +00:00
|
|
|
len = (ulint) (end_lsn - start_lsn);
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
log_group_write_buf(group, log_sys->buf, len, start_lsn, 0);
|
2006-11-24 13:05:01 +00:00
|
|
|
if (end_lsn >= finish_lsn) {
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Write the log buffer full of zeros */
|
|
|
|
for (i = 0; i < RECV_SCAN_SIZE; i++) {
|
|
|
|
|
|
|
|
*(log_sys->buf + i) = '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
start_lsn = end_lsn;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************
|
|
|
|
Copies the log segment between group->recovered_lsn and recovered_lsn from the
|
|
|
|
most up-to-date log group to group, so that it contains the latest log data. */
|
|
|
|
static
|
|
|
|
void
|
|
|
|
recv_copy_group(
|
|
|
|
/*============*/
|
|
|
|
log_group_t* up_to_date_group, /* in: the most up-to-date log
|
|
|
|
group */
|
|
|
|
log_group_t* group, /* in: copy to this log
|
|
|
|
group */
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t recovered_lsn) /* in: recovery succeeded up
|
2005-10-27 07:29:40 +00:00
|
|
|
to this lsn */
|
|
|
|
{
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t start_lsn;
|
|
|
|
ib_uint64_t end_lsn;
|
2006-11-24 13:05:01 +00:00
|
|
|
ulint len;
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
if (group->scanned_lsn >= recovered_lsn) {
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
ut_a(RECV_SCAN_SIZE <= log_sys->buf_size);
|
|
|
|
|
2006-11-30 09:23:47 +00:00
|
|
|
start_lsn = ut_uint64_align_down(group->scanned_lsn,
|
|
|
|
OS_FILE_LOG_BLOCK_SIZE);
|
2006-02-23 19:25:29 +00:00
|
|
|
for (;;) {
|
2006-11-24 13:05:01 +00:00
|
|
|
end_lsn = start_lsn + RECV_SCAN_SIZE;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
if (end_lsn > recovered_lsn) {
|
2006-11-30 09:23:47 +00:00
|
|
|
end_lsn = ut_uint64_align_up(recovered_lsn,
|
|
|
|
OS_FILE_LOG_BLOCK_SIZE);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
log_group_read_log_seg(LOG_RECOVER, log_sys->buf,
|
2006-08-29 09:30:31 +00:00
|
|
|
up_to_date_group, start_lsn, end_lsn);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2008-05-14 15:43:19 +00:00
|
|
|
len = (ulint) (end_lsn - start_lsn);
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
log_group_write_buf(group, log_sys->buf, len, start_lsn, 0);
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
if (end_lsn >= recovered_lsn) {
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
start_lsn = end_lsn;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************
|
|
|
|
Copies a log segment from the most up-to-date log group to the other log
|
|
|
|
groups, so that they all contain the latest log data. Also writes the info
|
|
|
|
about the latest checkpoint to the groups, and inits the fields in the group
|
|
|
|
memory structs to up-to-date values. */
|
|
|
|
static
|
|
|
|
void
|
|
|
|
recv_synchronize_groups(
|
|
|
|
/*====================*/
|
|
|
|
log_group_t* up_to_date_group) /* in: the most up-to-date
|
|
|
|
log group */
|
|
|
|
{
|
|
|
|
log_group_t* group;
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t start_lsn;
|
|
|
|
ib_uint64_t end_lsn;
|
|
|
|
ib_uint64_t recovered_lsn;
|
|
|
|
ib_uint64_t limit_lsn;
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
recovered_lsn = recv_sys->recovered_lsn;
|
|
|
|
limit_lsn = recv_sys->limit_lsn;
|
|
|
|
|
|
|
|
/* Read the last recovered log block to the recovery system buffer:
|
|
|
|
the block is always incomplete */
|
|
|
|
|
2006-11-30 09:23:47 +00:00
|
|
|
start_lsn = ut_uint64_align_down(recovered_lsn,
|
|
|
|
OS_FILE_LOG_BLOCK_SIZE);
|
|
|
|
end_lsn = ut_uint64_align_up(recovered_lsn, OS_FILE_LOG_BLOCK_SIZE);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
ut_a(start_lsn != end_lsn);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
log_group_read_log_seg(LOG_RECOVER, recv_sys->last_block,
|
2006-08-29 09:30:31 +00:00
|
|
|
up_to_date_group, start_lsn, end_lsn);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
group = UT_LIST_GET_FIRST(log_sys->log_groups);
|
|
|
|
|
|
|
|
while (group) {
|
|
|
|
if (group != up_to_date_group) {
|
|
|
|
|
|
|
|
/* Copy log data if needed */
|
|
|
|
|
|
|
|
recv_copy_group(group, up_to_date_group,
|
2006-08-29 09:30:31 +00:00
|
|
|
recovered_lsn);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Update the fields in the group struct to correspond to
|
|
|
|
recovered_lsn */
|
|
|
|
|
|
|
|
log_group_set_fields(group, recovered_lsn);
|
|
|
|
|
|
|
|
group = UT_LIST_GET_NEXT(log_groups, group);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Copy the checkpoint info to the groups; remember that we have
|
|
|
|
incremented checkpoint_no by one, and the info will not be written
|
|
|
|
over the max checkpoint info, thus making the preservation of max
|
|
|
|
checkpoint info on disk certain */
|
|
|
|
|
|
|
|
log_groups_write_checkpoint_info();
|
|
|
|
|
|
|
|
mutex_exit(&(log_sys->mutex));
|
|
|
|
|
|
|
|
/* Wait for the checkpoint write to complete */
|
|
|
|
rw_lock_s_lock(&(log_sys->checkpoint_lock));
|
|
|
|
rw_lock_s_unlock(&(log_sys->checkpoint_lock));
|
|
|
|
|
|
|
|
mutex_enter(&(log_sys->mutex));
|
|
|
|
}
|
|
|
|
|
|
|
|
/***************************************************************************
|
|
|
|
Checks the consistency of the checkpoint info */
|
|
|
|
static
|
|
|
|
ibool
|
|
|
|
recv_check_cp_is_consistent(
|
|
|
|
/*========================*/
|
|
|
|
/* out: TRUE if ok */
|
|
|
|
byte* buf) /* in: buffer containing checkpoint info */
|
|
|
|
{
|
|
|
|
ulint fold;
|
|
|
|
|
|
|
|
fold = ut_fold_binary(buf, LOG_CHECKPOINT_CHECKSUM_1);
|
|
|
|
|
2006-09-19 10:14:07 +00:00
|
|
|
if ((fold & 0xFFFFFFFFUL) != mach_read_from_4(
|
|
|
|
buf + LOG_CHECKPOINT_CHECKSUM_1)) {
|
2005-10-27 07:29:40 +00:00
|
|
|
return(FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
fold = ut_fold_binary(buf + LOG_CHECKPOINT_LSN,
|
2006-08-29 09:30:31 +00:00
|
|
|
LOG_CHECKPOINT_CHECKSUM_2 - LOG_CHECKPOINT_LSN);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-09-19 10:14:07 +00:00
|
|
|
if ((fold & 0xFFFFFFFFUL) != mach_read_from_4(
|
|
|
|
buf + LOG_CHECKPOINT_CHECKSUM_2)) {
|
2005-10-27 07:29:40 +00:00
|
|
|
return(FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
return(TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************
|
|
|
|
Looks for the maximum consistent checkpoint from the log groups. */
|
|
|
|
static
|
|
|
|
ulint
|
|
|
|
recv_find_max_checkpoint(
|
|
|
|
/*=====================*/
|
|
|
|
/* out: error code or DB_SUCCESS */
|
|
|
|
log_group_t** max_group, /* out: max group */
|
|
|
|
ulint* max_field) /* out: LOG_CHECKPOINT_1 or
|
|
|
|
LOG_CHECKPOINT_2 */
|
|
|
|
{
|
|
|
|
log_group_t* group;
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t max_no;
|
|
|
|
ib_uint64_t checkpoint_no;
|
2005-10-27 07:29:40 +00:00
|
|
|
ulint field;
|
|
|
|
byte* buf;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
group = UT_LIST_GET_FIRST(log_sys->log_groups);
|
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
max_no = 0;
|
2005-10-27 07:29:40 +00:00
|
|
|
*max_group = NULL;
|
|
|
|
*max_field = 0;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
buf = log_sys->checkpoint_buf;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
while (group) {
|
|
|
|
group->state = LOG_GROUP_CORRUPTED;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
for (field = LOG_CHECKPOINT_1; field <= LOG_CHECKPOINT_2;
|
2006-08-29 09:30:31 +00:00
|
|
|
field += LOG_CHECKPOINT_2 - LOG_CHECKPOINT_1) {
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
log_group_read_checkpoint_info(group, field);
|
|
|
|
|
|
|
|
if (!recv_check_cp_is_consistent(buf)) {
|
|
|
|
#ifdef UNIV_DEBUG
|
|
|
|
if (log_debug_writes) {
|
2006-02-23 19:25:29 +00:00
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: Checkpoint in group"
|
|
|
|
" %lu at %lu invalid, %lu\n",
|
|
|
|
(ulong) group->id,
|
|
|
|
(ulong) field,
|
2006-09-19 10:14:07 +00:00
|
|
|
(ulong) mach_read_from_4(
|
|
|
|
buf
|
|
|
|
+ LOG_CHECKPOINT_CHECKSUM_1));
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
#endif /* UNIV_DEBUG */
|
|
|
|
goto not_consistent;
|
|
|
|
}
|
|
|
|
|
|
|
|
group->state = LOG_GROUP_OK;
|
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
group->lsn = mach_read_ull(
|
2006-09-19 10:14:07 +00:00
|
|
|
buf + LOG_CHECKPOINT_LSN);
|
|
|
|
group->lsn_offset = mach_read_from_4(
|
|
|
|
buf + LOG_CHECKPOINT_OFFSET);
|
2006-11-24 13:05:01 +00:00
|
|
|
checkpoint_no = mach_read_ull(
|
2006-09-19 10:14:07 +00:00
|
|
|
buf + LOG_CHECKPOINT_NO);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
#ifdef UNIV_DEBUG
|
|
|
|
if (log_debug_writes) {
|
2006-02-23 19:25:29 +00:00
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: Checkpoint number %lu"
|
|
|
|
" found in group %lu\n",
|
2006-11-24 13:05:01 +00:00
|
|
|
(ulong) checkpoint_no,
|
2006-08-29 09:30:31 +00:00
|
|
|
(ulong) group->id);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
#endif /* UNIV_DEBUG */
|
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
if (checkpoint_no >= max_no) {
|
2005-10-27 07:29:40 +00:00
|
|
|
*max_group = group;
|
|
|
|
*max_field = field;
|
|
|
|
max_no = checkpoint_no;
|
|
|
|
}
|
|
|
|
|
2006-08-29 09:30:31 +00:00
|
|
|
not_consistent:
|
2005-10-27 07:29:40 +00:00
|
|
|
;
|
|
|
|
}
|
|
|
|
|
|
|
|
group = UT_LIST_GET_NEXT(log_groups, group);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*max_group == NULL) {
|
|
|
|
|
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: No valid checkpoint found.\n"
|
|
|
|
"InnoDB: If this error appears when you are"
|
|
|
|
" creating an InnoDB database,\n"
|
|
|
|
"InnoDB: the problem may be that during"
|
|
|
|
" an earlier attempt you managed\n"
|
|
|
|
"InnoDB: to create the InnoDB data files,"
|
|
|
|
" but log file creation failed.\n"
|
|
|
|
"InnoDB: If that is the case, please refer to\n"
|
|
|
|
"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
|
|
|
|
"error-creating-innodb.html\n");
|
2005-10-27 07:29:40 +00:00
|
|
|
return(DB_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
return(DB_SUCCESS);
|
|
|
|
}
|
|
|
|
|
branches/innodb+: Merge revisions 4072:4150 from branches/zip:
------------------------------------------------------------------------
r4074 | vasil | 2009-01-31 08:05:24 +0200 (Sat, 31 Jan 2009) | 4 lines
branches/zip:
Adjust the failing patch patches/information_schema.diff.
------------------------------------------------------------------------
r4076 | vasil | 2009-02-02 09:32:04 +0200 (Mon, 02 Feb 2009) | 4 lines
branches/zip:
Add ChangeLog entry for the change in r4072.
------------------------------------------------------------------------
r4077 | marko | 2009-02-02 10:48:05 +0200 (Mon, 02 Feb 2009) | 2 lines
branches/zip: innobase_start_or_create_for_mysql(): Remove a factual error
in the function comment. Parameters are not read from a file "srv_init".
------------------------------------------------------------------------
r4081 | marko | 2009-02-02 14:28:17 +0200 (Mon, 02 Feb 2009) | 4 lines
branches/zip: Enclose some backup functions in #ifdef UNIV_HOTBACKUP.
recv_read_cp_info_for_backup(), recv_scan_log_seg_for_backup():
These functions are only called by InnoDB Hot Backup.
------------------------------------------------------------------------
r4082 | vasil | 2009-02-02 18:24:08 +0200 (Mon, 02 Feb 2009) | 10 lines
branches/zip:
Fix a mysql-test failure in innodb-zip:
main.innodb-zip [ fail ]
Test ended at 2009-02-02 18:13:25
CURRENT_TEST: main.innodb-zip
mysqltest: At line 160: Found line beginning with -- that didn't contain a valid mysqltest command, check your syntax or use # if you intended to write a comment
------------------------------------------------------------------------
r4083 | vasil | 2009-02-02 18:33:20 +0200 (Mon, 02 Feb 2009) | 6 lines
branches/zip:
Fix the failing innodb-zip test to restore the environment as it was before
the test execution because a newly added feature in the mysql-test framework
does check for this.
------------------------------------------------------------------------
r4088 | calvin | 2009-02-03 02:35:56 +0200 (Tue, 03 Feb 2009) | 8 lines
branches/zip: fix a compiler error and a warning
Both are minor changes:
1) Compiler error introduced in r4072: double ';' at the end.
2) Warning introduced in r3613: \mem\mem0pool.c(481) :
warning C4098: 'mem_area_free' : 'void' function returning a value
Approved by: Sunny (IM)
------------------------------------------------------------------------
r4098 | marko | 2009-02-03 09:52:45 +0200 (Tue, 03 Feb 2009) | 4 lines
branches/zip: mem_area_free(): Correct a bug that was introduced in r4088.
free() is not the same as ut_free(). ut_free() pairs with ut_malloc(),
not malloc(). free() pairs with malloc() and some other functions.
------------------------------------------------------------------------
r4114 | marko | 2009-02-04 16:09:24 +0200 (Wed, 04 Feb 2009) | 2 lines
branches/zip: buf_block_align(): Fix a bogus debug assertion
that was introduced in r4036, to address Issue #161.
------------------------------------------------------------------------
r4139 | vasil | 2009-02-09 13:47:16 +0200 (Mon, 09 Feb 2009) | 5 lines
branches/zip:
Remove mysql-test/patches/bug35261.diff because that bug has been fixed
in the MySQL repository.
------------------------------------------------------------------------
r4141 | marko | 2009-02-09 15:35:50 +0200 (Mon, 09 Feb 2009) | 1 line
branches/zip: fil_write_lsn_and_arch_no_to_file(): Plug a memory leak.
------------------------------------------------------------------------
r4144 | inaam | 2009-02-10 01:36:25 +0200 (Tue, 10 Feb 2009) | 9 lines
branches/zip rb://30
This patch changes the innodb mutexes and rw_locks implementation.
On supported platforms it uses GCC builtin atomics. These changes
are based on the patch sent by Mark Callaghan of Google under BSD
license. More technical discussion can be found at rb://30
Approved by: Heikki
------------------------------------------------------------------------
r4145 | vasil | 2009-02-10 07:34:43 +0200 (Tue, 10 Feb 2009) | 9 lines
branches/zip:
Non-functional change: Fix a compilation warning introduced in r4144:
gcc -DHAVE_CONFIG_H -I. -I../../include -I../../include -I../../include -I../../regex -I../../storage/innobase/include -I../../sql -I. -Werror -Wall -g -MT libinnobase_a-sync0arr.o -MD -MP -MF .deps/libinnobase_a-sync0arr.Tpo -c -o libinnobase_a-sync0arr.o `test -f 'sync/sync0arr.c' || echo './'`sync/sync0arr.c
cc1: warnings being treated as errors
sync/sync0arr.c: In function 'sync_array_object_signalled':
sync/sync0arr.c:869: warning: pointer targets in passing argument 1 of 'os_atomic_increment' differ in signedness
------------------------------------------------------------------------
r4148 | marko | 2009-02-10 10:38:41 +0200 (Tue, 10 Feb 2009) | 12 lines
branches/zip: Map ut_malloc(), ut_realloc(), ut_free() to
malloc(), realloc(), free() when innodb_use_sys_malloc is set.
ut_free_all_mem(): If innodb_use_sys_malloc is set, do nothing,
because then ut_mem_block_list_inited will never be set.
log_init(): Use mem_alloc() instead of ut_malloc(), so that the
memory will be freed. (Tested with Valgrind, although it is not
clear why the memory would be freed.)
rb://86 approved by Heikki Tuuri and Ken Jacobs. This addresses Issue #168.
------------------------------------------------------------------------
r4149 | marko | 2009-02-10 11:09:15 +0200 (Tue, 10 Feb 2009) | 1 line
branches/zip: ChangeLog: Document recent changes.
------------------------------------------------------------------------
r4150 | marko | 2009-02-10 11:51:43 +0200 (Tue, 10 Feb 2009) | 6 lines
branches/zip: get_share(), free_share(): Make table locking case sensitive.
If lower_case_table_names=1, MySQL will pass the table names in lower case.
Thus, we can use a binary comparison (strcmp) in the hash table.
rb://87 approved by Heikki Tuuri, to address Bug #41676 and Issue #167.
------------------------------------------------------------------------
2009-02-10 10:03:42 +00:00
|
|
|
#ifdef UNIV_HOTBACKUP
|
2005-10-27 07:29:40 +00:00
|
|
|
/***********************************************************************
|
|
|
|
Reads the checkpoint info needed in hot backup. */
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
ibool
|
|
|
|
recv_read_cp_info_for_backup(
|
|
|
|
/*=========================*/
|
2006-11-24 13:05:01 +00:00
|
|
|
/* out: TRUE if success */
|
|
|
|
byte* hdr, /* in: buffer containing the log group
|
|
|
|
header */
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t* lsn, /* out: checkpoint lsn */
|
2006-11-24 13:05:01 +00:00
|
|
|
ulint* offset, /* out: checkpoint offset in the log group */
|
|
|
|
ulint* fsp_limit,/* out: fsp limit of space 0,
|
|
|
|
1000000000 if the database is running
|
|
|
|
with < version 3.23.50 of InnoDB */
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t* cp_no, /* out: checkpoint number */
|
|
|
|
ib_uint64_t* first_header_lsn)
|
2006-11-24 13:05:01 +00:00
|
|
|
/* out: lsn of of the start of the
|
|
|
|
first log file */
|
2005-10-27 07:29:40 +00:00
|
|
|
{
|
2006-11-24 13:05:01 +00:00
|
|
|
ulint max_cp = 0;
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t max_cp_no = 0;
|
2006-11-24 13:05:01 +00:00
|
|
|
byte* cp_buf;
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
cp_buf = hdr + LOG_CHECKPOINT_1;
|
|
|
|
|
|
|
|
if (recv_check_cp_is_consistent(cp_buf)) {
|
2006-11-24 13:05:01 +00:00
|
|
|
max_cp_no = mach_read_ull(cp_buf + LOG_CHECKPOINT_NO);
|
2005-10-27 07:29:40 +00:00
|
|
|
max_cp = LOG_CHECKPOINT_1;
|
|
|
|
}
|
|
|
|
|
|
|
|
cp_buf = hdr + LOG_CHECKPOINT_2;
|
|
|
|
|
|
|
|
if (recv_check_cp_is_consistent(cp_buf)) {
|
2006-11-24 13:05:01 +00:00
|
|
|
if (mach_read_ull(cp_buf + LOG_CHECKPOINT_NO) > max_cp_no) {
|
2005-10-27 07:29:40 +00:00
|
|
|
max_cp = LOG_CHECKPOINT_2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (max_cp == 0) {
|
|
|
|
return(FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
cp_buf = hdr + max_cp;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
*lsn = mach_read_ull(cp_buf + LOG_CHECKPOINT_LSN);
|
2005-10-27 07:29:40 +00:00
|
|
|
*offset = mach_read_from_4(cp_buf + LOG_CHECKPOINT_OFFSET);
|
|
|
|
|
|
|
|
/* If the user is running a pre-3.23.50 version of InnoDB, its
|
|
|
|
checkpoint data does not contain the fsp limit info */
|
|
|
|
if (mach_read_from_4(cp_buf + LOG_CHECKPOINT_FSP_MAGIC_N)
|
2006-08-29 09:30:31 +00:00
|
|
|
== LOG_CHECKPOINT_FSP_MAGIC_N_VAL) {
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2006-09-19 10:14:07 +00:00
|
|
|
*fsp_limit = mach_read_from_4(
|
|
|
|
cp_buf + LOG_CHECKPOINT_FSP_FREE_LIMIT);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
if (*fsp_limit == 0) {
|
|
|
|
*fsp_limit = 1000000000;
|
2006-02-23 19:25:29 +00:00
|
|
|
}
|
2005-10-27 07:29:40 +00:00
|
|
|
} else {
|
|
|
|
*fsp_limit = 1000000000;
|
|
|
|
}
|
|
|
|
|
2006-08-29 09:30:31 +00:00
|
|
|
/* fprintf(stderr, "fsp limit %lu MB\n", *fsp_limit); */
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
*cp_no = mach_read_ull(cp_buf + LOG_CHECKPOINT_NO);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
*first_header_lsn = mach_read_ull(hdr + LOG_FILE_START_LSN);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
return(TRUE);
|
|
|
|
}
|
branches/innodb+: Merge revisions 4072:4150 from branches/zip:
------------------------------------------------------------------------
r4074 | vasil | 2009-01-31 08:05:24 +0200 (Sat, 31 Jan 2009) | 4 lines
branches/zip:
Adjust the failing patch patches/information_schema.diff.
------------------------------------------------------------------------
r4076 | vasil | 2009-02-02 09:32:04 +0200 (Mon, 02 Feb 2009) | 4 lines
branches/zip:
Add ChangeLog entry for the change in r4072.
------------------------------------------------------------------------
r4077 | marko | 2009-02-02 10:48:05 +0200 (Mon, 02 Feb 2009) | 2 lines
branches/zip: innobase_start_or_create_for_mysql(): Remove a factual error
in the function comment. Parameters are not read from a file "srv_init".
------------------------------------------------------------------------
r4081 | marko | 2009-02-02 14:28:17 +0200 (Mon, 02 Feb 2009) | 4 lines
branches/zip: Enclose some backup functions in #ifdef UNIV_HOTBACKUP.
recv_read_cp_info_for_backup(), recv_scan_log_seg_for_backup():
These functions are only called by InnoDB Hot Backup.
------------------------------------------------------------------------
r4082 | vasil | 2009-02-02 18:24:08 +0200 (Mon, 02 Feb 2009) | 10 lines
branches/zip:
Fix a mysql-test failure in innodb-zip:
main.innodb-zip [ fail ]
Test ended at 2009-02-02 18:13:25
CURRENT_TEST: main.innodb-zip
mysqltest: At line 160: Found line beginning with -- that didn't contain a valid mysqltest command, check your syntax or use # if you intended to write a comment
------------------------------------------------------------------------
r4083 | vasil | 2009-02-02 18:33:20 +0200 (Mon, 02 Feb 2009) | 6 lines
branches/zip:
Fix the failing innodb-zip test to restore the environment as it was before
the test execution because a newly added feature in the mysql-test framework
does check for this.
------------------------------------------------------------------------
r4088 | calvin | 2009-02-03 02:35:56 +0200 (Tue, 03 Feb 2009) | 8 lines
branches/zip: fix a compiler error and a warning
Both are minor changes:
1) Compiler error introduced in r4072: double ';' at the end.
2) Warning introduced in r3613: \mem\mem0pool.c(481) :
warning C4098: 'mem_area_free' : 'void' function returning a value
Approved by: Sunny (IM)
------------------------------------------------------------------------
r4098 | marko | 2009-02-03 09:52:45 +0200 (Tue, 03 Feb 2009) | 4 lines
branches/zip: mem_area_free(): Correct a bug that was introduced in r4088.
free() is not the same as ut_free(). ut_free() pairs with ut_malloc(),
not malloc(). free() pairs with malloc() and some other functions.
------------------------------------------------------------------------
r4114 | marko | 2009-02-04 16:09:24 +0200 (Wed, 04 Feb 2009) | 2 lines
branches/zip: buf_block_align(): Fix a bogus debug assertion
that was introduced in r4036, to address Issue #161.
------------------------------------------------------------------------
r4139 | vasil | 2009-02-09 13:47:16 +0200 (Mon, 09 Feb 2009) | 5 lines
branches/zip:
Remove mysql-test/patches/bug35261.diff because that bug has been fixed
in the MySQL repository.
------------------------------------------------------------------------
r4141 | marko | 2009-02-09 15:35:50 +0200 (Mon, 09 Feb 2009) | 1 line
branches/zip: fil_write_lsn_and_arch_no_to_file(): Plug a memory leak.
------------------------------------------------------------------------
r4144 | inaam | 2009-02-10 01:36:25 +0200 (Tue, 10 Feb 2009) | 9 lines
branches/zip rb://30
This patch changes the innodb mutexes and rw_locks implementation.
On supported platforms it uses GCC builtin atomics. These changes
are based on the patch sent by Mark Callaghan of Google under BSD
license. More technical discussion can be found at rb://30
Approved by: Heikki
------------------------------------------------------------------------
r4145 | vasil | 2009-02-10 07:34:43 +0200 (Tue, 10 Feb 2009) | 9 lines
branches/zip:
Non-functional change: Fix a compilation warning introduced in r4144:
gcc -DHAVE_CONFIG_H -I. -I../../include -I../../include -I../../include -I../../regex -I../../storage/innobase/include -I../../sql -I. -Werror -Wall -g -MT libinnobase_a-sync0arr.o -MD -MP -MF .deps/libinnobase_a-sync0arr.Tpo -c -o libinnobase_a-sync0arr.o `test -f 'sync/sync0arr.c' || echo './'`sync/sync0arr.c
cc1: warnings being treated as errors
sync/sync0arr.c: In function 'sync_array_object_signalled':
sync/sync0arr.c:869: warning: pointer targets in passing argument 1 of 'os_atomic_increment' differ in signedness
------------------------------------------------------------------------
r4148 | marko | 2009-02-10 10:38:41 +0200 (Tue, 10 Feb 2009) | 12 lines
branches/zip: Map ut_malloc(), ut_realloc(), ut_free() to
malloc(), realloc(), free() when innodb_use_sys_malloc is set.
ut_free_all_mem(): If innodb_use_sys_malloc is set, do nothing,
because then ut_mem_block_list_inited will never be set.
log_init(): Use mem_alloc() instead of ut_malloc(), so that the
memory will be freed. (Tested with Valgrind, although it is not
clear why the memory would be freed.)
rb://86 approved by Heikki Tuuri and Ken Jacobs. This addresses Issue #168.
------------------------------------------------------------------------
r4149 | marko | 2009-02-10 11:09:15 +0200 (Tue, 10 Feb 2009) | 1 line
branches/zip: ChangeLog: Document recent changes.
------------------------------------------------------------------------
r4150 | marko | 2009-02-10 11:51:43 +0200 (Tue, 10 Feb 2009) | 6 lines
branches/zip: get_share(), free_share(): Make table locking case sensitive.
If lower_case_table_names=1, MySQL will pass the table names in lower case.
Thus, we can use a binary comparison (strcmp) in the hash table.
rb://87 approved by Heikki Tuuri, to address Bug #41676 and Issue #167.
------------------------------------------------------------------------
2009-02-10 10:03:42 +00:00
|
|
|
#endif /* UNIV_HOTBACKUP */
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
/**********************************************************
|
|
|
|
Checks the 4-byte checksum to the trailer checksum field of a log block.
|
|
|
|
We also accept a log block in the old format < InnoDB-3.23.52 where the
|
|
|
|
checksum field contains the log block number. */
|
|
|
|
static
|
|
|
|
ibool
|
|
|
|
log_block_checksum_is_ok_or_old_format(
|
|
|
|
/*===================================*/
|
|
|
|
/* out: TRUE if ok, or if the log block may be in the
|
|
|
|
format of InnoDB version < 3.23.52 */
|
|
|
|
byte* block) /* in: pointer to a log block */
|
|
|
|
{
|
|
|
|
#ifdef UNIV_LOG_DEBUG
|
|
|
|
return(TRUE);
|
|
|
|
#endif /* UNIV_LOG_DEBUG */
|
|
|
|
if (log_block_calc_checksum(block) == log_block_get_checksum(block)) {
|
|
|
|
|
|
|
|
return(TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (log_block_get_hdr_no(block) == log_block_get_checksum(block)) {
|
|
|
|
|
|
|
|
/* We assume the log block is in the format of
|
|
|
|
InnoDB version < 3.23.52 and the block is ok */
|
2006-08-29 09:30:31 +00:00
|
|
|
#if 0
|
2005-10-27 07:29:40 +00:00
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: Scanned old format < InnoDB-3.23.52"
|
|
|
|
" log block number %lu\n",
|
2005-10-27 07:29:40 +00:00
|
|
|
log_block_get_hdr_no(block));
|
2006-08-29 09:30:31 +00:00
|
|
|
#endif
|
2005-10-27 07:29:40 +00:00
|
|
|
return(TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
return(FALSE);
|
|
|
|
}
|
|
|
|
|
branches/innodb+: Merge revisions 4072:4150 from branches/zip:
------------------------------------------------------------------------
r4074 | vasil | 2009-01-31 08:05:24 +0200 (Sat, 31 Jan 2009) | 4 lines
branches/zip:
Adjust the failing patch patches/information_schema.diff.
------------------------------------------------------------------------
r4076 | vasil | 2009-02-02 09:32:04 +0200 (Mon, 02 Feb 2009) | 4 lines
branches/zip:
Add ChangeLog entry for the change in r4072.
------------------------------------------------------------------------
r4077 | marko | 2009-02-02 10:48:05 +0200 (Mon, 02 Feb 2009) | 2 lines
branches/zip: innobase_start_or_create_for_mysql(): Remove a factual error
in the function comment. Parameters are not read from a file "srv_init".
------------------------------------------------------------------------
r4081 | marko | 2009-02-02 14:28:17 +0200 (Mon, 02 Feb 2009) | 4 lines
branches/zip: Enclose some backup functions in #ifdef UNIV_HOTBACKUP.
recv_read_cp_info_for_backup(), recv_scan_log_seg_for_backup():
These functions are only called by InnoDB Hot Backup.
------------------------------------------------------------------------
r4082 | vasil | 2009-02-02 18:24:08 +0200 (Mon, 02 Feb 2009) | 10 lines
branches/zip:
Fix a mysql-test failure in innodb-zip:
main.innodb-zip [ fail ]
Test ended at 2009-02-02 18:13:25
CURRENT_TEST: main.innodb-zip
mysqltest: At line 160: Found line beginning with -- that didn't contain a valid mysqltest command, check your syntax or use # if you intended to write a comment
------------------------------------------------------------------------
r4083 | vasil | 2009-02-02 18:33:20 +0200 (Mon, 02 Feb 2009) | 6 lines
branches/zip:
Fix the failing innodb-zip test to restore the environment as it was before
the test execution because a newly added feature in the mysql-test framework
does check for this.
------------------------------------------------------------------------
r4088 | calvin | 2009-02-03 02:35:56 +0200 (Tue, 03 Feb 2009) | 8 lines
branches/zip: fix a compiler error and a warning
Both are minor changes:
1) Compiler error introduced in r4072: double ';' at the end.
2) Warning introduced in r3613: \mem\mem0pool.c(481) :
warning C4098: 'mem_area_free' : 'void' function returning a value
Approved by: Sunny (IM)
------------------------------------------------------------------------
r4098 | marko | 2009-02-03 09:52:45 +0200 (Tue, 03 Feb 2009) | 4 lines
branches/zip: mem_area_free(): Correct a bug that was introduced in r4088.
free() is not the same as ut_free(). ut_free() pairs with ut_malloc(),
not malloc(). free() pairs with malloc() and some other functions.
------------------------------------------------------------------------
r4114 | marko | 2009-02-04 16:09:24 +0200 (Wed, 04 Feb 2009) | 2 lines
branches/zip: buf_block_align(): Fix a bogus debug assertion
that was introduced in r4036, to address Issue #161.
------------------------------------------------------------------------
r4139 | vasil | 2009-02-09 13:47:16 +0200 (Mon, 09 Feb 2009) | 5 lines
branches/zip:
Remove mysql-test/patches/bug35261.diff because that bug has been fixed
in the MySQL repository.
------------------------------------------------------------------------
r4141 | marko | 2009-02-09 15:35:50 +0200 (Mon, 09 Feb 2009) | 1 line
branches/zip: fil_write_lsn_and_arch_no_to_file(): Plug a memory leak.
------------------------------------------------------------------------
r4144 | inaam | 2009-02-10 01:36:25 +0200 (Tue, 10 Feb 2009) | 9 lines
branches/zip rb://30
This patch changes the innodb mutexes and rw_locks implementation.
On supported platforms it uses GCC builtin atomics. These changes
are based on the patch sent by Mark Callaghan of Google under BSD
license. More technical discussion can be found at rb://30
Approved by: Heikki
------------------------------------------------------------------------
r4145 | vasil | 2009-02-10 07:34:43 +0200 (Tue, 10 Feb 2009) | 9 lines
branches/zip:
Non-functional change: Fix a compilation warning introduced in r4144:
gcc -DHAVE_CONFIG_H -I. -I../../include -I../../include -I../../include -I../../regex -I../../storage/innobase/include -I../../sql -I. -Werror -Wall -g -MT libinnobase_a-sync0arr.o -MD -MP -MF .deps/libinnobase_a-sync0arr.Tpo -c -o libinnobase_a-sync0arr.o `test -f 'sync/sync0arr.c' || echo './'`sync/sync0arr.c
cc1: warnings being treated as errors
sync/sync0arr.c: In function 'sync_array_object_signalled':
sync/sync0arr.c:869: warning: pointer targets in passing argument 1 of 'os_atomic_increment' differ in signedness
------------------------------------------------------------------------
r4148 | marko | 2009-02-10 10:38:41 +0200 (Tue, 10 Feb 2009) | 12 lines
branches/zip: Map ut_malloc(), ut_realloc(), ut_free() to
malloc(), realloc(), free() when innodb_use_sys_malloc is set.
ut_free_all_mem(): If innodb_use_sys_malloc is set, do nothing,
because then ut_mem_block_list_inited will never be set.
log_init(): Use mem_alloc() instead of ut_malloc(), so that the
memory will be freed. (Tested with Valgrind, although it is not
clear why the memory would be freed.)
rb://86 approved by Heikki Tuuri and Ken Jacobs. This addresses Issue #168.
------------------------------------------------------------------------
r4149 | marko | 2009-02-10 11:09:15 +0200 (Tue, 10 Feb 2009) | 1 line
branches/zip: ChangeLog: Document recent changes.
------------------------------------------------------------------------
r4150 | marko | 2009-02-10 11:51:43 +0200 (Tue, 10 Feb 2009) | 6 lines
branches/zip: get_share(), free_share(): Make table locking case sensitive.
If lower_case_table_names=1, MySQL will pass the table names in lower case.
Thus, we can use a binary comparison (strcmp) in the hash table.
rb://87 approved by Heikki Tuuri, to address Bug #41676 and Issue #167.
------------------------------------------------------------------------
2009-02-10 10:03:42 +00:00
|
|
|
#ifdef UNIV_HOTBACKUP
|
2005-10-27 07:29:40 +00:00
|
|
|
/***********************************************************************
|
|
|
|
Scans the log segment and n_bytes_scanned is set to the length of valid
|
|
|
|
log scanned. */
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
void
|
|
|
|
recv_scan_log_seg_for_backup(
|
|
|
|
/*=========================*/
|
|
|
|
byte* buf, /* in: buffer containing log data */
|
|
|
|
ulint buf_len, /* in: data length in that buffer */
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t* scanned_lsn, /* in/out: lsn of buffer start,
|
2005-10-27 07:29:40 +00:00
|
|
|
we return scanned lsn */
|
|
|
|
ulint* scanned_checkpoint_no,
|
|
|
|
/* in/out: 4 lowest bytes of the
|
|
|
|
highest scanned checkpoint number so
|
|
|
|
far */
|
|
|
|
ulint* n_bytes_scanned)/* out: how much we were able to
|
|
|
|
scan, smaller than buf_len if log
|
|
|
|
data ended here */
|
|
|
|
{
|
|
|
|
ulint data_len;
|
|
|
|
byte* log_block;
|
|
|
|
ulint no;
|
|
|
|
|
|
|
|
*n_bytes_scanned = 0;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
for (log_block = buf; log_block < buf + buf_len;
|
2006-08-29 09:30:31 +00:00
|
|
|
log_block += OS_FILE_LOG_BLOCK_SIZE) {
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
no = log_block_get_hdr_no(log_block);
|
|
|
|
|
2006-08-29 09:30:31 +00:00
|
|
|
#if 0
|
|
|
|
fprintf(stderr, "Log block header no %lu\n", no);
|
|
|
|
#endif
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
if (no != log_block_convert_lsn_to_no(*scanned_lsn)
|
2006-08-29 09:30:31 +00:00
|
|
|
|| !log_block_checksum_is_ok_or_old_format(log_block)) {
|
|
|
|
#if 0
|
2005-10-27 07:29:40 +00:00
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"Log block n:o %lu, scanned lsn n:o %lu\n",
|
|
|
|
no, log_block_convert_lsn_to_no(*scanned_lsn));
|
|
|
|
#endif
|
2005-10-27 07:29:40 +00:00
|
|
|
/* Garbage or an incompletely written log block */
|
|
|
|
|
|
|
|
log_block += OS_FILE_LOG_BLOCK_SIZE;
|
2006-08-29 09:30:31 +00:00
|
|
|
#if 0
|
2005-10-27 07:29:40 +00:00
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"Next log block n:o %lu\n",
|
|
|
|
log_block_get_hdr_no(log_block));
|
|
|
|
#endif
|
2005-10-27 07:29:40 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*scanned_checkpoint_no > 0
|
2006-08-29 09:30:31 +00:00
|
|
|
&& log_block_get_checkpoint_no(log_block)
|
|
|
|
< *scanned_checkpoint_no
|
|
|
|
&& *scanned_checkpoint_no
|
|
|
|
- log_block_get_checkpoint_no(log_block)
|
|
|
|
> 0x80000000UL) {
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
/* Garbage from a log buffer flush which was made
|
|
|
|
before the most recent database recovery */
|
2006-08-29 09:30:31 +00:00
|
|
|
#if 0
|
2005-10-27 07:29:40 +00:00
|
|
|
fprintf(stderr,
|
|
|
|
"Scanned cp n:o %lu, block cp n:o %lu\n",
|
|
|
|
*scanned_checkpoint_no,
|
|
|
|
log_block_get_checkpoint_no(log_block));
|
2006-08-29 09:30:31 +00:00
|
|
|
#endif
|
2005-10-27 07:29:40 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
data_len = log_block_get_data_len(log_block);
|
|
|
|
|
|
|
|
*scanned_checkpoint_no
|
2006-08-29 09:30:31 +00:00
|
|
|
= log_block_get_checkpoint_no(log_block);
|
2006-11-24 13:05:01 +00:00
|
|
|
*scanned_lsn += data_len;
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
*n_bytes_scanned += data_len;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
if (data_len < OS_FILE_LOG_BLOCK_SIZE) {
|
|
|
|
/* Log data ends here */
|
|
|
|
|
2006-08-29 09:30:31 +00:00
|
|
|
#if 0
|
|
|
|
fprintf(stderr, "Log block data len %lu\n",
|
|
|
|
data_len);
|
|
|
|
#endif
|
2005-10-27 07:29:40 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
branches/innodb+: Merge revisions 4072:4150 from branches/zip:
------------------------------------------------------------------------
r4074 | vasil | 2009-01-31 08:05:24 +0200 (Sat, 31 Jan 2009) | 4 lines
branches/zip:
Adjust the failing patch patches/information_schema.diff.
------------------------------------------------------------------------
r4076 | vasil | 2009-02-02 09:32:04 +0200 (Mon, 02 Feb 2009) | 4 lines
branches/zip:
Add ChangeLog entry for the change in r4072.
------------------------------------------------------------------------
r4077 | marko | 2009-02-02 10:48:05 +0200 (Mon, 02 Feb 2009) | 2 lines
branches/zip: innobase_start_or_create_for_mysql(): Remove a factual error
in the function comment. Parameters are not read from a file "srv_init".
------------------------------------------------------------------------
r4081 | marko | 2009-02-02 14:28:17 +0200 (Mon, 02 Feb 2009) | 4 lines
branches/zip: Enclose some backup functions in #ifdef UNIV_HOTBACKUP.
recv_read_cp_info_for_backup(), recv_scan_log_seg_for_backup():
These functions are only called by InnoDB Hot Backup.
------------------------------------------------------------------------
r4082 | vasil | 2009-02-02 18:24:08 +0200 (Mon, 02 Feb 2009) | 10 lines
branches/zip:
Fix a mysql-test failure in innodb-zip:
main.innodb-zip [ fail ]
Test ended at 2009-02-02 18:13:25
CURRENT_TEST: main.innodb-zip
mysqltest: At line 160: Found line beginning with -- that didn't contain a valid mysqltest command, check your syntax or use # if you intended to write a comment
------------------------------------------------------------------------
r4083 | vasil | 2009-02-02 18:33:20 +0200 (Mon, 02 Feb 2009) | 6 lines
branches/zip:
Fix the failing innodb-zip test to restore the environment as it was before
the test execution because a newly added feature in the mysql-test framework
does check for this.
------------------------------------------------------------------------
r4088 | calvin | 2009-02-03 02:35:56 +0200 (Tue, 03 Feb 2009) | 8 lines
branches/zip: fix a compiler error and a warning
Both are minor changes:
1) Compiler error introduced in r4072: double ';' at the end.
2) Warning introduced in r3613: \mem\mem0pool.c(481) :
warning C4098: 'mem_area_free' : 'void' function returning a value
Approved by: Sunny (IM)
------------------------------------------------------------------------
r4098 | marko | 2009-02-03 09:52:45 +0200 (Tue, 03 Feb 2009) | 4 lines
branches/zip: mem_area_free(): Correct a bug that was introduced in r4088.
free() is not the same as ut_free(). ut_free() pairs with ut_malloc(),
not malloc(). free() pairs with malloc() and some other functions.
------------------------------------------------------------------------
r4114 | marko | 2009-02-04 16:09:24 +0200 (Wed, 04 Feb 2009) | 2 lines
branches/zip: buf_block_align(): Fix a bogus debug assertion
that was introduced in r4036, to address Issue #161.
------------------------------------------------------------------------
r4139 | vasil | 2009-02-09 13:47:16 +0200 (Mon, 09 Feb 2009) | 5 lines
branches/zip:
Remove mysql-test/patches/bug35261.diff because that bug has been fixed
in the MySQL repository.
------------------------------------------------------------------------
r4141 | marko | 2009-02-09 15:35:50 +0200 (Mon, 09 Feb 2009) | 1 line
branches/zip: fil_write_lsn_and_arch_no_to_file(): Plug a memory leak.
------------------------------------------------------------------------
r4144 | inaam | 2009-02-10 01:36:25 +0200 (Tue, 10 Feb 2009) | 9 lines
branches/zip rb://30
This patch changes the innodb mutexes and rw_locks implementation.
On supported platforms it uses GCC builtin atomics. These changes
are based on the patch sent by Mark Callaghan of Google under BSD
license. More technical discussion can be found at rb://30
Approved by: Heikki
------------------------------------------------------------------------
r4145 | vasil | 2009-02-10 07:34:43 +0200 (Tue, 10 Feb 2009) | 9 lines
branches/zip:
Non-functional change: Fix a compilation warning introduced in r4144:
gcc -DHAVE_CONFIG_H -I. -I../../include -I../../include -I../../include -I../../regex -I../../storage/innobase/include -I../../sql -I. -Werror -Wall -g -MT libinnobase_a-sync0arr.o -MD -MP -MF .deps/libinnobase_a-sync0arr.Tpo -c -o libinnobase_a-sync0arr.o `test -f 'sync/sync0arr.c' || echo './'`sync/sync0arr.c
cc1: warnings being treated as errors
sync/sync0arr.c: In function 'sync_array_object_signalled':
sync/sync0arr.c:869: warning: pointer targets in passing argument 1 of 'os_atomic_increment' differ in signedness
------------------------------------------------------------------------
r4148 | marko | 2009-02-10 10:38:41 +0200 (Tue, 10 Feb 2009) | 12 lines
branches/zip: Map ut_malloc(), ut_realloc(), ut_free() to
malloc(), realloc(), free() when innodb_use_sys_malloc is set.
ut_free_all_mem(): If innodb_use_sys_malloc is set, do nothing,
because then ut_mem_block_list_inited will never be set.
log_init(): Use mem_alloc() instead of ut_malloc(), so that the
memory will be freed. (Tested with Valgrind, although it is not
clear why the memory would be freed.)
rb://86 approved by Heikki Tuuri and Ken Jacobs. This addresses Issue #168.
------------------------------------------------------------------------
r4149 | marko | 2009-02-10 11:09:15 +0200 (Tue, 10 Feb 2009) | 1 line
branches/zip: ChangeLog: Document recent changes.
------------------------------------------------------------------------
r4150 | marko | 2009-02-10 11:51:43 +0200 (Tue, 10 Feb 2009) | 6 lines
branches/zip: get_share(), free_share(): Make table locking case sensitive.
If lower_case_table_names=1, MySQL will pass the table names in lower case.
Thus, we can use a binary comparison (strcmp) in the hash table.
rb://87 approved by Heikki Tuuri, to address Bug #41676 and Issue #167.
------------------------------------------------------------------------
2009-02-10 10:03:42 +00:00
|
|
|
#endif /* UNIV_HOTBACKUP */
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
Tries to parse a single log record body and also applies it to a page if
|
|
|
|
specified. File ops are parsed, but not applied in this function. */
|
|
|
|
static
|
|
|
|
byte*
|
|
|
|
recv_parse_or_apply_log_rec_body(
|
|
|
|
/*=============================*/
|
2006-10-13 11:55:27 +00:00
|
|
|
/* out: log record end, NULL if not a
|
|
|
|
complete record */
|
|
|
|
byte type, /* in: type */
|
|
|
|
byte* ptr, /* in: pointer to a buffer */
|
|
|
|
byte* end_ptr,/* in: pointer to the buffer end */
|
|
|
|
buf_block_t* block, /* in/out: buffer block or NULL; if
|
|
|
|
not NULL, then the log record is
|
|
|
|
applied to the page, and the log
|
|
|
|
record should be complete then */
|
|
|
|
mtr_t* mtr) /* in: mtr or NULL; should be non-NULL
|
|
|
|
if and only if block is non-NULL */
|
2005-10-27 07:29:40 +00:00
|
|
|
{
|
2006-10-13 11:55:27 +00:00
|
|
|
dict_index_t* index = NULL;
|
|
|
|
page_t* page;
|
|
|
|
page_zip_des_t* page_zip;
|
|
|
|
|
|
|
|
ut_ad(!block == !mtr);
|
|
|
|
|
|
|
|
if (block) {
|
|
|
|
page = block->frame;
|
|
|
|
page_zip = buf_block_get_page_zip(block);
|
|
|
|
} else {
|
|
|
|
page = NULL;
|
|
|
|
page_zip = NULL;
|
|
|
|
}
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
case MLOG_1BYTE: case MLOG_2BYTES: case MLOG_4BYTES: case MLOG_8BYTES:
|
2006-08-02 05:49:15 +00:00
|
|
|
ptr = mlog_parse_nbytes(type, ptr, end_ptr, page, page_zip);
|
2005-10-27 07:29:40 +00:00
|
|
|
break;
|
|
|
|
case MLOG_REC_INSERT: case MLOG_COMP_REC_INSERT:
|
2006-09-19 10:14:07 +00:00
|
|
|
if (NULL != (ptr = mlog_parse_index(
|
|
|
|
ptr, end_ptr,
|
|
|
|
type == MLOG_COMP_REC_INSERT,
|
|
|
|
&index))) {
|
2005-10-27 07:29:40 +00:00
|
|
|
ut_a(!page
|
2006-08-29 09:30:31 +00:00
|
|
|
|| (ibool)!!page_is_comp(page)
|
|
|
|
== dict_table_is_comp(index->table));
|
2006-09-19 10:14:07 +00:00
|
|
|
ptr = page_cur_parse_insert_rec(FALSE, ptr, end_ptr,
|
2006-10-20 12:45:53 +00:00
|
|
|
block, index, mtr);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case MLOG_REC_CLUST_DELETE_MARK: case MLOG_COMP_REC_CLUST_DELETE_MARK:
|
2006-09-19 10:14:07 +00:00
|
|
|
if (NULL != (ptr = mlog_parse_index(
|
|
|
|
ptr, end_ptr,
|
|
|
|
type == MLOG_COMP_REC_CLUST_DELETE_MARK,
|
|
|
|
&index))) {
|
2005-10-27 07:29:40 +00:00
|
|
|
ut_a(!page
|
2006-08-29 09:30:31 +00:00
|
|
|
|| (ibool)!!page_is_comp(page)
|
|
|
|
== dict_table_is_comp(index->table));
|
2006-09-19 10:14:07 +00:00
|
|
|
ptr = btr_cur_parse_del_mark_set_clust_rec(
|
|
|
|
ptr, end_ptr, page, page_zip, index);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case MLOG_COMP_REC_SEC_DELETE_MARK:
|
|
|
|
/* This log record type is obsolete, but we process it for
|
|
|
|
backward compatibility with MySQL 5.0.3 and 5.0.4. */
|
|
|
|
ut_a(!page || page_is_comp(page));
|
2006-08-02 05:49:15 +00:00
|
|
|
ut_a(!page_zip);
|
2005-10-27 07:29:40 +00:00
|
|
|
ptr = mlog_parse_index(ptr, end_ptr, TRUE, &index);
|
|
|
|
if (!ptr) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* Fall through */
|
|
|
|
case MLOG_REC_SEC_DELETE_MARK:
|
2005-10-27 11:48:10 +00:00
|
|
|
ptr = btr_cur_parse_del_mark_set_sec_rec(ptr, end_ptr,
|
2006-08-29 09:30:31 +00:00
|
|
|
page, page_zip);
|
2005-10-27 07:29:40 +00:00
|
|
|
break;
|
|
|
|
case MLOG_REC_UPDATE_IN_PLACE: case MLOG_COMP_REC_UPDATE_IN_PLACE:
|
2006-09-19 10:14:07 +00:00
|
|
|
if (NULL != (ptr = mlog_parse_index(
|
|
|
|
ptr, end_ptr,
|
|
|
|
type == MLOG_COMP_REC_UPDATE_IN_PLACE,
|
|
|
|
&index))) {
|
2005-10-27 07:29:40 +00:00
|
|
|
ut_a(!page
|
2006-08-29 09:30:31 +00:00
|
|
|
|| (ibool)!!page_is_comp(page)
|
|
|
|
== dict_table_is_comp(index->table));
|
2006-09-19 10:14:07 +00:00
|
|
|
ptr = btr_cur_parse_update_in_place(ptr, end_ptr, page,
|
|
|
|
page_zip, index);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case MLOG_LIST_END_DELETE: case MLOG_COMP_LIST_END_DELETE:
|
|
|
|
case MLOG_LIST_START_DELETE: case MLOG_COMP_LIST_START_DELETE:
|
2006-09-19 10:14:07 +00:00
|
|
|
if (NULL != (ptr = mlog_parse_index(
|
|
|
|
ptr, end_ptr,
|
|
|
|
type == MLOG_COMP_LIST_END_DELETE
|
|
|
|
|| type == MLOG_COMP_LIST_START_DELETE,
|
|
|
|
&index))) {
|
2005-10-27 07:29:40 +00:00
|
|
|
ut_a(!page
|
2006-08-29 09:30:31 +00:00
|
|
|
|| (ibool)!!page_is_comp(page)
|
|
|
|
== dict_table_is_comp(index->table));
|
2005-10-27 07:29:40 +00:00
|
|
|
ptr = page_parse_delete_rec_list(type, ptr, end_ptr,
|
2006-10-20 12:45:53 +00:00
|
|
|
block, index, mtr);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case MLOG_LIST_END_COPY_CREATED: case MLOG_COMP_LIST_END_COPY_CREATED:
|
2006-09-19 10:14:07 +00:00
|
|
|
if (NULL != (ptr = mlog_parse_index(
|
|
|
|
ptr, end_ptr,
|
|
|
|
type == MLOG_COMP_LIST_END_COPY_CREATED,
|
|
|
|
&index))) {
|
2005-10-27 07:29:40 +00:00
|
|
|
ut_a(!page
|
2006-08-29 09:30:31 +00:00
|
|
|
|| (ibool)!!page_is_comp(page)
|
|
|
|
== dict_table_is_comp(index->table));
|
2006-09-19 10:14:07 +00:00
|
|
|
ptr = page_parse_copy_rec_list_to_created_page(
|
2006-10-20 12:45:53 +00:00
|
|
|
ptr, end_ptr, block, index, mtr);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case MLOG_PAGE_REORGANIZE: case MLOG_COMP_PAGE_REORGANIZE:
|
2006-09-19 10:14:07 +00:00
|
|
|
if (NULL != (ptr = mlog_parse_index(
|
|
|
|
ptr, end_ptr,
|
|
|
|
type == MLOG_COMP_PAGE_REORGANIZE,
|
|
|
|
&index))) {
|
2005-10-27 07:29:40 +00:00
|
|
|
ut_a(!page
|
2006-08-29 09:30:31 +00:00
|
|
|
|| (ibool)!!page_is_comp(page)
|
|
|
|
== dict_table_is_comp(index->table));
|
2005-10-27 07:29:40 +00:00
|
|
|
ptr = btr_parse_page_reorganize(ptr, end_ptr, index,
|
2006-10-18 11:39:31 +00:00
|
|
|
block, mtr);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case MLOG_PAGE_CREATE: case MLOG_COMP_PAGE_CREATE:
|
2006-08-02 05:49:15 +00:00
|
|
|
ut_a(!page_zip);
|
2005-10-27 07:29:40 +00:00
|
|
|
ptr = page_parse_create(ptr, end_ptr,
|
2006-08-29 09:30:31 +00:00
|
|
|
type == MLOG_COMP_PAGE_CREATE,
|
2006-10-13 11:55:27 +00:00
|
|
|
block, mtr);
|
2005-10-27 07:29:40 +00:00
|
|
|
break;
|
|
|
|
case MLOG_UNDO_INSERT:
|
|
|
|
ptr = trx_undo_parse_add_undo_rec(ptr, end_ptr, page);
|
|
|
|
break;
|
|
|
|
case MLOG_UNDO_ERASE_END:
|
|
|
|
ptr = trx_undo_parse_erase_page_end(ptr, end_ptr, page, mtr);
|
|
|
|
break;
|
|
|
|
case MLOG_UNDO_INIT:
|
|
|
|
ptr = trx_undo_parse_page_init(ptr, end_ptr, page, mtr);
|
|
|
|
break;
|
|
|
|
case MLOG_UNDO_HDR_DISCARD:
|
|
|
|
ptr = trx_undo_parse_discard_latest(ptr, end_ptr, page, mtr);
|
|
|
|
break;
|
|
|
|
case MLOG_UNDO_HDR_CREATE:
|
|
|
|
case MLOG_UNDO_HDR_REUSE:
|
|
|
|
ptr = trx_undo_parse_page_header(type, ptr, end_ptr,
|
2006-08-29 09:30:31 +00:00
|
|
|
page, mtr);
|
2005-10-27 07:29:40 +00:00
|
|
|
break;
|
|
|
|
case MLOG_REC_MIN_MARK: case MLOG_COMP_REC_MIN_MARK:
|
2006-08-07 11:35:03 +00:00
|
|
|
/* On a compressed page, MLOG_COMP_REC_MIN_MARK
|
|
|
|
will be followed by MLOG_COMP_REC_DELETE
|
|
|
|
or MLOG_ZIP_WRITE_HEADER(FIL_PAGE_PREV, FIL_NULL)
|
|
|
|
in the same mini-transaction. */
|
|
|
|
ut_a(type == MLOG_COMP_REC_MIN_MARK || !page_zip);
|
2006-09-19 10:14:07 +00:00
|
|
|
ptr = btr_parse_set_min_rec_mark(
|
|
|
|
ptr, end_ptr, type == MLOG_COMP_REC_MIN_MARK,
|
|
|
|
page, mtr);
|
2005-10-27 07:29:40 +00:00
|
|
|
break;
|
|
|
|
case MLOG_REC_DELETE: case MLOG_COMP_REC_DELETE:
|
2006-09-19 10:14:07 +00:00
|
|
|
if (NULL != (ptr = mlog_parse_index(
|
|
|
|
ptr, end_ptr,
|
|
|
|
type == MLOG_COMP_REC_DELETE,
|
|
|
|
&index))) {
|
2005-10-27 07:29:40 +00:00
|
|
|
ut_a(!page
|
2006-08-29 09:30:31 +00:00
|
|
|
|| (ibool)!!page_is_comp(page)
|
|
|
|
== dict_table_is_comp(index->table));
|
2006-10-20 12:45:53 +00:00
|
|
|
ptr = page_cur_parse_delete_rec(ptr, end_ptr,
|
|
|
|
block, index, mtr);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case MLOG_IBUF_BITMAP_INIT:
|
2006-10-19 08:27:34 +00:00
|
|
|
ptr = ibuf_parse_bitmap_init(ptr, end_ptr, block, mtr);
|
2005-10-27 07:29:40 +00:00
|
|
|
break;
|
|
|
|
case MLOG_INIT_FILE_PAGE:
|
2006-10-19 08:27:34 +00:00
|
|
|
ptr = fsp_parse_init_file_page(ptr, end_ptr, block);
|
2005-10-27 07:29:40 +00:00
|
|
|
break;
|
|
|
|
case MLOG_WRITE_STRING:
|
2006-08-02 05:49:15 +00:00
|
|
|
ptr = mlog_parse_string(ptr, end_ptr, page, page_zip);
|
2005-10-27 07:29:40 +00:00
|
|
|
break;
|
|
|
|
case MLOG_FILE_CREATE:
|
|
|
|
case MLOG_FILE_RENAME:
|
|
|
|
case MLOG_FILE_DELETE:
|
2008-05-14 15:43:19 +00:00
|
|
|
case MLOG_FILE_CREATE2:
|
2006-04-25 07:12:32 +00:00
|
|
|
ptr = fil_op_log_parse_or_replay(ptr, end_ptr, type, 0);
|
2005-10-27 07:29:40 +00:00
|
|
|
break;
|
2006-02-10 15:06:17 +00:00
|
|
|
case MLOG_ZIP_WRITE_NODE_PTR:
|
2006-09-19 10:14:07 +00:00
|
|
|
ptr = page_zip_parse_write_node_ptr(ptr, end_ptr,
|
|
|
|
page, page_zip);
|
2006-04-07 11:04:08 +00:00
|
|
|
break;
|
2006-04-07 12:56:22 +00:00
|
|
|
case MLOG_ZIP_WRITE_BLOB_PTR:
|
2006-09-19 10:14:07 +00:00
|
|
|
ptr = page_zip_parse_write_blob_ptr(ptr, end_ptr,
|
|
|
|
page, page_zip);
|
2006-04-07 12:56:22 +00:00
|
|
|
break;
|
2006-02-22 13:02:40 +00:00
|
|
|
case MLOG_ZIP_WRITE_HEADER:
|
2006-09-19 10:14:07 +00:00
|
|
|
ptr = page_zip_parse_write_header(ptr, end_ptr,
|
|
|
|
page, page_zip);
|
2006-02-10 15:06:17 +00:00
|
|
|
break;
|
2006-04-11 12:27:06 +00:00
|
|
|
case MLOG_ZIP_PAGE_COMPRESS:
|
2006-09-19 10:14:07 +00:00
|
|
|
ptr = page_zip_parse_compress(ptr, end_ptr,
|
|
|
|
page, page_zip);
|
2005-10-27 11:48:10 +00:00
|
|
|
break;
|
2005-10-27 07:29:40 +00:00
|
|
|
default:
|
|
|
|
ptr = NULL;
|
|
|
|
recv_sys->found_corrupt_log = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (index) {
|
|
|
|
dict_table_t* table = index->table;
|
2006-04-12 09:32:17 +00:00
|
|
|
|
|
|
|
dict_mem_index_free(index);
|
|
|
|
dict_mem_table_free(table);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
return(ptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
Calculates the fold value of a page file address: used in inserting or
|
|
|
|
searching for a log record in the hash table. */
|
|
|
|
UNIV_INLINE
|
|
|
|
ulint
|
|
|
|
recv_fold(
|
|
|
|
/*======*/
|
|
|
|
/* out: folded value */
|
|
|
|
ulint space, /* in: space */
|
|
|
|
ulint page_no)/* in: page number */
|
|
|
|
{
|
|
|
|
return(ut_fold_ulint_pair(space, page_no));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
Calculates the hash value of a page file address: used in inserting or
|
|
|
|
searching for a log record in the hash table. */
|
|
|
|
UNIV_INLINE
|
|
|
|
ulint
|
|
|
|
recv_hash(
|
|
|
|
/*======*/
|
|
|
|
/* out: folded value */
|
|
|
|
ulint space, /* in: space */
|
|
|
|
ulint page_no)/* in: page number */
|
|
|
|
{
|
|
|
|
return(hash_calc_hash(recv_fold(space, page_no), recv_sys->addr_hash));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
Gets the hashed file address struct for a page. */
|
|
|
|
static
|
|
|
|
recv_addr_t*
|
|
|
|
recv_get_fil_addr_struct(
|
|
|
|
/*=====================*/
|
|
|
|
/* out: file address struct, NULL if not found from
|
|
|
|
the hash table */
|
|
|
|
ulint space, /* in: space id */
|
|
|
|
ulint page_no)/* in: page number */
|
|
|
|
{
|
|
|
|
recv_addr_t* recv_addr;
|
|
|
|
|
|
|
|
recv_addr = HASH_GET_FIRST(recv_sys->addr_hash,
|
2006-08-29 09:30:31 +00:00
|
|
|
recv_hash(space, page_no));
|
2005-10-27 07:29:40 +00:00
|
|
|
while (recv_addr) {
|
|
|
|
if ((recv_addr->space == space)
|
2006-08-29 09:30:31 +00:00
|
|
|
&& (recv_addr->page_no == page_no)) {
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
recv_addr = HASH_GET_NEXT(addr_hash, recv_addr);
|
|
|
|
}
|
|
|
|
|
|
|
|
return(recv_addr);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
Adds a new log record to the hash table of log records. */
|
|
|
|
static
|
|
|
|
void
|
|
|
|
recv_add_to_hash_table(
|
|
|
|
/*===================*/
|
2006-11-24 13:05:01 +00:00
|
|
|
byte type, /* in: log record type */
|
|
|
|
ulint space, /* in: space id */
|
|
|
|
ulint page_no, /* in: page number */
|
|
|
|
byte* body, /* in: log record body */
|
|
|
|
byte* rec_end, /* in: log record end */
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t start_lsn, /* in: start lsn of the mtr */
|
|
|
|
ib_uint64_t end_lsn) /* in: end lsn of the mtr */
|
2005-10-27 07:29:40 +00:00
|
|
|
{
|
|
|
|
recv_t* recv;
|
|
|
|
ulint len;
|
|
|
|
recv_data_t* recv_data;
|
|
|
|
recv_data_t** prev_field;
|
|
|
|
recv_addr_t* recv_addr;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
if (fil_tablespace_deleted_or_being_deleted_in_mem(space, -1)) {
|
|
|
|
/* The tablespace does not exist any more: do not store the
|
|
|
|
log record */
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
len = rec_end - body;
|
|
|
|
|
|
|
|
recv = mem_heap_alloc(recv_sys->heap, sizeof(recv_t));
|
|
|
|
recv->type = type;
|
|
|
|
recv->len = rec_end - body;
|
|
|
|
recv->start_lsn = start_lsn;
|
|
|
|
recv->end_lsn = end_lsn;
|
|
|
|
|
|
|
|
recv_addr = recv_get_fil_addr_struct(space, page_no);
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
if (recv_addr == NULL) {
|
|
|
|
recv_addr = mem_heap_alloc(recv_sys->heap,
|
2006-08-29 09:30:31 +00:00
|
|
|
sizeof(recv_addr_t));
|
2005-10-27 07:29:40 +00:00
|
|
|
recv_addr->space = space;
|
|
|
|
recv_addr->page_no = page_no;
|
|
|
|
recv_addr->state = RECV_NOT_PROCESSED;
|
|
|
|
|
|
|
|
UT_LIST_INIT(recv_addr->rec_list);
|
|
|
|
|
|
|
|
HASH_INSERT(recv_addr_t, addr_hash, recv_sys->addr_hash,
|
2006-08-29 09:30:31 +00:00
|
|
|
recv_fold(space, page_no), recv_addr);
|
2005-10-27 07:29:40 +00:00
|
|
|
recv_sys->n_addrs++;
|
2006-08-29 09:30:31 +00:00
|
|
|
#if 0
|
|
|
|
fprintf(stderr, "Inserting log rec for space %lu, page %lu\n",
|
|
|
|
space, page_no);
|
|
|
|
#endif
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
UT_LIST_ADD_LAST(rec_list, recv_addr->rec_list, recv);
|
|
|
|
|
|
|
|
prev_field = &(recv->data);
|
|
|
|
|
|
|
|
/* Store the log record body in chunks of less than UNIV_PAGE_SIZE:
|
|
|
|
recv_sys->heap grows into the buffer pool, and bigger chunks could not
|
|
|
|
be allocated */
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
while (rec_end > body) {
|
|
|
|
|
|
|
|
len = rec_end - body;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
if (len > RECV_DATA_BLOCK_SIZE) {
|
|
|
|
len = RECV_DATA_BLOCK_SIZE;
|
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
recv_data = mem_heap_alloc(recv_sys->heap,
|
2006-08-29 09:30:31 +00:00
|
|
|
sizeof(recv_data_t) + len);
|
2005-10-27 07:29:40 +00:00
|
|
|
*prev_field = recv_data;
|
|
|
|
|
|
|
|
ut_memcpy(((byte*)recv_data) + sizeof(recv_data_t), body, len);
|
|
|
|
|
|
|
|
prev_field = &(recv_data->next);
|
|
|
|
|
|
|
|
body += len;
|
|
|
|
}
|
|
|
|
|
|
|
|
*prev_field = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
Copies the log record body from recv to buf. */
|
|
|
|
static
|
|
|
|
void
|
|
|
|
recv_data_copy_to_buf(
|
|
|
|
/*==================*/
|
|
|
|
byte* buf, /* in: buffer of length at least recv->len */
|
|
|
|
recv_t* recv) /* in: log record */
|
|
|
|
{
|
|
|
|
recv_data_t* recv_data;
|
|
|
|
ulint part_len;
|
|
|
|
ulint len;
|
|
|
|
|
|
|
|
len = recv->len;
|
|
|
|
recv_data = recv->data;
|
|
|
|
|
|
|
|
while (len > 0) {
|
|
|
|
if (len > RECV_DATA_BLOCK_SIZE) {
|
|
|
|
part_len = RECV_DATA_BLOCK_SIZE;
|
|
|
|
} else {
|
|
|
|
part_len = len;
|
|
|
|
}
|
|
|
|
|
|
|
|
ut_memcpy(buf, ((byte*)recv_data) + sizeof(recv_data_t),
|
2006-08-29 09:30:31 +00:00
|
|
|
part_len);
|
2005-10-27 07:29:40 +00:00
|
|
|
buf += part_len;
|
|
|
|
len -= part_len;
|
|
|
|
|
|
|
|
recv_data = recv_data->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
Applies the hashed log records to the page, if the page lsn is less than the
|
|
|
|
lsn of a log record. This can be called when a buffer page has just been
|
|
|
|
read in, or also for a page already in the buffer pool. */
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
void
|
|
|
|
recv_recover_page(
|
|
|
|
/*==============*/
|
2006-10-12 11:05:22 +00:00
|
|
|
ibool recover_backup,
|
|
|
|
/* in: TRUE if we are recovering a backup
|
2005-10-27 07:29:40 +00:00
|
|
|
page: then we do not acquire any latches
|
|
|
|
since the page was read in outside the
|
|
|
|
buffer pool */
|
2006-10-12 11:05:22 +00:00
|
|
|
ibool just_read_in,
|
|
|
|
/* in: TRUE if the i/o-handler calls this for
|
2005-10-27 07:29:40 +00:00
|
|
|
a freshly read page */
|
2006-10-12 11:05:22 +00:00
|
|
|
buf_block_t* block) /* in: buffer block */
|
2005-10-27 07:29:40 +00:00
|
|
|
{
|
2006-10-12 11:05:22 +00:00
|
|
|
page_t* page;
|
2005-10-27 07:29:40 +00:00
|
|
|
recv_addr_t* recv_addr;
|
|
|
|
recv_t* recv;
|
|
|
|
byte* buf;
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t start_lsn;
|
|
|
|
ib_uint64_t end_lsn;
|
|
|
|
ib_uint64_t page_lsn;
|
|
|
|
ib_uint64_t page_newest_lsn;
|
2005-10-27 07:29:40 +00:00
|
|
|
ibool modification_to_page;
|
|
|
|
ibool success;
|
|
|
|
mtr_t mtr;
|
|
|
|
|
|
|
|
mutex_enter(&(recv_sys->mutex));
|
|
|
|
|
|
|
|
if (recv_sys->apply_log_recs == FALSE) {
|
|
|
|
|
|
|
|
/* Log records should not be applied now */
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
mutex_exit(&(recv_sys->mutex));
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2006-11-23 13:26:01 +00:00
|
|
|
recv_addr = recv_get_fil_addr_struct(buf_block_get_space(block),
|
|
|
|
buf_block_get_page_no(block));
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
if ((recv_addr == NULL)
|
2006-08-29 09:30:31 +00:00
|
|
|
|| (recv_addr->state == RECV_BEING_PROCESSED)
|
|
|
|
|| (recv_addr->state == RECV_PROCESSED)) {
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
mutex_exit(&(recv_sys->mutex));
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-08-29 09:30:31 +00:00
|
|
|
#if 0
|
2006-10-12 11:05:22 +00:00
|
|
|
fprintf(stderr, "Recovering space %lu, page %lu\n",
|
2006-11-23 13:26:01 +00:00
|
|
|
buf_block_get_space(block), buf_block_get_page_no(block));
|
2006-08-29 09:30:31 +00:00
|
|
|
#endif
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
recv_addr->state = RECV_BEING_PROCESSED;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
mutex_exit(&(recv_sys->mutex));
|
|
|
|
|
|
|
|
mtr_start(&mtr);
|
|
|
|
mtr_set_log_mode(&mtr, MTR_LOG_NONE);
|
|
|
|
|
2006-10-12 11:05:22 +00:00
|
|
|
page = block->frame;
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-10-12 11:05:22 +00:00
|
|
|
if (!recover_backup) {
|
2005-10-27 07:29:40 +00:00
|
|
|
if (just_read_in) {
|
2006-08-29 09:30:31 +00:00
|
|
|
/* Move the ownership of the x-latch on the
|
|
|
|
page to this OS thread, so that we can acquire
|
|
|
|
a second x-latch on it. This is needed for the
|
|
|
|
operations to the page to pass the debug
|
|
|
|
checks. */
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
rw_lock_x_lock_move_ownership(&(block->lock));
|
|
|
|
}
|
|
|
|
|
2006-10-12 11:05:22 +00:00
|
|
|
success = buf_page_get_known_nowait(RW_X_LATCH, block,
|
2006-08-29 09:30:31 +00:00
|
|
|
BUF_KEEP_OLD,
|
|
|
|
__FILE__, __LINE__,
|
|
|
|
&mtr);
|
2005-10-27 07:29:40 +00:00
|
|
|
ut_a(success);
|
|
|
|
|
2006-10-12 11:05:22 +00:00
|
|
|
buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Read the newest modification lsn from the page */
|
2006-11-24 13:05:01 +00:00
|
|
|
page_lsn = mach_read_ull(page + FIL_PAGE_LSN);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
if (!recover_backup) {
|
|
|
|
/* It may be that the page has been modified in the buffer
|
|
|
|
pool: read the newest modification lsn there */
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2006-11-30 15:09:33 +00:00
|
|
|
page_newest_lsn
|
|
|
|
= buf_page_get_newest_modification(&block->page);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
if (page_newest_lsn) {
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
page_lsn = page_newest_lsn;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* In recovery from a backup we do not really use the buffer
|
|
|
|
pool */
|
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
page_newest_lsn = 0;
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
modification_to_page = FALSE;
|
2006-11-24 13:05:01 +00:00
|
|
|
start_lsn = end_lsn = 0;
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
recv = UT_LIST_GET_FIRST(recv_addr->rec_list);
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
while (recv) {
|
|
|
|
end_lsn = recv->end_lsn;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
if (recv->len > RECV_DATA_BLOCK_SIZE) {
|
|
|
|
/* We have to copy the record body to a separate
|
|
|
|
buffer */
|
|
|
|
|
|
|
|
buf = mem_alloc(recv->len);
|
|
|
|
|
|
|
|
recv_data_copy_to_buf(buf, recv);
|
|
|
|
} else {
|
|
|
|
buf = ((byte*)(recv->data)) + sizeof(recv_data_t);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (recv->type == MLOG_INIT_FILE_PAGE) {
|
|
|
|
page_lsn = page_newest_lsn;
|
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
mach_write_ull(page + UNIV_PAGE_SIZE
|
|
|
|
- FIL_PAGE_END_LSN_OLD_CHKSUM, 0);
|
|
|
|
mach_write_ull(page + FIL_PAGE_LSN, 0);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
if (recv->start_lsn >= page_lsn) {
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
if (!modification_to_page) {
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
modification_to_page = TRUE;
|
|
|
|
start_lsn = recv->start_lsn;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef UNIV_DEBUG
|
|
|
|
if (log_debug_writes) {
|
2006-02-23 19:25:29 +00:00
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: Applying log rec"
|
|
|
|
" type %lu len %lu"
|
|
|
|
" to space %lu page no %lu\n",
|
2005-10-27 07:29:40 +00:00
|
|
|
(ulong) recv->type, (ulong) recv->len,
|
|
|
|
(ulong) recv_addr->space,
|
|
|
|
(ulong) recv_addr->page_no);
|
|
|
|
}
|
|
|
|
#endif /* UNIV_DEBUG */
|
|
|
|
|
|
|
|
recv_parse_or_apply_log_rec_body(recv->type, buf,
|
2006-08-29 09:30:31 +00:00
|
|
|
buf + recv->len,
|
2006-10-13 11:55:27 +00:00
|
|
|
block, &mtr);
|
2006-11-24 13:05:01 +00:00
|
|
|
mach_write_ull(page + UNIV_PAGE_SIZE
|
|
|
|
- FIL_PAGE_END_LSN_OLD_CHKSUM,
|
|
|
|
recv->start_lsn + recv->len);
|
|
|
|
mach_write_ull(page + FIL_PAGE_LSN,
|
|
|
|
recv->start_lsn + recv->len);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
if (recv->len > RECV_DATA_BLOCK_SIZE) {
|
|
|
|
mem_free(buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
recv = UT_LIST_GET_NEXT(rec_list, recv);
|
|
|
|
}
|
|
|
|
|
2008-10-11 19:37:21 +00:00
|
|
|
#ifdef UNIV_ZIP_DEBUG
|
|
|
|
if (fil_page_get_type(page) == FIL_PAGE_INDEX) {
|
|
|
|
page_zip_des_t* page_zip = buf_block_get_page_zip(block);
|
|
|
|
|
|
|
|
if (page_zip) {
|
|
|
|
ut_a(page_zip_validate_low(page_zip, page, FALSE));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* UNIV_ZIP_DEBUG */
|
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
mutex_enter(&(recv_sys->mutex));
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
if (recv_max_page_lsn < page_lsn) {
|
2005-10-27 07:29:40 +00:00
|
|
|
recv_max_page_lsn = page_lsn;
|
|
|
|
}
|
|
|
|
|
|
|
|
recv_addr->state = RECV_PROCESSED;
|
|
|
|
|
|
|
|
ut_a(recv_sys->n_addrs);
|
|
|
|
recv_sys->n_addrs--;
|
|
|
|
|
|
|
|
mutex_exit(&(recv_sys->mutex));
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
if (!recover_backup && modification_to_page) {
|
|
|
|
ut_a(block);
|
|
|
|
|
|
|
|
buf_flush_recv_note_modification(block, start_lsn, end_lsn);
|
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
/* Make sure that committing mtr does not change the modification
|
|
|
|
lsn values of page */
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
mtr.modifications = FALSE;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
|
|
|
mtr_commit(&mtr);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
Reads in pages which have hashed log records, from an area around a given
|
|
|
|
page number. */
|
|
|
|
static
|
|
|
|
ulint
|
|
|
|
recv_read_in_area(
|
|
|
|
/*==============*/
|
|
|
|
/* out: number of pages found */
|
|
|
|
ulint space, /* in: space */
|
2006-10-19 11:07:50 +00:00
|
|
|
ulint zip_size,/* in: compressed page size in bytes, or 0 */
|
2005-10-27 07:29:40 +00:00
|
|
|
ulint page_no)/* in: page number */
|
|
|
|
{
|
|
|
|
recv_addr_t* recv_addr;
|
|
|
|
ulint page_nos[RECV_READ_AHEAD_AREA];
|
|
|
|
ulint low_limit;
|
|
|
|
ulint n;
|
|
|
|
|
|
|
|
low_limit = page_no - (page_no % RECV_READ_AHEAD_AREA);
|
|
|
|
|
|
|
|
n = 0;
|
|
|
|
|
|
|
|
for (page_no = low_limit; page_no < low_limit + RECV_READ_AHEAD_AREA;
|
2006-08-29 09:30:31 +00:00
|
|
|
page_no++) {
|
2005-10-27 07:29:40 +00:00
|
|
|
recv_addr = recv_get_fil_addr_struct(space, page_no);
|
|
|
|
|
|
|
|
if (recv_addr && !buf_page_peek(space, page_no)) {
|
|
|
|
|
|
|
|
mutex_enter(&(recv_sys->mutex));
|
|
|
|
|
|
|
|
if (recv_addr->state == RECV_NOT_PROCESSED) {
|
|
|
|
recv_addr->state = RECV_BEING_READ;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
page_nos[n] = page_no;
|
|
|
|
|
|
|
|
n++;
|
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
mutex_exit(&(recv_sys->mutex));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-10-19 11:07:50 +00:00
|
|
|
buf_read_recv_pages(FALSE, space, zip_size, page_nos, n);
|
2005-10-27 07:29:40 +00:00
|
|
|
/*
|
|
|
|
fprintf(stderr, "Recv pages at %lu n %lu\n", page_nos[0], n);
|
|
|
|
*/
|
|
|
|
return(n);
|
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
/***********************************************************************
|
|
|
|
Empties the hash table of stored log records, applying them to appropriate
|
|
|
|
pages. */
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
void
|
|
|
|
recv_apply_hashed_log_recs(
|
|
|
|
/*=======================*/
|
|
|
|
ibool allow_ibuf) /* in: if TRUE, also ibuf operations are
|
|
|
|
allowed during the application; if FALSE,
|
|
|
|
no ibuf operations are allowed, and after
|
|
|
|
the application all file pages are flushed to
|
|
|
|
disk and invalidated in buffer pool: this
|
|
|
|
alternative means that no new log records
|
|
|
|
can be generated during the application;
|
|
|
|
the caller must in this case own the log
|
|
|
|
mutex */
|
|
|
|
{
|
|
|
|
recv_addr_t* recv_addr;
|
|
|
|
ulint i;
|
|
|
|
ulint n_pages;
|
|
|
|
ibool has_printed = FALSE;
|
|
|
|
mtr_t mtr;
|
|
|
|
loop:
|
|
|
|
mutex_enter(&(recv_sys->mutex));
|
|
|
|
|
|
|
|
if (recv_sys->apply_batch_on) {
|
|
|
|
|
|
|
|
mutex_exit(&(recv_sys->mutex));
|
|
|
|
|
|
|
|
os_thread_sleep(500000);
|
|
|
|
|
|
|
|
goto loop;
|
|
|
|
}
|
|
|
|
|
|
|
|
ut_ad(!allow_ibuf == mutex_own(&log_sys->mutex));
|
2007-01-18 18:29:12 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
if (!allow_ibuf) {
|
|
|
|
recv_no_ibuf_operations = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
recv_sys->apply_log_recs = TRUE;
|
|
|
|
recv_sys->apply_batch_on = TRUE;
|
|
|
|
|
|
|
|
for (i = 0; i < hash_get_n_cells(recv_sys->addr_hash); i++) {
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
recv_addr = HASH_GET_FIRST(recv_sys->addr_hash, i);
|
|
|
|
|
|
|
|
while (recv_addr) {
|
2006-10-19 11:07:50 +00:00
|
|
|
ulint space = recv_addr->space;
|
|
|
|
ulint zip_size = fil_space_get_zip_size(space);
|
|
|
|
ulint page_no = recv_addr->page_no;
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
if (recv_addr->state == RECV_NOT_PROCESSED) {
|
|
|
|
if (!has_printed) {
|
2006-02-23 19:25:29 +00:00
|
|
|
ut_print_timestamp(stderr);
|
2006-08-29 09:30:31 +00:00
|
|
|
fputs(" InnoDB: Starting an"
|
|
|
|
" apply batch of log records"
|
|
|
|
" to the database...\n"
|
|
|
|
"InnoDB: Progress in percents: ",
|
|
|
|
stderr);
|
2005-10-27 07:29:40 +00:00
|
|
|
has_printed = TRUE;
|
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
mutex_exit(&(recv_sys->mutex));
|
|
|
|
|
|
|
|
if (buf_page_peek(space, page_no)) {
|
2006-10-12 11:05:22 +00:00
|
|
|
buf_block_t* block;
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
mtr_start(&mtr);
|
|
|
|
|
2007-01-18 09:59:00 +00:00
|
|
|
block = buf_page_get(
|
|
|
|
space, zip_size, page_no,
|
|
|
|
RW_X_LATCH, &mtr);
|
2006-10-12 11:05:22 +00:00
|
|
|
buf_block_dbg_add_level(
|
|
|
|
block, SYNC_NO_ORDER_CHECK);
|
2008-09-22 07:57:34 +00:00
|
|
|
|
2006-10-12 11:05:22 +00:00
|
|
|
recv_recover_page(FALSE, FALSE, block);
|
2005-10-27 07:29:40 +00:00
|
|
|
mtr_commit(&mtr);
|
|
|
|
} else {
|
2006-10-19 11:07:50 +00:00
|
|
|
recv_read_in_area(space, zip_size,
|
|
|
|
page_no);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mutex_enter(&(recv_sys->mutex));
|
|
|
|
}
|
|
|
|
|
|
|
|
recv_addr = HASH_GET_NEXT(addr_hash, recv_addr);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (has_printed
|
2006-08-29 09:30:31 +00:00
|
|
|
&& (i * 100) / hash_get_n_cells(recv_sys->addr_hash)
|
|
|
|
!= ((i + 1) * 100)
|
|
|
|
/ hash_get_n_cells(recv_sys->addr_hash)) {
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-08-29 09:30:31 +00:00
|
|
|
fprintf(stderr, "%lu ", (ulong)
|
|
|
|
((i * 100)
|
|
|
|
/ hash_get_n_cells(recv_sys->addr_hash)));
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Wait until all the pages have been processed */
|
|
|
|
|
|
|
|
while (recv_sys->n_addrs != 0) {
|
|
|
|
|
|
|
|
mutex_exit(&(recv_sys->mutex));
|
|
|
|
|
|
|
|
os_thread_sleep(500000);
|
|
|
|
|
|
|
|
mutex_enter(&(recv_sys->mutex));
|
2006-02-23 19:25:29 +00:00
|
|
|
}
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
if (has_printed) {
|
|
|
|
|
2006-02-23 19:25:29 +00:00
|
|
|
fprintf(stderr, "\n");
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!allow_ibuf) {
|
|
|
|
/* Flush all the file pages to disk and invalidate them in
|
|
|
|
the buffer pool */
|
|
|
|
|
|
|
|
mutex_exit(&(recv_sys->mutex));
|
|
|
|
mutex_exit(&(log_sys->mutex));
|
|
|
|
|
|
|
|
n_pages = buf_flush_batch(BUF_FLUSH_LIST, ULINT_MAX,
|
2006-11-24 13:05:01 +00:00
|
|
|
IB_ULONGLONG_MAX);
|
2005-10-27 07:29:40 +00:00
|
|
|
ut_a(n_pages != ULINT_UNDEFINED);
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
buf_flush_wait_batch_end(BUF_FLUSH_LIST);
|
|
|
|
|
|
|
|
buf_pool_invalidate();
|
|
|
|
|
|
|
|
mutex_enter(&(log_sys->mutex));
|
|
|
|
mutex_enter(&(recv_sys->mutex));
|
|
|
|
|
|
|
|
recv_no_ibuf_operations = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
recv_sys->apply_log_recs = FALSE;
|
|
|
|
recv_sys->apply_batch_on = FALSE;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
recv_sys_empty_hash();
|
|
|
|
|
|
|
|
if (has_printed) {
|
|
|
|
fprintf(stderr, "InnoDB: Apply batch completed\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
mutex_exit(&(recv_sys->mutex));
|
|
|
|
}
|
|
|
|
|
2006-04-26 09:35:18 +00:00
|
|
|
#ifdef UNIV_HOTBACKUP
|
2005-10-27 07:29:40 +00:00
|
|
|
/***********************************************************************
|
|
|
|
Applies log records in the hash table to a backup. */
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
void
|
|
|
|
recv_apply_log_recs_for_backup(void)
|
|
|
|
/*================================*/
|
|
|
|
{
|
|
|
|
recv_addr_t* recv_addr;
|
|
|
|
ulint n_hash_cells;
|
2006-10-06 11:23:19 +00:00
|
|
|
buf_block_t* block;
|
2005-10-27 07:29:40 +00:00
|
|
|
ulint actual_size;
|
|
|
|
ibool success;
|
|
|
|
ulint error;
|
|
|
|
ulint i;
|
|
|
|
|
|
|
|
recv_sys->apply_log_recs = TRUE;
|
|
|
|
recv_sys->apply_batch_on = TRUE;
|
|
|
|
|
2006-12-13 14:58:54 +00:00
|
|
|
block = buf_LRU_get_free_block(UNIV_PAGE_SIZE);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-08-29 09:30:31 +00:00
|
|
|
fputs("InnoDB: Starting an apply batch of log records"
|
|
|
|
" to the database...\n"
|
|
|
|
"InnoDB: Progress in percents: ", stderr);
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
n_hash_cells = hash_get_n_cells(recv_sys->addr_hash);
|
|
|
|
|
|
|
|
for (i = 0; i < n_hash_cells; i++) {
|
2006-02-23 19:25:29 +00:00
|
|
|
/* The address hash table is externally chained */
|
2005-10-27 07:29:40 +00:00
|
|
|
recv_addr = hash_get_nth_cell(recv_sys->addr_hash, i)->node;
|
|
|
|
|
|
|
|
while (recv_addr != NULL) {
|
|
|
|
|
2006-10-06 11:23:19 +00:00
|
|
|
ulint zip_size
|
|
|
|
= fil_space_get_zip_size(recv_addr->space);
|
|
|
|
|
|
|
|
if (zip_size == ULINT_UNDEFINED) {
|
2006-08-29 09:30:31 +00:00
|
|
|
#if 0
|
2005-10-27 07:29:40 +00:00
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: Warning: cannot apply"
|
|
|
|
" log record to"
|
|
|
|
" tablespace %lu page %lu,\n"
|
|
|
|
"InnoDB: because tablespace with"
|
|
|
|
" that id does not exist.\n",
|
|
|
|
recv_addr->space, recv_addr->page_no);
|
|
|
|
#endif
|
2005-10-27 07:29:40 +00:00
|
|
|
recv_addr->state = RECV_PROCESSED;
|
|
|
|
|
|
|
|
ut_a(recv_sys->n_addrs);
|
|
|
|
recv_sys->n_addrs--;
|
|
|
|
|
|
|
|
goto skip_this_recv_addr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We simulate a page read made by the buffer pool, to
|
2006-10-09 16:22:47 +00:00
|
|
|
make sure the recovery apparatus works ok. We must init
|
|
|
|
the block. */
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-09-19 10:14:07 +00:00
|
|
|
buf_page_init_for_backup_restore(
|
|
|
|
recv_addr->space, recv_addr->page_no,
|
2006-10-06 11:23:19 +00:00
|
|
|
zip_size, block);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
/* Extend the tablespace's last file if the page_no
|
|
|
|
does not fall inside its bounds; we assume the last
|
|
|
|
file is auto-extending, and ibbackup copied the file
|
|
|
|
when it still was smaller */
|
|
|
|
|
2006-09-19 10:14:07 +00:00
|
|
|
success = fil_extend_space_to_desired_size(
|
|
|
|
&actual_size,
|
|
|
|
recv_addr->space, recv_addr->page_no + 1);
|
2005-10-27 07:29:40 +00:00
|
|
|
if (!success) {
|
2006-02-23 19:25:29 +00:00
|
|
|
fprintf(stderr,
|
|
|
|
"InnoDB: Fatal error: cannot extend"
|
|
|
|
" tablespace %lu to hold %lu pages\n",
|
|
|
|
recv_addr->space, recv_addr->page_no);
|
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Read the page from the tablespace file using the
|
|
|
|
fil0fil.c routines */
|
|
|
|
|
2006-10-06 11:23:19 +00:00
|
|
|
if (zip_size) {
|
|
|
|
error = fil_io(OS_FILE_READ, TRUE,
|
|
|
|
recv_addr->space, zip_size,
|
|
|
|
recv_addr->page_no, 0, zip_size,
|
2006-11-30 15:25:52 +00:00
|
|
|
block->page.zip.data, NULL);
|
2006-10-06 11:23:19 +00:00
|
|
|
} else {
|
|
|
|
error = fil_io(OS_FILE_READ, TRUE,
|
|
|
|
recv_addr->space, 0,
|
|
|
|
recv_addr->page_no, 0,
|
|
|
|
UNIV_PAGE_SIZE,
|
|
|
|
block->frame, NULL);
|
|
|
|
}
|
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
if (error != DB_SUCCESS) {
|
2006-02-23 19:25:29 +00:00
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: Fatal error: cannot read"
|
|
|
|
" from tablespace"
|
|
|
|
" %lu page number %lu\n",
|
2006-02-23 19:25:29 +00:00
|
|
|
(ulong) recv_addr->space,
|
|
|
|
(ulong) recv_addr->page_no);
|
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Apply the log records to this page */
|
2006-10-19 11:07:50 +00:00
|
|
|
recv_recover_page(TRUE, FALSE, block);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
/* Write the page back to the tablespace file using the
|
|
|
|
fil0fil.c routines */
|
|
|
|
|
2006-09-19 10:14:07 +00:00
|
|
|
buf_flush_init_for_writing(
|
2006-10-06 11:23:19 +00:00
|
|
|
block->frame, buf_block_get_page_zip(block),
|
2006-11-24 13:05:01 +00:00
|
|
|
mach_read_ull(block->frame + FIL_PAGE_LSN));
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-10-06 11:23:19 +00:00
|
|
|
if (zip_size) {
|
|
|
|
error = fil_io(OS_FILE_WRITE, TRUE,
|
|
|
|
recv_addr->space, zip_size,
|
|
|
|
recv_addr->page_no, 0,
|
|
|
|
zip_size,
|
2006-11-30 15:25:52 +00:00
|
|
|
block->page.zip.data, NULL);
|
2006-10-06 11:23:19 +00:00
|
|
|
} else {
|
|
|
|
error = fil_io(OS_FILE_WRITE, TRUE,
|
|
|
|
recv_addr->space, 0,
|
|
|
|
recv_addr->page_no, 0,
|
|
|
|
UNIV_PAGE_SIZE,
|
|
|
|
block->frame, NULL);
|
|
|
|
}
|
2005-10-27 07:29:40 +00:00
|
|
|
skip_this_recv_addr:
|
|
|
|
recv_addr = HASH_GET_NEXT(addr_hash, recv_addr);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((100 * i) / n_hash_cells
|
2006-08-29 09:30:31 +00:00
|
|
|
!= (100 * (i + 1)) / n_hash_cells) {
|
2005-10-27 07:29:40 +00:00
|
|
|
fprintf(stderr, "%lu ",
|
2006-02-23 19:25:29 +00:00
|
|
|
(ulong) ((100 * i) / n_hash_cells));
|
2005-10-27 07:29:40 +00:00
|
|
|
fflush(stderr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-10-06 11:23:19 +00:00
|
|
|
buf_block_free(block);
|
2005-10-27 07:29:40 +00:00
|
|
|
recv_sys_empty_hash();
|
|
|
|
}
|
2006-04-26 09:35:18 +00:00
|
|
|
#endif /* UNIV_HOTBACKUP */
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
Tries to parse a single log record and returns its length. */
|
|
|
|
static
|
|
|
|
ulint
|
|
|
|
recv_parse_log_rec(
|
|
|
|
/*===============*/
|
|
|
|
/* out: length of the record, or 0 if the record was
|
|
|
|
not complete */
|
|
|
|
byte* ptr, /* in: pointer to a buffer */
|
|
|
|
byte* end_ptr,/* in: pointer to the buffer end */
|
|
|
|
byte* type, /* out: type */
|
|
|
|
ulint* space, /* out: space id */
|
|
|
|
ulint* page_no,/* out: page number */
|
|
|
|
byte** body) /* out: log record body start */
|
|
|
|
{
|
|
|
|
byte* new_ptr;
|
|
|
|
|
|
|
|
*body = NULL;
|
|
|
|
|
|
|
|
if (ptr == end_ptr) {
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*ptr == MLOG_MULTI_REC_END) {
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
*type = *ptr;
|
|
|
|
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*ptr == MLOG_DUMMY_RECORD) {
|
|
|
|
*type = *ptr;
|
|
|
|
|
|
|
|
*space = ULINT_UNDEFINED - 1; /* For debugging */
|
|
|
|
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
new_ptr = mlog_parse_initial_log_record(ptr, end_ptr, type, space,
|
2006-08-29 09:30:31 +00:00
|
|
|
page_no);
|
2005-10-27 07:29:40 +00:00
|
|
|
*body = new_ptr;
|
|
|
|
|
|
|
|
if (UNIV_UNLIKELY(!new_ptr)) {
|
|
|
|
|
2006-02-23 19:25:29 +00:00
|
|
|
return(0);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Check that page_no is sensible */
|
|
|
|
|
|
|
|
if (UNIV_UNLIKELY(*page_no > 0x8FFFFFFFUL)) {
|
|
|
|
|
|
|
|
recv_sys->found_corrupt_log = TRUE;
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
new_ptr = recv_parse_or_apply_log_rec_body(*type, new_ptr, end_ptr,
|
2006-10-13 11:55:27 +00:00
|
|
|
NULL, NULL);
|
2005-10-27 07:29:40 +00:00
|
|
|
if (UNIV_UNLIKELY(new_ptr == NULL)) {
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*page_no > recv_max_parsed_page_no) {
|
|
|
|
recv_max_parsed_page_no = *page_no;
|
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
return(new_ptr - ptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************
|
|
|
|
Calculates the new value for lsn when more data is added to the log. */
|
|
|
|
static
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t
|
2005-10-27 07:29:40 +00:00
|
|
|
recv_calc_lsn_on_data_add(
|
|
|
|
/*======================*/
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t lsn, /* in: old lsn */
|
|
|
|
ib_uint64_t len) /* in: this many bytes of data is
|
2006-11-24 13:05:01 +00:00
|
|
|
added, log block headers not included */
|
2005-10-27 07:29:40 +00:00
|
|
|
{
|
|
|
|
ulint frag_len;
|
|
|
|
ulint lsn_len;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
frag_len = (((ulint) lsn) % OS_FILE_LOG_BLOCK_SIZE)
|
2006-08-29 09:30:31 +00:00
|
|
|
- LOG_BLOCK_HDR_SIZE;
|
2005-10-27 07:29:40 +00:00
|
|
|
ut_ad(frag_len < OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_HDR_SIZE
|
2006-08-29 09:30:31 +00:00
|
|
|
- LOG_BLOCK_TRL_SIZE);
|
2008-05-14 15:43:19 +00:00
|
|
|
lsn_len = (ulint) len;
|
|
|
|
lsn_len += (lsn_len + frag_len)
|
|
|
|
/ (OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_HDR_SIZE
|
|
|
|
- LOG_BLOCK_TRL_SIZE)
|
2006-08-29 09:30:31 +00:00
|
|
|
* (LOG_BLOCK_HDR_SIZE + LOG_BLOCK_TRL_SIZE);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
return(lsn + lsn_len);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
2006-08-29 09:30:31 +00:00
|
|
|
#ifdef UNIV_LOG_DEBUG
|
2005-10-27 07:29:40 +00:00
|
|
|
/***********************************************************
|
|
|
|
Checks that the parser recognizes incomplete initial segments of a log
|
|
|
|
record as incomplete. */
|
2006-08-29 09:30:31 +00:00
|
|
|
static
|
2005-10-27 07:29:40 +00:00
|
|
|
void
|
|
|
|
recv_check_incomplete_log_recs(
|
|
|
|
/*===========================*/
|
|
|
|
byte* ptr, /* in: pointer to a complete log record */
|
|
|
|
ulint len) /* in: length of the log record */
|
|
|
|
{
|
|
|
|
ulint i;
|
|
|
|
byte type;
|
|
|
|
ulint space;
|
|
|
|
ulint page_no;
|
|
|
|
byte* body;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
for (i = 0; i < len; i++) {
|
|
|
|
ut_a(0 == recv_parse_log_rec(ptr, ptr + i, &type, &space,
|
2006-08-29 09:30:31 +00:00
|
|
|
&page_no, &body));
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
}
|
2006-08-29 09:30:31 +00:00
|
|
|
#endif /* UNIV_LOG_DEBUG */
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
/***********************************************************
|
|
|
|
Prints diagnostic info of corrupt log. */
|
|
|
|
static
|
|
|
|
void
|
|
|
|
recv_report_corrupt_log(
|
|
|
|
/*====================*/
|
|
|
|
byte* ptr, /* in: pointer to corrupt log record */
|
|
|
|
byte type, /* in: type of the record */
|
|
|
|
ulint space, /* in: space id, this may also be garbage */
|
|
|
|
ulint page_no)/* in: page number, this may also be garbage */
|
|
|
|
{
|
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: ############### CORRUPT LOG RECORD FOUND\n"
|
|
|
|
"InnoDB: Log record type %lu, space id %lu, page number %lu\n"
|
2006-11-24 13:05:01 +00:00
|
|
|
"InnoDB: Log parsing proceeded successfully up to %llu\n"
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: Previous log record type %lu, is multi %lu\n"
|
|
|
|
"InnoDB: Recv offset %lu, prev %lu\n",
|
2006-02-23 19:25:29 +00:00
|
|
|
(ulong) type, (ulong) space, (ulong) page_no,
|
2006-11-24 13:05:01 +00:00
|
|
|
recv_sys->recovered_lsn,
|
2006-02-23 19:25:29 +00:00
|
|
|
(ulong) recv_previous_parsed_rec_type,
|
|
|
|
(ulong) recv_previous_parsed_rec_is_multi,
|
|
|
|
(ulong) (ptr - recv_sys->buf),
|
|
|
|
(ulong) recv_previous_parsed_rec_offset);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
if ((ulint)(ptr - recv_sys->buf + 100)
|
2006-08-29 09:30:31 +00:00
|
|
|
> recv_previous_parsed_rec_offset
|
|
|
|
&& (ulint)(ptr - recv_sys->buf + 100
|
|
|
|
- recv_previous_parsed_rec_offset)
|
|
|
|
< 200000) {
|
|
|
|
fputs("InnoDB: Hex dump of corrupt log starting"
|
|
|
|
" 100 bytes before the start\n"
|
|
|
|
"InnoDB: of the previous log rec,\n"
|
|
|
|
"InnoDB: and ending 100 bytes after the start"
|
|
|
|
" of the corrupt rec:\n",
|
|
|
|
stderr);
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
ut_print_buf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
recv_sys->buf
|
|
|
|
+ recv_previous_parsed_rec_offset - 100,
|
|
|
|
ptr - recv_sys->buf + 200
|
|
|
|
- recv_previous_parsed_rec_offset);
|
2005-10-27 07:29:40 +00:00
|
|
|
putc('\n', stderr);
|
|
|
|
}
|
|
|
|
|
2006-08-29 09:30:31 +00:00
|
|
|
fputs("InnoDB: WARNING: the log file may have been corrupt and it\n"
|
|
|
|
"InnoDB: is possible that the log scan did not proceed\n"
|
|
|
|
"InnoDB: far enough in recovery! Please run CHECK TABLE\n"
|
|
|
|
"InnoDB: on your InnoDB tables to check that they are ok!\n"
|
|
|
|
"InnoDB: If mysqld crashes after this recovery, look at\n"
|
|
|
|
"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
|
|
|
|
"forcing-recovery.html\n"
|
|
|
|
"InnoDB: about forcing recovery.\n", stderr);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
fflush(stderr);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************
|
|
|
|
Parses log records from a buffer and stores them to a hash table to wait
|
|
|
|
merging to file pages. */
|
|
|
|
static
|
|
|
|
ibool
|
|
|
|
recv_parse_log_recs(
|
|
|
|
/*================*/
|
|
|
|
/* out: currently always returns FALSE */
|
|
|
|
ibool store_to_hash) /* in: TRUE if the records should be stored
|
|
|
|
to the hash table; this is set to FALSE if just
|
|
|
|
debug checking is needed */
|
|
|
|
{
|
2006-11-24 13:05:01 +00:00
|
|
|
byte* ptr;
|
|
|
|
byte* end_ptr;
|
|
|
|
ulint single_rec;
|
|
|
|
ulint len;
|
|
|
|
ulint total_len;
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t new_recovered_lsn;
|
|
|
|
ib_uint64_t old_lsn;
|
2006-11-24 13:05:01 +00:00
|
|
|
byte type;
|
|
|
|
ulint space;
|
|
|
|
ulint page_no;
|
|
|
|
byte* body;
|
|
|
|
ulint n_recs;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
2006-11-24 13:05:01 +00:00
|
|
|
ut_ad(recv_sys->parse_start_lsn != 0);
|
2005-10-27 07:29:40 +00:00
|
|
|
loop:
|
|
|
|
ptr = recv_sys->buf + recv_sys->recovered_offset;
|
|
|
|
|
|
|
|
end_ptr = recv_sys->buf + recv_sys->len;
|
|
|
|
|
|
|
|
if (ptr == end_ptr) {
|
|
|
|
|
|
|
|
return(FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
single_rec = (ulint)*ptr & MLOG_SINGLE_REC_FLAG;
|
|
|
|
|
|
|
|
if (single_rec || *ptr == MLOG_DUMMY_RECORD) {
|
|
|
|
/* The mtr only modified a single page, or this is a file op */
|
|
|
|
|
|
|
|
old_lsn = recv_sys->recovered_lsn;
|
|
|
|
|
|
|
|
/* Try to parse a log record, fetching its type, space id,
|
|
|
|
page no, and a pointer to the body of the log record */
|
|
|
|
|
|
|
|
len = recv_parse_log_rec(ptr, end_ptr, &type, &space,
|
2006-08-29 09:30:31 +00:00
|
|
|
&page_no, &body);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
if (len == 0 || recv_sys->found_corrupt_log) {
|
|
|
|
if (recv_sys->found_corrupt_log) {
|
|
|
|
|
|
|
|
recv_report_corrupt_log(ptr,
|
2006-08-29 09:30:31 +00:00
|
|
|
type, space, page_no);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
return(FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
new_recovered_lsn = recv_calc_lsn_on_data_add(old_lsn, len);
|
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
if (new_recovered_lsn > recv_sys->scanned_lsn) {
|
2005-10-27 07:29:40 +00:00
|
|
|
/* The log record filled a log block, and we require
|
|
|
|
that also the next log block should have been scanned
|
|
|
|
in */
|
|
|
|
|
|
|
|
return(FALSE);
|
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
recv_previous_parsed_rec_type = (ulint)type;
|
|
|
|
recv_previous_parsed_rec_offset = recv_sys->recovered_offset;
|
|
|
|
recv_previous_parsed_rec_is_multi = 0;
|
|
|
|
|
|
|
|
recv_sys->recovered_offset += len;
|
|
|
|
recv_sys->recovered_lsn = new_recovered_lsn;
|
|
|
|
|
|
|
|
#ifdef UNIV_DEBUG
|
|
|
|
if (log_debug_writes) {
|
2006-02-23 19:25:29 +00:00
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: Parsed a single log rec"
|
|
|
|
" type %lu len %lu space %lu page no %lu\n",
|
2005-10-27 07:29:40 +00:00
|
|
|
(ulong) type, (ulong) len, (ulong) space,
|
|
|
|
(ulong) page_no);
|
|
|
|
}
|
|
|
|
#endif /* UNIV_DEBUG */
|
|
|
|
|
|
|
|
if (type == MLOG_DUMMY_RECORD) {
|
|
|
|
/* Do nothing */
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2006-04-25 07:12:32 +00:00
|
|
|
} else if (!store_to_hash) {
|
|
|
|
/* In debug checking, update a replicate page
|
|
|
|
according to the log record, and check that it
|
|
|
|
becomes identical with the original page */
|
|
|
|
#ifdef UNIV_LOG_DEBUG
|
|
|
|
recv_check_incomplete_log_recs(ptr, len);
|
|
|
|
#endif/* UNIV_LOG_DEBUG */
|
|
|
|
|
|
|
|
} else if (type == MLOG_FILE_CREATE
|
2008-05-14 15:43:19 +00:00
|
|
|
|| type == MLOG_FILE_CREATE2
|
2006-08-29 09:30:31 +00:00
|
|
|
|| type == MLOG_FILE_RENAME
|
|
|
|
|| type == MLOG_FILE_DELETE) {
|
2006-04-25 07:12:32 +00:00
|
|
|
ut_a(space);
|
2005-10-27 07:29:40 +00:00
|
|
|
#ifdef UNIV_HOTBACKUP
|
|
|
|
if (recv_replay_file_ops) {
|
|
|
|
|
|
|
|
/* In ibbackup --apply-log, replay an .ibd file
|
|
|
|
operation, if possible; note that
|
|
|
|
fil_path_to_mysql_datadir is set in ibbackup to
|
|
|
|
point to the datadir we should use there */
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2006-09-19 10:14:07 +00:00
|
|
|
if (NULL == fil_op_log_parse_or_replay(
|
|
|
|
body, end_ptr, type, space)) {
|
2005-10-27 07:29:40 +00:00
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: Error: file op"
|
|
|
|
" log record of type %lu"
|
|
|
|
" space %lu not complete in\n"
|
|
|
|
"InnoDB: the replay phase."
|
|
|
|
" Path %s\n",
|
|
|
|
(ulint)type, space,
|
|
|
|
(char*)(body + 2));
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-04-25 07:12:32 +00:00
|
|
|
ut_error;
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
/* In normal mysqld crash recovery we do not try to
|
|
|
|
replay file operations */
|
2006-04-25 07:12:32 +00:00
|
|
|
} else {
|
2005-10-27 07:29:40 +00:00
|
|
|
recv_add_to_hash_table(type, space, page_no, body,
|
2006-08-29 09:30:31 +00:00
|
|
|
ptr + len, old_lsn,
|
|
|
|
recv_sys->recovered_lsn);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* Check that all the records associated with the single mtr
|
|
|
|
are included within the buffer */
|
|
|
|
|
|
|
|
total_len = 0;
|
|
|
|
n_recs = 0;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
for (;;) {
|
|
|
|
len = recv_parse_log_rec(ptr, end_ptr, &type, &space,
|
2006-08-29 09:30:31 +00:00
|
|
|
&page_no, &body);
|
2005-10-27 07:29:40 +00:00
|
|
|
if (len == 0 || recv_sys->found_corrupt_log) {
|
|
|
|
|
2006-02-23 19:25:29 +00:00
|
|
|
if (recv_sys->found_corrupt_log) {
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-09-19 10:14:07 +00:00
|
|
|
recv_report_corrupt_log(
|
|
|
|
ptr, type, space, page_no);
|
2006-02-23 19:25:29 +00:00
|
|
|
}
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-02-23 19:25:29 +00:00
|
|
|
return(FALSE);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
recv_previous_parsed_rec_type = (ulint)type;
|
|
|
|
recv_previous_parsed_rec_offset
|
|
|
|
= recv_sys->recovered_offset + total_len;
|
|
|
|
recv_previous_parsed_rec_is_multi = 1;
|
|
|
|
|
|
|
|
if ((!store_to_hash) && (type != MLOG_MULTI_REC_END)) {
|
|
|
|
#ifdef UNIV_LOG_DEBUG
|
|
|
|
recv_check_incomplete_log_recs(ptr, len);
|
|
|
|
#endif /* UNIV_LOG_DEBUG */
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef UNIV_DEBUG
|
|
|
|
if (log_debug_writes) {
|
2006-02-23 19:25:29 +00:00
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: Parsed a multi log rec"
|
|
|
|
" type %lu len %lu"
|
|
|
|
" space %lu page no %lu\n",
|
|
|
|
(ulong) type, (ulong) len,
|
|
|
|
(ulong) space, (ulong) page_no);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
#endif /* UNIV_DEBUG */
|
|
|
|
|
|
|
|
total_len += len;
|
|
|
|
n_recs++;
|
|
|
|
|
|
|
|
ptr += len;
|
|
|
|
|
|
|
|
if (type == MLOG_MULTI_REC_END) {
|
|
|
|
|
|
|
|
/* Found the end mark for the records */
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-19 10:14:07 +00:00
|
|
|
new_recovered_lsn = recv_calc_lsn_on_data_add(
|
|
|
|
recv_sys->recovered_lsn, total_len);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
if (new_recovered_lsn > recv_sys->scanned_lsn) {
|
2005-10-27 07:29:40 +00:00
|
|
|
/* The log record filled a log block, and we require
|
|
|
|
that also the next log block should have been scanned
|
|
|
|
in */
|
|
|
|
|
|
|
|
return(FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Add all the records to the hash table */
|
|
|
|
|
|
|
|
ptr = recv_sys->buf + recv_sys->recovered_offset;
|
|
|
|
|
|
|
|
for (;;) {
|
|
|
|
old_lsn = recv_sys->recovered_lsn;
|
|
|
|
len = recv_parse_log_rec(ptr, end_ptr, &type, &space,
|
2006-08-29 09:30:31 +00:00
|
|
|
&page_no, &body);
|
2005-10-27 07:29:40 +00:00
|
|
|
if (recv_sys->found_corrupt_log) {
|
|
|
|
|
|
|
|
recv_report_corrupt_log(ptr,
|
|
|
|
type, space, page_no);
|
|
|
|
}
|
|
|
|
|
|
|
|
ut_a(len != 0);
|
|
|
|
ut_a(0 == ((ulint)*ptr & MLOG_SINGLE_REC_FLAG));
|
|
|
|
|
|
|
|
recv_sys->recovered_offset += len;
|
2006-08-29 09:30:31 +00:00
|
|
|
recv_sys->recovered_lsn
|
|
|
|
= recv_calc_lsn_on_data_add(old_lsn, len);
|
2005-10-27 07:29:40 +00:00
|
|
|
if (type == MLOG_MULTI_REC_END) {
|
|
|
|
|
|
|
|
/* Found the end mark for the records */
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (store_to_hash) {
|
|
|
|
recv_add_to_hash_table(type, space, page_no,
|
2006-08-29 09:30:31 +00:00
|
|
|
body, ptr + len,
|
|
|
|
old_lsn,
|
|
|
|
new_recovered_lsn);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
ptr += len;
|
|
|
|
}
|
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
goto loop;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************
|
|
|
|
Adds data from a new log block to the parsing buffer of recv_sys if
|
|
|
|
recv_sys->parse_start_lsn is non-zero. */
|
|
|
|
static
|
|
|
|
ibool
|
|
|
|
recv_sys_add_to_parsing_buf(
|
|
|
|
/*========================*/
|
2006-11-24 13:05:01 +00:00
|
|
|
/* out: TRUE if more data added */
|
|
|
|
byte* log_block, /* in: log block */
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t scanned_lsn) /* in: lsn of how far we were able
|
2006-11-24 13:05:01 +00:00
|
|
|
to find data in this log block */
|
2005-10-27 07:29:40 +00:00
|
|
|
{
|
|
|
|
ulint more_len;
|
|
|
|
ulint data_len;
|
|
|
|
ulint start_offset;
|
|
|
|
ulint end_offset;
|
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
ut_ad(scanned_lsn >= recv_sys->scanned_lsn);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
if (!recv_sys->parse_start_lsn) {
|
2005-10-27 07:29:40 +00:00
|
|
|
/* Cannot start parsing yet because no start point for
|
|
|
|
it found */
|
|
|
|
|
|
|
|
return(FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
data_len = log_block_get_data_len(log_block);
|
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
if (recv_sys->parse_start_lsn >= scanned_lsn) {
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
return(FALSE);
|
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
} else if (recv_sys->scanned_lsn >= scanned_lsn) {
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
return(FALSE);
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
} else if (recv_sys->parse_start_lsn > recv_sys->scanned_lsn) {
|
|
|
|
more_len = (ulint) (scanned_lsn - recv_sys->parse_start_lsn);
|
2005-10-27 07:29:40 +00:00
|
|
|
} else {
|
2006-11-24 13:05:01 +00:00
|
|
|
more_len = (ulint) (scanned_lsn - recv_sys->scanned_lsn);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (more_len == 0) {
|
|
|
|
|
|
|
|
return(FALSE);
|
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
ut_ad(data_len >= more_len);
|
|
|
|
|
|
|
|
start_offset = data_len - more_len;
|
|
|
|
|
|
|
|
if (start_offset < LOG_BLOCK_HDR_SIZE) {
|
|
|
|
start_offset = LOG_BLOCK_HDR_SIZE;
|
|
|
|
}
|
|
|
|
|
|
|
|
end_offset = data_len;
|
|
|
|
|
|
|
|
if (end_offset > OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_TRL_SIZE) {
|
|
|
|
end_offset = OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_TRL_SIZE;
|
|
|
|
}
|
|
|
|
|
|
|
|
ut_ad(start_offset <= end_offset);
|
|
|
|
|
|
|
|
if (start_offset < end_offset) {
|
|
|
|
ut_memcpy(recv_sys->buf + recv_sys->len,
|
2006-08-29 09:30:31 +00:00
|
|
|
log_block + start_offset, end_offset - start_offset);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
recv_sys->len += end_offset - start_offset;
|
|
|
|
|
|
|
|
ut_a(recv_sys->len <= RECV_PARSING_BUF_SIZE);
|
|
|
|
}
|
|
|
|
|
|
|
|
return(TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************
|
|
|
|
Moves the parsing buffer data left to the buffer start. */
|
|
|
|
static
|
|
|
|
void
|
|
|
|
recv_sys_justify_left_parsing_buf(void)
|
|
|
|
/*===================================*/
|
2006-02-23 19:25:29 +00:00
|
|
|
{
|
2005-10-27 07:29:40 +00:00
|
|
|
ut_memmove(recv_sys->buf, recv_sys->buf + recv_sys->recovered_offset,
|
2006-08-29 09:30:31 +00:00
|
|
|
recv_sys->len - recv_sys->recovered_offset);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
recv_sys->len -= recv_sys->recovered_offset;
|
|
|
|
|
|
|
|
recv_sys->recovered_offset = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************
|
|
|
|
Scans log from a buffer and stores new log data to the parsing buffer. Parses
|
|
|
|
and hashes the log records if new data found. */
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
ibool
|
|
|
|
recv_scan_log_recs(
|
|
|
|
/*===============*/
|
2006-11-24 13:05:01 +00:00
|
|
|
/* out: TRUE if limit_lsn has been
|
|
|
|
reached, or not able to scan any more
|
|
|
|
in this log group */
|
|
|
|
ibool apply_automatically,/* in: TRUE if we want this
|
|
|
|
function to apply log records
|
|
|
|
automatically when the hash table
|
|
|
|
becomes full; in the hot backup tool
|
|
|
|
the tool does the applying, not this
|
|
|
|
function */
|
|
|
|
ulint available_memory,/* in: we let the hash table of recs
|
|
|
|
to grow to this size, at the maximum */
|
|
|
|
ibool store_to_hash, /* in: TRUE if the records should be
|
|
|
|
stored to the hash table; this is set
|
|
|
|
to FALSE if just debug checking is
|
|
|
|
needed */
|
|
|
|
byte* buf, /* in: buffer containing a log segment
|
|
|
|
or garbage */
|
|
|
|
ulint len, /* in: buffer length */
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t start_lsn, /* in: buffer start lsn */
|
|
|
|
ib_uint64_t* contiguous_lsn, /* in/out: it is known that all log
|
2006-11-24 13:05:01 +00:00
|
|
|
groups contain contiguous log data up
|
|
|
|
to this lsn */
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t* group_scanned_lsn)/* out: scanning succeeded up to
|
2006-11-24 13:05:01 +00:00
|
|
|
this lsn */
|
2005-10-27 07:29:40 +00:00
|
|
|
{
|
2006-11-24 13:05:01 +00:00
|
|
|
byte* log_block;
|
|
|
|
ulint no;
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t scanned_lsn;
|
2006-11-24 13:05:01 +00:00
|
|
|
ibool finished;
|
|
|
|
ulint data_len;
|
|
|
|
ibool more_data;
|
|
|
|
|
|
|
|
ut_ad(start_lsn % OS_FILE_LOG_BLOCK_SIZE == 0);
|
2005-10-27 07:29:40 +00:00
|
|
|
ut_ad(len % OS_FILE_LOG_BLOCK_SIZE == 0);
|
|
|
|
ut_ad(len > 0);
|
|
|
|
ut_a(apply_automatically <= TRUE);
|
|
|
|
ut_a(store_to_hash <= TRUE);
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
finished = FALSE;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
log_block = buf;
|
|
|
|
scanned_lsn = start_lsn;
|
|
|
|
more_data = FALSE;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
while (log_block < buf + len && !finished) {
|
|
|
|
|
|
|
|
no = log_block_get_hdr_no(log_block);
|
2006-08-29 09:30:31 +00:00
|
|
|
/*
|
2005-10-27 07:29:40 +00:00
|
|
|
fprintf(stderr, "Log block header no %lu\n", no);
|
|
|
|
|
|
|
|
fprintf(stderr, "Scanned lsn no %lu\n",
|
2006-08-29 09:30:31 +00:00
|
|
|
log_block_convert_lsn_to_no(scanned_lsn));
|
|
|
|
*/
|
2005-10-27 07:29:40 +00:00
|
|
|
if (no != log_block_convert_lsn_to_no(scanned_lsn)
|
2006-08-29 09:30:31 +00:00
|
|
|
|| !log_block_checksum_is_ok_or_old_format(log_block)) {
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
if (no == log_block_convert_lsn_to_no(scanned_lsn)
|
2006-09-19 10:14:07 +00:00
|
|
|
&& !log_block_checksum_is_ok_or_old_format(
|
|
|
|
log_block)) {
|
2005-10-27 07:29:40 +00:00
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: Log block no %lu at"
|
2006-11-24 13:05:01 +00:00
|
|
|
" lsn %llu has\n"
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: ok header, but checksum field"
|
|
|
|
" contains %lu, should be %lu\n",
|
|
|
|
(ulong) no,
|
2006-11-24 13:05:01 +00:00
|
|
|
scanned_lsn,
|
2006-09-19 10:14:07 +00:00
|
|
|
(ulong) log_block_get_checksum(
|
|
|
|
log_block),
|
|
|
|
(ulong) log_block_calc_checksum(
|
|
|
|
log_block));
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Garbage or an incompletely written log block */
|
|
|
|
|
|
|
|
finished = TRUE;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (log_block_get_flush_bit(log_block)) {
|
|
|
|
/* This block was a start of a log flush operation:
|
|
|
|
we know that the previous flush operation must have
|
|
|
|
been completed for all log groups before this block
|
|
|
|
can have been flushed to any of the groups. Therefore,
|
|
|
|
we know that log data is contiguous up to scanned_lsn
|
|
|
|
in all non-corrupt log groups. */
|
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
if (scanned_lsn > *contiguous_lsn) {
|
2005-10-27 07:29:40 +00:00
|
|
|
*contiguous_lsn = scanned_lsn;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
data_len = log_block_get_data_len(log_block);
|
|
|
|
|
|
|
|
if ((store_to_hash || (data_len == OS_FILE_LOG_BLOCK_SIZE))
|
2006-11-24 13:05:01 +00:00
|
|
|
&& scanned_lsn + data_len > recv_sys->scanned_lsn
|
2006-08-29 09:30:31 +00:00
|
|
|
&& (recv_sys->scanned_checkpoint_no > 0)
|
|
|
|
&& (log_block_get_checkpoint_no(log_block)
|
|
|
|
< recv_sys->scanned_checkpoint_no)
|
|
|
|
&& (recv_sys->scanned_checkpoint_no
|
|
|
|
- log_block_get_checkpoint_no(log_block)
|
|
|
|
> 0x80000000UL)) {
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
/* Garbage from a log buffer flush which was made
|
|
|
|
before the most recent database recovery */
|
|
|
|
|
|
|
|
finished = TRUE;
|
|
|
|
#ifdef UNIV_LOG_DEBUG
|
|
|
|
/* This is not really an error, but currently
|
|
|
|
we stop here in the debug version: */
|
|
|
|
|
|
|
|
ut_error;
|
|
|
|
#endif
|
|
|
|
break;
|
2006-02-23 19:25:29 +00:00
|
|
|
}
|
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
if (!recv_sys->parse_start_lsn
|
2006-08-29 09:30:31 +00:00
|
|
|
&& (log_block_get_first_rec_group(log_block) > 0)) {
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
/* We found a point from which to start the parsing
|
|
|
|
of log records */
|
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
recv_sys->parse_start_lsn = scanned_lsn
|
|
|
|
+ log_block_get_first_rec_group(log_block);
|
2005-10-27 07:29:40 +00:00
|
|
|
recv_sys->scanned_lsn = recv_sys->parse_start_lsn;
|
|
|
|
recv_sys->recovered_lsn = recv_sys->parse_start_lsn;
|
|
|
|
}
|
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
scanned_lsn += data_len;
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
if (scanned_lsn > recv_sys->scanned_lsn) {
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2007-08-01 11:18:43 +00:00
|
|
|
/* We have found more entries. If this scan is
|
|
|
|
of startup type, we must initiate crash recovery
|
|
|
|
environment before parsing these log records. */
|
|
|
|
|
|
|
|
if (recv_log_scan_is_startup_type
|
|
|
|
&& !recv_needed_recovery) {
|
|
|
|
|
|
|
|
fprintf(stderr,
|
|
|
|
"InnoDB: Log scan progressed"
|
|
|
|
" past the checkpoint lsn %llu\n",
|
|
|
|
recv_sys->scanned_lsn);
|
|
|
|
recv_init_crash_recovery();
|
|
|
|
}
|
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
/* We were able to find more log data: add it to the
|
|
|
|
parsing buffer if parse_start_lsn is already
|
|
|
|
non-zero */
|
|
|
|
|
|
|
|
if (recv_sys->len + 4 * OS_FILE_LOG_BLOCK_SIZE
|
2006-08-29 09:30:31 +00:00
|
|
|
>= RECV_PARSING_BUF_SIZE) {
|
2005-10-27 07:29:40 +00:00
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: Error: log parsing"
|
|
|
|
" buffer overflow."
|
|
|
|
" Recovery may have failed!\n");
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
recv_sys->found_corrupt_log = TRUE;
|
|
|
|
|
|
|
|
} else if (!recv_sys->found_corrupt_log) {
|
2006-09-19 10:14:07 +00:00
|
|
|
more_data = recv_sys_add_to_parsing_buf(
|
|
|
|
log_block, scanned_lsn);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
recv_sys->scanned_lsn = scanned_lsn;
|
2006-08-29 09:30:31 +00:00
|
|
|
recv_sys->scanned_checkpoint_no
|
|
|
|
= log_block_get_checkpoint_no(log_block);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
if (data_len < OS_FILE_LOG_BLOCK_SIZE) {
|
|
|
|
/* Log data for this group ends here */
|
|
|
|
|
|
|
|
finished = TRUE;
|
|
|
|
} else {
|
|
|
|
log_block += OS_FILE_LOG_BLOCK_SIZE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*group_scanned_lsn = scanned_lsn;
|
|
|
|
|
|
|
|
if (recv_needed_recovery
|
2006-08-29 09:30:31 +00:00
|
|
|
|| (recv_is_from_backup && !recv_is_making_a_backup)) {
|
2005-10-27 07:29:40 +00:00
|
|
|
recv_scan_print_counter++;
|
|
|
|
|
|
|
|
if (finished || (recv_scan_print_counter % 80 == 0)) {
|
|
|
|
|
2006-02-23 19:25:29 +00:00
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: Doing recovery: scanned up to"
|
2006-11-24 13:05:01 +00:00
|
|
|
" log sequence number %llu\n",
|
|
|
|
*group_scanned_lsn);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (more_data && !recv_sys->found_corrupt_log) {
|
|
|
|
/* Try to parse more log records */
|
|
|
|
|
|
|
|
recv_parse_log_recs(store_to_hash);
|
|
|
|
|
|
|
|
if (store_to_hash && mem_heap_get_size(recv_sys->heap)
|
2006-08-29 09:30:31 +00:00
|
|
|
> available_memory
|
|
|
|
&& apply_automatically) {
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
/* Hash table of log records has grown too big:
|
|
|
|
empty it; FALSE means no ibuf operations
|
|
|
|
allowed, as we cannot add new records to the
|
|
|
|
log yet: they would be produced by ibuf
|
|
|
|
operations */
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
recv_apply_hashed_log_recs(FALSE);
|
2006-02-23 19:25:29 +00:00
|
|
|
}
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
if (recv_sys->recovered_offset > RECV_PARSING_BUF_SIZE / 4) {
|
|
|
|
/* Move parsing buffer data to the buffer start */
|
|
|
|
|
|
|
|
recv_sys_justify_left_parsing_buf();
|
2006-02-23 19:25:29 +00:00
|
|
|
}
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return(finished);
|
2006-02-23 19:25:29 +00:00
|
|
|
}
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
/***********************************************************
|
|
|
|
Scans log from a buffer and stores new log data to the parsing buffer. Parses
|
|
|
|
and hashes the log records if new data found. */
|
|
|
|
static
|
|
|
|
void
|
|
|
|
recv_group_scan_log_recs(
|
|
|
|
/*=====================*/
|
2006-11-24 13:05:01 +00:00
|
|
|
log_group_t* group, /* in: log group */
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t* contiguous_lsn, /* in/out: it is known that all log
|
2006-11-24 13:05:01 +00:00
|
|
|
groups contain contiguous log data up
|
|
|
|
to this lsn */
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t* group_scanned_lsn)/* out: scanning succeeded up to
|
2006-11-24 13:05:01 +00:00
|
|
|
this lsn */
|
2005-10-27 07:29:40 +00:00
|
|
|
{
|
2006-11-24 13:05:01 +00:00
|
|
|
ibool finished;
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t start_lsn;
|
|
|
|
ib_uint64_t end_lsn;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
finished = FALSE;
|
|
|
|
|
|
|
|
start_lsn = *contiguous_lsn;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
|
|
|
while (!finished) {
|
2006-11-24 13:05:01 +00:00
|
|
|
end_lsn = start_lsn + RECV_SCAN_SIZE;
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
log_group_read_log_seg(LOG_RECOVER, log_sys->buf,
|
2006-08-29 09:30:31 +00:00
|
|
|
group, start_lsn, end_lsn);
|
|
|
|
|
2006-09-19 10:14:07 +00:00
|
|
|
finished = recv_scan_log_recs(
|
2006-10-30 15:15:19 +00:00
|
|
|
TRUE, (buf_pool->curr_size - recv_n_pool_free_frames)
|
2006-09-19 10:14:07 +00:00
|
|
|
* UNIV_PAGE_SIZE, TRUE, log_sys->buf, RECV_SCAN_SIZE,
|
|
|
|
start_lsn, contiguous_lsn, group_scanned_lsn);
|
2005-10-27 07:29:40 +00:00
|
|
|
start_lsn = end_lsn;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef UNIV_DEBUG
|
|
|
|
if (log_debug_writes) {
|
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: Scanned group %lu up to"
|
2006-11-24 13:05:01 +00:00
|
|
|
" log sequence number %llu\n",
|
2006-08-29 09:30:31 +00:00
|
|
|
(ulong) group->id,
|
2006-11-24 13:05:01 +00:00
|
|
|
*group_scanned_lsn);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
#endif /* UNIV_DEBUG */
|
|
|
|
}
|
|
|
|
|
2007-08-01 11:18:43 +00:00
|
|
|
/***********************************************************
|
|
|
|
Initialize crash recovery environment. Can be called iff
|
|
|
|
recv_needed_recovery == FALSE. */
|
|
|
|
static
|
|
|
|
void
|
|
|
|
recv_init_crash_recovery(void)
|
|
|
|
/*==========================*/
|
|
|
|
{
|
|
|
|
ut_a(!recv_needed_recovery);
|
|
|
|
|
|
|
|
recv_needed_recovery = TRUE;
|
|
|
|
|
|
|
|
ut_print_timestamp(stderr);
|
|
|
|
|
|
|
|
fprintf(stderr,
|
|
|
|
" InnoDB: Database was not"
|
|
|
|
" shut down normally!\n"
|
|
|
|
"InnoDB: Starting crash recovery.\n");
|
|
|
|
|
|
|
|
fprintf(stderr,
|
|
|
|
"InnoDB: Reading tablespace information"
|
|
|
|
" from the .ibd files...\n");
|
|
|
|
|
|
|
|
fil_load_single_table_tablespaces();
|
|
|
|
|
|
|
|
/* If we are using the doublewrite method, we will
|
|
|
|
check if there are half-written pages in data files,
|
|
|
|
and restore them from the doublewrite buffer if
|
|
|
|
possible */
|
|
|
|
|
|
|
|
if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) {
|
|
|
|
|
|
|
|
fprintf(stderr,
|
|
|
|
"InnoDB: Restoring possible"
|
|
|
|
" half-written data pages from"
|
|
|
|
" the doublewrite\n"
|
|
|
|
"InnoDB: buffer...\n");
|
|
|
|
trx_sys_doublewrite_init_or_restore_pages(TRUE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
/************************************************************
|
|
|
|
Recovers from a checkpoint. When this function returns, the database is able
|
|
|
|
to start processing of new user transactions, but the function
|
|
|
|
recv_recovery_from_checkpoint_finish should be called later to complete
|
|
|
|
the recovery and free the resources used in it. */
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
ulint
|
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
|
|
|
recv_recovery_from_checkpoint_start_func(
|
|
|
|
/*=====================================*/
|
2006-11-24 13:05:01 +00:00
|
|
|
/* out: error code or DB_SUCCESS */
|
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
|
|
|
#ifdef UNIV_LOG_ARCHIVE
|
2006-11-24 13:05:01 +00:00
|
|
|
ulint type, /* in: LOG_CHECKPOINT or LOG_ARCHIVE */
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t limit_lsn, /* in: recover up to this lsn
|
2006-11-24 13:05:01 +00:00
|
|
|
if possible */
|
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
|
|
|
#endif /* UNIV_LOG_ARCHIVE */
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t min_flushed_lsn,/* in: min flushed lsn from
|
2006-11-24 13:05:01 +00:00
|
|
|
data files */
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t max_flushed_lsn)/* in: max flushed lsn from
|
2006-11-24 13:05:01 +00:00
|
|
|
data files */
|
2005-10-27 07:29:40 +00:00
|
|
|
{
|
|
|
|
log_group_t* group;
|
|
|
|
log_group_t* max_cp_group;
|
|
|
|
log_group_t* up_to_date_group;
|
|
|
|
ulint max_cp_field;
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t checkpoint_lsn;
|
|
|
|
ib_uint64_t checkpoint_no;
|
|
|
|
ib_uint64_t old_scanned_lsn;
|
|
|
|
ib_uint64_t group_scanned_lsn;
|
|
|
|
ib_uint64_t contiguous_lsn;
|
|
|
|
ib_uint64_t archived_lsn;
|
2005-10-27 07:29:40 +00:00
|
|
|
byte* buf;
|
|
|
|
byte log_hdr_buf[LOG_FILE_HDR_SIZE];
|
|
|
|
ulint err;
|
|
|
|
|
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
|
|
|
#ifdef UNIV_LOG_ARCHIVE
|
2006-11-24 13:05:01 +00:00
|
|
|
ut_ad(type != LOG_CHECKPOINT || limit_lsn == IB_ULONGLONG_MAX);
|
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
|
|
|
# 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 */
|
2006-02-23 19:25:29 +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
|
|
|
if (TYPE_CHECKPOINT) {
|
2005-10-27 07:29:40 +00:00
|
|
|
recv_sys_create();
|
|
|
|
recv_sys_init(FALSE, buf_pool_get_curr_size());
|
|
|
|
}
|
|
|
|
|
|
|
|
if (srv_force_recovery >= SRV_FORCE_NO_LOG_REDO) {
|
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: The user has set SRV_FORCE_NO_LOG_REDO on\n");
|
2005-10-27 07:29:40 +00:00
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: Skipping log redo\n");
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
return(DB_SUCCESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
recv_recovery_on = TRUE;
|
|
|
|
|
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
|
|
|
recv_sys->limit_lsn = LIMIT_LSN;
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
mutex_enter(&(log_sys->mutex));
|
|
|
|
|
|
|
|
/* Look for the latest checkpoint from any of the log groups */
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
err = recv_find_max_checkpoint(&max_cp_group, &max_cp_field);
|
|
|
|
|
|
|
|
if (err != DB_SUCCESS) {
|
|
|
|
|
|
|
|
mutex_exit(&(log_sys->mutex));
|
|
|
|
|
|
|
|
return(err);
|
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
log_group_read_checkpoint_info(max_cp_group, max_cp_field);
|
|
|
|
|
|
|
|
buf = log_sys->checkpoint_buf;
|
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
checkpoint_lsn = mach_read_ull(buf + LOG_CHECKPOINT_LSN);
|
|
|
|
checkpoint_no = mach_read_ull(buf + LOG_CHECKPOINT_NO);
|
|
|
|
archived_lsn = mach_read_ull(buf + LOG_CHECKPOINT_ARCHIVED_LSN);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
/* Read the first log file header to print a note if this is
|
|
|
|
a recovery from a restored InnoDB Hot Backup */
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2006-06-15 07:27:13 +00:00
|
|
|
fil_io(OS_FILE_READ | OS_FILE_LOG, TRUE, max_cp_group->space_id, 0,
|
2006-08-29 09:30:31 +00:00
|
|
|
0, 0, LOG_FILE_HDR_SIZE,
|
|
|
|
log_hdr_buf, max_cp_group);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
if (0 == ut_memcmp(log_hdr_buf + LOG_FILE_WAS_CREATED_BY_HOT_BACKUP,
|
2006-08-29 09:30:31 +00:00
|
|
|
(byte*)"ibbackup", (sizeof "ibbackup") - 1)) {
|
2005-10-27 07:29:40 +00:00
|
|
|
/* This log file was created by ibbackup --restore: print
|
|
|
|
a note to the user about it */
|
|
|
|
|
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: The log file was created by"
|
|
|
|
" ibbackup --apply-log at\n"
|
|
|
|
"InnoDB: %s\n",
|
|
|
|
log_hdr_buf + LOG_FILE_WAS_CREATED_BY_HOT_BACKUP);
|
2005-10-27 07:29:40 +00:00
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: NOTE: the following crash recovery"
|
|
|
|
" is part of a normal restore.\n");
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
/* Wipe over the label now */
|
|
|
|
|
|
|
|
memset(log_hdr_buf + LOG_FILE_WAS_CREATED_BY_HOT_BACKUP,
|
2006-08-29 09:30:31 +00:00
|
|
|
' ', 4);
|
2005-10-27 07:29:40 +00:00
|
|
|
/* Write to the log file to wipe over the label */
|
|
|
|
fil_io(OS_FILE_WRITE | OS_FILE_LOG, TRUE,
|
2006-08-29 09:30:31 +00:00
|
|
|
max_cp_group->space_id, 0,
|
|
|
|
0, 0, OS_FILE_LOG_BLOCK_SIZE,
|
|
|
|
log_hdr_buf, max_cp_group);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
2006-02-23 19:25:29 +00:00
|
|
|
#ifdef UNIV_LOG_ARCHIVE
|
2005-10-27 07:29:40 +00:00
|
|
|
group = UT_LIST_GET_FIRST(log_sys->log_groups);
|
|
|
|
|
|
|
|
while (group) {
|
|
|
|
log_checkpoint_get_nth_group_info(buf, group->id,
|
2006-08-29 09:30:31 +00:00
|
|
|
&(group->archived_file_no),
|
|
|
|
&(group->archived_offset));
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
group = UT_LIST_GET_NEXT(log_groups, group);
|
|
|
|
}
|
|
|
|
#endif /* UNIV_LOG_ARCHIVE */
|
|
|
|
|
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
|
|
|
if (TYPE_CHECKPOINT) {
|
2005-10-27 07:29:40 +00:00
|
|
|
/* 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. */
|
|
|
|
|
|
|
|
recv_sys->parse_start_lsn = checkpoint_lsn;
|
|
|
|
recv_sys->scanned_lsn = checkpoint_lsn;
|
|
|
|
recv_sys->scanned_checkpoint_no = 0;
|
|
|
|
recv_sys->recovered_lsn = checkpoint_lsn;
|
|
|
|
|
|
|
|
srv_start_lsn = checkpoint_lsn;
|
|
|
|
}
|
|
|
|
|
2006-11-30 09:23:47 +00:00
|
|
|
contiguous_lsn = ut_uint64_align_down(recv_sys->scanned_lsn,
|
|
|
|
OS_FILE_LOG_BLOCK_SIZE);
|
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
|
|
|
if (TYPE_CHECKPOINT) {
|
|
|
|
up_to_date_group = max_cp_group;
|
|
|
|
#ifdef UNIV_LOG_ARCHIVE
|
|
|
|
} else {
|
|
|
|
ulint capacity;
|
|
|
|
|
2006-02-23 19:25:29 +00:00
|
|
|
/* Try to recover the remaining part from logs: first from
|
2005-10-27 07:29:40 +00:00
|
|
|
the logs of the archived group */
|
|
|
|
|
|
|
|
group = recv_sys->archive_group;
|
|
|
|
capacity = log_group_get_capacity(group);
|
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
if (recv_sys->scanned_lsn > checkpoint_lsn + capacity
|
|
|
|
|| checkpoint_lsn > recv_sys->scanned_lsn + capacity) {
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
mutex_exit(&(log_sys->mutex));
|
|
|
|
|
|
|
|
/* The group does not contain enough log: probably
|
|
|
|
an archived log file was missing or corrupt */
|
|
|
|
|
|
|
|
return(DB_ERROR);
|
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
recv_group_scan_log_recs(group, &contiguous_lsn,
|
2006-08-29 09:30:31 +00:00
|
|
|
&group_scanned_lsn);
|
2006-11-24 13:05:01 +00:00
|
|
|
if (recv_sys->scanned_lsn < checkpoint_lsn) {
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
mutex_exit(&(log_sys->mutex));
|
|
|
|
|
|
|
|
/* The group did not contain enough log: an archived
|
|
|
|
log file was missing or invalid, or the log group
|
|
|
|
was corrupt */
|
|
|
|
|
|
|
|
return(DB_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
group->scanned_lsn = group_scanned_lsn;
|
|
|
|
up_to_date_group = group;
|
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
|
|
|
#endif /* UNIV_LOG_ARCHIVE */
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ut_ad(RECV_SCAN_SIZE <= log_sys->buf_size);
|
|
|
|
|
|
|
|
group = UT_LIST_GET_FIRST(log_sys->log_groups);
|
|
|
|
|
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
|
|
|
#ifdef UNIV_LOG_ARCHIVE
|
2005-10-27 07:29:40 +00:00
|
|
|
if ((type == LOG_ARCHIVE) && (group == recv_sys->archive_group)) {
|
|
|
|
group = UT_LIST_GET_NEXT(log_groups, group);
|
2006-02-23 19:25:29 +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
|
|
|
#endif /* UNIV_LOG_ARCHIVE */
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2007-08-01 11:18:43 +00:00
|
|
|
/* Set the flag to publish that we are doing startup scan. */
|
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
|
|
|
recv_log_scan_is_startup_type = TYPE_CHECKPOINT;
|
2006-02-23 19:25:29 +00:00
|
|
|
while (group) {
|
2005-10-27 07:29:40 +00:00
|
|
|
old_scanned_lsn = recv_sys->scanned_lsn;
|
|
|
|
|
|
|
|
recv_group_scan_log_recs(group, &contiguous_lsn,
|
2006-08-29 09:30:31 +00:00
|
|
|
&group_scanned_lsn);
|
2005-10-27 07:29:40 +00:00
|
|
|
group->scanned_lsn = group_scanned_lsn;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
if (old_scanned_lsn < group_scanned_lsn) {
|
2005-10-27 07:29:40 +00:00
|
|
|
/* We found a more up-to-date group */
|
|
|
|
|
|
|
|
up_to_date_group = group;
|
|
|
|
}
|
2006-02-23 19:25:29 +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
|
|
|
#ifdef UNIV_LOG_ARCHIVE
|
2005-10-27 07:29:40 +00:00
|
|
|
if ((type == LOG_ARCHIVE)
|
2006-08-29 09:30:31 +00:00
|
|
|
&& (group == recv_sys->archive_group)) {
|
2005-10-27 07:29:40 +00:00
|
|
|
group = UT_LIST_GET_NEXT(log_groups, group);
|
2006-02-23 19:25:29 +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
|
|
|
#endif /* UNIV_LOG_ARCHIVE */
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
group = UT_LIST_GET_NEXT(log_groups, group);
|
|
|
|
}
|
|
|
|
|
2007-08-01 11:18:43 +00:00
|
|
|
/* Done with startup scan. Clear the flag. */
|
|
|
|
recv_log_scan_is_startup_type = FALSE;
|
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
|
|
|
if (TYPE_CHECKPOINT) {
|
2007-08-01 11:18:43 +00:00
|
|
|
/* 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: */
|
|
|
|
|
|
|
|
if (checkpoint_lsn != max_flushed_lsn
|
|
|
|
|| checkpoint_lsn != min_flushed_lsn) {
|
|
|
|
|
|
|
|
if (checkpoint_lsn < max_flushed_lsn) {
|
|
|
|
fprintf(stderr,
|
|
|
|
"InnoDB: #########################"
|
|
|
|
"#################################\n"
|
|
|
|
"InnoDB: "
|
|
|
|
"WARNING!\n"
|
|
|
|
"InnoDB: The log sequence number"
|
|
|
|
" in ibdata files is higher\n"
|
|
|
|
"InnoDB: than the log sequence number"
|
|
|
|
" in the ib_logfiles! Are you sure\n"
|
|
|
|
"InnoDB: you are using the right"
|
|
|
|
" ib_logfiles to start up"
|
|
|
|
" the database?\n"
|
|
|
|
"InnoDB: Log sequence number in"
|
|
|
|
" ib_logfiles is %llu, log\n"
|
|
|
|
"InnoDB: sequence numbers stamped"
|
|
|
|
" to ibdata file headers are between\n"
|
|
|
|
"InnoDB: %llu and %llu.\n"
|
|
|
|
"InnoDB: #########################"
|
|
|
|
"#################################\n",
|
|
|
|
checkpoint_lsn,
|
|
|
|
min_flushed_lsn,
|
|
|
|
max_flushed_lsn);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!recv_needed_recovery) {
|
|
|
|
fprintf(stderr,
|
|
|
|
"InnoDB: The log sequence number"
|
|
|
|
" in ibdata files does not match\n"
|
|
|
|
"InnoDB: the log sequence number"
|
|
|
|
" in the ib_logfiles!\n");
|
|
|
|
recv_init_crash_recovery();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!recv_needed_recovery) {
|
|
|
|
/* Init the doublewrite buffer memory structure */
|
|
|
|
trx_sys_doublewrite_init_or_restore_pages(FALSE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
/* We currently have only one log group */
|
2006-11-24 13:05:01 +00:00
|
|
|
if (group_scanned_lsn < checkpoint_lsn) {
|
2005-10-27 07:29:40 +00:00
|
|
|
ut_print_timestamp(stderr);
|
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
" InnoDB: ERROR: We were only able to scan the log"
|
|
|
|
" up to\n"
|
2006-11-24 13:05:01 +00:00
|
|
|
"InnoDB: %llu, but a checkpoint was at %llu.\n"
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: It is possible that"
|
|
|
|
" the database is now corrupt!\n",
|
2006-11-24 13:05:01 +00:00
|
|
|
group_scanned_lsn,
|
|
|
|
checkpoint_lsn);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
if (group_scanned_lsn < recv_max_page_lsn) {
|
2005-10-27 07:29:40 +00:00
|
|
|
ut_print_timestamp(stderr);
|
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
" InnoDB: ERROR: We were only able to scan the log"
|
2006-11-24 13:05:01 +00:00
|
|
|
" up to %llu\n"
|
|
|
|
"InnoDB: but a database page a had an lsn %llu."
|
2006-08-29 09:30:31 +00:00
|
|
|
" It is possible that the\n"
|
|
|
|
"InnoDB: database is now corrupt!\n",
|
2006-11-24 13:05:01 +00:00
|
|
|
group_scanned_lsn,
|
|
|
|
recv_max_page_lsn);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
if (recv_sys->recovered_lsn < checkpoint_lsn) {
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
mutex_exit(&(log_sys->mutex));
|
|
|
|
|
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
|
|
|
if (recv_sys->recovered_lsn >= LIMIT_LSN) {
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
return(DB_SUCCESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
ut_error;
|
|
|
|
|
|
|
|
return(DB_ERROR);
|
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
/* Synchronize the uncorrupted log groups to the most up-to-date log
|
|
|
|
group; we also copy checkpoint info to groups */
|
|
|
|
|
|
|
|
log_sys->next_checkpoint_lsn = checkpoint_lsn;
|
2006-11-24 13:05:01 +00:00
|
|
|
log_sys->next_checkpoint_no = checkpoint_no + 1;
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
#ifdef UNIV_LOG_ARCHIVE
|
|
|
|
log_sys->archived_lsn = archived_lsn;
|
|
|
|
#endif /* UNIV_LOG_ARCHIVE */
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
recv_synchronize_groups(up_to_date_group);
|
|
|
|
|
|
|
|
if (!recv_needed_recovery) {
|
2007-08-01 11:18:43 +00:00
|
|
|
ut_a(checkpoint_lsn == recv_sys->recovered_lsn);
|
2005-10-27 07:29:40 +00:00
|
|
|
} else {
|
|
|
|
srv_start_lsn = recv_sys->recovered_lsn;
|
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
log_sys->lsn = recv_sys->recovered_lsn;
|
|
|
|
|
|
|
|
ut_memcpy(log_sys->buf, recv_sys->last_block, OS_FILE_LOG_BLOCK_SIZE);
|
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
log_sys->buf_free = (ulint) log_sys->lsn % OS_FILE_LOG_BLOCK_SIZE;
|
2005-10-27 07:29:40 +00:00
|
|
|
log_sys->buf_next_to_write = log_sys->buf_free;
|
|
|
|
log_sys->written_to_some_lsn = log_sys->lsn;
|
|
|
|
log_sys->written_to_all_lsn = log_sys->lsn;
|
|
|
|
|
|
|
|
log_sys->last_checkpoint_lsn = checkpoint_lsn;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
log_sys->next_checkpoint_no = checkpoint_no + 1;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
#ifdef UNIV_LOG_ARCHIVE
|
2006-11-24 13:05:01 +00:00
|
|
|
if (archived_lsn == IB_ULONGLONG_MAX) {
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
log_sys->archiving_state = LOG_ARCH_OFF;
|
|
|
|
}
|
|
|
|
#endif /* UNIV_LOG_ARCHIVE */
|
|
|
|
|
|
|
|
mutex_enter(&(recv_sys->mutex));
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
recv_sys->apply_log_recs = TRUE;
|
|
|
|
|
2006-02-23 19:25:29 +00:00
|
|
|
mutex_exit(&(recv_sys->mutex));
|
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
mutex_exit(&(log_sys->mutex));
|
|
|
|
|
|
|
|
recv_lsn_checks_on = TRUE;
|
|
|
|
|
|
|
|
/* The database is now ready to start almost normal processing of user
|
|
|
|
transactions: transaction rollbacks and the application of the log
|
|
|
|
records in the hash table can be run in background. */
|
|
|
|
|
|
|
|
return(DB_SUCCESS);
|
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
|
|
|
|
|
|
|
#undef TYPE_CHECKPOINT
|
|
|
|
#undef LIMIT_LSN
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************
|
|
|
|
Completes recovery from a checkpoint. */
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
void
|
|
|
|
recv_recovery_from_checkpoint_finish(void)
|
|
|
|
/*======================================*/
|
|
|
|
{
|
2006-02-23 19:25:29 +00:00
|
|
|
int i;
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
/* Apply the hashed log records to the respective file pages */
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) {
|
|
|
|
|
|
|
|
recv_apply_hashed_log_recs(TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef UNIV_DEBUG
|
|
|
|
if (log_debug_writes) {
|
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: Log records applied to the database\n");
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
#endif /* UNIV_DEBUG */
|
|
|
|
|
|
|
|
if (recv_needed_recovery) {
|
|
|
|
trx_sys_print_mysql_master_log_pos();
|
|
|
|
trx_sys_print_mysql_binlog_offset();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (recv_sys->found_corrupt_log) {
|
|
|
|
|
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: WARNING: the log file may have been"
|
|
|
|
" corrupt and it\n"
|
|
|
|
"InnoDB: is possible that the log scan or parsing"
|
|
|
|
" did not proceed\n"
|
|
|
|
"InnoDB: far enough in recovery. Please run"
|
|
|
|
" CHECK TABLE\n"
|
|
|
|
"InnoDB: on your InnoDB tables to check that"
|
|
|
|
" they are ok!\n"
|
|
|
|
"InnoDB: It may be safest to recover your"
|
|
|
|
" InnoDB database from\n"
|
|
|
|
"InnoDB: a backup!\n");
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Free the resources of the recovery system */
|
|
|
|
|
|
|
|
recv_recovery_on = FALSE;
|
|
|
|
|
|
|
|
#ifndef UNIV_LOG_DEBUG
|
|
|
|
recv_sys_free();
|
|
|
|
#endif
|
2007-01-02 14:36:59 +00:00
|
|
|
|
2007-09-05 10:18:03 +00:00
|
|
|
/* Drop partially created indexes. */
|
|
|
|
row_merge_drop_temp_indexes();
|
|
|
|
|
2007-01-02 14:36:59 +00:00
|
|
|
#ifdef UNIV_SYNC_DEBUG
|
|
|
|
/* Wait for a while so that created threads have time to suspend
|
|
|
|
themselves before we switch the latching order checks on */
|
|
|
|
os_thread_sleep(1000000);
|
|
|
|
|
|
|
|
/* Switch latching order checks on in sync0sync.c */
|
|
|
|
sync_order_checks_on = TRUE;
|
|
|
|
#endif
|
2005-10-27 07:29:40 +00:00
|
|
|
if (srv_force_recovery < SRV_FORCE_NO_TRX_UNDO) {
|
|
|
|
/* Rollback the uncommitted transactions which have no user
|
|
|
|
session */
|
|
|
|
|
2007-10-30 08:25:01 +00:00
|
|
|
os_thread_create(trx_rollback_or_clean_all_recovered,
|
2006-08-29 09:30:31 +00:00
|
|
|
(void *)&i, NULL);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**********************************************************
|
|
|
|
Resets the logs. The contents of log files will be lost! */
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
void
|
|
|
|
recv_reset_logs(
|
|
|
|
/*============*/
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t lsn, /* in: reset to this lsn
|
2006-11-24 13:05:01 +00:00
|
|
|
rounded up to be divisible by
|
|
|
|
OS_FILE_LOG_BLOCK_SIZE, after
|
|
|
|
which we add
|
|
|
|
LOG_BLOCK_HDR_SIZE */
|
2005-10-27 07:29:40 +00:00
|
|
|
#ifdef UNIV_LOG_ARCHIVE
|
2006-11-24 13:05:01 +00:00
|
|
|
ulint arch_log_no, /* in: next archived log file number */
|
2005-10-27 07:29:40 +00:00
|
|
|
#endif /* UNIV_LOG_ARCHIVE */
|
2006-11-24 13:05:01 +00:00
|
|
|
ibool new_logs_created)/* in: TRUE if resetting logs
|
|
|
|
is done at the log creation;
|
|
|
|
FALSE if it is done after
|
|
|
|
archive recovery */
|
2005-10-27 07:29:40 +00:00
|
|
|
{
|
|
|
|
log_group_t* group;
|
|
|
|
|
|
|
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
2007-01-18 18:29:12 +00:00
|
|
|
|
2006-11-30 09:23:47 +00:00
|
|
|
log_sys->lsn = ut_uint64_align_up(lsn, OS_FILE_LOG_BLOCK_SIZE);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
group = UT_LIST_GET_FIRST(log_sys->log_groups);
|
|
|
|
|
|
|
|
while (group) {
|
|
|
|
group->lsn = log_sys->lsn;
|
|
|
|
group->lsn_offset = LOG_FILE_HDR_SIZE;
|
|
|
|
#ifdef UNIV_LOG_ARCHIVE
|
2006-02-23 19:25:29 +00:00
|
|
|
group->archived_file_no = arch_log_no;
|
2005-10-27 07:29:40 +00:00
|
|
|
group->archived_offset = 0;
|
|
|
|
#endif /* UNIV_LOG_ARCHIVE */
|
|
|
|
|
|
|
|
if (!new_logs_created) {
|
|
|
|
recv_truncate_group(group, group->lsn, group->lsn,
|
2006-08-29 09:30:31 +00:00
|
|
|
group->lsn, group->lsn);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
group = UT_LIST_GET_NEXT(log_groups, group);
|
|
|
|
}
|
|
|
|
|
|
|
|
log_sys->buf_next_to_write = 0;
|
|
|
|
log_sys->written_to_some_lsn = log_sys->lsn;
|
|
|
|
log_sys->written_to_all_lsn = log_sys->lsn;
|
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
log_sys->next_checkpoint_no = 0;
|
|
|
|
log_sys->last_checkpoint_lsn = 0;
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
#ifdef UNIV_LOG_ARCHIVE
|
|
|
|
log_sys->archived_lsn = log_sys->lsn;
|
|
|
|
#endif /* UNIV_LOG_ARCHIVE */
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
log_block_init(log_sys->buf, log_sys->lsn);
|
|
|
|
log_block_set_first_rec_group(log_sys->buf, LOG_BLOCK_HDR_SIZE);
|
|
|
|
|
|
|
|
log_sys->buf_free = LOG_BLOCK_HDR_SIZE;
|
2006-11-24 13:05:01 +00:00
|
|
|
log_sys->lsn += LOG_BLOCK_HDR_SIZE;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
mutex_exit(&(log_sys->mutex));
|
|
|
|
|
|
|
|
/* Reset the checkpoint fields in logs */
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
log_make_checkpoint_at(IB_ULONGLONG_MAX, TRUE);
|
|
|
|
log_make_checkpoint_at(IB_ULONGLONG_MAX, TRUE);
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
mutex_enter(&(log_sys->mutex));
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef UNIV_HOTBACKUP
|
|
|
|
/**********************************************************
|
|
|
|
Creates new log files after a backup has been restored. */
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
void
|
|
|
|
recv_reset_log_files_for_backup(
|
|
|
|
/*============================*/
|
|
|
|
const char* log_dir, /* in: log file directory path */
|
|
|
|
ulint n_log_files, /* in: number of log files */
|
|
|
|
ulint log_file_size, /* in: log file size */
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t lsn) /* in: new start lsn, must be
|
2005-10-27 07:29:40 +00:00
|
|
|
divisible by OS_FILE_LOG_BLOCK_SIZE */
|
|
|
|
{
|
|
|
|
os_file_t log_file;
|
|
|
|
ibool success;
|
|
|
|
byte* buf;
|
|
|
|
ulint i;
|
|
|
|
ulint log_dir_len;
|
2006-02-23 19:25:29 +00:00
|
|
|
char name[5000];
|
|
|
|
static const char ib_logfile_basename[] = "ib_logfile";
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
log_dir_len = strlen(log_dir);
|
2006-02-23 19:25:29 +00:00
|
|
|
/* full path name of ib_logfile consists of log dir path + basename
|
2006-08-29 09:30:31 +00:00
|
|
|
+ number. This must fit in the name buffer.
|
2006-02-23 19:25:29 +00:00
|
|
|
*/
|
|
|
|
ut_a(log_dir_len + strlen(ib_logfile_basename) + 11 < sizeof(name));
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
buf = ut_malloc(LOG_FILE_HDR_SIZE + OS_FILE_LOG_BLOCK_SIZE);
|
2006-02-23 19:25:29 +00:00
|
|
|
memset(buf, '\0', LOG_FILE_HDR_SIZE + OS_FILE_LOG_BLOCK_SIZE);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
for (i = 0; i < n_log_files; i++) {
|
|
|
|
|
2006-02-23 19:25:29 +00:00
|
|
|
sprintf(name, "%s%s%lu", log_dir,
|
|
|
|
ib_logfile_basename, (ulong)i);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
log_file = os_file_create_simple(name, OS_FILE_CREATE,
|
2006-08-29 09:30:31 +00:00
|
|
|
OS_FILE_READ_WRITE, &success);
|
2005-10-27 07:29:40 +00:00
|
|
|
if (!success) {
|
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: Cannot create %s. Check that"
|
|
|
|
" the file does not exist yet.\n", name);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
fprintf(stderr,
|
|
|
|
"Setting log file size to %lu %lu\n",
|
|
|
|
(ulong) ut_get_high32(log_file_size),
|
|
|
|
(ulong) log_file_size & 0xFFFFFFFFUL);
|
|
|
|
|
|
|
|
success = os_file_set_size(name, log_file,
|
2006-08-29 09:30:31 +00:00
|
|
|
log_file_size & 0xFFFFFFFFUL,
|
|
|
|
ut_get_high32(log_file_size));
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
if (!success) {
|
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: Cannot set %s size to %lu %lu\n",
|
|
|
|
name, (ulong) ut_get_high32(log_file_size),
|
|
|
|
(ulong) (log_file_size & 0xFFFFFFFFUL));
|
2005-10-27 07:29:40 +00:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
os_file_flush(log_file);
|
|
|
|
os_file_close(log_file);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We pretend there is a checkpoint at lsn + LOG_BLOCK_HDR_SIZE */
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
log_reset_first_header_and_checkpoint(buf, lsn);
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
log_block_init_in_old_format(buf + LOG_FILE_HDR_SIZE, lsn);
|
|
|
|
log_block_set_first_rec_group(buf + LOG_FILE_HDR_SIZE,
|
2006-08-29 09:30:31 +00:00
|
|
|
LOG_BLOCK_HDR_SIZE);
|
2006-02-23 19:25:29 +00:00
|
|
|
sprintf(name, "%s%s%lu", log_dir, ib_logfile_basename, (ulong)0);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
log_file = os_file_create_simple(name, OS_FILE_OPEN,
|
2006-08-29 09:30:31 +00:00
|
|
|
OS_FILE_READ_WRITE, &success);
|
2005-10-27 07:29:40 +00:00
|
|
|
if (!success) {
|
|
|
|
fprintf(stderr, "InnoDB: Cannot open %s.\n", name);
|
|
|
|
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
os_file_write(name, log_file, buf, 0, 0,
|
2006-08-29 09:30:31 +00:00
|
|
|
LOG_FILE_HDR_SIZE + OS_FILE_LOG_BLOCK_SIZE);
|
2005-10-27 07:29:40 +00:00
|
|
|
os_file_flush(log_file);
|
|
|
|
os_file_close(log_file);
|
|
|
|
|
|
|
|
ut_free(buf);
|
|
|
|
}
|
|
|
|
#endif /* UNIV_HOTBACKUP */
|
|
|
|
|
|
|
|
#ifdef UNIV_LOG_ARCHIVE
|
|
|
|
/**********************************************************
|
|
|
|
Reads from the archive of a log group and performs recovery. */
|
|
|
|
static
|
|
|
|
ibool
|
|
|
|
log_group_recover_from_archive_file(
|
|
|
|
/*================================*/
|
|
|
|
/* out: TRUE if no more complete
|
|
|
|
consistent archive files */
|
|
|
|
log_group_t* group) /* in: log group */
|
|
|
|
{
|
2006-11-24 13:05:01 +00:00
|
|
|
os_file_t file_handle;
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t start_lsn;
|
|
|
|
ib_uint64_t file_end_lsn;
|
|
|
|
ib_uint64_t dummy_lsn;
|
|
|
|
ib_uint64_t scanned_lsn;
|
2006-11-24 13:05:01 +00:00
|
|
|
ulint len;
|
|
|
|
ibool ret;
|
|
|
|
byte* buf;
|
|
|
|
ulint read_offset;
|
|
|
|
ulint file_size;
|
|
|
|
ulint file_size_high;
|
|
|
|
int input_char;
|
|
|
|
char name[10000];
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
ut_a(0);
|
|
|
|
|
2006-02-23 19:25:29 +00:00
|
|
|
try_open_again:
|
2005-10-27 07:29:40 +00:00
|
|
|
buf = log_sys->buf;
|
|
|
|
|
|
|
|
/* Add the file to the archive file space; open the file */
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
log_archived_file_name_gen(name, group->id, group->archived_file_no);
|
|
|
|
|
|
|
|
file_handle = os_file_create(name, OS_FILE_OPEN,
|
2006-08-29 09:30:31 +00:00
|
|
|
OS_FILE_LOG, OS_FILE_AIO, &ret);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
if (ret == FALSE) {
|
|
|
|
ask_again:
|
2006-02-23 19:25:29 +00:00
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: Do you want to copy additional"
|
|
|
|
" archived log files\n"
|
|
|
|
"InnoDB: to the directory\n");
|
2006-02-23 19:25:29 +00:00
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: or were these all the files needed"
|
|
|
|
" in recovery?\n");
|
2006-02-23 19:25:29 +00:00
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: (Y == copy more files; N == this is all)?");
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
input_char = getchar();
|
|
|
|
|
|
|
|
if (input_char == (int) 'N') {
|
|
|
|
|
|
|
|
return(TRUE);
|
|
|
|
} else if (input_char == (int) 'Y') {
|
|
|
|
|
|
|
|
goto try_open_again;
|
|
|
|
} else {
|
|
|
|
goto ask_again;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = os_file_get_size(file_handle, &file_size, &file_size_high);
|
|
|
|
ut_a(ret);
|
|
|
|
|
|
|
|
ut_a(file_size_high == 0);
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
fprintf(stderr, "InnoDB: Opened archived log file %s\n", name);
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
ret = os_file_close(file_handle);
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
if (file_size < LOG_FILE_HDR_SIZE) {
|
|
|
|
fprintf(stderr,
|
|
|
|
"InnoDB: Archive file header incomplete %s\n", name);
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
return(TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
ut_a(ret);
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
/* Add the archive file as a node to the space */
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
fil_node_create(name, 1 + file_size / UNIV_PAGE_SIZE,
|
2006-08-29 09:30:31 +00:00
|
|
|
group->archive_space_id, FALSE);
|
2006-02-17 14:19:39 +00:00
|
|
|
#if RECV_SCAN_SIZE < LOG_FILE_HDR_SIZE
|
|
|
|
# error "RECV_SCAN_SIZE < LOG_FILE_HDR_SIZE"
|
|
|
|
#endif
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
/* Read the archive file header */
|
|
|
|
fil_io(OS_FILE_READ | OS_FILE_LOG, TRUE, group->archive_space_id, 0, 0,
|
2006-08-29 09:30:31 +00:00
|
|
|
LOG_FILE_HDR_SIZE, buf, NULL);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
/* Check if the archive file header is consistent */
|
|
|
|
|
|
|
|
if (mach_read_from_4(buf + LOG_GROUP_ID) != group->id
|
2006-08-29 09:30:31 +00:00
|
|
|
|| mach_read_from_4(buf + LOG_FILE_NO)
|
|
|
|
!= group->archived_file_no) {
|
2005-10-27 07:29:40 +00:00
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: Archive file header inconsistent %s\n", name);
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
return(TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!mach_read_from_4(buf + LOG_FILE_ARCH_COMPLETED)) {
|
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: Archive file not completely written %s\n",
|
|
|
|
name);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
return(TRUE);
|
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
start_lsn = mach_read_ull(buf + LOG_FILE_START_LSN);
|
|
|
|
file_end_lsn = mach_read_ull(buf + LOG_FILE_END_LSN);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
if (!recv_sys->scanned_lsn) {
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
if (recv_sys->parse_start_lsn < start_lsn) {
|
2006-02-23 19:25:29 +00:00
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: Archive log file %s"
|
|
|
|
" starts from too big a lsn\n",
|
2006-02-23 19:25:29 +00:00
|
|
|
name);
|
2005-10-27 07:29:40 +00:00
|
|
|
return(TRUE);
|
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
recv_sys->scanned_lsn = start_lsn;
|
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
if (recv_sys->scanned_lsn != start_lsn) {
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: Archive log file %s starts from"
|
|
|
|
" a wrong lsn\n",
|
|
|
|
name);
|
2005-10-27 07:29:40 +00:00
|
|
|
return(TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
read_offset = LOG_FILE_HDR_SIZE;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
for (;;) {
|
|
|
|
len = RECV_SCAN_SIZE;
|
|
|
|
|
|
|
|
if (read_offset + len > file_size) {
|
|
|
|
len = ut_calc_align_down(file_size - read_offset,
|
2006-08-29 09:30:31 +00:00
|
|
|
OS_FILE_LOG_BLOCK_SIZE);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (len == 0) {
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
#ifdef UNIV_DEBUG
|
|
|
|
if (log_debug_writes) {
|
2006-02-23 19:25:29 +00:00
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: Archive read starting at"
|
2006-11-24 13:05:01 +00:00
|
|
|
" lsn %llu, len %lu from file %s\n",
|
|
|
|
start_lsn,
|
2006-08-29 09:30:31 +00:00
|
|
|
(ulong) len, name);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
#endif /* UNIV_DEBUG */
|
|
|
|
|
|
|
|
fil_io(OS_FILE_READ | OS_FILE_LOG, TRUE,
|
2006-08-29 09:30:31 +00:00
|
|
|
group->archive_space_id, read_offset / UNIV_PAGE_SIZE,
|
|
|
|
read_offset % UNIV_PAGE_SIZE, len, buf, NULL);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-09-19 10:14:07 +00:00
|
|
|
ret = recv_scan_log_recs(
|
|
|
|
TRUE, (buf_pool->n_frames - recv_n_pool_free_frames)
|
|
|
|
* UNIV_PAGE_SIZE, TRUE, buf, len, start_lsn,
|
|
|
|
&dummy_lsn, &scanned_lsn);
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
if (scanned_lsn == file_end_lsn) {
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
return(FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ret) {
|
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: Archive log file %s"
|
|
|
|
" does not scan right\n",
|
2006-02-23 19:25:29 +00:00
|
|
|
name);
|
2005-10-27 07:29:40 +00:00
|
|
|
return(TRUE);
|
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
read_offset += len;
|
2006-11-24 13:05:01 +00:00
|
|
|
start_lsn += len;
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
ut_ad(start_lsn == scanned_lsn);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return(FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************
|
|
|
|
Recovers from archived log files, and also from log files, if they exist. */
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
ulint
|
|
|
|
recv_recovery_from_archive_start(
|
|
|
|
/*=============================*/
|
2006-11-24 13:05:01 +00:00
|
|
|
/* out: error code or DB_SUCCESS */
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t min_flushed_lsn,/* in: min flushed lsn field from the
|
2006-11-24 13:05:01 +00:00
|
|
|
data files */
|
2006-11-29 14:52:16 +00:00
|
|
|
ib_uint64_t limit_lsn, /* in: recover up to this lsn if
|
2006-11-24 13:05:01 +00:00
|
|
|
possible */
|
|
|
|
ulint first_log_no) /* in: number of the first archived
|
|
|
|
log file to use in the recovery; the
|
|
|
|
file will be searched from
|
|
|
|
INNOBASE_LOG_ARCH_DIR specified in
|
|
|
|
server config file */
|
2005-10-27 07:29:40 +00:00
|
|
|
{
|
|
|
|
log_group_t* group;
|
|
|
|
ulint group_id;
|
|
|
|
ulint trunc_len;
|
|
|
|
ibool ret;
|
|
|
|
ulint err;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
ut_a(0);
|
|
|
|
|
|
|
|
recv_sys_create();
|
|
|
|
recv_sys_init(FALSE, buf_pool_get_curr_size());
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
recv_recovery_on = TRUE;
|
|
|
|
recv_recovery_from_backup_on = TRUE;
|
|
|
|
|
|
|
|
recv_sys->limit_lsn = limit_lsn;
|
|
|
|
|
|
|
|
group_id = 0;
|
|
|
|
|
|
|
|
group = UT_LIST_GET_FIRST(log_sys->log_groups);
|
|
|
|
|
|
|
|
while (group) {
|
|
|
|
if (group->id == group_id) {
|
|
|
|
|
2006-02-23 19:25:29 +00:00
|
|
|
break;
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
group = UT_LIST_GET_NEXT(log_groups, group);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!group) {
|
|
|
|
fprintf(stderr,
|
2006-08-29 09:30:31 +00:00
|
|
|
"InnoDB: There is no log group defined with id %lu!\n",
|
|
|
|
(ulong) group_id);
|
2005-10-27 07:29:40 +00:00
|
|
|
return(DB_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
group->archived_file_no = first_log_no;
|
|
|
|
|
|
|
|
recv_sys->parse_start_lsn = min_flushed_lsn;
|
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
recv_sys->scanned_lsn = 0;
|
2005-10-27 07:29:40 +00:00
|
|
|
recv_sys->scanned_checkpoint_no = 0;
|
|
|
|
recv_sys->recovered_lsn = recv_sys->parse_start_lsn;
|
|
|
|
|
|
|
|
recv_sys->archive_group = group;
|
|
|
|
|
|
|
|
ret = FALSE;
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
mutex_enter(&(log_sys->mutex));
|
|
|
|
|
|
|
|
while (!ret) {
|
|
|
|
ret = log_group_recover_from_archive_file(group);
|
|
|
|
|
|
|
|
/* Close and truncate a possible processed archive file
|
|
|
|
from the file space */
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
trunc_len = UNIV_PAGE_SIZE
|
2006-02-23 19:25:29 +00:00
|
|
|
* fil_space_get_size(group->archive_space_id);
|
2005-10-27 07:29:40 +00:00
|
|
|
if (trunc_len > 0) {
|
|
|
|
fil_space_truncate_start(group->archive_space_id,
|
2006-08-29 09:30:31 +00:00
|
|
|
trunc_len);
|
2005-10-27 07:29:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
group->archived_file_no++;
|
|
|
|
}
|
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
if (recv_sys->recovered_lsn < limit_lsn) {
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
if (!recv_sys->scanned_lsn) {
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
recv_sys->scanned_lsn = recv_sys->parse_start_lsn;
|
|
|
|
}
|
|
|
|
|
|
|
|
mutex_exit(&(log_sys->mutex));
|
|
|
|
|
|
|
|
err = recv_recovery_from_checkpoint_start(LOG_ARCHIVE,
|
2006-08-29 09:30:31 +00:00
|
|
|
limit_lsn,
|
2006-11-24 13:05:01 +00:00
|
|
|
IB_ULONGLONG_MAX,
|
|
|
|
IB_ULONGLONG_MAX);
|
2005-10-27 07:29:40 +00:00
|
|
|
if (err != DB_SUCCESS) {
|
|
|
|
|
|
|
|
return(err);
|
|
|
|
}
|
|
|
|
|
|
|
|
mutex_enter(&(log_sys->mutex));
|
|
|
|
}
|
|
|
|
|
2006-11-24 13:05:01 +00:00
|
|
|
if (limit_lsn != IB_ULONGLONG_MAX) {
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
recv_apply_hashed_log_recs(FALSE);
|
|
|
|
|
|
|
|
recv_reset_logs(recv_sys->recovered_lsn, 0, FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
mutex_exit(&(log_sys->mutex));
|
|
|
|
|
|
|
|
return(DB_SUCCESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
/************************************************************
|
|
|
|
Completes recovery from archive. */
|
2008-02-06 14:17:36 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
void
|
|
|
|
recv_recovery_from_archive_finish(void)
|
|
|
|
/*===================================*/
|
|
|
|
{
|
|
|
|
recv_recovery_from_checkpoint_finish();
|
|
|
|
|
|
|
|
recv_recovery_from_backup_on = FALSE;
|
|
|
|
}
|
|
|
|
#endif /* UNIV_LOG_ARCHIVE */
|