From: Date: April 2 2008 6:37pm Subject: bk commit into maria tree (guilhem:1.2624) BUG#35570 List-Archive: http://lists.mysql.com/commits/44800 X-Bug: 35570 Message-Id: <20080402163707.4D21C21669@gbichot4.local> Below is the list of changes that have just been committed into a local maria repository of guilhem. When guilhem does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet@stripped, 2008-04-02 18:37:01+02:00, guilhem@stripped +3 -0 Fix for BUG#35570 "CHECKSUM TABLE unreliable if LINESTRING field (same content / differen checksum)" This will be back-ported to 5.x trees but the work for R-tree logging critically needs this patch in Maria now. mysql-test/r/myisam.result@stripped, 2008-04-02 18:36:56+02:00, guilhem@stripped +15 -0 checksums are identical; without the code fix they were all different mysql-test/t/myisam.test@stripped, 2008-04-02 18:36:56+02:00, guilhem@stripped +15 -1 test that same tables give same checksums sql/sql_table.cc@stripped, 2008-04-02 18:36:56+02:00, guilhem@stripped +8 -2 Type GEOMETRY is implemented on top of type BLOB, so, just like for BLOB, its 'field' contains pointers which it does not make sense to include in the checksum; it rather has to be converted to a string and then we can compute the checksum. diff -Nrup a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result --- a/mysql-test/r/myisam.result 2008-02-11 19:54:54 +01:00 +++ b/mysql-test/r/myisam.result 2008-04-02 18:36:56 +02:00 @@ -2033,4 +2033,19 @@ t1 CREATE TABLE `t1` ( `c` char(1) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 TRANSACTIONAL=1 drop table t1; +CREATE TABLE t1 (line LINESTRING NOT NULL) engine=myisam; +INSERT INTO t1 VALUES (GeomFromText("POINT(0 0)")); +checksum table t1; +Table Checksum +test.t1 326284887 +CREATE TABLE t2 (line LINESTRING NOT NULL) engine=myisam; +INSERT INTO t2 VALUES (GeomFromText("POINT(0 0)")); +checksum table t2; +Table Checksum +test.t2 326284887 +CREATE TABLE t3 select * from t1; +checksum table t3; +Table Checksum +test.t3 326284887 +drop table t1,t2,t3; End of 5.1 tests diff -Nrup a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test --- a/mysql-test/t/myisam.test 2008-02-11 19:54:55 +01:00 +++ b/mysql-test/t/myisam.test 2008-04-02 18:36:56 +02:00 @@ -1285,5 +1285,19 @@ create table t1 (n int not null, c char( show create table t1; drop table t1; ---echo End of 5.1 tests +# +# Test of BUG#35570 CHECKSUM TABLE unreliable if LINESTRING field +# (same content / differen checksum) +# + +CREATE TABLE t1 (line LINESTRING NOT NULL) engine=myisam; +INSERT INTO t1 VALUES (GeomFromText("POINT(0 0)")); +checksum table t1; +CREATE TABLE t2 (line LINESTRING NOT NULL) engine=myisam; +INSERT INTO t2 VALUES (GeomFromText("POINT(0 0)")); +checksum table t2; +CREATE TABLE t3 select * from t1; +checksum table t3; +drop table t1,t2,t3; +--echo End of 5.1 tests diff -Nrup a/sql/sql_table.cc b/sql/sql_table.cc --- a/sql/sql_table.cc 2008-03-20 16:04:18 +01:00 +++ b/sql/sql_table.cc 2008-04-02 18:36:56 +02:00 @@ -7261,8 +7261,14 @@ bool mysql_checksum_table(THD *thd, TABL if (! thd->variables.old_mode && f->is_real_null(0)) continue; - if ((f->type() == MYSQL_TYPE_BLOB) || - (f->type() == MYSQL_TYPE_VARCHAR)) + enum_field_types field_type= f->type(); + /* + BLOB and VARCHAR have pointers in their field, we must convert + to string; GEOMETRY is implemented on top of BLOB. + */ + if ((field_type == MYSQL_TYPE_BLOB) || + (field_type == MYSQL_TYPE_VARCHAR) || + (field_type == MYSQL_TYPE_GEOMETRY)) { String tmp; f->val_str(&tmp);