List:Commits« Previous MessageNext Message »
From:Martin Skold Date:May 14 2012 2:31pm
Subject:bzr push into mysql-trunk-cluster branch (Martin.Skold:3485 to 3486) WL#3749
WL#5534
View as plain text  
 3486 Martin Skold	2012-05-14
      WL#5534 inplace ALTER TABLE: Adaption to new interface for ndb (from WL#3749)

    modified:
      include/mysql_com.h
      mysql-test/suite/ndb/r/ndb_add_partition.result
      mysql-test/suite/ndb/r/ndb_alter_table_error.result
      mysql-test/suite/ndb/r/ndb_alter_table_online.result
      mysql-test/suite/ndb/r/ndb_alter_table_online2.result
      mysql-test/suite/ndb/r/ndb_dd_restore_compat.result
      mysql-test/suite/ndb/r/ndb_ddl_open_trans.result
      mysql-test/suite/ndb/r/ndb_short_sigs.result
      mysql-test/suite/ndb_binlog/r/ndb_binlog_basic.result
      mysql-test/suite/ndb_binlog/r/ndb_binlog_ddl_multi.result
      mysql-test/suite/ndb_binlog/r/ndb_binlog_log_bin.result
      mysql-test/suite/ndb_binlog/r/ndb_binlog_multi.result
      mysql-test/suite/ndb_rpl/r/ndb_rpl_ddl_open_trans.result
      sql/ha_ndbcluster.cc
      sql/ha_ndbcluster.h
      sql/handler.cc
      sql/handler.h
      sql/sql_alter.h
      sql/sql_partition.cc
      sql/sql_table.cc
      sql/sql_yacc.yy
      storage/innobase/handler/handler0alter.cc
 3485 magnus.blaudd@stripped	2012-04-20
      WL#6224 Adapt MySQL Cluster to 5.6 
       - update .result file to Timestamp2 output from ndb_desc, this test
         was previsoulsy disabled by not havine ALTER ONLINE

    modified:
      mysql-test/suite/ndb/r/ndb_native_default_support.result
=== modified file 'include/mysql_com.h'
--- a/include/mysql_com.h	2012-04-19 11:55:46 +0000
+++ b/include/mysql_com.h	2012-05-14 14:28:50 +0000
@@ -114,10 +114,7 @@ enum enum_server_command
 #define BINCMP_FLAG	131072		/* Intern: Used by sql_yacc */
 #define GET_FIXED_FIELDS_FLAG (1 << 18) /* Used to get fields in item tree */
 #define FIELD_IN_PART_FUNC_FLAG (1 << 19)/* Field part of partition func */
-/*
-  #define FIELD_IN_ADD_INDEX (1<< 20)
-  Was part of old online ALTER API, flag is now unused.
-*/
+#define FIELD_IN_ADD_INDEX (1<< 20)
 #define FIELD_IS_RENAMED (1<< 21)       /* Intern: Field is being renamed */
 #define FIELD_FLAGS_STORAGE_MEDIA 22    /* Field storage media, bit 22-23 */
 #define FIELD_FLAGS_STORAGE_MEDIA_MASK (3 << FIELD_FLAGS_STORAGE_MEDIA)

=== modified file 'mysql-test/suite/ndb/r/ndb_add_partition.result'
--- a/mysql-test/suite/ndb/r/ndb_add_partition.result	2011-05-12 11:31:21 +0000
+++ b/mysql-test/suite/ndb/r/ndb_add_partition.result	2012-05-14 14:28:50 +0000
@@ -143,7 +143,11 @@ select * from t2 where b = 50;
 a	b	c
 50	50	50
 alter online table t1 reorganize partition;
+Warnings:
+Warning	1287	'ONLINE' is deprecated and will be removed in a future release. Please use ALGORITHM=INPLACE instead
 alter online table t2 reorganize partition;
+Warnings:
+Warning	1287	'ONLINE' is deprecated and will be removed in a future release. Please use ALGORITHM=INPLACE instead
 partitions added to t1
 t1_added
 0
@@ -151,7 +155,11 @@ partitions added to t2
 t2_added
 0
 alter online table t1 add partition partitions 1;
+Warnings:
+Warning	1287	'ONLINE' is deprecated and will be removed in a future release. Please use ALGORITHM=INPLACE instead
 alter online table t2 add partition partitions 4;
+Warnings:
+Warning	1287	'ONLINE' is deprecated and will be removed in a future release. Please use ALGORITHM=INPLACE instead
 partitions added to t1
 t1_added
 1
@@ -257,7 +265,11 @@ select * from t2 where b = 50;
 a	b	c
 50	50	50
 alter online table t1 add partition partitions 2;
+Warnings:
+Warning	1287	'ONLINE' is deprecated and will be removed in a future release. Please use ALGORITHM=INPLACE instead
 alter online table t2 add partition partitions 1;
+Warnings:
+Warning	1287	'ONLINE' is deprecated and will be removed in a future release. Please use ALGORITHM=INPLACE instead
 partitions added to t1
 t1_added
 3

=== modified file 'mysql-test/suite/ndb/r/ndb_alter_table_error.result'
--- a/mysql-test/suite/ndb/r/ndb_alter_table_error.result	2011-09-02 06:37:29 +0000
+++ b/mysql-test/suite/ndb/r/ndb_alter_table_error.result	2012-05-14 14:28:50 +0000
@@ -12,6 +12,8 @@ ALTER OFFLINE TABLE t1 ADD c CHAR(19);
 ERROR HY000: Lock wait timeout exceeded; try restarting transaction
 commit;
 ALTER OFFLINE TABLE t1 ADD c CHAR(19);
+Warnings:
+Warning	1287	'OFFLINE' is deprecated and will be removed in a future release. Please use ALGORITHM=COPY instead
 create unique index b_unq on t1(b) using hash;
 ERROR 23000: Can't write, because of unique constraint, to table 't1'
 update t1 set b = b - 1 where a = 1;

=== modified file 'mysql-test/suite/ndb/r/ndb_alter_table_online.result'
--- a/mysql-test/suite/ndb/r/ndb_alter_table_online.result	2011-07-05 23:02:21 +0000
+++ b/mysql-test/suite/ndb/r/ndb_alter_table_online.result	2012-05-14 14:28:50 +0000
@@ -105,6 +105,8 @@ a	b	c
 * Create online Index ci
 *******************************
 CREATE ONLINE INDEX ci on t1(c);
+Warnings:
+Warning	1287	'ONLINE' is deprecated and will be removed in a future release. Please use ALGORITHM=INPLACE instead
 
 ndb_show_tables completed.....
 
@@ -115,6 +117,8 @@ name
 * Create offline Index ci2
 *******************************
 CREATE OFFLINE INDEX ci2 on t1(c);
+Warnings:
+Warning	1287	'OFFLINE' is deprecated and will be removed in a future release. Please use ALGORITHM=COPY instead
 
 ndb_show_tables completed.....
 
