Skip to content

Commit 094f140

Browse files
committed
5.6.33
1 parent b4f97a1 commit 094f140

File tree

7 files changed

+97
-12
lines changed

7 files changed

+97
-12
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
@@ -6569,6 +6570,36 @@ fts_check_corrupt_index(
65696570
return(0);
65706571
}
65716572

6573+
/* Get parent table name if it's a fts aux table
6574+
@param[in] aux_table_name aux table name
6575+
@param[in] aux_table_len aux table length
6576+
@return parent table name, or NULL */
6577+
char*
6578+
fts_get_parent_table_name(
6579+
const char* aux_table_name,
6580+
ulint aux_table_len)
6581+
{
6582+
fts_aux_table_t aux_table;
6583+
char* parent_table_name = NULL;
6584+
6585+
if (fts_is_aux_table_name(&aux_table, aux_table_name, aux_table_len)) {
6586+
dict_table_t* parent_table;
6587+
6588+
parent_table = dict_table_open_on_id(
6589+
aux_table.parent_id, TRUE, DICT_TABLE_OP_NORMAL);
6590+
6591+
if (parent_table != NULL) {
6592+
parent_table_name = mem_strdupl(
6593+
parent_table->name,
6594+
strlen(parent_table->name));
6595+
6596+
dict_table_close(parent_table, TRUE, FALSE);
6597+
}
6598+
}
6599+
6600+
return(parent_table_name);
6601+
}
6602+
65726603
/** Check the validity of the parent table.
65736604
@param[in] aux_table auxiliary table
65746605
@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
@@ -14505,7 +14505,12 @@ innodb_internal_table_update(
1450514505
my_free(old);
1450614506
}
1450714507

14508-
fts_internal_tbl_name = *(char**) var_ptr;
14508+
fts_internal_tbl_name2 = *(char**) var_ptr;
14509+
if (fts_internal_tbl_name2 == NULL) {
14510+
fts_internal_tbl_name = const_cast<char*>("default");
14511+
} else {
14512+
fts_internal_tbl_name = fts_internal_tbl_name2;
14513+
}
1450914514
}
1451014515

1451114516
/****************************************************************//**
@@ -16253,7 +16258,7 @@ static MYSQL_SYSVAR_BOOL(disable_sort_file_cache, srv_disable_sort_file_cache,
1625316258
"Whether to disable OS system file cache for sort I/O",
1625416259
NULL, NULL, FALSE);
1625516260

16256-
static MYSQL_SYSVAR_STR(ft_aux_table, fts_internal_tbl_name,
16261+
static MYSQL_SYSVAR_STR(ft_aux_table, fts_internal_tbl_name2,
1625716262
PLUGIN_VAR_NOCMDARG,
1625816263
"FTS internal auxiliary table to be checked",
1625916264
innodb_internal_table_validate,

storage/innobase/handler/handler0alter.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,10 @@ innobase_need_rebuild(
201201
/*==================*/
202202
const Alter_inplace_info* ha_alter_info)
203203
{
204-
if (ha_alter_info->handler_flags
204+
Alter_inplace_info::HA_ALTER_FLAGS alter_inplace_flags =
205+
ha_alter_info->handler_flags & ~(INNOBASE_INPLACE_IGNORE);
206+
207+
if (alter_inplace_flags
205208
== Alter_inplace_info::CHANGE_CREATE_OPTION
206209
&& !(ha_alter_info->create_info->used_fields
207210
& (HA_CREATE_USED_ROW_FORMAT
@@ -3760,7 +3763,7 @@ ha_innobase::prepare_inplace_alter_table(
37603763
}
37613764

37623765
if (!(ha_alter_info->handler_flags & INNOBASE_ALTER_DATA)
3763-
|| (ha_alter_info->handler_flags
3766+
|| ((ha_alter_info->handler_flags & ~INNOBASE_INPLACE_IGNORE)
37643767
== Alter_inplace_info::CHANGE_CREATE_OPTION
37653768
&& !innobase_need_rebuild(ha_alter_info))) {
37663769

@@ -3926,7 +3929,7 @@ ha_innobase::inplace_alter_table(
39263929
DBUG_RETURN(false);
39273930
}
39283931

3929-
if (ha_alter_info->handler_flags
3932+
if ((ha_alter_info->handler_flags & ~INNOBASE_INPLACE_IGNORE)
39303933
== Alter_inplace_info::CHANGE_CREATE_OPTION
39313934
&& !innobase_need_rebuild(ha_alter_info)) {
39323935
goto ok_exit;

storage/innobase/handler/i_s.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4038,6 +4038,8 @@ i_s_fts_config_fill(
40384038
DBUG_RETURN(0);
40394039
}
40404040

4041+
DEBUG_SYNC_C("i_s_fts_config_fille_check");
4042+
40414043
fields = table->field;
40424044

40434045
/* 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/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
@@ -2676,6 +2676,10 @@ row_drop_tables_for_mysql_in_background(void)
26762676
return(n_tables + n_tables_dropped);
26772677
}
26782678

2679+
DBUG_EXECUTE_IF("row_drop_tables_in_background_sleep",
2680+
os_thread_sleep(5000000);
2681+
);
2682+
26792683
table = dict_table_open_on_name(drop->table_name, FALSE, FALSE,
26802684
DICT_ERR_IGNORE_NONE);
26812685

@@ -2686,6 +2690,16 @@ row_drop_tables_for_mysql_in_background(void)
26862690
goto already_dropped;
26872691
}
26882692

2693+
if (!table->to_be_dropped) {
2694+
/* There is a scenario: the old table is dropped
2695+
just after it's added into drop list, and new
2696+
table with the same name is created, then we try
2697+
to drop the new table in background. */
2698+
dict_table_close(table, FALSE, FALSE);
2699+
2700+
goto already_dropped;
2701+
}
2702+
26892703
ut_a(!table->can_be_evicted);
26902704

26912705
dict_table_close(table, FALSE, FALSE);
@@ -3945,6 +3959,13 @@ row_drop_table_for_mysql(
39453959
}
39463960
}
39473961

3962+
3963+
DBUG_EXECUTE_IF("row_drop_table_add_to_background",
3964+
row_add_table_to_background_drop_list(table->name);
3965+
err = DB_SUCCESS;
3966+
goto funct_exit;
3967+
);
3968+
39483969
/* TODO: could we replace the counter n_foreign_key_checks_running
39493970
with lock checks on the table? Acquire here an exclusive lock on the
39503971
table, and rewrite lock0lock.cc and the lock wait in srv0srv.cc so that
@@ -4561,6 +4582,19 @@ row_drop_database_for_mysql(
45614582
row_mysql_lock_data_dictionary(trx);
45624583

45634584
while ((table_name = dict_get_first_table_name_in_db(name))) {
4585+
/* Drop parent table if it is a fts aux table, to
4586+
avoid accessing dropped fts aux tables in information
4587+
scheam when parent table still exists.
4588+
Note: Drop parent table will drop fts aux tables. */
4589+
char* parent_table_name;
4590+
parent_table_name = fts_get_parent_table_name(
4591+
table_name, strlen(table_name));
4592+
4593+
if (parent_table_name != NULL) {
4594+
mem_free(table_name);
4595+
table_name = parent_table_name;
4596+
}
4597+
45644598
ut_a(memcmp(table_name, name, namelen) == 0);
45654599

45664600
table = dict_table_open_on_name(

0 commit comments

Comments
 (0)