Skip to content

Commit

Permalink
5.6.27-76.0
Browse files Browse the repository at this point in the history
  • Loading branch information
vuvova committed Dec 13, 2015
1 parent 6a821d7 commit 1e270d5
Show file tree
Hide file tree
Showing 33 changed files with 620 additions and 254 deletions.
21 changes: 20 additions & 1 deletion storage/xtradb/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2006, 2015, 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
Expand Down Expand Up @@ -29,6 +29,9 @@ IF(UNIX)
ADD_DEFINITIONS(-DLINUX_NATIVE_AIO=1)
LINK_LIBRARIES(aio)
ENDIF()
IF(HAVE_LIBNUMA)
LINK_LIBRARIES(numa)
ENDIF()
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "HP*")
ADD_DEFINITIONS("-DUNIV_HPUX")
ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "AIX")
Expand Down Expand Up @@ -145,6 +148,18 @@ IF(NOT CMAKE_CROSSCOMPILING)
}"
HAVE_IB_GCC_ATOMIC_THREAD_FENCE
)
CHECK_C_SOURCE_RUNS(
"#include<stdint.h>
int main()
{
unsigned char c;
__atomic_test_and_set(&c, __ATOMIC_ACQUIRE);
__atomic_clear(&c, __ATOMIC_RELEASE);
return(0);
}"
HAVE_IB_GCC_ATOMIC_TEST_AND_SET
)
ENDIF()

IF(HAVE_IB_GCC_ATOMIC_BUILTINS)
Expand All @@ -167,6 +182,10 @@ IF(HAVE_IB_GCC_ATOMIC_THREAD_FENCE)
ADD_DEFINITIONS(-DHAVE_IB_GCC_ATOMIC_THREAD_FENCE=1)
ENDIF()

IF(HAVE_IB_GCC_ATOMIC_TEST_AND_SET)
ADD_DEFINITIONS(-DHAVE_IB_GCC_ATOMIC_TEST_AND_SET=1)
ENDIF()

