3468 Jon Olav Hauglid 2012-01-26
WL#5534 Online ALTER, Phase 1.
Patch #76: Fix regression in parts.partition_debug_innodb.
Restore ha_partition::alter_table_flags() as is
needed for compatibility layer implementation of
handler::check_if_supported_inplace_alter().
modified:
sql/ha_partition.cc
sql/ha_partition.h
sql/handler.h
3467 Jon Olav Hauglid 2012-01-25
WL#5534 Online ALTER, Phase 1.
Patch #75: Review changes.
modified:
mysql-test/r/alter_table.result
mysql-test/r/innodb_mysql_sync.result
mysql-test/r/mdl_sync.result
mysql-test/r/truncate_coverage.result
mysql-test/t/alter_table.test
mysql-test/t/innodb_mysql_sync.test
mysql-test/t/mdl_sync.test
mysql-test/t/truncate_coverage.test
sql/ha_partition.cc
sql/ha_partition.h
sql/handler.cc
sql/handler.h
sql/mdl.cc
sql/sql_alter.cc
sql/sql_insert.cc
sql/sql_table.cc
sql/sql_table.h
sql/sql_yacc.yy
=== modified file 'sql/ha_partition.cc'
--- a/sql/ha_partition.cc 2012-01-25 16:40:54 +0000
+++ b/sql/ha_partition.cc 2012-01-26 10:02:26 +0000
@@ -6836,6 +6836,50 @@ bool ha_partition::get_error_message(int
/****************************************************************************
MODULE in-place ALTER
****************************************************************************/
+/**
+ alter_table_flags must be on handler/table level, not on hton level
+ due to the ha_partition hton does not know what the underlying hton is.
+*/
+uint ha_partition::alter_table_flags(uint flags)
+{
+ uint flags_to_return, flags_to_check;
+ DBUG_ENTER("ha_partition::alter_table_flags");
+
+ flags_to_return= ht->alter_table_flags(flags);
+ flags_to_return|= m_file[0]->alter_table_flags(flags);
+
+ /*
+ If one partition fails we must be able to revert the change for the other,
+ already altered, partitions. So both ADD and DROP can only be supported in
+ pairs.
+ */
+ flags_to_check= HA_INPLACE_ADD_INDEX_NO_READ_WRITE;
+ flags_to_check|= HA_INPLACE_DROP_INDEX_NO_READ_WRITE;
+ if ((flags_to_return & flags_to_check) != flags_to_check)
+ flags_to_return&= ~flags_to_check;
+ flags_to_check= HA_INPLACE_ADD_UNIQUE_INDEX_NO_READ_WRITE;
+ flags_to_check|= HA_INPLACE_DROP_UNIQUE_INDEX_NO_READ_WRITE;
+ if ((flags_to_return & flags_to_check) != flags_to_check)
+ flags_to_return&= ~flags_to_check;
+ flags_to_check= HA_INPLACE_ADD_PK_INDEX_NO_READ_WRITE;
+ flags_to_check|= HA_INPLACE_DROP_PK_INDEX_NO_READ_WRITE;
+ if ((flags_to_return & flags_to_check) != flags_to_check)
+ flags_to_return&= ~flags_to_check;
+ flags_to_check= HA_INPLACE_ADD_INDEX_NO_WRITE;
+ flags_to_check|= HA_INPLACE_DROP_INDEX_NO_WRITE;
+ if ((flags_to_return & flags_to_check) != flags_to_check)
+ flags_to_return&= ~flags_to_check;
+ flags_to_check= HA_INPLACE_ADD_UNIQUE_INDEX_NO_WRITE;
+ flags_to_check|= HA_INPLACE_DROP_UNIQUE_INDEX_NO_WRITE;
+ if ((flags_to_return & flags_to_check) != flags_to_check)
+ flags_to_return&= ~flags_to_check;
+ flags_to_check= HA_INPLACE_ADD_PK_INDEX_NO_WRITE;
+ flags_to_check|= HA_INPLACE_DROP_PK_INDEX_NO_WRITE;
+ if ((flags_to_return & flags_to_check) != flags_to_check)
+ flags_to_return&= ~flags_to_check;
+ DBUG_RETURN(flags_to_return);
+}
+
/**
check if copy of data is needed in alter table.
@@ -7111,6 +7155,7 @@ err:
"'%s' partition nr %d",
table_share->table_name.str, i);
}
+ part_inplace_ctx->handler_ctx_array[i]= ha_alter_info->handler_ctx;
}
// We have now reverted/rolled back changes. Set flag to prevent
=== modified file 'sql/ha_partition.h'
--- a/sql/ha_partition.h 2012-01-25 16:40:54 +0000
+++ b/sql/ha_partition.h 2012-01-26 10:02:26 +0000
@@ -870,6 +870,11 @@ public:
~HA_DO_INDEX_COND_PUSHDOWN;
}
+ /**
+ wrapper function for handlerton alter_table_flags, since
+ the ha_partition_hton cannot know all its capabilities
+ */
+ virtual uint alter_table_flags(uint flags);
/*
extensions of table handler files
*/
=== modified file 'sql/handler.h'
--- a/sql/handler.h 2012-01-25 16:40:54 +0000
+++ b/sql/handler.h 2012-01-26 10:02:26 +0000
@@ -2416,15 +2416,8 @@ public:
}
/**
- These two functions are part of old, deprecated in-place ALTER API.
+ Part of old, deprecated in-place ALTER API.
*/
- virtual uint alter_table_flags(uint flags)
- {
- if (ht->alter_table_flags)
- return ht->alter_table_flags(flags);
- return 0;
- }
-
virtual bool check_if_incompatible_data(HA_CREATE_INFO *create_info,
uint table_changes)
{ return COMPATIBLE_DATA_NO; }
@@ -2695,6 +2688,12 @@ public:
but we don't have a primary key
*/
virtual void use_hidden_primary_key();
+ virtual uint alter_table_flags(uint flags)
+ {
+ if (ht->alter_table_flags)
+ return ht->alter_table_flags(flags);
+ return 0;
+ }
protected:
/* Service methods for use by storage engines. */
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk-wl5534 branch (jon.hauglid:3467 to 3468) WL#5534 | Jon Olav Hauglid | 30 Jan |