@@ -125,6 +129,8 @@ set @t1_id = (select id from ndb_show_ta
 * Drop online Index ci
 *******************************
 DROP ONLINE INDEX ci on t1;
+Warnings:
+Warning	1287	'ONLINE' is deprecated and will be removed in a future release. Please use ALGORITHM=INPLACE instead
 
 ndb_show_tables completed.....
 
@@ -135,6 +141,8 @@ name
 * Drop offline Index ci2
 *******************************
 DROP OFFLINE INDEX ci2 on t1;
+Warnings:
+Warning	1287	'OFFLINE' is deprecated and will be removed in a future release. Please use ALGORITHM=COPY instead
 
 ndb_show_tables completed.....
 
@@ -401,6 +409,8 @@ PRIMARY KEY($PK) - UniqueHashIndex
 ALTER ONLINE TABLE t1 ADD PRIMARY KEY (a);
 ERROR 42000: This version of MySQL doesn't yet support 'ALTER ONLINE TABLE t1 ADD PRIMARY KEY (a)'
 ALTER OFFLINE TABLE t1 ADD PRIMARY KEY (a);
+Warnings:
+Warning	1287	'OFFLINE' is deprecated and will be removed in a future release. Please use ALGORITHM=COPY instead
 Primary keys:
 a Unsigned PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
 PRIMARY KEY(a) - UniqueHashIndex
@@ -408,18 +418,24 @@ PRIMARY(a) - OrderedIndex
 ALTER ONLINE TABLE t1 DROP PRIMARY KEY;
 ERROR 42000: This version of MySQL doesn't yet support 'ALTER ONLINE TABLE t1 DROP PRIMARY KEY'
 ALTER OFFLINE TABLE t1 DROP PRIMARY KEY;
+Warnings:
+Warning	1287	'OFFLINE' is deprecated and will be removed in a future release. Please use ALGORITHM=COPY instead
 Primary keys:
 $PK Bigunsigned PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY AUTO_INCR
 PRIMARY KEY($PK) - UniqueHashIndex
 CREATE ONLINE UNIQUE INDEX pk ON t1(a);
 ERROR 42000: This version of MySQL doesn't yet support 'CREATE ONLINE UNIQUE INDEX pk ON t1(a)'
 CREATE OFFLINE UNIQUE INDEX pk ON t1(a);
+Warnings:
+Warning	1287	'OFFLINE' is deprecated and will be removed in a future release. Please use ALGORITHM=COPY instead
 Primary keys:
 a Unsigned PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
 PRIMARY KEY(a) - UniqueHashIndex
 ALTER ONLINE TABLE t1 DROP INDEX PK;
 ERROR 42000: This version of MySQL doesn't yet support 'ALTER ONLINE TABLE t1 DROP INDEX PK'
 ALTER OFFLINE TABLE t1 DROP INDEX PK;
+Warnings:
+Warning	1287	'OFFLINE' is deprecated and will be removed in a future release. Please use ALGORITHM=COPY instead
 Primary keys:
 $PK Bigunsigned PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY AUTO_INCR
 PRIMARY KEY($PK) - UniqueHashIndex
@@ -428,12 +444,16 @@ CREATE TABLE t1 (a INT UNSIGNED) ENGINE 
 ALTER ONLINE TABLE t1 ADD b INT UNIQUE;
 ERROR 42000: This version of MySQL doesn't yet support 'ALTER ONLINE TABLE t1 ADD b INT UNIQUE'
 ALTER OFFLINE TABLE t1 ADD b INT UNIQUE;
+Warnings:
+Warning	1287	'OFFLINE' is deprecated and will be removed in a future release. Please use ALGORITHM=COPY instead
 Primary keys:
 $PK Bigunsigned PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY AUTO_INCR
 PRIMARY KEY($PK) - UniqueHashIndex
 ALTER ONLINE TABLE t1 ADD c INT NOT NULL UNIQUE;
 ERROR 42000: This version of MySQL doesn't yet support 'ALTER ONLINE TABLE t1 ADD c INT NOT NULL UNIQUE'
 ALTER OFFLINE TABLE t1 ADD c INT NOT NULL UNIQUE;
+Warnings:
+Warning	1287	'OFFLINE' is deprecated and will be removed in a future release. Please use ALGORITHM=COPY instead
 Primary keys:
 c Int PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
 PRIMARY KEY(c) - UniqueHashIndex
@@ -473,24 +493,28 @@ set @t1_id = (select id from ndb_show_ta
 *******************************
 ALTER ONLINE TABLE t1 ADD c FLOAT;
 Warnings:
+Warning	1287	'ONLINE' is deprecated and will be removed in a future release. Please use ALGORITHM=INPLACE instead
 Warning	1478	Converted FIXED field to DYNAMIC to enable on-line ADD COLUMN
 *******************************
 * Add column d as nullable DOUBLE
 *******************************
 ALTER ONLINE TABLE t1 ADD d DOUBLE UNSIGNED;
 Warnings:
+Warning	1287	'ONLINE' is deprecated and will be removed in a future release. Please use ALGORITHM=INPLACE instead
 Warning	1478	Converted FIXED field to DYNAMIC to enable on-line ADD COLUMN
 *******************************
 * Add column e as nullable DECIMAL
 *******************************
 ALTER ONLINE TABLE t1 ADD e DECIMAL(5,2);
 Warnings:
+Warning	1287	'ONLINE' is deprecated and will be removed in a future release. Please use ALGORITHM=INPLACE instead
 Warning	1478	Converted FIXED field to DYNAMIC to enable on-line ADD COLUMN
 *******************************
 * Add column f as nullable DATETIME
 *******************************
 ALTER ONLINE TABLE t1 ADD f DATETIME;
 Warnings:
+Warning	1287	'ONLINE' is deprecated and will be removed in a future release. Please use ALGORITHM=INPLACE instead
 Warning	1478	Converted FIXED field to DYNAMIC to enable on-line ADD COLUMN
 *******************************
 * Add column g as nullable BINARY
@@ -576,10 +600,16 @@ create table t1 (a int primary key, b in
 alter online table t1 add column c0 int null column_format DYNAMIC;
 ERROR 42000: This version of MySQL doesn't yet support 'alter online table t1 add column c0 int null column_format DYNAMIC'
 alter online table t1 add column c1 int null column_format DYNAMIC storage memory;
+Warnings:
+Warning	1287	'ONLINE' is deprecated and will be removed in a future release. Please use ALGORITHM=INPLACE instead
 drop table t1;
 create table t1 (a int primary key, b int storage disk) tablespace ts1 engine = ndb;
 alter online table t1 add column c0 int null column_format DYNAMIC;
+Warnings:
+Warning	1287	'ONLINE' is deprecated and will be removed in a future release. Please use ALGORITHM=INPLACE instead
 alter online table t1 add column c1 int null column_format DYNAMIC storage memory;
+Warnings:
+Warning	1287	'ONLINE' is deprecated and will be removed in a future release. Please use ALGORITHM=INPLACE instead
 drop table t1;
 ALTER TABLESPACE ts1
 DROP DATAFILE 'datafile.dat'
@@ -634,10 +664,14 @@ DROP TABLE t1, ndb_show_tables_results;
 create table t1 ( c499 int, c498 int, c497 int, c496 int, c495 int, c494 int, c493 int, c492 int, c491 int, c490 int, c489 int, c488 int, c487 int, c486 int, c485 int, c484 int, c483 int, c482 int, c481 int, c480 int, c479 int, c478 int, c477 int, c476 int, c475 int, c474 int, c473 int, c472 int, c471 int, c470 int, c469 int, c468 int, c467 int, c466 int, c465 int, c464 int, c463 int, c462 int, c461 int, c460 int, c459 int, c458 int, c457 int, c456 int, c455 int, c454 int, c453 int, c452 int, c451 int, c450 int, c449 int, c448 int, c447 int, c446 int, c445 int, c444 int, c443 int, c442 int, c441 int, c440 int, c439 int, c438 int, c437 int, c436 int, c435 int, c434 int, c433 int, c432 int, c431 int, c430 int, c429 int, c428 int, c427 int, c426 int, c425 int, c424 int, c423 int, c422 int, c421 int, c420 int, c419 int, c418 int, c417 int, c416 int, c415 int, c414 int, c413 int, c412 int, c411 int, c410 int, c409 int, c408 int, c407 int, c406 int, c405 int, c404 int, c403 int, c
 402 int, c401 int, c400 int, c399 int, c398 int, c397 int, c396 int, c395 int, c394 int, c393 int, c392 int, c391 int, c390 int, c389 int, c388 int, c387 int, c386 int, c385 int, c384 int, c383 int, c382 int, c381 int, c380 int, c379 int, c378 int, c377 int, c376 int, c375 int, c374 int, c373 int, c372 int, c371 int, c370 int, c369 int, c368 int, c367 int, c366 int, c365 int, c364 int, c363 int, c362 int, c361 int, c360 int, c359 int, c358 int, c357 int, c356 int, c355 int, c354 int, c353 int, c352 int, c351 int, c350 int, c349 int, c348 int, c347 int, c346 int, c345 int, c344 int, c343 int, c342 int, c341 int, c340 int, c339 int, c338 int, c337 int, c336 int, c335 int, c334 int, c333 int, c332 int, c331 int, c330 int, c329 int, c328 int, c327 int, c326 int, c325 int, c324 int, c323 int, c322 int, c321 int, c320 int, c319 int, c318 int, c317 int, c316 int, c315 int, c314 int, c313 int, c312 int, c311 int, c310 int, c309 int, c308 int, c307 int, c306 int, c305 int, c304 int, 
 c303 int, c302 int, c301 int, c300 int, c299 int, c298 int, c297 int, c296 int, c295 int, c294 int, c293 int, c292 int, c291 int, c290 int, c289 int, c288 int, c287 int, c286 int, c285 int, c284 int, c283 int, c282 int, c281 int, c280 int, c279 int, c278 int, c277 int, c276 int, c275 int, c274 int, c273 int, c272 int, c271 int, c270 int, c269 int, c268 int, c267 int, c266 int, c265 int, c264 int, c263 int, c262 int, c261 int, c260 int, c259 int, c258 int, c257 int, c256 int, c255 int, c254 int, c253 int, c252 int, c251 int, c250 int, c249 int, c248 int, c247 int, c246 int, c245 int, c244 int, c243 int, c242 int, c241 int, c240 int, c239 int, c238 int, c237 int, c236 int, c235 int, c234 int, c233 int, c232 int, c231 int, c230 int, c229 int, c228 int, c227 int, c226 int, c225 int, c224 int, c223 int, c222 int, c221 int, c220 int, c219 int, c218 int, c217 int, c216 int, c215 int, c214 int, c213 int, c212 int, c211 int, c210 int, c209 int, c208 int, c207 int, c206 int, c205 int,
  c204 int, c203 int, c202 int, c201 int, c200 int, c199 int, c198 int, c197 int, c196 int, c195 int, c194 int, c193 int, c192 int, c191 int, c190 int, c189 int, c188 int, c187 int, c186 int, c185 int, c184 int, c183 int, c182 int, c181 int, c180 int, c179 int, c178 int, c177 int, c176 int, c175 int, c174 int, c173 int, c172 int, c171 int, c170 int, c169 int, c168 int, c167 int, c166 int, c165 int, c164 int, c163 int, c162 int, c161 int, c160 int, c159 int, c158 int, c157 int, c156 int, c155 int, c154 int, c153 int, c152 int, c151 int, c150 int, c149 int, c148 int, c147 int, c146 int, c145 int, c144 int, c143 int, c142 int, c141 int, c140 int, c139 int, c138 int, c137 int, c136 int, c135 int, c134 int, c133 int, c132 int, c131 int, c130 int, c129 int, c128 int, c127 int, c126 int, c125 int, c124 int, c123 int, c122 int, c121 int, c120 int, c119 int, c118 int, c117 int, c116 int, c115 int, c114 int, c113 int, c112 int, c111 int, c110 int, c109 int, c108 int, c107 int, c106 int
 , c105 int, c104 int, c103 int, c102 int, c101 int, c100 int, c99 int, c98 int, c97 int, c96 int, c95 int, c94 int, c93 int, c92 int, c91 int, c90 int, c89 int, c88 int, c87 int, c86 int, c85 int, c84 int, c83 int, c82 int, c81 int, c80 int, c79 int, c78 int, c77 int, c76 int, c75 int, c74 int, c73 int, c72 int, c71 int, c70 int, c69 int, c68 int, c67 int, c66 int, c65 int, c64 int, c63 int, c62 int, c61 int, c60 int, c59 int, c58 int, c57 int, c56 int, c55 int, c54 int, c53 int, c52 int, c51 int, c50 int, c49 int, c48 int, c47 int, c46 int, c45 int, c44 int, c43 int, c42 int, c41 int, c40 int, c39 int, c38 int, c37 int, c36 int, c35 int, c34 int, c33 int, c32 int, c31 int, c30 int, c29 int, c28 int, c27 int, c26 int, c25 int, c24 int, c23 int, c22 int, c21 int, c20 int, c19 int, c18 int, c17 int, c16 int, c15 int, c14 int, c13 int, c12 int, c11 int, c10 int, c9 int, c8 int, c7 int, c6 int, c5 int, c4 int, c3 int, c2 int, c1 int, c501 varchar(10000), primary key using hash(c
 1)) engine=ndb;
 insert into t1 (c1) values (1), (2), (3);
 alter offline table t1 modify c1 int auto_increment;
+Warnings:
+Warning	1287	'OFFLINE' is deprecated and will be removed in a future release. Please use ALGORITHM=COPY instead
 alter online table t1 add column c500 bit(1) column_format DYNAMIC;
+Warnings:
+Warning	1287	'ONLINE' is deprecated and will be removed in a future release. Please use ALGORITHM=INPLACE instead
 alter offline table t1 add column c502 varchar(2000);
-ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 14000. You have to change some columns to TEXT or BLOBs
+ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 14000. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
 alter online table t1 add column c502 varchar(2000);
-ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 14000. You have to change some columns to TEXT or BLOBs
+ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 14000. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
 delete from t1;
 drop table t1;

=== modified file 'mysql-test/suite/ndb/r/ndb_alter_table_online2.result'
--- a/mysql-test/suite/ndb/r/ndb_alter_table_online2.result	2011-12-16 07:55:55 +0000
+++ b/mysql-test/suite/ndb/r/ndb_alter_table_online2.result	2012-05-14 14:28:50 +0000
@@ -32,6 +32,7 @@ set @t1_id = (select id from ndb_show_ta
 
 ALTER ONLINE TABLE t1 ADD b INT;
 Warnings:
+Warning	1287	'ONLINE' is deprecated and will be removed in a future release. Please use ALGORITHM=INPLACE instead
 Warning	1478	Converted FIXED field to DYNAMIC to enable on-line ADD COLUMN
 
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -57,6 +58,7 @@ update t1 set b = 0 where pk = 1;
 
 ALTER ONLINE TABLE t1 ADD c INT;
 Warnings:
+Warning	1287	'ONLINE' is deprecated and will be removed in a future release. Please use ALGORITHM=INPLACE instead
 Warning	1478	Converted FIXED field to DYNAMIC to enable on-line ADD COLUMN
 
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

=== modified file 'mysql-test/suite/ndb/r/ndb_dd_restore_compat.result'
--- a/mysql-test/suite/ndb/r/ndb_dd_restore_compat.result	2012-03-13 08:28:13 +0000
+++ b/mysql-test/suite/ndb/r/ndb_dd_restore_compat.result	2012-05-14 14:28:50 +0000
@@ -45,6 +45,8 @@ a1	a2	a3	a4	a5	a6	a7	a8	a9	a10
 4	5	2000000004	aaa4	34.2	04:03:02	2006-01-01	1971-05-28 16:55:03	bbbbbbbbbbbbb4	binary data
 5	6	2000000005	aaa5	34.2	04:03:02	2006-01-01	1971-05-28 16:55:03	bbbbbbbbbbbbb5	binary data
 ALTER TABLE t1 ADD COLUMN c int;
+Warnings:
+Warning	1478	Converted FIXED field to DYNAMIC to enable on-line ADD COLUMN
 SHOW CREATE TABLE t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (

=== modified file 'mysql-test/suite/ndb/r/ndb_ddl_open_trans.result'
--- a/mysql-test/suite/ndb/r/ndb_ddl_open_trans.result	2011-07-06 10:40:14 +0000
+++ b/mysql-test/suite/ndb/r/ndb_ddl_open_trans.result	2012-05-14 14:28:50 +0000
@@ -10,6 +10,8 @@ create table t1 ( a int primary key) eng
 begin;
 insert into t1 values(1);
 alter online table t1 add column b int column_format dynamic;
+Warnings:
+Warning	1287	'ONLINE' is deprecated and will be removed in a future release. Please use ALGORITHM=INPLACE instead
 commit;
 drop table t1;
 set global ndb_check_shares=1;
@@ -27,6 +29,8 @@ create table t1 ( a int primary key, b i
 begin;
 insert into t1 values(1, 1);
 create online index ind_b on t1(b);
+Warnings:
+Warning	1287	'ONLINE' is deprecated and will be removed in a future release. Please use ALGORITHM=INPLACE instead
 commit;
 drop table t1;
 set global ndb_check_shares=1;

=== modified file 'mysql-test/suite/ndb/r/ndb_short_sigs.result'
--- a/mysql-test/suite/ndb/r/ndb_short_sigs.result	2012-03-12 12:52:29 +0000
+++ b/mysql-test/suite/ndb/r/ndb_short_sigs.result	2012-05-14 14:28:50 +0000
@@ -63,6 +63,8 @@ th	un	de	length(rb)	length(al)
 4	9	4	991	60009
 5	10	5	990	60010
 alter table t1 add column extra varchar(2000);
+Warnings:
+Warning	1478	Converted FIXED field to DYNAMIC to enable on-line ADD COLUMN
 update t1 set extra = repeat(rb, 2);
 select th, un, de, length(rb), length(al), length(extra)
 from t1 

=== modified file 'mysql-test/suite/ndb_binlog/r/ndb_binlog_basic.result'
--- a/mysql-test/suite/ndb_binlog/r/ndb_binlog_basic.result	2012-03-12 12:52:29 +0000
+++ b/mysql-test/suite/ndb_binlog/r/ndb_binlog_basic.result	2012-05-14 14:28:50 +0000
@@ -12,6 +12,8 @@ select @max_epoch:=max(epoch)-1 from mys
 #
 delete from t1;
 alter table t1 add (b int);
+Warnings:
+Warning	1478	Converted FIXED field to DYNAMIC to enable on-line ADD COLUMN
 insert into t1 values (3,3),(4,4);
 alter table t1 rename t2;
 begin;

=== modified file 'mysql-test/suite/ndb_binlog/r/ndb_binlog_ddl_multi.result'
--- a/mysql-test/suite/ndb_binlog/r/ndb_binlog_ddl_multi.result	2012-03-12 12:52:29 +0000
+++ b/mysql-test/suite/ndb_binlog/r/ndb_binlog_ddl_multi.result	2012-05-14 14:28:50 +0000
@@ -21,6 +21,8 @@ mysqld-bin.000001	#	Query	1	#	use `test`
 reset master;
 reset master;
 alter table t2 add column (b int);
+Warnings:
+Warning	1478	Converted FIXED field to DYNAMIC to enable on-line ADD COLUMN
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 mysqld-bin.000001	#	Query	1	#	use `test`; alter table t2 add column (b int)

=== modified file 'mysql-test/suite/ndb_binlog/r/ndb_binlog_log_bin.result'
--- a/mysql-test/suite/ndb_binlog/r/ndb_binlog_log_bin.result	2012-03-12 12:52:29 +0000
+++ b/mysql-test/suite/ndb_binlog/r/ndb_binlog_log_bin.result	2012-05-14 14:28:50 +0000
@@ -9,6 +9,8 @@ create table t1 (a int key, b int) engin
 create table t2 (a int key, b int) engine=ndb;
 insert into t1 values (1,1);
 alter table t1 add c int;
+Warnings:
+Warning	1478	Converted FIXED field to DYNAMIC to enable on-line ADD COLUMN
 show binlog events from <binlog_start>;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 reset master;

=== modified file 'mysql-test/suite/ndb_binlog/r/ndb_binlog_multi.result'
--- a/mysql-test/suite/ndb_binlog/r/ndb_binlog_multi.result	2011-09-21 10:57:59 +0000
+++ b/mysql-test/suite/ndb_binlog/r/ndb_binlog_multi.result	2012-05-14 14:28:50 +0000
@@ -91,5 +91,7 @@ primary key(col0)) engine = ndb;
 begin;
 insert into t1 (col0) values (1);
 alter online table t1 add column col32 int COLUMN_FORMAT DYNAMIC;
+Warnings:
+Warning	1287	'ONLINE' is deprecated and will be removed in a future release. Please use ALGORITHM=INPLACE instead
 commit;
 drop table t1;

=== modified file 'mysql-test/suite/ndb_rpl/r/ndb_rpl_ddl_open_trans.result'
--- a/mysql-test/suite/ndb_rpl/r/ndb_rpl_ddl_open_trans.result	2012-04-19 10:59:52 +0000
+++ b/mysql-test/suite/ndb_rpl/r/ndb_rpl_ddl_open_trans.result	2012-05-14 14:28:50 +0000
@@ -15,6 +15,8 @@ create table t1 ( a int primary key) eng
 begin;
 insert into t1 values(1);
 alter online table t1 add column b int column_format dynamic;
+Warnings:
+Warning	1287	'ONLINE' is deprecated and will be removed in a future release. Please use ALGORITHM=INPLACE instead
 commit;
 drop table t1;
 set global ndb_check_shares=1;
@@ -32,6 +34,8 @@ create table t1 ( a int primary key, b i
 begin;
 insert into t1 values(1, 1);
 create online index ind_b on t1(b);
+Warnings:
+Warning	1287	'ONLINE' is deprecated and will be removed in a future release. Please use ALGORITHM=INPLACE instead
 commit;
 drop table t1;
 set global ndb_check_shares=1;

=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	2012-04-11 12:33:47 +0000
+++ b/sql/ha_ndbcluster.cc	2012-05-14 14:28:50 +0000
@@ -10121,6 +10121,33 @@ int ha_ndbcluster::create_ndb_index(THD 
   DBUG_RETURN(0);  
 }
 
+/*
+ Prepare for an on-line alter table
+*/ 
+void ha_ndbcluster::prepare_for_alter()
+{
+  /* ndb_share reference schema */
+  ndbcluster_get_share(m_share); // Increase ref_count
+  DBUG_PRINT("NDB_SHARE", ("%s binlog schema  use_count: %u",
+                           m_share->key, m_share->use_count));
+  set_ndb_share_state(m_share, NSS_ALTERED);
+}
+
+/*
+  Add an index on-line to a table
+*/
+/*
+int ha_ndbcluster::add_index(TABLE *table_arg, 
+                             KEY *key_info, uint num_of_keys,
+                             handler_add_index **add)
+{
+  // TODO: As we don't yet implement ::final_add_index(),
+  // we don't need a handler_add_index object either..?
+  *add= NULL; // new handler_add_index(table_arg, key_info, num_of_keys);
+  return add_index_impl(current_thd, table_arg, key_info, num_of_keys);
+}
+*/
+
 int ha_ndbcluster::add_index_impl(THD *thd, TABLE *table_arg, 
                                   KEY *key_info, uint num_of_keys)
 {
@@ -10148,6 +10175,59 @@ int ha_ndbcluster::add_index_impl(THD *t
   DBUG_RETURN(error);  
 }
 
+/*
+  Mark one or several indexes for deletion. and
+  renumber the remaining indexes
+*/
+int ha_ndbcluster::prepare_drop_index(TABLE *table_arg, 
+                                      uint *key_num, uint num_of_keys)
+{
+  DBUG_ENTER("ha_ndbcluster::prepare_drop_index");
+  DBUG_ASSERT(m_share->state == NSS_ALTERED);
+  // Mark indexes for deletion
+  uint idx;
+  for (idx= 0; idx < num_of_keys; idx++)
+  {
+    DBUG_PRINT("info", ("ha_ndbcluster::prepare_drop_index %u", *key_num));
+    uint i = *key_num++;
+    m_index[i].status= TO_BE_DROPPED;
+    // Prepare delete of index stat entry
+    if (m_index[i].type == PRIMARY_KEY_ORDERED_INDEX ||
+        m_index[i].type == UNIQUE_ORDERED_INDEX ||
+        m_index[i].type == ORDERED_INDEX)
+    {
+      const NdbDictionary::Index *index= m_index[i].index;
+      if (index) // safety
+      {
+        int index_id= index->getObjectId();
+        int index_version= index->getObjectVersion();
+        ndb_index_stat_free(m_share, index_id, index_version);
+      }
+    }
+  }
+  // Renumber indexes
+  THD *thd= current_thd;
+  Thd_ndb *thd_ndb= get_thd_ndb(thd);
+  Ndb *ndb= thd_ndb->ndb;
+  renumber_indexes(ndb, table_arg);
+  DBUG_RETURN(0);
+}
+ 
+/*
+  Really drop all indexes marked for deletion
+*/
+int ha_ndbcluster::final_drop_index(TABLE *table_arg)
+{
+  int error;
+  DBUG_ENTER("ha_ndbcluster::final_drop_index");
+  // Really drop indexes
+  THD *thd= current_thd;
+  Thd_ndb *thd_ndb= get_thd_ndb(thd);
+  Ndb *ndb= thd_ndb->ndb;
+  error= drop_indexes(ndb, table_arg);
+  DBUG_RETURN(error);
+}
+
 /**
   Rename a table in NDB Cluster.
 */
@@ -15885,59 +15965,66 @@ ha_ndbcluster::set_up_partition_info(par
   DBUG_RETURN(0);
 }
 
-#ifndef NDB_WITHOUT_ONLINE_ALTER
 static
-HA_ALTER_FLAGS supported_alter_operations()
+Alter_inplace_info::HA_ALTER_FLAGS supported_alter_operations()
 {
-  HA_ALTER_FLAGS alter_flags;
+  Alter_inplace_info::HA_ALTER_FLAGS alter_flags= 0;
   return alter_flags |
-    HA_ADD_INDEX |
-    HA_DROP_INDEX |
-    HA_ADD_UNIQUE_INDEX |
-    HA_DROP_UNIQUE_INDEX |
-    HA_ADD_COLUMN |
-    HA_COLUMN_STORAGE |
-    HA_COLUMN_FORMAT |
-    HA_ADD_PARTITION |
-    HA_ALTER_TABLE_REORG |
-    HA_CHANGE_AUTOINCREMENT_VALUE;
-}
-
-int ha_ndbcluster::check_if_supported_alter(TABLE *altered_table,
-                                            HA_CREATE_INFO *create_info,
-                                            HA_ALTER_INFO *alter_info,
-                                            HA_ALTER_FLAGS *alter_flags,
-                                            uint table_changes)
+    Alter_inplace_info::ADD_INDEX |
+    Alter_inplace_info::DROP_INDEX |
+    Alter_inplace_info::ADD_UNIQUE_INDEX |
+    Alter_inplace_info::DROP_UNIQUE_INDEX |
+    Alter_inplace_info::ADD_COLUMN |
+    Alter_inplace_info::ALTER_COLUMN_STORAGE_TYPE |
+    Alter_inplace_info::ALTER_COLUMN_COLUMN_FORMAT |
+    Alter_inplace_info::ADD_PARTITION |
+    Alter_inplace_info::ALTER_TABLE_REORG |
+    Alter_inplace_info::CHANGE_AUTOINCREMENT_VALUE;
+}
+
+enum_alter_inplace_result
+  ha_ndbcluster::check_if_supported_inplace_alter(TABLE *altered_table,
+                                                  Alter_inplace_info *ha_alter_info)
 {
   THD *thd= current_thd;
-  HA_ALTER_FLAGS not_supported= ~(supported_alter_operations());
+  HA_CREATE_INFO *create_info= ha_alter_info->create_info;
+  Alter_inplace_info::HA_ALTER_FLAGS alter_flags= ha_alter_info->handler_flags;
+  Alter_inplace_info::HA_ALTER_FLAGS supported= supported_alter_operations();
+  Alter_inplace_info::HA_ALTER_FLAGS not_supported= ~supported;
   uint i;
   const NDBTAB *tab= (const NDBTAB *) m_table;
-  HA_ALTER_FLAGS add_column;
-  HA_ALTER_FLAGS adding;
-  HA_ALTER_FLAGS dropping;
-
-  DBUG_ENTER("ha_ndbcluster::check_if_supported_alter");
-  add_column= add_column | HA_ADD_COLUMN;
-  adding= adding | HA_ADD_INDEX | HA_ADD_UNIQUE_INDEX;
-  dropping= dropping | HA_DROP_INDEX | HA_DROP_UNIQUE_INDEX;
+  Alter_inplace_info::HA_ALTER_FLAGS add_column= 0;
+  Alter_inplace_info::HA_ALTER_FLAGS adding= 0;
+  Alter_inplace_info::HA_ALTER_FLAGS dropping= 0;
+  enum_alter_inplace_result result= HA_ALTER_INPLACE_SHARED_LOCK;
+
+  DBUG_ENTER("ha_ndbcluster::check_if_supported_inplace_alter");
+  add_column= add_column | Alter_inplace_info::ADD_COLUMN;
+  adding= adding |
+    Alter_inplace_info::ADD_INDEX
+    | Alter_inplace_info::ADD_UNIQUE_INDEX;
+  dropping= dropping |
+    Alter_inplace_info::DROP_INDEX
+    | Alter_inplace_info::DROP_UNIQUE_INDEX;
   partition_info *part_info= altered_table->part_info;
   const NDBTAB *old_tab= m_table;
 
   if (THDVAR(thd, use_copying_alter_table))
   {
     DBUG_PRINT("info", ("On-line alter table disabled"));
-    DBUG_RETURN(HA_ALTER_NOT_SUPPORTED);
+    DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
   }
 #ifndef DBUG_OFF
   {
-    char dbug_string[HA_MAX_ALTER_FLAGS+1];
-    alter_flags->print(dbug_string);
-    DBUG_PRINT("info", ("Not supported %s", dbug_string));
+    DBUG_PRINT("info", ("Passed alter flags 0x%lx", alter_flags));
+    DBUG_PRINT("info", ("Supported 0x%lx", supported));
+    DBUG_PRINT("info", ("Not supported 0x%lx", not_supported));
+    DBUG_PRINT("info", ("alter_flags & not_supported 0x%lx",
+                        alter_flags & not_supported));
   }
 #endif
 
-  if (alter_flags->is_set(HA_ALTER_TABLE_REORG))
+  if (alter_flags & Alter_inplace_info::ALTER_TABLE_REORG)
   {
     /*
       sql_partition.cc tries to compute what is going on
@@ -15945,33 +16032,32 @@ int ha_ndbcluster::check_if_supported_al
     */
     if (part_info->use_default_num_partitions)
     {
-      alter_flags->clear_bit(HA_COALESCE_PARTITION);
-      alter_flags->clear_bit(HA_ADD_PARTITION);
+      alter_flags= alter_flags & ~Alter_inplace_info::COALESCE_PARTITION;
+      alter_flags= alter_flags & ~Alter_inplace_info::ADD_PARTITION;
     }
   }
 
-  if ((*alter_flags & not_supported).is_set())
+  if (alter_flags & not_supported)
   {
 #ifndef DBUG_OFF
-    HA_ALTER_FLAGS tmp = *alter_flags;
+    Alter_inplace_info::HA_ALTER_FLAGS tmp= alter_flags;
     tmp&= not_supported;
-    char dbug_string[HA_MAX_ALTER_FLAGS+1];
-    tmp.print(dbug_string);
-    DBUG_PRINT("info", ("Detected unsupported change: %s", dbug_string));
+    DBUG_PRINT("info", ("Detected unsupported change: 0x%lx", tmp));
 #endif
-    DBUG_RETURN(HA_ALTER_NOT_SUPPORTED);
+    DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
   }
 
-  if (alter_flags->is_set(HA_ADD_COLUMN) ||
-      alter_flags->is_set(HA_ADD_PARTITION) ||
-      alter_flags->is_set(HA_ALTER_TABLE_REORG))
+  if (alter_flags & Alter_inplace_info::ADD_COLUMN ||
+      alter_flags & Alter_inplace_info::ADD_PARTITION ||
+      alter_flags & Alter_inplace_info::ALTER_TABLE_REORG)
   {
      Ndb *ndb= get_ndb(thd);
      NDBDICT *dict= ndb->getDictionary();
      ndb->setDatabaseName(m_dbname);
      NdbDictionary::Table new_tab= *old_tab;
 
-     if (alter_flags->is_set(HA_ADD_COLUMN))
+     result= HA_ALTER_INPLACE_EXCLUSIVE_LOCK;
+     if (alter_flags & Alter_inplace_info::ADD_COLUMN)
      {
        NDBCOL col;
 
@@ -15986,12 +16072,12 @@ int ha_ndbcluster::check_if_supported_al
          In case of someone trying to change a column, the HA_CHANGE_COLUMN would be set
          which we don't support, so we will still return HA_ALTER_NOT_SUPPORTED in those cases
        */
-       add_column.set_bit(HA_COLUMN_STORAGE);
-       add_column.set_bit(HA_COLUMN_FORMAT);
-       if ((*alter_flags & ~add_column).is_set())
+       add_column|= Alter_inplace_info::ALTER_COLUMN_STORAGE_TYPE;
+       add_column|= Alter_inplace_info::ALTER_COLUMN_COLUMN_FORMAT;
+       if (alter_flags & ~add_column)
        {
          DBUG_PRINT("info", ("Only add column exclusively can be performed on-line"));
-         DBUG_RETURN(HA_ALTER_NOT_SUPPORTED);
+         DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
        }
        /*
          Check for extra fields for hidden primary key
@@ -16000,7 +16086,7 @@ int ha_ndbcluster::check_if_supported_al
        if (table_share->primary_key == MAX_KEY ||
            part_info->part_type != HASH_PARTITION ||
            !part_info->list_of_part_fields)
-         DBUG_RETURN(HA_ALTER_NOT_SUPPORTED);
+         DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
 
        /* Find the new fields */
        for (uint i= table->s->fields; i < altered_table->s->fields; i++)
@@ -16015,18 +16101,18 @@ int ha_ndbcluster::check_if_supported_al
                                           COLUMN_FORMAT_TYPE_DYNAMIC)))
          {
            DBUG_PRINT("info", ("create_ndb_column returned %u", my_errno));
-           DBUG_RETURN(my_errno);
+           DBUG_RETURN(HA_ALTER_ERROR);
          }
          new_tab.addColumn(col);
        }
      }
 
-     if (alter_flags->is_set(HA_ALTER_TABLE_REORG))
+     if (alter_flags & Alter_inplace_info::ALTER_TABLE_REORG)
      {
        new_tab.setFragmentCount(0);
        new_tab.setFragmentData(0, 0);
      }
-     else if (alter_flags->is_set(HA_ADD_PARTITION))
+     else if (alter_flags & Alter_inplace_info::ADD_PARTITION)
      {
        DBUG_PRINT("info", ("Adding partition (%u)", part_info->num_parts));
        new_tab.setFragmentCount(part_info->num_parts);
@@ -16049,33 +16135,33 @@ int ha_ndbcluster::check_if_supported_al
      else
      {
        DBUG_PRINT("info",("Adding column not supported on-line"));
-       DBUG_RETURN(HA_ALTER_NOT_SUPPORTED);
+       DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
      }
   }
 
   /*
     Check that we are not adding multiple indexes
   */
-  if ((*alter_flags & adding).is_set())
+  if (alter_flags & adding)
   {
     if (((altered_table->s->keys - table->s->keys) != 1) ||
-        (*alter_flags & dropping).is_set())
+        (alter_flags & dropping))
     {
        DBUG_PRINT("info",("Only one index can be added on-line"));
-       DBUG_RETURN(HA_ALTER_NOT_SUPPORTED);
+       DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
     }
   }
 
   /*
     Check that we are not dropping multiple indexes
   */
-  if ((*alter_flags & dropping).is_set())
+  if (alter_flags & dropping)
   {
     if (((table->s->keys - altered_table->s->keys) != 1) ||
-        (*alter_flags & adding).is_set())
+        (alter_flags & adding))
     {
        DBUG_PRINT("info",("Only one index can be dropped on-line"));
-       DBUG_RETURN(HA_ALTER_NOT_SUPPORTED);
+       DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
     }
   }
 
@@ -16110,7 +16196,7 @@ int ha_ndbcluster::check_if_supported_al
       }
     }
 
