From: Pekka Nousiainen Date: July 19 2011 4:08pm Subject: bzr push into mysql-5.1-telco-7.0-wl4124-new1 branch (pekka.nousiainen:4411 to 4412) WL#4124 List-Archive: http://lists.mysql.com/commits/140370 Message-Id: <20110719160816.2593B55875@sama.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 4412 Pekka Nousiainen 2011-07-19 wl#4124 x13_fix.diff bugfix: wrong byte size from date etc modified: mysql-test/suite/ndb/r/ndb_index_stat.result mysql-test/suite/ndb/t/ndb_index_stat.test storage/ndb/src/ndbapi/NdbIndexStatImpl.cpp 4411 Pekka Nousiainen 2011-07-19 wl#4124 x12_fix.diff ndb_restore_misc filter out sample_x1 modified: mysql-test/suite/ndb/r/ndb_restore_misc.result mysql-test/suite/ndb/t/ndb_restore_misc.test === modified file 'mysql-test/suite/ndb/r/ndb_index_stat.result' --- a/mysql-test/suite/ndb/r/ndb_index_stat.result 2011-07-02 07:05:32 +0000 +++ b/mysql-test/suite/ndb/r/ndb_index_stat.result 2011-07-19 16:04:38 +0000 @@ -234,6 +234,242 @@ analyze table t1; Table Op Msg_type Msg_text test.t1 analyze status OK drop table t1; +create table t1 ( +pk int not null, +a tinyint not null, +b tinyint unsigned not null, +c smallint not null, +d smallint unsigned not null, +e mediumint not null, +f mediumint unsigned not null, +g int not null, +h int unsigned not null, +i bigint not null, +j bigint unsigned not null, +k float not null, +l double not null, +m decimal not null, +n decimal unsigned not null, +primary key using hash (pk), +index (a), +index (b), +index (c), +index (d), +index (e), +index (f), +index (g), +index (h), +index (i), +index (j), +index (k), +index (l), +index (m), +index (n) +) engine=ndb; +insert into t1 values +(1,11,11,11,11,11,11,11,11,11,11,11,11,11,11), +(2,22,22,22,22,22,22,22,22,22,22,22,22,22,22), +(3,33,33,33,33,33,33,33,33,33,33,33,33,33,33); +select count(*) from t1 where a > 22; +count(*) +1 +select count(*) from t1 where b > 22; +count(*) +1 +select count(*) from t1 where c > 22; +count(*) +1 +select count(*) from t1 where d > 22; +count(*) +1 +select count(*) from t1 where e > 22; +count(*) +1 +select count(*) from t1 where f > 22; +count(*) +1 +select count(*) from t1 where g > 22; +count(*) +1 +select count(*) from t1 where h > 22; +count(*) +1 +select count(*) from t1 where i > 22; +count(*) +1 +select count(*) from t1 where j > 22; +count(*) +1 +select count(*) from t1 where k > 22; +count(*) +1 +select count(*) from t1 where l > 22; +count(*) +1 +select count(*) from t1 where m > 22; +count(*) +1 +select count(*) from t1 where n > 22; +count(*) +1 +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +select count(*) from t1 where a > 22; +count(*) +1 +select count(*) from t1 where b > 22; +count(*) +1 +select count(*) from t1 where c > 22; +count(*) +1 +select count(*) from t1 where d > 22; +count(*) +1 +select count(*) from t1 where e > 22; +count(*) +1 +select count(*) from t1 where f > 22; +count(*) +1 +select count(*) from t1 where g > 22; +count(*) +1 +select count(*) from t1 where h > 22; +count(*) +1 +select count(*) from t1 where i > 22; +count(*) +1 +select count(*) from t1 where j > 22; +count(*) +1 +select count(*) from t1 where k > 22; +count(*) +1 +select count(*) from t1 where l > 22; +count(*) +1 +select count(*) from t1 where m > 22; +count(*) +1 +select count(*) from t1 where n > 22; +count(*) +1 +drop table t1; +create table t1 ( +pk int not null, +a datetime not null, +b date not null, +c year not null, +d time not null, +e timestamp not null, +primary key using hash (pk), +index (a), +index (b), +index (c), +index (d), +index (e) +) engine=ndb; +insert into t1 values +(1,'1971-01-01 01:01:01','1971-01-01','1971','01:01:01','1971-01-01 01:01:01'), +(2,'1972-02-02 02:02:02','1972-02-02','1972','02:02:02','1972-02-02 02:02:02'), +(3,'1973-03-03 03:03:03','1973-03-03','1973','03:03:03','1973-03-03 03:03:03'); +select count(*) from t1 where a > '1972-02-02 02:02:02'; +count(*) +1 +select count(*) from t1 where b > '1972-02-02'; +count(*) +1 +select count(*) from t1 where c > '1972'; +count(*) +1 +select count(*) from t1 where d > '02:02:02'; +count(*) +1 +select count(*) from t1 where e > '1972-02-02 02:02:02'; +count(*) +1 +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +select count(*) from t1 where a > '1972-02-02 02:02:02'; +count(*) +1 +select count(*) from t1 where b > '1972-02-02'; +count(*) +1 +select count(*) from t1 where c > '1972'; +count(*) +1 +select count(*) from t1 where d > '02:02:02'; +count(*) +1 +select count(*) from t1 where e > '1972-02-02 02:02:02'; +count(*) +1 +drop table t1; +create table t1 ( +pk int not null, +a char(10) not null, +b varchar(10) not null, +c varchar(1000) not null, +d binary(10) not null, +e varbinary(10) not null, +f varbinary(1000) not null, +primary key using hash (pk), +index (a), +index (b), +index (c), +index (d), +index (e), +index (f) +) engine=ndb; +insert into t1 values +('1','111','111','111','111','111','111'), +('2','222','222','222','222','222','222'), +('3','333','333','333','333','333','333'); +select count(*) from t1 where a > '222'; +count(*) +1 +select count(*) from t1 where b > '222'; +count(*) +1 +select count(*) from t1 where c > '222'; +count(*) +1 +select count(*) from t1 where d > '222'; +count(*) +2 +select count(*) from t1 where e > '222'; +count(*) +1 +select count(*) from t1 where f > '222'; +count(*) +1 +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +select count(*) from t1 where a > '222'; +count(*) +1 +select count(*) from t1 where b > '222'; +count(*) +1 +select count(*) from t1 where c > '222'; +count(*) +1 +select count(*) from t1 where d > '222'; +count(*) +2 +select count(*) from t1 where e > '222'; +count(*) +1 +select count(*) from t1 where f > '222'; +count(*) +1 +drop table t1; set @is_enable = @is_enable_default; set @is_enable = NULL; # is_enable_on=0 is_enable_off=1 === modified file 'mysql-test/suite/ndb/t/ndb_index_stat.test' --- a/mysql-test/suite/ndb/t/ndb_index_stat.test 2011-07-02 07:05:32 +0000 +++ b/mysql-test/suite/ndb/t/ndb_index_stat.test 2011-07-19 16:04:38 +0000 @@ -168,5 +168,143 @@ select * from t1 order by a; analyze table t1; drop table t1; +# bug#XXXXX +# wrong byte size from some types to NdbPack +# before error fixes causes stats to be ignored silently (error 4716) +# best seen with debug and export NDB_PACK_ABORT_ON_ERROR=1 +# affected types: mediumint datetime date time timestamp + +create table t1 ( + pk int not null, + a tinyint not null, + b tinyint unsigned not null, + c smallint not null, + d smallint unsigned not null, + e mediumint not null, + f mediumint unsigned not null, + g int not null, + h int unsigned not null, + i bigint not null, + j bigint unsigned not null, + k float not null, + l double not null, + m decimal not null, + n decimal unsigned not null, + primary key using hash (pk), + index (a), + index (b), + index (c), + index (d), + index (e), + index (f), + index (g), + index (h), + index (i), + index (j), + index (k), + index (l), + index (m), + index (n) +) engine=ndb; +insert into t1 values +(1,11,11,11,11,11,11,11,11,11,11,11,11,11,11), +(2,22,22,22,22,22,22,22,22,22,22,22,22,22,22), +(3,33,33,33,33,33,33,33,33,33,33,33,33,33,33); +let $i = 2; +while ($i) +{ + dec $i; + if (!$i) + { + eval analyze table t1; + } + eval select count(*) from t1 where a > 22; + eval select count(*) from t1 where b > 22; + eval select count(*) from t1 where c > 22; + eval select count(*) from t1 where d > 22; + eval select count(*) from t1 where e > 22; + eval select count(*) from t1 where f > 22; + eval select count(*) from t1 where g > 22; + eval select count(*) from t1 where h > 22; + eval select count(*) from t1 where i > 22; + eval select count(*) from t1 where j > 22; + eval select count(*) from t1 where k > 22; + eval select count(*) from t1 where l > 22; + eval select count(*) from t1 where m > 22; + eval select count(*) from t1 where n > 22; +} +drop table t1; + +create table t1 ( + pk int not null, + a datetime not null, + b date not null, + c year not null, + d time not null, + e timestamp not null, + primary key using hash (pk), + index (a), + index (b), + index (c), + index (d), + index (e) +) engine=ndb; +insert into t1 values +(1,'1971-01-01 01:01:01','1971-01-01','1971','01:01:01','1971-01-01 01:01:01'), +(2,'1972-02-02 02:02:02','1972-02-02','1972','02:02:02','1972-02-02 02:02:02'), +(3,'1973-03-03 03:03:03','1973-03-03','1973','03:03:03','1973-03-03 03:03:03'); +let $i = 2; +while ($i) +{ + dec $i; + if (!$i) + { + eval analyze table t1; + } + eval select count(*) from t1 where a > '1972-02-02 02:02:02'; + eval select count(*) from t1 where b > '1972-02-02'; + eval select count(*) from t1 where c > '1972'; + eval select count(*) from t1 where d > '02:02:02'; + eval select count(*) from t1 where e > '1972-02-02 02:02:02'; +} +drop table t1; + +create table t1 ( + pk int not null, + a char(10) not null, + b varchar(10) not null, + c varchar(1000) not null, + d binary(10) not null, + e varbinary(10) not null, + f varbinary(1000) not null, + primary key using hash (pk), + index (a), + index (b), + index (c), + index (d), + index (e), + index (f) +) engine=ndb; +insert into t1 values +('1','111','111','111','111','111','111'), +('2','222','222','222','222','222','222'), +('3','333','333','333','333','333','333'); +let $i = 2; +while ($i) +{ + dec $i; + if (!$i) + { + eval analyze table t1; + } + eval select count(*) from t1 where a > '222'; + eval select count(*) from t1 where b > '222'; + eval select count(*) from t1 where c > '222'; + eval select count(*) from t1 where d > '222'; + eval select count(*) from t1 where e > '222'; + eval select count(*) from t1 where f > '222'; +} +drop table t1; + set @is_enable = @is_enable_default; source ndb_index_stat_enable.inc; === modified file 'storage/ndb/src/ndbapi/NdbIndexStatImpl.cpp' --- a/storage/ndb/src/ndbapi/NdbIndexStatImpl.cpp 2011-07-04 13:37:56 +0000 +++ b/storage/ndb/src/ndbapi/NdbIndexStatImpl.cpp 2011-07-19 16:04:38 +0000 @@ -725,7 +725,7 @@ NdbIndexStatImpl::set_index(const NdbDic } NdbPack::Type type ( icol->getType(), - icol->getArrayType() + icol->getSize() * icol->getLength(), + icol->getSizeInBytes(), icol->getNullable(), icol->getCharset() != 0 ? icol->getCharset()->number : 0 ); No bundle (reason: useless for push emails).