Commit 9927b36e authored by Sergei Golubchik's avatar Sergei Golubchik

merge of "Bug#16216513 INPLACE ALTER DISABLED FOR PARTITIONED TABLES"

revno: 4777
committer: Marko Mäkelä <marko.makela@oracle.com>
branch nick: mysql-5.6
timestamp: Fri 2013-02-15 10:32:25 +0200
message:
  Bug#16216513 INPLACE ALTER DISABLED FOR PARTITIONED TABLES
parent 8db4a518
This diff is collapsed.
...@@ -1860,6 +1860,18 @@ class Alter_inplace_info ...@@ -1860,6 +1860,18 @@ class Alter_inplace_info
*/ */
inplace_alter_handler_ctx *handler_ctx; inplace_alter_handler_ctx *handler_ctx;
/**
If the table uses several handlers, like ha_partition uses one handler
per partition, this contains a Null terminated array of ctx pointers
that should all be committed together.
Or NULL if only handler_ctx should be committed.
Set to NULL if the low level handler::commit_inplace_alter_table uses it,
to signal to the main handler that everything was committed as atomically.
@see inplace_alter_handler_ctx for information about object lifecycle.
*/
inplace_alter_handler_ctx **group_commit_ctx;
/** /**
Flags describing in detail which operations the storage engine is to execute. Flags describing in detail which operations the storage engine is to execute.
*/ */
...@@ -1908,6 +1920,7 @@ class Alter_inplace_info ...@@ -1908,6 +1920,7 @@ class Alter_inplace_info
index_add_count(0), index_add_count(0),
index_add_buffer(NULL), index_add_buffer(NULL),
handler_ctx(NULL), handler_ctx(NULL),
group_commit_ctx(NULL),
handler_flags(0), handler_flags(0),
modified_part_info(modified_part_info_arg), modified_part_info(modified_part_info_arg),
ignore(ignore_arg), ignore(ignore_arg),
...@@ -3627,6 +3640,10 @@ class handler :public Sql_alloc ...@@ -3627,6 +3640,10 @@ class handler :public Sql_alloc
@note In case of partitioning, this function might be called for rollback @note In case of partitioning, this function might be called for rollback
without prepare_inplace_alter_table() having been called first. without prepare_inplace_alter_table() having been called first.
Also partitioned tables sets ha_alter_info->group_commit_ctx to a NULL
terminated array of the partitions handlers and if all of them are
committed as one, then group_commit_ctx should be set to NULL to indicate
to the partitioning handler that all partitions handlers are committed.
@see prepare_inplace_alter_table(). @see prepare_inplace_alter_table().
@param altered_table TABLE object for new version of table. @param altered_table TABLE object for new version of table.
...@@ -3641,7 +3658,11 @@ class handler :public Sql_alloc ...@@ -3641,7 +3658,11 @@ class handler :public Sql_alloc
virtual bool commit_inplace_alter_table(TABLE *altered_table, virtual bool commit_inplace_alter_table(TABLE *altered_table,
Alter_inplace_info *ha_alter_info, Alter_inplace_info *ha_alter_info,
bool commit) bool commit)
{ return false; } {
/* Nothing to commit/rollback, mark all handlers committed! */
ha_alter_info->group_commit_ctx= NULL;
return false;
}
/** /**
......
...@@ -5388,6 +5388,7 @@ ha_innobase::commit_inplace_alter_table( ...@@ -5388,6 +5388,7 @@ ha_innobase::commit_inplace_alter_table(
if (!(ha_alter_info->handler_flags & ~INNOBASE_INPLACE_IGNORE)) { if (!(ha_alter_info->handler_flags & ~INNOBASE_INPLACE_IGNORE)) {
DBUG_ASSERT(!ctx0); DBUG_ASSERT(!ctx0);
MONITOR_ATOMIC_DEC(MONITOR_PENDING_ALTER_TABLE); MONITOR_ATOMIC_DEC(MONITOR_PENDING_ALTER_TABLE);
ha_alter_info->group_commit_ctx = NULL;
DBUG_RETURN(false); DBUG_RETURN(false);
} }
...@@ -5396,12 +5397,17 @@ ha_innobase::commit_inplace_alter_table( ...@@ -5396,12 +5397,17 @@ ha_innobase::commit_inplace_alter_table(
inplace_alter_handler_ctx** ctx_array; inplace_alter_handler_ctx** ctx_array;
inplace_alter_handler_ctx* ctx_single[2]; inplace_alter_handler_ctx* ctx_single[2];
if (ha_alter_info->group_commit_ctx) {
ctx_array = ha_alter_info->group_commit_ctx;
} else {
ctx_single[0] = ctx0; ctx_single[0] = ctx0;
ctx_single[1] = NULL; ctx_single[1] = NULL;
ctx_array = ctx_single; ctx_array = ctx_single;
}
DBUG_ASSERT(ctx0 == ctx_array[0]); DBUG_ASSERT(ctx0 == ctx_array[0]);
ut_ad(prebuilt->table == ctx0->old_table); ut_ad(prebuilt->table == ctx0->old_table);
ha_alter_info->group_commit_ctx = NULL;
/* Free the ctx->trx of other partitions, if any. We will only /* Free the ctx->trx of other partitions, if any. We will only
use the ctx0->trx here. Others may have been allocated in use the ctx0->trx here. Others may have been allocated in
......
...@@ -5403,6 +5403,7 @@ ha_innobase::commit_inplace_alter_table( ...@@ -5403,6 +5403,7 @@ ha_innobase::commit_inplace_alter_table(
if (!(ha_alter_info->handler_flags & ~INNOBASE_INPLACE_IGNORE)) { if (!(ha_alter_info->handler_flags & ~INNOBASE_INPLACE_IGNORE)) {
DBUG_ASSERT(!ctx0); DBUG_ASSERT(!ctx0);
MONITOR_ATOMIC_DEC(MONITOR_PENDING_ALTER_TABLE); MONITOR_ATOMIC_DEC(MONITOR_PENDING_ALTER_TABLE);
ha_alter_info->group_commit_ctx = NULL;
DBUG_RETURN(false); DBUG_RETURN(false);
} }
...@@ -5411,12 +5412,17 @@ ha_innobase::commit_inplace_alter_table( ...@@ -5411,12 +5412,17 @@ ha_innobase::commit_inplace_alter_table(
inplace_alter_handler_ctx** ctx_array; inplace_alter_handler_ctx** ctx_array;
inplace_alter_handler_ctx* ctx_single[2]; inplace_alter_handler_ctx* ctx_single[2];
if (ha_alter_info->group_commit_ctx) {
ctx_array = ha_alter_info->group_commit_ctx;
} else {
ctx_single[0] = ctx0; ctx_single[0] = ctx0;
ctx_single[1] = NULL; ctx_single[1] = NULL;
ctx_array = ctx_single; ctx_array = ctx_single;
}
DBUG_ASSERT(ctx0 == ctx_array[0]); DBUG_ASSERT(ctx0 == ctx_array[0]);
ut_ad(prebuilt->table == ctx0->old_table); ut_ad(prebuilt->table == ctx0->old_table);
ha_alter_info->group_commit_ctx = NULL;
/* Free the ctx->trx of other partitions, if any. We will only /* Free the ctx->trx of other partitions, if any. We will only
use the ctx0->trx here. Others may have been allocated in use the ctx0->trx here. Others may have been allocated in
......
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