]> git.pld-linux.org Git - packages/mysql.git/blame_incremental - control_online_alter_index.patch
- ignore-builtin-innodb is deprecated
[packages/mysql.git] / control_online_alter_index.patch
... / ...
CommitLineData
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--- a/sql/handler.h
9+++ b/sql/handler.h
10@@ -206,6 +206,8 @@
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)
14+
15+#define HA_INPLACE_ALTER_INDEX_MASK ((1L << 12) - 1)
16 /*
17 HA_PARTITION_FUNCTION_SUPPORTED indicates that the function is
18 supported at all.
19--- a/sql/sql_class.h
20+++ b/sql/sql_class.h
21@@ -479,6 +479,8 @@
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;
30--- a/sql/sql_partition.cc
31+++ b/sql/sql_partition.cc
32@@ -4637,7 +4637,12 @@
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+ {
40+ flags&= ~((uint)HA_INPLACE_ALTER_INDEX_MASK);
41+ }
42+ if (!flags)
43 {
44 my_error(ER_PARTITION_FUNCTION_FAILURE, MYF(0));
45 goto err;
46--- a/sql/sql_table.cc
47+++ b/sql/sql_table.cc
48@@ -6146,6 +6146,10 @@
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+ {
54+ alter_flags&= ~((ulong)HA_INPLACE_ALTER_INDEX_MASK);
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;
59--- a/sql/sys_vars.cc
60+++ b/sql/sys_vars.cc
61@@ -2265,6 +2265,13 @@
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)
This page took 0.026151 seconds and 4 git commands to generate.