List:Commits« Previous MessageNext Message »
From:Magnus Blåudd Date:January 21 2011 12:43pm
Subject:bzr commit into mysql-5.5-telco-7.0 branch (magnus.blaudd:3144)
View as plain text  
#At file:///home/msvensson/mysql/5.5-telco-7.0/ based on revid:magnus.blaudd@strippede8vzx

 3144 Magnus Blåudd	2011-01-21 [merge]
      Merge 7.0 -> 5.5-telco-7.0

    modified:
      mysql-test/r/join_outer.result
      mysql-test/r/range.result
      mysql-test/suite/ndb/r/ndb_alter_table_online.result
      mysql-test/suite/ndb/r/ndb_basic.result
      mysql-test/suite/ndb/r/ndb_condition_pushdown.result
      mysql-test/suite/ndb/r/ndb_index_unique.result
      mysql-test/suite/ndb/r/ndb_load.result
      mysql-test/suite/ndb/r/ndb_partition_error.result
      mysql-test/suite/ndb/r/ndb_restore.result
      mysql-test/suite/ndb/t/ndb_alter_table_online.test
      mysql-test/suite/ndb/t/ndb_basic.test
      mysql-test/suite/ndb/t/ndb_index_unique.test
      mysql-test/suite/ndb/t/ndb_load.test
      mysql-test/suite/ndb/t/ndb_partition_error.test
      mysql-test/suite/ndb/t/ndb_restore.test
      mysql-test/t/join_outer.test
      mysql-test/t/range.test
      sql/ha_ndbcluster.cc
      sql/ha_ndbcluster.h
      sql/ha_ndbcluster_binlog.cc
      sql/ha_ndbcluster_glue.h
      sql/ha_ndbcluster_tables.h
      sql/sql_select.cc
      storage/ndb/src/kernel/blocks/lgman.cpp
      storage/ndb/src/kernel/blocks/tsman.cpp
      storage/ndb/src/kernel/blocks/tsman.hpp
      storage/ndb/src/mgmsrv/InitConfigFileParser.cpp
      storage/ndb/test/ndbapi/bench/mainAsyncGenerator.cpp
      storage/ndb/tools/restore/Restore.cpp
=== modified file 'mysql-test/r/join_outer.result'
--- a/mysql-test/r/join_outer.result	2011-01-14 15:25:27 +0000
+++ b/mysql-test/r/join_outer.result	2011-01-21 12:43:19 +0000
@@ -1472,4 +1472,44 @@ WHERE 7;
 col_datetime_key
 NULL
 DROP TABLE BB;
+#
+# Bug#58626 Incorrect result for WHERE <column> IN (<subquery>) IS UNKNOWN 
+#
+CREATE TABLE t1 (I INT NOT NULL);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (I INT NOT NULL);
+INSERT INTO t2 VALUES (3);
+CREATE TABLE t3 (PK1 INT, PK2 INT, PRIMARY KEY(PK1,PK2));
+INSERT INTO t3 VALUES (1,1),(2,2),(3,3);
+SELECT * FROM
+t1 LEFT JOIN t2 ON t2.i = t1.i
+WHERE t2.i IN 
+(
+SELECT STRAIGHT_JOIN t3.pk1 FROM t3 JOIN t3 as t4
+ON t4.pk1=t3.pk1
+WHERE t3.pk2 = t2.i
+)
+IS UNKNOWN;
+I	I
+SELECT * FROM
+t1 LEFT JOIN t2 ON t2.i = t1.i
+WHERE t2.i IN 
+(
+SELECT t3.pk1 FROM t3 LEFT JOIN t3 as t4
+ON t4.pk1=t3.pk1
+WHERE t3.pk2 = t2.i
+)
+IS UNKNOWN;
+I	I
+SELECT * FROM
+t1 LEFT JOIN t2 ON t2.i = t1.i
+WHERE t2.i IN 
+(
+SELECT t3.pk1 FROM t3 JOIN t3 as t4
+ON t4.pk1=t3.pk1
+WHERE t3.pk2 = t2.i
+)
+IS UNKNOWN;
+I	I
+DROP TABLE t1,t2,t3;
 End of 5.1 tests

=== modified file 'mysql-test/r/range.result'
--- a/mysql-test/r/range.result	2010-08-26 12:35:38 +0000
+++ b/mysql-test/r/range.result	2011-01-21 12:43:19 +0000
@@ -1666,4 +1666,105 @@ c_key	c_notkey
 1	1
 3	3
 DROP TABLE t1;
+#
+# Bug #57030: 'BETWEEN' evaluation is incorrect
+#
+CREATE TABLE t1(pk INT PRIMARY KEY, i4 INT);
+CREATE UNIQUE INDEX i4_uq ON t1(i4);
+INSERT INTO t1 VALUES (1,10), (2,20), (3,30);
+EXPLAIN
+SELECT * FROM t1 WHERE i4 BETWEEN 10 AND 10;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	const	i4_uq	i4_uq	5	const	1	
+SELECT * FROM t1 WHERE i4 BETWEEN 10 AND 10;
+pk	i4
+1	10
+EXPLAIN
+SELECT * FROM t1 WHERE 10 BETWEEN i4 AND i4;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	const	i4_uq	i4_uq	5	const	1	
+SELECT * FROM t1 WHERE 10 BETWEEN i4 AND i4;
+pk	i4
+1	10
+EXPLAIN
+SELECT * FROM t1 WHERE 10 BETWEEN 10 AND i4;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	range	i4_uq	i4_uq	5	NULL	3	Using where
+SELECT * FROM t1 WHERE 10 BETWEEN 10 AND i4;
+pk	i4
+1	10
+2	20
+3	30
+EXPLAIN
+SELECT * FROM t1 WHERE 10 BETWEEN i4 AND 10;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	range	i4_uq	i4_uq	5	NULL	1	Using where
+SELECT * FROM t1 WHERE 10 BETWEEN i4 AND 10;
+pk	i4
+1	10
+EXPLAIN
+SELECT * FROM t1 WHERE 10 BETWEEN 10 AND 10;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	3	
+SELECT * FROM t1 WHERE 10 BETWEEN 10 AND 10;
+pk	i4
+1	10
+2	20
+3	30
+EXPLAIN
+SELECT * FROM t1 WHERE 10 BETWEEN 11 AND 11;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE
+SELECT * FROM t1 WHERE 10 BETWEEN 11 AND 11;
+pk	i4
+EXPLAIN
+SELECT * FROM t1 WHERE 10 BETWEEN 100 AND 0;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE
+SELECT * FROM t1 WHERE 10 BETWEEN 100 AND 0;
+pk	i4
+EXPLAIN
+SELECT * FROM t1 WHERE i4 BETWEEN 100 AND 0;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+SELECT * FROM t1 WHERE i4 BETWEEN 100 AND 0;
+pk	i4
+EXPLAIN
+SELECT * FROM t1 WHERE i4 BETWEEN 10 AND 99999999999999999;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	range	i4_uq	i4_uq	5	NULL	2	Using where
+SELECT * FROM t1 WHERE i4 BETWEEN 10 AND 99999999999999999;
+pk	i4
+1	10
+2	20
+3	30
+EXPLAIN
+SELECT * FROM t1 WHERE i4 BETWEEN 999999999999999 AND 30;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+SELECT * FROM t1 WHERE i4 BETWEEN 999999999999999 AND 30;
+pk	i4
+EXPLAIN
+SELECT * FROM t1 WHERE i4 BETWEEN 10 AND '20';
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	range	i4_uq	i4_uq	5	NULL	1	Using where
+SELECT * FROM t1 WHERE i4 BETWEEN 10 AND '20';
+pk	i4
+1	10
+2	20
+EXPLAIN
+SELECT * FROM t1, t1 as t2 WHERE t2.pk BETWEEN t1.i4 AND t1.i4;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ALL	i4_uq	NULL	NULL	NULL	3	
+1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	4	test.t1.i4	1	Using where
+SELECT * FROM t1, t1 as t2 WHERE t2.pk BETWEEN t1.i4 AND t1.i4;
+pk	i4	pk	i4
+EXPLAIN
+SELECT * FROM t1, t1 as t2 WHERE t1.i4 BETWEEN t2.pk AND t2.pk;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ALL	i4_uq	NULL	NULL	NULL	3	
+1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	4	test.t1.i4	1	Using where
+SELECT * FROM t1, t1 as t2 WHERE t1.i4 BETWEEN t2.pk AND t2.pk;
+pk	i4	pk	i4
+DROP TABLE t1;
 End of 5.1 tests

=== modified file 'mysql-test/suite/ndb/r/ndb_alter_table_online.result'
--- a/mysql-test/suite/ndb/r/ndb_alter_table_online.result	2009-10-09 15:48:57 +0000
+++ b/mysql-test/suite/ndb/r/ndb_alter_table_online.result	2011-01-21 10:29:46 +0000
@@ -691,7 +691,10 @@ SELECT COUNT(*) FROM t1;
 COUNT(*)
 16384
 ALTER ONLINE TABLE t1 ADD b INT;
-********************
-* Cleanup Section
-********************
 DROP TABLE t1, ndb_show_tables_results;
+create table t1 ( c499 int, c498 int, c497 int, c496 int, c495 int, c494 int, c493 int, c492 int, c491 int, c490 int, c489 int, c488 int, c487 int, c486 int, c485 int, c484 int, c483 int, c482 int, c481 int, c480 int, c479 int, c478 int, c477 int, c476 int, c475 int, c474 int, c473 int, c472 int, c471 int, c470 int, c469 int, c468 int, c467 int, c466 int, c465 int, c464 int, c463 int, c462 int, c461 int, c460 int, c459 int, c458 int, c457 int, c456 int, c455 int, c454 int, c453 int, c452 int, c451 int, c450 int, c449 int, c448 int, c447 int, c446 int, c445 int, c444 int, c443 int, c442 int, c441 int, c440 int, c439 int, c438 int, c437 int, c436 int, c435 int, c434 int, c433 int, c432 int, c431 int, c430 int, c429 int, c428 int, c427 int, c426 int, c425 int, c424 int, c423 int, c422 int, c421 int, c420 int, c419 int, c418 int, c417 int, c416 int, c415 int, c414 int, c413 int, c412 int, c411 int, c410 int, c409 int, c408 int, c407 int, c406 int, c405 int, c404 int, c403 int, c402 int, c401 int, c400 int, c399 int, c398 int, c397 int, c396 int, c395 int, c394 int, c393 int, c392 int, c391 int, c390 int, c389 int, c388 int, c387 int, c386 int, c385 int, c384 int, c383 int, c382 int, c381 int, c380 int, c379 int, c378 int, c377 int, c376 int, c375 int, c374 int, c373 int, c372 int, c371 int, c370 int, c369 int, c368 int, c367 int, c366 int, c365 int, c364 int, c363 int, c362 int, c361 int, c360 int, c359 int, c358 int, c357 int, c356 int, c355 int, c354 int, c353 int, c352 int, c351 int, c350 int, c349 int, c348 int, c347 int, c346 int, c345 int, c344 int, c343 int, c342 int, c341 int, c340 int, c339 int, c338 int, c337 int, c336 int, c335 int, c334 int, c333 int, c332 int, c331 int, c330 int, c329 int, c328 int, c327 int, c326 int, c325 int, c324 int, c323 int, c322 int, c321 int, c320 int, c319 int, c318 int, c317 int, c316 int, c315 int, c314 int, c313 int, c312 int, c311 int, c310 int, c309 int, c308 int, c307 int, c306 int, c305 int, c304 int, c303 int, c302 int, c301 int, c300 int, c299 int, c298 int, c297 int, c296 int, c295 int, c294 int, c293 int, c292 int, c291 int, c290 int, c289 int, c288 int, c287 int, c286 int, c285 int, c284 int, c283 int, c282 int, c281 int, c280 int, c279 int, c278 int, c277 int, c276 int, c275 int, c274 int, c273 int, c272 int, c271 int, c270 int, c269 int, c268 int, c267 int, c266 int, c265 int, c264 int, c263 int, c262 int, c261 int, c260 int, c259 int, c258 int, c257 int, c256 int, c255 int, c254 int, c253 int, c252 int, c251 int, c250 int, c249 int, c248 int, c247 int, c246 int, c245 int, c244 int, c243 int, c242 int, c241 int, c240 int, c239 int, c238 int, c237 int, c236 int, c235 int, c234 int, c233 int, c232 int, c231 int, c230 int, c229 int, c228 int, c227 int, c226 int, c225 int, c224 int, c223 int, c222 int, c221 int, c220 int, c219 int, c218 int, c217 int, c216 int, c215 int, c214 int, c213 int, c212 int, c211 int, c210 int, c209 int, c208 int, c207 int, c206 int, c205 int, c204 int, c203 int, c202 int, c201 int, c200 int, c199 int, c198 int, c197 int, c196 int, c195 int, c194 int, c193 int, c192 int, c191 int, c190 int, c189 int, c188 int, c187 int, c186 int, c185 int, c184 int, c183 int, c182 int, c181 int, c180 int, c179 int, c178 int, c177 int, c176 int, c175 int, c174 int, c173 int, c172 int, c171 int, c170 int, c169 int, c168 int, c167 int, c166 int, c165 int, c164 int, c163 int, c162 int, c161 int, c160 int, c159 int, c158 int, c157 int, c156 int, c155 int, c154 int, c153 int, c152 int, c151 int, c150 int, c149 int, c148 int, c147 int, c146 int, c145 int, c144 int, c143 int, c142 int, c141 int, c140 int, c139 int, c138 int, c137 int, c136 int, c135 int, c134 int, c133 int, c132 int, c131 int, c130 int, c129 int, c128 int, c127 int, c126 int, c125 int, c124 int, c123 int, c122 int, c121 int, c120 int, c119 int, c118 int, c117 int, c116 int, c115 int, c114 int, c113 int, c112 int, c111 int, c110 int, c109 int, c108 int, c107 int, c106 int, c105 int, c104 int, c103 int, c102 int, c101 int, c100 int, c99 int, c98 int, c97 int, c96 int, c95 int, c94 int, c93 int, c92 int, c91 int, c90 int, c89 int, c88 int, c87 int, c86 int, c85 int, c84 int, c83 int, c82 int, c81 int, c80 int, c79 int, c78 int, c77 int, c76 int, c75 int, c74 int, c73 int, c72 int, c71 int, c70 int, c69 int, c68 int, c67 int, c66 int, c65 int, c64 int, c63 int, c62 int, c61 int, c60 int, c59 int, c58 int, c57 int, c56 int, c55 int, c54 int, c53 int, c52 int, c51 int, c50 int, c49 int, c48 int, c47 int, c46 int, c45 int, c44 int, c43 int, c42 int, c41 int, c40 int, c39 int, c38 int, c37 int, c36 int, c35 int, c34 int, c33 int, c32 int, c31 int, c30 int, c29 int, c28 int, c27 int, c26 int, c25 int, c24 int, c23 int, c22 int, c21 int, c20 int, c19 int, c18 int, c17 int, c16 int, c15 int, c14 int, c13 int, c12 int, c11 int, c10 int, c9 int, c8 int, c7 int, c6 int, c5 int, c4 int, c3 int, c2 int, c1 int, primary key using hash(c1)) engine=ndb;
+insert into t1 (c1) values (1), (2), (3);
+alter offline table t1 modify c1 int auto_increment;
+alter online table t1 add column c500 bit(1) column_format DYNAMIC;
+delete from t1;
+drop table t1;

=== modified file 'mysql-test/suite/ndb/r/ndb_basic.result'
--- a/mysql-test/suite/ndb/r/ndb_basic.result	2011-01-14 15:25:27 +0000
+++ b/mysql-test/suite/ndb/r/ndb_basic.result	2011-01-21 12:43:19 +0000
@@ -482,514 +482,10 @@ select * from t1 where b IS NOT NULL;
 a	b
 1	
 drop table t1;
-create table t1 (
-c1 int,
-c2 int,
-c3 int,
-c4 int,
-c5 int,
-c6 int,
-c7 int,
-c8 int,
-c9 int,
-c10 int,
-c11 int,
-c12 int,
-c13 int,
-c14 int,
-c15 int,
-c16 int,
-c17 int,
-c18 int,
-c19 int,
-c20 int,
-c21 int,
-c22 int,
-c23 int,
-c24 int,
-c25 int,
-c26 int,
-c27 int,
-c28 int,
-c29 int,
-c30 int,
-c31 int,
-c32 int,
-c33 int,
-c34 int,
-c35 int,
-c36 int,
-c37 int,
-c38 int,
-c39 int,
-c40 int,
-c41 int,
-c42 int,
-c43 int,
-c44 int,
-c45 int,
-c46 int,
-c47 int,
-c48 int,
-c49 int,
-c50 int,
-c51 int,
-c52 int,
-c53 int,
-c54 int,
-c55 int,
-c56 int,
-c57 int,
-c58 int,
-c59 int,
-c60 int,
-c61 int,
-c62 int,
-c63 int,
-c64 int,
-c65 int,
-c66 int,
-c67 int,
-c68 int,
-c69 int,
-c70 int,
-c71 int,
-c72 int,
-c73 int,
-c74 int,
-c75 int,
-c76 int,
-c77 int,
-c78 int,
-c79 int,
-c80 int,
-c81 int,
-c82 int,
-c83 int,
-c84 int,
-c85 int,
-c86 int,
-c87 int,
-c88 int,
-c89 int,
-c90 int,
-c91 int,
-c92 int,
-c93 int,
-c94 int,
-c95 int,
-c96 int,
-c97 int,
-c98 int,
-c99 int,
-c100 int,
-c101 int,
-c102 int,
-c103 int,
-c104 int,
-c105 int,
-c106 int,
-c107 int,
-c108 int,
-c109 int,
-c110 int,
-c111 int,
-c112 int,
-c113 int,
-c114 int,
-c115 int,
-c116 int,
-c117 int,
-c118 int,
-c119 int,
-c120 int,
-c121 int,
-c122 int,
-c123 int,
-c124 int,
-c125 int,
-c126 int,
-c127 int,
-c128 int,
-c129 int,
-c130 int,
-c131 int,
-c132 int,
-c133 int,
-c134 int,
-c135 int,
-c136 int,
-c137 int,
-c138 int,
-c139 int,
-c140 int,
-c141 int,
-c142 int,
-c143 int,
-c144 int,
-c145 int,
-c146 int,
-c147 int,
-c148 int,
-c149 int,
-c150 int,
-c151 int,
-c152 int,
-c153 int,
-c154 int,
-c155 int,
-c156 int,
-c157 int,
-c158 int,
-c159 int,
-c160 int,
-c161 int,
-c162 int,
-c163 int,
-c164 int,
-c165 int,
-c166 int,
-c167 int,
-c168 int,
-c169 int,
-c170 int,
-c171 int,
-c172 int,
-c173 int,
-c174 int,
-c175 int,
-c176 int,
-c177 int,
-c178 int,
-c179 int,
-c180 int,
-c181 int,
-c182 int,
-c183 int,
-c184 int,
-c185 int,
-c186 int,
-c187 int,
-c188 int,
-c189 int,
-c190 int,
-c191 int,
-c192 int,
-c193 int,
-c194 int,
-c195 int,
-c196 int,
-c197 int,
-c198 int,
-c199 int,
-c200 int,
-c201 int,
-c202 int,
-c203 int,
-c204 int,
-c205 int,
-c206 int,
-c207 int,
-c208 int,
-c209 int,
-c210 int,
-c211 int,
-c212 int,
-c213 int,
-c214 int,
-c215 int,
-c216 int,
-c217 int,
-c218 int,
-c219 int,
-c220 int,
-c221 int,
-c222 int,
-c223 int,
-c224 int,
-c225 int,
-c226 int,
-c227 int,
-c228 int,
-c229 int,
-c230 int,
-c231 int,
-c232 int,
-c233 int,
-c234 int,
-c235 int,
-c236 int,
-c237 int,
-c238 int,
-c239 int,
-c240 int,
-c241 int,
-c242 int,
-c243 int,
-c244 int,
-c245 int,
-c246 int,
-c247 int,
-c248 int,
-c249 int,
-c250 int,
-c251 int,
-c252 int,
-c253 int,
-c254 int,
-c255 int,
-c256 int,
-c257 int,
-c258 int,
-c259 int,
-c260 int,
-c261 int,
-c262 int,
-c263 int,
-c264 int,
-c265 int,
-c266 int,
-c267 int,
-c268 int,
-c269 int,
-c270 int,
-c271 int,
-c272 int,
-c273 int,
-c274 int,
-c275 int,
-c276 int,
-c277 int,
-c278 int,
-c279 int,
-c280 int,
-c281 int,
-c282 int,
-c283 int,
-c284 int,
-c285 int,
-c286 int,
-c287 int,
-c288 int,
-c289 int,
-c290 int,
-c291 int,
-c292 int,
-c293 int,
-c294 int,
-c295 int,
-c296 int,
-c297 int,
-c298 int,
-c299 int,
-c300 int,
-c301 int,
-c302 int,
-c303 int,
-c304 int,
-c305 int,
-c306 int,
-c307 int,
-c308 int,
-c309 int,
-c310 int,
-c311 int,
-c312 int,
-c313 int,
-c314 int,
-c315 int,
-c316 int,
-c317 int,
-c318 int,
-c319 int,
-c320 int,
-c321 int,
-c322 int,
-c323 int,
-c324 int,
-c325 int,
-c326 int,
-c327 int,
-c328 int,
-c329 int,
-c330 int,
-c331 int,
-c332 int,
-c333 int,
-c334 int,
-c335 int,
-c336 int,
-c337 int,
-c338 int,
-c339 int,
-c340 int,
-c341 int,
-c342 int,
-c343 int,
-c344 int,
-c345 int,
-c346 int,
-c347 int,
-c348 int,
-c349 int,
-c350 int,
-c351 int,
-c352 int,
-c353 int,
-c354 int,
-c355 int,
-c356 int,
-c357 int,
-c358 int,
-c359 int,
-c360 int,
-c361 int,
-c362 int,
-c363 int,
-c364 int,
-c365 int,
-c366 int,
-c367 int,
-c368 int,
-c369 int,
-c370 int,
-c371 int,
-c372 int,
-c373 int,
-c374 int,
-c375 int,
-c376 int,
-c377 int,
-c378 int,
-c379 int,
-c380 int,
-c381 int,
-c382 int,
-c383 int,
-c384 int,
-c385 int,
-c386 int,
-c387 int,
-c388 int,
-c389 int,
-c390 int,
-c391 int,
-c392 int,
-c393 int,
-c394 int,
-c395 int,
-c396 int,
-c397 int,
-c398 int,
-c399 int,
-c400 int,
-c401 int,
-c402 int,
-c403 int,
-c404 int,
-c405 int,
-c406 int,
-c407 int,
-c408 int,
-c409 int,
-c410 int,
-c411 int,
-c412 int,
-c413 int,
-c414 int,
-c415 int,
-c416 int,
-c417 int,
-c418 int,
-c419 int,
-c420 int,
-c421 int,
-c422 int,
-c423 int,
-c424 int,
-c425 int,
-c426 int,
-c427 int,
-c428 int,
-c429 int,
-c430 int,
-c431 int,
-c432 int,
-c433 int,
-c434 int,
-c435 int,
-c436 int,
-c437 int,
-c438 int,
-c439 int,
-c440 int,
-c441 int,
-c442 int,
-c443 int,
-c444 int,
-c445 int,
-c446 int,
-c447 int,
-c448 int,
-c449 int,
-c450 int,
-c451 int,
-c452 int,
-c453 int,
-c454 int,
-c455 int,
-c456 int,
-c457 int,
-c458 int,
-c459 int,
-c460 int,
-c461 int,
-c462 int,
-c463 int,
-c464 int,
-c465 int,
-c466 int,
-c467 int,
-c468 int,
-c469 int,
-c470 int,
-c471 int,
-c472 int,
-c473 int,
-c474 int,
-c475 int,
-c476 int,
-c477 int,
-c478 int,
-c479 int,
-c480 int,
-c481 int,
-c482 int,
-c483 int,
-c484 int,
-c485 int,
-c486 int,
-c487 int,
-c488 int,
-c489 int,
-c490 int,
-c491 int,
-c492 int,
-c493 int,
-c494 int,
-c495 int,
-c496 int,
-c497 int,
-c498 int,
-c499 int,
-primary key using hash(c1)) engine=ndb partition by key(c1);
+create table t1 ( c512 int, c511 int, c510 int, c509 int, c508 int, c507 int, c506 int, c505 int, c504 int, c503 int, c502 int, c501 int, c500 int, c499 int, c498 int, c497 int, c496 int, c495 int, c494 int, c493 int, c492 int, c491 int, c490 int, c489 int, c488 int, c487 int, c486 int, c485 int, c484 int, c483 int, c482 int, c481 int, c480 int, c479 int, c478 int, c477 int, c476 int, c475 int, c474 int, c473 int, c472 int, c471 int, c470 int, c469 int, c468 int, c467 int, c466 int, c465 int, c464 int, c463 int, c462 int, c461 int, c460 int, c459 int, c458 int, c457 int, c456 int, c455 int, c454 int, c453 int, c452 int, c451 int, c450 int, c449 int, c448 int, c447 int, c446 int, c445 int, c444 int, c443 int, c442 int, c441 int, c440 int, c439 int, c438 int, c437 int, c436 int, c435 int, c434 int, c433 int, c432 int, c431 int, c430 int, c429 int, c428 int, c427 int, c426 int, c425 int, c424 int, c423 int, c422 int, c421 int, c420 int, c419 int, c418 int, c417 int, c416 int, c415 int, c414 int, c413 int, c412 int, c411 int, c410 int, c409 int, c408 int, c407 int, c406 int, c405 int, c404 int, c403 int, c402 int, c401 int, c400 int, c399 int, c398 int, c397 int, c396 int, c395 int, c394 int, c393 int, c392 int, c391 int, c390 int, c389 int, c388 int, c387 int, c386 int, c385 int, c384 int, c383 int, c382 int, c381 int, c380 int, c379 int, c378 int, c377 int, c376 int, c375 int, c374 int, c373 int, c372 int, c371 int, c370 int, c369 int, c368 int, c367 int, c366 int, c365 int, c364 int, c363 int, c362 int, c361 int, c360 int, c359 int, c358 int, c357 int, c356 int, c355 int, c354 int, c353 int, c352 int, c351 int, c350 int, c349 int, c348 int, c347 int, c346 int, c345 int, c344 int, c343 int, c342 int, c341 int, c340 int, c339 int, c338 int, c337 int, c336 int, c335 int, c334 int, c333 int, c332 int, c331 int, c330 int, c329 int, c328 int, c327 int, c326 int, c325 int, c324 int, c323 int, c322 int, c321 int, c320 int, c319 int, c318 int, c317 int, c316 int, c315 int, c314 int, c313 int, c312 int, c311 int, c310 int, c309 int, c308 int, c307 int, c306 int, c305 int, c304 int, c303 int, c302 int, c301 int, c300 int, c299 int, c298 int, c297 int, c296 int, c295 int, c294 int, c293 int, c292 int, c291 int, c290 int, c289 int, c288 int, c287 int, c286 int, c285 int, c284 int, c283 int, c282 int, c281 int, c280 int, c279 int, c278 int, c277 int, c276 int, c275 int, c274 int, c273 int, c272 int, c271 int, c270 int, c269 int, c268 int, c267 int, c266 int, c265 int, c264 int, c263 int, c262 int, c261 int, c260 int, c259 int, c258 int, c257 int, c256 int, c255 int, c254 int, c253 int, c252 int, c251 int, c250 int, c249 int, c248 int, c247 int, c246 int, c245 int, c244 int, c243 int, c242 int, c241 int, c240 int, c239 int, c238 int, c237 int, c236 int, c235 int, c234 int, c233 int, c232 int, c231 int, c230 int, c229 int, c228 int, c227 int, c226 int, c225 int, c224 int, c223 int, c222 int, c221 int, c220 int, c219 int, c218 int, c217 int, c216 int, c215 int, c214 int, c213 int, c212 int, c211 int, c210 int, c209 int, c208 int, c207 int, c206 int, c205 int, c204 int, c203 int, c202 int, c201 int, c200 int, c199 int, c198 int, c197 int, c196 int, c195 int, c194 int, c193 int, c192 int, c191 int, c190 int, c189 int, c188 int, c187 int, c186 int, c185 int, c184 int, c183 int, c182 int, c181 int, c180 int, c179 int, c178 int, c177 int, c176 int, c175 int, c174 int, c173 int, c172 int, c171 int, c170 int, c169 int, c168 int, c167 int, c166 int, c165 int, c164 int, c163 int, c162 int, c161 int, c160 int, c159 int, c158 int, c157 int, c156 int, c155 int, c154 int, c153 int, c152 int, c151 int, c150 int, c149 int, c148 int, c147 int, c146 int, c145 int, c144 int, c143 int, c142 int, c141 int, c140 int, c139 int, c138 int, c137 int, c136 int, c135 int, c134 int, c133 int, c132 int, c131 int, c130 int, c129 int, c128 int, c127 int, c126 int, c125 int, c124 int, c123 int, c122 int, c121 int, c120 int, c119 int, c118 int, c117 int, c116 int, c115 int, c114 int, c113 int, c112 int, c111 int, c110 int, c109 int, c108 int, c107 int, c106 int, c105 int, c104 int, c103 int, c102 int, c101 int, c100 int, c99 int, c98 int, c97 int, c96 int, c95 int, c94 int, c93 int, c92 int, c91 int, c90 int, c89 int, c88 int, c87 int, c86 int, c85 int, c84 int, c83 int, c82 int, c81 int, c80 int, c79 int, c78 int, c77 int, c76 int, c75 int, c74 int, c73 int, c72 int, c71 int, c70 int, c69 int, c68 int, c67 int, c66 int, c65 int, c64 int, c63 int, c62 int, c61 int, c60 int, c59 int, c58 int, c57 int, c56 int, c55 int, c54 int, c53 int, c52 int, c51 int, c50 int, c49 int, c48 int, c47 int, c46 int, c45 int, c44 int, c43 int, c42 int, c41 int, c40 int, c39 int, c38 int, c37 int, c36 int, c35 int, c34 int, c33 int, c32 int, c31 int, c30 int, c29 int, c28 int, c27 int, c26 int, c25 int, c24 int, c23 int, c22 int, c21 int, c20 int, c19 int, c18 int, c17 int, c16 int, c15 int, c14 int, c13 int, c12 int, c11 int, c10 int, c9 int, c8 int, c7 int, c6 int, c5 int, c4 int, c3 int, c2 int, c1 int, primary key using hash(c1)) engine=ndb partition by key(c1);
 insert into t1 (c1) values (1), (2), (3);
-alter offline table t1 modify c1 int auto_increment;
-alter online table t1 add column c500 bit(1) column_format DYNAMIC;
 delete from t1;
 drop table t1;
-create table `t1` (`a` int, b int, primary key (a,b)) engine=ndb partition by key(`a`,`b`,`a`);
-ERROR HY000: Field in list of fields for partition function not found in table
 create table t1 (
 a1234567890123456789012345678901234567890 int primary key,
 a12345678901234567890123456789a1234567890 int,

=== modified file 'mysql-test/suite/ndb/r/ndb_condition_pushdown.result'
--- a/mysql-test/suite/ndb/r/ndb_condition_pushdown.result	2011-01-14 15:25:27 +0000
+++ b/mysql-test/suite/ndb/r/ndb_condition_pushdown.result	2011-01-21 12:43:19 +0000
@@ -1307,7 +1307,7 @@ select auto from t1 where
 ('1901-01-01 01:01:01' between date_time and date_time) 
 order by auto;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	medium_index	medium_index	3	NULL	#	Using where with pushed condition; Using filesort
+1	SIMPLE	t1	ref	medium_index	medium_index	3	const	#	Using where with pushed condition; Using filesort
 select auto from t1 where
 ("aaaa" between string and string) and 
 ("aaaa" between vstring and vstring) and 

=== modified file 'mysql-test/suite/ndb/r/ndb_index_unique.result'
--- a/mysql-test/suite/ndb/r/ndb_index_unique.result	2010-11-15 10:52:52 +0000
+++ b/mysql-test/suite/ndb/r/ndb_index_unique.result	2011-01-21 12:43:19 +0000
@@ -889,3 +889,27 @@ a
 4
 set engine_condition_pushdown = @old_ecpd;
 drop table t1;
+create table t1 (pk int primary key, a int) engine=ndb;
+create table t2 (pk int primary key, uq int, a int, 
+unique key ix(uq,a) USING HASH) engine=ndb;
+Warnings:
+Warning	1121	Ndb does not support unique index on NULL valued attributes, index access with NULL value will become full table scan
+insert into t2 values
+(0,0,0), (1,1,0), (2,2,0), (3,3,0), (4,4,0),
+(5,5,1), (6,6,1), (7,7,1), (8,8,1), (9,9,1);
+insert into t1
+select
+t1.pk + t2.pk*10 + t3.pk*100 + t4.pk*1000, t1.a
+from
+t2 as t1, t2 as t2, t2 as t3, t2 as t4;
+explain
+SELECT STRAIGHT_JOIN count(*) FROM 
+t1 JOIN t2 ON t2.a=t1.a where t2.uq IS NULL;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	10000	
+1	SIMPLE	t2	ref	ix	ix	10	const,test.t1.a	1	Using where with pushed condition
+SELECT STRAIGHT_JOIN count(*) FROM 
+t1 JOIN t2 ON t2.a=t1.a where t2.uq IS NULL;
+count(*)
+0
+drop table t1,t2;

=== modified file 'mysql-test/suite/ndb/r/ndb_load.result'
--- a/mysql-test/suite/ndb/r/ndb_load.result	2009-04-06 10:37:55 +0000
+++ b/mysql-test/suite/ndb/r/ndb_load.result	2011-01-21 12:21:05 +0000
@@ -124,7 +124,7 @@ COUNT(*)
 DROP PROCEDURE bulkinsert;
 DROP TABLE t2;
 Now check bulk insert using create .. as select.
-SHOW VARIABLES LIKE '%storage_engine%';
+SHOW VARIABLES LIKE 'storage_engine';
 Variable_name	Value
 storage_engine	MyISAM
 SET storage_engine="ndb";

=== modified file 'mysql-test/suite/ndb/r/ndb_partition_error.result'
--- a/mysql-test/suite/ndb/r/ndb_partition_error.result	2010-10-27 11:32:32 +0000
+++ b/mysql-test/suite/ndb/r/ndb_partition_error.result	2011-01-21 12:43:19 +0000
@@ -45,3 +45,5 @@ partition x234 values in (5, 1));
 insert into t1 values (NULL,1,1);
 Got one of the listed errors
 drop table t1;
+create table `t1` (`a` int, b int, primary key (a,b)) engine=ndb partition by key(`a`,`b`,`a`);
+ERROR HY000: Field in list of fields for partition function not found in table

=== modified file 'mysql-test/suite/ndb/r/ndb_restore.result'
--- a/mysql-test/suite/ndb/r/ndb_restore.result	2010-10-27 11:32:32 +0000
+++ b/mysql-test/suite/ndb/r/ndb_restore.result	2011-01-21 12:43:19 +0000
@@ -630,3 +630,6 @@ id	type	state	logging	_database	_schema
 drop table ndb_show_tables_results;
 create table t1 (a int primary key) engine = ndb;
 drop table t1;
+create table t1 ( c499 int, c498 int, c497 int, c496 int, c495 int, c494 int, c493 int, c492 int, c491 int, c490 int, c489 int, c488 int, c487 int, c486 int, c485 int, c484 int, c483 int, c482 int, c481 int, c480 int, c479 int, c478 int, c477 int, c476 int, c475 int, c474 int, c473 int, c472 int, c471 int, c470 int, c469 int, c468 int, c467 int, c466 int, c465 int, c464 int, c463 int, c462 int, c461 int, c460 int, c459 int, c458 int, c457 int, c456 int, c455 int, c454 int, c453 int, c452 int, c451 int, c450 int, c449 int, c448 int, c447 int, c446 int, c445 int, c444 int, c443 int, c442 int, c441 int, c440 int, c439 int, c438 int, c437 int, c436 int, c435 int, c434 int, c433 int, c432 int, c431 int, c430 int, c429 int, c428 int, c427 int, c426 int, c425 int, c424 int, c423 int, c422 int, c421 int, c420 int, c419 int, c418 int, c417 int, c416 int, c415 int, c414 int, c413 int, c412 int, c411 int, c410 int, c409 int, c408 int, c407 int, c406 int, c405 int, c404 int, c403 int, c402 int, c401 int, c400 int, c399 int, c398 int, c397 int, c396 int, c395 int, c394 int, c393 int, c392 int, c391 int, c390 int, c389 int, c388 int, c387 int, c386 int, c385 int, c384 int, c383 int, c382 int, c381 int, c380 int, c379 int, c378 int, c377 int, c376 int, c375 int, c374 int, c373 int, c372 int, c371 int, c370 int, c369 int, c368 int, c367 int, c366 int, c365 int, c364 int, c363 int, c362 int, c361 int, c360 int, c359 int, c358 int, c357 int, c356 int, c355 int, c354 int, c353 int, c352 int, c351 int, c350 int, c349 int, c348 int, c347 int, c346 int, c345 int, c344 int, c343 int, c342 int, c341 int, c340 int, c339 int, c338 int, c337 int, c336 int, c335 int, c334 int, c333 int, c332 int, c331 int, c330 int, c329 int, c328 int, c327 int, c326 int, c325 int, c324 int, c323 int, c322 int, c321 int, c320 int, c319 int, c318 int, c317 int, c316 int, c315 int, c314 int, c313 int, c312 int, c311 int, c310 int, c309 int, c308 int, c307 int, c306 int, c305 int, c304 int, c303 int, c302 int, c301 int, c300 int, c299 int, c298 int, c297 int, c296 int, c295 int, c294 int, c293 int, c292 int, c291 int, c290 int, c289 int, c288 int, c287 int, c286 int, c285 int, c284 int, c283 int, c282 int, c281 int, c280 int, c279 int, c278 int, c277 int, c276 int, c275 int, c274 int, c273 int, c272 int, c271 int, c270 int, c269 int, c268 int, c267 int, c266 int, c265 int, c264 int, c263 int, c262 int, c261 int, c260 int, c259 int, c258 int, c257 int, c256 int, c255 int, c254 int, c253 int, c252 int, c251 int, c250 int, c249 int, c248 int, c247 int, c246 int, c245 int, c244 int, c243 int, c242 int, c241 int, c240 int, c239 int, c238 int, c237 int, c236 int, c235 int, c234 int, c233 int, c232 int, c231 int, c230 int, c229 int, c228 int, c227 int, c226 int, c225 int, c224 int, c223 int, c222 int, c221 int, c220 int, c219 int, c218 int, c217 int, c216 int, c215 int, c214 int, c213 int, c212 int, c211 int, c210 int, c209 int, c208 int, c207 int, c206 int, c205 int, c204 int, c203 int, c202 int, c201 int, c200 int, c199 int, c198 int, c197 int, c196 int, c195 int, c194 int, c193 int, c192 int, c191 int, c190 int, c189 int, c188 int, c187 int, c186 int, c185 int, c184 int, c183 int, c182 int, c181 int, c180 int, c179 int, c178 int, c177 int, c176 int, c175 int, c174 int, c173 int, c172 int, c171 int, c170 int, c169 int, c168 int, c167 int, c166 int, c165 int, c164 int, c163 int, c162 int, c161 int, c160 int, c159 int, c158 int, c157 int, c156 int, c155 int, c154 int, c153 int, c152 int, c151 int, c150 int, c149 int, c148 int, c147 int, c146 int, c145 int, c144 int, c143 int, c142 int, c141 int, c140 int, c139 int, c138 int, c137 int, c136 int, c135 int, c134 int, c133 int, c132 int, c131 int, c130 int, c129 int, c128 int, c127 int, c126 int, c125 int, c124 int, c123 int, c122 int, c121 int, c120 int, c119 int, c118 int, c117 int, c116 int, c115 int, c114 int, c113 int, c112 int, c111 int, c110 int, c109 int, c108 int, c107 int, c106 int, c105 int, c104 int, c103 int, c102 int, c101 int, c100 int, c99 int, c98 int, c97 int, c96 int, c95 int, c94 int, c93 int, c92 int, c91 int, c90 int, c89 int, c88 int, c87 int, c86 int, c85 int, c84 int, c83 int, c82 int, c81 int, c80 int, c79 int, c78 int, c77 int, c76 int, c75 int, c74 int, c73 int, c72 int, c71 int, c70 int, c69 int, c68 int, c67 int, c66 int, c65 int, c64 int, c63 int, c62 int, c61 int, c60 int, c59 int, c58 int, c57 int, c56 int, c55 int, c54 int, c53 int, c52 int, c51 int, c50 int, c49 int, c48 int, c47 int, c46 int, c45 int, c44 int, c43 int, c42 int, c41 int, c40 int, c39 int, c38 int, c37 int, c36 int, c35 int, c34 int, c33 int, c32 int, c31 int, c30 int, c29 int, c28 int, c27 int, c26 int, c25 int, c24 int, c23 int, c22 int, c21 int, c20 int, c19 int, c18 int, c17 int, c16 int, c15 int, c14 int, c13 int, c12 int, c11 int, c10 int, c9 int, c8 int, c7 int, c6 int, c5 int, c4 int, c3 int, c2 int, c1 int, primary key using hash(c1)) engine=ndb;
+insert into t1 (c1) values (1), (2), (3);
+drop table t1;

=== modified file 'mysql-test/suite/ndb/t/ndb_alter_table_online.test'
--- a/mysql-test/suite/ndb/t/ndb_alter_table_online.test	2009-10-09 15:48:57 +0000
+++ b/mysql-test/suite/ndb/t/ndb_alter_table_online.test	2011-01-21 10:29:46 +0000
@@ -744,11 +744,27 @@ ALTER ONLINE TABLE t1 ADD b INT;
 --sleep 10
 
 --enable_warnings
---echo ********************
---echo * Cleanup Section
---echo ********************
 
 DROP TABLE t1, ndb_show_tables_results;
-# End of 5.1 Test Case
 
+#
+# test alter of table with many attributes
+#
+let $i=499;
+let $separator=;
+let $sql=create table t1 (;
+while ($i)
+{
+  let $sql=$sql$separator c$i int;
+  let $separator=,;
+  dec $i;
+}
+let $sql=$sql, primary key using hash(c1)) engine=ndb;
+eval $sql; # eval the sql and create the table
+
+insert into t1 (c1) values (1), (2), (3);
+alter offline table t1 modify c1 int auto_increment;
+alter online table t1 add column c500 bit(1) column_format DYNAMIC;
+delete from t1;
+drop table t1;
 

=== modified file 'mysql-test/suite/ndb/t/ndb_basic.test'
--- a/mysql-test/suite/ndb/t/ndb_basic.test	2010-11-01 09:13:06 +0000
+++ b/mysql-test/suite/ndb/t/ndb_basic.test	2011-01-21 10:29:46 +0000
@@ -410,526 +410,30 @@ drop table t1;
 
 #
 # test the limit of no of attributes in one table
+#  - use while loop to build dynamic sql string
 #
-# also tests bug#17179, more than 31 attributes in
-# a partitioned table
-#
-create table t1 (
-c1 int,
-c2 int,
-c3 int,
-c4 int,
-c5 int,
-c6 int,
-c7 int,
-c8 int,
-c9 int,
-c10 int,
-c11 int,
-c12 int,
-c13 int,
-c14 int,
-c15 int,
-c16 int,
-c17 int,
-c18 int,
-c19 int,
-c20 int,
-c21 int,
-c22 int,
-c23 int,
-c24 int,
-c25 int,
-c26 int,
-c27 int,
-c28 int,
-c29 int,
-c30 int,
-c31 int,
-c32 int,
-c33 int,
-c34 int,
-c35 int,
-c36 int,
-c37 int,
-c38 int,
-c39 int,
-c40 int,
-c41 int,
-c42 int,
-c43 int,
-c44 int,
-c45 int,
-c46 int,
-c47 int,
-c48 int,
-c49 int,
-c50 int,
-c51 int,
-c52 int,
-c53 int,
-c54 int,
-c55 int,
-c56 int,
-c57 int,
-c58 int,
-c59 int,
-c60 int,
-c61 int,
-c62 int,
-c63 int,
-c64 int,
-c65 int,
-c66 int,
-c67 int,
-c68 int,
-c69 int,
-c70 int,
-c71 int,
-c72 int,
-c73 int,
-c74 int,
-c75 int,
-c76 int,
-c77 int,
-c78 int,
-c79 int,
-c80 int,
-c81 int,
-c82 int,
-c83 int,
-c84 int,
-c85 int,
-c86 int,
-c87 int,
-c88 int,
-c89 int,
-c90 int,
-c91 int,
-c92 int,
-c93 int,
-c94 int,
-c95 int,
-c96 int,
-c97 int,
-c98 int,
-c99 int,
-c100 int,
-c101 int,
-c102 int,
-c103 int,
-c104 int,
-c105 int,
-c106 int,
-c107 int,
-c108 int,
-c109 int,
-c110 int,
-c111 int,
-c112 int,
-c113 int,
-c114 int,
-c115 int,
-c116 int,
-c117 int,
-c118 int,
-c119 int,
-c120 int,
-c121 int,
-c122 int,
-c123 int,
-c124 int,
-c125 int,
-c126 int,
-c127 int,
-c128 int,
-c129 int,
-c130 int,
-c131 int,
-c132 int,
-c133 int,
-c134 int,
-c135 int,
-c136 int,
-c137 int,
-c138 int,
-c139 int,
-c140 int,
-c141 int,
-c142 int,
-c143 int,
-c144 int,
-c145 int,
-c146 int,
-c147 int,
-c148 int,
-c149 int,
-c150 int,
-c151 int,
-c152 int,
-c153 int,
-c154 int,
-c155 int,
-c156 int,
-c157 int,
-c158 int,
-c159 int,
-c160 int,
-c161 int,
-c162 int,
-c163 int,
-c164 int,
-c165 int,
-c166 int,
-c167 int,
-c168 int,
-c169 int,
-c170 int,
-c171 int,
-c172 int,
-c173 int,
-c174 int,
-c175 int,
-c176 int,
-c177 int,
-c178 int,
-c179 int,
-c180 int,
-c181 int,
-c182 int,
-c183 int,
-c184 int,
-c185 int,
-c186 int,
-c187 int,
-c188 int,
-c189 int,
-c190 int,
-c191 int,
-c192 int,
-c193 int,
-c194 int,
-c195 int,
-c196 int,
-c197 int,
-c198 int,
-c199 int,
-c200 int,
-c201 int,
-c202 int,
-c203 int,
-c204 int,
-c205 int,
-c206 int,
-c207 int,
-c208 int,
-c209 int,
-c210 int,
-c211 int,
-c212 int,
-c213 int,
-c214 int,
-c215 int,
-c216 int,
-c217 int,
-c218 int,
-c219 int,
-c220 int,
-c221 int,
-c222 int,
-c223 int,
-c224 int,
-c225 int,
-c226 int,
-c227 int,
-c228 int,
-c229 int,
-c230 int,
-c231 int,
-c232 int,
-c233 int,
-c234 int,
-c235 int,
-c236 int,
-c237 int,
-c238 int,
-c239 int,
-c240 int,
-c241 int,
-c242 int,
-c243 int,
-c244 int,
-c245 int,
-c246 int,
-c247 int,
-c248 int,
-c249 int,
-c250 int,
-c251 int,
-c252 int,
-c253 int,
-c254 int,
-c255 int,
-c256 int,
-c257 int,
-c258 int,
-c259 int,
-c260 int,
-c261 int,
-c262 int,
-c263 int,
-c264 int,
-c265 int,
-c266 int,
-c267 int,
-c268 int,
-c269 int,
-c270 int,
-c271 int,
-c272 int,
-c273 int,
-c274 int,
-c275 int,
-c276 int,
-c277 int,
-c278 int,
-c279 int,
-c280 int,
-c281 int,
-c282 int,
-c283 int,
-c284 int,
-c285 int,
-c286 int,
-c287 int,
-c288 int,
-c289 int,
-c290 int,
-c291 int,
-c292 int,
-c293 int,
-c294 int,
-c295 int,
-c296 int,
-c297 int,
-c298 int,
-c299 int,
-c300 int,
-c301 int,
-c302 int,
-c303 int,
-c304 int,
-c305 int,
-c306 int,
-c307 int,
-c308 int,
-c309 int,
-c310 int,
-c311 int,
-c312 int,
-c313 int,
-c314 int,
-c315 int,
-c316 int,
-c317 int,
-c318 int,
-c319 int,
-c320 int,
-c321 int,
-c322 int,
-c323 int,
-c324 int,
-c325 int,
-c326 int,
-c327 int,
-c328 int,
-c329 int,
-c330 int,
-c331 int,
-c332 int,
-c333 int,
-c334 int,
-c335 int,
-c336 int,
-c337 int,
-c338 int,
-c339 int,
-c340 int,
-c341 int,
-c342 int,
-c343 int,
-c344 int,
-c345 int,
-c346 int,
-c347 int,
-c348 int,
-c349 int,
-c350 int,
-c351 int,
-c352 int,
-c353 int,
-c354 int,
-c355 int,
-c356 int,
-c357 int,
-c358 int,
-c359 int,
-c360 int,
-c361 int,
-c362 int,
-c363 int,
-c364 int,
-c365 int,
-c366 int,
-c367 int,
-c368 int,
-c369 int,
-c370 int,
-c371 int,
-c372 int,
-c373 int,
-c374 int,
-c375 int,
-c376 int,
-c377 int,
-c378 int,
-c379 int,
-c380 int,
-c381 int,
-c382 int,
-c383 int,
-c384 int,
-c385 int,
-c386 int,
-c387 int,
-c388 int,
-c389 int,
-c390 int,
-c391 int,
-c392 int,
-c393 int,
-c394 int,
-c395 int,
-c396 int,
-c397 int,
-c398 int,
-c399 int,
-c400 int,
-c401 int,
-c402 int,
-c403 int,
-c404 int,
-c405 int,
-c406 int,
-c407 int,
-c408 int,
-c409 int,
-c410 int,
-c411 int,
-c412 int,
-c413 int,
-c414 int,
-c415 int,
-c416 int,
-c417 int,
-c418 int,
-c419 int,
-c420 int,
-c421 int,
-c422 int,
-c423 int,
-c424 int,
-c425 int,
-c426 int,
-c427 int,
-c428 int,
-c429 int,
-c430 int,
-c431 int,
-c432 int,
-c433 int,
-c434 int,
-c435 int,
-c436 int,
-c437 int,
-c438 int,
-c439 int,
-c440 int,
-c441 int,
-c442 int,
-c443 int,
-c444 int,
-c445 int,
-c446 int,
-c447 int,
-c448 int,
-c449 int,
-c450 int,
-c451 int,
-c452 int,
-c453 int,
-c454 int,
-c455 int,
-c456 int,
-c457 int,
-c458 int,
-c459 int,
-c460 int,
-c461 int,
-c462 int,
-c463 int,
-c464 int,
-c465 int,
-c466 int,
-c467 int,
-c468 int,
-c469 int,
-c470 int,
-c471 int,
-c472 int,
-c473 int,
-c474 int,
-c475 int,
-c476 int,
-c477 int,
-c478 int,
-c479 int,
-c480 int,
-c481 int,
-c482 int,
-c483 int,
-c484 int,
-c485 int,
-c486 int,
-c487 int,
-c488 int,
-c489 int,
-c490 int,
-c491 int,
-c492 int,
-c493 int,
-c494 int,
-c495 int,
-c496 int,
-c497 int,
-c498 int,
-c499 int,
-primary key using hash(c1)) engine=ndb partition by key(c1);
+let $i=512; # The current max number of attributes
+let $separator=;
+let $sql=create table t1 (;
+while ($i)
+{
+  let $sql=$sql$separator c$i int;
+  let $separator=,;
+  dec $i;
+}
+let $sql=$sql, primary key using hash(c1)) engine=ndb;
+let $sql=$sql partition by key(c1);
+#             ^^^^^^^^^^^^^^^^^^^^
+#             also tests bug#17179, more than 31
+#             attributes in a partitioned table
+
+eval $sql; # eval the sql and create the table
+
 insert into t1 (c1) values (1), (2), (3);
-alter offline table t1 modify c1 int auto_increment;
-alter online table t1 add column c500 bit(1) column_format DYNAMIC;
---source include/ndb_backup.inc
 delete from t1;
 drop table t1;
 
 #
-# test bug#53354 - crash when creating partitioned table with multiple columns in the partition key
-#
-
---error ER_FIELD_NOT_FOUND_PART_ERROR
-create table `t1` (`a` int, b int, primary key (a,b)) engine=ndb partition by key(`a`,`b`,`a`);
-
-#
 # test max size of attribute name and truncation
 #
 

=== modified file 'mysql-test/suite/ndb/t/ndb_index_unique.test'
--- a/mysql-test/suite/ndb/t/ndb_index_unique.test	2010-11-15 10:52:52 +0000
+++ b/mysql-test/suite/ndb/t/ndb_index_unique.test	2011-01-21 12:43:19 +0000
@@ -514,4 +514,42 @@ set engine_condition_pushdown = @old_ecp
 
 drop table t1;
 
+#
+# Bug#58750: 'out of connection objects' due to missing close()
+# of prev. full_table_scan()
+#
+create table t1 (pk int primary key, a int) engine=ndb;
+create table t2 (pk int primary key, uq int, a int, 
+   unique key ix(uq,a) USING HASH) engine=ndb;
+
+insert into t2 values
+   (0,0,0), (1,1,0), (2,2,0), (3,3,0), (4,4,0),
+   (5,5,1), (6,6,1), (7,7,1), (8,8,1), (9,9,1);
+
+##
+# 10^4 cross product on t2 creates 10.000 rows:
+##
+insert into t1
+ select
+   t1.pk + t2.pk*10 + t3.pk*100 + t4.pk*1000, t1.a
+from
+  t2 as t1, t2 as t2, t2 as t3, t2 as t4;
+
+# Execute a 'scan(t1) join REF(t2) using ix'
+#  - Where condition 't2.uq IS NULL' in combination with 
+#    join cond. 't2.a=t1.a' will create the REF keys (NULL,t1.a).
+#    This will initiate a ::full_table_scan() which fails to
+#    close any open table scans.
+#  - Table scan(t1) will 'drive' the case above and eventually
+#    cause all ScanOperations / hupp'ed transactions to have been 
+#    consumed
+
+explain
+SELECT STRAIGHT_JOIN count(*) FROM 
+   t1 JOIN t2 ON t2.a=t1.a where t2.uq IS NULL;
+SELECT STRAIGHT_JOIN count(*) FROM 
+   t1 JOIN t2 ON t2.a=t1.a where t2.uq IS NULL;
+
+drop table t1,t2;
+
 # end of tests

=== modified file 'mysql-test/suite/ndb/t/ndb_load.test'
--- a/mysql-test/suite/ndb/t/ndb_load.test	2009-04-06 10:37:55 +0000
+++ b/mysql-test/suite/ndb/t/ndb_load.test	2011-01-21 12:21:05 +0000
@@ -78,7 +78,7 @@ DROP PROCEDURE bulkinsert;
 DROP TABLE t2;
 
 --echo Now check bulk insert using create .. as select.
-SHOW VARIABLES LIKE '%storage_engine%';
+SHOW VARIABLES LIKE 'storage_engine';
 SET storage_engine="ndb";
 
 CREATE TABLE t2 AS SELECT * FROM t1;

=== modified file 'mysql-test/suite/ndb/t/ndb_partition_error.test'
--- a/mysql-test/suite/ndb/t/ndb_partition_error.test	2009-05-15 14:00:51 +0000
+++ b/mysql-test/suite/ndb/t/ndb_partition_error.test	2011-01-21 09:14:41 +0000
@@ -72,3 +72,11 @@ partitions 2
 --error ER_BAD_NULL_ERROR,ER_NO_PARTITION_FOR_GIVEN_VALUE
 insert into t1 values (NULL,1,1);
 drop table t1;
+
+#
+# test bug#53354 - crash when creating partitioned table with multiple columns in the partition key
+#
+
+--error ER_FIELD_NOT_FOUND_PART_ERROR
+create table `t1` (`a` int, b int, primary key (a,b)) engine=ndb partition by key(`a`,`b`,`a`);
+

=== modified file 'mysql-test/suite/ndb/t/ndb_restore.test'
--- a/mysql-test/suite/ndb/t/ndb_restore.test	2010-10-25 09:15:03 +0000
+++ b/mysql-test/suite/ndb/t/ndb_restore.test	2011-01-21 10:29:46 +0000
@@ -560,3 +560,21 @@ create table t1 (a int primary key) engi
 --exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "abort backup 33" >> $NDB_TOOLS_OUTPUT
 drop table t1;
 
+#
+# test backup of table with many attributes
+#
+let $i=499;
+let $separator=;
+let $sql=create table t1 (;
+while ($i)
+{
+  let $sql=$sql$separator c$i int;
+  let $separator=,;
+  dec $i;
+}
+let $sql=$sql, primary key using hash(c1)) engine=ndb;
+eval $sql; # eval the sql and create the table
+
+insert into t1 (c1) values (1), (2), (3);
+--source include/ndb_backup.inc
+drop table t1;

=== modified file 'mysql-test/t/join_outer.test'
--- a/mysql-test/t/join_outer.test	2011-01-14 08:54:47 +0000
+++ b/mysql-test/t/join_outer.test	2011-01-14 14:26:14 +0000
@@ -1063,4 +1063,48 @@ FROM BB table1 RIGHT JOIN BB table2
 
 DROP TABLE BB;
 
+--echo #
+--echo # Bug#58626 Incorrect result for WHERE <column> IN (<subquery>) IS UNKNOWN 
+--echo #
+
+CREATE TABLE t1 (I INT NOT NULL);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (I INT NOT NULL);
+INSERT INTO t2 VALUES (3);
+CREATE TABLE t3 (PK1 INT, PK2 INT, PRIMARY KEY(PK1,PK2));
+INSERT INTO t3 VALUES (1,1),(2,2),(3,3);
+
+##'IS UNKNOWN' should not return any rows as subquery returns an empty set
+SELECT * FROM
+ t1 LEFT JOIN t2 ON t2.i = t1.i
+ WHERE t2.i IN 
+ (
+   SELECT STRAIGHT_JOIN t3.pk1 FROM t3 JOIN t3 as t4
+    ON t4.pk1=t3.pk1
+    WHERE t3.pk2 = t2.i
+ )
+ IS UNKNOWN; 
+
+SELECT * FROM
+ t1 LEFT JOIN t2 ON t2.i = t1.i
+ WHERE t2.i IN 
+ (
+   SELECT t3.pk1 FROM t3 LEFT JOIN t3 as t4
+    ON t4.pk1=t3.pk1
+    WHERE t3.pk2 = t2.i
+ )
+ IS UNKNOWN; 
+
+SELECT * FROM
+ t1 LEFT JOIN t2 ON t2.i = t1.i
+ WHERE t2.i IN 
+ (
+   SELECT t3.pk1 FROM t3 JOIN t3 as t4
+    ON t4.pk1=t3.pk1
+    WHERE t3.pk2 = t2.i
+ )
+ IS UNKNOWN; 
+
+DROP TABLE t1,t2,t3;
+
 --echo End of 5.1 tests

=== modified file 'mysql-test/t/range.test'
--- a/mysql-test/t/range.test	2010-08-24 15:51:32 +0000
+++ b/mysql-test/t/range.test	2011-01-14 15:08:09 +0000
@@ -1325,4 +1325,71 @@ SELECT * FROM t1 WHERE 2 NOT BETWEEN c_n
 
 DROP TABLE t1;
 
+--echo #
+--echo # Bug #57030: 'BETWEEN' evaluation is incorrect
+--echo #
+
+# Test some BETWEEN predicates which does *not* follow the
+# 'normal' pattern of <field> BETWEEN <low const> AND <high const>
+
+CREATE TABLE t1(pk INT PRIMARY KEY, i4 INT);
+CREATE UNIQUE INDEX i4_uq ON t1(i4);
+
+INSERT INTO t1 VALUES (1,10), (2,20), (3,30);
+
+EXPLAIN
+SELECT * FROM t1 WHERE i4 BETWEEN 10 AND 10;
+SELECT * FROM t1 WHERE i4 BETWEEN 10 AND 10;
+
+EXPLAIN
+SELECT * FROM t1 WHERE 10 BETWEEN i4 AND i4;
+SELECT * FROM t1 WHERE 10 BETWEEN i4 AND i4;
+
+EXPLAIN
+SELECT * FROM t1 WHERE 10 BETWEEN 10 AND i4;
+SELECT * FROM t1 WHERE 10 BETWEEN 10 AND i4;
+
+EXPLAIN
+SELECT * FROM t1 WHERE 10 BETWEEN i4 AND 10;
+SELECT * FROM t1 WHERE 10 BETWEEN i4 AND 10;
+
+EXPLAIN
+SELECT * FROM t1 WHERE 10 BETWEEN 10 AND 10;
+SELECT * FROM t1 WHERE 10 BETWEEN 10 AND 10;
+
+EXPLAIN
+SELECT * FROM t1 WHERE 10 BETWEEN 11 AND 11;
+SELECT * FROM t1 WHERE 10 BETWEEN 11 AND 11;
+
+EXPLAIN
+SELECT * FROM t1 WHERE 10 BETWEEN 100 AND 0;
+SELECT * FROM t1 WHERE 10 BETWEEN 100 AND 0;
+
+EXPLAIN
+SELECT * FROM t1 WHERE i4 BETWEEN 100 AND 0;
+SELECT * FROM t1 WHERE i4 BETWEEN 100 AND 0;
+
+EXPLAIN
+SELECT * FROM t1 WHERE i4 BETWEEN 10 AND 99999999999999999;
+SELECT * FROM t1 WHERE i4 BETWEEN 10 AND 99999999999999999;
+
+EXPLAIN
+SELECT * FROM t1 WHERE i4 BETWEEN 999999999999999 AND 30;
+SELECT * FROM t1 WHERE i4 BETWEEN 999999999999999 AND 30;
+
+EXPLAIN
+SELECT * FROM t1 WHERE i4 BETWEEN 10 AND '20';
+SELECT * FROM t1 WHERE i4 BETWEEN 10 AND '20';
+
+#Should detect the EQ_REF 't2.pk=t1.i4'
+EXPLAIN
+SELECT * FROM t1, t1 as t2 WHERE t2.pk BETWEEN t1.i4 AND t1.i4;
+SELECT * FROM t1, t1 as t2 WHERE t2.pk BETWEEN t1.i4 AND t1.i4;
+
+EXPLAIN
+SELECT * FROM t1, t1 as t2 WHERE t1.i4 BETWEEN t2.pk AND t2.pk;
+SELECT * FROM t1, t1 as t2 WHERE t1.i4 BETWEEN t2.pk AND t2.pk;
+
+DROP TABLE t1;
+
 --echo End of 5.1 tests

=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	2011-01-19 15:17:11 +0000
+++ b/sql/ha_ndbcluster.cc	2011-01-21 12:43:19 +0000
@@ -3598,6 +3598,7 @@ int ha_ndbcluster::full_table_scan(const
     m_thd_ndb->m_pruned_scan_count += (op->getPruned()? 1 : 0);
   }
   
+  DBUG_ASSERT(m_active_cursor==NULL);
   m_active_cursor= op;
 
   if (uses_blob_value(table->read_set) &&
@@ -5448,6 +5449,9 @@ int ha_ndbcluster::read_range_first_to_b
   DBUG_ENTER("ha_ndbcluster::read_range_first_to_buf");
   DBUG_PRINT("info", ("desc: %d, sorted: %d", desc, sorted));
 
+  if (m_active_cursor && (error= close_scan()))
+    DBUG_RETURN(error);
+
   if (m_use_partition_pruning)
   {
     get_partition_set(table, buf, active_index, start_key, &part_spec);
@@ -5486,8 +5490,6 @@ int ha_ndbcluster::read_range_first_to_b
         start_key->length == key_info->key_length &&
         start_key->flag == HA_READ_KEY_EXACT)
     {
-      if (m_active_cursor && (error= close_scan()))
-        DBUG_RETURN(error);
       if (!m_thd_ndb->trans)
         if (unlikely(!start_transaction_key(active_index,
                                             start_key->key, error)))
@@ -5503,9 +5505,6 @@ int ha_ndbcluster::read_range_first_to_b
         start_key->flag == HA_READ_KEY_EXACT && 
         !check_null_in_key(key_info, start_key->key, start_key->length))
     {
-      if (m_active_cursor && (error= close_scan()))
-        DBUG_RETURN(error);
-
       if (!m_thd_ndb->trans)
         if (unlikely(!start_transaction_key(active_index,
                                             start_key->key, error)))
@@ -9823,11 +9822,18 @@ static void ndbcluster_drop_database(han
 int ndb_create_table_from_engine(THD *thd, const char *db,
                                  const char *table_name)
 {
+  // Copy db and table_name to stack buffers since functions used by
+  // ha_create_table_from_engine may convert to lowercase on some platforms
+  char db_buf[FN_REFLEN + 1];
+  char table_name_buf[FN_REFLEN + 1];
+  strnmov(db_buf, db, sizeof(db_buf));
+  strnmov(table_name_buf, table_name, sizeof(table_name_buf));
+
   LEX *old_lex= thd->lex, newlex;
   thd->lex= &newlex;
   newlex.current_select= NULL;
   lex_start(thd);
-  int res= ha_create_table_from_engine(thd, db, table_name);
+  int res= ha_create_table_from_engine(thd, db_buf, table_name_buf);
   thd->lex= old_lex;
   return res;
 }
@@ -10679,7 +10685,9 @@ ulonglong ha_ndbcluster::table_flags(voi
     HA_NULL_IN_KEY |
     HA_AUTO_PART_KEY |
     HA_NO_PREFIX_CHAR_KEYS |
+#ifndef NDB_WITH_NEW_MRR_INTERFACE
     HA_NEED_READ_RANGE_BUFFER |
+#endif
     HA_CAN_GEOMETRY |
     HA_CAN_BIT_FIELD |
     HA_PRIMARY_KEY_REQUIRED_FOR_POSITION |
@@ -11755,7 +11763,7 @@ int ha_ndbcluster::write_ndb_file(const
   DBUG_RETURN(error);
 }
 
-
+#ifndef NDB_WITH_NEW_MRR_INTERFACE
 bool 
 ha_ndbcluster::null_value_index_search(KEY_MULTI_RANGE *ranges,
 				       KEY_MULTI_RANGE *end_range,
@@ -11785,6 +11793,7 @@ ha_ndbcluster::null_value_index_search(K
   }
   DBUG_RETURN(FALSE);
 }
+#endif
 
 void ha_ndbcluster::check_read_before_write_removal()
 {
@@ -11825,7 +11834,7 @@ void ha_ndbcluster::check_read_before_wr
   DBUG_VOID_RETURN;
 }
 
-
+#ifndef NDB_WITH_NEW_MRR_INTERFACE
 /*
   This is used to check if an ordered index scan is needed for a range in
   a multi range read.
@@ -12415,6 +12424,7 @@ ha_ndbcluster::read_multi_range_fetch_ne
   }
   return 0;
 }
+#endif
 
 /**
   @param[in] comment  table comment defined by user

=== modified file 'sql/ha_ndbcluster.h'
--- a/sql/ha_ndbcluster.h	2011-01-14 15:25:27 +0000
+++ b/sql/ha_ndbcluster.h	2011-01-21 12:43:19 +0000
@@ -416,6 +416,7 @@ class ha_ndbcluster: public handler
   int read_range_next();
   int alter_tablespace(st_alter_tablespace *info);
 
+#ifndef NDB_WITH_NEW_MRR_INTERFACE
   /**
    * Multi range stuff
    */
@@ -426,6 +427,7 @@ class ha_ndbcluster: public handler
   bool null_value_index_search(KEY_MULTI_RANGE *ranges,
 			       KEY_MULTI_RANGE *end_range,
 			       HANDLER_BUFFER *buffer);
+#endif
 
   bool get_error_message(int error, String *buf);
   ha_rows records();

=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc	2011-01-19 15:05:02 +0000
+++ b/sql/ha_ndbcluster_binlog.cc	2011-01-21 12:43:19 +0000
@@ -1645,6 +1645,19 @@ struct Cluster_schema
   uint32 any_value;
 };
 
+static void
+print_could_not_discover_error(THD *thd,
+                               const Cluster_schema *schema)
+{
+  sql_print_error("NDB Binlog: Could not discover table '%s.%s' from "
+                  "binlog schema event '%s' from node %d. "
+                  "my_errno: %d",
+                   schema->db, schema->name, schema->query,
+                   schema->node_id, my_errno);
+  print_warning_list("NDB Binlog", thd_warn_list(thd));
+}
+
+
 /*
   Transfer schema table data into corresponding struct
 */
@@ -2787,12 +2800,7 @@ ndb_binlog_thread_handle_schema_event(TH
           }
           else if (ndb_create_table_from_engine(thd, schema->db, schema->name))
           {
-            sql_print_error("NDB Binlog: Could not discover table '%s.%s' from "
-                            "binlog schema event '%s' from node %d. "
-                            "my_errno: %d",
-                            schema->db, schema->name, schema->query,
-                            schema->node_id, my_errno);
-            print_warning_list("NDB Binlog", thd_warn_list(thd));
+            print_could_not_discover_error(thd, schema);
           }
           log_query= 1;
           break;
@@ -3161,11 +3169,7 @@ ndb_binlog_thread_handle_schema_event_po
           }
           else if (ndb_create_table_from_engine(thd, schema->db, schema->name))
           {
-            sql_print_error("NDB Binlog: Could not discover table '%s.%s' from "
-                            "binlog schema event '%s' from node %d. my_errno: %d",
-                            schema->db, schema->name, schema->query,
-                            schema->node_id, my_errno);
-            print_warning_list("NDB Binlog", thd_warn_list(thd));
+            print_could_not_discover_error(thd, schema);
           }
         }
         break;
@@ -3334,11 +3338,7 @@ ndb_binlog_thread_handle_schema_event_po
           }
           else if (ndb_create_table_from_engine(thd, schema->db, schema->name))
           {
-            sql_print_error("NDB Binlog: Could not discover table '%s.%s' from "
-                            "binlog schema event '%s' from node %d. my_errno: %d",
-                            schema->db, schema->name, schema->query,
-                            schema->node_id, my_errno);
-            print_warning_list("NDB Binlog", thd_warn_list(thd));
+            print_could_not_discover_error(thd, schema);
           }
         }
         break;

=== modified file 'sql/ha_ndbcluster_glue.h'
--- a/sql/ha_ndbcluster_glue.h	2011-01-19 14:53:52 +0000
+++ b/sql/ha_ndbcluster_glue.h	2011-01-21 12:43:19 +0000
@@ -317,4 +317,11 @@ bool mysql_truncate_table(THD *thd, TABL
 #endif
 }
 
+#if MYSQL_VERSION_ID >= 50600
+
+/* New multi range read interface replaced original mrr */
+#define NDB_WITH_NEW_MRR_INTERFACE
+
+#endif
+
 #endif

=== modified file 'sql/ha_ndbcluster_tables.h'
--- a/sql/ha_ndbcluster_tables.h	2010-10-27 11:32:32 +0000
+++ b/sql/ha_ndbcluster_tables.h	2011-01-21 12:43:19 +0000
@@ -17,12 +17,9 @@
 */
 
 #define NDB_REP_DB      "mysql"
-#define OLD_NDB_REP_DB  "cluster"
 #define NDB_REP_TABLE   "ndb_binlog_index"
 #define NDB_APPLY_TABLE "ndb_apply_status"
-#define OLD_NDB_APPLY_TABLE "apply_status"
 #define NDB_SCHEMA_TABLE "ndb_schema"
-#define OLD_NDB_SCHEMA_TABLE "schema"
 #define NDB_REPLICATION_TABLE "ndb_replication"
 
 enum Ndb_binlog_type

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2011-01-14 15:25:27 +0000
+++ b/sql/sql_select.cc	2011-01-21 12:43:19 +0000
@@ -3352,6 +3352,9 @@ add_key_field(KEY_FIELD **key_fields,uin
         eq_func is NEVER true when num_values > 1
        */
       if (!eq_func)
+#ifndef MCP_BUG57030
+        return;
+#else
       {
         /* 
           Additional optimization: if we're processing
@@ -3372,6 +3375,7 @@ add_key_field(KEY_FIELD **key_fields,uin
         eq_func= TRUE;
       }
 
+#endif
       if (field->result_type() == STRING_RESULT)
       {
         if ((*value)->result_type() != STRING_RESULT)
@@ -3567,9 +3571,71 @@ add_key_fields(JOIN *join, KEY_FIELD **k
   case Item_func::OPTIMIZE_KEY:
   {
     Item **values;
+#ifndef MCP_BUG57030
+    /*
+      Build list of possible keys for 'a BETWEEN low AND high'.
+      It is handled similar to the equivalent condition 
+      'a >= low AND a <= high':
+    */
+    if (cond_func->functype() == Item_func::BETWEEN)
+    {
+      Item_field *field_item;
+      bool equal_func= FALSE;
+      uint num_values= 2;
+      values= cond_func->arguments();
+
+      bool binary_cmp= (values[0]->real_item()->type() == Item::FIELD_ITEM)
+            ? ((Item_field*)values[0]->real_item())->field->binary()
+            : TRUE;
+
+      /*
+        Additional optimization: If 'low = high':
+        Handle as if the condition was "t.key = low".
+      */
+      if (!((Item_func_between*)cond_func)->negated &&
+          values[1]->eq(values[2], binary_cmp))
+      {
+        equal_func= TRUE;
+        num_values= 1;
+      }
+
+      /*
+        Append keys for 'field <cmp> value[]' if the
+        condition is of the form::
+        '<field> BETWEEN value[1] AND value[2]'
+      */
+      if (is_local_field (values[0]))
+      {
+        field_item= (Item_field *) (values[0]->real_item());
+        add_key_equal_fields(key_fields, *and_level, cond_func,
+                             field_item, equal_func, &values[1],
+                             num_values, usable_tables, sargables);
+      }
+      /*
+        Append keys for 'value[0] <cmp> field' if the
+        condition is of the form:
+        'value[0] BETWEEN field1 AND field2'
+      */
+      for (uint i= 1; i <= num_values; i++)
+      {
+        if (is_local_field (values[i]))
+        {
+          field_item= (Item_field *) (values[i]->real_item());
+          add_key_equal_fields(key_fields, *and_level, cond_func,
+                               field_item, equal_func, values,
+                               1, usable_tables, sargables);
+        }
+      }
+    } // if ( ... Item_func::BETWEEN)
+
+    // IN, NE
+    else if (is_local_field (cond_func->key_item()) &&
+            !(cond_func->used_tables() & OUTER_REF_TABLE_BIT))
+#else
     // BETWEEN, IN, NE
     if (is_local_field (cond_func->key_item()) &&
 	!(cond_func->used_tables() & OUTER_REF_TABLE_BIT))
+#endif /* MCP_BUG57030 */
     {
       values= cond_func->arguments()+1;
       if (cond_func->functype() == Item_func::NE_FUNC &&
@@ -3583,6 +3649,7 @@ add_key_fields(JOIN *join, KEY_FIELD **k
                            cond_func->argument_count()-1,
                            usable_tables, sargables);
     }
+#ifdef MCP_BUG57030
     if (cond_func->functype() == Item_func::BETWEEN)
     {
       values= cond_func->arguments();
@@ -3598,6 +3665,7 @@ add_key_fields(JOIN *join, KEY_FIELD **k
         }
       }  
     }
+#endif
     break;
   }
   case Item_func::OPTIMIZE_OP:
@@ -13175,10 +13243,27 @@ part_of_refkey(TABLE *table,Field *field
     KEY_PART_INFO *key_part=
       table->key_info[table->reginfo.join_tab->ref.key].key_part;
 
+#ifndef MCP_BUG58626
+    uint part;
+
+    /* If execution plan may use 'Full scan on NULL key', There might
+     * not by any 'REF' access and entire predicate should be preserved.
+     */
+    for (part=0 ; part < ref_parts ; part++)
+    {
+      if (table->reginfo.join_tab->ref.cond_guards[part])
+        return (Item*) 0;
+    }
+
+    for (part=0 ; part < ref_parts ; part++,key_part++)
+#else
     for (uint part=0 ; part < ref_parts ; part++,key_part++)
+#endif
+    {
       if (field->eq(key_part->field) &&
 	  !(key_part->key_part_flag & (HA_PART_KEY_SEG | HA_NULL_PART)))
 	return table->reginfo.join_tab->ref.items[part];
+    }
   }
   return (Item*) 0;
 }

=== modified file 'storage/ndb/src/kernel/blocks/lgman.cpp'
--- a/storage/ndb/src/kernel/blocks/lgman.cpp	2010-08-17 11:47:55 +0000
+++ b/storage/ndb/src/kernel/blocks/lgman.cpp	2011-01-15 06:29:18 +0000
@@ -312,7 +312,8 @@ Lgman::execCONTINUEB(Signal* signal){
     jam();
     Ptr<Logfile_group> ptr;
     m_logfile_group_pool.getPtr(ptr, ptrI);
-    if (ptr.p->m_state & Logfile_group::LG_THREAD_MASK)
+    if ((ptr.p->m_state & Logfile_group::LG_THREAD_MASK) ||
+        ptr.p->m_outstanding_fs > 0)
     {
       jam();
       sendSignalWithDelay(reference(), GSN_CONTINUEB, signal, 100, 

=== modified file 'storage/ndb/src/kernel/blocks/tsman.cpp'
--- a/storage/ndb/src/kernel/blocks/tsman.cpp	2010-02-09 05:24:15 +0000
+++ b/storage/ndb/src/kernel/blocks/tsman.cpp	2011-01-15 06:29:18 +0000
@@ -486,6 +486,13 @@ Tsman::execDROP_FILEGROUP_IMPL_REQ(Signa
       ptr.p->m_state = Tablespace::TS_DROPPING;
       break;
     case DropFilegroupImplReq::Commit:
+      if (ptr.p->m_ref_count)
+      {
+        jam();
+        sendSignalWithDelay(reference(), GSN_DROP_FILEGROUP_REQ, signal,
+                            100, signal->getLength());
+        return;
+      }
       m_tablespace_list.remove(ptr);
       m_tablespace_hash.release(ptr);
       break;
@@ -1482,6 +1489,14 @@ Tsman::execDROP_FILE_IMPL_REQ(Signal* si
     }
     case DropFileImplReq::Commit:
       ndbrequire(find_file_by_id(file_ptr, fg_ptr.p->m_meta_files, req.file_id));
+      if (file_ptr.p->m_ref_count)
+      {
+        jam();
+        sendSignalWithDelay(reference(), GSN_DROP_FILE_REQ, signal,
+                            100, signal->getLength());
+        return;
+      }
+      
       file_ptr.p->m_create.m_extent_pages = 
 	file_ptr.p->m_online.m_offset_data_pages - 1;
       file_ptr.p->m_create.m_senderRef = req.senderRef;
@@ -1535,6 +1550,7 @@ Tsman::Tablespace::Tablespace(Tsman* ts,
   m_logfile_group_id = req->tablespace.logfile_group_id;
   m_tablespace_id = req->filegroup_id;
   m_version = req->filegroup_version;
+  m_ref_count = 0;
   
   m_extent_size = (Uint32)DIV(req->tablespace.extent_size, File_formats::NDB_PAGE_SIZE);
 #if defined VM_TRACE || defined ERROR_INSERT
@@ -1549,6 +1565,7 @@ Tsman::Datafile::Datafile(const struct C
   m_file_no = RNIL;
   m_fd = RNIL;
   m_online.m_first_free_extent = RNIL;
+  m_ref_count = 0;
     
   m_create.m_senderRef = req->senderRef; // During META
   m_create.m_senderData = req->senderData; // During META
@@ -2127,8 +2144,10 @@ Tsman::execEND_LCP_REQ(Signal* signal)
    * Move extents from "lcp" free list to real free list
    */
   Ptr<Tablespace> ptr;
-  if(m_tablespace_list.first(ptr))
+  if (m_tablespace_list.first(ptr))
   {
+    jam();
+    ptr.p->m_ref_count ++;
     signal->theData[0] = TsmanContinueB::END_LCP;
     signal->theData[1] = ptr.i;
     signal->theData[2] = 0;    // free
@@ -2142,6 +2161,8 @@ Tsman::end_lcp(Signal* signal, Uint32 pt
 {
   Ptr<Tablespace> ptr;
   m_tablespace_list.getPtr(ptr, ptrI);
+  ndbrequire(ptr.p->m_ref_count);
+  ptr.p->m_ref_count--;
   
   Ptr<Datafile> file;
   file.i = filePtrI;
@@ -2162,6 +2183,8 @@ Tsman::end_lcp(Signal* signal, Uint32 pt
     else
     {
       tmp.getPtr(file);
+      ndbrequire(file.p->m_ref_count);
+      file.p->m_ref_count--;
     }
     break;
   }
@@ -2181,6 +2204,8 @@ Tsman::end_lcp(Signal* signal, Uint32 pt
     else
     {
       tmp.getPtr(file);
+      ndbrequire(file.p->m_ref_count);
+      file.p->m_ref_count--;
     }
     break;
   }
@@ -2263,10 +2288,19 @@ Tsman::end_lcp(Signal* signal, Uint32 pt
       m_tablespace_list.next(ptr);
     }
   }
+  else
+  {
+    jam();
+    ndbrequire(ptr.i != RNIL);
+    m_file_pool.getPtr(file);
+    file.p->m_ref_count++;
+  }
   
 next:
   if(ptr.i != RNIL)
   {
+    ptr.p->m_ref_count++;
+    
     signal->theData[0] = TsmanContinueB::END_LCP;
     signal->theData[1] = ptr.i;
     signal->theData[2] = list;    

=== modified file 'storage/ndb/src/kernel/blocks/tsman.hpp'
--- a/storage/ndb/src/kernel/blocks/tsman.hpp	2009-10-08 11:15:24 +0000
+++ b/storage/ndb/src/kernel/blocks/tsman.hpp	2011-01-15 06:29:18 +0000
@@ -96,7 +96,8 @@ public:
     
     Uint32 m_tablespace_ptr_i;
     Uint32 m_extent_size;   
-    Uint32 m_state;
+    Uint16 m_state;
+    Uint16 m_ref_count;
 
     enum FileState 
     {
@@ -160,7 +161,8 @@ public:
       Uint32 m_tablespace_id;
     };
     Uint32 m_version;
-    Uint32 m_state;
+    Uint16 m_state;
+    Uint16 m_ref_count; // Can't release when m_ref_count > 0
 
     enum TablespaceState 
     {

=== modified file 'storage/ndb/src/mgmsrv/InitConfigFileParser.cpp'
--- a/storage/ndb/src/mgmsrv/InitConfigFileParser.cpp	2011-01-14 14:13:31 +0000
+++ b/storage/ndb/src/mgmsrv/InitConfigFileParser.cpp	2011-01-14 16:13:34 +0000
@@ -738,7 +738,7 @@ load_defaults(Vector<struct my_option>&
   BaseString group_suffix;
 
   const char *save_file = my_defaults_file;
-#if MYSQL_VERSION_ID >= 50600
+#if MYSQL_VERSION_ID >= 50508
   const
 #endif
   char *save_extra_file = my_defaults_extra_file;

=== modified file 'storage/ndb/test/ndbapi/bench/mainAsyncGenerator.cpp'
--- a/storage/ndb/test/ndbapi/bench/mainAsyncGenerator.cpp	2009-09-25 21:26:33 +0000
+++ b/storage/ndb/test/ndbapi/bench/mainAsyncGenerator.cpp	2011-01-16 06:24:02 +0000
@@ -278,6 +278,7 @@ print_stats(const char       *title,
     ndbout_c("     Transactions: %d", gen->totalTransactions);
     ndbout_c("     Outer       : %.0f TPS",gen->outerTps);
     ndbout_c("\n");
+    ndbout_c("NDBT_Observation;tps;%.0f", gen->outerTps);
   }
 }
 

=== modified file 'storage/ndb/tools/restore/Restore.cpp'
--- a/storage/ndb/tools/restore/Restore.cpp	2010-12-03 09:36:45 +0000
+++ b/storage/ndb/tools/restore/Restore.cpp	2011-01-21 08:38:59 +0000
@@ -507,6 +507,10 @@ end:
   return true;
 }
 
+#define OLD_NDB_REP_DB  "cluster"
+#define OLD_NDB_APPLY_TABLE "apply_status"
+#define OLD_NDB_SCHEMA_TABLE "schema"
+
 bool
 RestoreMetaData::markSysTables()
 {

No bundle (reason: revision is a merge).
Thread
bzr commit into mysql-5.5-telco-7.0 branch (magnus.blaudd:3144) Magnus Blåudd21 Jan