-    if (index_on_column == false && (*alter_flags & adding).is_set())
+    if (index_on_column == false && (alter_flags & adding))
     {
       for (uint j= table->s->keys; j<altered_table->s->keys; j++)
       {
@@ -16140,7 +16226,7 @@ int ha_ndbcluster::check_if_supported_al
     {
       if (field->field_storage_type() == HA_SM_DISK)
       {
-        DBUG_RETURN(HA_ALTER_NOT_SUPPORTED);
+        DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
       }
       new_col.setStorageType(NdbDictionary::Column::StorageTypeMemory);
     }
@@ -16156,32 +16242,32 @@ int ha_ndbcluster::check_if_supported_al
     if (col->getStorageType() != new_col.getStorageType())
     {
       DBUG_PRINT("info", ("Column storage media is changed"));
-      DBUG_RETURN(HA_ALTER_NOT_SUPPORTED);
+      DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
     }
 
     if (field->flags & FIELD_IS_RENAMED)
     {
       DBUG_PRINT("info", ("Field has been renamed, copy table"));
-      DBUG_RETURN(HA_ALTER_NOT_SUPPORTED);
+      DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
     }
 
     if ((field->flags & FIELD_IN_ADD_INDEX) &&
         (col->getStorageType() == NdbDictionary::Column::StorageTypeDisk))
     {
       DBUG_PRINT("info", ("add/drop index not supported for disk stored column"));
-      DBUG_RETURN(HA_ALTER_NOT_SUPPORTED);
+      DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
     }
   }
 
-  if ((*alter_flags & HA_CHANGE_AUTOINCREMENT_VALUE).is_set())
+  if (alter_flags & Alter_inplace_info::CHANGE_AUTOINCREMENT_VALUE)
   {
     /* Check that only auto_increment value was changed */
-    HA_ALTER_FLAGS change_auto_flags=
-      change_auto_flags | HA_CHANGE_AUTOINCREMENT_VALUE;
-    if ((*alter_flags & ~change_auto_flags).is_set())
+    Alter_inplace_info::HA_ALTER_FLAGS change_auto_flags=
+      change_auto_flags | Alter_inplace_info::CHANGE_AUTOINCREMENT_VALUE;
+    if (alter_flags & ~change_auto_flags)
     {
       DBUG_PRINT("info", ("Not only auto_increment value changed"));
-      DBUG_RETURN(HA_ALTER_NOT_SUPPORTED);
+      DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
     }
   }
   else
@@ -16191,22 +16277,21 @@ int ha_ndbcluster::check_if_supported_al
         get_row_type() != create_info->row_type)
     {
       DBUG_PRINT("info", ("Row format changed"));
-      DBUG_RETURN(HA_ALTER_NOT_SUPPORTED);
+      DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
     }
   }
 
   DBUG_PRINT("info", ("Ndb supports ALTER on-line"));
