summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2018-10-28 01:10:15 +0200
committerSergei Golubchik <serg@mariadb.org>2018-10-28 01:22:18 +0200
commit87d852f102a7f733a774252d9a446377ac51a976 (patch)
treecd54a22ca68b201daa24e449d9ce63858d257f0c /storage
parent37ab7e45963627f3c1ea2dd43d5b305de37bb16f (diff)
parentda34c7de5dacac85c4dc1f714bcd7edf3b7fe5f9 (diff)
downloadmariadb-git-87d852f102a7f733a774252d9a446377ac51a976.tar.gz
Merge branch 'merge/merge-innodb-5.6' into 10.0
Diffstat (limited to 'storage')
-rw-r--r--storage/innobase/dict/dict0dict.cc7
-rw-r--r--storage/innobase/fts/fts0fts.cc20
-rw-r--r--storage/innobase/handler/ha_innodb.cc68
-rw-r--r--storage/innobase/handler/handler0alter.cc35
-rw-r--r--storage/innobase/include/os0file.h6
-rw-r--r--storage/innobase/row/row0import.cc1
-rw-r--r--storage/innobase/row/row0merge.cc5
-rw-r--r--storage/innobase/row/row0mysql.cc3
-rw-r--r--storage/innobase/row/row0sel.cc2
9 files changed, 93 insertions, 54 deletions
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index 7575a4aed62..6c5df41e90d 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 2018, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2014, 2017, MariaDB Corporation.
@@ -3370,7 +3370,10 @@ dict_foreign_find_index(
table, col_names, columns, n_cols,
index, types_idx,
check_charsets, check_null,
- error, err_col_no,err_index)) {
+ error, err_col_no,err_index)
+ && (!(index->online_status ==
+ ONLINE_INDEX_ABORTED_DROPPED
+ ||index->online_status == ONLINE_INDEX_ABORTED))) {
if (error) {
*error = DB_SUCCESS;
}
diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc
index 4891e572741..d4ca9cb3660 100644
--- a/storage/innobase/fts/fts0fts.cc
+++ b/storage/innobase/fts/fts0fts.cc
@@ -870,19 +870,19 @@ fts_drop_index(
err = fts_drop_index_tables(trx, index);
while (index->index_fts_syncing
- && !trx_is_interrupted(trx)) {
- DICT_BG_YIELD(trx);
- }
+ && !trx_is_interrupted(trx)) {
+ DICT_BG_YIELD(trx);
+ }
- fts_free(table);
+ fts_free(table);
return(err);
}
while (index->index_fts_syncing
- && !trx_is_interrupted(trx)) {
- DICT_BG_YIELD(trx);
- }
+ && !trx_is_interrupted(trx)) {
+ DICT_BG_YIELD(trx);
+ }
current_doc_id = table->fts->cache->next_doc_id;
first_doc_id = table->fts->cache->first_doc_id;
@@ -901,9 +901,9 @@ fts_drop_index(
if (index_cache != NULL) {
while (index->index_fts_syncing
- && !trx_is_interrupted(trx)) {
- DICT_BG_YIELD(trx);
- }
+ && !trx_is_interrupted(trx)) {
+ DICT_BG_YIELD(trx);
+ }
if (index_cache->words) {
fts_words_free(index_cache->words);
rbt_free(index_cache->words);
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 2092cd113a5..c775a89918c 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -2015,6 +2015,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.
@@ -10903,35 +10908,36 @@ innobase_rename_table(
row_mysql_lock_data_dictionary(trx);
- dict_table_t* table = dict_table_open_on_name(norm_from, TRUE, FALSE,
- DICT_ERR_IGNORE_NONE);
+ dict_table_t* table = NULL;
+ table = dict_table_open_on_name(norm_from, TRUE, FALSE,
+ DICT_ERR_IGNORE_NONE);
- /* Since DICT_BG_YIELD has sleep for 250 milliseconds,
+ /* Since DICT_BG_YIELD has sleep for 250 milliseconds,
Convert lock_wait_timeout unit from second to 250 milliseconds */
- long int lock_wait_timeout = thd_lock_wait_timeout(thd) * 4;
- if (table != NULL) {
- for (dict_index_t* index = dict_table_get_first_index(table);
- index != NULL;
- index = dict_table_get_next_index(index)) {
-
- if (index->type & DICT_FTS) {
- /* Found */
- while (index->index_fts_syncing
- && !trx_is_interrupted(trx)
- && (lock_wait_timeout--) > 0) {
- DICT_BG_YIELD(trx);
- }
- }
- }
- dict_table_close(table, TRUE, FALSE);
- }
+ long int lock_wait_timeout = thd_lock_wait_timeout(thd) * 4;
+ if (table != NULL) {
+ for (dict_index_t* index = dict_table_get_first_index(table);
+ index != NULL;
+ index = dict_table_get_next_index(index)) {
+
+ if (index->type & DICT_FTS) {
+ /* Found */
+ while (index->index_fts_syncing
+ && !trx_is_interrupted(trx)
+ && (lock_wait_timeout--) > 0) {
+ DICT_BG_YIELD(trx);
+ }
+ }
+ }
+ dict_table_close(table, TRUE, FALSE);
+ }
- /* FTS sync is in progress. We shall timeout this operation */
- if (lock_wait_timeout < 0) {
- error = DB_LOCK_WAIT_TIMEOUT;
- row_mysql_unlock_data_dictionary(trx);
- DBUG_RETURN(error);
- }
+ /* FTS sync is in progress. We shall timeout this operation */
+ if (lock_wait_timeout < 0) {
+ error = DB_LOCK_WAIT_TIMEOUT;
+ row_mysql_unlock_data_dictionary(trx);
+ DBUG_RETURN(error);
+ }
/* Transaction must be flagged as a locking transaction or it hasn't
been started yet. */
@@ -11086,12 +11092,14 @@ ha_innobase::rename_table(
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), to);
error = DB_ERROR;
- } else if (error == DB_LOCK_WAIT_TIMEOUT) {
- my_error(ER_LOCK_WAIT_TIMEOUT, MYF(0), to);
-
- error = DB_LOCK_WAIT;
}
+ else if (error == DB_LOCK_WAIT_TIMEOUT) {
+ my_error(ER_LOCK_WAIT_TIMEOUT, MYF(0), to);
+
+ error = DB_LOCK_WAIT;
+ }
+
DBUG_RETURN(convert_error_code_to_mysql(error, 0, NULL));
}
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index 8d5eefc4f2b..8f95772268c 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -4173,11 +4173,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;
@@ -5105,11 +5117,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/innobase/include/os0file.h b/storage/innobase/include/os0file.h
index a78e3d64773..e73aeca6e5a 100644
--- a/storage/innobase/include/os0file.h
+++ b/storage/innobase/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.
Copyright (c) 2013, 2017, MariaDB Corporation.
@@ -1314,6 +1314,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/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc
index ea020fac56e..5c42ab6f2bb 100644
--- a/storage/innobase/row/row0import.cc
+++ b/storage/innobase/row/row0import.cc
@@ -3830,4 +3830,3 @@ row_import_for_mysql(
return(row_import_cleanup(prebuilt, trx, err));
}
-
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index ec9b8f79e49..5d3e2d2cca6 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/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.
Copyright (c) 2014, 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
@@ -3138,9 +3138,10 @@ row_merge_file_create_low(
file APIs, add instrumentation to register with
performance schema */
struct PSI_file_locker* locker = NULL;
+
PSI_file_locker_state state;
if (!path) {
- path = mysql_tmpdir;
+ path = innobase_mysql_tmpdir();
}
static const char label[] = "/Innodb Merge Temp File";
char* name = static_cast<char*>(
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index c997c9f98ab..ae3f99fac68 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -5135,6 +5135,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/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc
index 8397269d8db..9426953d173 100644
--- a/storage/innobase/row/row0sel.cc
+++ b/storage/innobase/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.
Copyright (c) 2015, 2018, MariaDB Corporation.