mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 04:53:01 +01:00
Merge mysql-5.5-innodb -> mysql-5.5-bugteam
This commit is contained in:
commit
06a10d4bd3
16 changed files with 151 additions and 163 deletions
|
@ -13,7 +13,7 @@
|
|||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
# This is the CMakeLists for InnoDB Plugin
|
||||
# This is the CMakeLists for InnoDB
|
||||
|
||||
INCLUDE(CheckFunctionExists)
|
||||
INCLUDE(CheckCSourceCompiles)
|
||||
|
@ -254,29 +254,7 @@ IF(WITH_INNODB)
|
|||
SET(WITH_INNOBASE_STORAGE_ENGINE TRUE)
|
||||
ENDIF()
|
||||
|
||||
|
||||
#The plugin's CMakeLists.txt still needs to work with previous versions of MySQL.
|
||||
IF(EXISTS ${SOURCE_DIR}/storage/mysql_storage_engine.cmake)
|
||||
# Old plugin support on Windows only,
|
||||
# use tricks to force ha_innodb.dll name for DLL
|
||||
INCLUDE(${SOURCE_DIR}/storage/mysql_storage_engine.cmake)
|
||||
MYSQL_STORAGE_ENGINE(INNOBASE)
|
||||
GET_TARGET_PROPERTY(LIB_LOCATION ha_innobase LOCATION)
|
||||
IF(LIB_LOCATION)
|
||||
SET_TARGET_PROPERTIES(ha_innobase PROPERTIES OUTPUT_NAME ha_innodb)
|
||||
ENDIF()
|
||||
ELSEIF (MYSQL_VERSION_ID LESS "50137")
|
||||
# Windows only, no plugin support
|
||||
IF (NOT SOURCE_SUBLIBS)
|
||||
ADD_DEFINITIONS(-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()
|
||||
ELSE()
|
||||
# New plugin support, cross-platform , base name for shared module is "ha_innodb"
|
||||
MYSQL_ADD_PLUGIN(innobase ${INNOBASE_SOURCES} STORAGE_ENGINE
|
||||
DEFAULT
|
||||
MODULE_OUTPUT_NAME ha_innodb
|
||||
LINK_LIBRARIES ${ZLIB_LIBRARY})
|
||||
ENDIF()
|
||||
MYSQL_ADD_PLUGIN(innobase ${INNOBASE_SOURCES} STORAGE_ENGINE
|
||||
DEFAULT
|
||||
MODULE_OUTPUT_NAME ha_innodb
|
||||
LINK_LIBRARIES ${ZLIB_LIBRARY})
|
||||
|
|
|
@ -246,8 +246,8 @@ static const int WAIT_FOR_READ = 5000;
|
|||
/** Number of attemtps made to read in a page in the buffer pool */
|
||||
static const ulint BUF_PAGE_READ_MAX_RETRIES = 100;
|
||||
|
||||
/** The buffer buf_pool of the database */
|
||||
UNIV_INTERN buf_pool_t* buf_pool_ptr[MAX_BUFFER_POOLS];
|
||||
/** The buffer pools of the database */
|
||||
UNIV_INTERN buf_pool_t* buf_pool_ptr;
|
||||
|
||||
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
|
||||
static ulint buf_dbg_counter = 0; /*!< This is used to insert validation
|
||||
|
@ -858,7 +858,7 @@ buf_block_init(
|
|||
|
||||
block->frame = frame;
|
||||
|
||||
block->page.buf_pool = buf_pool;
|
||||
block->page.buf_pool_index = buf_pool_index(buf_pool);
|
||||
block->page.state = BUF_BLOCK_NOT_USED;
|
||||
block->page.buf_fix_count = 0;
|
||||
block->page.io_fix = BUF_IO_NONE;
|
||||
|
@ -1280,8 +1280,6 @@ buf_pool_free_instance(
|
|||
mem_free(buf_pool->chunks);
|
||||
hash_table_free(buf_pool->page_hash);
|
||||
hash_table_free(buf_pool->zip_hash);
|
||||
mem_free(buf_pool);
|
||||
buf_pool = NULL;
|
||||
}
|
||||
|
||||
/********************************************************************//**
|
||||
|
@ -1294,25 +1292,23 @@ buf_pool_init(
|
|||
ulint total_size, /*!< in: size of the total pool in bytes */
|
||||
ulint n_instances) /*!< in: number of instances */
|
||||
{
|
||||
ulint i;
|
||||
ulint i;
|
||||
const ulint size = total_size / n_instances;
|
||||
|
||||
ut_ad(n_instances > 0);
|
||||
ut_ad(n_instances <= MAX_BUFFER_POOLS);
|
||||
ut_ad(n_instances == srv_buf_pool_instances);
|
||||
|
||||
/* We create an extra buffer pool instance, this instance is used
|
||||
for flushing the flush lists, to keep track of n_flush for all
|
||||
the buffer pools and also used as a waiting object during flushing. */
|
||||
buf_pool_ptr = mem_zalloc(n_instances * sizeof *buf_pool_ptr);
|
||||
|
||||
for (i = 0; i < n_instances; i++) {
|
||||
buf_pool_t* ptr;
|
||||
ulint size;
|
||||
|
||||
ptr = mem_zalloc(sizeof(*ptr));
|
||||
|
||||
size = total_size / n_instances;
|
||||
|
||||
buf_pool_ptr[i] = ptr;
|
||||
buf_pool_t* ptr = &buf_pool_ptr[i];
|
||||
|
||||
if (buf_pool_init_instance(ptr, size, i) != DB_SUCCESS) {
|
||||
|
||||
mem_free(buf_pool_ptr[i]);
|
||||
|
||||
/* Free all the instances created so far. */
|
||||
buf_pool_free(i);
|
||||
|
||||
|
@ -1341,8 +1337,10 @@ buf_pool_free(
|
|||
|
||||
for (i = 0; i < n_instances; i++) {
|
||||
buf_pool_free_instance(buf_pool_from_array(i));
|
||||
buf_pool_ptr[i] = NULL;
|
||||
}
|
||||
|
||||
mem_free(buf_pool_ptr);
|
||||
buf_pool_ptr = NULL;
|
||||
}
|
||||
|
||||
/********************************************************************//**
|
||||
|
@ -3685,7 +3683,7 @@ err_exit:
|
|||
bpage = buf_buddy_alloc(buf_pool, sizeof *bpage, &lru);
|
||||
|
||||
/* Initialize the buf_pool pointer. */
|
||||
bpage->buf_pool = buf_pool;
|
||||
bpage->buf_pool_index = buf_pool_index(buf_pool);
|
||||
|
||||
/* If buf_buddy_alloc() allocated storage from the LRU list,
|
||||
it released and reacquired buf_pool->mutex. Thus, we must
|
||||
|
|
|
@ -1733,13 +1733,13 @@ err_exit:
|
|||
if (err != DB_SUCCESS) {
|
||||
dict_table_remove_from_cache(table);
|
||||
table = NULL;
|
||||
} else {
|
||||
table->fk_max_recusive_level = 0;
|
||||
}
|
||||
} else if (!srv_force_recovery) {
|
||||
dict_table_remove_from_cache(table);
|
||||
table = NULL;
|
||||
}
|
||||
|
||||
table->fk_max_recusive_level = 0;
|
||||
#if 0
|
||||
if (err != DB_SUCCESS && table != NULL) {
|
||||
|
||||
|
|
|
@ -95,10 +95,6 @@ extern "C" {
|
|||
# define MYSQL_PLUGIN_IMPORT /* nothing */
|
||||
# endif /* MYSQL_PLUGIN_IMPORT */
|
||||
|
||||
#if MYSQL_VERSION_ID < 50124
|
||||
bool check_global_access(THD *thd, ulong want_access);
|
||||
#endif /* MYSQL_VERSION_ID < 50124 */
|
||||
|
||||
/** to protect innobase_open_files */
|
||||
static mysql_mutex_t innobase_share_mutex;
|
||||
/** to force correct commit order in binlog */
|
||||
|
@ -240,7 +236,6 @@ static PSI_mutex_info all_innodb_mutexes[] = {
|
|||
{&ibuf_mutex_key, "ibuf_mutex", 0},
|
||||
{&ibuf_pessimistic_insert_mutex_key,
|
||||
"ibuf_pessimistic_insert_mutex", 0},
|
||||
{&ios_mutex_key, "ios_mutex", 0},
|
||||
{&kernel_mutex_key, "kernel_mutex", 0},
|
||||
{&log_sys_mutex_key, "log_sys_mutex", 0},
|
||||
# ifdef UNIV_MEM_DEBUG
|
||||
|
@ -1899,11 +1894,7 @@ innobase_convert_identifier(
|
|||
FALSE=id is an UTF-8 string */
|
||||
{
|
||||
char nz[NAME_LEN + 1];
|
||||
#if MYSQL_VERSION_ID >= 50141
|
||||
char nz2[NAME_LEN + 1 + EXPLAIN_FILENAME_MAX_EXTRA_LENGTH];
|
||||
#else /* MYSQL_VERSION_ID >= 50141 */
|
||||
char nz2[NAME_LEN + 1 + sizeof srv_mysql50_table_name_prefix];
|
||||
#endif /* MYSQL_VERSION_ID >= 50141 */
|
||||
|
||||
const char* s = id;
|
||||
int q;
|
||||
|
@ -1921,13 +1912,9 @@ innobase_convert_identifier(
|
|||
nz[idlen] = 0;
|
||||
|
||||
s = nz2;
|
||||
#if MYSQL_VERSION_ID >= 50141
|
||||
idlen = explain_filename((THD*) thd, nz, nz2, sizeof nz2,
|
||||
EXPLAIN_PARTITIONS_AS_COMMENT);
|
||||
goto no_quote;
|
||||
#else /* MYSQL_VERSION_ID >= 50141 */
|
||||
idlen = filename_to_tablename(nz, nz2, sizeof nz2);
|
||||
#endif /* MYSQL_VERSION_ID >= 50141 */
|
||||
}
|
||||
|
||||
/* See if the identifier needs to be quoted. */
|
||||
|
@ -1938,9 +1925,7 @@ innobase_convert_identifier(
|
|||
}
|
||||
|
||||
if (q == EOF) {
|
||||
#if MYSQL_VERSION_ID >= 50141
|
||||
no_quote:
|
||||
#endif /* MYSQL_VERSION_ID >= 50141 */
|
||||
if (UNIV_UNLIKELY(idlen > buflen)) {
|
||||
idlen = buflen;
|
||||
}
|
||||
|
|
|
@ -276,14 +276,13 @@ int thd_binlog_format(const MYSQL_THD thd);
|
|||
*/
|
||||
void thd_mark_transaction_to_rollback(MYSQL_THD thd, bool all);
|
||||
|
||||
#if MYSQL_VERSION_ID > 50140
|
||||
/**
|
||||
Check if binary logging is filtered for thread's current db.
|
||||
@param thd Thread handle
|
||||
@retval 1 the query is not filtered, 0 otherwise.
|
||||
*/
|
||||
bool thd_binlog_filter_ok(const MYSQL_THD thd);
|
||||
#endif /* MYSQL_VERSION_ID > 50140 */
|
||||
|
||||
/**
|
||||
Check if the query may generate row changes which
|
||||
may end up in the binary.
|
||||
|
|
|
@ -1363,12 +1363,12 @@ ibuf_add_ops(
|
|||
const ulint* ops) /*!< in: operation counts */
|
||||
|
||||
{
|
||||
ulint i;
|
||||
|
||||
#ifndef HAVE_ATOMIC_BUILTINS
|
||||
ut_ad(mutex_own(&ibuf_mutex));
|
||||
#endif /* !HAVE_ATOMIC_BUILTINS */
|
||||
|
||||
ulint i;
|
||||
|
||||
for (i = 0; i < IBUF_OP_COUNT; i++) {
|
||||
#ifdef HAVE_ATOMIC_BUILTINS
|
||||
os_atomic_increment_ulint(&arr[i], ops[i]);
|
||||
|
|
|
@ -69,7 +69,7 @@ Created 11/5/1995 Heikki Tuuri
|
|||
#define BUF_POOL_WATCH_SIZE 1 /*!< Maximum number of concurrent
|
||||
buffer pool watches */
|
||||
|
||||
extern buf_pool_t* buf_pool_ptr[MAX_BUFFER_POOLS]; /*!< The buffer pools
|
||||
extern buf_pool_t* buf_pool_ptr; /*!< The buffer pools
|
||||
of the database */
|
||||
#ifdef UNIV_DEBUG
|
||||
extern ibool buf_debug_prints;/*!< If this is set TRUE, the program
|
||||
|
@ -1034,6 +1034,15 @@ buf_page_address_fold(
|
|||
ulint space, /*!< in: space id */
|
||||
ulint offset) /*!< in: offset of the page within space */
|
||||
__attribute__((const));
|
||||
/********************************************************************//**
|
||||
Calculates the index of a buffer pool to the buf_pool[] array.
|
||||
@return the position of the buffer pool in buf_pool[] */
|
||||
UNIV_INLINE
|
||||
ulint
|
||||
buf_pool_index(
|
||||
/*===========*/
|
||||
const buf_pool_t* buf_pool) /*!< in: buffer pool */
|
||||
__attribute__((nonnull, const));
|
||||
/******************************************************************//**
|
||||
Returns the buffer pool instance given a page instance
|
||||
@return buf_pool */
|
||||
|
@ -1065,8 +1074,9 @@ Returns the buffer pool instance given its array index
|
|||
UNIV_INLINE
|
||||
buf_pool_t*
|
||||
buf_pool_from_array(
|
||||
/*====================*/
|
||||
ulint index); /*!< in: array index to get buffer pool instance from */
|
||||
/*================*/
|
||||
ulint index); /*!< in: array index to get
|
||||
buffer pool instance from */
|
||||
/******************************************************************//**
|
||||
Returns the control block of a file page, NULL if not found.
|
||||
@return block, NULL if not found */
|
||||
|
@ -1204,8 +1214,13 @@ struct buf_page_struct{
|
|||
unsigned io_fix:2; /*!< type of pending I/O operation;
|
||||
also protected by buf_pool->mutex
|
||||
@see enum buf_io_fix */
|
||||
unsigned buf_fix_count:25;/*!< count of how manyfold this block
|
||||
unsigned buf_fix_count:19;/*!< count of how manyfold this block
|
||||
is currently bufferfixed */
|
||||
unsigned buf_pool_index:6;/*!< index number of the buffer pool
|
||||
that this block belongs to */
|
||||
# if MAX_BUFFER_POOLS > 64
|
||||
# error "MAX_BUFFER_POOLS > 64; redefine buf_pool_index:6"
|
||||
# endif
|
||||
/* @} */
|
||||
#endif /* !UNIV_HOTBACKUP */
|
||||
page_zip_des_t zip; /*!< compressed page; zip.data
|
||||
|
@ -1324,8 +1339,6 @@ struct buf_page_struct{
|
|||
frees a page in buffer pool */
|
||||
# endif /* UNIV_DEBUG_FILE_ACCESSES */
|
||||
#endif /* !UNIV_HOTBACKUP */
|
||||
buf_pool_t* buf_pool; /*!< buffer pool instance this
|
||||
page belongs to */
|
||||
};
|
||||
|
||||
/** The buffer control block structure */
|
||||
|
|
|
@ -46,6 +46,48 @@ buf_pool_get_curr_size(void)
|
|||
return(srv_buf_pool_curr_size);
|
||||
}
|
||||
|
||||
/********************************************************************//**
|
||||
Calculates the index of a buffer pool to the buf_pool[] array.
|
||||
@return the position of the buffer pool in buf_pool[] */
|
||||
UNIV_INLINE
|
||||
ulint
|
||||
buf_pool_index(
|
||||
/*===========*/
|
||||
const buf_pool_t* buf_pool) /*!< in: buffer pool */
|
||||
{
|
||||
ulint i = buf_pool - buf_pool_ptr;
|
||||
ut_ad(i < MAX_BUFFER_POOLS);
|
||||
ut_ad(i < srv_buf_pool_instances);
|
||||
return(i);
|
||||
}
|
||||
|
||||
/******************************************************************//**
|
||||
Returns the buffer pool instance given a page instance
|
||||
@return buf_pool */
|
||||
UNIV_INLINE
|
||||
buf_pool_t*
|
||||
buf_pool_from_bpage(
|
||||
/*================*/
|
||||
const buf_page_t* bpage) /*!< in: buffer pool page */
|
||||
{
|
||||
ulint i;
|
||||
i = bpage->buf_pool_index;
|
||||
ut_ad(i < srv_buf_pool_instances);
|
||||
return(&buf_pool_ptr[i]);
|
||||
}
|
||||
|
||||
/******************************************************************//**
|
||||
Returns the buffer pool instance given a block instance
|
||||
@return buf_pool */
|
||||
UNIV_INLINE
|
||||
buf_pool_t*
|
||||
buf_pool_from_block(
|
||||
/*================*/
|
||||
const buf_block_t* block) /*!< in: block */
|
||||
{
|
||||
return(buf_pool_from_bpage(&block->page));
|
||||
}
|
||||
|
||||
/*********************************************************************//**
|
||||
Gets the current size of buffer buf_pool in pages.
|
||||
@return size in pages*/
|
||||
|
@ -885,33 +927,6 @@ buf_block_buf_fix_dec(
|
|||
#endif
|
||||
}
|
||||
|
||||
/******************************************************************//**
|
||||
Returns the buffer pool instance given a page instance
|
||||
@return buf_pool */
|
||||
UNIV_INLINE
|
||||
buf_pool_t*
|
||||
buf_pool_from_bpage(
|
||||
/*================*/
|
||||
const buf_page_t* bpage) /*!< in: buffer pool page */
|
||||
{
|
||||
/* Every page must be in some buffer pool. */
|
||||
ut_ad(bpage->buf_pool != NULL);
|
||||
|
||||
return(bpage->buf_pool);
|
||||
}
|
||||
|
||||
/******************************************************************//**
|
||||
Returns the buffer pool instance given a block instance
|
||||
@return buf_pool */
|
||||
UNIV_INLINE
|
||||
buf_pool_t*
|
||||
buf_pool_from_block(
|
||||
/*================*/
|
||||
const buf_block_t* block) /*!< in: block */
|
||||
{
|
||||
return(buf_pool_from_bpage(&block->page));
|
||||
}
|
||||
|
||||
/******************************************************************//**
|
||||
Returns the buffer pool instance given space and offset of page
|
||||
@return buffer pool */
|
||||
|
@ -929,7 +944,7 @@ buf_pool_get(
|
|||
ignored_offset = offset >> 6; /* 2log of BUF_READ_AHEAD_AREA (64)*/
|
||||
fold = buf_page_address_fold(space, ignored_offset);
|
||||
index = fold % srv_buf_pool_instances;
|
||||
return buf_pool_ptr[index];
|
||||
return(&buf_pool_ptr[index]);
|
||||
}
|
||||
|
||||
/******************************************************************//**
|
||||
|
@ -939,10 +954,12 @@ UNIV_INLINE
|
|||
buf_pool_t*
|
||||
buf_pool_from_array(
|
||||
/*================*/
|
||||
ulint index) /*!< in: array index to get
|
||||
ulint index) /*!< in: array index to get
|
||||
buffer pool instance from */
|
||||
{
|
||||
return buf_pool_ptr[index];
|
||||
ut_ad(index < MAX_BUFFER_POOLS);
|
||||
ut_ad(index < srv_buf_pool_instances);
|
||||
return(&buf_pool_ptr[index]);
|
||||
}
|
||||
|
||||
/******************************************************************//**
|
||||
|
|
|
@ -85,7 +85,6 @@ extern mysql_pfs_key_t hash_table_mutex_key;
|
|||
extern mysql_pfs_key_t ibuf_bitmap_mutex_key;
|
||||
extern mysql_pfs_key_t ibuf_mutex_key;
|
||||
extern mysql_pfs_key_t ibuf_pessimistic_insert_mutex_key;
|
||||
extern mysql_pfs_key_t ios_mutex_key;
|
||||
extern mysql_pfs_key_t log_sys_mutex_key;
|
||||
extern mysql_pfs_key_t log_flush_order_mutex_key;
|
||||
extern mysql_pfs_key_t kernel_mutex_key;
|
||||
|
|
|
@ -262,8 +262,6 @@ UNIV_INTERN
|
|||
page_t*
|
||||
trx_undo_set_state_at_finish(
|
||||
/*=========================*/
|
||||
trx_rseg_t* rseg, /*!< in: rollback segment memory object */
|
||||
trx_t* trx, /*!< in: transaction */
|
||||
trx_undo_t* undo, /*!< in: undo log memory copy */
|
||||
mtr_t* mtr); /*!< in: mtr */
|
||||
/******************************************************************//**
|
||||
|
|
|
@ -2400,7 +2400,10 @@ os_file_read_func(
|
|||
ulint i;
|
||||
#endif /* !UNIV_HOTBACKUP */
|
||||
|
||||
/* On 64-bit Windows, ulint is 64 bits. But offset and n should be
|
||||
no more than 32 bits. */
|
||||
ut_a((offset & 0xFFFFFFFFUL) == offset);
|
||||
ut_a((n & 0xFFFFFFFFUL) == n);
|
||||
|
||||
os_n_file_reads++;
|
||||
os_bytes_read_since_printout += n;
|
||||
|
@ -2526,7 +2529,10 @@ os_file_read_no_error_handling_func(
|
|||
ulint i;
|
||||
#endif /* !UNIV_HOTBACKUP */
|
||||
|
||||
/* On 64-bit Windows, ulint is 64 bits. But offset and n should be
|
||||
no more than 32 bits. */
|
||||
ut_a((offset & 0xFFFFFFFFUL) == offset);
|
||||
ut_a((n & 0xFFFFFFFFUL) == n);
|
||||
|
||||
os_n_file_reads++;
|
||||
os_bytes_read_since_printout += n;
|
||||
|
@ -2658,7 +2664,10 @@ os_file_write_func(
|
|||
ulint i;
|
||||
#endif /* !UNIV_HOTBACKUP */
|
||||
|
||||
ut_a((offset & 0xFFFFFFFF) == offset);
|
||||
/* On 64-bit Windows, ulint is 64 bits. But offset and n should be
|
||||
no more than 32 bits. */
|
||||
ut_a((offset & 0xFFFFFFFFUL) == offset);
|
||||
ut_a((n & 0xFFFFFFFFUL) == n);
|
||||
|
||||
os_n_file_writes++;
|
||||
|
||||
|
@ -3621,6 +3630,10 @@ os_aio_array_reserve_slot(
|
|||
ulint slots_per_seg;
|
||||
ulint local_seg;
|
||||
|
||||
#ifdef WIN_ASYNC_IO
|
||||
ut_a((len & 0xFFFFFFFFUL) == len);
|
||||
#endif
|
||||
|
||||
/* No need of a mutex. Only reading constant fields */
|
||||
slots_per_seg = array->n_slots / array->n_segments;
|
||||
|
||||
|
@ -3996,6 +4009,9 @@ os_aio_func(
|
|||
ut_ad(n % OS_FILE_LOG_BLOCK_SIZE == 0);
|
||||
ut_ad(offset % OS_FILE_LOG_BLOCK_SIZE == 0);
|
||||
ut_ad(os_aio_validate());
|
||||
#ifdef WIN_ASYNC_IO
|
||||
ut_ad((n & 0xFFFFFFFFUL) == n);
|
||||
#endif
|
||||
|
||||
wake_later = mode & OS_AIO_SIMULATED_WAKE_LATER;
|
||||
mode = mode & (~OS_AIO_SIMULATED_WAKE_LATER);
|
||||
|
@ -4271,16 +4287,18 @@ os_aio_windows_handle(
|
|||
__FILE__, __LINE__);
|
||||
#endif
|
||||
|
||||
ut_a((slot->len & 0xFFFFFFFFUL) == slot->len);
|
||||
|
||||
switch (slot->type) {
|
||||
case OS_FILE_WRITE:
|
||||
ret = WriteFile(slot->file, slot->buf,
|
||||
slot->len, &len,
|
||||
(DWORD) slot->len, &len,
|
||||
&(slot->control));
|
||||
|
||||
break;
|
||||
case OS_FILE_READ:
|
||||
ret = ReadFile(slot->file, slot->buf,
|
||||
slot->len, &len,
|
||||
(DWORD) slot->len, &len,
|
||||
&(slot->control));
|
||||
|
||||
break;
|
||||
|
|
|
@ -136,20 +136,30 @@ os_cond_wait_timed(
|
|||
#ifndef __WIN__
|
||||
const struct timespec* abstime /*!< in: timeout */
|
||||
#else
|
||||
ulint time_in_ms /*!< in: timeout in
|
||||
DWORD time_in_ms /*!< in: timeout in
|
||||
milliseconds*/
|
||||
#endif /* !__WIN__ */
|
||||
)
|
||||
{
|
||||
#ifdef __WIN__
|
||||
BOOL ret;
|
||||
BOOL ret;
|
||||
DWORD err;
|
||||
|
||||
ut_a(sleep_condition_variable != NULL);
|
||||
|
||||
ret = sleep_condition_variable(cond, mutex, time_in_ms);
|
||||
|
||||
if (!ret && GetLastError() == WAIT_TIMEOUT) {
|
||||
return(TRUE);
|
||||
if (!ret) {
|
||||
err = GetLastError();
|
||||
/* From http://msdn.microsoft.com/en-us/library/ms686301%28VS.85%29.aspx,
|
||||
"Condition variables are subject to spurious wakeups
|
||||
(those not associated with an explicit wake) and stolen wakeups
|
||||
(another thread manages to run before the woken thread)."
|
||||
Check for both types of timeouts.
|
||||
Conditions are checked by the caller.*/
|
||||
if ((err == WAIT_TIMEOUT) || (err == ERROR_TIMEOUT)) {
|
||||
return(TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
ut_a(ret);
|
||||
|
@ -163,12 +173,15 @@ os_cond_wait_timed(
|
|||
switch (ret) {
|
||||
case 0:
|
||||
case ETIMEDOUT:
|
||||
break;
|
||||
/* We play it safe by checking for EINTR even though
|
||||
according to the POSIX documentation it can't return EINTR. */
|
||||
case EINTR:
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, " InnoDB: pthread_cond_timedwait() returned: "
|
||||
"%d: abstime={%lu,%lu}\n",
|
||||
ret, abstime->tv_sec, abstime->tv_nsec);
|
||||
ret, (ulong) abstime->tv_sec, (ulong) abstime->tv_nsec);
|
||||
ut_error;
|
||||
}
|
||||
|
||||
|
@ -655,7 +668,7 @@ os_event_wait_time_low(
|
|||
ut_a(event);
|
||||
|
||||
if (time_in_usec != OS_SYNC_INFINITE_TIME) {
|
||||
time_in_ms = time_in_ms / 1000;
|
||||
time_in_ms = time_in_usec / 1000;
|
||||
err = WaitForSingleObject(event->handle, time_in_ms);
|
||||
} else {
|
||||
err = WaitForSingleObject(event->handle, INFINITE);
|
||||
|
@ -663,7 +676,7 @@ os_event_wait_time_low(
|
|||
|
||||
if (err == WAIT_OBJECT_0) {
|
||||
return(0);
|
||||
} else if (err == WAIT_TIMEOUT) {
|
||||
} else if ((err == WAIT_TIMEOUT) || (err == ERROR_TIMEOUT)) {
|
||||
return(OS_SYNC_TIME_EXCEEDED);
|
||||
}
|
||||
|
||||
|
|
|
@ -2839,15 +2839,6 @@ row_truncate_table_for_mysql(
|
|||
|
||||
trx->table_id = table->id;
|
||||
|
||||
/* Lock all index trees for this table, as we will
|
||||
truncate the table/index and possibly change their metadata.
|
||||
All DML/DDL are blocked by table level lock, with
|
||||
a few exceptions such as queries into information schema
|
||||
about the table, MySQL could try to access index stats
|
||||
for this kind of query, we need to use index locks to
|
||||
sync up */
|
||||
dict_table_x_lock_indexes(table);
|
||||
|
||||
if (table->space && !table->dir_path_of_temp_table) {
|
||||
/* Discard and create the single-table tablespace. */
|
||||
ulint space = table->space;
|
||||
|
@ -2860,6 +2851,11 @@ row_truncate_table_for_mysql(
|
|||
|
||||
dict_hdr_get_new_id(NULL, NULL, &space);
|
||||
|
||||
/* Lock all index trees for this table. We must
|
||||
do so after dict_hdr_get_new_id() to preserve
|
||||
the latch order */
|
||||
dict_table_x_lock_indexes(table);
|
||||
|
||||
if (space == ULINT_UNDEFINED
|
||||
|| fil_create_new_single_table_tablespace(
|
||||
space, table->name, FALSE, flags,
|
||||
|
@ -2893,6 +2889,15 @@ row_truncate_table_for_mysql(
|
|||
FIL_IBD_FILE_INITIAL_SIZE, &mtr);
|
||||
mtr_commit(&mtr);
|
||||
}
|
||||
} else {
|
||||
/* Lock all index trees for this table, as we will
|
||||
truncate the table/index and possibly change their metadata.
|
||||
All DML/DDL are blocked by table level lock, with
|
||||
a few exceptions such as queries into information schema
|
||||
about the table, MySQL could try to access index stats
|
||||
for this kind of query, we need to use index locks to
|
||||
sync up */
|
||||
dict_table_x_lock_indexes(table);
|
||||
}
|
||||
|
||||
/* scan SYS_INDEXES for all indexes of the table */
|
||||
|
|
|
@ -120,11 +120,6 @@ UNIV_INTERN enum srv_shutdown_state srv_shutdown_state = SRV_SHUTDOWN_NONE;
|
|||
/** Files comprising the system tablespace */
|
||||
static os_file_t files[1000];
|
||||
|
||||
/** Mutex protecting the ios count */
|
||||
static mutex_t ios_mutex;
|
||||
/** Count of I/O operations in io_handler_thread() */
|
||||
static ulint ios;
|
||||
|
||||
/** io_handler_thread parameters for thread identification */
|
||||
static ulint n[SRV_MAX_N_IO_THREADS + 6];
|
||||
/** io_handler_thread identifiers */
|
||||
|
@ -152,11 +147,6 @@ UNIV_INTERN mysql_pfs_key_t srv_master_thread_key;
|
|||
UNIV_INTERN mysql_pfs_key_t srv_purge_thread_key;
|
||||
#endif /* UNIV_PFS_THREAD */
|
||||
|
||||
#ifdef UNIV_PFS_MUTEX
|
||||
/* Key to register ios_mutex_key with performance schema */
|
||||
UNIV_INTERN mysql_pfs_key_t ios_mutex_key;
|
||||
#endif /* UNIV_PFS_MUTEX */
|
||||
|
||||
/*********************************************************************//**
|
||||
Convert a numeric string that optionally ends in G or M, to a number
|
||||
containing megabytes.
|
||||
|
@ -491,10 +481,6 @@ io_handler_thread(
|
|||
|
||||
while (srv_shutdown_state != SRV_SHUTDOWN_EXIT_THREADS) {
|
||||
fil_aio_wait(segment);
|
||||
|
||||
mutex_enter(&ios_mutex);
|
||||
ios++;
|
||||
mutex_exit(&ios_mutex);
|
||||
}
|
||||
|
||||
/* We count the number of threads in os_thread_exit(). A created
|
||||
|
@ -998,10 +984,6 @@ skip_size_check:
|
|||
srv_data_file_is_raw_partition[i] != 0);
|
||||
}
|
||||
|
||||
ios = 0;
|
||||
|
||||
mutex_create(ios_mutex_key, &ios_mutex, SYNC_NO_ORDER_CHECK);
|
||||
|
||||
return(DB_SUCCESS);
|
||||
}
|
||||
|
||||
|
|
|
@ -753,8 +753,7 @@ trx_commit_off_kernel(
|
|||
mutex_enter(&(rseg->mutex));
|
||||
|
||||
if (trx->insert_undo != NULL) {
|
||||
trx_undo_set_state_at_finish(
|
||||
rseg, trx, trx->insert_undo, &mtr);
|
||||
trx_undo_set_state_at_finish(trx->insert_undo, &mtr);
|
||||
}
|
||||
|
||||
undo = trx->update_undo;
|
||||
|
@ -769,7 +768,7 @@ trx_commit_off_kernel(
|
|||
transaction commit for this transaction. */
|
||||
|
||||
update_hdr_page = trx_undo_set_state_at_finish(
|
||||
rseg, trx, undo, &mtr);
|
||||
undo, &mtr);
|
||||
|
||||
/* We have to do the cleanup for the update log while
|
||||
holding the rseg mutex because update log headers
|
||||
|
|
|
@ -1798,8 +1798,6 @@ UNIV_INTERN
|
|||
page_t*
|
||||
trx_undo_set_state_at_finish(
|
||||
/*=========================*/
|
||||
trx_rseg_t* rseg, /*!< in: rollback segment memory object */
|
||||
trx_t* trx __attribute__((unused)), /*!< in: transaction */
|
||||
trx_undo_t* undo, /*!< in: undo log memory copy */
|
||||
mtr_t* mtr) /*!< in: mtr */
|
||||
{
|
||||
|
@ -1808,10 +1806,8 @@ trx_undo_set_state_at_finish(
|
|||
page_t* undo_page;
|
||||
ulint state;
|
||||
|
||||
ut_ad(trx);
|
||||
ut_ad(undo);
|
||||
ut_ad(mtr);
|
||||
ut_ad(mutex_own(&rseg->mutex));
|
||||
|
||||
if (undo->id >= TRX_RSEG_N_SLOTS) {
|
||||
fprintf(stderr, "InnoDB: Error: undo->id is %lu\n",
|
||||
|
@ -1830,19 +1826,7 @@ trx_undo_set_state_at_finish(
|
|||
&& mach_read_from_2(page_hdr + TRX_UNDO_PAGE_FREE)
|
||||
< TRX_UNDO_PAGE_REUSE_LIMIT) {
|
||||
|
||||
/* This is a heuristic to avoid the problem of all UNDO
|
||||
slots ending up in one of the UNDO lists. Previously if
|
||||
the server crashed with all the slots in one of the lists,
|
||||
transactions that required the slots of a different type
|
||||
would fail for lack of slots. */
|
||||
|
||||
if (UT_LIST_GET_LEN(rseg->update_undo_list) < 500
|
||||
&& UT_LIST_GET_LEN(rseg->insert_undo_list) < 500) {
|
||||
|
||||
state = TRX_UNDO_CACHED;
|
||||
} else {
|
||||
state = TRX_UNDO_TO_FREE;
|
||||
}
|
||||
state = TRX_UNDO_CACHED;
|
||||
|
||||
} else if (undo->type == TRX_UNDO_INSERT) {
|
||||
|
||||
|
|
Loading…
Reference in a new issue