-  DBUG_RETURN(HA_ALTER_SUPPORTED_WAIT_LOCK);
+  DBUG_RETURN(result);
 }
 
-int ha_ndbcluster::alter_table_phase1(THD *thd,
-                                      TABLE *altered_table,
-                                      HA_CREATE_INFO *create_info,
-                                      HA_ALTER_INFO *alter_info,
-                                      HA_ALTER_FLAGS *alter_flags)
+bool
+ha_ndbcluster::prepare_inplace_alter_table(TABLE *altered_table,
+                                              Alter_inplace_info *ha_alter_info)
 {
   int error= 0;
   uint i;
+  THD *thd= current_thd;
   Thd_ndb *thd_ndb= get_thd_ndb(thd);
   Ndb *ndb= get_ndb(thd);
   NDBDICT *dict= ndb->getDictionary();
@@ -16214,28 +16299,35 @@ int ha_ndbcluster::alter_table_phase1(TH
   NDB_ALTER_DATA *alter_data;
   const NDBTAB *old_tab;
   NdbDictionary::Table *new_tab;
-  HA_ALTER_FLAGS adding;
-  HA_ALTER_FLAGS dropping;
-
-  DBUG_ENTER("alter_table_phase1");
-  adding=  adding | HA_ADD_INDEX | HA_ADD_UNIQUE_INDEX;
-  dropping= dropping | HA_DROP_INDEX | HA_DROP_UNIQUE_INDEX;
+  HA_CREATE_INFO *create_info= ha_alter_info->create_info;
+  Alter_inplace_info::HA_ALTER_FLAGS alter_flags= ha_alter_info->handler_flags;
+  Alter_inplace_info::HA_ALTER_FLAGS adding= 0;
+  Alter_inplace_info::HA_ALTER_FLAGS dropping= 0;
+
+  DBUG_ENTER("ha_ndbcluster::prepare_inplace_alter_table");
+  adding=  adding |
+    Alter_inplace_info::ADD_INDEX
+    |  Alter_inplace_info::ADD_UNIQUE_INDEX;
+  dropping= dropping |
+    Alter_inplace_info::DROP_INDEX
+    |  Alter_inplace_info::DROP_UNIQUE_INDEX;
 
-  if (!thd_ndb->has_required_global_schema_lock("ha_ndbcluster::alter_table_phase1"))
+  ha_alter_info->handler_ctx= 0;
+  if (!thd_ndb->has_required_global_schema_lock("ha_ndbcluster::prepare_inplace_alter_table"))
     DBUG_RETURN(HA_ERR_NO_CONNECTION);
 
   if (!(alter_data= new NDB_ALTER_DATA(dict, m_table)))
     DBUG_RETURN(HA_ERR_OUT_OF_MEM);
   old_tab= alter_data->old_table;
   new_tab= alter_data->new_table;
-  alter_info->data= alter_data;
+  ha_alter_info->handler_ctx= alter_data;
+
 #ifndef DBUG_OFF
   {
-    char dbug_string[HA_MAX_ALTER_FLAGS+1];
-    alter_flags->print(dbug_string);
-    DBUG_PRINT("info", ("altered_table %s, alter_flags %s",
+    DBUG_PRINT("info", ("altered_table %s, alter_flags 0x%lx",
                         altered_table->s->table_name.str,
-                        (char *) dbug_string));
+                        alter_flags));
+
   }
 #endif
 
@@ -16250,7 +16342,7 @@ int ha_ndbcluster::alter_table_phase1(TH
     goto err;
   }
 
-  if ((*alter_flags & adding).is_set())
+  if (alter_flags & adding)
   {
     KEY           *key_info;
     KEY           *key;
@@ -16259,22 +16351,22 @@ int ha_ndbcluster::alter_table_phase1(TH
     KEY_PART_INFO *key_part;
     KEY_PART_INFO *part_end;
     DBUG_PRINT("info", ("Adding indexes"));
-    key_info= (KEY*) thd->alloc(sizeof(KEY) * alter_info->index_add_count);
+    key_info= (KEY*) thd->alloc(sizeof(KEY) * ha_alter_info->index_add_count);
     key= key_info;
-    for (idx_p=  alter_info->index_add_buffer,
-	 idx_end_p= idx_p + alter_info->index_add_count;
+    for (idx_p=  ha_alter_info->index_add_buffer,
+	 idx_end_p= idx_p + ha_alter_info->index_add_count;
 	 idx_p < idx_end_p;
 	 idx_p++, key++)
     {
       /* Copy the KEY struct. */
-      *key= alter_info->key_info_buffer[*idx_p];
+      *key= ha_alter_info->key_info_buffer[*idx_p];
       /* Fix the key parts. */
       part_end= key->key_part + key->key_parts;
       for (key_part= key->key_part; key_part < part_end; key_part++)
 	key_part->field= table->field[key_part->fieldnr];
     }
     if ((error= add_index_impl(thd, altered_table, key_info,
-                               alter_info->index_add_count)))
+                               ha_alter_info->index_add_count)))
     {
       /*
 	Exchange the key_info for the error message. If we exchange
@@ -16288,35 +16380,46 @@ int ha_ndbcluster::alter_table_phase1(TH
     }
   }
 
-  if ((*alter_flags & dropping).is_set())
+  if (alter_flags & dropping)
   {
     uint          *key_numbers;
     uint          *keyno_p;
-    uint          *idx_p;
-    uint          *idx_end_p;
+    KEY           **idx_p;
+    KEY           **idx_end_p;
     DBUG_PRINT("info", ("Renumbering indexes"));
     /* The prepare_drop_index() method takes an array of key numbers. */
-    key_numbers= (uint*) thd->alloc(sizeof(uint) * alter_info->index_drop_count);
+    key_numbers= (uint*) thd->alloc(sizeof(uint) * ha_alter_info->index_drop_count);
     keyno_p= key_numbers;
     /* Get the number of each key. */
-    for (idx_p= alter_info->index_drop_buffer,
-	 idx_end_p= idx_p + alter_info->index_drop_count;
+    for (idx_p= ha_alter_info->index_drop_buffer,
+	 idx_end_p= idx_p + ha_alter_info->index_drop_count;
 	 idx_p < idx_end_p;
 	 idx_p++, keyno_p++)
-      *keyno_p= *idx_p;
+    {
+      // Find the key number matching the key to be dropped
+      KEY *keyp= *idx_p;
+      uint i;
+      for(i=0; i < table->s->keys; i++)
+      {
+	if (keyp == table->key_info + i)
+	  break;
+      }
+      DBUG_PRINT("info", ("Dropping index %u", i)); 
+      *keyno_p= i;
+    }
     /*
       Tell the handler to prepare for drop indexes.
       This re-numbers the indexes to get rid of gaps.
     */
     if ((error= prepare_drop_index(table, key_numbers,
-				   alter_info->index_drop_count)))
+				   ha_alter_info->index_drop_count)))
     {
       table->file->print_error(error, MYF(0));
       goto abort;
     }
   }
 
-  if (alter_flags->is_set(HA_ADD_COLUMN))
+  if (alter_flags &  Alter_inplace_info::ADD_COLUMN)
   {
      NDBCOL col;
 
@@ -16349,14 +16452,15 @@ int ha_ndbcluster::alter_table_phase1(TH
      }
   }
 
-  if (alter_flags->is_set(HA_ALTER_TABLE_REORG) || alter_flags->is_set(HA_ADD_PARTITION))
+if (alter_flags & Alter_inplace_info::ALTER_TABLE_REORG
+    || alter_flags & Alter_inplace_info::ADD_PARTITION)
   {
-    if (alter_flags->is_set(HA_ALTER_TABLE_REORG))
+    if (alter_flags & Alter_inplace_info::ALTER_TABLE_REORG)
     {
       new_tab->setFragmentCount(0);
       new_tab->setFragmentData(0, 0);
     }
-    else if (alter_flags->is_set(HA_ADD_PARTITION))
+    else if (alter_flags & Alter_inplace_info::ADD_PARTITION)
     {
       partition_info *part_info= altered_table->part_info;
       new_tab->setFragmentCount(part_info->num_parts);
@@ -16380,13 +16484,8 @@ abort:
     ERR_PRINT(dict->getNdbError());
     error= ndb_to_mysql_error(&dict->getNdbError());
   }
+
 err:
-  set_ndb_share_state(m_share, NSS_INITIAL);
-  /* ndb_share reference schema free */
-  DBUG_PRINT("NDB_SHARE", ("%s binlog schema free  use_count: %u",
-                           m_share->key, m_share->use_count));
-  free_share(&m_share); // Decrease ref_count
-  delete alter_data;
   DBUG_RETURN(error);
 }
 
