]>
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! | |
8 | diff -ruN a/sql/handler.h b/sql/handler.h | |
9 | --- a/sql/handler.h 2010-11-03 07:01:14.000000000 +0900 | |
10 | +++ b/sql/handler.h 2010-12-03 13:51:04.727293058 +0900 | |
adf0fb13 | 11 | @@ -205,6 +205,8 @@ |
df1b5770 AM |
12 | #define HA_INPLACE_DROP_UNIQUE_INDEX_NO_WRITE (1L << 9) |
13 | #define HA_INPLACE_ADD_PK_INDEX_NO_WRITE (1L << 10) | |
14 | #define HA_INPLACE_DROP_PK_INDEX_NO_WRITE (1L << 11) | |
b4e1fa2c | 15 | + |
df1b5770 | 16 | +#define HA_INPLACE_ALTER_INDEX_MASK ((1L << 12) - 1) |
b4e1fa2c AM |
17 | /* |
18 | HA_PARTITION_FUNCTION_SUPPORTED indicates that the function is | |
19 | supported at all. | |
20 | diff -ruN a/sql/sql_class.h b/sql/sql_class.h | |
21 | --- a/sql/sql_class.h 2010-12-02 20:31:56.200956501 +0900 | |
22 | +++ b/sql/sql_class.h 2010-12-03 13:51:04.744953174 +0900 | |
23 | @@ -481,6 +481,8 @@ | |
24 | my_bool engine_condition_pushdown; | |
25 | my_bool keep_files_on_create; | |
26 | ||
27 | + my_bool online_alter_index; | |
28 | + | |
29 | my_bool old_alter_table; | |
30 | my_bool old_passwords; | |
31 | my_bool big_tables; | |
32 | diff -ruN a/sql/sql_partition.cc b/sql/sql_partition.cc | |
33 | --- a/sql/sql_partition.cc 2010-11-03 07:01:14.000000000 +0900 | |
34 | +++ b/sql/sql_partition.cc 2010-12-03 13:59:56.444039002 +0900 | |
d8778560 | 35 | @@ -4636,7 +4636,12 @@ |
b4e1fa2c AM |
36 | alter_info->num_parts= curr_part_no - new_part_no; |
37 | } | |
38 | } | |
39 | - if (!(flags= new_table->file->alter_table_flags(alter_info->flags))) | |
40 | + flags= new_table->file->alter_table_flags(alter_info->flags); | |
41 | + if (!thd->variables.online_alter_index) | |
42 | + { | |
df1b5770 | 43 | + flags&= ~((uint)HA_INPLACE_ALTER_INDEX_MASK); |
b4e1fa2c AM |
44 | + } |
45 | + if (!flags) | |
46 | { | |
47 | my_error(ER_PARTITION_FUNCTION_FAILURE, MYF(0)); | |
48 | goto err; | |
49 | diff -ruN a/sql/sql_table.cc b/sql/sql_table.cc | |
50 | --- a/sql/sql_table.cc 2010-11-03 07:01:14.000000000 +0900 | |
51 | +++ b/sql/sql_table.cc 2010-12-03 13:51:04.768955495 +0900 | |
adf0fb13 | 52 | @@ -6112,6 +6112,10 @@ |
b4e1fa2c AM |
53 | uint *idx_end_p; |
54 | ||
55 | alter_flags= table->file->alter_table_flags(alter_info->flags); | |
56 | + if (!thd->variables.online_alter_index) | |
57 | + { | |
df1b5770 | 58 | + alter_flags&= ~((ulong)HA_INPLACE_ALTER_INDEX_MASK); |
b4e1fa2c AM |
59 | + } |
60 | DBUG_PRINT("info", ("alter_flags: %lu", alter_flags)); | |
61 | /* Check dropped indexes. */ | |
62 | for (idx_p= index_drop_buffer, idx_end_p= idx_p + index_drop_count; | |
63 | diff -ruN a/sql/sys_vars.cc b/sql/sys_vars.cc | |
64 | --- a/sql/sys_vars.cc 2010-12-02 21:23:05.569356468 +0900 | |
65 | +++ b/sql/sys_vars.cc 2010-12-03 14:05:28.857356603 +0900 | |
adf0fb13 | 66 | @@ -2186,6 +2186,13 @@ |
b4e1fa2c AM |
67 | GLOBAL_VAR(opt_optimizer_fix), |
68 | NO_CMD_LINE, DEFAULT(TRUE)); | |
69 | ||
70 | +static Sys_var_mybool Sys_fast_index_creation( | |
71 | + "fast_index_creation", | |
72 | + "If disabled, suppresses online operations for indexes of ALTER TABLE " | |
73 | + "(e.g. fast index creation of InnoDB Plugin) for the session.", | |
74 | + SESSION_VAR(online_alter_index), NO_CMD_LINE, | |
75 | + DEFAULT(TRUE)); | |
76 | + | |
77 | /** propagates changes to the relevant flag of @@optimizer_switch */ | |
78 | static bool fix_engine_condition_pushdown(sys_var *self, THD *thd, | |
79 | enum_var_type type) |