]> git.pld-linux.org Git - packages/percona-server.git/blame - control_online_alter_index.patch
- symbolic-links=0 from fedora
[packages/percona-server.git] / control_online_alter_index.patch
CommitLineData
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!
8diff -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@@ -194,6 +194,19 @@
12 #define HA_ONLINE_DROP_UNIQUE_INDEX (1L << 9) /*drop uniq. online*/
13 #define HA_ONLINE_ADD_PK_INDEX (1L << 10)/*add prim. online*/
14 #define HA_ONLINE_DROP_PK_INDEX (1L << 11)/*drop prim. online*/
15+
16+#define HA_ONLINE_ALTER_INDEX_MASK (HA_ONLINE_ADD_INDEX_NO_WRITES \
17+ | HA_ONLINE_DROP_INDEX_NO_WRITES \
18+ | HA_ONLINE_ADD_UNIQUE_INDEX_NO_WRITES \
19+ | HA_ONLINE_DROP_UNIQUE_INDEX_NO_WRITES \
20+ | HA_ONLINE_ADD_PK_INDEX_NO_WRITES \
21+ | HA_ONLINE_DROP_PK_INDEX_NO_WRITES \
22+ | HA_ONLINE_ADD_INDEX \
23+ | HA_ONLINE_DROP_INDEX \
24+ | HA_ONLINE_ADD_UNIQUE_INDEX \
25+ | HA_ONLINE_DROP_UNIQUE_INDEX \
26+ | HA_ONLINE_ADD_PK_INDEX \
27+ | HA_ONLINE_DROP_PK_INDEX)
28 /*
29 HA_PARTITION_FUNCTION_SUPPORTED indicates that the function is
30 supported at all.
31diff -ruN a/sql/sql_class.h b/sql/sql_class.h
32--- a/sql/sql_class.h 2010-12-02 20:31:56.200956501 +0900
33+++ b/sql/sql_class.h 2010-12-03 13:51:04.744953174 +0900
34@@ -481,6 +481,8 @@
35 my_bool engine_condition_pushdown;
36 my_bool keep_files_on_create;
37
38+ my_bool online_alter_index;
39+
40 my_bool old_alter_table;
41 my_bool old_passwords;
42 my_bool big_tables;
43diff -ruN a/sql/sql_partition.cc b/sql/sql_partition.cc
44--- a/sql/sql_partition.cc 2010-11-03 07:01:14.000000000 +0900
45+++ b/sql/sql_partition.cc 2010-12-03 13:59:56.444039002 +0900
d8778560 46@@ -4636,7 +4636,12 @@
b4e1fa2c
AM
47 alter_info->num_parts= curr_part_no - new_part_no;
48 }
49 }
50- if (!(flags= new_table->file->alter_table_flags(alter_info->flags)))
51+ flags= new_table->file->alter_table_flags(alter_info->flags);
52+ if (!thd->variables.online_alter_index)
53+ {
54+ flags&= ~((uint)HA_ONLINE_ALTER_INDEX_MASK);
55+ }
56+ if (!flags)
57 {
58 my_error(ER_PARTITION_FUNCTION_FAILURE, MYF(0));
59 goto err;
60diff -ruN a/sql/sql_table.cc b/sql/sql_table.cc
61--- a/sql/sql_table.cc 2010-11-03 07:01:14.000000000 +0900
62+++ b/sql/sql_table.cc 2010-12-03 13:51:04.768955495 +0900
d8778560 63@@ -6117,6 +6117,10 @@
b4e1fa2c
AM
64 uint *idx_end_p;
65
66 alter_flags= table->file->alter_table_flags(alter_info->flags);
67+ if (!thd->variables.online_alter_index)
68+ {
69+ alter_flags&= ~((ulong)HA_ONLINE_ALTER_INDEX_MASK);
70+ }
71 DBUG_PRINT("info", ("alter_flags: %lu", alter_flags));
72 /* Check dropped indexes. */
73 for (idx_p= index_drop_buffer, idx_end_p= idx_p + index_drop_count;
74diff -ruN a/sql/sys_vars.cc b/sql/sys_vars.cc
75--- a/sql/sys_vars.cc 2010-12-02 21:23:05.569356468 +0900
76+++ b/sql/sys_vars.cc 2010-12-03 14:05:28.857356603 +0900
d8778560 77@@ -2140,6 +2140,13 @@
b4e1fa2c
AM
78 GLOBAL_VAR(opt_optimizer_fix),
79 NO_CMD_LINE, DEFAULT(TRUE));
80
81+static Sys_var_mybool Sys_fast_index_creation(
82+ "fast_index_creation",
83+ "If disabled, suppresses online operations for indexes of ALTER TABLE "
84+ "(e.g. fast index creation of InnoDB Plugin) for the session.",
85+ SESSION_VAR(online_alter_index), NO_CMD_LINE,
86+ DEFAULT(TRUE));
87+
88 /** propagates changes to the relevant flag of @@optimizer_switch */
89 static bool fix_engine_condition_pushdown(sys_var *self, THD *thd,
90 enum_var_type type)
This page took 0.037501 seconds and 4 git commands to generate.