Skip to content

Commit 3629f62

Browse files
committed
Merge branch 'merge/merge-innodb-5.6' into 10.0
2 parents 77ce4ea + 094f140 commit 3629f62

File tree

8 files changed

+98
-13
lines changed

8 files changed

+98
-13
lines changed

storage/innobase/fts/fts0fts.cc

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ UNIV_INTERN mysql_pfs_key_t fts_pll_tokenize_mutex_key;
108108
/** variable to record innodb_fts_internal_tbl_name for information
109109
schema table INNODB_FTS_INSERTED etc. */
110110
UNIV_INTERN char* fts_internal_tbl_name = NULL;
111+
UNIV_INTERN char* fts_internal_tbl_name2 = NULL;
111112

112113
/** InnoDB default stopword list:
113114
There are different versions of stopwords, the stop words listed
@@ -6570,6 +6571,36 @@ fts_check_corrupt_index(
65706571
return(0);
65716572
}
65726573

6574+
/* Get parent table name if it's a fts aux table
6575+
@param[in] aux_table_name aux table name
6576+
@param[in] aux_table_len aux table length
6577+
@return parent table name, or NULL */
6578+
char*
6579+
fts_get_parent_table_name(
6580+
const char* aux_table_name,
6581+
ulint aux_table_len)
6582+
{
6583+
fts_aux_table_t aux_table;
6584+
char* parent_table_name = NULL;
6585+
6586+
if (fts_is_aux_table_name(&aux_table, aux_table_name, aux_table_len)) {
6587+
dict_table_t* parent_table;
6588+
6589+
parent_table = dict_table_open_on_id(
6590+
aux_table.parent_id, TRUE, DICT_TABLE_OP_NORMAL);
6591+
6592+
if (parent_table != NULL) {
6593+
parent_table_name = mem_strdupl(
6594+
parent_table->name,
6595+
strlen(parent_table->name));
6596+
6597+
dict_table_close(parent_table, TRUE, FALSE);
6598+
}
6599+
}
6600+
6601+
return(parent_table_name);
6602+
}
6603+
65736604
/** Check the validity of the parent table.
65746605
@param[in] aux_table auxiliary table
65756606
@return true if it is a valid table or false if it is not */

storage/innobase/handler/ha_innodb.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15010,7 +15010,12 @@ innodb_internal_table_update(
1501015010
my_free(old);
1501115011
}
1501215012

15013-
fts_internal_tbl_name = *(char**) var_ptr;
15013+
fts_internal_tbl_name2 = *(char**) var_ptr;
15014+
if (fts_internal_tbl_name2 == NULL) {
15015+
fts_internal_tbl_name = const_cast<char*>("default");
15016+
} else {
15017+
fts_internal_tbl_name = fts_internal_tbl_name2;
15018+
}
1501415019
}
1501515020

1501615021
/****************************************************************//**
@@ -16793,7 +16798,7 @@ static MYSQL_SYSVAR_BOOL(disable_sort_file_cache, srv_disable_sort_file_cache,
1679316798
"Whether to disable OS system file cache for sort I/O",
1679416799
NULL, NULL, FALSE);
1679516800

16796-
static MYSQL_SYSVAR_STR(ft_aux_table, fts_internal_tbl_name,
16801+
static MYSQL_SYSVAR_STR(ft_aux_table, fts_internal_tbl_name2,
1679716802
PLUGIN_VAR_NOCMDARG,
1679816803
"FTS internal auxiliary table to be checked",
1679916804
innodb_internal_table_validate,

storage/innobase/handler/handler0alter.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,10 @@ innobase_need_rebuild(
209209
const Alter_inplace_info* ha_alter_info,
210210
const TABLE* altered_table)
211211
{
212-
if (ha_alter_info->handler_flags
212+
Alter_inplace_info::HA_ALTER_FLAGS alter_inplace_flags =
213+
ha_alter_info->handler_flags & ~(INNOBASE_INPLACE_IGNORE);
214+
215+
if (alter_inplace_flags
213216
== Alter_inplace_info::CHANGE_CREATE_OPTION
214217
&& !(ha_alter_info->create_info->used_fields
215218
& (HA_CREATE_USED_ROW_FORMAT
@@ -3933,7 +3936,7 @@ ha_innobase::prepare_inplace_alter_table(
39333936
}
39343937

39353938
if (!(ha_alter_info->handler_flags & INNOBASE_ALTER_DATA)
3936-
|| (ha_alter_info->handler_flags
3939+
|| ((ha_alter_info->handler_flags & ~INNOBASE_INPLACE_IGNORE)
39373940
== Alter_inplace_info::CHANGE_CREATE_OPTION
39383941
&& !innobase_need_rebuild(ha_alter_info, table))) {
39393942

@@ -4107,7 +4110,7 @@ ha_innobase::inplace_alter_table(
41074110
DBUG_RETURN(false);
41084111
}
41094112

4110-
if (ha_alter_info->handler_flags
4113+
if ((ha_alter_info->handler_flags & ~INNOBASE_INPLACE_IGNORE)
41114114
== Alter_inplace_info::CHANGE_CREATE_OPTION
41124115
&& !innobase_need_rebuild(ha_alter_info, table)) {
41134116
goto ok_exit;

storage/innobase/handler/i_s.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3981,6 +3981,8 @@ i_s_fts_config_fill(
39813981
DBUG_RETURN(0);
39823982
}
39833983

3984+
DEBUG_SYNC_C("i_s_fts_config_fille_check");
3985+
39843986
fields = table->field;
39853987

39863988
/* Prevent DDL to drop fts aux tables. */

