Skip to content

Commit

Permalink
Merge branch 'merge-xtradb-5.6' into 10.0
Browse files Browse the repository at this point in the history
5.6.29-76.2
  • Loading branch information
vuvova committed Apr 26, 2016
2 parents c4dcfb6 + 5b8ac23 commit cfad394
Show file tree
Hide file tree
Showing 21 changed files with 664 additions and 165 deletions.
25 changes: 22 additions & 3 deletions storage/xtradb/buf/buf0dump.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (c) 2011, 2012, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2011, 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 the Free Software
Expand Down Expand Up @@ -167,6 +167,25 @@ buf_load_status(
va_end(ap);
}

/** Returns the directory path where the buffer pool dump file will be created.
@return directory path */
static
const char*
get_buf_dump_dir()
{
const char* dump_dir;

/* The dump file should be created in the default data directory if
innodb_data_home_dir is set as an empty string. */
if (strcmp(srv_data_home, "") == 0) {
dump_dir = fil_path_to_mysql_datadir;
} else {
dump_dir = srv_data_home;
}

return(dump_dir);
}

/*****************************************************************//**
Perform a buffer pool dump into the file specified by
innodb_buffer_pool_filename. If any errors occur then the value of
Expand All @@ -190,7 +209,7 @@ buf_dump(
int ret;

ut_snprintf(full_filename, sizeof(full_filename),
"%s%c%s", srv_data_home, SRV_PATH_SEPARATOR,
"%s%c%s", get_buf_dump_dir(), SRV_PATH_SEPARATOR,
srv_buf_dump_filename);

ut_snprintf(tmp_filename, sizeof(tmp_filename),
Expand Down Expand Up @@ -463,7 +482,7 @@ buf_load()
buf_load_abort_flag = FALSE;

ut_snprintf(full_filename, sizeof(full_filename),
"%s%c%s", srv_data_home, SRV_PATH_SEPARATOR,
"%s%c%s", get_buf_dump_dir(), SRV_PATH_SEPARATOR,
srv_buf_dump_filename);

buf_load_status(STATUS_NOTICE,
Expand Down
6 changes: 0 additions & 6 deletions storage/xtradb/buf/buf0flu.cc
Expand Up @@ -67,12 +67,6 @@ UNIV_INTERN mysql_pfs_key_t buf_page_cleaner_thread_key;
UNIV_INTERN mysql_pfs_key_t buf_lru_manager_thread_key;
#endif /* UNIV_PFS_THREAD */

/** If LRU list of a buf_pool is less than this size then LRU eviction
should not happen. This is because when we do LRU flushing we also put
the blocks on free list. If LRU list is very small then we can end up
in thrashing. */
#define BUF_LRU_MIN_LEN 256

/* @} */

/** Handled page counters for a single flush */
Expand Down
2 changes: 1 addition & 1 deletion storage/xtradb/dict/dict0dict.cc
Expand Up @@ -1107,7 +1107,7 @@ dict_init(void)
&dict_operation_lock, SYNC_DICT_OPERATION);

