Commit a1bb24eb authored by Satya B's avatar Satya B

Applying InnoDB Plugin 1.0.5 snapshot, part 11

From revision r5945 to r5994
r5950 - already applied and so skipped

Detailed revision comments:

r5945 | calvin | 2009-09-21 09:53:22 -0500 (Mon, 21 Sep 2009) | 4 lines
branches/zip: fix a type in r5935

Should be innodb_open_files, spotted by Michael.

r5951 | calvin | 2009-09-22 10:17:01 -0500 (Tue, 22 Sep 2009) | 4 lines
branches/zip: adjust CMake file to work with old versions of MySQL

Tested with MySQL 5.1.38 and 5.1.30.

r5956 | calvin | 2009-09-22 18:30:10 -0500 (Tue, 22 Sep 2009) | 4 lines
branches/zip: remove handler0vars.h from Makefile.am

Left over from r5950.

r5971 | marko | 2009-09-23 08:03:51 -0500 (Wed, 23 Sep 2009) | 2 lines
branches/zip: os_file_pwrite(): Make the code compile in InnoDB Hot Backup
when the pwrite system call is not available.
r5972 | marko | 2009-09-23 14:44:52 -0500 (Wed, 23 Sep 2009) | 5 lines
branches/zip: fil_node_open_file(): In InnoDB Hot Backup,
determine the page size of single-file tablespaces before computing
the file node size.  Otherwise, the space->size of compressed tablespaces
would be computed with UNIV_PAGE_SIZE instead of key_block_size.
This should fix Issue #313.
r5973 | marko | 2009-09-23 14:53:21 -0500 (Wed, 23 Sep 2009) | 2 lines
branches/zip: recv_add_to_hash_table():
Simplify obfuscated pointer arithmetics.
r5978 | marko | 2009-09-24 02:47:56 -0500 (Thu, 24 Sep 2009) | 1 line
branches/zip: Fix warnings and errors when UNIV_HOTBACKUP is defined.
r5979 | marko | 2009-09-24 05:16:10 -0500 (Thu, 24 Sep 2009) | 4 lines
branches/zip: ha_innodb.cc: Define MYSQL_PLUGIN_IMPORT when necessary.
This preprocessor symbol has been recently introduced in MySQL 5.1.
The InnoDB Plugin should remain source compatible with MySQL 5.1.24
and later.
r5988 | calvin | 2009-09-25 14:14:43 -0500 (Fri, 25 Sep 2009) | 8 lines
branches/zip: fix bug#47055 unconditional exit(1) on ERROR_WORKING_SET_QUOTA
1453 (0x5AD) for InnoDB backend

When error ERROR_WORKING_SET_QUOTA or ERROR_NO_SYSTEM_RESOURCES
occurs, yields for 100ms and retries the operation.

Approved by: Heikki (on IM)

r5992 | vasil | 2009-09-28 02:10:29 -0500 (Mon, 28 Sep 2009) | 4 lines
branches/zip:

Add ChangeLog entry for c5988.

r5994 | marko | 2009-09-28 03:33:59 -0500 (Mon, 28 Sep 2009) | 17 lines
branches/zip: Try to prevent the reuse of tablespace identifiers after
InnoDB has crashed during table creation.  Also, refuse to start if
files with duplicate tablespace identifiers are encountered.

fil_node_create(): Update fil_system->max_assigned_id.  This should
prevent the reuse of a space->id when InnoDB does a full crash
recovery and invokes fil_load_single_table_tablespaces().  Normally,
fil_system->max_assigned_id is initialized from
SELECT MAX(ID) FROM SYS_TABLES.

fil_open_single_table_tablespace(): Return FALSE when
fil_space_create() fails.

fil_load_single_table_tablespace(): Exit if fil_space_create() fails
and innodb_force_recovery=0.

