]>
Commit | Line | Data |
---|---|---|
b4e1fa2c AM |
1 | # name : control_online_alter_index.patch |
2 | # introduced : 12 | |
3 | # maintainer : Yasufumi | |
4 | # | |
5 | #!!! notice !!! | |
6 | # Any small change to this file in the main branch | |
7 | # should be done or reviewed by the maintainer! | |
db82db79 AM |
8 | --- a/sql/handler.h |
9 | +++ b/sql/handler.h | |
10 | @@ -206,6 +206,8 @@ | |
df1b5770 AM |
11 | #define HA_INPLACE_DROP_UNIQUE_INDEX_NO_WRITE (1L << 9) |
12 | #define HA_INPLACE_ADD_PK_INDEX_NO_WRITE (1L << 10) | |
13 | #define HA_INPLACE_DROP_PK_INDEX_NO_WRITE (1L << 11) | |
b4e1fa2c | 14 | + |
df1b5770 | 15 | +#define HA_INPLACE_ALTER_INDEX_MASK ((1L << 12) - 1) |
b4e1fa2c AM |
16 | /* |
17 | HA_PARTITION_FUNCTION_SUPPORTED indicates that the function is | |
18 | supported at all. | |
db82db79 AM |
19 | --- a/sql/sql_class.h |
20 | +++ b/sql/sql_class.h | |
1bfc1981 | 21 | @@ -479,6 +479,8 @@ |
b4e1fa2c AM |
22 | my_bool engine_condition_pushdown; |
23 | my_bool keep_files_on_create; | |
24 | ||
25 | + my_bool online_alter_index; | |
26 | + | |
27 | my_bool old_alter_table; | |
28 | my_bool old_passwords; | |
29 | my_bool big_tables; | |
db82db79 AM |
30 | --- a/sql/sql_partition.cc |
31 | +++ b/sql/sql_partition.cc | |
32 | @@ -4637,7 +4637,12 @@ | |
b4e1fa2c AM |
33 | alter_info->num_parts= curr_part_no - new_part_no; |
34 | } | |
35 | } | |
36 | - if (!(flags= new_table->file->alter_table_flags(alter_info->flags))) | |
37 | + flags= new_table->file->alter_table_flags(alter_info->flags); | |
38 | + if (!thd->variables.online_alter_index) | |
39 | + { | |
df1b5770 | 40 | + flags&= ~((uint)HA_INPLACE_ALTER_INDEX_MASK); |
b4e1fa2c AM |
41 | + } |
42 | + if (!flags) | |
43 | { | |
44 | my_error(ER_PARTITION_FUNCTION_FAILURE, MYF(0)); | |
45 | goto err; | |
db82db79 AM |
46 | --- a/sql/sql_table.cc |
47 | +++ b/sql/sql_table.cc | |
1bfc1981 | 48 | @@ -6146,6 +6146,10 @@ |
b4e1fa2c AM |
49 | uint *idx_end_p; |
50 | ||
51 | alter_flags= table->file->alter_table_flags(alter_info->flags); | |
52 | + if (!thd->variables.online_alter_index) | |
53 | + { | |
df1b5770 | 54 | + alter_flags&= ~((ulong)HA_INPLACE_ALTER_INDEX_MASK); |
b4e1fa2c AM |
55 | + } |
56 | DBUG_PRINT("info", ("alter_flags: %lu", alter_flags)); | |
57 | /* Check dropped indexes. */ | |
58 | for (idx_p= index_drop_buffer, idx_end_p= idx_p + index_drop_count; | |
db82db79 AM |
59 | --- a/sql/sys_vars.cc |
60 | +++ b/sql/sys_vars.cc | |
29ffd636 | 61 | @@ -2265,6 +2265,13 @@ |
b4e1fa2c AM |
62 | GLOBAL_VAR(opt_optimizer_fix), |
63 | NO_CMD_LINE, DEFAULT(TRUE)); | |
64 | ||
65 | +static Sys_var_mybool Sys_fast_index_creation( | |
66 | + "fast_index_creation", | |
67 | + "If disabled, suppresses online operations for indexes of ALTER TABLE " | |
68 | + "(e.g. fast index creation of InnoDB Plugin) for the session.", | |
69 | + SESSION_VAR(online_alter_index), NO_CMD_LINE, | |
70 | + DEFAULT(TRUE)); | |
71 | + | |
72 | /** propagates changes to the relevant flag of @@optimizer_switch */ | |
73 | static bool fix_engine_condition_pushdown(sys_var *self, THD *thd, | |
74 | enum_var_type type) |