Commit 488cc63a authored by Aleksandr Kuzminsky's avatar Aleksandr Kuzminsky

Sync with rev. 152 of extensions-1.0.6

parent 0a3a94ae
......@@ -137,6 +137,12 @@ btr_root_block_get(
root_page_no = dict_index_get_page(index);
block = btr_block_get(space, zip_size, root_page_no, RW_X_LATCH, mtr);
if (srv_pass_corrupt_table && !block) {
return(0);
}
ut_a(block);
ut_a((ibool)!!page_is_comp(buf_block_get_frame(block))
== dict_table_is_comp(index->table));
#ifdef UNIV_BTR_DEBUG
......@@ -422,6 +428,12 @@ btr_get_size(
root = btr_root_get(index, &mtr);
if (srv_pass_corrupt_table && !root) {
mtr_commit(&mtr);
return(0);
}
ut_a(root);
if (flag == BTR_N_LEAF_PAGES) {
seg_header = root + PAGE_HEADER + PAGE_BTR_SEG_LEAF;
......@@ -862,6 +874,13 @@ leaf_loop:
mtr_start(&mtr);
root = btr_page_get(space, zip_size, root_page_no, RW_X_LATCH, &mtr);
if (srv_pass_corrupt_table && !root) {
mtr_commit(&mtr);
return;
}
ut_a(root);
#ifdef UNIV_BTR_DEBUG
ut_a(btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF
+ root, space));
......@@ -884,6 +903,12 @@ top_loop:
mtr_start(&mtr);
root = btr_page_get(space, zip_size, root_page_no, RW_X_LATCH, &mtr);
if (srv_pass_corrupt_table && !root) {
mtr_commit(&mtr);
return;
}
ut_a(root);
#ifdef UNIV_BTR_DEBUG
ut_a(btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_TOP
+ root, space));
......@@ -917,6 +942,11 @@ btr_free_root(
block = btr_block_get(space, zip_size, root_page_no, RW_X_LATCH, mtr);
if (srv_pass_corrupt_table && !block) {
return;
}
ut_a(block);
btr_search_drop_page_hash_index(block);
header = buf_block_get_frame(block) + PAGE_HEADER + PAGE_BTR_SEG_TOP;
......
This diff is collapsed.
......@@ -32,7 +32,7 @@ Created 2/23/1996 Heikki Tuuri
#include "ut0byte.h"
#include "rem0cmp.h"
#include "trx0trx.h"
#include "srv0srv.h"
/**************************************************************//**
Allocates memory for a persistent cursor object and initializes the cursor.
@return own: persistent cursor */
......@@ -102,6 +102,12 @@ btr_pcur_store_position(
ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
block = btr_pcur_get_block(cursor);
if (srv_pass_corrupt_table && !block) {
return;
}
ut_a(block);
index = btr_cur_get_index(btr_pcur_get_btr_cur(cursor));
page_cursor = btr_pcur_get_page_cur(cursor);
......@@ -413,6 +419,15 @@ btr_pcur_move_to_next_page(
next_block = btr_block_get(space, zip_size, next_page_no,
cursor->latch_mode, mtr);
next_page = buf_block_get_frame(next_block);
if (srv_pass_corrupt_table && !next_page) {
btr_leaf_page_release(btr_pcur_get_block(cursor),
cursor->latch_mode, mtr);
btr_pcur_get_page_cur(cursor)->block = 0;
btr_pcur_get_page_cur(cursor)->rec = 0;
return;
}
ut_a(next_page);
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(next_page) == page_is_comp(page));
ut_a(btr_page_get_prev(next_page, mtr)
......
......@@ -42,7 +42,7 @@ Created 2/17/1996 Heikki Tuuri
#include "btr0pcur.h"
#include "btr0btr.h"
#include "ha0ha.h"
#include "srv0srv.h"
/** Flag: has the search system been enabled?
Protected by btr_search_latch and btr_search_enabled_mutex. */
UNIV_INTERN char btr_search_enabled = TRUE;
......@@ -585,6 +585,11 @@ btr_search_info_update_slow(
block = btr_cur_get_block(cursor);
if (srv_pass_corrupt_table && !block) {
return;
}
ut_a(block);
/* NOTE that the following two function calls do NOT protect
info or block->n_fields etc. with any semaphore, to save CPU time!
We cannot assume the fields are consistent when we return from
......
......@@ -43,7 +43,7 @@ static ulint buf_buddy_n_frames;
#endif /* UNIV_DEBUG */
/** Statistics of the buddy system, indexed by block size.
Protected by buf_pool_mutex. */
UNIV_INTERN buf_buddy_stat_t buf_buddy_stat[BUF_BUDDY_SIZES + 1];
UNIV_INTERN buf_buddy_stat_t buf_buddy_stat[BUF_BUDDY_SIZES_MAX + 1];
/**********************************************************************//**
Get the offset of the buddy of a compressed page frame.
......
......@@ -52,6 +52,7 @@ Created 11/5/1995 Heikki Tuuri
#include "log0recv.h"
#include "page0zip.h"
#include "trx0trx.h"
#include "srv0start.h"
/* prototypes for new functions added to ha_innodb.cc */
trx_t* innobase_get_trx();
......@@ -348,6 +349,27 @@ buf_calc_page_new_checksum(
return(checksum);
}
UNIV_INTERN
ulint
buf_calc_page_new_checksum_32(
/*==========================*/
const byte* page) /*!< in: buffer page */
{
ulint checksum;
checksum = ut_fold_binary(page + FIL_PAGE_OFFSET,
FIL_PAGE_FILE_FLUSH_LSN - FIL_PAGE_OFFSET)
+ ut_fold_binary(page + FIL_PAGE_DATA,
FIL_PAGE_DATA_ALIGN_32 - FIL_PAGE_DATA)
+ ut_fold_binary_32(page + FIL_PAGE_DATA_ALIGN_32,
UNIV_PAGE_SIZE - FIL_PAGE_DATA_ALIGN_32
- FIL_PAGE_END_LSN_OLD_CHKSUM);
checksum = checksum & 0xFFFFFFFFUL;
return(checksum);
}
/********************************************************************//**
In versions < 4.0.14 and < 4.1.1 there was a bug that the checksum only
looked at the first few bytes of the page. This calculates that old
......@@ -462,13 +484,25 @@ buf_page_is_corrupted(
/* InnoDB versions < 4.0.14 and < 4.1.1 stored the space id
(always equal to 0), to FIL_PAGE_SPACE_OR_CHKSUM */
if (checksum_field != 0
if (!srv_fast_checksum
&& checksum_field != 0
&& checksum_field != BUF_NO_CHECKSUM_MAGIC
&& checksum_field
!= buf_calc_page_new_checksum(read_buf)) {
return(TRUE);
}
if (srv_fast_checksum
&& checksum_field != 0
&& checksum_field != BUF_NO_CHECKSUM_MAGIC
&& checksum_field
!= buf_calc_page_new_checksum_32(read_buf)
&& checksum_field
!= buf_calc_page_new_checksum(read_buf)) {
return(TRUE);
}
}
return(FALSE);
......@@ -488,6 +522,7 @@ buf_page_print(
dict_index_t* index;
#endif /* !UNIV_HOTBACKUP */
ulint checksum;
ulint checksum_32;
ulint old_checksum;
ulint size = zip_size;
......@@ -574,12 +609,14 @@ buf_page_print(
checksum = srv_use_checksums
? buf_calc_page_new_checksum(read_buf) : BUF_NO_CHECKSUM_MAGIC;
checksum_32 = srv_use_checksums
? buf_calc_page_new_checksum_32(read_buf) : BUF_NO_CHECKSUM_MAGIC;
old_checksum = srv_use_checksums
? buf_calc_page_old_checksum(read_buf) : BUF_NO_CHECKSUM_MAGIC;
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Page checksum %lu, prior-to-4.0.14-form"
" InnoDB: Page checksum %lu (32bit_calc: %lu), prior-to-4.0.14-form"
" checksum %lu\n"
"InnoDB: stored checksum %lu, prior-to-4.0.14-form"
" stored checksum %lu\n"
......@@ -588,7 +625,7 @@ buf_page_print(
"InnoDB: Page number (if stored to page already) %lu,\n"
"InnoDB: space id (if created with >= MySQL-4.1.1"
" and stored already) %lu\n",
(ulong) checksum, (ulong) old_checksum,
(ulong) checksum, (ulong) checksum_32, (ulong) old_checksum,
(ulong) mach_read_from_4(read_buf + FIL_PAGE_SPACE_OR_CHKSUM),
(ulong) mach_read_from_4(read_buf + UNIV_PAGE_SIZE
- FIL_PAGE_END_LSN_OLD_CHKSUM),
......@@ -1809,6 +1846,14 @@ err_exit:
return(NULL);
}
if (srv_pass_corrupt_table) {
if (bpage->is_corrupt) {
rw_lock_s_unlock(&page_hash_latch);
return(NULL);
}
}
ut_a(!(bpage->is_corrupt));
block_mutex = buf_page_get_mutex_enter(bpage);
rw_lock_s_unlock(&page_hash_latch);
......@@ -2246,6 +2291,14 @@ loop2:
return(NULL);
}
if (srv_pass_corrupt_table) {
if (block->page.is_corrupt) {
mutex_exit(block_mutex);
return(NULL);
}
}
ut_a(!(block->page.is_corrupt));
switch (buf_block_get_state(block)) {
buf_page_t* bpage;
ibool success;
......@@ -2874,6 +2927,7 @@ buf_page_init_low(
bpage->newest_modification = 0;
bpage->oldest_modification = 0;
HASH_INVALIDATE(bpage, hash);
bpage->is_corrupt = FALSE;
#ifdef UNIV_DEBUG_FILE_ACCESSES
bpage->file_page_was_freed = FALSE;
#endif /* UNIV_DEBUG_FILE_ACCESSES */
......@@ -3329,7 +3383,8 @@ UNIV_INTERN
void
buf_page_io_complete(
/*=================*/
buf_page_t* bpage) /*!< in: pointer to the block in question */
buf_page_t* bpage, /*!< in: pointer to the block in question */
trx_t* trx)
{
enum buf_io_fix io_type;
const ibool uncompressed = (buf_page_get_state(bpage)
......@@ -3406,6 +3461,7 @@ buf_page_io_complete(
(ulong) bpage->offset);
}
if (!srv_pass_corrupt_table || !bpage->is_corrupt) {
/* From version 3.23.38 up we store the page checksum
to the 4 first bytes of the page end lsn field */
......@@ -3447,6 +3503,19 @@ corrupt:
REFMAN "forcing-recovery.html\n"
"InnoDB: about forcing recovery.\n", stderr);
if (srv_pass_corrupt_table && bpage->space > 0
&& bpage->space < SRV_LOG_SPACE_FIRST_ID) {
fprintf(stderr,
"InnoDB: space %lu will be treated as corrupt.\n",
bpage->space);
fil_space_set_corrupt(bpage->space);
if (trx && trx->dict_operation_lock_mode == 0) {
dict_table_set_corrupt_by_space(bpage->space, TRUE);
} else {
dict_table_set_corrupt_by_space(bpage->space, FALSE);
}
bpage->is_corrupt = TRUE;
} else
if (srv_force_recovery < SRV_FORCE_IGNORE_CORRUPT) {
fputs("InnoDB: Ending processing because of"
" a corrupt database page.\n",
......@@ -3454,6 +3523,7 @@ corrupt:
exit(1);
}
}
} /**/
if (recv_recovery_is_on()) {
/* Pages must be uncompressed for crash recovery. */
......@@ -3463,8 +3533,11 @@ corrupt:
if (uncompressed && !recv_no_ibuf_operations) {
ibuf_merge_or_delete_for_page(
/* Delete possible entries, if bpage is_corrupt */
(srv_pass_corrupt_table && bpage->is_corrupt) ? NULL :
(buf_block_t*) bpage, bpage->space,
bpage->offset, buf_page_get_zip_size(bpage),
(srv_pass_corrupt_table && bpage->is_corrupt) ? FALSE :
TRUE);
}
}
......
......@@ -711,7 +711,9 @@ buf_flush_init_for_writing(
mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM,
srv_use_checksums
? buf_calc_page_new_checksum(page)
? (!srv_fast_checksum
? buf_calc_page_new_checksum(page)
: buf_calc_page_new_checksum_32(page))
: BUF_NO_CHECKSUM_MAGIC);
/* We overwrite the first 4 bytes of the end lsn field to store
......
......@@ -187,12 +187,19 @@ not_to_recover:
sync, space, 0, offset, 0, UNIV_PAGE_SIZE,
((buf_block_t*) bpage)->frame, bpage, trx);
}
if (srv_pass_corrupt_table) {
if (*err != DB_SUCCESS) {
bpage->is_corrupt = TRUE;
}
} else {
ut_a(*err == DB_SUCCESS);
}
if (sync) {
/* The i/o is already completed when we arrive from
fil_read */
buf_page_io_complete(bpage);
buf_page_io_complete(bpage, trx);
}
return(1);
......
......@@ -1018,6 +1018,10 @@ fi
# merging BK trees)
##############################################################################
%changelog
* Mon Mar 22 2010 Aleksandr Kuzminsky <aleksandr.kuzminsky@percona.com>
XtraDB Release 10
* Thu Feb 11 2010 Aleksandr Kuzminsky <aleksandr.kuzminsky@percona.com>
Package name changed to Percona-XtraDB
......
......@@ -54,6 +54,7 @@ UNIV_INTERN dict_index_t* dict_ind_compact;
#include "row0merge.h"
#include "m_ctype.h" /* my_isspace() */
#include "ha_prototypes.h" /* innobase_strcasecmp() */
#include "srv0start.h" /* SRV_LOG_SPACE_FIRST_ID */
#include <ctype.h>
......@@ -658,7 +659,7 @@ dict_table_get(
mutex_exit(&(dict_sys->mutex));
if (table != NULL) {
if (!table->stat_initialized) {
if (!table->stat_initialized && !table->is_corrupt) {
/* If table->ibd_file_missing == TRUE, this will
print an error message and return without doing
anything. */
......@@ -1181,7 +1182,7 @@ retry:
+ dict_sys->size) > srv_dict_size_limit ) {
prev_table = UT_LIST_GET_PREV(table_LRU, table);
if (table == self || table->n_mysql_handles_opened)
if (table == self || table->n_mysql_handles_opened || table->is_corrupt)
goto next_loop;
cached_foreign_tables = 0;
......@@ -4219,6 +4220,11 @@ dict_update_statistics_low(
}
while (index) {
if (table->is_corrupt) {
ut_a(srv_pass_corrupt_table);
return;
}
size = btr_get_size(index, BTR_TOTAL_SIZE);
index->stat_index_size = size;
......@@ -4920,4 +4926,42 @@ dict_close(void)
mem_free(dict_sys);
dict_sys = NULL;
}
/*************************************************************************
set is_corrupt flag by space_id*/
void
dict_table_set_corrupt_by_space(
/*============================*/
ulint space_id,
ibool need_mutex)
{
dict_table_t* table;
ibool found = FALSE;
ut_a(space_id != 0 && space_id < SRV_LOG_SPACE_FIRST_ID);
if (need_mutex)
mutex_enter(&(dict_sys->mutex));
table = UT_LIST_GET_FIRST(dict_sys->table_LRU);
while (table) {
if (table->space == space_id) {
table->is_corrupt = TRUE;
found = TRUE;
}
table = UT_LIST_GET_NEXT(table_LRU, table);
}
if (need_mutex)
mutex_exit(&(dict_sys->mutex));
if (!found) {
fprintf(stderr, "InnoDB: space to be marked as "
"crashed was not found for id %lu.\n",
(ulong) space_id);
}
}
#endif /* !UNIV_HOTBACKUP */
......@@ -85,6 +85,8 @@ dict_mem_table_create(
/* The number of transactions that are either waiting on the
AUTOINC lock or have been granted the lock. */
table->n_waiting_or_granted_auto_inc_locks = 0;
table->is_corrupt = FALSE;
#endif /* !UNIV_HOTBACKUP */
ut_d(table->magic_n = DICT_TABLE_MAGIC_N);
......
......@@ -220,6 +220,7 @@ struct fil_space_struct {
file we have written to */
ibool is_in_unflushed_spaces; /*!< TRUE if this space is
currently in unflushed_spaces */
ibool is_corrupt;
UT_LIST_NODE_T(fil_space_t) space_list;
/*!< list of all spaces */
ulint magic_n;/*!< FIL_SPACE_MAGIC_N */
......@@ -1220,6 +1221,8 @@ try_again:
ut_fold_string(name), space);
space->is_in_unflushed_spaces = FALSE;
space->is_corrupt = FALSE;
UT_LIST_ADD_LAST(space_list, fil_system->space_list, space);
mutex_exit(&fil_system->mutex);
......@@ -3042,7 +3045,9 @@ fil_open_single_table_tablespace(
mach_write_ull(page + FIL_PAGE_FILE_FLUSH_LSN, current_lsn);
mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM,
srv_use_checksums
? buf_calc_page_new_checksum(page)
? (!srv_fast_checksum
? buf_calc_page_new_checksum(page)
: buf_calc_page_new_checksum_32(page))
: BUF_NO_CHECKSUM_MAGIC);
mach_write_to_4(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
srv_use_checksums
......@@ -3154,7 +3159,8 @@ skip_info:
goto skip_write;
}
if (checksum_field != 0
if (!srv_fast_checksum
&& checksum_field != 0
&& checksum_field != BUF_NO_CHECKSUM_MAGIC
&& checksum_field
!= buf_calc_page_new_checksum(page)) {
......@@ -3162,6 +3168,17 @@ skip_info:
goto skip_write;
}
if (srv_fast_checksum
&& checksum_field != 0
&& checksum_field != BUF_NO_CHECKSUM_MAGIC
&& checksum_field
!= buf_calc_page_new_checksum_32(page)
&& checksum_field
!= buf_calc_page_new_checksum(page)) {
goto skip_write;
}
if (mach_read_from_4(page + FIL_PAGE_OFFSET) || !offset) {
mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, id);
......@@ -3236,7 +3253,9 @@ skip_info:
mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM,
srv_use_checksums
? buf_calc_page_new_checksum(page)
? (!srv_fast_checksum
? buf_calc_page_new_checksum(page)
: buf_calc_page_new_checksum_32(page))
: BUF_NO_CHECKSUM_MAGIC);
mach_write_to_4(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
srv_use_checksums
......@@ -4575,9 +4594,9 @@ _fil_io(
ut_ad(ut_is_2pow(zip_size));
ut_ad(buf);
ut_ad(len > 0);
#if (1 << UNIV_PAGE_SIZE_SHIFT) != UNIV_PAGE_SIZE
# error "(1 << UNIV_PAGE_SIZE_SHIFT) != UNIV_PAGE_SIZE"
#endif
//#if (1 << UNIV_PAGE_SIZE_SHIFT) != UNIV_PAGE_SIZE
//# error "(1 << UNIV_PAGE_SIZE_SHIFT) != UNIV_PAGE_SIZE"
//#endif
ut_ad(fil_validate());
#ifndef UNIV_HOTBACKUP
# ifndef UNIV_LOG_DEBUG
......@@ -4711,6 +4730,22 @@ _fil_io(
ut_a(byte_offset % OS_FILE_LOG_BLOCK_SIZE == 0);
ut_a((len % OS_FILE_LOG_BLOCK_SIZE) == 0);
if (srv_pass_corrupt_table && space->is_corrupt) {
/* should ignore i/o for the crashed space */
mutex_enter(&fil_system->mutex);
fil_node_complete_io(node, fil_system, type);
mutex_exit(&fil_system->mutex);
if (mode == OS_AIO_NORMAL) {
ut_a(space->purpose == FIL_TABLESPACE);
buf_page_io_complete(message, trx);
}
if (type == OS_FILE_READ) {
return(DB_TABLESPACE_DELETED);
} else {
return(DB_SUCCESS);
}
} else {
ut_a(!space->is_corrupt);
#ifdef UNIV_HOTBACKUP
/* In ibbackup do normal i/o, not aio */
if (type == OS_FILE_READ) {
......@@ -4725,6 +4760,8 @@ _fil_io(
ret = os_aio(type, mode | wake_later, node->name, node->handle, buf,
offset_low, offset_high, len, node, message, trx);
#endif
} /**/
ut_a(ret);
if (mode == OS_AIO_SYNC) {
......@@ -4871,7 +4908,7 @@ fil_aio_wait(
if (fil_node->space->purpose == FIL_TABLESPACE) {
srv_set_io_thread_op_info(segment, "complete io for buf page");
buf_page_io_complete(message);
buf_page_io_complete(message, NULL);
} else {
srv_set_io_thread_op_info(segment, "complete io for log");
log_io_complete(message);
......@@ -5223,3 +5260,46 @@ fil_system_hash_nodes(void)
return 0;
}
}
/*************************************************************************
functions to access is_corrupt flag of fil_space_t*/
ibool
fil_space_is_corrupt(
/*=================*/
ulint space_id)
{
fil_space_t* space;
ibool ret = FALSE;
mutex_enter(&fil_system->mutex);
space = fil_space_get_by_id(space_id);
if (space && space->is_corrupt) {
ret = TRUE;
}
mutex_exit(&fil_system->mutex);
return(ret);
}
void
fil_space_set_corrupt(
/*==================*/
ulint space_id)
{
fil_space_t* space;
mutex_enter(&fil_system->mutex);
space = fil_space_get_by_id(space_id);
if (space) {
space->is_corrupt = TRUE;
}
mutex_exit(&fil_system->mutex);
}
......@@ -370,6 +370,12 @@ fsp_get_space_header(
ut_ad(id || !zip_size);
block = buf_page_get(id, zip_size, 0, RW_X_LATCH, mtr);
if (srv_pass_corrupt_table && !block) {
return(0);
}
ut_a(block);
header = FSP_HEADER_OFFSET + buf_block_get_frame(block);
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
......@@ -652,15 +658,16 @@ xdes_calc_descriptor_page(
ulint offset) /*!< in: page offset */
{
#ifndef DOXYGEN /* Doxygen gets confused of these */
# if UNIV_PAGE_SIZE <= XDES_ARR_OFFSET \
+ (UNIV_PAGE_SIZE / FSP_EXTENT_SIZE) * XDES_SIZE
# error
# endif
//# if UNIV_PAGE_SIZE <= XDES_ARR_OFFSET \
// + (UNIV_PAGE_SIZE / FSP_EXTENT_SIZE) * XDES_SIZE
//# error
//# endif
# if PAGE_ZIP_MIN_SIZE <= XDES_ARR_OFFSET \
+ (PAGE_ZIP_MIN_SIZE / FSP_EXTENT_SIZE) * XDES_SIZE
# error
# endif
#endif /* !DOXYGEN */
ut_a(UNIV_PAGE_SIZE > XDES_ARR_OFFSET + (UNIV_PAGE_SIZE / FSP_EXTENT_SIZE) * XDES_SIZE);
ut_ad(ut_is_2pow(zip_size));
if (!zip_size) {
......@@ -788,6 +795,12 @@ xdes_get_descriptor(
fsp_header_t* sp_header;
block = buf_page_get(space, zip_size, 0, RW_X_LATCH, mtr);
if (srv_pass_corrupt_table && !block) {
return(0);
}
ut_a(block);
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
sp_header = FSP_HEADER_OFFSET + buf_block_get_frame(block);
......@@ -1457,12 +1470,12 @@ fsp_fill_free_list(
mtr);
xdes_init(descr, mtr);
#if UNIV_PAGE_SIZE % FSP_EXTENT_SIZE
# error "UNIV_PAGE_SIZE % FSP_EXTENT_SIZE != 0"
#endif
#if PAGE_ZIP_MIN_SIZE % FSP_EXTENT_SIZE
# error "PAGE_ZIP_MIN_SIZE % FSP_EXTENT_SIZE != 0"
#endif
//#if UNIV_PAGE_SIZE % FSP_EXTENT_SIZE
//# error "UNIV_PAGE_SIZE % FSP_EXTENT_SIZE != 0"
//#endif
//#if PAGE_ZIP_MIN_SIZE % FSP_EXTENT_SIZE
//# error "PAGE_ZIP_MIN_SIZE % FSP_EXTENT_SIZE != 0"
//#endif
if (UNIV_UNLIKELY(init_xdes)) {
......@@ -1871,6 +1884,11 @@ fsp_seg_inode_page_find_free(
{
fseg_inode_t* inode;
if (srv_pass_corrupt_table && !page) {
return(ULINT_UNDEFINED);
}
ut_a(page);
for (; i < FSP_SEG_INODES_PER_PAGE(zip_size); i++) {
inode = fsp_seg_inode_page_get_nth_inode(
......@@ -1984,6 +2002,11 @@ fsp_alloc_seg_inode(
page = buf_block_get_frame(block);
if (srv_pass_corrupt_table && !page) {
return(0);
}
ut_a(page);
n = fsp_seg_inode_page_find_free(page, 0, zip_size, mtr);
ut_a(n != ULINT_UNDEFINED);
......@@ -2077,6 +2100,11 @@ fseg_inode_try_get(
inode = fut_get_ptr(space, zip_size, inode_addr, RW_X_LATCH, mtr);
if (srv_pass_corrupt_table && !inode) {
return(0);
}
ut_a(inode);
if (UNIV_UNLIKELY
(ut_dulint_is_zero(mach_read_from_8(inode + FSEG_ID)))) {
......@@ -2104,7 +2132,7 @@ fseg_inode_get(
{
fseg_inode_t* inode
= fseg_inode_try_get(header, space, zip_size, mtr);
ut_a(inode);
ut_a(srv_pass_corrupt_table || inode);
return(inode);
}
......@@ -3263,6 +3291,11 @@ fseg_free_page_low(
descr = xdes_get_descriptor(space, zip_size, page, mtr);
if (srv_pass_corrupt_table && !descr) {
/* The page may be corrupt. pass it. */
return;
}
ut_a(descr);
if (xdes_get_bit(descr, XDES_FREE_BIT, page % FSP_EXTENT_SIZE, mtr)) {
fputs("InnoDB: Dump of the tablespace extent descriptor: ",
......@@ -3515,6 +3548,11 @@ fseg_free_step(
descr = xdes_get_descriptor(space, zip_size, header_page, mtr);
if (srv_pass_corrupt_table && !descr) {
/* The page may be corrupt. pass it. */
return(TRUE);
}
/* Check that the header resides on a page which has not been
freed yet */
......@@ -3599,6 +3637,12 @@ fseg_free_step_not_header(
inode = fseg_inode_get(header, space, zip_size, mtr);
if (srv_pass_corrupt_table && !inode) {
/* ignore the corruption */
return(TRUE);
}
ut_a(inode);
descr = fseg_get_first_extent(inode, space, zip_size, mtr);
if (descr != NULL) {
......
This diff is collapsed.
This diff is collapsed.
......@@ -36,6 +36,7 @@ typedef struct st_innobase_share {
incremented in get_share()
and decremented in free_share() */
void* table_name_hash;/*!< hash table chain node */
dict_table_t* ib_table;
} INNOBASE_SHARE;
......@@ -119,6 +120,7 @@ class ha_innobase: public handler
int close(void);
double scan_time();
double read_time(uint index, uint ranges, ha_rows rows);
bool is_corrupt() const;
int write_row(uchar * buf);
int update_row(const uchar * old_data, uchar * new_data);
......
This diff is collapsed.
......@@ -41,5 +41,7 @@ extern struct st_mysql_plugin i_s_innodb_rseg;
extern struct st_mysql_plugin i_s_innodb_table_stats;
extern struct st_mysql_plugin i_s_innodb_index_stats;
extern struct st_mysql_plugin i_s_innodb_admin_command;
extern struct st_mysql_plugin i_s_innodb_sys_tables;
extern struct st_mysql_plugin i_s_innodb_sys_indexes;
#endif /* i_s_h */
......@@ -43,5 +43,9 @@ struct innodb_enhancement {
{"innodb_extend_slow","Extended statistics in slow.log","It is InnoDB-part only. It needs to patch also to mysqld.","http://www.percona.com/docs/wiki/percona-xtradb"},
{"innodb_relax_table_creation","Relax limitation of column size at table creation as builtin InnoDB.","","http://www.percona.com/docs/wiki/percona-xtradb"},
{"innodb_lru_dump_restore","Dump and restore command for content of buffer pool","","http://www.percona.com/docs/wiki/percona-xtradb"},
{"innodb_pass_corrupt_table","Treat tables as corrupt instead of crash, when meet corrupt blocks","","http://www.percona.com/docs/wiki/percona-xtradb"},
{"innodb_fast_checksum","Using the checksum on 32bit-unit calculation","incompatible for unpatched ver.","http://www.percona.com/docs/wiki/percona-xtradb"},
{"innodb_files_extend","allow >4GB transaction log files, and can vary universal page size of datafiles","incompatible for unpatched ver.","http://www.percona.com/docs/wiki/percona-xtradb"},
{"innodb_sys_tables_sys_indexes","Expose InnoDB SYS_TABLES and SYS_INDEXES schema tables","","http://www.percona.com/docs/wiki/percona-xtradb"},
{NULL, NULL, NULL, NULL}
};
......@@ -28,7 +28,7 @@ Created 6/2/1994 Heikki Tuuri
#include "mtr0mtr.h"
#include "mtr0log.h"
#include "page0zip.h"
#include "srv0srv.h"
#define BTR_MAX_NODE_LEVEL 50 /*!< Maximum B-tree page level
(not really a hard limit).
Used in debug assertions
......@@ -52,7 +52,9 @@ btr_block_get(
block = buf_page_get(space, zip_size, page_no, mode, mtr);
if (mode != RW_NO_LATCH) {
ut_a(srv_pass_corrupt_table || block);
if (block && mode != RW_NO_LATCH) {
buf_block_dbg_add_level(block, SYNC_TREE_NODE);
}
......
......@@ -83,7 +83,7 @@ typedef struct buf_buddy_stat_struct buf_buddy_stat_t;
/** Statistics of the buddy system, indexed by block size.
Protected by buf_pool_mutex. */
extern buf_buddy_stat_t buf_buddy_stat[BUF_BUDDY_SIZES + 1];
extern buf_buddy_stat_t buf_buddy_stat[BUF_BUDDY_SIZES_MAX + 1];
#ifndef UNIV_NONINL
# include "buf0buddy.ic"
......
......@@ -482,6 +482,11 @@ ulint
buf_calc_page_new_checksum(
/*=======================*/
const byte* page); /*!< in: buffer page */
UNIV_INTERN
ulint
buf_calc_page_new_checksum_32(
/*==========================*/
const byte* page); /*!< in: buffer page */
/********************************************************************//**
In versions < 4.0.14 and < 4.1.1 there was a bug that the checksum only
looked at the first few bytes of the page. This calculates that old
......@@ -855,7 +860,7 @@ buf_block_get_frame(
const buf_block_t* block) /*!< in: pointer to the control block */
__attribute__((pure));
#else /* UNIV_DEBUG */
# define buf_block_get_frame(block) (block)->frame
# define buf_block_get_frame(block) (block ? (block)->frame : 0)
#endif /* UNIV_DEBUG */
/*********************************************************************//**
Gets the space id of a block.
......@@ -987,7 +992,8 @@ UNIV_INTERN
void
buf_page_io_complete(
/*=================*/
buf_page_t* bpage); /*!< in: pointer to the block in question */
buf_page_t* bpage, /*!< in: pointer to the block in question */
trx_t* trx);
/********************************************************************//**
Calculates a folded value of a file page address to use in the page hash
table.
......@@ -1155,6 +1161,7 @@ struct buf_page_struct{
0 if the block was never accessed
in the buffer pool */
/* @} */
ibool is_corrupt;
# ifdef UNIV_DEBUG_FILE_ACCESSES
ibool file_page_was_freed;
/*!< this is set to TRUE when fsp
......@@ -1422,11 +1429,11 @@ struct buf_pool_struct{
/* @{ */
UT_LIST_BASE_NODE_T(buf_page_t) zip_clean;
/*!< unmodified compressed pages */
UT_LIST_BASE_NODE_T(buf_page_t) zip_free[BUF_BUDDY_SIZES];
UT_LIST_BASE_NODE_T(buf_page_t) zip_free[BUF_BUDDY_SIZES_MAX];
/*!< buddy free lists */
#if BUF_BUDDY_HIGH != UNIV_PAGE_SIZE
# error "BUF_BUDDY_HIGH != UNIV_PAGE_SIZE"
#endif
//#if BUF_BUDDY_HIGH != UNIV_PAGE_SIZE
//# error "BUF_BUDDY_HIGH != UNIV_PAGE_SIZE"
//#endif
#if BUF_BUDDY_LOW > PAGE_ZIP_MIN_SIZE
# error "BUF_BUDDY_LOW > PAGE_ZIP_MIN_SIZE"
#endif
......
......@@ -35,7 +35,7 @@ Created 11/5/1995 Heikki Tuuri
#include "buf0flu.h"
#include "buf0lru.h"
#include "buf0rea.h"
#include "srv0srv.h"
/********************************************************************//**
Reads the freed_page_clock of a buffer block.
@return freed_page_clock */
......@@ -581,6 +581,12 @@ buf_block_get_frame(
/*================*/
const buf_block_t* block) /*!< in: pointer to the control block */
{
ut_a(srv_pass_corrupt_table || block);
if (srv_pass_corrupt_table && !block) {
return(0);
}
ut_ad(block);
switch (buf_block_get_state(block)) {
......
......@@ -70,6 +70,7 @@ enum buf_io_fix {
buddy system; must be at least
sizeof(buf_page_t) */
#define BUF_BUDDY_SIZES (UNIV_PAGE_SIZE_SHIFT - BUF_BUDDY_LOW_SHIFT)
#define BUF_BUDDY_SIZES_MAX (UNIV_PAGE_SIZE_SHIFT_MAX - BUF_BUDDY_LOW_SHIFT)
/*!< number of buddy sizes */
/** twice the maximum block size of the buddy system;
......
......@@ -1164,6 +1164,15 @@ void
dict_close(void);
/*============*/
/*************************************************************************
set is_corrupt flag by space_id*/
void
dict_table_set_corrupt_by_space(
/*============================*/
ulint space_id,
ibool need_mutex);
#ifndef UNIV_NONINL
#include "dict0dict.ic"
#endif
......
......@@ -521,6 +521,7 @@ struct dict_table_struct{
the AUTOINC lock on this table. */
/* @} */
/*----------------------*/
ibool is_corrupt;
#endif /* !UNIV_HOTBACKUP */
#ifdef UNIV_DEBUG
......
......@@ -116,6 +116,7 @@ extern fil_addr_t fil_addr_null;
#define FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID 34 /*!< starting from 4.1.x this
contains the space id of the page */
#define FIL_PAGE_DATA 38 /*!< start of the data on the page */
#define FIL_PAGE_DATA_ALIGN_32 40
/* @} */
/** File page trailer @{ */
#define FIL_PAGE_END_LSN_OLD_CHKSUM 8 /*!< the low 4 bytes of this are used
......@@ -748,6 +749,19 @@ ulint
fil_system_hash_nodes(void);
/*========================*/
/*************************************************************************
functions to access is_corrupt flag of fil_space_t*/
ibool
fil_space_is_corrupt(
/*=================*/
ulint space_id);
void
fil_space_set_corrupt(
/*==================*/
ulint space_id);
typedef struct fil_space_struct fil_space_t;
#endif
......@@ -23,6 +23,7 @@ File-based utilities
Created 12/13/1995 Heikki Tuuri
***********************************************************************/
#include "srv0srv.h"
#include "sync0rw.h"
#include "buf0buf.h"
......@@ -48,6 +49,12 @@ fut_get_ptr(
ut_ad((rw_latch == RW_S_LATCH) || (rw_latch == RW_X_LATCH));
block = buf_page_get(space, zip_size, addr.page, rw_latch, mtr);
if (srv_pass_corrupt_table && !block) {
return(0);
}
ut_a(block);
ptr = buf_block_get_frame(block) + addr.boffset;
buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
......
......@@ -293,6 +293,22 @@ page_cur_open_on_rnd_user_rec(
/*==========================*/
buf_block_t* block, /*!< in: page */
page_cur_t* cursor);/*!< out: page cursor */
UNIV_INTERN
void
page_cur_open_on_nth_user_rec(
/*==========================*/
buf_block_t* block, /*!< in: page */
page_cur_t* cursor, /*!< out: page cursor */
ulint nth);
UNIV_INTERN
ibool
page_cur_open_on_rnd_user_rec_after_nth(
/*==========================*/
buf_block_t* block, /*!< in: page */
page_cur_t* cursor, /*!< out: page cursor */
ulint nth);
#endif /* !UNIV_HOTBACKUP */
/***********************************************************//**
Parses a log record of a record insert on a page.
......
......@@ -56,8 +56,9 @@ page0*.h includes rem0rec.h and may include rem0rec.ic. */
/** Number of supported compressed page sizes */
#define PAGE_ZIP_NUM_SSIZE (UNIV_PAGE_SIZE_SHIFT - PAGE_ZIP_MIN_SIZE_SHIFT + 2)
#if PAGE_ZIP_NUM_SSIZE > (1 << PAGE_ZIP_SSIZE_BITS)
# error "PAGE_ZIP_NUM_SSIZE > (1 << PAGE_ZIP_SSIZE_BITS)"
#define PAGE_ZIP_NUM_SSIZE_MAX (UNIV_PAGE_SIZE_SHIFT_MAX - PAGE_ZIP_MIN_SIZE_SHIFT + 2)
#if PAGE_ZIP_NUM_SSIZE_MAX > (1 << PAGE_ZIP_SSIZE_BITS)
# error "PAGE_ZIP_NUM_SSIZE_MAX > (1 << PAGE_ZIP_SSIZE_BITS)"
#endif
/** Compressed page descriptor */
......@@ -98,7 +99,7 @@ struct page_zip_stat_struct {
typedef struct page_zip_stat_struct page_zip_stat_t;
/** Statistics on compression, indexed by page_zip_des_struct::ssize - 1 */
extern page_zip_stat_t page_zip_stat[PAGE_ZIP_NUM_SSIZE - 1];
extern page_zip_stat_t page_zip_stat[PAGE_ZIP_NUM_SSIZE_MAX - 1];
/**********************************************************************//**
Write the "deleted" flag of a record on a compressed page. The flag must
......
......@@ -227,6 +227,7 @@ extern ulint srv_stats_update_need_lock;
extern ibool srv_use_doublewrite_buf;
extern ibool srv_use_checksums;
extern ibool srv_fast_checksum;
extern ibool srv_set_thread_priorities;
extern int srv_query_thread_priority;
......@@ -247,6 +248,7 @@ extern ulint srv_adaptive_checkpoint;
extern ulint srv_expand_import;
extern ulint srv_relax_table_creation;
extern ulint srv_pass_corrupt_table;
extern ulint srv_extra_rsegments;
extern ulint srv_dict_size_limit;
......
......@@ -487,9 +487,9 @@ in size */
/** Contents of TRX_SYS_MYSQL_LOG_MAGIC_N_FLD */
#define TRX_SYS_MYSQL_LOG_MAGIC_N 873422344
#if UNIV_PAGE_SIZE < 4096
# error "UNIV_PAGE_SIZE < 4096"
#endif
//#if UNIV_PAGE_SIZE < 4096
//# error "UNIV_PAGE_SIZE < 4096"
//#endif
/** The offset of the MySQL replication info in the trx system header;
this contains the same fields as TRX_SYS_MYSQL_LOG_INFO below */
#define TRX_SYS_MYSQL_MASTER_LOG_INFO (UNIV_PAGE_SIZE - 2000)
......
......@@ -292,9 +292,13 @@ management to ensure correct alignment for doubles etc. */
*/
/* The 2-logarithm of UNIV_PAGE_SIZE: */
#define UNIV_PAGE_SIZE_SHIFT 14
/* #define UNIV_PAGE_SIZE_SHIFT 14 */
#define UNIV_PAGE_SIZE_SHIFT_MAX 14
#define UNIV_PAGE_SIZE_SHIFT srv_page_size_shift
/* The universal page size of the database */
#define UNIV_PAGE_SIZE (1 << UNIV_PAGE_SIZE_SHIFT)
/* #define UNIV_PAGE_SIZE (1 << UNIV_PAGE_SIZE_SHIFT) */
#define UNIV_PAGE_SIZE srv_page_size
#define UNIV_PAGE_SIZE_MAX (1 << UNIV_PAGE_SIZE_SHIFT_MAX)
/* Maximum number of parallel threads in a parallelized operation */
#define UNIV_MAX_PARALLELISM 32
......@@ -387,7 +391,7 @@ number indicate that a field contains a reference to an externally
stored part of the field in the tablespace. The length field then
contains the sum of the following flag and the locally stored len. */
#define UNIV_EXTERN_STORAGE_FIELD (UNIV_SQL_NULL - UNIV_PAGE_SIZE)
#define UNIV_EXTERN_STORAGE_FIELD (UNIV_SQL_NULL - UNIV_PAGE_SIZE_MAX)
/* Some macros to improve branch prediction and reduce cache misses */
#if defined(__GNUC__) && (__GNUC__ > 2) && ! defined(__INTEL_COMPILER)
......@@ -490,4 +494,6 @@ typedef void* os_thread_ret_t;
UNIV_MEM_ALLOC(addr, size); \
} while (0)
extern ulint srv_page_size_shift;
extern ulint srv_page_size;
#endif
......@@ -124,6 +124,13 @@ ut_fold_binary(
const byte* str, /*!< in: string of bytes */
ulint len) /*!< in: length */
__attribute__((pure));
UNIV_INLINE
ulint
ut_fold_binary_32(
/*==============*/
const byte* str, /*!< in: string of bytes */
ulint len) /*!< in: length */
__attribute__((pure));
/***********************************************************//**
Looks for a prime number slightly greater than the given argument.
The prime is chosen so that it is not near any power of 2.
......
......@@ -228,3 +228,28 @@ ut_fold_binary(
return(fold);
}
UNIV_INLINE
ulint
ut_fold_binary_32(
/*==============*/
const byte* str, /*!< in: string of bytes */
ulint len) /*!< in: length */
{
const ib_uint32_t* str_end = (const ib_uint32_t*) (str + len);
const ib_uint32_t* str_32 = (const ib_uint32_t*) str;
ulint fold = 0;
ut_ad(str);
/* This function is only for word-aligned data */
ut_ad(len % 4 == 0);
ut_ad((ulint)str % 4 == 0);
while (str_32 < str_end) {
fold = ut_fold_ulint_pair(fold, (ulint)(*str_32));
str_32++;
}
return(fold);
}
......@@ -3364,26 +3364,23 @@ lock_deadlock_recursive(
bit_no = lock_rec_find_set_bit(wait_lock);
ut_a(bit_no != ULINT_UNDEFINED);
/* get the starting point for the search for row level locks
since we are scanning from the front of the list */
lock = lock_rec_get_first_on_page_addr(wait_lock->un_member.rec_lock.space,
wait_lock->un_member.rec_lock.page_no);
}
else {
/* table level locks use a two-way linked list so scanning backwards is OK */
lock = UT_LIST_GET_PREV(un_member.tab_lock.locks,
lock);
}
}
/* Look at the locks ahead of wait_lock in the lock queue */
for (;;) {
if (lock_get_type_low(lock) & LOCK_TABLE) {
lock = UT_LIST_GET_PREV(un_member.tab_lock.locks,
lock);
} else {
ut_ad(lock_get_type_low(lock) == LOCK_REC);
ut_a(bit_no != ULINT_UNDEFINED);
lock = (lock_t*) lock_rec_get_prev(lock, bit_no);
}
/* reached the original lock in the queue for row level locks
or past beginning of the list for table level locks */
if (lock == NULL || lock == wait_lock) {
if (lock == NULL) {
/* We can mark this subtree as searched */
trx->deadlock_mark = 1;
......@@ -3508,17 +3505,6 @@ lock_deadlock_recursive(
}
}
}
/* next lock to check */
if (lock_get_type_low(lock) & LOCK_TABLE) {
lock = UT_LIST_GET_PREV(un_member.tab_lock.locks,
lock);
} else {
ut_ad(lock_get_type_low(lock) == LOCK_REC);
ut_a(bit_no != ULINT_UNDEFINED);
lock = (lock_t*) lock_rec_get_next(bit_no, lock);
}
}/* end of the 'for (;;)'-loop */
}
......
......@@ -608,7 +608,9 @@ log_group_calc_lsn_offset(
offset = (gr_lsn_size_offset + difference) % group_size;
if (sizeof(ulint) == 4) {
ut_a(offset < (((ib_int64_t) 1) << 32)); /* offset must be < 4 GB */
}
/* fprintf(stderr,
"Offset is %lu gr_lsn_offset is %lu difference is %lu\n",
......@@ -1805,6 +1807,7 @@ log_group_checkpoint(
mach_write_to_4(buf + LOG_CHECKPOINT_LOG_BUF_SIZE, log_sys->buf_size);
#ifdef UNIV_LOG_ARCHIVE
#error "UNIV_LOG_ARCHIVE could not be enabled"
if (log_sys->archiving_state == LOG_ARCH_OFF) {
archived_lsn = IB_ULONGLONG_MAX;
} else {
......@@ -1818,7 +1821,9 @@ log_group_checkpoint(
mach_write_ull(buf + LOG_CHECKPOINT_ARCHIVED_LSN, archived_lsn);
#else /* UNIV_LOG_ARCHIVE */
mach_write_ull(buf + LOG_CHECKPOINT_ARCHIVED_LSN, IB_ULONGLONG_MAX);
mach_write_ull(buf + LOG_CHECKPOINT_ARCHIVED_LSN,
(ib_uint64_t)log_group_calc_lsn_offset(
log_sys->next_checkpoint_lsn, group));
#endif /* UNIV_LOG_ARCHIVE */
for (i = 0; i < LOG_MAX_N_GROUPS; i++) {
......
......@@ -680,8 +680,22 @@ recv_find_max_checkpoint(
group->lsn = mach_read_ull(
buf + LOG_CHECKPOINT_LSN);
#ifdef UNIV_LOG_ARCHIVE
#error "UNIV_LOG_ARCHIVE could not be enabled"
#endif
{
ib_uint64_t tmp_lsn_offset = mach_read_ull(
buf + LOG_CHECKPOINT_ARCHIVED_LSN);
if (sizeof(ulint) != 4
&& tmp_lsn_offset != IB_ULONGLONG_MAX) {
group->lsn_offset = (ulint) tmp_lsn_offset;
} else {
group->lsn_offset = mach_read_from_4(
buf + LOG_CHECKPOINT_OFFSET);
}
}
checkpoint_no = mach_read_ull(
buf + LOG_CHECKPOINT_NO);
......
--- mysql-test/r/mysql.result.orig 2010-02-11 04:11:48.000000000 -0500
+++ mysql-test/r/mysql.result 2010-02-11 04:18:24.000000000 -0500
@@ -162,8 +162,8 @@
ERROR 1049 (42000) at line 1: Unknown database 'invalid'
Test connect with dbname + hostname
Test connect with dbname + _invalid_ hostname
-ERROR 2005 (HY000) at line 1: Unknown MySQL server host 'invalid_hostname' (errno)
-ERROR 2005 (HY000) at line 1: Unknown MySQL server host 'invalid_hostname' (errno)
+ERROR 2003 (HY000) at line 1: Can't connect to MySQL server on 'invalid_hostname' (errno)
+ERROR 2003 (HY000) at line 1: Can't connect to MySQL server on 'invalid_hostname' (errno)
The commands reported in the bug report
ERROR 2005 (HY000) at line 1: Unknown MySQL server host 'cyril has found a bug :)XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' (errno)
Too long dbname
@@ -198,7 +198,7 @@
1
COUNT (*)
1
-ERROR 2005 (HY000) at line 1: Unknown MySQL server host 'invalid_hostname' (errno)
+ERROR 2003 (HY000) at line 1: Can't connect to MySQL server on 'invalid_hostname' (errno)
End of 5.0 tests
WARNING: --server-arg option not supported in this configuration.
Warning (Code 1286): Unknown table engine 'nonexistent'
--- mysql-test/r/mysql_upgrade.result.orig 2010-02-13 16:51:51.000000000 -0500
+++ mysql-test/r/mysql_upgrade.result 2010-02-13 16:52:07.000000000 -0500
@@ -94,7 +94,7 @@
mysql.user OK
DROP USER mysqltest1@'%';
Run mysql_upgrade with a non existing server socket
-mysqlcheck: Got error: 2005: Unknown MySQL server host 'not_existing_host' (errno) when trying to connect
+mysqlcheck: Got error: 2003: Can't connect to MySQL server on 'not_existing_host' (errno) when trying to connect
FATAL ERROR: Upgrade failed
set GLOBAL sql_mode='STRICT_ALL_TABLES,ANSI_QUOTES,NO_ZERO_DATE';
mtr.global_suppressions OK
This diff is collapsed.
......@@ -564,6 +564,74 @@ page_cur_open_on_rnd_user_rec(
} while (rnd--);
}
UNIV_INTERN
void
page_cur_open_on_nth_user_rec(
/*==========================*/
buf_block_t* block, /*!< in: page */
page_cur_t* cursor, /*!< out: page cursor */
ulint nth)
{
ulint n_recs = page_get_n_recs(buf_block_get_frame(block));
page_cur_set_before_first(block, cursor);
if (UNIV_UNLIKELY(n_recs == 0)) {
return;
}
nth--;
if (nth >= n_recs) {
nth = n_recs - 1;
}
do {
page_cur_move_to_next(cursor);
} while (nth--);
}
UNIV_INTERN
ibool
page_cur_open_on_rnd_user_rec_after_nth(
/*==========================*/
buf_block_t* block, /*!< in: page */
page_cur_t* cursor, /*!< out: page cursor */
ulint nth)
{
ulint rnd;
ulint n_recs = page_get_n_recs(buf_block_get_frame(block));
ibool ret;
page_cur_set_before_first(block, cursor);
if (UNIV_UNLIKELY(n_recs == 0)) {
return (FALSE);
}
nth--;
if (nth >= n_recs) {
nth = n_recs - 1;
}
rnd = (ulint) (nth + page_cur_lcg_prng() % (n_recs - nth));
if (rnd == nth) {
ret = TRUE;
} else {
ret = FALSE;
}
do {
page_cur_move_to_next(cursor);
} while (rnd--);
return (ret);
}
/***********************************************************//**
Writes the log record of a record insert on a page. */
static
......
......@@ -49,7 +49,7 @@ Created June 2005 by Marko Makela
#ifndef UNIV_HOTBACKUP
/** Statistics on compression, indexed by page_zip_des_t::ssize - 1 */
UNIV_INTERN page_zip_stat_t page_zip_stat[PAGE_ZIP_NUM_SSIZE - 1];
UNIV_INTERN page_zip_stat_t page_zip_stat[PAGE_ZIP_NUM_SSIZE_MAX - 1];
#endif /* !UNIV_HOTBACKUP */
/* Please refer to ../include/page0zip.ic for a description of the
......
......@@ -1340,6 +1340,12 @@ run_again:
const rec_t* rec = btr_pcur_get_rec(&pcur);
const buf_block_t* block = btr_pcur_get_block(&pcur);
if (srv_pass_corrupt_table && !block) {
err = DB_CORRUPTION;
break;
}
ut_a(block);
if (page_rec_is_infimum(rec)) {
goto next_rec;
......
......@@ -92,7 +92,7 @@ This buffer is used for writing or reading a record that spans two
row_merge_block_t. Thus, it must be able to hold one merge record,
whose maximum size is the same as the minimum size of
row_merge_block_t. */
typedef byte mrec_buf_t[UNIV_PAGE_SIZE];
typedef byte mrec_buf_t[UNIV_PAGE_SIZE_MAX];
/** @brief Merge record in row_merge_block_t.
......@@ -1216,6 +1216,13 @@ row_merge_read_clustered_index(
if (UNIV_LIKELY(has_next)) {
rec = btr_pcur_get_rec(&pcur);
if (srv_pass_corrupt_table && !rec) {
err = DB_CORRUPTION;
goto err_exit;
}
ut_a(rec);
offsets = rec_get_offsets(rec, clust_index, NULL,
ULINT_UNDEFINED, &row_heap);
......
......@@ -3766,6 +3766,13 @@ rec_loop:
/* PHASE 4: Look for matching records in a loop */
rec = btr_pcur_get_rec(pcur);
if (srv_pass_corrupt_table && !rec) {
err = DB_CORRUPTION;
goto lock_wait_or_error;
}
ut_a(rec);
ut_ad(!!page_rec_is_comp(rec) == comp);
#ifdef UNIV_SEARCH_DEBUG
/*
......
......@@ -224,6 +224,10 @@ UNIV_INTERN ulint srv_n_file_io_threads = ULINT_MAX;
UNIV_INTERN ulint srv_n_read_io_threads = ULINT_MAX;
UNIV_INTERN ulint srv_n_write_io_threads = ULINT_MAX;
/* The universal page size of the database */
UNIV_INTERN ulint srv_page_size_shift = 0;
UNIV_INTERN ulint srv_page_size = 0;
/* User settable value of the number of pages that must be present
in the buffer cache and accessed sequentially for InnoDB to trigger a
readahead request. */
......@@ -386,6 +390,7 @@ UNIV_INTERN ulint srv_stats_update_need_lock = 1;
UNIV_INTERN ibool srv_use_doublewrite_buf = TRUE;
UNIV_INTERN ibool srv_use_checksums = TRUE;
UNIV_INTERN ibool srv_fast_checksum = FALSE;
UNIV_INTERN ibool srv_set_thread_priorities = TRUE;
UNIV_INTERN int srv_query_thread_priority = 0;
......@@ -406,6 +411,7 @@ UNIV_INTERN ulint srv_adaptive_checkpoint = 0; /* 0: none 1: reflex 2: estimat
UNIV_INTERN ulint srv_expand_import = 0; /* 0:disable 1:enable */
UNIV_INTERN ulint srv_relax_table_creation = 0; /* 0:disable 1:enable */
UNIV_INTERN ulint srv_pass_corrupt_table = 0; /* 0:disable 1:enable */
UNIV_INTERN ulint srv_extra_rsegments = 0; /* extra rseg for users */
UNIV_INTERN ulint srv_dict_size_limit = 0;
......@@ -2560,10 +2566,10 @@ srv_master_thread(
srv_main_thread_process_no = os_proc_get_number();
srv_main_thread_id = os_thread_pf(os_thread_get_curr_id());
srv_table_reserve_slot(SRV_MASTER);
mutex_enter(&kernel_mutex);
srv_table_reserve_slot(SRV_MASTER);
srv_n_threads_active[SRV_MASTER]++;
mutex_exit(&kernel_mutex);
......@@ -3168,8 +3174,8 @@ srv_purge_thread(
os_thread_pf(os_thread_get_curr_id()));
#endif
srv_table_reserve_slot(SRV_PURGE);
mutex_enter(&kernel_mutex);
srv_table_reserve_slot(SRV_PURGE);
srv_n_threads_active[SRV_PURGE]++;
mutex_exit(&kernel_mutex);
......@@ -3256,8 +3262,8 @@ srv_purge_worker_thread(
fprintf(stderr, "Purge worker thread starts, id %lu\n",
os_thread_pf(os_thread_get_curr_id()));
#endif
srv_table_reserve_slot(SRV_PURGE_WORKER);
mutex_enter(&kernel_mutex);
srv_table_reserve_slot(SRV_PURGE_WORKER);
srv_n_threads_active[SRV_PURGE_WORKER]++;
mutex_exit(&kernel_mutex);
......
......@@ -1352,10 +1352,12 @@ innobase_start_or_create_for_mysql(void)
}
#endif /* UNIV_LOG_ARCHIVE */
if (srv_n_log_files * srv_log_file_size >= 262144) {
if (sizeof(ulint) == 4
&& srv_n_log_files * srv_log_file_size
>= ((ulint)1 << (32 - UNIV_PAGE_SIZE_SHIFT))) {
fprintf(stderr,
"InnoDB: Error: combined size of log files"
" must be < 4 GB\n");
" must be < 4 GB on 32-bit systems\n");
return(DB_ERROR);
}
......@@ -1364,7 +1366,7 @@ innobase_start_or_create_for_mysql(void)
for (i = 0; i < srv_n_data_files; i++) {
#ifndef __WIN__
if (sizeof(off_t) < 5 && srv_data_file_sizes[i] >= 262144) {
if (sizeof(off_t) < 5 && srv_data_file_sizes[i] >= ((ulint)1 << (32 - UNIV_PAGE_SIZE_SHIFT))) {
fprintf(stderr,
"InnoDB: Error: file size must be < 4 GB"
" with this MySQL binary\n"
......@@ -1809,6 +1811,13 @@ innobase_start_or_create_for_mysql(void)
os_fast_mutex_free(&srv_os_test_mutex);
if (!srv_file_per_table_original_value
&& srv_pass_corrupt_table) {
fprintf(stderr, "InnoDB: Warning:"
" innodb_file_per_table is diabled."
" So innodb_pass_corrupt_table doesn't make sence\n");
}
if (srv_print_verbose_log) {
ut_print_timestamp(stderr);
fprintf(stderr,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment