List:Commits« Previous MessageNext Message »
From:Jan Wedvik Date:January 21 2011 1:58pm
Subject:bzr push into mysql-5.1-telco-7.0-spj-scan-vs-scan branch (jan.wedvik:3412
to 3413)
View as plain text  
 3413 Jan Wedvik	2011-01-21 [merge]
      Merged from bk-internal.mysql.com/bzrroot/server/mysql-5.1-telco-7.0/ .

    added:
      mysql-test/suite/ndb/r/ndb_statistics.result
      mysql-test/suite/ndb/t/ndb_statistics.test
    modified:
      mysql-test/suite/ndb/r/ndb_alter_table3.result
      mysql-test/suite/ndb/r/ndb_index_unique.result
      mysql-test/suite/ndb/r/ndb_join_pushdown.result
      mysql-test/suite/ndb/r/ndb_read_multi_range.result
      mysql-test/suite/rpl_ndb/r/rpl_ndb_ddl.result
      sql/ha_ndbcluster.cc
      storage/ndb/include/kernel/signaldata/DisconnectRep.hpp
      storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
      storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp
      storage/ndb/src/kernel/blocks/dbtc/DbtcInit.cpp
      storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
      storage/ndb/src/kernel/blocks/dbtup/DbtupTrigger.cpp
      storage/ndb/src/kernel/blocks/dbutil/DbUtil.cpp
      storage/ndb/src/kernel/blocks/dbutil/DbUtil.hpp
      storage/ndb/src/kernel/blocks/ndbcntr/Ndbcntr.hpp
      storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp
      storage/ndb/src/mgmsrv/ConfigManager.cpp
      storage/ndb/src/mgmsrv/ConfigManager.hpp
      storage/ndb/src/mgmsrv/MgmtSrvr.cpp
      storage/ndb/src/ndbapi/ClusterMgr.cpp
      storage/ndb/src/ndbapi/ClusterMgr.hpp
      storage/ndb/src/ndbapi/TransporterFacade.cpp
      storage/ndb/src/ndbapi/trp_node.cpp
      storage/ndb/src/ndbapi/trp_node.hpp
      storage/ndb/test/ndbapi/testMgmd.cpp
      storage/ndb/test/run-test/atrt.hpp
      storage/ndb/test/run-test/main.cpp
 3412 Jan Wedvik	2011-01-18
      Trying to fix build break on Windows.

    modified:
      storage/ndb/CMakeLists.txt
=== modified file 'mysql-test/suite/ndb/r/ndb_alter_table3.result'
--- a/mysql-test/suite/ndb/r/ndb_alter_table3.result	2008-08-12 15:35:47 +0000
+++ b/mysql-test/suite/ndb/r/ndb_alter_table3.result	2011-01-18 11:49:03 +0000
@@ -6,8 +6,8 @@ create index c on t1(c);
 show indexes from t1;
 Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment
 t1	0	PRIMARY	1	a	A	3	NULL	NULL		BTREE	
-t1	1	b	1	b	A	3	NULL	NULL	YES	BTREE	
-t1	1	c	1	c	A	3	NULL	NULL	YES	BTREE	
+t1	1	b	1	b	A	NULL	NULL	NULL	YES	BTREE	
+t1	1	c	1	c	A	NULL	NULL	NULL	YES	BTREE	
 select * from t1 where c = 'two';
 a	b	c
 2	two	two
@@ -15,7 +15,7 @@ alter table t1 drop index c;
 show indexes from t1;
 Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment
 t1	0	PRIMARY	1	a	A	3	NULL	NULL		BTREE	
-t1	1	b	1	b	A	3	NULL	NULL	YES	BTREE	
+t1	1	b	1	b	A	NULL	NULL	NULL	YES	BTREE	
 select * from t1 where c = 'two';
 a	b	c
 2	two	two

=== modified file 'mysql-test/suite/ndb/r/ndb_index_unique.result'
--- a/mysql-test/suite/ndb/r/ndb_index_unique.result	2011-01-17 14:33:23 +0000
+++ b/mysql-test/suite/ndb/r/ndb_index_unique.result	2011-01-21 13:56:43 +0000
@@ -185,7 +185,7 @@ set @old_ecpd = @@session.engine_conditi
 set engine_condition_pushdown = true;
 explain select * from t2 where (b = 3 OR b = 5) AND c IS NULL AND a < 9 order by a;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	range	PRIMARY,b	PRIMARY	4	NULL	1	Using where with pushed condition
+1	SIMPLE	t2	range	PRIMARY,b	PRIMARY	4	NULL	10	Using where with pushed condition
 select * from t2 where (b = 3 OR b = 5) AND c IS NULL AND a < 9 order by a;
 a	b	c
 3	3	NULL

=== modified file 'mysql-test/suite/ndb/r/ndb_join_pushdown.result'
--- a/mysql-test/suite/ndb/r/ndb_join_pushdown.result	2011-01-04 14:50:54 +0000
+++ b/mysql-test/suite/ndb/r/ndb_join_pushdown.result	2011-01-21 13:56:43 +0000
@@ -2106,7 +2106,7 @@ a3	b3	c3	d3	a3	b3	c3	d3
 explain extended
 select * from t3 x, t3 y where x.d3>=31 and y.d3=x.b3;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
-1	SIMPLE	x	range	t3_d3	t3_d3	4	NULL	1	100.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`x`.`d3` >= 31)
+1	SIMPLE	x	range	t3_d3	t3_d3	4	NULL	10	30.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`x`.`d3` >= 31)
 1	SIMPLE	y	eq_ref	t3_d3	t3_d3	4	test.x.b3	1	100.00	Child of pushed join@1
 Warnings:
 Note	1003	select `test`.`x`.`a3` AS `a3`,`test`.`x`.`b3` AS `b3`,`test`.`x`.`c3` AS `c3`,`test`.`x`.`d3` AS `d3`,`test`.`y`.`a3` AS `a3`,`test`.`y`.`b3` AS `b3`,`test`.`y`.`c3` AS `c3`,`test`.`y`.`d3` AS `d3` from `test`.`t3` `x` join `test`.`t3` `y` where ((`test`.`y`.`d3` = `test`.`x`.`b3`) and (`test`.`x`.`d3` >= 31))
@@ -2222,7 +2222,7 @@ left outer join t3 as t2 on t2.d3 = t1.a
 left outer join t3 as t3 on t3.a3 = t2.d3
 where t1.d3 >= 47;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
-1	SIMPLE	t1	range	d3	d3	5	NULL	1	100.00	Parent of 3 pushed join@1; Using where with pushed condition: (`test`.`t1`.`d3` >= 47)
+1	SIMPLE	t1	range	d3	d3	5	NULL	10	40.00	Parent of 3 pushed join@1; Using where with pushed condition: (`test`.`t1`.`d3` >= 47)
 1	SIMPLE	t2	ref	d3	d3	5	test.t1.a3	1	100.00	Child of pushed join@1
 1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	4	test.t2.d3	1	100.00	Child of pushed join@1
 Warnings:
@@ -2257,7 +2257,7 @@ left outer join t3 as t2 on t2.d3 = t1.a
 left outer join t3 as t3 on t3.a3 = t2.d3
 where t1.d3 is not null;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
-1	SIMPLE	t1	range	d3	d3	5	NULL	1	100.00	Parent of 3 pushed join@1; Using where with pushed condition: (`test`.`t1`.`d3` is not null)
+1	SIMPLE	t1	range	d3	d3	5	NULL	10	40.00	Parent of 3 pushed join@1; Using where with pushed condition: (`test`.`t1`.`d3` is not null)
 1	SIMPLE	t2	ref	d3	d3	5	test.t1.a3	1	100.00	Child of pushed join@1
 1	SIMPLE	t3	eq_ref	PRIMARY	PRIMARY	4	test.t2.d3	1	100.00	Child of pushed join@1
 Warnings:
@@ -3831,7 +3831,7 @@ on x1.a=x2.u and x2.a = x3.b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	SIMPLE	x1	ALL	NULL	NULL	NULL	NULL	12	16.67	Parent of 3 pushed join@1
 1	SIMPLE	x2	eq_ref	ix2	ix2	4	test.x1.a	1	100.00	Child of pushed join@1
-1	SIMPLE	x3	ref	ix1	ix1	5	test.x2.a	1	100.00	Child of pushed join@1; Using where
+1	SIMPLE	x3	ref	ix1	ix1	5	test.x2.a	2	100.00	Child of pushed join@1; Using where
 Warnings:
 Note	1003	select count(0) AS `count(*)` from `test`.`t1` `x1` join `test`.`t1` `x2` join `test`.`t1` `x3` where ((`test`.`x3`.`b` = `test`.`x2`.`a`) and (`test`.`x2`.`u` = `test`.`x1`.`a`))
 select count(*) from t1 as x1 join t1 as x2 join t1 as x3 
@@ -3843,7 +3843,7 @@ where x1.u=x2.pk and x1.a=x3.b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	SIMPLE	x1	ALL	ix2	NULL	NULL	NULL	12	100.00	Parent of 3 pushed join@1
 1	SIMPLE	x2	eq_ref	PRIMARY	PRIMARY	4	test.x1.u	1	100.00	Child of pushed join@1
-1	SIMPLE	x3	ref	ix1	ix1	5	test.x1.a	1	100.00	Child of pushed join@1; Using where
+1	SIMPLE	x3	ref	ix1	ix1	5	test.x1.a	2	100.00	Child of pushed join@1; Using where
 Warnings:
 Note	1003	select count(0) AS `count(*)` from `test`.`t1` `x1` join `test`.`t1` `x2` join `test`.`t1` `x3` where ((`test`.`x3`.`b` = `test`.`x1`.`a`) and (`test`.`x2`.`pk` = `test`.`x1`.`u`))
 select count(*) from t1 as x1, t1 as x2, t1 as x3 
@@ -3854,7 +3854,7 @@ insert into t1 values (12,12,20,10);
 explain extended select count(*) from t1 as x1 left join t1 as x2 on x1.a=x2.b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	SIMPLE	x1	ALL	NULL	NULL	NULL	NULL	13	92.31	
-1	SIMPLE	x2	ref	ix1	ix1	5	test.x1.a	1	100.00	
+1	SIMPLE	x2	ref	ix1	ix1	5	test.x1.a	2	100.00	
 Warnings:
 Note	1644	Can't push table 'x2' as child of 'x1', outer join with scan-ancestor 'x1' not implemented
 Note	1003	select count(0) AS `count(*)` from `test`.`t1` `x1` left join `test`.`t1` `x2` on((`test`.`x1`.`a` = `test`.`x2`.`b`)) where 1
@@ -3872,7 +3872,7 @@ left join t1 as x3 on x2.a=x3.b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	SIMPLE	x1	ALL	NULL	NULL	NULL	NULL	13	100.00	Parent of 2 pushed join@1
 1	SIMPLE	x2	eq_ref	PRIMARY	PRIMARY	4	test.x1.u	1	100.00	Child of pushed join@1
-1	SIMPLE	x3	ref	ix1	ix1	5	test.x2.a	1	100.00	
+1	SIMPLE	x3	ref	ix1	ix1	5	test.x2.a	2	100.00	
 Warnings:
 Note	1644	Can't push table 'x3' as child of 'x1', outer join with scan-ancestor 'x1' not implemented
 Note	1003	select count(0) AS `count(*)` from `test`.`t1` `x1` left join `test`.`t1` `x2` on((`test`.`x1`.`u` = `test`.`x2`.`pk`)) left join `test`.`t1` `x3` on((`test`.`x2`.`a` = `test`.`x3`.`b`)) where 1
@@ -3896,9 +3896,9 @@ left join t1 as x5 on x4.a=x5.b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	SIMPLE	x1	ALL	NULL	NULL	NULL	NULL	13	100.00	Parent of 2 pushed join@1
 1	SIMPLE	x2	eq_ref	PRIMARY	PRIMARY	4	test.x1.u	1	100.00	Child of pushed join@1
-1	SIMPLE	x3	ref	ix1	ix1	5	test.x2.a	1	100.00	Parent of 2 pushed join@2
+1	SIMPLE	x3	ref	ix1	ix1	5	test.x2.a	2	100.00	Parent of 2 pushed join@2
 1	SIMPLE	x4	eq_ref	PRIMARY	PRIMARY	4	test.x3.u	1	100.00	Child of pushed join@2
-1	SIMPLE	x5	ref	ix1	ix1	5	test.x4.a	1	100.00	
+1	SIMPLE	x5	ref	ix1	ix1	5	test.x4.a	2	100.00	
 Warnings:
 Note	1644	Can't push table 'x3' as child of 'x1', outer join with scan-ancestor 'x1' not implemented
 Note	1644	Can't push table 'x4' as child of 'x1', column 'x3.u' is outside scope of pushable join
@@ -3926,7 +3926,7 @@ join t1 as x2 on x1.a=x2.b
 where x1.pk = 1 or x1.u=1;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	SIMPLE	x1	index_merge	PRIMARY,ix2	ix2,PRIMARY	4,4	NULL	2	100.00	Using sort_union(ix2,PRIMARY); Using where with pushed condition: ((`test`.`x1`.`pk` = 1) or (`test`.`x1`.`u` = 1))
-1	SIMPLE	x2	ref	ix1	ix1	5	test.x1.a	1	100.00	Using where
+1	SIMPLE	x2	ref	ix1	ix1	5	test.x1.a	2	100.00	Using where
 Warnings:
 Note	1644	Push of table 'x2' as scan-child with lookup-root 'x1' not implemented
 Note	1003	select count(0) AS `count(*)` from `test`.`t1` `x1` join `test`.`t1` `x2` where ((`test`.`x2`.`b` = `test`.`x1`.`a`) and ((`test`.`x1`.`pk` = 1) or (`test`.`x1`.`u` = 1)))
@@ -3943,8 +3943,8 @@ left join 
 on table1.pk = table2.b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	SIMPLE	table1	ALL	NULL	NULL	NULL	NULL	13	100.00	
-1	SIMPLE	table2	ref	PRIMARY,ix1	ix1	5	test.table1.pk	1	100.00	Parent of 2 pushed join@1
-1	SIMPLE	table3	ref	ix1	ix1	5	test.table2.pk	1	100.00	Child of pushed join@1
+1	SIMPLE	table2	ref	PRIMARY,ix1	ix1	5	test.table1.pk	2	100.00	Parent of 2 pushed join@1
+1	SIMPLE	table3	ref	ix1	ix1	5	test.table2.pk	2	100.00	Child of pushed join@1
 Warnings:
 Note	1644	Can't push table 'table2' as child of 'table1', outer join with scan-ancestor 'table1' not implemented
 Note	1644	Can't push table 'table3' as child of 'table1', column 'table2.pk' is outside scope of pushable join
@@ -3983,14 +3983,14 @@ explain extended select straight_join * 
 inner join t1 as x2 on x2.b = x1.a;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	SIMPLE	x1	ALL	NULL	NULL	NULL	NULL	13	100.00	Parent of 2 pushed join@1
-1	SIMPLE	x2	ref	ix1	ix1	5	test.x1.a	1	100.00	Child of pushed join@1; Using where
+1	SIMPLE	x2	ref	ix1	ix1	5	test.x1.a	2	100.00	Child of pushed join@1; Using where
 Warnings:
 Note	1003	select straight_join `test`.`x1`.`pk` AS `pk`,`test`.`x1`.`u` AS `u`,`test`.`x1`.`a` AS `a`,`test`.`x1`.`b` AS `b`,`test`.`x2`.`pk` AS `pk`,`test`.`x2`.`u` AS `u`,`test`.`x2`.`a` AS `a`,`test`.`x2`.`b` AS `b` from `test`.`t1` `x1` join `test`.`t1` `x2` where (`test`.`x2`.`b` = `test`.`x1`.`a`)
 explain extended select straight_join * from t1 as x1 
 left join t1 as x2 on x2.b = x1.a;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	SIMPLE	x1	ALL	NULL	NULL	NULL	NULL	13	100.00	
-1	SIMPLE	x2	ref	ix1	ix1	5	test.x1.a	1	100.00	
+1	SIMPLE	x2	ref	ix1	ix1	5	test.x1.a	2	100.00	
 Warnings:
 Note	1644	Can't push table 'x2' as child of 'x1', outer join with scan-ancestor 'x1' not implemented
 Note	1003	select straight_join `test`.`x1`.`pk` AS `pk`,`test`.`x1`.`u` AS `u`,`test`.`x1`.`a` AS `a`,`test`.`x1`.`b` AS `b`,`test`.`x2`.`pk` AS `pk`,`test`.`x2`.`u` AS `u`,`test`.`x2`.`a` AS `a`,`test`.`x2`.`b` AS `b` from `test`.`t1` `x1` left join `test`.`t1` `x2` on((`test`.`x2`.`b` = `test`.`x1`.`a`)) where 1
@@ -4009,7 +4009,7 @@ on x2.pk = x1.a;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	SIMPLE	x1	ALL	NULL	NULL	NULL	NULL	13	100.00	Parent of 3 pushed join@1
 1	SIMPLE	x2	eq_ref	PRIMARY	PRIMARY	4	test.x1.a	1	100.00	Child of pushed join@1
-1	SIMPLE	x3	ref	ix1	ix1	5	test.x2.a	1	100.00	Child of pushed join@1; Using where
+1	SIMPLE	x3	ref	ix1	ix1	5	test.x2.a	2	100.00	Child of pushed join@1; Using where
 Warnings:
 Note	1003	select straight_join `test`.`x1`.`pk` AS `pk`,`test`.`x1`.`u` AS `u`,`test`.`x1`.`a` AS `a`,`test`.`x1`.`b` AS `b`,`test`.`x2`.`pk` AS `pk`,`test`.`x2`.`u` AS `u`,`test`.`x2`.`a` AS `a`,`test`.`x2`.`b` AS `b`,`test`.`x3`.`pk` AS `pk`,`test`.`x3`.`u` AS `u`,`test`.`x3`.`a` AS `a`,`test`.`x3`.`b` AS `b` from `test`.`t1` `x1` join `test`.`t1` `x2` join `test`.`t1` `x3` where ((`test`.`x3`.`b` = `test`.`x2`.`a`) and (`test`.`x2`.`pk` = `test`.`x1`.`a`))
 explain extended select straight_join * from 
@@ -4019,7 +4019,7 @@ on x2.pk = x1.a;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	SIMPLE	x1	ALL	NULL	NULL	NULL	NULL	13	100.00	Parent of 2 pushed join@1
 1	SIMPLE	x2	eq_ref	PRIMARY	PRIMARY	4	test.x1.a	1	100.00	Child of pushed join@1
-1	SIMPLE	x3	ref	ix1	ix1	5	test.x2.a	1	100.00	
+1	SIMPLE	x3	ref	ix1	ix1	5	test.x2.a	2	100.00	
 Warnings:
 Note	1644	Can't push table 'x3' as child of 'x1', outer join with scan-ancestor 'x1' not implemented
 Note	1003	select straight_join `test`.`x1`.`pk` AS `pk`,`test`.`x1`.`u` AS `u`,`test`.`x1`.`a` AS `a`,`test`.`x1`.`b` AS `b`,`test`.`x2`.`pk` AS `pk`,`test`.`x2`.`u` AS `u`,`test`.`x2`.`a` AS `a`,`test`.`x2`.`b` AS `b`,`test`.`x3`.`pk` AS `pk`,`test`.`x3`.`u` AS `u`,`test`.`x3`.`a` AS `a`,`test`.`x3`.`b` AS `b` from `test`.`t1` `x1` left join (`test`.`t1` `x2` join `test`.`t1` `x3`) on(((`test`.`x2`.`pk` = `test`.`x1`.`a`) and (`test`.`x3`.`b` = `test`.`x2`.`a`))) where 1
@@ -4028,8 +4028,8 @@ join t1 as x2 on x2.b = x1.a
 join t1 as x3 on x3.b = x1.b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	SIMPLE	x1	ALL	ix1	NULL	NULL	NULL	13	100.00	Parent of 3 pushed join@1
-1	SIMPLE	x2	ref	ix1	ix1	5	test.x1.a	1	100.00	Child of pushed join@1; Using where
-1	SIMPLE	x3	ref	ix1	ix1	5	test.x1.b	1	100.00	Child of pushed join@1; Using where
+1	SIMPLE	x2	ref	ix1	ix1	5	test.x1.a	2	100.00	Child of pushed join@1; Using where
+1	SIMPLE	x3	ref	ix1	ix1	5	test.x1.b	2	100.00	Child of pushed join@1; Using where
 Warnings:
 Note	1003	select straight_join count(0) AS `count(*)` from `test`.`t1` `x1` join `test`.`t1` `x2` join `test`.`t1` `x3` where ((`test`.`x2`.`b` = `test`.`x1`.`a`) and (`test`.`x3`.`b` = `test`.`x1`.`b`))
 set ndb_join_pushdown=off;
@@ -4049,8 +4049,8 @@ left join t1 as x2 on x2.b = x1.a
 join t1 as x3 on x3.b = x1.b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	SIMPLE	x1	ALL	ix1	NULL	NULL	NULL	13	100.00	Parent of 2 pushed join@1
-1	SIMPLE	x2	ref	ix1	ix1	5	test.x1.a	1	100.00	
-1	SIMPLE	x3	ref	ix1	ix1	5	test.x1.b	1	100.00	Child of pushed join@1; Using where
+1	SIMPLE	x2	ref	ix1	ix1	5	test.x1.a	2	100.00	
+1	SIMPLE	x3	ref	ix1	ix1	5	test.x1.b	2	100.00	Child of pushed join@1; Using where
 Warnings:
 Note	1644	Can't push table 'x2' as child of 'x1', outer join with scan-ancestor 'x1' not implemented
 Note	1003	select straight_join count(0) AS `count(*)` from `test`.`t1` `x1` left join `test`.`t1` `x2` on((`test`.`x2`.`b` = `test`.`x1`.`a`)) join `test`.`t1` `x3` where (`test`.`x3`.`b` = `test`.`x1`.`b`)
@@ -4071,8 +4071,8 @@ join t1 as x2 on x2.b = x1.a
 left join t1 as x3 on x3.b = x1.b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	SIMPLE	x1	ALL	NULL	NULL	NULL	NULL	13	100.00	Parent of 2 pushed join@1
-1	SIMPLE	x2	ref	ix1	ix1	5	test.x1.a	1	100.00	Child of pushed join@1; Using where
-1	SIMPLE	x3	ref	ix1	ix1	5	test.x1.b	1	100.00	
+1	SIMPLE	x2	ref	ix1	ix1	5	test.x1.a	2	100.00	Child of pushed join@1; Using where
+1	SIMPLE	x3	ref	ix1	ix1	5	test.x1.b	2	100.00	
 Warnings:
 Note	1644	Can't push table 'x3' as child of 'x1', outer join with scan-descendant 'x2' not implemented
 Note	1003	select straight_join count(0) AS `count(*)` from `test`.`t1` `x1` join `test`.`t1` `x2` left join `test`.`t1` `x3` on((`test`.`x3`.`b` = `test`.`x1`.`b`)) where (`test`.`x2`.`b` = `test`.`x1`.`a`)
@@ -4094,9 +4094,9 @@ join t1 as x2 on x2.b = x1.a
 join t1 as x3 on x3.pk = x1.a join t1 as x4 on x4.b = x3.a;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	SIMPLE	x1	ALL	NULL	NULL	NULL	NULL	13	100.00	Parent of 3 pushed join@1
-1	SIMPLE	x2	ref	ix1	ix1	5	test.x1.a	1	100.00	Child of pushed join@1; Using where
+1	SIMPLE	x2	ref	ix1	ix1	5	test.x1.a	2	100.00	Child of pushed join@1; Using where
 1	SIMPLE	x3	eq_ref	PRIMARY	PRIMARY	4	test.x1.a	1	100.00	Child of pushed join@1
-1	SIMPLE	x4	ref	ix1	ix1	5	test.x3.a	1	100.00	Using where
+1	SIMPLE	x4	ref	ix1	ix1	5	test.x3.a	2	100.00	Using where
 Warnings:
 Note	1644	Can't push table 'x4' as child of 'x1', implementation limitations due to bushy scan with 'x2' indirect through 'x1'
 Note	1003	select straight_join count(0) AS `count(*)` from `test`.`t1` `x1` join `test`.`t1` `x2` join `test`.`t1` `x3` join `test`.`t1` `x4` where ((`test`.`x2`.`b` = `test`.`x1`.`a`) and (`test`.`x3`.`pk` = `test`.`x1`.`a`) and (`test`.`x4`.`b` = `test`.`x3`.`a`))
@@ -4117,7 +4117,7 @@ left join t1 as x3 on x3.b = x1.a
 join t1 as x2 on x2.pk = x1.a;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	SIMPLE	x1	ALL	NULL	NULL	NULL	NULL	13	100.00	Parent of 2 pushed join@1
-1	SIMPLE	x3	ref	ix1	ix1	5	test.x1.a	1	100.00	
+1	SIMPLE	x3	ref	ix1	ix1	5	test.x1.a	2	100.00	
 1	SIMPLE	x2	eq_ref	PRIMARY	PRIMARY	4	test.x1.a	1	100.00	Child of pushed join@1
 Warnings:
 Note	1644	Can't push table 'x3' as child of 'x1', outer join with scan-ancestor 'x1' not implemented
@@ -4141,7 +4141,7 @@ explain extended select count(*) from 
 left outer join t1 as z on z.u = x.a;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	SIMPLE	x	ALL	NULL	NULL	NULL	NULL	13	100.00	Parent of 3 pushed join@1
-1	SIMPLE	y	ref	ix1	ix1	5	test.x.a	1	100.00	Child of pushed join@1; Using where
+1	SIMPLE	y	ref	ix1	ix1	5	test.x.a	2	100.00	Child of pushed join@1; Using where
 1	SIMPLE	z	eq_ref	ix2	ix2	4	test.y.b	1	100.00	Child of pushed join@1
 Warnings:
 Note	1003	select count(0) AS `count(*)` from `test`.`t1` `x` join `test`.`t1` `y` left join `test`.`t1` `z` on(((`test`.`y`.`b` = `test`.`x`.`a`) and (`test`.`z`.`u` = `test`.`x`.`a`))) where (`test`.`y`.`b` = `test`.`x`.`a`)
@@ -4422,8 +4422,8 @@ join t1 as x3 on x2.a=x3.b 
 order by x1.pk limit 70;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	SIMPLE	x1	index	NULL	PRIMARY	4	NULL	10	20.00	Parent of 3 pushed join@1; Using temporary; Using filesort
-1	SIMPLE	x2	ref	ix1	ix1	5	test.x1.a	1	100.00	Child of pushed join@1; Using where
-1	SIMPLE	x3	ref	ix1	ix1	5	test.x2.a	1	100.00	Child of pushed join@1; Using where
+1	SIMPLE	x2	ref	ix1	ix1	5	test.x1.a	2	100.00	Child of pushed join@1; Using where
+1	SIMPLE	x3	ref	ix1	ix1	5	test.x2.a	2	100.00	Child of pushed join@1; Using where
 Warnings:
 Note	1003	select `test`.`x1`.`pk` AS `pk`,`test`.`x1`.`a` AS `a`,`test`.`x1`.`b` AS `b` from `test`.`t1` `x1` join `test`.`t1` `x2` join `test`.`t1` `x3` where ((`test`.`x2`.`b` = `test`.`x1`.`a`) and (`test`.`x3`.`b` = `test`.`x2`.`a`)) order by `test`.`x1`.`pk` limit 70
 select x1.pk,x1.a,x1.b from t1 as x1 
@@ -4504,7 +4504,7 @@ pk	a	b
 explain extended select * from t1 as x1, t1 as x2 where x1.a=x2.b and x1.b = 3;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	SIMPLE	x1	ref	ix1	ix1	5	const	10	100.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`x1`.`b` = 3)
-1	SIMPLE	x2	ref	ix1	ix1	5	test.x1.a	1	100.00	Child of pushed join@1; Using where
+1	SIMPLE	x2	ref	ix1	ix1	5	test.x1.a	2	100.00	Child of pushed join@1; Using where
 Warnings:
 Note	1003	select `test`.`x1`.`pk` AS `pk`,`test`.`x1`.`a` AS `a`,`test`.`x1`.`b` AS `b`,`test`.`x2`.`pk` AS `pk`,`test`.`x2`.`a` AS `a`,`test`.`x2`.`b` AS `b` from `test`.`t1` `x1` join `test`.`t1` `x2` where ((`test`.`x1`.`b` = 3) and (`test`.`x2`.`b` = `test`.`x1`.`a`))
 select * from t1 as x1, t1 as x2 where x1.a=x2.b and x1.b = 3;
@@ -4525,7 +4525,7 @@ on table1.a =  table4.pk
 where  table2.pk != 6;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	SIMPLE	table1	ALL	NULL	NULL	NULL	NULL	6	33.33	Using temporary
-1	SIMPLE	table2	range	PRIMARY	PRIMARY	4	NULL	2	100.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`table2`.`pk` <> 6); Distinct; Using join buffer
+1	SIMPLE	table2	range	PRIMARY	PRIMARY	4	NULL	20	30.00	Parent of 2 pushed join@1; Using where with pushed condition: (`test`.`table2`.`pk` <> 6); Distinct; Using join buffer
 1	SIMPLE	table3	eq_ref	PRIMARY	PRIMARY	4	test.table2.pk	1	100.00	Child of pushed join@1; Distinct
 1	SIMPLE	table4	eq_ref	PRIMARY	PRIMARY	4	test.table1.a	1	100.00	Using where; Distinct
 Warnings:

=== modified file 'mysql-test/suite/ndb/r/ndb_read_multi_range.result'
--- a/mysql-test/suite/ndb/r/ndb_read_multi_range.result	2010-11-25 14:42:27 +0000
+++ b/mysql-test/suite/ndb/r/ndb_read_multi_range.result	2011-01-21 13:56:43 +0000
@@ -605,7 +605,7 @@ SELECT DISTINCT STRAIGHT_JOIN t1.pk FROM
 t1 LEFT JOIN t2 ON t2.a = t1.a AND t2.pk != 6;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	3000	Using temporary
-1	SIMPLE	t2	range	PRIMARY	PRIMARY	4	NULL	2	Using where; Distinct
+1	SIMPLE	t2	range	PRIMARY	PRIMARY	4	NULL	20	Using where; Distinct
 SELECT DISTINCT STRAIGHT_JOIN t1.pk FROM 
 t1 LEFT JOIN t2 ON t2.a = t1.a AND t2.pk != 6;
 drop table t1, t2;

=== added file 'mysql-test/suite/ndb/r/ndb_statistics.result'
--- a/mysql-test/suite/ndb/r/ndb_statistics.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/ndb/r/ndb_statistics.result	2011-01-21 13:56:43 +0000
@@ -0,0 +1,61 @@
+drop table if exists t1, t2, t3, t4;
+CREATE TABLE t10(
+K INT NOT NULL AUTO_INCREMENT,
+I INT, J INT,
+PRIMARY KEY(K),
+KEY(I,J),
+UNIQUE KEY(J,K)
+) ENGINE=ndbcluster;
+INSERT INTO t10(I,J) VALUES (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(0,0);
+CREATE TABLE t100 LIKE t10;
+INSERT INTO t100(I,J)
+SELECT X.J, X.J+(10*Y.J) FROM t10 AS X,t10 AS Y;
+CREATE TABLE t10000 LIKE t10;
+INSERT INTO t10000(I,J)
+SELECT X.J, X.J+(100*Y.J) FROM t100 AS X,t100 AS Y
+WHERE X.J<50;
+INSERT INTO t10000(I,J)
+SELECT X.J, X.J+(100*Y.J) FROM t100 AS X,t100 AS Y
+WHERE X.J>=50;
+ANALYZE TABLE t10,t100,t10000;
+Table	Op	Msg_type	Msg_text
+test.t10	analyze	status	OK
+test.t100	analyze	status	OK
+test.t10000	analyze	status	OK
+SELECT COUNT(*) FROM t10;
+COUNT(*)
+10
+SELECT COUNT(*) FROM t100;
+COUNT(*)
+100
+SELECT COUNT(*) FROM t10000;
+COUNT(*)
+10000
+EXPLAIN
+SELECT * FROM t10000 WHERE k = 42;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t10000	const	PRIMARY	PRIMARY	4	const	1	
+EXPLAIN
+SELECT * FROM t10000 WHERE k >= 42 and k < 10000;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t10000	range	PRIMARY	PRIMARY	4	NULL	10	Using where with pushed condition
+EXPLAIN
+SELECT * FROM t10000 WHERE k BETWEEN 42 AND 10000;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t10000	range	PRIMARY	PRIMARY	4	NULL	10	Using where with pushed condition
+EXPLAIN
+SELECT * FROM t10000 WHERE k < 42;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t10000	range	PRIMARY	PRIMARY	4	NULL	10	Using where with pushed condition
+EXPLAIN
+SELECT * FROM t10000 WHERE k > 42;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t10000	range	PRIMARY	PRIMARY	4	NULL	10	Using where with pushed condition
+EXPLAIN
+SELECT * FROM t10000 AS X JOIN t10000 AS Y
+ON Y.I=X.I AND Y.J = X.I;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	X	ALL	I	NULL	NULL	NULL	10000	Parent of 2 pushed join@1
+1	SIMPLE	Y	ref	J,I	I	10	test.X.I,test.X.I	11	Child of pushed join@1; Using where
+DROP TABLE t10,t100,t10000;
+End of 5.1 tests

=== added file 'mysql-test/suite/ndb/t/ndb_statistics.test'
--- a/mysql-test/suite/ndb/t/ndb_statistics.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/ndb/t/ndb_statistics.test	2011-01-18 11:49:03 +0000
@@ -0,0 +1,68 @@
+-- source include/have_ndb.inc
+
+--disable_warnings
+drop table if exists t1, t2, t3, t4;
+--enable_warnings
+
+CREATE TABLE t10(
+  K INT NOT NULL AUTO_INCREMENT,
+  I INT, J INT,
+  PRIMARY KEY(K),
+  KEY(I,J),
+  UNIQUE KEY(J,K)
+) ENGINE=ndbcluster;
+
+INSERT INTO t10(I,J) VALUES (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(0,0);
+
+CREATE TABLE t100 LIKE t10;
+INSERT INTO t100(I,J)
+  SELECT X.J, X.J+(10*Y.J) FROM t10 AS X,t10 AS Y;
+
+CREATE TABLE t10000 LIKE t10;
+
+# Insert into t10000 in two chunks to not
+#  exhaust MaxNoOfConcurrentOperations
+INSERT INTO t10000(I,J)
+  SELECT X.J, X.J+(100*Y.J) FROM t100 AS X,t100 AS Y
+  WHERE X.J<50;
+INSERT INTO t10000(I,J)
+  SELECT X.J, X.J+(100*Y.J) FROM t100 AS X,t100 AS Y
+  WHERE X.J>=50;
+
+ANALYZE TABLE t10,t100,t10000;
+
+SELECT COUNT(*) FROM t10;
+SELECT COUNT(*) FROM t100;
+SELECT COUNT(*) FROM t10000;
+
+#
+# Bug #59517: Incorrect detection of single row access in
+#             ha_ndbcluster::records_in_range()
+
+# Expect a single row (or const) when PK is excact specified
+EXPLAIN
+SELECT * FROM t10000 WHERE k = 42;
+
+# All queries below should *not* return a single row
+EXPLAIN
+SELECT * FROM t10000 WHERE k >= 42 and k < 10000;
+EXPLAIN
+SELECT * FROM t10000 WHERE k BETWEEN 42 AND 10000;
+EXPLAIN
+SELECT * FROM t10000 WHERE k < 42;
+EXPLAIN
+SELECT * FROM t10000 WHERE k > 42;
+
+#
+# Bug #59519 ::set_rec_per_key() assumes ORDER_INDEX to be unique
+#
+
+# 'REF' join of 'Y' should match >1 rows
+EXPLAIN
+SELECT * FROM t10000 AS X JOIN t10000 AS Y
+  ON Y.I=X.I AND Y.J = X.I;
+
+
+DROP TABLE t10,t100,t10000;
+
+--echo End of 5.1 tests

=== modified file 'mysql-test/suite/rpl_ndb/r/rpl_ndb_ddl.result'
--- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_ddl.result	2007-12-11 10:51:14 +0000
+++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_ddl.result	2011-01-18 12:47:01 +0000
@@ -928,12 +928,12 @@ TEST-INFO: SLAVE:  The INSERT is committ
 -------- switch to master -------
 SHOW INDEX FROM mysqltest1.t5;
 Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment
-t5	1	my_idx5	1	f1	A	0	NULL	NULL	YES	BTREE	
+t5	1	my_idx5	1	f1	A	NULL	NULL	NULL	YES	BTREE	
 
 -------- switch to slave --------
 SHOW INDEX FROM mysqltest1.t5;
 Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment
-t5	1	my_idx5	1	f1	A	0	NULL	NULL	YES	BTREE	
+t5	1	my_idx5	1	f1	A	NULL	NULL	NULL	YES	BTREE	
 
 -------- switch to master -------
 

=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	2011-01-18 08:21:35 +0000
+++ b/sql/ha_ndbcluster.cc	2011-01-21 13:56:43 +0000
@@ -1754,9 +1754,35 @@ Ndb *ha_ndbcluster::get_ndb(THD *thd)
 void ha_ndbcluster::set_rec_per_key()
 {
   DBUG_ENTER("ha_ndbcluster::set_rec_per_key");
+  /*
+    Set up the 'rec_per_key[]' for keys which we have good knowledge
+    about the distribution. 'rec_per_key[]' is init'ed to '0' by 
+    open_binary_frm(), which is interpreted as 'unknown' by optimizer.
+    -> Not setting 'rec_per_key[]' will force the optimizer to use
+    its own heuristic to estimate 'records pr. key'.
+  */
   for (uint i=0 ; i < table_share->keys ; i++)
   {
-    table->key_info[i].rec_per_key[table->key_info[i].key_parts-1]= 1;
+    switch (get_index_type(i))
+    {
+    case UNIQUE_ORDERED_INDEX:
+    case PRIMARY_KEY_ORDERED_INDEX:
+    case UNIQUE_INDEX:
+    case PRIMARY_KEY_INDEX:
+    {
+      // Index is unique when all 'key_parts' are specified,
+      // else distribution is unknown and not specified here.
+      KEY* key_info= table->key_info + i;
+      key_info->rec_per_key[key_info->key_parts-1]= 1;
+      break;
+    }
+    case ORDERED_INDEX:
+      // 'Records pr. key' are unknown for non-unique indexes.
+      // (May change when we get better index statistics.)
+      break;
+    default:
+      DBUG_ASSERT(false);
+    }
   }
   DBUG_VOID_RETURN;
 }
@@ -11831,8 +11857,10 @@ ha_ndbcluster::records_in_range(uint inx
   // Read from hash index with full key
   // This is a "const" table which returns only one record!      
   if ((idx_type != ORDERED_INDEX) &&
-      ((min_key && min_key->length == key_length) || 
-       (max_key && max_key->length == key_length)))
+      ((min_key && min_key->length == key_length) &&
+       (max_key && max_key->length == key_length) &&
+       (min_key->key==max_key->key ||
+        memcmp(min_key->key, max_key->key, key_length)==0)))
     DBUG_RETURN(1);
   
   if ((idx_type == PRIMARY_KEY_ORDERED_INDEX ||

=== modified file 'storage/ndb/include/kernel/signaldata/DisconnectRep.hpp'
--- a/storage/ndb/include/kernel/signaldata/DisconnectRep.hpp	2009-05-27 15:21:45 +0000
+++ b/storage/ndb/include/kernel/signaldata/DisconnectRep.hpp	2011-01-18 07:39:47 +0000
@@ -24,12 +24,14 @@
 /**
  * 
  */
-class DisconnectRep {
+struct DisconnectRep
+{
   /**
    * Receiver(s)
    */
   friend class Qmgr;
   friend class Cmvmi; // Cmvmi
+  friend class ClusterMgr;
 
   /**
    * Senders
@@ -43,7 +45,6 @@ class DisconnectRep {
    */
   friend bool printDISCONNECT_REP(FILE *, const Uint32 *, Uint32, Uint16);
 
-public:
   STATIC_CONST( SignalLength = 2 );
 
   enum ErrCode {
@@ -54,8 +55,6 @@ public:
     TcReportNodeFailed = 0xFF000001
   };
 
-private:
-  
   Uint32 nodeId;
   Uint32 err;
 };

=== modified file 'storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp	2011-01-06 21:19:05 +0000
+++ b/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp	2011-01-21 13:56:43 +0000
@@ -4626,11 +4626,11 @@ void Dblqh::execLQHKEYREQ(Signal* signal
   
   if (LqhKeyReq::getRowidFlag(Treqinfo))
   {
-    ndbassert(refToBlock(senderRef) != DBTC);
+    ndbassert(refToMain(senderRef) != DBTC);
   }
   else if(op == ZINSERT)
   {
-    ndbassert(refToBlock(senderRef) == DBTC);
+    ndbassert(refToMain(senderRef) == DBTC);
   }
   
   if ((LqhKeyReq::FixedSignalLength + nextPos + TreclenAiLqhkey) != 

=== modified file 'storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp'
--- a/storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp	2011-01-06 21:19:05 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp	2011-01-21 13:56:43 +0000
@@ -1290,7 +1290,7 @@ public:
   typedef Ptr<TcFailRecord> TcFailRecordPtr;
 
 public:
-  Dbtc(Block_context&);
+  Dbtc(Block_context&, Uint32 instanceNumber = 0);
   virtual ~Dbtc();
 
 private:
@@ -2057,6 +2057,8 @@ private:
 
   Uint32 c_gcp_ref;
 
+  Uint32 c_sttor_ref;
+
 #ifdef ERROR_INSERT
   // Used with ERROR_INSERT 8078 + 8079 to check API_FAILREQ handling
   Uint32 c_lastFailedApi;

=== modified file 'storage/ndb/src/kernel/blocks/dbtc/DbtcInit.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtc/DbtcInit.cpp	2010-02-22 14:05:33 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtc/DbtcInit.cpp	2011-01-17 15:00:13 +0000
@@ -173,8 +173,8 @@ Dbtc::getParam(const char* name, Uint32*
   return false;
 }
 
-Dbtc::Dbtc(Block_context& ctx):
-  SimulatedBlock(DBTC, ctx),
+Dbtc::Dbtc(Block_context& ctx, Uint32 instanceNo):
+  SimulatedBlock(DBTC, ctx, instanceNo),
   c_theDefinedTriggers(c_theDefinedTriggerPool),
   c_firedTriggerHash(c_theFiredTriggerPool),
   c_maxNumberOfDefinedTriggers(0),

=== modified file 'storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp	2011-01-17 12:08:49 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp	2011-01-21 13:56:43 +0000
@@ -654,6 +654,7 @@ void Dbtc::execSTTOR(Signal* signal) 
                                                      /* START CASE */
   tphase = signal->theData[1];
   csignalKey = signal->theData[6];
+  c_sttor_ref = signal->getSendersBlockRef();
   switch (tphase) {
   case ZSPH1:
     jam();
@@ -673,7 +674,7 @@ void Dbtc::sttorryLab(Signal* signal) 
   signal->theData[2] = 2;    /* SIGNAL VERSION NUMBER */
   signal->theData[3] = ZSPH1;
   signal->theData[4] = 255;
-  sendSignal(NDBCNTR_REF, GSN_STTORRY, signal, 5, JBB);
+  sendSignal(c_sttor_ref, GSN_STTORRY, signal, 5, JBB);
 }//Dbtc::sttorryLab()
 
 /* ***************************************************************************/
@@ -689,6 +690,7 @@ void Dbtc::execNDB_STTOR(Signal* signal)
   tnodeid = signal->theData[1];
   tndbstartphase = signal->theData[2];   /* START PHASE      */
   tstarttype = signal->theData[3];       /* START TYPE       */
+  c_sttor_ref = signal->getSendersBlockRef();
   switch (tndbstartphase) {
   case ZINTSPH1:
     jam();
@@ -724,7 +726,7 @@ void Dbtc::execNDB_STTOR(Signal* signal)
 void Dbtc::ndbsttorry010Lab(Signal* signal) 
 {
   signal->theData[0] = cownref;
-  sendSignal(cndbcntrblockref, GSN_NDB_STTORRY, signal, 1, JBB);
+  sendSignal(c_sttor_ref, GSN_NDB_STTORRY, signal, 1, JBB);
 }//Dbtc::ndbsttorry010Lab()
 
 void
@@ -789,7 +791,7 @@ void Dbtc::startphase1x010Lab(Signal* si
 void Dbtc::intstartphase1x010Lab(Signal* signal) 
 {
   cownNodeid = tnodeid;
-  cownref =          calcTcBlockRef(cownNodeid);
+  cownref =          reference();
   clqhblockref =     calcLqhBlockRef(cownNodeid);
   cdihblockref =     calcDihBlockRef(cownNodeid);
   cdictblockref =    calcDictBlockRef(cownNodeid);
@@ -1240,7 +1242,8 @@ void Dbtc::execTCSEIZEREQ(Signal* signal
     apiConnectptr.p->ndbapiBlockref = tapiBlockref;
     signal->theData[0] = apiConnectptr.p->ndbapiConnect;
     signal->theData[1] = apiConnectptr.i;
-    sendSignal(tapiBlockref, GSN_TCSEIZECONF, signal, 2, JBB);
+    signal->theData[2] = reference();
+    sendSignal(tapiBlockref, GSN_TCSEIZECONF, signal, 3, JBB);
     return;
   }
 
@@ -11933,7 +11936,7 @@ void Dbtc::initialiseRecordsLab(Signal* 
   signal->theData[2] = 0;
   signal->theData[3] = retRef;
   signal->theData[4] = retData;
-  sendSignal(DBTC_REF, GSN_CONTINUEB, signal, 5, JBB);
+  sendSignal(reference(), GSN_CONTINUEB, signal, 5, JBB);
 }
 
 /* ========================================================================= */

=== modified file 'storage/ndb/src/kernel/blocks/dbtup/DbtupTrigger.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtup/DbtupTrigger.cpp	2010-12-04 11:20:36 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtup/DbtupTrigger.cpp	2011-01-17 15:00:13 +0000
@@ -539,7 +539,7 @@ Dbtup::checkImmediateTriggersAfterInsert
                                          Tablerec *regTablePtr,
                                          bool disk)
 {
-  if(refToBlock(req_struct->TC_ref) != DBTC) {
+  if (refToMain(req_struct->TC_ref) != DBTC) {
     return;
   }
 
@@ -559,7 +559,7 @@ Dbtup::checkImmediateTriggersAfterUpdate
                                          Tablerec* regTablePtr,
                                          bool disk)
 {
-  if(refToBlock(req_struct->TC_ref) != DBTC) {
+  if (refToMain(req_struct->TC_ref) != DBTC) {
     return;
   }
 
@@ -587,7 +587,7 @@ Dbtup::checkImmediateTriggersAfterDelete
                                          Tablerec* regTablePtr,
                                          bool disk)
 {
-  if(refToBlock(req_struct->TC_ref) != DBTC) {
+  if (refToMain(req_struct->TC_ref) != DBTC) {
     return;
   }
 

=== modified file 'storage/ndb/src/kernel/blocks/dbutil/DbUtil.cpp'
--- a/storage/ndb/src/kernel/blocks/dbutil/DbUtil.cpp	2010-10-21 12:02:45 +0000
+++ b/storage/ndb/src/kernel/blocks/dbutil/DbUtil.cpp	2011-01-17 15:00:13 +0000
@@ -328,7 +328,8 @@ DbUtil::execTCSEIZECONF(Signal* signal){
   ptr.i = signal->theData[0] >> 1;
   c_seizingTransactions.getPtr(ptr, signal->theData[0] >> 1);
   ptr.p->connectPtr = signal->theData[1];
-  
+  ptr.p->connectRef = signal->theData[2];
+
   c_seizingTransactions.release(ptr);
 
   if (c_seizingTransactions.isEmpty())
@@ -2281,7 +2282,7 @@ DbUtil::runOperation(Signal* signal, Tra
   printTCKEYREQ(stdout, signal->getDataPtr(), pop->tckeyLenInBytes >> 2,0);
 #endif
   Uint32 sigLen = pop->tckeyLen + (keyLen > 8 ? 8 : keyLen);
-  sendSignal(DBTC_REF, GSN_TCKEYREQ, signal, sigLen, JBB);
+  sendSignal(transPtr.p->connectRef, GSN_TCKEYREQ, signal, sigLen, JBB);
   
   /**
    * More the 8 words of key info not implemented
@@ -2295,7 +2296,8 @@ DbUtil::runOperation(Signal* signal, Tra
   keyInfo->connectPtr = transPtr.p->connectPtr;
   keyInfo->transId[0] = transPtr.p->transId[0];
   keyInfo->transId[1] = transPtr.p->transId[1];
-  sendKeyInfo(signal, keyInfo, op->keyInfo, kit);
+  sendKeyInfo(signal, transPtr.p->connectRef,
+              keyInfo, op->keyInfo, kit);
 
   /**
    * AttrInfo
@@ -2307,14 +2309,17 @@ DbUtil::runOperation(Signal* signal, Tra
 
   AttrInfoIterator ait;
   pop->attrInfo.first(ait);
-  sendAttrInfo(signal, attrInfo, pop->attrInfo, ait);
+  sendAttrInfo(signal, transPtr.p->connectRef,
+               attrInfo, pop->attrInfo, ait);
   
   op->attrInfo.first(ait);
-  sendAttrInfo(signal, attrInfo, op->attrInfo, ait);
+  sendAttrInfo(signal, transPtr.p->connectRef,
+               attrInfo, op->attrInfo, ait);
 }
 
 void
 DbUtil::sendKeyInfo(Signal* signal, 
+                    Uint32 tcRef,
 		    KeyInfo* keyInfo,
 		    const KeyInfoBuffer & keyBuf,
 		    KeyInfoIterator & kit)
@@ -2330,13 +2335,14 @@ DbUtil::sendKeyInfo(Signal* signal, 
 #if 0 //def EVENT_DEBUG
     printf("DbUtil::sendKeyInfo: sendSignal(DBTC_REF, GSN_KEYINFO, signal, %d , JBB)\n", KeyInfo::HeaderLength + keyDataLen);
 #endif
-    sendSignal(DBTC_REF, GSN_KEYINFO, signal, 
+    sendSignal(tcRef, GSN_KEYINFO, signal,
 	       KeyInfo::HeaderLength + keyDataLen, JBB);
   }
 }
 
 void
 DbUtil::sendAttrInfo(Signal* signal, 
+                     Uint32 tcRef,
 		     AttrInfo* attrInfo, 
 		     const AttrInfoBuffer & attrBuf,
 		     AttrInfoIterator & ait)
@@ -2351,7 +2357,7 @@ DbUtil::sendAttrInfo(Signal* signal, 
 #if 0 //def EVENT_DEBUG
     printf("DbUtil::sendAttrInfo: sendSignal(DBTC_REF, GSN_ATTRINFO, signal, %d , JBB)\n", AttrInfo::HeaderLength + i);
 #endif
-    sendSignal(DBTC_REF, GSN_ATTRINFO, signal, 
+    sendSignal(tcRef, GSN_ATTRINFO, signal,
 	       AttrInfo::HeaderLength + i, JBB);
   }
 }
@@ -2491,6 +2497,9 @@ DbUtil::execTCKEYCONF(Signal* signal){
     gci_lo = keyConf->operations[ops].apiOperationPtr;
   }
 
+  TransactionPtr transPtr;
+  c_runningTransactions.getPtr(transPtr, transI);
+
   /**
    * Check commit ack marker flag
    */
@@ -2499,11 +2508,9 @@ DbUtil::execTCKEYCONF(Signal* signal){
     jam();
     signal->theData[0] = transId1;
     signal->theData[1] = transId2;
-    sendSignal(DBTC_REF, GSN_TC_COMMIT_ACK, signal, 2, JBB);    
+    sendSignal(transPtr.p->connectRef, GSN_TC_COMMIT_ACK, signal, 2, JBB);    
   }//if
 
-  TransactionPtr transPtr;
-  c_runningTransactions.getPtr(transPtr, transI);
   ndbrequire(transId1 == transPtr.p->transId[0] && 
 	     transId2 == transPtr.p->transId[1]);
 

=== modified file 'storage/ndb/src/kernel/blocks/dbutil/DbUtil.hpp'
--- a/storage/ndb/src/kernel/blocks/dbutil/DbUtil.hpp	2010-10-21 12:02:45 +0000
+++ b/storage/ndb/src/kernel/blocks/dbutil/DbUtil.hpp	2011-01-17 15:00:13 +0000
@@ -348,6 +348,7 @@ public:
     };
     
     Uint32 connectPtr;
+    Uint32 connectRef;
     Uint32 transId[2];
     SLList<Operation> operations;
 
@@ -408,11 +409,11 @@ public:
   void initResultSet(ResultSetBuffer &, const ResultSetInfoBuffer &);
   void runTransaction(Signal* signal, TransactionPtr);
   void runOperation(Signal* signal, TransactionPtr &, OperationPtr &, Uint32);
-  void sendKeyInfo(Signal* signal, 
+  void sendKeyInfo(Signal* signal, Uint32 ref,
 		   KeyInfo* keyInfo,
 		   const KeyInfoBuffer & keyBuf,
 		   KeyInfoIterator & kit);
-  void sendAttrInfo(Signal*, 
+  void sendAttrInfo(Signal*, Uint32 ref,
 		    AttrInfo* attrInfo, 
 		    const AttrInfoBuffer &,
 		    AttrInfoIterator & ait);

=== modified file 'storage/ndb/src/kernel/blocks/ndbcntr/Ndbcntr.hpp'
--- a/storage/ndb/src/kernel/blocks/ndbcntr/Ndbcntr.hpp	2010-06-24 21:42:03 +0000
+++ b/storage/ndb/src/kernel/blocks/ndbcntr/Ndbcntr.hpp	2011-01-17 15:00:13 +0000
@@ -325,6 +325,7 @@ private:
   UintR cnoWaitrep6;
   UintR cnoWaitrep7;
   UintR ctcConnectionP;
+  Uint32 ctcReference;
   UintR ctcReqInfo;
   Uint8 ctransidPhase;
   Uint16 cresponses;

=== modified file 'storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp'
--- a/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp	2011-01-06 21:19:05 +0000
+++ b/storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp	2011-01-21 13:56:43 +0000
@@ -2524,6 +2524,7 @@ void Ndbcntr::execTCSEIZECONF(Signal* si
 {
   jamEntry();
   ctcConnectionP = signal->theData[1];
+  ctcReference = signal->theData[2];
   crSystab7Lab(signal);
   return;
 }//Ndbcntr::execTCSEIZECONF()
@@ -2587,7 +2588,7 @@ void Ndbcntr::crSystab7Lab(Signal* signa
     AttributeHeader::init(&tAIDataPtr[2], 1, 2 << 2);
     tAIDataPtr[3]                = (tkey << 16);
     tAIDataPtr[4]                = 1;    
-    sendSignal(DBTC_REF, GSN_TCKEYREQ, signal, 
+    sendSignal(ctcReference, GSN_TCKEYREQ, signal,
 	       TcKeyReq::StaticLength + 6, JBB);
   }//for
   ckey = ckey + RowsPerCommit;
@@ -2610,7 +2611,7 @@ void Ndbcntr::execTCKEYCONF(Signal* sign
     Uint32 transId2 = keyConf->transId2;
     signal->theData[0] = transId1;
     signal->theData[1] = transId2;
-    sendSignal(DBTC_REF, GSN_TC_COMMIT_ACK, signal, 2, JBB);    
+    sendSignal(ctcReference, GSN_TC_COMMIT_ACK, signal, 2, JBB);
   }//if
   
   cresponses = cresponses + TcKeyConf::getNoOfOperations(confInfo);
@@ -2639,7 +2640,7 @@ void Ndbcntr::crSystab8Lab(Signal* signa
   signal->theData[0] = ctcConnectionP;
   signal->theData[1] = reference();
   signal->theData[2] = 0;
-  sendSignal(DBTC_REF, GSN_TCRELEASEREQ, signal, 2, JBB);
+  sendSignal(ctcReference, GSN_TCRELEASEREQ, signal, 2, JBB);
   return;
 }//Ndbcntr::crSystab8Lab()
 

=== modified file 'storage/ndb/src/mgmsrv/ConfigManager.cpp'
--- a/storage/ndb/src/mgmsrv/ConfigManager.cpp	2011-01-11 19:13:37 +0000
+++ b/storage/ndb/src/mgmsrv/ConfigManager.cpp	2011-01-18 09:52:49 +0000
@@ -1752,8 +1752,6 @@ ConfigManager::run()
   // Build bitmaks of all mgm nodes in config
   m_config->get_nodemask(m_all_mgm, NDB_MGM_NODE_TYPE_MGM);
 
-  m_started.set(m_facade->ownId());
-
   // exclude nowait-nodes from config change protcol
   m_all_mgm.bitANDC(m_opts.nowait_nodes);
   m_all_mgm.set(m_facade->ownId()); // Never exclude own node
@@ -2199,10 +2197,9 @@ ConfigManager::load_saved_config(const B
   return conf;
 }
 
-
 bool
 ConfigManager::get_packed_config(ndb_mgm_node_type nodetype,
-                                 BaseString& buf64, BaseString& error)
+                                 BaseString* buf64, BaseString& error)
 {
   Guard g(m_config_mutex);
 
@@ -2248,23 +2245,26 @@ ConfigManager::get_packed_config(ndb_mgm
   }
 
   require(m_config != 0);
-  if (!m_packed_config.length())
+  if (buf64)
   {
-    // No packed config exist, generate a new one
-    Config config_copy(m_config);
-    if (!m_dynamic_ports.set_in_config(&config_copy))
-    {
-      error.assign("get_packed_config, failed to set dynamic ports in config");
-      return false;
-    }
-
-    if (!config_copy.pack64(m_packed_config))
+    if (!m_packed_config.length())
     {
-      error.assign("get_packed_config, failed to pack config_copy");
-      return false;
+      // No packed config exist, generate a new one
+      Config config_copy(m_config);
+      if (!m_dynamic_ports.set_in_config(&config_copy))
+      {
+        error.assign("get_packed_config, failed to set dynamic ports in config");
+        return false;
+      }
+      
+      if (!config_copy.pack64(m_packed_config))
+      {
+        error.assign("get_packed_config, failed to pack config_copy");
+        return false;
+      }
     }
+    buf64->assign(m_packed_config, m_packed_config.length());
   }
-  buf64.assign(m_packed_config, m_packed_config.length());
   return true;
 }
 

=== modified file 'storage/ndb/src/mgmsrv/ConfigManager.hpp'
--- a/storage/ndb/src/mgmsrv/ConfigManager.hpp	2010-09-17 14:30:59 +0000
+++ b/storage/ndb/src/mgmsrv/ConfigManager.hpp	2011-01-18 09:52:49 +0000
@@ -250,7 +250,7 @@ public:
     Retrieve the current configuration in base64 packed format
    */
   bool get_packed_config(ndb_mgm_node_type nodetype,
-                         BaseString& buf64, BaseString& error);
+                         BaseString * buf64, BaseString& error);
 
   static Config* load_config(const char* config_filename, bool mycnf,
                              BaseString& msg);

=== modified file 'storage/ndb/src/mgmsrv/MgmtSrvr.cpp'
--- a/storage/ndb/src/mgmsrv/MgmtSrvr.cpp	2011-01-10 13:30:14 +0000
+++ b/storage/ndb/src/mgmsrv/MgmtSrvr.cpp	2011-01-18 09:52:49 +0000
@@ -434,14 +434,6 @@ MgmtSrvr::start_transporter(const Config
     DBUG_RETURN(false);
   }
 
-  /**
-   * Wait for loopback interface to be enabled
-   */
-  while (!theFacade->ext_isConnected(_ownNodeId))
-  {
-    NdbSleep_MilliSleep(20);
-  }
-
   _ownReference = numberToRef(_blockNumber, _ownNodeId);
 
   /*
@@ -744,7 +736,7 @@ bool
 MgmtSrvr::get_packed_config(ndb_mgm_node_type node_type,
                             BaseString& buf64, BaseString& error)
 {
-  return m_config_manager->get_packed_config(node_type, buf64, error);
+  return m_config_manager->get_packed_config(node_type, &buf64, error);
 }
 
 
@@ -2857,6 +2849,10 @@ MgmtSrvr::try_alloc(unsigned id, const c
                     const struct sockaddr *client_addr,
                     Uint32 timeout_ms)
 {
+  if (theFacade && theFacade->ext_isConnected(id))
+  {
+    return -1;
+  }
   if (client_addr != 0)
   {
     int res = alloc_node_id_req(id, type, timeout_ms);
@@ -2939,6 +2935,23 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId,
   }
 
   Uint32 timeout_ms = Uint32(1000 * timeout_s);
+  Uint64 stop = NdbTick_CurrentMillisecond() + timeout_ms;
+  BaseString getconfig_message;
+  while (!m_config_manager->get_packed_config(type, 0, getconfig_message))
+  {
+    /**
+     * Wait for config to get confirmed before allocating node id
+     */
+    if (NdbTick_CurrentMillisecond() > stop)
+    {
+      error_code = NDB_MGM_ALLOCID_ERROR;
+      error_string.append("Unable to allocate nodeid as configuration"
+                          " not yet confirmed");
+      DBUG_RETURN(false);
+    }
+
+    NdbSleep_MilliSleep(20);
+  }
 
   Guard g(m_node_id_mutex);
 

=== modified file 'storage/ndb/src/ndbapi/ClusterMgr.cpp'
--- a/storage/ndb/src/ndbapi/ClusterMgr.cpp	2011-01-10 13:30:14 +0000
+++ b/storage/ndb/src/ndbapi/ClusterMgr.cpp	2011-01-19 18:41:30 +0000
@@ -141,12 +141,6 @@ ClusterMgr::configure(Uint32 nodeId,
       theNodes[i]= Node();
   }
 
-  /* Init own node info */
-  trp_node &node= theNodes[getOwnNodeId()];
-  assert(node.defined);
-  node.set_connected(true);
-  node.set_confirmed(true);
-
 #if 0
   print_nodes("init");
 #endif
@@ -181,12 +175,19 @@ void
 ClusterMgr::startThread() {
   Guard g(clusterMgrThreadMutex);
 
-  theStop = 0;
+  theStop = -1;
   theClusterMgrThread = NdbThread_Create(runClusterMgr_C,
                                          (void**)this,
                                          0, // default stack size
                                          "ndb_clustermgr",
                                          NDB_THREAD_PRIO_HIGH);
+  Uint32 cnt = 0;
+  while (theStop == -1 && cnt < 60)
+  {
+    NdbCondition_WaitTimeout(waitForHBCond, clusterMgrThreadMutex, 1000);
+  }
+
+  assert(theStop == 0);
 }
 
 void
@@ -262,7 +263,6 @@ ClusterMgr::forceHB()
   req->mysql_version = NDB_MYSQL_VERSION_D;
 
   {
-    Guard g(clusterMgrThreadMutex);
     lock();
     int nodeId= 0;
     for(int i=0;
@@ -289,15 +289,40 @@ ClusterMgr::forceHB()
 }
 
 void
-ClusterMgr::force_update_connections()
+ClusterMgr::startup()
 {
-  theFacade.lock_mutex();
-  theFacade.theTransporterRegistry->update_connections();
-  theFacade.unlock_mutex();
+  assert(theStop == -1);
+  Uint32 nodeId = getOwnNodeId();
+  Node & cm_node = theNodes[nodeId];
+  trp_node & theNode = cm_node;
+  assert(theNode.defined);
+  assert(theNode.is_connected() == false);
+
+  lock();
+  theFacade.doConnect(nodeId);
+  unlock();
+
+  for (Uint32 i = 0; i<3000; i++)
+  {
+    lock();
+    theFacade.theTransporterRegistry->update_connections();
+    unlock();
+    if (theNode.is_connected())
+      break;
+    NdbSleep_MilliSleep(20);
+  }
+
+  assert(theNode.is_connected());
+  Guard g(clusterMgrThreadMutex);
+  theStop = 0;
+  NdbCondition_Broadcast(waitForHBCond);
 }
 
 void
-ClusterMgr::threadMain( ){
+ClusterMgr::threadMain()
+{
+  startup();
+
   NdbApiSignal signal(numberToRef(API_CLUSTERMGR, theFacade.ownId()));
   
   signal.theVerId_signalNumber   = GSN_API_REGREQ;
@@ -309,6 +334,12 @@ ClusterMgr::threadMain( ){
   req->version = NDB_VERSION;
   req->mysql_version = NDB_MYSQL_VERSION_D;
   
+  NdbApiSignal nodeFail_signal(numberToRef(API_CLUSTERMGR, getOwnNodeId()));
+  nodeFail_signal.theVerId_signalNumber = GSN_NODE_FAILREP;
+  nodeFail_signal.theReceiversBlockNumber = API_CLUSTERMGR;
+  nodeFail_signal.theTrace  = 0;
+  nodeFail_signal.theLength = NodeFailRep::SignalLengthLong;
+
   NDB_TICKS timeSlept = 100;
   NDB_TICKS now = NdbTick_CurrentMillisecond();
 
@@ -346,7 +377,13 @@ ClusterMgr::threadMain( ){
       m_cluster_state = CS_waiting_for_first_connect;
     }
 
-    lock();
+
+    NodeFailRep * nodeFailRep = CAST_PTR(NodeFailRep,
+                                         nodeFail_signal.getDataPtrSend());
+    nodeFailRep->noOfNodes = 0;
+    NodeBitmask::clear(nodeFailRep->theNodes);
+
+    trp_client::lock();
     for (int i = 1; i < MAX_NODES; i++){
       /**
        * Send register request (heartbeat) to all available nodes 
@@ -358,9 +395,6 @@ ClusterMgr::threadMain( ){
       Node & cm_node = theNodes[nodeId];
       trp_node & theNode = cm_node;
 
-      if (nodeId == getOwnNodeId())
-        continue;
-
       if (!theNode.defined)
 	continue;
 
@@ -373,6 +407,15 @@ ClusterMgr::threadMain( ){
 	continue;
       }
       
+      if (nodeId == getOwnNodeId() && theNode.is_confirmed())
+      {
+        /**
+         * Don't send HB to self more than once
+         * (once needed to avoid weird special cases in e.g ConfigManager)
+         */
+        continue;
+      }
+
       cm_node.hbCounter += (Uint32)timeSlept;
       if (cm_node.hbCounter >= m_max_api_reg_req_interval ||
           cm_node.hbCounter >= cm_node.hbFrequency)
@@ -386,7 +429,7 @@ ClusterMgr::threadMain( ){
           cm_node.hbCounter = 0;
 	}
 
-        if(theNode.m_info.m_type == NodeInfo::MGM)
+        if (theNode.m_info.m_type != NodeInfo::DB)
           signal.theReceiversBlockNumber = API_CLUSTERMGR;
         else
           signal.theReceiversBlockNumber = QMGR;
@@ -397,11 +440,18 @@ ClusterMgr::threadMain( ){
 	raw_sendSignal(&signal, nodeId);
       }//if
       
-      if (cm_node.hbMissed == 4 && cm_node.hbFrequency > 0){
-	reportNodeFailed(i);
-      }//if
+      if (cm_node.hbMissed == 4 && cm_node.hbFrequency > 0)
+      {
+        nodeFailRep->noOfNodes++;
+        NodeBitmask::set(nodeFailRep->theNodes, nodeId);
+      }
     }
-    unlock();
+
+    if (nodeFailRep->noOfNodes)
+    {
+      raw_sendSignal(&nodeFail_signal, getOwnNodeId());
+    }
+    trp_client::unlock();
   }
 }
 
@@ -418,20 +468,15 @@ ClusterMgr::trp_deliver_signal(const Ndb
     break;
 
   case GSN_API_REGCONF:
-  {
-    execAPI_REGCONF(theData);
-
-    // Distribute signal to all threads/blocks
-    theFacade.for_each(this, sig, ptr);
+     execAPI_REGCONF(sig, ptr);
     break;
-  }
 
   case GSN_API_REGREF:
     execAPI_REGREF(theData);
     break;
 
   case GSN_NODE_FAILREP:
-    execNODE_FAILREP(theData);
+    execNODE_FAILREP(sig, ptr);
     break;
 
   case GSN_NF_COMPLETEREP:
@@ -499,6 +544,16 @@ ClusterMgr::trp_deliver_signal(const Ndb
     theFacade.for_each(this, sig, ptr);
     return;
   }
+  case GSN_CONNECT_REP:
+  {
+    execCONNECT_REP(sig, ptr);
+    return;
+  }
+  case GSN_DISCONNECT_REP:
+  {
+    execDISCONNECT_REP(sig, ptr);
+    return;
+  }
   default:
     break;
 
@@ -628,8 +683,11 @@ ClusterMgr::execAPI_REGREQ(const Uint32 
 }
 
 void
-ClusterMgr::execAPI_REGCONF(const Uint32 * theData){
-  const ApiRegConf * const apiRegConf = (ApiRegConf *)&theData[0];
+ClusterMgr::execAPI_REGCONF(const NdbApiSignal * signal,
+                            const LinearSectionPtr ptr[])
+{
+  const ApiRegConf * apiRegConf = CAST_CONSTPTR(ApiRegConf,
+                                                signal->getDataPtr());
   const NodeId nodeId = refToNode(apiRegConf->qmgrRef);
   
 #ifdef DEBUG_REG
@@ -677,17 +735,30 @@ ClusterMgr::execAPI_REGCONF(const Uint32
     memcpy(&node.m_state, &apiRegConf->nodeState, sizeof(node.m_state) - 24);
   }
   
-  if (node.compatible && (node.m_state.startLevel == NodeState::SL_STARTED  ||
-			  node.m_state.getSingleUserMode())){
-    set_node_alive(node, true);
-  } else {
-    set_node_alive(node, false);
-  }//if
+  if (node.m_info.m_type == NodeInfo::DB)
+  {
+    /**
+     * Only set DB nodes to "alive"
+     */
+    if (node.compatible && (node.m_state.startLevel == NodeState::SL_STARTED ||
+                            node.m_state.getSingleUserMode()))
+    {
+      set_node_alive(node, true);
+    }
+    else
+    {
+      set_node_alive(node, false);
+    }
+  }
 
   cm_node.hbMissed = 0;
   cm_node.hbCounter = 0;
   cm_node.hbFrequency = (apiRegConf->apiHeartbeatFrequency * 10) - 50;
 
+  // Distribute signal to all threads/blocks
+  // TODO only if state changed...
+  theFacade.for_each(this, signal, ptr);
+
   check_wait_for_hb(nodeId);
 }
 
@@ -742,17 +813,6 @@ ClusterMgr::execAPI_REGREF(const Uint32 
   check_wait_for_hb(nodeId);
 }
 
-
-void
-ClusterMgr::execNODE_FAILREP(const Uint32 * theData){
-  const NodeFailRep * const nodeFail = (NodeFailRep *)&theData[0];
-  for(int i = 1; i < MAX_NDB_NODES; i++){
-    if(NdbNodeBitmask::get(nodeFail->theNodes, i)){
-      reportNodeFailed(i);
-    }
-  }
-}
-
 void
 ClusterMgr::execNF_COMPLETEREP(const NdbApiSignal* signal,
                                const LinearSectionPtr ptr[3])
@@ -781,6 +841,10 @@ ClusterMgr::reportConnected(NodeId nodeI
    * us with the real time-out period to use.
    */
   assert(nodeId > 0 && nodeId < MAX_NODES);
+  if (nodeId == getOwnNodeId())
+  {
+    noOfConnectedNodes--; // Don't count self...
+  }
 
   noOfConnectedNodes++;
 
@@ -791,6 +855,8 @@ ClusterMgr::reportConnected(NodeId nodeI
   cm_node.hbCounter = 0;
   cm_node.hbFrequency = 0;
 
+  assert(theNode.is_connected() == false);
+
   /**
    * make sure the node itself is marked connected even
    * if first API_REGCONF has not arrived
@@ -800,63 +866,112 @@ ClusterMgr::reportConnected(NodeId nodeI
   theNode.m_info.m_version = 0;
   theNode.compatible = true;
   theNode.nfCompleteRep = true;
+  theNode.m_node_fail_rep = false;
   theNode.m_state.startLevel = NodeState::SL_NOTHING;
   theNode.minDbVersion = 0;
   
+  /**
+   * We know that we have clusterMgrThreadMutex and trp_client::mutex
+   *   but we don't know if we are polling...and for_each can
+   *   only be used by a poller...
+   *
+   * Send signal to self, so that we can do this when receiving a signal
+   */
   NdbApiSignal signal(numberToRef(API_CLUSTERMGR, getOwnNodeId()));
   signal.theVerId_signalNumber = GSN_CONNECT_REP;
-  signal.theReceiversBlockNumber = 0;
+  signal.theReceiversBlockNumber = API_CLUSTERMGR;
   signal.theTrace  = 0;
   signal.theLength = 1;
   signal.getDataPtrSend()[0] = nodeId;
-  theFacade.for_each(this, &signal, 0);
+  raw_sendSignal(&signal, getOwnNodeId());
   DBUG_VOID_RETURN;
 }
 
 void
+ClusterMgr::execCONNECT_REP(const NdbApiSignal* sig,
+                            const LinearSectionPtr ptr[])
+{
+  theFacade.for_each(this, sig, 0);
+}
+
+void
+ClusterMgr::set_node_dead(trp_node& theNode)
+{
+  set_node_alive(theNode, false);
+  theNode.set_confirmed(false);
+  theNode.m_state.m_connected_nodes.clear();
+  theNode.m_state.startLevel = NodeState::SL_NOTHING;
+  theNode.m_info.m_connectCount ++;
+  theNode.nfCompleteRep = false;
+}
+
+void
 ClusterMgr::reportDisconnected(NodeId nodeId)
 {
   assert(nodeId > 0 && nodeId < MAX_NODES);
   assert(noOfConnectedNodes > 0);
 
-  reportNodeFailed(nodeId, true);
+  /**
+   * We know that we have clusterMgrThreadMutex and trp_client::mutex
+   *   but we don't know if we are polling...and for_each can
+   *   only be used by a poller...
+   *
+   * Send signal to self, so that we can do this when receiving a signal
+   */
+  NdbApiSignal signal(numberToRef(API_CLUSTERMGR, getOwnNodeId()));
+  signal.theVerId_signalNumber = GSN_DISCONNECT_REP;
+  signal.theReceiversBlockNumber = API_CLUSTERMGR;
+  signal.theTrace  = 0;
+  signal.theLength = DisconnectRep::SignalLength;
+
+  DisconnectRep * rep = CAST_PTR(DisconnectRep, signal.getDataPtrSend());
+  rep->nodeId = nodeId;
+  rep->err = 0;
+  raw_sendSignal(&signal, getOwnNodeId());
 }
 
 void
-ClusterMgr::reportNodeFailed(NodeId nodeId, bool disconnect)
+ClusterMgr::execDISCONNECT_REP(const NdbApiSignal* sig,
+                               const LinearSectionPtr ptr[])
 {
-  // Check array bounds + don't allow node 0 to be touched
+  const DisconnectRep * rep = CAST_CONSTPTR(DisconnectRep, sig->getDataPtr());
+  Uint32 nodeId = rep->nodeId;
+
   assert(nodeId > 0 && nodeId < MAX_NODES);
   Node & cm_node = theNodes[nodeId];
   trp_node & theNode = cm_node;
 
-  set_node_alive(theNode, false);
-  theNode.m_info.m_connectCount ++;
+  bool node_failrep = theNode.m_node_fail_rep;
+  set_node_dead(theNode);
+  theNode.set_connected(false);
 
-  if (disconnect)
-  {
-    noOfConnectedNodes--;
-    theNode.set_confirmed(false);
-    theNode.set_connected(false);
-    theNode.m_state.m_connected_nodes.clear();
-  }
-  
-  if (theNode.is_connected())
+  noOfConnectedNodes--;
+  if (noOfConnectedNodes == 0)
   {
-    theFacade.doDisconnect(nodeId);
+    if (!global_flag_skip_invalidate_cache &&
+        theFacade.m_globalDictCache)
+    {
+      theFacade.m_globalDictCache->lock();
+      theFacade.m_globalDictCache->invalidate_all();
+      theFacade.m_globalDictCache->unlock();
+      m_connect_count ++;
+      m_cluster_state = CS_waiting_for_clean_cache;
+    }
+
+    if (m_auto_reconnect == 0)
+    {
+      theStop = 2;
+    }
   }
 
-  if (theNode.m_info.getType() == NodeInfo::DB)
-    recalcMinDbVersion();
-  
-  const bool report = (theNode.m_state.startLevel != NodeState::SL_NOTHING);  
-  theNode.m_state.startLevel = NodeState::SL_NOTHING;
-  
-  if (disconnect || report)
+  if (node_failrep == false)
   {
+    /**
+     * Inform API
+     */
     NdbApiSignal signal(numberToRef(API_CLUSTERMGR, getOwnNodeId()));
     signal.theVerId_signalNumber = GSN_NODE_FAILREP;
-    signal.theReceiversBlockNumber = 0;
+    signal.theReceiversBlockNumber = API_CLUSTERMGR;
     signal.theTrace  = 0;
     signal.theLength = NodeFailRep::SignalLengthLong;
 
@@ -866,27 +981,58 @@ ClusterMgr::reportNodeFailed(NodeId node
     rep->noOfNodes = 1;
     NodeBitmask::clear(rep->theNodes);
     NodeBitmask::set(rep->theNodes, nodeId);
-    theFacade.for_each(this, &signal, 0);
+    execNODE_FAILREP(&signal, 0);
   }
+}
+
+void
+ClusterMgr::execNODE_FAILREP(const NdbApiSignal* sig,
+                             const LinearSectionPtr ptr[])
+{
+  const NodeFailRep * rep = CAST_CONSTPTR(NodeFailRep, sig->getDataPtr());
+
+  NdbApiSignal signal(sig->theSendersBlockRef);
+  signal.theVerId_signalNumber = GSN_NODE_FAILREP;
+  signal.theReceiversBlockNumber = API_CLUSTERMGR;
+  signal.theTrace  = 0;
+  signal.theLength = NodeFailRep::SignalLengthLong;
   
-  if (noOfConnectedNodes == 0)
-  {
-    if (!global_flag_skip_invalidate_cache &&
-        theFacade.m_globalDictCache)
+  NodeFailRep * copy = CAST_PTR(NodeFailRep, signal.getDataPtrSend());
+  copy->failNo = 0;
+  copy->masterNodeId = 0;
+  copy->noOfNodes = 0;
+  NodeBitmask::clear(copy->theNodes);
+
+  for (Uint32 i = NdbNodeBitmask::find_first(rep->theNodes);
+       i != NdbNodeBitmask::NotFound;
+       i = NdbNodeBitmask::find_next(rep->theNodes, i + 1))
+  {
+    Node & cm_node = theNodes[i];
+    trp_node & theNode = cm_node;
+
+    bool node_failrep = theNode.m_node_fail_rep;
+    bool connected = theNode.is_connected();
+    set_node_dead(theNode);
+
+    if (node_failrep == false)
     {
-      theFacade.m_globalDictCache->lock();
-      theFacade.m_globalDictCache->invalidate_all();
-      theFacade.m_globalDictCache->unlock();
-      m_connect_count ++;
-      m_cluster_state = CS_waiting_for_clean_cache;
+      theNode.m_node_fail_rep = true;
+      NodeBitmask::set(copy->theNodes, i);
+      copy->noOfNodes++;
     }
 
-    if (m_auto_reconnect == 0)
+    if (connected)
     {
-      theStop = 2;
+      theFacade.doDisconnect(i);
     }
   }
-  theNode.nfCompleteRep = false;
+
+  recalcMinDbVersion();
+  if (copy->noOfNodes)
+  {
+    theFacade.for_each(this, &signal, 0); // report GSN_NODE_FAILREP
+  }
+
   if (noOfAliveNodes == 0)
   {
     NdbApiSignal signal(numberToRef(API_CLUSTERMGR, getOwnNodeId()));
@@ -913,7 +1059,6 @@ ClusterMgr::reportNodeFailed(NodeId node
   }
 }
 
-
 void
 ClusterMgr::print_nodes(const char* where, NdbOut& out)
 {
@@ -1287,7 +1432,6 @@ ArbitMgr::sendSignalToQmgr(ArbitSignal& 
 #endif
 
   {
-    Guard g(m_clusterMgr.clusterMgrThreadMutex);
     m_clusterMgr.lock();
     m_clusterMgr.raw_sendSignal(&signal, aSignal.data.sender);
     m_clusterMgr.unlock();

=== modified file 'storage/ndb/src/ndbapi/ClusterMgr.hpp'
--- a/storage/ndb/src/ndbapi/ClusterMgr.hpp	2011-01-10 13:30:14 +0000
+++ b/storage/ndb/src/ndbapi/ClusterMgr.hpp	2011-01-18 07:39:47 +0000
@@ -27,6 +27,7 @@
 #include <signaldata/NodeStateSignalData.hpp>
 #include "trp_client.hpp"
 #include "trp_node.hpp"
+#include <signaldata/DisconnectRep.hpp>
 
 extern "C" void* runClusterMgr_C(void * me);
 
@@ -56,9 +57,12 @@ public:
   void set_max_api_reg_req_interval(unsigned int millisec) {
     m_max_api_reg_req_interval = millisec;
   }
-  void force_update_connections();
+
+  void lock() { NdbMutex_Lock(clusterMgrThreadMutex); trp_client::lock(); }
+  void unlock() { trp_client::unlock();NdbMutex_Unlock(clusterMgrThreadMutex); }
 
 private:
+  void startup();
   void threadMain();
   
   int  theStop;
@@ -108,15 +112,15 @@ private:
    */
   NdbMutex*     clusterMgrThreadMutex;
 
-  void reportNodeFailed(NodeId nodeId, bool disconnect = false);
-  
   /**
    * Signals received
    */
   void execAPI_REGREQ    (const Uint32 * theData);
-  void execAPI_REGCONF   (const Uint32 * theData);
+  void execAPI_REGCONF   (const NdbApiSignal*, const LinearSectionPtr ptr[]);
   void execAPI_REGREF    (const Uint32 * theData);
-  void execNODE_FAILREP  (const Uint32 * theData);
+  void execCONNECT_REP   (const NdbApiSignal*, const LinearSectionPtr ptr[]);
+  void execDISCONNECT_REP(const NdbApiSignal*, const LinearSectionPtr ptr[]);
+  void execNODE_FAILREP  (const NdbApiSignal*, const LinearSectionPtr ptr[]);
   void execNF_COMPLETEREP(const NdbApiSignal*, const LinearSectionPtr ptr[]);
 
   void check_wait_for_hb(NodeId nodeId);
@@ -139,6 +143,8 @@ private:
     node.m_alive = alive;
   }
 
+  void set_node_dead(trp_node&);
+
   void print_nodes(const char* where, NdbOut& out = ndbout);
   void recalcMinDbVersion();
 

=== modified file 'storage/ndb/src/ndbapi/TransporterFacade.cpp'
--- a/storage/ndb/src/ndbapi/TransporterFacade.cpp	2011-01-17 12:08:49 +0000
+++ b/storage/ndb/src/ndbapi/TransporterFacade.cpp	2011-01-21 13:56:43 +0000
@@ -485,9 +485,9 @@ void TransporterFacade::threadMainReceiv
 #endif
   while(!theStopReceive)
   {
-    NdbMutex_Lock(theMutexPtr);
+    theClusterMgr->lock();
     theTransporterRegistry->update_connections();
-    NdbMutex_Unlock(theMutexPtr);
+    theClusterMgr->unlock();
     NdbSleep_MilliSleep(100);
   }//while
   theTransporterRegistry->stopReceiving();
@@ -599,14 +599,6 @@ TransporterFacade::do_connect_mgm(NodeId
     }
   }
 
-  /**
-   * Also setup Loopback Transporter
-   */
-  if (is_mgmd(nodeId, conf))
-  {
-    doConnect(nodeId);
-  }
-
   DBUG_RETURN(true);
 }
 
@@ -624,7 +616,7 @@ TransporterFacade::configure(NodeId node
   if (!IPCConfig::configureTransporters(nodeId,
                                         * conf,
                                         * theTransporterRegistry,
-                                        is_mgmd(nodeId, conf)))
+                                        true))
     DBUG_RETURN(false);
 
   // Configure cluster manager
@@ -663,7 +655,12 @@ TransporterFacade::configure(NodeId node
   // Open connection between MGM servers
   if (!do_connect_mgm(nodeId, conf))
     DBUG_RETURN(false);
-  
+
+  /**
+   * Also setup Loopback Transporter
+   */
+  doConnect(nodeId);
+
   DBUG_RETURN(true);
 }
 
@@ -874,7 +871,9 @@ TransporterFacade::sendSignal(const NdbA
     if (ss == SEND_OK)
     {
       assert(theClusterMgr->getNodeInfo(aNode).is_confirmed() ||
-             aSignal->readSignalNumber() == GSN_API_REGREQ);
+             aSignal->readSignalNumber() == GSN_API_REGREQ ||
+             (aSignal->readSignalNumber() == GSN_CONNECT_REP &&
+              aNode == ownId()));
     }
     return (ss == SEND_OK ? 0 : -1);
   }
@@ -1978,7 +1977,9 @@ TransporterFacade::ext_set_max_api_reg_r
 void
 TransporterFacade::ext_update_connections()
 {
-  theClusterMgr->force_update_connections();
+  theClusterMgr->lock();
+  theTransporterRegistry->update_connections();
+  theClusterMgr->unlock();
 }
 
 struct in_addr
@@ -1996,14 +1997,19 @@ TransporterFacade::ext_forceHB()
 bool
 TransporterFacade::ext_isConnected(NodeId aNodeId)
 {
-  return theTransporterRegistry->is_connected(aNodeId);
+  bool val;
+  theClusterMgr->lock();
+  val = theClusterMgr->theNodes[aNodeId].is_connected();
+  theClusterMgr->unlock();
+  return val;
 }
 
 void
 TransporterFacade::ext_doConnect(int aNodeId)
 {
-  lock_mutex();
+  theClusterMgr->lock();
+  assert(theClusterMgr->theNodes[aNodeId].is_connected() == false);
   doConnect(aNodeId);
-  unlock_mutex();
+  theClusterMgr->unlock();
 }
 

=== modified file 'storage/ndb/src/ndbapi/trp_node.cpp'
--- a/storage/ndb/src/ndbapi/trp_node.cpp	2010-12-21 11:43:32 +0000
+++ b/storage/ndb/src/ndbapi/trp_node.cpp	2011-01-18 07:39:47 +0000
@@ -21,7 +21,7 @@
 trp_node::trp_node()
 {
   compatible = nfCompleteRep = true;
-  m_connected = defined = m_alive = m_api_reg_conf = false;
+  m_connected = defined = m_alive = m_api_reg_conf = m_node_fail_rep = false;
   bzero(&m_state, sizeof(m_state));
   m_state.init();
   m_state.startLevel = NodeState::SL_NOTHING;
@@ -37,6 +37,7 @@ trp_node::operator==(const trp_node& oth
           defined == other.defined &&
           m_alive == other.m_alive &&
           m_api_reg_conf == other.m_api_reg_conf &&
+          m_node_fail_rep == other.m_node_fail_rep &&
           minDbVersion == other.minDbVersion &&
           memcmp(&m_state, &other.m_state, sizeof(m_state)) == 0);
 }
@@ -50,6 +51,7 @@ operator<<(NdbOut& out, const trp_node& 
       << ", connected: " << n.m_connected
       << ", api_reg_conf: " << n.m_api_reg_conf
       << ", alive: " << n.m_alive
+      << ", nodefailrep: " << n.m_node_fail_rep
       << ", nfCompleteRep: " << n.nfCompleteRep
       << ", minDbVersion: " << n.minDbVersion
       << ", state: " << n.m_state

=== modified file 'storage/ndb/src/ndbapi/trp_node.hpp'
--- a/storage/ndb/src/ndbapi/trp_node.hpp	2010-12-21 11:43:32 +0000
+++ b/storage/ndb/src/ndbapi/trp_node.hpp	2011-01-18 07:39:47 +0000
@@ -28,15 +28,21 @@ NdbOut& operator<<(NdbOut&, const struct
 struct trp_node
 {
   trp_node();
-  bool defined;
-  bool compatible;    // Version is compatible
-  bool nfCompleteRep; // NF Complete Rep has arrived
-  bool m_alive;       // Node is alive
-  Uint32 minDbVersion;
 
   NodeInfo  m_info;
   NodeState m_state;
 
+  Uint32 minDbVersion;
+  bool defined;
+  bool compatible;     // Version is compatible
+  bool nfCompleteRep;  // NF Complete Rep has arrived
+  bool m_alive;        // Node is alive
+  bool m_node_fail_rep;// NodeFailRep has arrived
+private:
+  bool m_connected;     // Transporter connected
+  bool m_api_reg_conf;// API_REGCONF has arrived
+public:
+
   void set_connected(bool connected) {
     assert(defined);
     m_connected = connected;
@@ -50,7 +56,8 @@ struct trp_node
   }
 
   void set_confirmed(bool confirmed) {
-    assert(is_connected()); // Must be connected to change confirmed
+    if (confirmed)
+      assert(is_connected());
     m_api_reg_conf = confirmed;
   }
 
@@ -64,8 +71,6 @@ struct trp_node
   bool operator==(const trp_node& other) const;
 
 private:
-  bool m_connected;     // Transporter connected
-  bool m_api_reg_conf;// API_REGCONF has arrived
 
   friend NdbOut& operator<<(NdbOut&, const trp_node&);
 };

=== modified file 'storage/ndb/test/ndbapi/testMgmd.cpp'
--- a/storage/ndb/test/ndbapi/testMgmd.cpp	2010-09-22 11:53:53 +0000
+++ b/storage/ndb/test/ndbapi/testMgmd.cpp	2011-01-18 07:22:33 +0000
@@ -971,16 +971,16 @@ TESTCASE("NoCfgCache",
   INITIALIZER(runTestNoConfigCache);
 }
 
-TESTCASE("Bug56844",
+TESTCASE("Bug45495",
          "Test that mgmd can be restarted in any order")
 {
-  INITIALIZER(runBug56844);
+  INITIALIZER(runTestBug45495);
 }
 
-TESTCASE("Bug45495",
-         "Test that mgmd can be restarted in any order")
+TESTCASE("Bug56844",
+         "Test that mgmd can be reloaded in parallel")
 {
-  INITIALIZER(runTestBug45495);
+  INITIALIZER(runBug56844);
 }
 
 NDBT_TESTSUITE_END(testMgmd);

=== modified file 'storage/ndb/test/run-test/atrt.hpp'
--- a/storage/ndb/test/run-test/atrt.hpp	2010-11-30 07:47:55 +0000
+++ b/storage/ndb/test/run-test/atrt.hpp	2011-01-17 14:59:31 +0000
@@ -132,7 +132,7 @@ bool configure(atrt_config&, int setup);
 bool setup_directories(atrt_config&, int setup);
 bool setup_files(atrt_config&, int setup, int sshx);
 
-bool deploy(atrt_config&);
+bool deploy(int, atrt_config&);
 bool sshx(atrt_config&, unsigned procmask);
 bool start(atrt_config&, unsigned procmask);
 

=== modified file 'storage/ndb/test/run-test/main.cpp'
--- a/storage/ndb/test/run-test/main.cpp	2010-11-28 12:27:13 +0000
+++ b/storage/ndb/test/run-test/main.cpp	2011-01-17 14:59:31 +0000
@@ -212,7 +212,7 @@ main(int argc, char ** argv)
   
   if (g_do_deploy)
   {
-    if (!deploy(g_config))
+    if (!deploy(g_do_deploy, g_config))
     {
       g_logger.critical("Failed to deploy");
       goto end;
@@ -613,8 +613,11 @@ parse_args(int argc, char** argv)
 	g_do_setup = 2;
 	break;
       case 'd':
-	g_do_deploy = 1;
+	g_do_deploy = 3;
 	break;
+      case 'D':
+        g_do_deploy = 2; // only binaries
+        break;
       case 'x':
 	g_do_sshx = atrt_process::AP_CLIENT | atrt_process::AP_NDB_API;
 	break;
@@ -1369,18 +1372,25 @@ do_rsync(const char *dir, const char *ds
 }
 
 bool
-deploy(atrt_config & config)
+deploy(int d, atrt_config & config)
 {
   for (size_t i = 0; i<config.m_hosts.size(); i++)
   {
-    if (!do_rsync(g_basedir, config.m_hosts[i]->m_hostname.c_str()))
-      return false;
+    if (d & 1)
+    {
+      if (!do_rsync(g_basedir, config.m_hosts[i]->m_hostname.c_str()))
+        return false;
+    }
 
-    if (!do_rsync(g_prefix, config.m_hosts[i]->m_hostname.c_str()))
-      return false;
+    if (d & 2)
+    {
+      if (!do_rsync(g_prefix, config.m_hosts[i]->m_hostname.c_str()))
+        return false;
     
-    if (g_prefix1 && !do_rsync(g_prefix1, config.m_hosts[i]->m_hostname.c_str()))
-      return false;
+      if (g_prefix1 && 
+          !do_rsync(g_prefix1, config.m_hosts[i]->m_hostname.c_str()))
+        return false;
+    }
   }
   
   return true;

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.1-telco-7.0-spj-scan-vs-scan branch (jan.wedvik:3412to 3413) Jan Wedvik21 Jan