Commit 98db467e authored by Sachin's avatar Sachin

Better Alter Query

parent 2d12d739
......@@ -9421,8 +9421,8 @@ static bool write_start_alter(THD *thd, bool* partial_alter, start_alter_info *i
{
char *send_query= (char *)thd->alloc(thd->query_length() + 20);
thd->gtid_flags3|= Gtid_log_event::FL_START_ALTER_E1;
sprintf(send_query, "/*!100001 %s, START %ld */", thd->query(),
(long)thd->thread_id);
sprintf(send_query, "/*!105001 %s EXECUTE = UNTIL COMMIT %ld */",
thd->query(), (long)thd->thread_id);
if (write_bin_log(thd, FALSE, send_query, strlen(send_query), true))
return true;
*partial_alter= true;
......@@ -10238,7 +10238,7 @@ do_continue:;
if (opt_binlog_split_alter)
{
thd->gtid_flags3|= Gtid_log_event::FL_ROLLBACK_ALTER_E1;
sprintf(send_query, "/*!100001 %s, ROLLBACK %ld */", thd->query(),
sprintf(send_query, "/*!105001 %s EXECUTE = ROLLBACK %ld */", thd->query(),
(long)thd->thread_id);
if(write_bin_log(thd, false, send_query, strlen(send_query), true, true))
DBUG_RETURN(true);
......@@ -10403,7 +10403,7 @@ do_continue:;
if (partial_alter)
{
thd->gtid_flags3|= Gtid_log_event::FL_COMMIT_ALTER_E1;
sprintf(send_query, "%s /*!100001, COMMIT %ld */", thd->query(),
sprintf(send_query, "%s /*!105001 EXECUTE = COMMIT %ld */", thd->query(),
(long)thd->thread_id);
if(write_bin_log(thd, false, send_query, strlen(send_query)))
DBUG_RETURN(true);
......@@ -10612,7 +10612,7 @@ do_continue:;
if (partial_alter)
{
thd->gtid_flags3|= Gtid_log_event::FL_COMMIT_ALTER_E1;
sprintf(send_query, "%s /*!100001, COMMIT %ld */", thd->query(),
sprintf(send_query, "%s /*!105001 EXECUTE = COMMIT %ld */", thd->query(),
(long)thd->thread_id);
if(write_bin_log(thd, false, send_query, strlen(send_query)))
DBUG_RETURN(true);
......@@ -10681,7 +10681,7 @@ do_continue:;
else if (opt_binlog_split_alter)
{
thd->gtid_flags3|= Gtid_log_event::FL_ROLLBACK_ALTER_E1;
sprintf(send_query, "/*!100001 %s, ROLLBACK %ld */", thd->query(),
sprintf(send_query, "/*!105001 %s EXECUTE = ROLLBACK %ld */", thd->query(),
(long)thd->thread_id);
if(write_bin_log(thd, false, send_query, strlen(send_query), true, true))
DBUG_RETURN(true);
......
......@@ -7303,6 +7303,9 @@ alter_commands:
remove_partitioning
| remove_partitioning
| partitioning
| alter_list
alter_state
| alter_state
/*
This part was added for release 5.1 by Mikael Ronstrm.
From here we insert a number of commands to manage the partitions of a
......@@ -7676,7 +7679,6 @@ alter_list_item:
}
| alter_algorithm_option
| alter_lock_option
| alter_state
| ADD SYSTEM VERSIONING_SYM
{
Lex->alter_info.flags|= ALTER_ADD_SYSTEM_VERSIONING;
......@@ -7735,20 +7737,25 @@ alter_lock_option:
}
;
alter_state:
START_SYM ulong_num
EXECUTE_SYM opt_equal DEFAULT
{
Lex->alter_info.alter_state= Alter_info::ALTER_TABLE_NORMAL;
Lex->alter_info.alter_identifier= 0;
}
| EXECUTE_SYM opt_equal UNTIL_SYM COMMIT_SYM ulong_num
{
Lex->alter_info.alter_state= Alter_info::ALTER_TABLE_START;
Lex->alter_info.alter_identifier= $2;
Lex->alter_info.alter_identifier= $5;
}
| COMMIT_SYM ulong_num
| EXECUTE_SYM opt_equal COMMIT_SYM ulong_num
{
Lex->alter_info.alter_state= Alter_info::ALTER_TABLE_COMMIT;
Lex->alter_info.alter_identifier= $2;
Lex->alter_info.alter_identifier= $4;
}
| ROLLBACK_SYM ulong_num
| EXECUTE_SYM opt_equal ROLLBACK_SYM ulong_num
{
Lex->alter_info.alter_state= Alter_info::ALTER_TABLE_ROLLBACK;
Lex->alter_info.alter_identifier= $2;
Lex->alter_info.alter_identifier= $4;
}
;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment