Skip to content

Commit b42664e

Browse files
committed
5.6.30-76.3
1 parent 5b8ac23 commit b42664e

40 files changed

+765
-1006
lines changed

storage/xtradb/buf/buf0buf.cc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,6 +1454,7 @@ buf_pool_free_instance(
14541454
buf_chunk_t* chunk;
14551455
buf_chunk_t* chunks;
14561456
buf_page_t* bpage;
1457+
ulint i;
14571458

14581459
bpage = UT_LIST_GET_LAST(buf_pool->LRU);
14591460
while (bpage != NULL) {
@@ -1477,10 +1478,29 @@ buf_pool_free_instance(
14771478
mem_free(buf_pool->watch);
14781479
buf_pool->watch = NULL;
14791480

1481+
for (i = BUF_FLUSH_LRU; i < BUF_FLUSH_N_TYPES; i++) {
1482+
os_event_free(buf_pool->no_flush[i]);
1483+
}
1484+
mutex_free(&buf_pool->LRU_list_mutex);
1485+
mutex_free(&buf_pool->free_list_mutex);
1486+
mutex_free(&buf_pool->zip_free_mutex);
1487+
mutex_free(&buf_pool->zip_hash_mutex);
1488+
mutex_free(&buf_pool->zip_mutex);
1489+
mutex_free(&buf_pool->flush_state_mutex);
1490+
mutex_free(&buf_pool->flush_list_mutex);
1491+
14801492
chunks = buf_pool->chunks;
14811493
chunk = chunks + buf_pool->n_chunks;
14821494

14831495
while (--chunk >= chunks) {
1496+
buf_block_t* block = chunk->blocks;
1497+
for (i = 0; i < chunk->size; i++, block++) {
1498+
mutex_free(&block->mutex);
1499+
rw_lock_free(&block->lock);
1500+
#ifdef UNIV_SYNC_DEBUG
1501+
rw_lock_free(&block->debug_latch);
1502+
#endif
1503+
}
14841504
os_mem_free_large(chunk->mem, chunk->mem_size);
14851505
}
14861506

storage/xtradb/buf/buf0lru.cc

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,7 @@ buf_flush_or_remove_pages(
607607
bpage != NULL;
608608
bpage = prev) {
609609

610+
ut_ad(!must_restart);
610611
ut_a(buf_page_in_file(bpage));
611612

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

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

645643
all_freed = false;
644+
if (UNIV_UNLIKELY(must_restart)) {
645+
646+
/* Cannot trust the prev pointer */
647+
break;
648+
}
646649
} else if (flush) {
647650

648651
/* The processing was successful. And during the
649652
processing we have released all the buf_pool mutexes
650653
when calling buf_page_flush(). We cannot trust
651654
prev pointer. */
652655
goto rescan;
653-
} else if (UNIV_UNLIKELY(must_restart)) {
654-
655-
ut_ad(!all_freed);
656-
break;
657656
}
658657

658+
ut_ad(!must_restart);
659659
++processed;
660660

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

668668
processed = 0;
669+
} else if (UNIV_UNLIKELY(must_restart)) {
670+
671+
/* Cannot trust the prev pointer */
672+
all_freed = false;
673+
break;
669674
}
670675

671676
#ifdef DBUG_OFF

storage/xtradb/fil/fil0fil.cc

Lines changed: 28 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*****************************************************************************
22
3-
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
3+
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
44
55
This program is free software; you can redistribute it and/or modify it under
66
the terms of the GNU General Public License as published by the Free Software
@@ -3248,8 +3248,6 @@ fil_create_link_file(
32483248
const char* tablename, /*!< in: tablename */
32493249
const char* filepath) /*!< in: pathname of tablespace */
32503250
{
3251-
os_file_t file;
3252-
ibool success;
32533251
dberr_t err = DB_SUCCESS;
32543252
char* link_filepath;
32553253
char* prev_filepath = fil_read_link_file(tablename);
@@ -3268,13 +3266,24 @@ fil_create_link_file(
32683266

32693267
link_filepath = fil_make_isl_name(tablename);
32703268

3271-
file = os_file_create_simple_no_error_handling(
3272-
innodb_file_data_key, link_filepath,
3273-
OS_FILE_CREATE, OS_FILE_READ_WRITE, &success);
3269+
/** Check if the file already exists. */
3270+
FILE* file = NULL;
3271+
ibool exists;
3272+
os_file_type_t ftype;
32743273

3275-
if (!success) {
3276-
/* The following call will print an error message */
3277-
ulint error = os_file_get_last_error(true);
3274+
bool success = os_file_status(link_filepath, &exists, &ftype);
3275+
3276+
ulint error = 0;
3277+
if (success && !exists) {
3278+
file = fopen(link_filepath, "w");
3279+
if (file == NULL) {
3280+
/* This call will print its own error message */
3281+
error = os_file_get_last_error(true);
3282+
}
3283+
} else {
3284+
error = OS_FILE_ALREADY_EXISTS;
3285+
}
3286+
if (error != 0) {
32783287

32793288
ut_print_timestamp(stderr);
32803289
fputs(" InnoDB: Cannot create file ", stderr);
@@ -3299,13 +3308,17 @@ fil_create_link_file(
32993308
return(err);
33003309
}
33013310

3302-
if (!os_file_write(link_filepath, file, filepath, 0,
3303-
strlen(filepath))) {
3311+
ulint rbytes = fwrite(filepath, 1, strlen(filepath), file);
3312+
if (rbytes != strlen(filepath)) {
3313+
os_file_get_last_error(true);
3314+
ib_logf(IB_LOG_LEVEL_ERROR,
3315+
"cannot write link file "
3316+
"%s",filepath);
33043317
err = DB_ERROR;
33053318
}
33063319

33073320
/* Close the file, we only need it at startup */
3308-
os_file_close(file);
3321+
fclose(file);
33093322

33103323
mem_free(link_filepath);
33113324

@@ -5185,8 +5198,8 @@ fil_extend_space_to_desired_size(
51855198
ib_logf(IB_LOG_LEVEL_ERROR,
51865199
"preallocating file space for file \'%s\' "
51875200
"failed. Current size " INT64PF
5188-
", len " INT64PF ", desired size " INT64PF
5189-
"\n", node->name, start_offset, end_offset,
5201+
", len " INT64PF ", desired size " INT64PF,
5202+
node->name, start_offset, end_offset,
51905203
start_offset + end_offset);
51915204
}
51925205
mutex_enter(&fil_system->mutex);
@@ -6254,10 +6267,7 @@ void
62546267
fil_close(void)
62556268
/*===========*/
62566269
{
6257-
#ifndef UNIV_HOTBACKUP
6258-
/* The mutex should already have been freed. */
6259-
ut_ad(fil_system->mutex.magic_n == 0);
6260-
#endif /* !UNIV_HOTBACKUP */
6270+
mutex_free(&fil_system->mutex);
62616271

62626272
hash_table_free(fil_system->spaces);
62636273

@@ -6781,27 +6791,6 @@ fil_mtr_rename_log(
67816791
/*************************************************************************
67826792
functions to access is_corrupt flag of fil_space_t*/
67836793

6784-
ibool
6785-
fil_space_is_corrupt(
6786-
/*=================*/
6787-
ulint space_id)
6788-
{
6789-
fil_space_t* space;
6790-
ibool ret = FALSE;
6791-
6792-
mutex_enter(&fil_system->mutex);
6793-
6794-
space = fil_space_get_by_id(space_id);
6795-
6796-
if (UNIV_UNLIKELY(space && space->is_corrupt)) {
6797-
ret = TRUE;
6798-
}
6799-
6800-
mutex_exit(&fil_system->mutex);
6801-
6802-
return(ret);
6803-
}
6804-
68056794
void
68066795
fil_space_set_corrupt(
68076796
/*==================*/

0 commit comments

Comments
 (0)