rb://173 approved by Heikki Tuuri.  This addresses Issue #335.
parent 8fffb928
......@@ -18,7 +18,13 @@
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
INCLUDE("${PROJECT_SOURCE_DIR}/storage/mysql_storage_engine.cmake")
# Starting at 5.1.38, MySQL CMake files are simplified. But the plugin
# CMakeLists.txt still needs to work with previous versions of MySQL.
IF (MYSQL_VERSION_ID GREATER "50137")
INCLUDE("${PROJECT_SOURCE_DIR}/storage/mysql_storage_engine.cmake")
ENDIF (MYSQL_VERSION_ID GREATER "50137")
IF (CMAKE_SIZEOF_VOID_P MATCHES 8)
SET(WIN64 TRUE)
ENDIF (CMAKE_SIZEOF_VOID_P MATCHES 8)
......@@ -75,4 +81,18 @@ SET(INNODB_PLUGIN_SOURCES btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c btr/btr0sea
ut/ut0byte.c ut/ut0dbg.c ut/ut0mem.c ut/ut0rnd.c ut/ut0ut.c ut/ut0vec.c
ut/ut0list.c ut/ut0wqueue.c)
ADD_DEFINITIONS(-DHAVE_WINDOWS_ATOMICS -DINNODB_RW_LOCKS_USE_ATOMICS -DIB_HAVE_PAUSE_INSTRUCTION)
MYSQL_STORAGE_ENGINE(INNODB_PLUGIN)
\ No newline at end of file
MYSQL_STORAGE_ENGINE(INNODB_PLUGIN)
IF (MYSQL_VERSION_ID GREATER "50137")
IF (WITH_INNOBASE_STORAGE_ENGINE)
MYSQL_STORAGE_ENGINE(INNOBASE)
ELSE (WITH_INNOBASE_STORAGE_ENGINE)
SET (INNODB_SOURCES ${INNOBASE_SOURCES})
MYSQL_STORAGE_ENGINE(INNODB)
ENDIF (WITH_INNOBASE_STORAGE_ENGINE)
ELSE (MYSQL_VERSION_ID GREATER "50137")
IF (NOT SOURCE_SUBLIBS)
ADD_DEFINITIONS(-D_WIN32 -DMYSQL_SERVER)
ADD_LIBRARY(innobase STATIC ${INNOBASE_SOURCES})
# Require mysqld_error.h, which is built as part of the GenError
ADD_DEPENDENCIES(innobase GenError)
ENDIF (NOT SOURCE_SUBLIBS)
2009-09-28 The InnoDB Team
* fil/fil0fil.c:
Try to prevent the reuse of tablespace identifiers after InnoDB
has crashed during table creation. Also, refuse to start if files
with duplicate tablespace identifiers are encountered.
2009-09-25 The InnoDB Team
* include/os0file.h, os/os0file.c:
Fix Bug#47055 unconditional exit(1) on ERROR_WORKING_SET_QUOTA
1453 (0x5AD) for InnoDB backend
2009-09-19 The InnoDB Team
* handler/ha_innodb.cc, mysql-test/innodb-consistent-master.opt,
......
......@@ -31,7 +31,6 @@ DEFS= @DEFS@
noinst_HEADERS= \
handler/ha_innodb.h \
handler/handler0vars.h \
handler/i_s.h \
include/btr0btr.h \
include/btr0btr.ic \
......
......@@ -594,6 +594,11 @@ fil_node_create(
UT_LIST_ADD_LAST(chain, space->chain, node);
if (id < SRV_LOG_SPACE_FIRST_ID && fil_system->max_assigned_id < id) {
fil_system->max_assigned_id = id;
}
mutex_exit(&fil_system->mutex);
}
......@@ -613,12 +618,10 @@ fil_node_open_file(
ulint size_high;
ibool ret;
ibool success;
#ifndef UNIV_HOTBACKUP
byte* buf2;
byte* page;
ulint space_id;
ulint flags;
#endif /* !UNIV_HOTBACKUP */
ut_ad(mutex_own(&(system->mutex)));
ut_a(node->n_pending == 0);
......@@ -654,9 +657,11 @@ fil_node_open_file(
size_bytes = (((ib_int64_t)size_high) << 32)
+ (ib_int64_t)size_low;
#ifdef UNIV_HOTBACKUP
node->size = (ulint) (size_bytes / UNIV_PAGE_SIZE);
/* TODO: adjust to zip_size, like below? */
#else
if (space->id == 0) {
node->size = (ulint) (size_bytes / UNIV_PAGE_SIZE);
goto add_size;
}
#endif /* UNIV_HOTBACKUP */
ut_a(space->purpose != FIL_LOG);
ut_a(space->id != 0);
......@@ -735,7 +740,10 @@ fil_node_open_file(
(size_bytes
/ dict_table_flags_to_zip_size(flags));
}
#endif
#ifdef UNIV_HOTBACKUP
add_size:
#endif /* UNIV_HOTBACKUP */
space->size += node->size;
}
......@@ -955,7 +963,7 @@ close_more:
" while the maximum\n"
"InnoDB: allowed value would be %lu.\n"
"InnoDB: You may need to raise the value of"
" innobase_open_files in\n"
" innodb_open_files in\n"
"InnoDB: my.cnf.\n",
(ulong) fil_system->n_open,
(ulong) fil_system->max_n_open);
......@@ -1535,7 +1543,7 @@ fil_open_log_and_system_tablespace_files(void)
fprintf(stderr,
"InnoDB: Warning: you must"
" raise the value of"
" innobase_open_files in\n"
" innodb_open_files in\n"
"InnoDB: my.cnf! Remember that"
" InnoDB keeps all log files"
" and all system\n"
......@@ -2923,7 +2931,6 @@ fil_open_single_table_tablespace(
byte* page;
ulint space_id;
ulint space_flags;
ibool ret = TRUE;
filepath = fil_make_ibd_name(name, FALSE);
......@@ -3001,7 +3008,7 @@ fil_open_single_table_tablespace(
(ulong) space_id, (ulong) space_flags,
(ulong) id, (ulong) flags);
ret = FALSE;
success = FALSE;
goto func_exit;
}
......@@ -3021,7 +3028,7 @@ func_exit:
os_file_close(file);
mem_free(filepath);
return(ret);
return(success);
}
#endif /* !UNIV_HOTBACKUP */
......@@ -3299,7 +3306,17 @@ fil_load_single_table_tablespace(
if (!success) {
goto func_exit;
if (srv_force_recovery > 0) {
fprintf(stderr,
"InnoDB: innodb_force_recovery"
" was set to %lu. Continuing crash recovery\n"
"InnoDB: even though the tablespace creation"
" of this table failed.\n",
srv_force_recovery);
goto func_exit;
}
exit(1);
}
/* We do not use the size information we have about the file, because
......
......@@ -231,10 +231,10 @@ the extent are free and which contain old tuple version to clean. */
/* Offset of the descriptor array on a descriptor page */
#define XDES_ARR_OFFSET (FSP_HEADER_OFFSET + FSP_HEADER_SIZE)
#ifndef UNIV_HOTBACKUP
/* Flag to indicate if we have printed the tablespace full error. */
static ibool fsp_tbs_full_error_printed = FALSE;
#ifndef UNIV_HOTBACKUP
/**********************************************************************//**
Returns an extent to the free list of a space. */
static
......
......@@ -107,6 +107,9 @@ extern "C" {
#include "i_s.h"
#ifndef MYSQL_SERVER
# ifndef MYSQL_PLUGIN_IMPORT
# define MYSQL_PLUGIN_IMPORT /* nothing */
# endif /* MYSQL_PLUGIN_IMPORT */
/* This is needed because of Bug #3596. Let us hope that pthread_mutex_t
is defined the same in both builds: the MySQL server and the InnoDB plugin. */
extern MYSQL_PLUGIN_IMPORT pthread_mutex_t LOCK_thread_count;
......
......@@ -157,6 +157,7 @@ log. */
to become available again */
#define OS_FILE_SHARING_VIOLATION 76
#define OS_FILE_ERROR_NOT_SPECIFIED 77
#define OS_FILE_INSUFFICIENT_RESOURCE 78
/* @} */
/** Types for aio operations @{ */
......
......@@ -1274,7 +1274,7 @@ recv_add_to_hash_table(
sizeof(recv_data_t) + len);
*prev_field = recv_data;
ut_memcpy(((byte*)recv_data) + sizeof(recv_data_t), body, len);
memcpy(recv_data + 1, body, len);
prev_field = &(recv_data->next);
......
......@@ -317,6 +317,12 @@ os_file_get_last_error(
" software or another instance\n"
"InnoDB: of MySQL."
" Please close it to get rid of this error.\n");
} else if (err == ERROR_WORKING_SET_QUOTA
|| err == ERROR_NO_SYSTEM_RESOURCES) {
fprintf(stderr,
"InnoDB: The error means that there are no"
" sufficient system resources or quota to"
" complete the operation.\n");
} else {
fprintf(stderr,
"InnoDB: Some operating system error numbers"
......@@ -338,6 +344,9 @@ os_file_get_last_error(
} else if (err == ERROR_SHARING_VIOLATION
|| err == ERROR_LOCK_VIOLATION) {
return(OS_FILE_SHARING_VIOLATION);
} else if (err == ERROR_WORKING_SET_QUOTA
|| err == ERROR_NO_SYSTEM_RESOURCES) {
return(OS_FILE_INSUFFICIENT_RESOURCE);
} else {
return(100 + err);
}
......@@ -456,6 +465,10 @@ os_file_handle_error_cond_exit(
os_thread_sleep(10000000); /* 10 sec */
return(TRUE);
} else if (err == OS_FILE_INSUFFICIENT_RESOURCE) {
os_thread_sleep(100000); /* 100 ms */
return(TRUE);
} else {
if (name) {
fprintf(stderr, "InnoDB: File name %s\n", name);
......@@ -2032,7 +2045,9 @@ os_file_pread(
offset */
{
off_t offs;
#if defined(HAVE_PREAD) && !defined(HAVE_BROKEN_PREAD)
ssize_t n_bytes;
#endif /* HAVE_PREAD && !HAVE_BROKEN_PREAD */
ut_a((offset & 0xFFFFFFFFUL) == offset);
......@@ -2071,16 +2086,20 @@ os_file_pread(
{
off_t ret_offset;
ssize_t ret;
#ifndef UNIV_HOTBACKUP
ulint i;
#endif /* !UNIV_HOTBACKUP */
os_mutex_enter(os_file_count_mutex);
os_n_pending_reads++;
os_mutex_exit(os_file_count_mutex);
#ifndef UNIV_HOTBACKUP
/* Protect the seek / read operation with a mutex */
i = ((ulint) file) % OS_FILE_N_SEEK_MUTEXES;
os_mutex_enter(os_file_seek_mutexes[i]);
#endif /* !UNIV_HOTBACKUP */
ret_offset = lseek(file, offs, SEEK_SET);
......@@ -2090,7 +2109,9 @@ os_file_pread(
ret = read(file, buf, (ssize_t)n);
}
#ifndef UNIV_HOTBACKUP
os_mutex_exit(os_file_seek_mutexes[i]);
#endif /* !UNIV_HOTBACKUP */
os_mutex_enter(os_file_count_mutex);
os_n_pending_reads--;
......@@ -2168,16 +2189,20 @@ os_file_pwrite(
#else
{
off_t ret_offset;
# ifndef UNIV_HOTBACKUP
ulint i;
# endif /* !UNIV_HOTBACKUP */
os_mutex_enter(os_file_count_mutex);
os_n_pending_writes++;
os_mutex_exit(os_file_count_mutex);
# ifndef UNIV_HOTBACKUP
/* Protect the seek / write operation with a mutex */
i = ((ulint) file) % OS_FILE_N_SEEK_MUTEXES;
os_mutex_enter(os_file_seek_mutexes[i]);
# endif /* UNIV_HOTBACKUP */
ret_offset = lseek(file, offs, SEEK_SET);
......@@ -2203,7 +2228,9 @@ os_file_pwrite(
# endif /* UNIV_DO_FLUSH */
func_exit:
# ifndef UNIV_HOTBACKUP
os_mutex_exit(os_file_seek_mutexes[i]);
# endif /* !UNIV_HOTBACKUP */
os_mutex_enter(os_file_count_mutex);
os_n_pending_writes--;
......
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