if (!srv_read_only_mode) {
dict_foreign_err_file = os_file_create_tmpfile();
dict_foreign_err_file = os_file_create_tmpfile(NULL);
ut_a(dict_foreign_err_file);

mutex_create(dict_foreign_err_mutex_key,
Expand Down
19 changes: 11 additions & 8 deletions storage/xtradb/dict/dict0stats.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (c) 2009, 2014, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, 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 the Free Software
Expand Down Expand Up @@ -1436,16 +1436,14 @@ on the leaf page.
when comparing records
@param[out] n_diff number of distinct records
@param[out] n_external_pages number of external pages
@param[in,out] mtr mini-transaction
@return number of distinct records on the leaf page */
static
void
dict_stats_analyze_index_below_cur(
const btr_cur_t* cur,
ulint n_prefix,
ib_uint64_t* n_diff,
ib_uint64_t* n_external_pages,
mtr_t* mtr)
ib_uint64_t* n_external_pages)
{
dict_index_t* index;
ulint space;
Expand All @@ -1459,6 +1457,7 @@ dict_stats_analyze_index_below_cur(
ulint* offsets2;
ulint* offsets_rec;
ulint size;
mtr_t mtr;

index = btr_cur_get_index(cur);

Expand Down Expand Up @@ -1497,12 +1496,14 @@ dict_stats_analyze_index_below_cur(
function without analyzing any leaf pages */
*n_external_pages = 0;

mtr_start(&mtr);

/* descend to the leaf level on the B-tree */
for (;;) {

block = buf_page_get_gen(space, zip_size, page_no, RW_S_LATCH,
NULL /* no guessed block */,
BUF_GET, __FILE__, __LINE__, mtr);
BUF_GET, __FILE__, __LINE__, &mtr);

page = buf_block_get_frame(block);

Expand All @@ -1524,6 +1525,8 @@ dict_stats_analyze_index_below_cur(
ut_a(*n_diff > 0);

if (*n_diff == 1) {
mtr_commit(&mtr);

/* page has all keys equal and the end of the page
was reached by dict_stats_scan_page(), no need to
descend to the leaf level */
Expand All @@ -1548,7 +1551,7 @@ dict_stats_analyze_index_below_cur(
}

/* make sure we got a leaf page as a result from the above loop */
ut_ad(btr_page_get_level(page, mtr) == 0);
ut_ad(btr_page_get_level(page, &mtr) == 0);

/* scan the leaf page and find the number of distinct keys,
when looking only at the first n_prefix columns; also estimate
Expand All @@ -1565,6 +1568,7 @@ dict_stats_analyze_index_below_cur(
__func__, page_no, n_diff);
#endif

mtr_commit(&mtr);
mem_heap_free(heap);
}

Expand Down Expand Up @@ -1774,8 +1778,7 @@ dict_stats_analyze_index_for_n_prefix(
dict_stats_analyze_index_below_cur(btr_pcur_get_btr_cur(&pcur),
n_prefix,
&n_diff_on_leaf_page,
&n_external_pages,
mtr);
&n_external_pages);

/* We adjust n_diff_on_leaf_page here to avoid counting
one record twice - once as the last on some page and once
Expand Down
11 changes: 6 additions & 5 deletions storage/xtradb/fts/fts0opt.cc
Expand Up @@ -580,7 +580,7 @@ fts_zip_read_word(
#ifdef UNIV_DEBUG
ulint i;
#endif
byte len = 0;
short len = 0;
void* null = NULL;
byte* ptr = word->f_str;
int flush = Z_NO_FLUSH;
Expand All @@ -590,7 +590,7 @@ fts_zip_read_word(
return(NULL);
}

zip->zp->next_out = &len;
zip->zp->next_out = reinterpret_cast<byte*>(&len);
zip->zp->avail_out = sizeof(len);

while (zip->status == Z_OK && zip->zp->avail_out > 0) {
Expand Down Expand Up @@ -688,11 +688,12 @@ fts_fetch_index_words(
fts_zip_t* zip = static_cast<fts_zip_t*>(user_arg);
que_node_t* exp = sel_node->select_list;
dfield_t* dfield = que_node_get_val(exp);
byte len = (byte) dfield_get_len(dfield);
short len = static_cast<short>(dfield_get_len(dfield));
void* data = dfield_get_data(dfield);

/* Skip the duplicate words. */
if (zip->word.f_len == len && !memcmp(zip->word.f_str, data, len)) {
if (zip->word.f_len == static_cast<ulint>(len)
&& !memcmp(zip->word.f_str, data, len)) {

return(TRUE);
}
Expand All @@ -706,7 +707,7 @@ fts_fetch_index_words(
ut_a(zip->zp->next_in == NULL);

/* The string is prefixed by len. */
zip->zp->next_in = &len;
zip->zp->next_in = reinterpret_cast<byte*>(&len);
zip->zp->avail_in = sizeof(len);

/* Compress the word, create output blocks as necessary. */
Expand Down

0 comments on commit cfad394

Please sign in to comment.