summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2019-01-24 16:48:39 +0100
committerOleksandr Byelkin <sanja@mariadb.com>2019-01-24 16:48:39 +0100
commit3262afc6c50bdee489dd35feb8c5254dbc93494b (patch)
tree1b9bb0f533ca8d171f6ea94fe4e748066e2edc28
parentbbcb1734365b0e81d7d82e1d3d9e37074048970e (diff)
downloadmariadb-git-3262afc6c50bdee489dd35feb8c5254dbc93494b.tar.gz
5.6.42-84.2
-rw-r--r--storage/xtradb/handler/ha_innodb.cc5
-rw-r--r--storage/xtradb/handler/handler0alter.cc35
-rw-r--r--storage/xtradb/include/os0file.h6
-rw-r--r--storage/xtradb/include/univ.i2
-rw-r--r--storage/xtradb/log/log0online.cc41
-rw-r--r--storage/xtradb/row/row0merge.cc17
-rw-r--r--storage/xtradb/row/row0mysql.cc15
-rw-r--r--storage/xtradb/row/row0sel.cc4
8 files changed, 99 insertions, 26 deletions
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc
index 053a181e26c..1ff50136859 100644
--- a/storage/xtradb/handler/ha_innodb.cc
+++ b/storage/xtradb/handler/ha_innodb.cc
@@ -2322,6 +2322,11 @@ innobase_get_lower_case_table_names(void)
{
return(lower_case_table_names);
}
+/** return one of the tmpdir path
+@return tmpdir path*/
+UNIV_INTERN
+char*
+innobase_mysql_tmpdir(void) { return (mysql_tmpdir); }
/** Create a temporary file in the location specified by the parameter
path. If the path is null, then it will be created in tmpdir.
diff --git a/storage/xtradb/handler/handler0alter.cc b/storage/xtradb/handler/handler0alter.cc
index 517dd30410b..856f8bac8de 100644
--- a/storage/xtradb/handler/handler0alter.cc
+++ b/storage/xtradb/handler/handler0alter.cc
@@ -4056,11 +4056,23 @@ oom:
table. Either way, we should be seeing and
reporting a bogus duplicate key error. */
dup_key = NULL;
- } else {
- DBUG_ASSERT(prebuilt->trx->error_key_num
- < ha_alter_info->key_count);
+ } else if (prebuilt->trx->error_key_num == 0) {
dup_key = &ha_alter_info->key_info_buffer[
prebuilt->trx->error_key_num];
+ } else {
+ /* Check if there is generated cluster index column */
+ if (ctx->num_to_add_index > ha_alter_info->key_count) {
+ DBUG_ASSERT(prebuilt->trx->error_key_num
+ <= ha_alter_info->key_count);
+ dup_key = &ha_alter_info->key_info_buffer[
+ prebuilt->trx->error_key_num - 1];
+ }
+ else {
+ DBUG_ASSERT(prebuilt->trx->error_key_num
+ < ha_alter_info->key_count);
+ dup_key = &ha_alter_info->key_info_buffer[
+ prebuilt->trx->error_key_num];
+ }
}
print_keydup_error(altered_table, dup_key, MYF(0));
break;
@@ -4981,11 +4993,20 @@ commit_try_rebuild(
FTS_DOC_ID. */
dup_key = NULL;
} else {
- DBUG_ASSERT(err_key <
- ha_alter_info->key_count);
- dup_key = &ha_alter_info
- ->key_info_buffer[err_key];
+ if (ctx->num_to_add_index > ha_alter_info->key_count) {
+ DBUG_ASSERT(err_key <=
+ ha_alter_info->key_count);
+ dup_key = &ha_alter_info
+ ->key_info_buffer[err_key - 1];
+ }
+ else {
+ DBUG_ASSERT(err_key <
+ ha_alter_info->key_count);
+ dup_key = &ha_alter_info
+ ->key_info_buffer[err_key];
+ }
}
+
print_keydup_error(altered_table, dup_key, MYF(0));
DBUG_RETURN(true);
case DB_ONLINE_LOG_TOO_BIG:
diff --git a/storage/xtradb/include/os0file.h b/storage/xtradb/include/os0file.h
index f7531d99f38..bc7e468b776 100644
--- a/storage/xtradb/include/os0file.h
+++ b/storage/xtradb/include/os0file.h
@@ -1,6 +1,6 @@
/***********************************************************************
-Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2018, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
Portions of this file contain modifications contributed and copyrighted
@@ -1531,6 +1531,10 @@ os_file_get_status(
file can be opened in RW mode */
#if !defined(UNIV_HOTBACKUP)
+
+/** return one of the tmpdir path
+ @return tmpdir path*/
+char *innobase_mysql_tmpdir(void);
/** Create a temporary file in the location specified by the parameter
path. If the path is null, then it will be created in tmpdir.
@param[in] path location for creating temporary file
diff --git a/storage/xtradb/include/univ.i b/storage/xtradb/include/univ.i
index f625ea46433..4904e174b87 100644
--- a/storage/xtradb/include/univ.i
+++ b/storage/xtradb/include/univ.i
@@ -47,7 +47,7 @@ Created 1/20/1994 Heikki Tuuri
#define INNODB_VERSION_BUGFIX MYSQL_VERSION_PATCH
#ifndef PERCONA_INNODB_VERSION
-#define PERCONA_INNODB_VERSION 84.1
+#define PERCONA_INNODB_VERSION 84.2
#endif
/* Enable UNIV_LOG_ARCHIVE in XtraDB */
diff --git a/storage/xtradb/log/log0online.cc b/storage/xtradb/log/log0online.cc
index e3cfbfc2088..a3d76e79b2a 100644
--- a/storage/xtradb/log/log0online.cc
+++ b/storage/xtradb/log/log0online.cc
@@ -1880,6 +1880,8 @@ log_online_purge_changed_page_bitmaps(
for (i = 0; i < bitmap_files.count; i++) {
+ char full_bmp_file_name[2 * FN_REFLEN + 2];
+
/* We consider the end LSN of the current bitmap, derived from
the start LSN of the subsequent bitmap file, to determine
whether to remove the current bitmap. Note that bitmap_files
@@ -1895,8 +1897,45 @@ log_online_purge_changed_page_bitmaps(
break;
}
+
+ /* In some non-trivial cases the sequence of .xdb files may
+ have gaps. For instance:
+ ib_modified_log_1_0.xdb
+ ib_modified_log_2_<mmm>.xdb
+ ib_modified_log_4_<nnn>.xdb
+ Adding this check as a safety precaution. */
+ if (bitmap_files.files[i].name[0] == '\0')
+ continue;
+
+ /* If redo log tracking is enabled, reuse 'bmp_file_home'
+ from 'log_bmp_sys'. Otherwise, compose the full '.xdb' file
+ path from 'srv_data_home', adding a path separator if
+ necessary. */
+ if (log_bmp_sys != NULL) {
+ ut_snprintf(full_bmp_file_name,
+ sizeof(full_bmp_file_name),
+ "%s%s", log_bmp_sys->bmp_file_home,
+ bitmap_files.files[i].name);
+ }
+ else {
+ char separator[2] = {0, 0};
+ const size_t srv_data_home_len =
+ strlen(srv_data_home);
+
+ ut_a(srv_data_home_len < FN_REFLEN);
+ if (srv_data_home_len != 0 &&
+ srv_data_home[srv_data_home_len - 1] !=
+ SRV_PATH_SEPARATOR) {
+ separator[0] = SRV_PATH_SEPARATOR;
+ }
+ ut_snprintf(full_bmp_file_name,
+ sizeof(full_bmp_file_name), "%s%s%s",
+ srv_data_home, separator,
+ bitmap_files.files[i].name);
+ }
+
if (!os_file_delete_if_exists(innodb_file_bmp_key,
- bitmap_files.files[i].name)) {
+ full_bmp_file_name)) {
os_file_get_last_error(TRUE);
result = TRUE;
diff --git a/storage/xtradb/row/row0merge.cc b/storage/xtradb/row/row0merge.cc
index b000f313d67..507709ce12b 100644
--- a/storage/xtradb/row/row0merge.cc
+++ b/storage/xtradb/row/row0merge.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2005, 2017, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2005, 2018, 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
@@ -3129,15 +3129,27 @@ row_merge_file_create_low(
const char* path)
{
int fd;
+ char filename[] = "Innodb Merge Temp File\0";
+ char* filepath = NULL;
+ int path_len;
+ if (path == NULL) {
+ path = innobase_mysql_tmpdir();
+ }
#ifdef UNIV_PFS_IO
/* This temp file open does not go through normal
file APIs, add instrumentation to register with
performance schema */
+ path_len = strlen(path) + sizeof "/" + strlen(filename)+1;
+ filepath = static_cast<char*>(mem_alloc(path_len));
+ memcpy(filepath,path,strlen(path));
+ ut_snprintf(filepath + strlen(path),path_len - strlen(path),
+ "%c%s",'/',filename);
struct PSI_file_locker* locker = NULL;
+
PSI_file_locker_state state;
locker = PSI_FILE_CALL(get_thread_file_name_locker)(
&state, innodb_file_temp_key, PSI_FILE_OPEN,
- "Innodb Merge Temp File", &locker);
+ filepath, &locker);
if (locker != NULL) {
PSI_FILE_CALL(start_file_open_wait)(locker,
__FILE__,
@@ -3150,6 +3162,7 @@ row_merge_file_create_low(
PSI_FILE_CALL(end_file_open_wait_and_bind_to_descriptor)(
locker, fd);
}
+ mem_free(filepath);
#endif
if (fd < 0) {
diff --git a/storage/xtradb/row/row0mysql.cc b/storage/xtradb/row/row0mysql.cc
index ddde8b8f730..9fc5c669ba0 100644
--- a/storage/xtradb/row/row0mysql.cc
+++ b/storage/xtradb/row/row0mysql.cc
@@ -5500,18 +5500,6 @@ row_rename_table_for_mysql(
goto funct_exit;
}
- /* Wait for background fts sync to finish */
- for (retry = 1; dict_fts_index_syncing(table); ++retry) {
- DICT_BG_YIELD(trx);
- if (retry % 100 == 0) {
- ib_logf(IB_LOG_LEVEL_INFO,
- "Unable to rename table %s to new name"
- " %s because FTS sync is running on table."
- " Retrying\n",
- old_name, new_name);
- }
- }
-
/* We use the private SQL parser of Innobase to generate the query
graphs needed in updating the dictionary data from system tables. */
@@ -5669,6 +5657,9 @@ row_rename_table_for_mysql(
" = TO_BINARY(:old_table_name);\n"
"END;\n"
, FALSE, trx);
+ if (err != DB_SUCCESS) {
+ goto end;
+ }
} else if (n_constraints_to_drop > 0) {
/* Drop some constraints of tmp tables. */
diff --git a/storage/xtradb/row/row0sel.cc b/storage/xtradb/row/row0sel.cc
index 5db61ecdd56..0edad710d79 100644
--- a/storage/xtradb/row/row0sel.cc
+++ b/storage/xtradb/row/row0sel.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1997, 2018, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
@@ -4416,7 +4416,7 @@ rec_loop:
passed to InnoDB when there is no ICP and number of loops
in row_search_for_mysql for rows found but not
reporting due to search views etc. */
- if (prev_rec != NULL
+ if (prev_rec != NULL && !prebuilt->innodb_api
&& prebuilt->mysql_handler->end_range != NULL
&& prebuilt->idx_cond == NULL
&& end_loop >= 100) {