# either define HAVE_IB_ATOMIC_PTHREAD_T_GCC or not
IF(NOT CMAKE_CROSSCOMPILING)
CHECK_C_SOURCE_RUNS(
Expand Down
46 changes: 33 additions & 13 deletions storage/xtradb/btr/btr0cur.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (c) 1994, 2014, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 1994, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2012, Facebook Inc.
Expand Down Expand Up @@ -284,8 +284,13 @@ btr_cur_latch_leaves(
#ifdef UNIV_BTR_DEBUG
ut_a(page_is_comp(get_block->frame)
== page_is_comp(page));
ut_a(btr_page_get_next(get_block->frame, mtr)
== page_get_page_no(page));

/* For fake_change mode we avoid a detailed validation
as it operate in tweaked format where-in validation
may fail. */
ut_a(sibling_mode == RW_NO_LATCH
|| btr_page_get_next(get_block->frame, mtr)
== page_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
if (sibling_mode == RW_NO_LATCH) {
/* btr_block_get() called with RW_NO_LATCH will
Expand Down Expand Up @@ -1383,9 +1388,6 @@ btr_cur_optimistic_insert(
}
#endif /* UNIV_DEBUG */

ut_ad((thr && thr_get_trx(thr)->fake_changes)
|| mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));

leaf = page_is_leaf(page);

/* Calculate the record size when entry is converted to a record */
Expand Down Expand Up @@ -2265,6 +2267,7 @@ btr_cur_optimistic_update(
ulint max_size;
ulint new_rec_size;
ulint old_rec_size;
ulint max_ins_size = 0;
dtuple_t* new_entry;
roll_ptr_t roll_ptr;
ulint i;
Expand Down Expand Up @@ -2394,6 +2397,10 @@ btr_cur_optimistic_update(
: (old_rec_size
+ page_get_max_insert_size_after_reorganize(page, 1));

if (!page_zip) {
max_ins_size = page_get_max_insert_size_after_reorganize(page, 1);
}

if (!(((max_size >= BTR_CUR_PAGE_REORGANIZE_LIMIT)
&& (max_size >= new_rec_size))
|| (page_get_n_recs(page) <= 1))) {
Expand Down Expand Up @@ -2459,12 +2466,15 @@ btr_cur_optimistic_update(
ut_ad(err == DB_SUCCESS);

func_exit:
if (page_zip
&& !(flags & BTR_KEEP_IBUF_BITMAP)
if (!(flags & BTR_KEEP_IBUF_BITMAP)
&& !dict_index_is_clust(index)
&& page_is_leaf(page)) {
/* Update the free bits in the insert buffer. */
ibuf_update_free_bits_zip(block, mtr);

if (page_zip) {
ibuf_update_free_bits_zip(block, mtr);
} else {
ibuf_update_free_bits_low(block, max_ins_size, mtr);
}
}

return(err);
Expand Down Expand Up @@ -2600,6 +2610,7 @@ btr_cur_pessimistic_update(
ulint n_reserved = 0;
ulint n_ext;
trx_t* trx;
ulint max_ins_size = 0;

*offsets = NULL;
*big_rec = NULL;
Expand Down Expand Up @@ -2800,6 +2811,10 @@ btr_cur_pessimistic_update(
}
}

if (!page_zip) {
max_ins_size = page_get_max_insert_size_after_reorganize(page, 1);
}

/* Store state of explicit locks on rec on the page infimum record,
before deleting rec. The page infimum acts as a dummy carrier of the
locks, taking care also of lock releases, before we can move the locks
Expand Down Expand Up @@ -2845,13 +2860,18 @@ btr_cur_pessimistic_update(
rec_offs_make_valid(
page_cursor->rec, index, *offsets);
}
} else if (page_zip &&
!dict_index_is_clust(index)
} else if (!dict_index_is_clust(index)
&& page_is_leaf(page)) {

/* Update the free bits in the insert buffer.
This is the same block which was skipped by
BTR_KEEP_IBUF_BITMAP. */
ibuf_update_free_bits_zip(block, mtr);
if (page_zip) {
ibuf_update_free_bits_zip(block, mtr);
} else {
ibuf_update_free_bits_low(block, max_ins_size,
mtr);
}
}

err = DB_SUCCESS;
Expand Down
58 changes: 51 additions & 7 deletions storage/xtradb/buf/buf0buf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ Created 11/5/1995 Heikki Tuuri
#include "page0zip.h"
#include "srv0mon.h"
#include "buf0checksum.h"
#ifdef HAVE_LIBNUMA
#include <numa.h>
#include <numaif.h>
#endif // HAVE_LIBNUMA
#include "trx0trx.h"
#include "srv0start.h"

Expand Down Expand Up @@ -1125,8 +1129,7 @@ buf_chunk_init(
/*===========*/
buf_pool_t* buf_pool, /*!< in: buffer pool instance */
buf_chunk_t* chunk, /*!< out: chunk of buffers */
ulint mem_size, /*!< in: requested size in bytes */
ibool populate) /*!< in: virtual page preallocation */
ulint mem_size) /*!< in: requested size in bytes */
{
buf_block_t* block;
byte* frame;
Expand All @@ -1142,13 +1145,29 @@ buf_chunk_init(
+ (UNIV_PAGE_SIZE - 1), UNIV_PAGE_SIZE);

chunk->mem_size = mem_size;
chunk->mem = os_mem_alloc_large(&chunk->mem_size, populate);
chunk->mem = os_mem_alloc_large(&chunk->mem_size);

if (UNIV_UNLIKELY(chunk->mem == NULL)) {

return(NULL);
}

#ifdef HAVE_LIBNUMA
if (srv_numa_interleave) {
int st = mbind(chunk->mem, chunk->mem_size,
MPOL_INTERLEAVE,
numa_all_nodes_ptr->maskp,
numa_all_nodes_ptr->size,
MPOL_MF_MOVE);
if (st != 0) {
ib_logf(IB_LOG_LEVEL_WARN,
"Failed to set NUMA memory policy of buffer"
" pool page frames to MPOL_INTERLEAVE"
" (error: %s).", strerror(errno));
}
}
#endif // HAVE_LIBNUMA

/* Allocate the block descriptors from
the start of the memory block. */
chunk->blocks = (buf_block_t*) chunk->mem;
Expand Down Expand Up @@ -1345,7 +1364,6 @@ buf_pool_init_instance(
/*===================*/
buf_pool_t* buf_pool, /*!< in: buffer pool instance */
ulint buf_pool_size, /*!< in: size in bytes */
ibool populate, /*!< in: virtual page preallocation */
ulint instance_no) /*!< in: id of the instance */
{
ulint i;
Expand Down Expand Up @@ -1374,7 +1392,7 @@ buf_pool_init_instance(

UT_LIST_INIT(buf_pool->free);

if (!buf_chunk_init(buf_pool, chunk, buf_pool_size, populate)) {
if (!buf_chunk_init(buf_pool, chunk, buf_pool_size)) {
mem_free(chunk);
mem_free(buf_pool);

Expand Down Expand Up @@ -1480,7 +1498,6 @@ dberr_t
buf_pool_init(
/*==========*/
ulint total_size, /*!< in: size of the total pool in bytes */
ibool populate, /*!< in: virtual page preallocation */
ulint n_instances) /*!< in: number of instances */
{
ulint i;
Expand All @@ -1490,13 +1507,28 @@ buf_pool_init(
ut_ad(n_instances <= MAX_BUFFER_POOLS);
ut_ad(n_instances == srv_buf_pool_instances);

#ifdef HAVE_LIBNUMA
if (srv_numa_interleave) {
ib_logf(IB_LOG_LEVEL_INFO,
"Setting NUMA memory policy to MPOL_INTERLEAVE");
if (set_mempolicy(MPOL_INTERLEAVE,
numa_all_nodes_ptr->maskp,
numa_all_nodes_ptr->size) != 0) {
ib_logf(IB_LOG_LEVEL_WARN,
"Failed to set NUMA memory policy to"
" MPOL_INTERLEAVE (error: %s).",
strerror(errno));
}
}
#endif // HAVE_LIBNUMA

buf_pool_ptr = (buf_pool_t*) mem_zalloc(
n_instances * sizeof *buf_pool_ptr);

for (i = 0; i < n_instances; i++) {
buf_pool_t* ptr = &buf_pool_ptr[i];

if (buf_pool_init_instance(ptr, size, populate, i) != DB_SUCCESS) {
if (buf_pool_init_instance(ptr, size, i) != DB_SUCCESS) {

/* Free all the instances created so far. */
buf_pool_free(i);
Expand All @@ -1510,6 +1542,18 @@ buf_pool_init(

btr_search_sys_create(buf_pool_get_curr_size() / sizeof(void*) / 64);

#ifdef HAVE_LIBNUMA
if (srv_numa_interleave) {
ib_logf(IB_LOG_LEVEL_INFO,
"Setting NUMA memory policy to MPOL_DEFAULT");
if (set_mempolicy(MPOL_DEFAULT, NULL, 0) != 0) {
ib_logf(IB_LOG_LEVEL_WARN,
"Failed to set NUMA memory policy to"
" MPOL_DEFAULT (error: %s).", strerror(errno));
}
}
#endif // HAVE_LIBNUMA

return(DB_SUCCESS);
}

Expand Down
2 changes: 1 addition & 1 deletion storage/xtradb/dict/dict0crea.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,7 @@ dict_create_index_step(
>= UNIV_FORMAT_B);

node->index = dict_index_get_if_in_cache_low(index_id);
ut_a(!node->index == (err != DB_SUCCESS));
ut_a((node->index == 0) == (err != DB_SUCCESS));

if (err != DB_SUCCESS) {

Expand Down
Loading

0 comments on commit 1e270d5

Please sign in to comment.