]> git.pld-linux.org Git - packages/mysql.git/blob - control_online_alter_index.patch
- up to 5.5.13
[packages/mysql.git] / control_online_alter_index.patch
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
11 @@ -205,6 +205,8 @@
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)
15 +
16 +#define HA_INPLACE_ALTER_INDEX_MASK                ((1L << 12) - 1)
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
35 @@ -4636,7 +4636,12 @@
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 +    {
43 +      flags&= ~((uint)HA_INPLACE_ALTER_INDEX_MASK);
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
52 @@ -6112,6 +6112,10 @@
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 +    {
58 +      alter_flags&= ~((ulong)HA_INPLACE_ALTER_INDEX_MASK);
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
66 @@ -2186,6 +2186,13 @@
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)
This page took 0.053428 seconds and 4 git commands to generate.