Skip to content

Commit 484e719

Browse files
Merge branch 'mysql-5.6' into mysql-5.7
2 parents fdbdce7 + a4ea462 commit 484e719

File tree

2 files changed

+43
-3
lines changed

2 files changed

+43
-3
lines changed

storage/innobase/fts/fts0fts.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,8 @@ fts_drop_index(
834834

835835
err = fts_drop_index_tables(trx, index);
836836

837-
while (index->index_fts_syncing) {
837+
while (index->index_fts_syncing
838+
&& !trx_is_interrupted(trx)) {
838839
DICT_BG_YIELD(trx);
839840
}
840841

@@ -843,7 +844,8 @@ fts_drop_index(
843844
return(err);
844845
}
845846

846-
while (index->index_fts_syncing) {
847+
while (index->index_fts_syncing
848+
&& !trx_is_interrupted(trx)) {
847849
DICT_BG_YIELD(trx);
848850
}
849851

@@ -864,7 +866,8 @@ fts_drop_index(
864866
index_cache = fts_find_index_cache(cache, index);
865867

866868
if (index_cache != NULL) {
867-
while (index->index_fts_syncing) {
869+
while (index->index_fts_syncing
870+
&& !trx_is_interrupted(trx)) {
868871
DICT_BG_YIELD(trx);
869872
}
870873

storage/innobase/handler/ha_innodb.cc

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13140,6 +13140,37 @@ innobase_rename_table(
1314013140

1314113141
row_mysql_lock_data_dictionary(trx);
1314213142

13143+
dict_table_t* table = NULL;
13144+
table = dict_table_open_on_name(norm_from, TRUE, FALSE,
13145+
DICT_ERR_IGNORE_NONE);
13146+
13147+
/* Since DICT_BG_YIELD has sleep for 250 milliseconds,
13148+
Convert lock_wait_timeout unit from second to 250 milliseconds */
13149+
long int lock_wait_timeout = thd_lock_wait_timeout(thd) * 4;
13150+
if (table != NULL) {
13151+
for (dict_index_t* index = dict_table_get_first_index(table);
13152+
index != NULL;
13153+
index = dict_table_get_next_index(index)) {
13154+
13155+
if (index->type & DICT_FTS) {
13156+
/* Found */
13157+
while (index->index_fts_syncing
13158+
&& !trx_is_interrupted(trx)
13159+
&& (lock_wait_timeout--) > 0) {
13160+
DICT_BG_YIELD(trx);
13161+
}
13162+
}
13163+
}
13164+
dict_table_close(table, TRUE, FALSE);
13165+
}
13166+
13167+
/* FTS sync is in progress. We shall timeout this operation */
13168+
if (lock_wait_timeout < 0) {
13169+
error = DB_LOCK_WAIT_TIMEOUT;
13170+
row_mysql_unlock_data_dictionary(trx);
13171+
DBUG_RETURN(error);
13172+
}
13173+
1314313174
/* Transaction must be flagged as a locking transaction or it hasn't
1314413175
been started yet. */
1314513176

@@ -13304,6 +13335,12 @@ ha_innobase::rename_table(
1330413335
error = DB_ERROR;
1330513336
}
1330613337

13338+
else if (error == DB_LOCK_WAIT_TIMEOUT) {
13339+
my_error(ER_LOCK_WAIT_TIMEOUT, MYF(0), to);
13340+
13341+
error = DB_LOCK_WAIT;
13342+
}
13343+
1330713344
DBUG_RETURN(convert_error_code_to_mysql(error, 0, NULL));
1330813345
}
1330913346

0 commit comments

Comments
 (0)