List:Commits« Previous MessageNext Message »
From:Frazer Clement Date:March 21 2012 5:30pm
Subject:bzr push into mysql-5.5-cluster-7.2 branch (frazer.clement:3854 to 3855)
View as plain text  
 3855 Frazer Clement	2012-03-21 [merge]
      Merge 7.1->7.2

    modified:
      mysql-test/suite/ndb/r/ndb_add_partition.result
      mysql-test/suite/ndb/t/ndb_add_partition.test
      mysql-test/suite/ndb/t/ndb_addnode.test
      sql/ha_ndbcluster.cc
      sql/handler.h
      sql/sql_table.cc
      storage/ndb/include/util/InputStream.hpp
      storage/ndb/src/common/transporter/Transporter.cpp
      storage/ndb/test/run-test/conf-blade08.cnf
      storage/ndb/test/run-test/conf-ndb07.cnf
      storage/ndb/test/run-test/conf-tyr13.cnf
      storage/ndb/test/run-test/daily-basic-tests.txt
 3854 Jonas Oreland	2012-03-21 [merge]
      ndb - merge 71 to 72

    modified:
      storage/ndb/src/kernel/vm/mt-send-t.cpp
=== 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-03-21 15:42:47 +0000
@@ -24,6 +24,19 @@ ENGINE = NDB
 STORAGE DISK
 TABLESPACE ts1
 partition by key(a);