storage/innobase/include/fts0fts.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@ extern bool fts_need_sync;
375375
/** Variable specifying the table that has Fulltext index to display its
376376
content through information schema table */
377377
extern char* fts_internal_tbl_name;
378+
extern char* fts_internal_tbl_name2;
378379

379380
#define fts_que_graph_free(graph) \
380381
do { \
@@ -823,6 +824,15 @@ void
823824
fts_drop_orphaned_tables(void);
824825
/*==========================*/
825826

827+
/* Get parent table name if it's a fts aux table
828+
@param[in] aux_table_name aux table name
829+
@param[in] aux_table_len aux table length
830+
@return parent table name, or NULL */
831+
char*
832+
fts_get_parent_table_name(
833+
const char* aux_table_name,
834+
ulint aux_table_len);
835+
826836
/******************************************************************//**
827837
Since we do a horizontal split on the index table, we need to drop
828838
all the split tables.

storage/innobase/include/univ.i

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Created 1/20/1994 Heikki Tuuri
4444

4545
#define INNODB_VERSION_MAJOR 5
4646
#define INNODB_VERSION_MINOR 6
47-
#define INNODB_VERSION_BUGFIX 32
47+
#define INNODB_VERSION_BUGFIX 33
4848

4949
/* The following is the InnoDB version as shown in
5050
SELECT plugin_version FROM information_schema.plugins;

storage/innobase/row/row0log.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ row_log_table_delete(
613613
&old_pk_extra_size);
614614
ut_ad(old_pk_extra_size < 0x100);
615615

616-
mrec_size = 4 + old_pk_size;
616+
mrec_size = 6 + old_pk_size;
617617

618618
/* Log enough prefix of the BLOB unless both the
619619
old and new table are in COMPACT or REDUNDANT format,
@@ -643,8 +643,8 @@ row_log_table_delete(
643643
*b++ = static_cast<byte>(old_pk_extra_size);
644644

645645
/* Log the size of external prefix we saved */
646-
mach_write_to_2(b, ext_size);
647-
b += 2;
646+
mach_write_to_4(b, ext_size);
647+
b += 4;
648648

649649
rec_convert_dtuple_to_temp(
650650
b + old_pk_extra_size, new_index,
@@ -2268,14 +2268,14 @@ row_log_table_apply_op(
22682268
break;
22692269

22702270
case ROW_T_DELETE:
2271-
/* 1 (extra_size) + 2 (ext_size) + at least 1 (payload) */
2272-
if (mrec + 4 >= mrec_end) {
2271+
/* 1 (extra_size) + 4 (ext_size) + at least 1 (payload) */
2272+
if (mrec + 6 >= mrec_end) {
22732273
return(NULL);
22742274
}
22752275

22762276
extra_size = *mrec++;
2277-
ext_size = mach_read_from_2(mrec);
2278-
mrec += 2;
2277+
ext_size = mach_read_from_4(mrec);
2278+
mrec += 4;
22792279
ut_ad(mrec < mrec_end);
22802280

22812281
/* We assume extra_size < 0x100 for the PRIMARY KEY prefix.

storage/innobase/row/row0mysql.cc

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2715,6 +2715,10 @@ row_drop_tables_for_mysql_in_background(void)
27152715
return(n_tables + n_tables_dropped);
27162716
}
27172717

2718+
DBUG_EXECUTE_IF("row_drop_tables_in_background_sleep",
2719+
os_thread_sleep(5000000);
2720+
);
2721+
27182722
table = dict_table_open_on_name(drop->table_name, FALSE, FALSE,
27192723
DICT_ERR_IGNORE_NONE);
27202724

@@ -2725,6 +2729,16 @@ row_drop_tables_for_mysql_in_background(void)
27252729
goto already_dropped;
27262730
}
27272731

2732+
if (!table->to_be_dropped) {
2733+
/* There is a scenario: the old table is dropped
2734+
just after it's added into drop list, and new
2735+
table with the same name is created, then we try
2736+
to drop the new table in background. */
2737+
dict_table_close(table, FALSE, FALSE);
2738+
2739+
goto already_dropped;
2740+
}
2741+
27282742
ut_a(!table->can_be_evicted);
27292743

27302744
dict_table_close(table, FALSE, FALSE);
@@ -3992,6 +4006,13 @@ row_drop_table_for_mysql(
39924006
}
39934007
}
39944008

4009+
4010+
DBUG_EXECUTE_IF("row_drop_table_add_to_background",
4011+
row_add_table_to_background_drop_list(table->name);
4012+
err = DB_SUCCESS;
4013+
goto funct_exit;
4014+
);
4015+
39954016
/* TODO: could we replace the counter n_foreign_key_checks_running
39964017
with lock checks on the table? Acquire here an exclusive lock on the
39974018
table, and rewrite lock0lock.cc and the lock wait in srv0srv.cc so that
@@ -4608,6 +4629,19 @@ row_drop_database_for_mysql(
46084629
row_mysql_lock_data_dictionary(trx);
46094630

46104631
while ((table_name = dict_get_first_table_name_in_db(name))) {
4632+
/* Drop parent table if it is a fts aux table, to
4633+
avoid accessing dropped fts aux tables in information
4634+
scheam when parent table still exists.
4635+
Note: Drop parent table will drop fts aux tables. */
4636+
char* parent_table_name;
4637+
parent_table_name = fts_get_parent_table_name(
4638+
table_name, strlen(table_name));
4639+
4640+
if (parent_table_name != NULL) {
4641+
mem_free(table_name);
4642+
table_name = parent_table_name;
4643+
}
4644+
46114645
ut_a(memcmp(table_name, name, namelen) == 0);
46124646

46134647
table = dict_table_open_on_name(

0 commit comments

Comments
 (0)