@@ -16441,29 +16540,31 @@ int ha_ndbcluster::alter_frm(THD *thd, c
   DBUG_RETURN(error);
 }
 
-int ha_ndbcluster::alter_table_phase2(THD *thd,
-                                      TABLE *altered_table,
-                                      HA_CREATE_INFO *create_info,
-                                      HA_ALTER_INFO *alter_info,
-                                      HA_ALTER_FLAGS *alter_flags)
-
+bool
+ha_ndbcluster::inplace_alter_table(TABLE *altered_table,
+                                   Alter_inplace_info *ha_alter_info)
 {
+  DBUG_ENTER("ha_ndbcluster::inplace_alter_table");
   int error= 0;
+  THD *thd= current_thd;
   Thd_ndb *thd_ndb= get_thd_ndb(thd);
-  NDB_ALTER_DATA *alter_data= (NDB_ALTER_DATA *) alter_info->data;
+  HA_CREATE_INFO *create_info= ha_alter_info->create_info;
+  NDB_ALTER_DATA *alter_data= (NDB_ALTER_DATA *) ha_alter_info->handler_ctx;
   NDBDICT *dict= alter_data->dictionary;
-  HA_ALTER_FLAGS dropping;
+  Alter_inplace_info::HA_ALTER_FLAGS alter_flags= ha_alter_info->handler_flags;
+  Alter_inplace_info::HA_ALTER_FLAGS dropping= 0;
 
-  DBUG_ENTER("alter_table_phase2");
-  dropping= dropping  | HA_DROP_INDEX | HA_DROP_UNIQUE_INDEX;
+  dropping= dropping  |
+    Alter_inplace_info::DROP_INDEX
+    | Alter_inplace_info::DROP_UNIQUE_INDEX;
 
-  if (!thd_ndb->has_required_global_schema_lock("ha_ndbcluster::alter_table_phase2"))
+  if (!thd_ndb->has_required_global_schema_lock("ha_ndbcluster::inplace_alter_table"))
   {
     error= HA_ERR_NO_CONNECTION;
     goto err;
   }
 
-  if ((*alter_flags & dropping).is_set())
+  if (alter_flags & dropping)
   {
     /* Tell the handler to finally drop the indexes. */
     if ((error= final_drop_index(table)))
@@ -16490,7 +16591,7 @@ int ha_ndbcluster::alter_table_phase2(TH
       table->file->print_error(error, MYF(0));
       goto err;
     }
-    if ((*alter_flags & HA_CHANGE_AUTOINCREMENT_VALUE).is_set())
+    if (alter_flags & Alter_inplace_info::CHANGE_AUTOINCREMENT_VALUE)
       error= set_auto_inc_val(thd, create_info->auto_increment_value);
     if (error)
     {
@@ -16507,41 +16608,32 @@ abort:
       DBUG_PRINT("info", ("Failed to abort schema transaction"));
       ERR_PRINT(dict->getNdbError());
     }
-err:
-    /* ndb_share reference schema free */
-    DBUG_PRINT("NDB_SHARE", ("%s binlog schema free  use_count: %u",
-                             m_share->key, m_share->use_count));
-    delete alter_data;
-    alter_info->data= 0;
   }
-  set_ndb_share_state(m_share, NSS_INITIAL);
-  free_share(&m_share); // Decrease ref_count
+
+err:
   DBUG_RETURN(error);
 }
 
