Skip to content

Commit

Permalink
5.6.30-76.3
Browse files Browse the repository at this point in the history
  • Loading branch information
vuvova committed Jun 21, 2016
1 parent 5b8ac23 commit b42664e
Show file tree
Hide file tree
Showing 40 changed files with 765 additions and 1,006 deletions.
20 changes: 20 additions & 0 deletions storage/xtradb/buf/buf0buf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1454,6 +1454,7 @@ buf_pool_free_instance(
buf_chunk_t* chunk;
buf_chunk_t* chunks;
buf_page_t* bpage;
ulint i;

bpage = UT_LIST_GET_LAST(buf_pool->LRU);
while (bpage != NULL) {
Expand All @@ -1477,10 +1478,29 @@ buf_pool_free_instance(
mem_free(buf_pool->watch);
buf_pool->watch = NULL;

for (i = BUF_FLUSH_LRU; i < BUF_FLUSH_N_TYPES; i++) {
os_event_free(buf_pool->no_flush[i]);
}
mutex_free(&buf_pool->LRU_list_mutex);
mutex_free(&buf_pool->free_list_mutex);
mutex_free(&buf_pool->zip_free_mutex);
mutex_free(&buf_pool->zip_hash_mutex);
mutex_free(&buf_pool->zip_mutex);
mutex_free(&buf_pool->flush_state_mutex);
mutex_free(&buf_pool->flush_list_mutex);

chunks = buf_pool->chunks;
chunk = chunks + buf_pool->n_chunks;

while (--chunk >= chunks) {
buf_block_t* block = chunk->blocks;
for (i = 0; i < chunk->size; i++, block++) {
mutex_free(&block->mutex);
rw_lock_free(&block->lock);
#ifdef UNIV_SYNC_DEBUG
rw_lock_free(&block->debug_latch);
#endif
}
os_mem_free_large(chunk->mem, chunk->mem_size);
}

Expand Down
19 changes: 12 additions & 7 deletions storage/xtradb/buf/buf0lru.cc
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,7 @@ buf_flush_or_remove_pages(
bpage != NULL;
bpage = prev) {

ut_ad(!must_restart);
ut_a(buf_page_in_file(bpage));

/* Save the previous link because once we free the
Expand All @@ -624,9 +625,6 @@ buf_flush_or_remove_pages(

/* Remove was unsuccessful, we have to try again
by scanning the entire list from the end.
This also means that we never released the
flush list mutex. Therefore we can trust the prev
pointer.
buf_flush_or_remove_page() released the
flush list mutex but not the LRU list mutex.
Therefore it is possible that a new page was
Expand All @@ -643,19 +641,21 @@ buf_flush_or_remove_pages(
iteration. */

all_freed = false;
if (UNIV_UNLIKELY(must_restart)) {

/* Cannot trust the prev pointer */
break;
}
} else if (flush) {

/* The processing was successful. And during the
processing we have released all the buf_pool mutexes
when calling buf_page_flush(). We cannot trust
prev pointer. */
goto rescan;
} else if (UNIV_UNLIKELY(must_restart)) {

ut_ad(!all_freed);
break;
}

ut_ad(!must_restart);
++processed;

/* Yield if we have hogged the CPU and mutexes for too long. */
Expand All @@ -666,6 +666,11 @@ buf_flush_or_remove_pages(
/* Reset the batch size counter if we had to yield. */

processed = 0;
} else if (UNIV_UNLIKELY(must_restart)) {

/* Cannot trust the prev pointer */
all_freed = false;
break;
}

#ifdef DBUG_OFF
Expand Down
67 changes: 28 additions & 39 deletions storage/xtradb/fil/fil0fil.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Expand Down Expand Up @@ -3248,8 +3248,6 @@ fil_create_link_file(
const char* tablename, /*!< in: tablename */
const char* filepath) /*!< in: pathname of tablespace */
{
os_file_t file;
ibool success;
dberr_t err = DB_SUCCESS;
char* link_filepath;
char* prev_filepath = fil_read_link_file(tablename);
Expand All @@ -3268,13 +3266,24 @@ fil_create_link_file(

link_filepath = fil_make_isl_name(tablename);

file = os_file_create_simple_no_error_handling(
innodb_file_data_key, link_filepath,
OS_FILE_CREATE, OS_FILE_READ_WRITE, &success);
/** Check if the file already exists. */
FILE* file = NULL;
ibool exists;
os_file_type_t ftype;

if (!success) {
/* The following call will print an error message */
ulint error = os_file_get_last_error(true);
bool success = os_file_status(link_filepath, &exists, &ftype);

ulint error = 0;
if (success && !exists) {
file = fopen(link_filepath, "w");
if (file == NULL) {
/* This call will print its own error message */
error = os_file_get_last_error(true);
}
} else {
error = OS_FILE_ALREADY_EXISTS;
}
if (error != 0) {

ut_print_timestamp(stderr);
fputs(" InnoDB: Cannot create file ", stderr);
Expand All @@ -3299,13 +3308,17 @@ fil_create_link_file(
return(err);
}

if (!os_file_write(link_filepath, file, filepath, 0,
strlen(filepath))) {
ulint rbytes = fwrite(filepath, 1, strlen(filepath), file);
if (rbytes != strlen(filepath)) {
os_file_get_last_error(true);
ib_logf(IB_LOG_LEVEL_ERROR,
"cannot write link file "
"%s",filepath);
err = DB_ERROR;
}

/* Close the file, we only need it at startup */
os_file_close(file);
fclose(file);

mem_free(link_filepath);

Expand Down Expand Up @@ -5185,8 +5198,8 @@ fil_extend_space_to_desired_size(
ib_logf(IB_LOG_LEVEL_ERROR,
"preallocating file space for file \'%s\' "
"failed. Current size " INT64PF
", len " INT64PF ", desired size " INT64PF
"\n", node->name, start_offset, end_offset,
", len " INT64PF ", desired size " INT64PF,
node->name, start_offset, end_offset,
start_offset + end_offset);
}
mutex_enter(&fil_system->mutex);
Expand Down Expand Up @@ -6254,10 +6267,7 @@ void
fil_close(void)
/*===========*/
{
#ifndef UNIV_HOTBACKUP
/* The mutex should already have been freed. */
ut_ad(fil_system->mutex.magic_n == 0);
#endif /* !UNIV_HOTBACKUP */
mutex_free(&fil_system->mutex);

hash_table_free(fil_system->spaces);

Expand Down Expand Up @@ -6781,27 +6791,6 @@ fil_mtr_rename_log(
/*************************************************************************
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 (UNIV_UNLIKELY(space && space->is_corrupt)) {
ret = TRUE;
}

mutex_exit(&fil_system->mutex);

return(ret);
}

void
fil_space_set_corrupt(
/*==================*/
Expand Down
Loading

0 comments on commit b42664e

Please sign in to comment.