+CREATE TABLE t3 (a int unsigned not null,
+b int unsigned not null,
+c int unsigned not null,
+primary key(a,b),
+unique (b))
+MAX_ROWS=50000000
+ENGINE = NDB;
+CREATE TABLE t4 (a int unsigned not null,
+b int unsigned not null,
+c int unsigned not null,
+primary key(a,b),
+unique (b))
+ENGINE = NDB;
 INSERT INTO t1 VALUES
 (1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
 (6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10),
@@ -46,12 +59,20 @@ INSERT INTO t1 VALUES
 (91,91,91),(92,92,92),(93,93,93),(94,94,94),(95,95,95),
 (96,96,96),(97,97,97),(98,98,98),(99,99,99),(100,100,100);
 insert into t2 select * from t1;
+insert into t3 select * from t1;
+insert into t4 select * from t1;
 select count(*) from t1;
 count(*)
 100
 select count(*) from t2;
 count(*)
 100
+select count(*) from t3;
+count(*)
+100
+select count(*) from t4;
+count(*)
+100
 select * from t1 where a < 20;
 a	b	c
 1	1	1
@@ -142,24 +163,146 @@ a	b	c
 select * from t2 where b = 50;
 a	b	c
 50	50	50
+select * from t3 where a < 20;
+a	b	c
+1	1	1
+10	10	10
+11	11	11
+12	12	12
+13	13	13
+14	14	14
+15	15	15
+16	16	16
+17	17	17
+18	18	18
+19	19	19
+2	2	2
+3	3	3
+4	4	4
+5	5	5
+6	6	6
+7	7	7
+8	8	8
+9	9	9
+select * from t3 where a = 20;
+a	b	c
+20	20	20
+select * from t3 where a = 30;
+a	b	c
+30	30	30
+select * from t3 where a = 40;
+a	b	c
+40	40	40
+select * from t3 where a = 50;
+a	b	c
+50	50	50
+select * from t3 where b = 20;
+a	b	c
+20	20	20
+select * from t3 where b = 30;
+a	b	c
+30	30	30
+select * from t3 where b = 40;
+a	b	c
+40	40	40
+select * from t3 where b = 50;
+a	b	c
+50	50	50
+select * from t4 where a < 20;
+a	b	c
+1	1	1
+10	10	10
+11	11	11
+12	12	12
+13	13	13
+14	14	14
+15	15	15
+16	16	16
+17	17	17
+18	18	18
+19	19	19
+2	2	2
+3	3	3
+4	4	4
+5	5	5
+6	6	6
+7	7	7
+8	8	8
+9	9	9
+select * from t4 where a = 20;
+a	b	c
+20	20	20
+select * from t4 where a = 30;
+a	b	c
+30	30	30
+select * from t4 where a = 40;
+a	b	c
+40	40	40
+select * from t4 where a = 50;
+a	b	c
+50	50	50
+select * from t4 where b = 20;
+a	b	c
+20	20	20
+select * from t4 where b = 30;
+a	b	c
+30	30	30
+select * from t4 where b = 40;
+a	b	c
+40	40	40
+select * from t4 where b = 50;
+a	b	c
+50	50	50
 alter online table t1 reorganize partition;
 alter online table t2 reorganize partition;
+Cannot use normal reorganize partition on t3 as it has explicit MAX_ROWS set
+alter online table t3 reorganize partition;
+ERROR 42000: This version of MySQL doesn't yet support 'alter online table t3 reorganize partition'
+show warnings;
+Level	Code	Message
+Warning	1105	Cannot online REORGANIZE a table with Max_Rows set.  Use ALTER TABLE ... MAX_ROWS=<new_val> or offline REORGANIZE to redistribute this table.
+Error	1235	This version of MySQL doesn't yet support 'alter online table t3 reorganize partition'
+alter online table t3 max_rows=50000000;
+alter online table t4 reorganize partition;
+Check partitions added, expect 0 in all cases
 partitions added to t1
 t1_added
 0
 partitions added to t2
 t2_added
 0
+partitions added to t3
+t3_added
+0
+partitions added to t4
+t4_added
+0
 alter online table t1 add partition partitions 1;
 alter online table t2 add partition partitions 4;
-partitions added to t1
+alter online table t3 max_rows=100000000;
+alter online table t4 max_rows=100000000;
+ERROR 42000: This version of MySQL doesn't yet support 'alter online table t4 max_rows=100000000'
+partitions added to t1 (expect 1)
 t1_added
 1
-partitions added to t2
+partitions added to t2 (expect 4)
 t2_added
 4
+partitions added to t3 (expect 2)
+t3_added
+2
+partitions added to t4 (expect 0)
+t4_added
+0
 alter online table t1 reorganize partition;
 ERROR HY000: REORGANIZE PARTITION without parameters can only be used on auto-partitioned tables using HASH PARTITIONs
+alter online table t3 reorganize partition;
+ERROR 42000: This version of MySQL doesn't yet support 'alter online table t3 reorganize partition'
+show warnings;
+Level	Code	Message
+Warning	1105	Cannot online REORGANIZE a table with Max_Rows set.  Use ALTER TABLE ... MAX_ROWS=<new_val> or offline REORGANIZE to redistribute this table.
+Error	1235	This version of MySQL doesn't yet support 'alter online table t3 reorganize partition'
+alter online table t4 reorganize partition;
 select count(*) from t1;
 count(*)
 100
@@ -256,14 +399,109 @@ a	b	c
 select * from t2 where b = 50;
 a	b	c
 50	50	50
+select * from t3 where a < 20;
+a	b	c
+1	1	1
+10	10	10
+11	11	11
+12	12	12
+13	13	13
+14	14	14
+15	15	15
+16	16	16
+17	17	17
+18	18	18
+19	19	19
+2	2	2
+3	3	3
+4	4	4
+5	5	5
+6	6	6
+7	7	7
+8	8	8
+9	9	9
+select * from t3 where a = 20;
+a	b	c
+20	20	20
+select * from t3 where a = 30;
+a	b	c
+30	30	30
+select * from t3 where a = 40;
+a	b	c
+40	40	40
+select * from t3 where a = 50;
+a	b	c
+50	50	50
+select * from t3 where b = 20;
+a	b	c
+20	20	20
+select * from t3 where b = 30;
+a	b	c
+30	30	30
+select * from t3 where b = 40;
+a	b	c
+40	40	40
+select * from t3 where b = 50;
+a	b	c
+50	50	50
+select * from t4 where a < 20;
+a	b	c
+1	1	1
+10	10	10
+11	11	11
+12	12	12
+13	13	13
+14	14	14
+15	15	15
+16	16	16
+17	17	17
+18	18	18
+19	19	19
+2	2	2
+3	3	3
+4	4	4
+5	5	5
+6	6	6
+7	7	7
+8	8	8
+9	9	9
+select * from t4 where a = 20;
+a	b	c
+20	20	20
+select * from t4 where a = 30;
+a	b	c
+30	30	30
+select * from t4 where a = 40;
+a	b	c
+40	40	40
+select * from t4 where a = 50;
+a	b	c
+50	50	50
+select * from t4 where b = 20;
+a	b	c
+20	20	20
+select * from t4 where b = 30;
+a	b	c
+30	30	30
+select * from t4 where b = 40;
+a	b	c
+40	40	40
+select * from t4 where b = 50;
+a	b	c
+50	50	50
+drop table t4;
 alter online table t1 add partition partitions 2;
 alter online table t2 add partition partitions 1;
-partitions added to t1
+alter online table t3 max_rows=150000000;
+partitions added to t1 (expect 3)
 t1_added
 3
-partitions added to t2
+partitions added to t2 (expect 5)
 t2_added
 5
+partitions added to t3 (expect 4)
+t3_added
+4
 select count(*) from t1;
 count(*)
 100
@@ -360,7 +598,52 @@ a	b	c
 select * from t2 where b = 50;
 a	b	c
 50	50	50
-drop table t1,t2;
+select * from t3 where a < 20;
+a	b	c
+1	1	1
+10	10	10
+11	11	11
+12	12	12
+13	13	13
+14	14	14
+15	15	15
+16	16	16
+17	17	17
+18	18	18
+19	19	19
+2	2	2
+3	3	3
+4	4	4
+5	5	5
+6	6	6
+7	7	7
+8	8	8
+9	9	9
+select * from t3 where a = 20;
+a	b	c
+20	20	20
+select * from t3 where a = 30;
+a	b	c
+30	30	30
+select * from t3 where a = 40;
+a	b	c
+40	40	40
+select * from t3 where a = 50;
+a	b	c
+50	50	50
+select * from t3 where b = 20;
+a	b	c
+20	20	20
+select * from t3 where b = 30;
+a	b	c
+30	30	30
+select * from t3 where b = 40;
+a	b	c
+40	40	40
+select * from t3 where b = 50;
+a	b	c
+50	50	50
+drop table t1,t2,t3;
 alter tablespace ts1 drop datafile 'datafile.dat' engine = ndb;
 drop tablespace ts1 engine = ndb;
 drop logfile group lg1 engine = ndb;

=== modified file 'mysql-test/suite/ndb/t/ndb_add_partition.test'
--- a/mysql-test/suite/ndb/t/ndb_add_partition.test	2011-05-12 14:34:22 +0000
+++ b/mysql-test/suite/ndb/t/ndb_add_partition.test	2012-03-21 17:28:20 +0000
@@ -34,10 +34,29 @@ STORAGE DISK
 TABLESPACE ts1
 partition by key(a);
 
+CREATE TABLE t3 (a int unsigned not null,
+                 b int unsigned not null,
+                 c int unsigned not null,
+                 primary key(a,b),
+                 unique (b))
+MAX_ROWS=50000000
+ENGINE = NDB;
+
+CREATE TABLE t4 (a int unsigned not null,
+                 b int unsigned not null,
+                 c int unsigned not null,
+                 primary key(a,b),
+                 unique (b))
+ENGINE = NDB;
+
 let $t1_part_count_start = query_get_value(select count(*) as Value from information_schema.partitions where table_schema = 'test' and table_name = 't1', Value, 1);
 
 let $t2_part_count_start = query_get_value(select count(*) as Value from information_schema.partitions where table_schema = 'test' and table_name = 't2', Value, 1);
 
+let $t3_part_count_start = query_get_value(select count(*) as Value from information_schema.partitions where table_schema = 'test' and table_name = 't3', Value, 1);
+
+let $t4_part_count_start = query_get_value(select count(*) as Value from information_schema.partitions where table_schema = 'test' and table_name = 't4', Value, 1);
+
 INSERT INTO t1 VALUES
 (1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
 (6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10),
@@ -61,8 +80,12 @@ INSERT INTO t1 VALUES
 (96,96,96),(97,97,97),(98,98,98),(99,99,99),(100,100,100);
 
 insert into t2 select * from t1;
+insert into t3 select * from t1;
+insert into t4 select * from t1;
 select count(*) from t1;
 select count(*) from t2;
+select count(*) from t3;
+select count(*) from t4;
 --sorted_result
 select * from t1 where a < 20;
 --sorted_result
@@ -93,32 +116,89 @@ select * from t2 where b = 30;
 select * from t2 where b = 40;
 select * from t2 where b = 50;
 
+--sorted_result
+select * from t3 where a < 20;
+--sorted_result
+select * from t3 where a = 20;
+--sorted_result
+select * from t3 where a = 30;
+--sorted_result
+select * from t3 where a = 40;
+--sorted_result
+select * from t3 where a = 50;
+select * from t3 where b = 20;
+select * from t3 where b = 30;
+select * from t3 where b = 40;
+select * from t3 where b = 50;
+
+--sorted_result
+select * from t4 where a < 20;
+--sorted_result
+select * from t4 where a = 20;
+--sorted_result
+select * from t4 where a = 30;
+--sorted_result
+select * from t4 where a = 40;
+--sorted_result
+select * from t4 where a = 50;
+select * from t4 where b = 20;
+select * from t4 where b = 30;
+select * from t4 where b = 40;
+select * from t4 where b = 50;
+
 alter online table t1 reorganize partition;
 alter online table t2 reorganize partition;
+--echo Cannot use normal reorganize partition on t3 as it has explicit MAX_ROWS set
+--error 1235
+alter online table t3 reorganize partition;
+show warnings;
+
+alter online table t3 max_rows=50000000;
+alter online table t4 reorganize partition;
 
 let $t1_part_count_now = query_get_value(select count(*) as Value from information_schema.partitions where table_schema = 'test' and table_name = 't1', Value, 1);
 
 let $t2_part_count_now = query_get_value(select count(*) as Value from information_schema.partitions where table_schema = 'test' and table_name = 't2', Value, 1);
 
+let $t3_part_count_now = query_get_value(select count(*) as Value from information_schema.partitions where table_schema = 'test' and table_name = 't3', Value, 1);
+
+let $t4_part_count_now = query_get_value(select count(*) as Value from information_schema.partitions where table_schema = 'test' and table_name = 't4', Value, 1);
+
 --disable_query_log
+--echo Check partitions added, expect 0 in all cases
 --echo partitions added to t1
 eval select $t1_part_count_now - $t1_part_count_start as t1_added;
 --echo partitions added to t2
 eval select $t2_part_count_now - $t2_part_count_start as t2_added;
+--echo partitions added to t3
+eval select $t3_part_count_now - $t3_part_count_start as t3_added;
+--echo partitions added to t4
+eval select $t4_part_count_now - $t4_part_count_start as t4_added;
 --enable_query_log
 
 alter online table t1 add partition partitions 1;
 alter online table t2 add partition partitions 4;
+alter online table t3 max_rows=100000000; # Expansion of max rows
+--error 1235
+alter online table t4 max_rows=100000000; # Attempted introduction of max rows - fails
 
 let $t1_part_count_now = query_get_value(select count(*) as Value from information_schema.partitions where table_schema = 'test' and table_name = 't1', Value, 1);
 
 let $t2_part_count_now = query_get_value(select count(*) as Value from information_schema.partitions where table_schema = 'test' and table_name = 't2', Value, 1);
 
+let $t3_part_count_now = query_get_value(select count(*) as Value from information_schema.partitions where table_schema = 'test' and table_name = 't3', Value, 1);
+
+let $t4_part_count_now = query_get_value(select count(*) as Value from information_schema.partitions where table_schema = 'test' and table_name = 't4', Value, 1);
+
 --disable_query_log
---echo partitions added to t1
+--echo partitions added to t1 (expect 1)
 eval select $t1_part_count_now - $t1_part_count_start as t1_added;
---echo partitions added to t2
+--echo partitions added to t2 (expect 4)
 eval select $t2_part_count_now - $t2_part_count_start as t2_added;
+--echo partitions added to t3 (expect 2)
+eval select $t3_part_count_now - $t3_part_count_start as t3_added;
+--echo partitions added to t4 (expect 0)
+eval select $t4_part_count_now - $t4_part_count_start as t4_added;
 --enable_query_log
 
 # reorganize partition not support if not default partitioning
@@ -126,6 +206,14 @@ eval select $t2_part_count_now - $t2_par
 --error ER_REORG_NO_PARAM_ERROR
 alter online table t1 reorganize partition;
 
+# Following will fail as t3 has an explicit MAX_ROWS set 
+--error 1235 
+alter online table t3 reorganize partition;
+show warnings;
+
+# t4 reorg will succeed as t4 has no explicit MAX_ROWS
+alter online table t4 reorganize partition;
+
 select count(*) from t1;
 select count(*) from t2;
 --sorted_result
@@ -158,18 +246,55 @@ select * from t2 where b = 30;
 select * from t2 where b = 40;
 select * from t2 where b = 50;
 
+--sorted_result
+select * from t3 where a < 20;
+--sorted_result
+select * from t3 where a = 20;
+--sorted_result
+select * from t3 where a = 30;
+--sorted_result
+select * from t3 where a = 40;
+--sorted_result
+select * from t3 where a = 50;
+select * from t3 where b = 20;
+select * from t3 where b = 30;
+select * from t3 where b = 40;
+select * from t3 where b = 50;
+
+--sorted_result
+select * from t4 where a < 20;
+--sorted_result
+select * from t4 where a = 20;
+--sorted_result
+select * from t4 where a = 30;
+--sorted_result
+select * from t4 where a = 40;
+--sorted_result
+select * from t4 where a = 50;
+select * from t4 where b = 20;
+select * from t4 where b = 30;
+select * from t4 where b = 40;
+select * from t4 where b = 50;
+
+drop table t4;
+
 alter online table t1 add partition partitions 2;
 alter online table t2 add partition partitions 1;
+alter online table t3 max_rows=150000000;
 
 let $t1_part_count_now = query_get_value(select count(*) as Value from information_schema.partitions where table_schema = 'test' and table_name = 't1', Value, 1);
 
 let $t2_part_count_now = query_get_value(select count(*) as Value from information_schema.partitions where table_schema = 'test' and table_name = 't2', Value, 1);
 
+let $t3_part_count_now = query_get_value(select count(*) as Value from information_schema.partitions where table_schema = 'test' and table_name = 't3', Value, 1);
+
 --disable_query_log
---echo partitions added to t1
+--echo partitions added to t1 (expect 3)
 eval select $t1_part_count_now - $t1_part_count_start as t1_added;
---echo partitions added to t2
+--echo partitions added to t2 (expect 5)
 eval select $t2_part_count_now - $t2_part_count_start as t2_added;
+--echo partitions added to t3 (expect 4)
+eval select $t3_part_count_now - $t3_part_count_start as t3_added;
 --enable_query_log
 
 select count(*) from t1;
@@ -204,7 +329,22 @@ select * from t2 where b = 30;
 select * from t2 where b = 40;
 select * from t2 where b = 50;
 
-drop table t1,t2;
+--sorted_result
+select * from t3 where a < 20;
+--sorted_result
+select * from t3 where a = 20;
+--sorted_result
+select * from t3 where a = 30;
+--sorted_result
+select * from t3 where a = 40;
+--sorted_result
+select * from t3 where a = 50;
+select * from t3 where b = 20;
+select * from t3 where b = 30;
+select * from t3 where b = 40;
+select * from t3 where b = 50;
+
+drop table t1,t2,t3;
 alter tablespace ts1 drop datafile 'datafile.dat' engine = ndb;
 drop tablespace ts1 engine = ndb;
 drop logfile group lg1 engine = ndb;

=== modified file 'mysql-test/suite/ndb/t/ndb_addnode.test'
--- a/mysql-test/suite/ndb/t/ndb_addnode.test	2011-05-09 08:49:19 +0000
+++ b/mysql-test/suite/ndb/t/ndb_addnode.test	2012-03-21 17:28:20 +0000
@@ -20,9 +20,19 @@ CREATE TABLESPACE ts_1
 create table t1(id int NOT NULL PRIMARY KEY, data char(8)) engine=ndb;
 create table t2(id int NOT NULL PRIMARY KEY, data char(8))
 TABLESPACE ts_1 STORAGE DISK engine=ndb;
+# BUG#13714648
+create table t5(id int NOT NULL PRIMARY KEY, data char(8)) max_rows=50000000 engine=ndb;
 
 load data local infile 'suite/ndb/data/table_data10000.dat' into table t1 fields terminated by ' ' lines terminated by '\n';
 load data local infile 'suite/ndb/data/table_data10000.dat' into table t2 fields terminated by ' ' lines terminated by '\n';
+load data local infile 'suite/ndb/data/table_data10000.dat' into table t5 fields terminated by ' ' lines terminated by '\n';
+
+select count(1) as t1_part_count from information_schema.partitions where table_schema='test' and table_name='t1';
+select count(1) as t2_part_count from information_schema.partitions where table_schema='test' and table_name='t2';
+select @init_t5_part_count:= count(1) as t5_part_count from information_schema.partitions where table_schema='test' and table_name='t5';
+
+## Check details of t5 partitioning
+--exec $NDB_DESC -dtest -p -n t5
 
 ## Create nodegroup for "new" nodes
 --exec $NDB_MGM -e "create nodegroup 3,4"
@@ -48,6 +58,23 @@ insert into t4(id, data) VALUES
 
 alter online table t1 reorganize partition;
 alter online table t2 reorganize partition;
+alter online table t5 max_rows=100000000;
+
+select count(1) as t1_part_count from information_schema.partitions where table_schema='test' and table_name='t1';
+select count(1) as t2_part_count from information_schema.partitions where table_schema='test' and table_name='t2';
+select count(1) as t3_part_count from information_schema.partitions where table_schema='test' and table_name='t3';
+select count(1) as t4_part_count from information_schema.partitions where table_schema='test' and table_name='t4';
+select @reorg_t5_part_count:= count(1) as t5_part_count from information_schema.partitions where table_schema='test' and table_name='t5';
+
+## Check details of t5 partitioning
+--exec $NDB_DESC -dtest -p -n t5
+
+--let $t5_part_diff=query_get_value('select @reorg_t5_part_count-@init_t5_part_count as Value',Value,1)
+
+if (!$t5_part_diff)
+{
+  --die Table t5 was not reorganised
+}
 
 ## Drop nodegroup with "new" nodes is not allowed with data one those nodes
 # NOTE: --error=0 is due to return codes doesnt work on windoze
@@ -57,7 +84,7 @@ alter online table t2 reorganize partiti
 ## Nodegroup with "new" nodes still exist after dropping it as shown:
 --exec $NDB_MGM -e show
 
-drop table t1,t2,t3,t4;
+drop table t1,t2,t3,t4,t5;
 
 ## Drop nodegroup with "new" nodes
 --exec $NDB_MGM -e "drop nodegroup 1"

=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	2012-03-19 12:09:39 +0000
+++ b/sql/ha_ndbcluster.cc	2012-03-21 17:28:20 +0000
@@ -15624,7 +15624,9 @@ HA_ALTER_FLAGS supported_alter_operation
     HA_COLUMN_FORMAT |
     HA_ADD_PARTITION |
     HA_ALTER_TABLE_REORG |
-    HA_CHANGE_AUTOINCREMENT_VALUE;
+    HA_CHANGE_AUTOINCREMENT_VALUE | 
+    HA_ALTER_MAX_ROWS
+;
 }
 
 int ha_ndbcluster::check_if_supported_alter(TABLE *altered_table,
@@ -15695,7 +15697,8 @@ int ha_ndbcluster::check_if_supported_al
 
   if (alter_flags->is_set(HA_ADD_COLUMN) ||
       alter_flags->is_set(HA_ADD_PARTITION) ||
-      alter_flags->is_set(HA_ALTER_TABLE_REORG))
+      alter_flags->is_set(HA_ALTER_TABLE_REORG) ||
+      alter_flags->is_set(HA_ALTER_MAX_ROWS))
   {
      Ndb *ndb= get_ndb(thd);
      NDBDICT *dict= ndb->getDictionary();
@@ -15755,6 +15758,19 @@ int ha_ndbcluster::check_if_supported_al
 
      if (alter_flags->is_set(HA_ALTER_TABLE_REORG))
      {
+       /* 
+          Refuse if Max_rows has been used before...
+          Workaround is to use ALTER ONLINE TABLE <t> MAX_ROWS=<bigger>;
+       */
+       if (old_tab->getMaxRows() != 0)
+       {
+         push_warning(current_thd,
+                      MYSQL_ERROR::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
+                      "Cannot online REORGANIZE a table with Max_Rows set.  "
+                      "Use ALTER TABLE ... MAX_ROWS=<new_val> or offline REORGANIZE "
+                      "to redistribute this table.");
+         DBUG_RETURN(HA_ALTER_NOT_SUPPORTED);
+       }
        new_tab.setFragmentCount(0);
        new_tab.setFragmentData(0, 0);
      }
@@ -15763,6 +15779,27 @@ int ha_ndbcluster::check_if_supported_al
        DBUG_PRINT("info", ("Adding partition (%u)", part_info->num_parts));
        new_tab.setFragmentCount(part_info->num_parts);
      }
+     if (alter_flags->is_set(HA_ALTER_MAX_ROWS))
+     {
+       ulonglong rows= create_info->max_rows;
+       uint no_fragments= get_no_fragments(rows);
+       uint reported_frags= no_fragments;
+       if (adjusted_frag_count(ndb, no_fragments, reported_frags))
+       {
+         push_warning(current_thd,
+                      MYSQL_ERROR::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
+                      "Ndb might have problems storing the max amount "
+                      "of rows specified");
+       }
+       if (reported_frags < old_tab->getFragmentCount())
+       {
+         DBUG_PRINT("info", ("Online reduction in number of fragments not supported"));
+         DBUG_RETURN(HA_ALTER_NOT_SUPPORTED);
+       }
+       new_tab.setFragmentCount(reported_frags);
+       new_tab.setDefaultNoPartitionsFlag(false);
+       new_tab.setFragmentData(0, 0);
+     }
 
      NDB_Modifiers table_modifiers(ndb_table_modifiers);
      table_modifiers.parse(thd, "NDB_TABLE=", create_info->comment.str,
@@ -16081,7 +16118,9 @@ 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->is_set(HA_ALTER_TABLE_REORG) || 
+      alter_flags->is_set(HA_ADD_PARTITION) ||
+      alter_flags->is_set(HA_ALTER_MAX_ROWS))
   {
     if (alter_flags->is_set(HA_ALTER_TABLE_REORG))
     {
@@ -16093,7 +16132,29 @@ int ha_ndbcluster::alter_table_phase1(TH
       partition_info *part_info= altered_table->part_info;
       new_tab->setFragmentCount(part_info->num_parts);
     }
-
+    else if (alter_flags->is_set(HA_ALTER_MAX_ROWS))
+    {
+      ulonglong rows= create_info->max_rows;
+      uint no_fragments= get_no_fragments(rows);
+      uint reported_frags= no_fragments;
+      if (adjusted_frag_count(ndb, no_fragments, reported_frags))
+      {
+        DBUG_ASSERT(false); /* Checked above */
+      }
+      if (reported_frags < old_tab->getFragmentCount())
+      {
+        DBUG_ASSERT(false);
+        DBUG_RETURN(HA_ALTER_NOT_SUPPORTED);
+      }
+      /* Note we don't set the ndb table's max_rows param, as that 
+       * is considered a 'real' change
+       */
+      //new_tab->setMaxRows(create_info->max_rows);
+      new_tab->setFragmentCount(reported_frags);
+      new_tab->setDefaultNoPartitionsFlag(false);
+      new_tab->setFragmentData(0, 0);
+    }
+    
     int res= dict->prepareHashMap(*old_tab, *new_tab);
     if (res == -1)
     {

=== modified file 'sql/handler.h'
--- a/sql/handler.h	2012-02-23 15:41:31 +0000
+++ b/sql/handler.h	2012-03-21 17:28:20 +0000
@@ -58,7 +58,8 @@ class Alter_info;
 /* Bits to show what an alter table will do */
 #include <sql_bitmap.h>
 
-#define HA_MAX_ALTER_FLAGS 40
+#define HA_MAX_ALTER_FLAGS 41
+
 typedef Bitmap<HA_MAX_ALTER_FLAGS> HA_ALTER_FLAGS;
 
 #define HA_ADD_INDEX                  (0)
@@ -101,6 +102,7 @@ typedef Bitmap<HA_MAX_ALTER_FLAGS> HA_AL
 #define HA_ALTER_STORAGE_ENGINE       (37)
 #define HA_RECREATE                   (38)
 #define HA_ALTER_TABLE_REORG          (39)
+#define HA_ALTER_MAX_ROWS             (40)
 /* Remember to increase HA_MAX_ALTER_FLAGS when adding more flags! */
 
 /* Return values for check_if_supported_alter */

=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	2012-02-14 08:00:53 +0000
+++ b/sql/sql_table.cc	2012-03-21 17:28:20 +0000
@@ -5079,6 +5079,8 @@ compare_tables(THD *thd,
       *alter_flags|= HA_SET_DEFAULT_CHARACTER_SET;
     if (alter_info->flags & ALTER_RECREATE)
       *alter_flags|= HA_RECREATE;
+    if (create_info->used_fields & HA_CREATE_USED_MAX_ROWS)
+      *alter_flags|= HA_ALTER_MAX_ROWS;
     /* TODO check for ADD/DROP FOREIGN KEY */
     if (alter_info->flags & ALTER_FOREIGN_KEY)
       *alter_flags|=  HA_ALTER_FOREIGN_KEY;

=== modified file 'storage/ndb/include/util/InputStream.hpp'
--- a/storage/ndb/include/util/InputStream.hpp	2011-06-30 15:59:25 +0000
+++ b/storage/ndb/include/util/InputStream.hpp	2012-03-21 15:31:06 +0000
@@ -57,7 +57,7 @@ class SocketInputStream : public InputSt
   bool m_startover;
   bool m_timedout;
 public:
-  SocketInputStream(NDB_SOCKET_TYPE socket, unsigned read_timeout_ms = 60000);
+  SocketInputStream(NDB_SOCKET_TYPE socket, unsigned read_timeout_ms = 3000);
   virtual ~SocketInputStream() {}
   char* gets(char * buf, int bufLen);
   bool timedout() { return m_timedout; }

=== modified file 'storage/ndb/src/common/transporter/Transporter.cpp'
--- a/storage/ndb/src/common/transporter/Transporter.cpp	2011-12-10 19:02:03 +0000
+++ b/storage/ndb/src/common/transporter/Transporter.cpp	2012-03-21 17:28:20 +0000
@@ -74,7 +74,7 @@ Transporter::Transporter(TransporterRegi
   checksumUsed    = _checksum;
   signalIdUsed    = _signalId;
 
-  m_timeOutMillis = 30000;
+  m_timeOutMillis = 3000;
 
   m_connect_address.s_addr= 0;
   if(s_port<0)

=== modified file 'storage/ndb/test/run-test/conf-blade08.cnf'
--- a/storage/ndb/test/run-test/conf-blade08.cnf	2011-05-19 17:47:28 +0000
+++ b/storage/ndb/test/run-test/conf-blade08.cnf	2012-03-21 14:43:07 +0000
@@ -26,6 +26,7 @@ FragmentLogFileSize = 64M
 CompressedLCP=1
 CompressedBackup=1
 ODirect=1
+MaxNoOfAttributes=2000
 
 SharedGlobalMemory=256M
 InitialLogfileGroup=undo_buffer_size=64M;undofile01.dat:256M;undofile02.dat:128M

=== modified file 'storage/ndb/test/run-test/conf-ndb07.cnf'
--- a/storage/ndb/test/run-test/conf-ndb07.cnf	2011-05-19 18:19:47 +0000
+++ b/storage/ndb/test/run-test/conf-ndb07.cnf	2012-03-21 14:43:07 +0000
@@ -31,6 +31,7 @@ MaxNoOfSavedMessages= 5
 NoOfFragmentLogFiles = 8
 FragmentLogFileSize = 64M
 ODirect=1
+MaxNoOfAttributes=2000
 
 SharedGlobalMemory=256M
 DiskPageBufferMemory=256M

=== modified file 'storage/ndb/test/run-test/conf-tyr13.cnf'
--- a/storage/ndb/test/run-test/conf-tyr13.cnf	2011-12-09 15:11:21 +0000
+++ b/storage/ndb/test/run-test/conf-tyr13.cnf	2012-03-21 14:43:07 +0000
@@ -34,6 +34,7 @@ FragmentLogFileSize = 64M
 ODirect=1
 MaxNoOfExecutionThreads=8
 SendBufferMemory=4M
+MaxNoOfAttributes=2000
 
 SharedGlobalMemory=256M
 DiskPageBufferMemory=256M

=== modified file 'storage/ndb/test/run-test/daily-basic-tests.txt'
--- a/storage/ndb/test/run-test/daily-basic-tests.txt	2012-02-23 15:41:31 +0000
+++ b/storage/ndb/test/run-test/daily-basic-tests.txt	2012-03-21 17:28:20 +0000
@@ -946,7 +946,7 @@ max-time: 500
 cmd: testNdbApi
 args: -n Bug44065
 
-max-time: 500
+max-time: 1000
 cmd: testNdbApi
 args: -n Bug44065_org
 

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.5-cluster-7.2 branch (frazer.clement:3854 to 3855) Frazer Clement22 Mar