-int ha_ndbcluster::alter_table_phase3(THD *thd, TABLE *table,
-                                      HA_CREATE_INFO *create_info,
-                                      HA_ALTER_INFO *alter_info,
-                                      HA_ALTER_FLAGS *alter_flags)
-{
+bool
+ha_ndbcluster::commit_inplace_alter_table(TABLE *altered_table,
+                                          Alter_inplace_info *ha_alter_info,
+                                          bool commit)
+{
+  DBUG_ENTER("ha_ndbcluster::commit_inplace_alter_table");
+
+  if (!commit)
+    DBUG_RETURN(abort_inplace_alter_table(altered_table,
+                                          ha_alter_info));
+  THD *thd= current_thd;
   Thd_ndb *thd_ndb= get_thd_ndb(thd);
-  DBUG_ENTER("alter_table_phase3");
-
-  NDB_ALTER_DATA *alter_data= (NDB_ALTER_DATA *) alter_info->data;
-  if (!thd_ndb->has_required_global_schema_lock("ha_ndbcluster::alter_table_phase3"))
+  NDB_ALTER_DATA *alter_data= (NDB_ALTER_DATA *) ha_alter_info->handler_ctx;
+  if (!thd_ndb->has_required_global_schema_lock("ha_ndbcluster::commit_inplace_alter_table"))
   {
-    delete alter_data;
-    alter_info->data= 0;
     DBUG_RETURN(HA_ERR_NO_CONNECTION);
   }
 
   const char *db= table->s->db.str;
   const char *name= table->s->table_name.str;
-
-  /*
-    all mysqld's will read frms from disk and setup new
-    event operation for the table (new_op)
-  */
   uint32 table_id= 0, table_version= 0;
   DBUG_ASSERT(alter_data != 0);
   if (alter_data)
@@ -16554,12 +16646,56 @@ int ha_ndbcluster::alter_table_phase3(TH
                            table_id, table_version,
                            SOT_ONLINE_ALTER_TABLE_PREPARE,
                            NULL, NULL);
+  delete alter_data;
+  ha_alter_info->handler_ctx= 0;
+  set_ndb_share_state(m_share, NSS_INITIAL);
+  free_share(&m_share); // Decrease ref_count
+  DBUG_RETURN(0);
+}
+
+bool
+ha_ndbcluster::abort_inplace_alter_table(TABLE *altered_table,
+                                         Alter_inplace_info *ha_alter_info)
+{
+  DBUG_ENTER("ha_ndbcluster::abort_inplace_alter_table");
+  int error= 0;
+  NDB_ALTER_DATA *alter_data= (NDB_ALTER_DATA *) ha_alter_info->handler_ctx;
+  if (!alter_data)
+    DBUG_RETURN(0);
+
+  NDBDICT *dict= alter_data->dictionary;
+  if (dict->endSchemaTrans(NdbDictionary::Dictionary::SchemaTransAbort)
+      == -1)
+  {
+    DBUG_PRINT("info", ("Failed to abort schema transaction"));
+    ERR_PRINT(dict->getNdbError());
+  }
+  /* ndb_share reference schema free */
+  DBUG_PRINT("NDB_SHARE", ("%s binlog schema free  use_count: %u",
+                           m_share->key, m_share->use_count));
+  delete alter_data;
+  ha_alter_info->handler_ctx= 0;
+  set_ndb_share_state(m_share, NSS_INITIAL);
+  free_share(&m_share); // Decrease ref_count
+  DBUG_RETURN(error);
+}
+
+void ha_ndbcluster::notify_table_changed()
+{
+  DBUG_ENTER("ha_ndbcluster::notify_table_changed ");
+
+  /*
+    all mysqld's will read frms from disk and setup new
+    event operation for the table (new_op)
+  */
+  THD *thd= current_thd;
+  const char *db= table->s->db.str;
+  const char *name= table->s->table_name.str;
+  uint32 table_id= 0, table_version= 0;
 
   /*
     Get table id/version for new table
   */
-  table_id= 0;
-  table_version= 0;
   {
     Ndb* ndb= get_ndb(thd);
     DBUG_ASSERT(ndb != 0);
@@ -16587,36 +16723,8 @@ int ha_ndbcluster::alter_table_phase3(TH
                            SOT_ONLINE_ALTER_TABLE_COMMIT,
                            NULL, NULL);
 
-  delete alter_data;
-  alter_info->data= 0;
-  DBUG_RETURN(0);
-}
-
-int ha_ndbcluster::alter_table_abort(THD *thd,
-                                     HA_ALTER_INFO *alter_info,
-                                     HA_ALTER_FLAGS *alter_flags)
-{
-  int error= 0;
-  //Thd_ndb *thd_ndb= get_thd_ndb(thd);
-  NDB_ALTER_DATA *alter_data= (NDB_ALTER_DATA *) alter_info->data;
-  NDBDICT *dict= alter_data->dictionary;
-  DBUG_ENTER("alter_table_abort");
-  if (dict->endSchemaTrans(NdbDictionary::Dictionary::SchemaTransAbort)
-      == -1)
-  {
-    DBUG_PRINT("info", ("Failed to abort schema transaction"));
-    ERR_PRINT(dict->getNdbError());
-  }
-  /* ndb_share reference schema free */
-  DBUG_PRINT("NDB_SHARE", ("%s binlog schema free  use_count: %u",
-                           m_share->key, m_share->use_count));
-  delete alter_data;
-  alter_info->data= 0;
-  set_ndb_share_state(m_share, NSS_INITIAL);
-  free_share(&m_share); // Decrease ref_count
-  DBUG_RETURN(error);
+  DBUG_VOID_RETURN;
 }
-#endif
 
 bool set_up_tablespace(st_alter_tablespace *alter_info,
                        NdbDictionary::Tablespace *ndb_ts)

=== modified file 'sql/ha_ndbcluster.h'
--- a/sql/ha_ndbcluster.h	2012-04-11 12:33:47 +0000
+++ b/sql/ha_ndbcluster.h	2012-05-14 14:28:50 +0000
@@ -92,7 +92,8 @@ typedef enum ndb_write_op {
   NDB_PK_UPDATE = 2
 } NDB_WRITE_OP;
 
-class NDB_ALTER_DATA : public Sql_alloc
+//class NDB_ALTER_DATA : public Sql_alloc
+class NDB_ALTER_DATA : public inplace_alter_handler_ctx
 {
 public:
   NDB_ALTER_DATA(NdbDictionary::Dictionary *dict,
@@ -370,37 +371,33 @@ static void set_tabname(const char *path
                                      uint key_length,
                                      qc_engine_callback *engine_callback,
                                      ulonglong *engine_data);
+enum_alter_inplace_result
+  check_if_supported_inplace_alter(TABLE *altered_table,
+                                   Alter_inplace_info *ha_alter_info);
 
-#ifndef NDB_WITHOUT_ONLINE_ALTER
-  int check_if_supported_alter(TABLE *altered_table,
-                               HA_CREATE_INFO *create_info,
-                               HA_ALTER_INFO *alter_info,
-                               HA_ALTER_FLAGS *alter_flags,
-                               uint table_changes);
-
-  int alter_table_phase1(THD *thd,
-                         TABLE *altered_table,
-                         HA_CREATE_INFO *create_info,
-                         HA_ALTER_INFO *alter_info,
-                         HA_ALTER_FLAGS *alter_flags);
-
-  int alter_table_phase2(THD *thd,
-                         TABLE *altered_table,
-                         HA_CREATE_INFO *create_info,
-                         HA_ALTER_INFO *alter_info,
-                         HA_ALTER_FLAGS *alter_flags);
-
-  int alter_table_phase3(THD *thd, TABLE *table,
-                         HA_CREATE_INFO *create_info,
-                         HA_ALTER_INFO *alter_info,
-                         HA_ALTER_FLAGS *alter_flags);
-
-  int alter_table_abort(THD *thd,
-                        HA_ALTER_INFO *alter_info,
-                        HA_ALTER_FLAGS *alter_flags);
-#endif
+bool prepare_inplace_alter_table(TABLE *altered_table,
+                                    Alter_inplace_info *ha_alter_info);
+
+bool inplace_alter_table(TABLE *altered_table,
+                            Alter_inplace_info *ha_alter_info);
+  
+bool commit_inplace_alter_table(TABLE *altered_table,
+                                   Alter_inplace_info *ha_alter_info,
+                                   bool commit);
+
+void notify_table_changed();
 
 private:
+  void prepare_for_alter();
+  /*
+  int add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys,
+		handler_add_index **add);
+  */
+  int prepare_drop_index(TABLE *table_arg, uint *key_num, uint num_of_keys);
+  int final_drop_index(TABLE *table_arg);
+  
+  bool abort_inplace_alter_table(TABLE *altered_table,
+                                 Alter_inplace_info *ha_alter_info);
 #ifdef HAVE_NDB_BINLOG
   int prepare_conflict_detection(enum_conflicting_op_type op_type,
                                  const NdbRecord* key_rec,
@@ -488,9 +485,7 @@ private:
 
   int ndb_optimize_table(THD* thd, uint delay);
 
-#ifndef NDB_WITHOUT_ONLINE_ALTER
   int alter_frm(THD *thd, const char *file, NDB_ALTER_DATA *alter_data);
-#endif
 
   bool check_all_operations_for_error(NdbTransaction *trans,
                                       const NdbOperation *first,

=== modified file 'sql/handler.cc'
--- a/sql/handler.cc	2012-04-11 12:33:47 +0000
+++ b/sql/handler.cc	2012-05-14 14:28:50 +0000
@@ -3689,11 +3689,12 @@ handler::ha_discard_or_import_tablespace
 bool handler::ha_prepare_inplace_alter_table(TABLE *altered_table,
                                              Alter_inplace_info *ha_alter_info)
 {
+  DBUG_ENTER("handler::ha_prepare_inplace_alter_table");
   DBUG_ASSERT(table_share->tmp_table != NO_TMP_TABLE ||
               m_lock_type != F_UNLCK);
   mark_trx_read_write();
 
-  return prepare_inplace_alter_table(altered_table, ha_alter_info);
+  DBUG_RETURN(prepare_inplace_alter_table(altered_table, ha_alter_info));
 }
 
 
@@ -3726,7 +3727,7 @@ enum_alter_inplace_result
 handler::check_if_supported_inplace_alter(TABLE *altered_table,
                                           Alter_inplace_info *ha_alter_info)
 {
-  DBUG_ENTER("check_if_supported_alter");
+  DBUG_ENTER("handler::check_if_supported_inplace_alter");
 
   HA_CREATE_INFO *create_info= ha_alter_info->create_info;
 

=== modified file 'sql/handler.h'
--- a/sql/handler.h	2012-04-19 11:55:46 +0000
+++ b/sql/handler.h	2012-05-14 14:28:50 +0000
@@ -1067,6 +1067,19 @@ public:
   // Change the column format of column
   static const HA_ALTER_FLAGS ALTER_COLUMN_COLUMN_FORMAT = 1L << 20;
 
+  /* Changes to partitioning */
+  static const HA_ALTER_FLAGS ADD_PARTITION                = 1L << 21;
+  static const HA_ALTER_FLAGS DROP_PARTITION               = 1L << 22;
+  static const HA_ALTER_FLAGS ALTER_PARTITION              = 1L << 23;
+  static const HA_ALTER_FLAGS COALESCE_PARTITION           = 1L << 24;
+  static const HA_ALTER_FLAGS REORGANIZE_PARTITION         = 1L << 25;
+  static const HA_ALTER_FLAGS ALTER_TABLE_REORG            = 1L << 26;
+  static const HA_ALTER_FLAGS ALTER_REMOVE_PARTITIONING    = 1L << 27;
+  static const HA_ALTER_FLAGS ALTER_ALL_PARTITION          = 1L << 28;
+
+  /* Change of AUTO_INCREMENT value */
+  static const HA_ALTER_FLAGS CHANGE_AUTOINCREMENT_VALUE   = 1L << 29;
+
   /**
     Create options (like MAX_ROWS) for the new version of table.
 

=== modified file 'sql/sql_alter.h'
--- a/sql/sql_alter.h	2012-02-02 09:12:43 +0000
+++ b/sql/sql_alter.h	2012-05-14 14:28:50 +0000
@@ -108,6 +108,7 @@ public:
   // Set for REMOVE PARTITIONING
   static const uint ALTER_REMOVE_PARTITIONING   = 1L << 21;
 
+
   // Set for ADD FOREIGN KEY
   static const uint ADD_FOREIGN_KEY             = 1L << 22;
 
@@ -123,6 +124,11 @@ public:
   // Set for ADD [COLUMN] FIRST | AFTER
   static const uint ALTER_COLUMN_ORDER          = 1L << 26;
 
+  // Change the storage type of column 
+  static const uint ALTER_COLUMN_STORAGE_TYPE = 1L << 27;
+
+  // Change the column format of column
+  static const uint ALTER_COLUMN_COLUMN_FORMAT = 1L << 28;
 
   enum enum_enable_or_disable { LEAVE_AS_IS, ENABLE, DISABLE };
 
@@ -184,7 +190,6 @@ public:
   // Type of ALTER TABLE lock.
   enum_alter_table_lock         requested_lock;
 
-
   Alter_info() :
     flags(0),
     keys_onoff(LEAVE_AS_IS),

=== modified file 'sql/sql_partition.cc'
--- a/sql/sql_partition.cc	2012-04-11 12:33:47 +0000
+++ b/sql/sql_partition.cc	2012-05-14 14:28:50 +0000
@@ -4749,8 +4749,19 @@ uint prep_alter_part_table(THD *thd, TAB
     if (alter_info->flags & Alter_info::ALTER_TABLE_REORG)
     {
       uint new_part_no, curr_part_no;
+#ifndef MCP_WL3749
+      /* 'ALTER TABLE t REORG PARTITION' only allowed with auto partition 
+          if default partitioning is used */
+                          
+      if (tab_part_info->part_type != HASH_PARTITION ||
+          ((table->s->db_type()->partition_flags() & HA_USE_AUTO_PARTITION) &&
+           !tab_part_info->use_default_num_partitions) ||
+          ((!(table->s->db_type()->partition_flags() & HA_USE_AUTO_PARTITION))&&
+           tab_part_info->use_default_num_partitions))
+#else
       if (tab_part_info->part_type != HASH_PARTITION ||
           tab_part_info->use_default_num_partitions)
+#endif
       {
         my_error(ER_REORG_NO_PARAM_ERROR, MYF(0));
         goto err;
@@ -4764,7 +4775,15 @@ uint prep_alter_part_table(THD *thd, TAB
           after the change as before. Thus we can reply ok immediately
           without any changes at all.
         */
+#ifndef MCP_WL3749
+        flags= table->file->alter_table_flags(alter_info->flags);
+        if ((flags & (HA_FAST_CHANGE_PARTITION | HA_PARTITION_ONE_PHASE)) != 0)
+        {
+          *fast_alter_table= true;
+        }
+#else
         *fast_alter_table= true;
+#endif
         thd->work_part_info= tab_part_info;
         DBUG_RETURN(FALSE);
       }

=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	2012-04-19 11:55:46 +0000
+++ b/sql/sql_table.cc	2012-05-14 14:28:50 +0000
@@ -5246,6 +5246,7 @@ static bool fill_alter_inplace_info(THD 
   KEY_PART_INFO *key_part, *new_part;
   KEY_PART_INFO *end;
   uint candidate_key_count= 0;
+  HA_CREATE_INFO *create_info= ha_alter_info->create_info;
   Alter_info *alter_info= ha_alter_info->alter_info;
   DBUG_ENTER("fill_alter_inplace_info");
 
@@ -5258,6 +5259,29 @@ static bool fill_alter_inplace_info(THD 
     DBUG_RETURN(true);
 
   /* First we setup ha_alter_flags based on what was detected by parser. */
+
+  /* Check partition changes */
+  if (alter_info->flags & Alter_info::ALTER_ADD_PARTITION)
+    ha_alter_info->handler_flags|= Alter_inplace_info::ADD_PARTITION;
+  if (alter_info->flags & Alter_info::ALTER_DROP_PARTITION)
+    ha_alter_info->handler_flags|= Alter_inplace_info::DROP_PARTITION;
+  if (alter_info->flags & Alter_info::ALTER_PARTITION)
+    ha_alter_info->handler_flags|= Alter_inplace_info::ALTER_PARTITION;
+  if (alter_info->flags & Alter_info::ALTER_COALESCE_PARTITION)
+    ha_alter_info->handler_flags|= Alter_inplace_info::COALESCE_PARTITION;
+  if (alter_info->flags & Alter_info::ALTER_REORGANIZE_PARTITION)
+    ha_alter_info->handler_flags|= Alter_inplace_info::REORGANIZE_PARTITION;
+  if (alter_info->flags & Alter_info::ALTER_TABLE_REORG)
+    ha_alter_info->handler_flags|= Alter_inplace_info::ALTER_TABLE_REORG;
+  if (alter_info->flags & Alter_info::ALTER_REMOVE_PARTITIONING)
+    ha_alter_info->handler_flags|= Alter_inplace_info::ALTER_REMOVE_PARTITIONING;
+  if (alter_info->flags & Alter_info::ALTER_ALL_PARTITION)
+    ha_alter_info->handler_flags|= Alter_inplace_info::ALTER_ALL_PARTITION;
+
+  if (create_info->auto_increment_value !=
+      table->file->stats.auto_increment_value)
+    ha_alter_info->handler_flags|= Alter_inplace_info::CHANGE_AUTOINCREMENT_VALUE;
+
   if (alter_info->flags & Alter_info::ALTER_ADD_COLUMN)
     ha_alter_info->handler_flags|= Alter_inplace_info::ADD_COLUMN;
   if (alter_info->flags & Alter_info::ALTER_DROP_COLUMN)
@@ -5280,6 +5304,15 @@ static bool fill_alter_inplace_info(THD 
   if (alter_info->flags & Alter_info::ALTER_RENAME)
     ha_alter_info->handler_flags|= Alter_inplace_info::ALTER_RENAME;
 
+  if (alter_info->flags & Alter_info::ALTER_COLUMN_ORDER)
+    ha_alter_info->handler_flags|= Alter_inplace_info::ALTER_COLUMN_ORDER;
+
+  if (alter_info->flags & Alter_info::ALTER_COLUMN_STORAGE_TYPE)
+    ha_alter_info->handler_flags|= Alter_inplace_info::ALTER_COLUMN_STORAGE_TYPE;
+  if (alter_info->flags & Alter_info::ALTER_COLUMN_COLUMN_FORMAT)
+    ha_alter_info->handler_flags|= Alter_inplace_info::ALTER_COLUMN_COLUMN_FORMAT;
+
+
   /*
     If we altering table with old VARCHAR fields we will be automatically
     upgrading VARCHAR column types.
@@ -5300,6 +5333,8 @@ static bool fill_alter_inplace_info(THD 
   */
   for (f_ptr= table->field; (field= *f_ptr); f_ptr++)
   {
+    /* Clear marker for field in new index we are going to set later. */
+    field->flags&= ~FIELD_IN_ADD_INDEX;
     /* Clear marker for renamed field which we are going to set later. */
     field->flags&= ~FIELD_IS_RENAMED;
 
@@ -5561,6 +5596,8 @@ static bool fill_alter_inplace_info(THD 
   {
     table_key= *dropped_key;
 
+    DBUG_PRINT("info", ("Found dropped index %s", table_key->name));
+
     if (table_key->flags & HA_NOSAME)
     {
       /*
@@ -5587,6 +5624,8 @@ static bool fill_alter_inplace_info(THD 
   for (uint add_key_idx= 0; add_key_idx < ha_alter_info->index_add_count; add_key_idx++)
   {
     new_key= ha_alter_info->key_info_buffer + ha_alter_info->index_add_buffer[add_key_idx];
+    
+    DBUG_PRINT("info", ("Found added index %s", new_key->name));
 
     if (new_key->flags & HA_NOSAME)
     {
@@ -5610,6 +5649,22 @@ static bool fill_alter_inplace_info(THD 
     }
     else
       ha_alter_info->handler_flags|= Alter_inplace_info::ADD_INDEX;
+    /* Mark all fields in the new index */
+    KEY_PART_INFO *key_part= new_key->key_part;
+    KEY_PART_INFO *end= key_part + new_key->key_parts;
+    for(; key_part != end; key_part++)
+    {
+      /*
+        Check if all fields in key are declared
+        NOT NULL
+      */
+      if (key_part->fieldnr < table->s->fields)
+      {
+        /* Mark field to be part of new key */
+        Field *field= table->field[key_part->fieldnr];
+        field->flags|= FIELD_IN_ADD_INDEX;
+      }
+    }
   }
 
   DBUG_RETURN(false);
@@ -7085,8 +7140,13 @@ bool mysql_alter_table(THD *thd,char *ne
        Alter_info::ALTER_TABLE_ALGORITHM_INPLACE)
       || is_inplace_alter_impossible(table, create_info, alter_info)
 #ifdef WITH_PARTITION_STORAGE_ENGINE
+#ifndef MCP_WL3749
+      || (partition_changed &&
+          !(table->s->db_type()->partition_flags() & HA_USE_AUTO_PARTITION))
+#else
       || partition_changed
 #endif
+#endif
      )
   {
     if (alter_info->requested_algorithm ==

=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy	2012-04-20 15:37:05 +0000
+++ b/sql/sql_yacc.yy	2012-05-14 14:28:50 +0000
@@ -6307,7 +6307,11 @@ opt_attribute_list:
 attribute:
           NULL_SYM { Lex->type&= ~ NOT_NULL_FLAG; }
         | not NULL_SYM { Lex->type|= NOT_NULL_FLAG; }
-        | DEFAULT now_or_signed_literal { Lex->default_value=$2; }
+        | DEFAULT now_or_signed_literal 
+          { 
+            Lex->default_value=$2;
+            Lex->alter_info.flags|= Alter_info::ALTER_CHANGE_COLUMN_DEFAULT;
+          }
         | ON UPDATE_SYM now { Lex->on_update_value= $3; }
         | AUTO_INC { Lex->type|= AUTO_INCREMENT_FLAG | NOT_NULL_FLAG; }
         | SERIAL_SYM DEFAULT VALUE_SYM
@@ -6353,33 +6357,39 @@ attribute:
             Lex->type&= ~(FIELD_FLAGS_COLUMN_FORMAT_MASK);
             Lex->type|=
               (COLUMN_FORMAT_TYPE_DEFAULT << FIELD_FLAGS_COLUMN_FORMAT);
+            Lex->alter_info.flags|= Alter_info::ALTER_COLUMN_COLUMN_FORMAT;
           }
         | COLUMN_FORMAT_SYM FIXED_SYM
           {
             Lex->type&= ~(FIELD_FLAGS_COLUMN_FORMAT_MASK);
             Lex->type|=
               (COLUMN_FORMAT_TYPE_FIXED << FIELD_FLAGS_COLUMN_FORMAT);
+            Lex->alter_info.flags|= Alter_info::ALTER_COLUMN_COLUMN_FORMAT;
           }
         | COLUMN_FORMAT_SYM DYNAMIC_SYM
           {
             Lex->type&= ~(FIELD_FLAGS_COLUMN_FORMAT_MASK);
             Lex->type|=
               (COLUMN_FORMAT_TYPE_DYNAMIC << FIELD_FLAGS_COLUMN_FORMAT);
+            Lex->alter_info.flags|= Alter_info::ALTER_COLUMN_COLUMN_FORMAT;
           }
         | STORAGE_SYM DEFAULT
           {
             Lex->type&= ~(FIELD_FLAGS_STORAGE_MEDIA_MASK);
             Lex->type|= (HA_SM_DEFAULT << FIELD_FLAGS_STORAGE_MEDIA);
+            Lex->alter_info.flags|= Alter_info::ALTER_COLUMN_STORAGE_TYPE;
           }
         | STORAGE_SYM DISK_SYM
           {
             Lex->type&= ~(FIELD_FLAGS_STORAGE_MEDIA_MASK);
             Lex->type|= (HA_SM_DISK << FIELD_FLAGS_STORAGE_MEDIA);
+            Lex->alter_info.flags|= Alter_info::ALTER_COLUMN_STORAGE_TYPE;
           }
         | STORAGE_SYM MEMORY_SYM
           {
             Lex->type&= ~(FIELD_FLAGS_STORAGE_MEDIA_MASK);
             Lex->type|= (HA_SM_MEMORY << FIELD_FLAGS_STORAGE_MEDIA);
+            Lex->alter_info.flags|= Alter_info::ALTER_COLUMN_STORAGE_TYPE;
           }
         ;
 
@@ -7274,12 +7284,7 @@ opt_online_offline:
                                 ER_WARN_DEPRECATED_SYNTAX,
                                 ER(ER_WARN_DEPRECATED_SYNTAX),
                                 "ONLINE", "ALGORITHM=INPLACE");
-#ifdef MCP_WL6224
-            // ha_ndbcluster must be adapted to inplace alter
             $$= Alter_info::ALTER_TABLE_ALGORITHM_INPLACE;
-#else
-            $$= Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT;
-#endif
           }
         | OFFLINE_SYM
           {

=== modified file 'storage/innobase/handler/handler0alter.cc'
--- a/storage/innobase/handler/handler0alter.cc	2012-04-10 14:16:44 +0000
+++ b/storage/innobase/handler/handler0alter.cc	2012-05-14 14:28:50 +0000
@@ -50,7 +50,8 @@ static const Alter_inplace_info::HA_ALTE
 /** Operations for altering a table that InnoDB does not care about */
 static const Alter_inplace_info::HA_ALTER_FLAGS INNOBASE_INPLACE_IGNORE
 	= Alter_inplace_info::ALTER_COLUMN_DEFAULT
-	| Alter_inplace_info::CHANGE_CREATE_OPTION;
+	| Alter_inplace_info::CHANGE_CREATE_OPTION
+        | Alter_inplace_info::CHANGE_AUTOINCREMENT_VALUE;
 
 /** Operations that InnoDB can perform online */
 static const Alter_inplace_info::HA_ALTER_FLAGS INNOBASE_ONLINE_OPERATIONS

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk-cluster branch (Martin.Skold:3485 to 3486) WL#3749WL#5534Martin Skold16 May