summaryrefslogtreecommitdiff
path: root/sql/sql_alter.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_alter.cc')
-rw-r--r--sql/sql_alter.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/sql/sql_alter.cc b/sql/sql_alter.cc
index be305267076..a21933892de 100644
--- a/sql/sql_alter.cc
+++ b/sql/sql_alter.cc
@@ -508,8 +508,18 @@ bool Sql_cmd_alter_table::execute(THD *thd)
DBUG_RETURN(TRUE);
}
- thd->variables.auto_increment_offset = 1;
- thd->variables.auto_increment_increment = 1;
+ /*
+ It makes sense to set auto_increment_* to defaults in TOI operations.
+ Must be done before wsrep_TOI_begin() since Query_log_event encapsulating
+ TOI statement and auto inc variables for wsrep replication is constructed
+ there. Variables are reset back in THD::reset_for_next_command() before
+ processing of next command.
+ */
+ if (wsrep_auto_increment_control)
+ {
+ thd->variables.auto_increment_offset = 1;
+ thd->variables.auto_increment_increment = 1;
+ }
}
#endif