List:Commits« Previous MessageNext Message »
From:Guilhem Bichot Date:April 10 2008 4:50pm
Subject:bk commit into 5.0 tree (guilhem:1.2605) BUG#35570
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 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-10 16:50:08+02:00, guilhem@stripped +3 -0
  Fix for BUG#35570 "CHECKSUM TABLE unreliable if LINESTRING field (same content/ differen
checksum)"
  The problem was that checksum of GEOMETRY type used memory addresses
  in the computation, making it un-repeatable thus useless.

  mysql-test/r/myisam.result@stripped, 2008-04-10 16:50:06+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-10 16:50:06+02:00, guilhem@stripped +15 -0
    test that same tables give same checksums

  sql/sql_table.cc@stripped, 2008-04-10 16:50:06+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-03-15 18:51:30 +01:00
+++ b/mysql-test/r/myisam.result	2008-04-10 16:50:06 +02:00
@@ -1862,4 +1862,19 @@ id	ref
 3	2
 4	5
 DROP TABLE t1, t2;
+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.0 tests
diff -Nrup a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test
--- a/mysql-test/t/myisam.test	2008-01-16 12:15:56 +01:00
+++ b/mysql-test/t/myisam.test	2008-04-10 16:50:06 +02:00
@@ -1210,4 +1210,19 @@ SELECT * FROM t1;
 
 DROP TABLE t1, t2;
 
+#
+# 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.0 tests
diff -Nrup a/sql/sql_table.cc b/sql/sql_table.cc
--- a/sql/sql_table.cc	2008-01-23 16:01:29 +01:00
+++ b/sql/sql_table.cc	2008-04-10 16:50:06 +02:00
@@ -4369,8 +4369,14 @@ bool mysql_checksum_table(THD *thd, TABL
 	    for (uint i= 0; i < t->s->fields; i++ )
 	    {
 	      Field *f= t->field[i];
-	      if ((f->type() == FIELD_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);
Thread
bk commit into 5.0 tree (guilhem:1.2605) BUG#35570Guilhem Bichot10 Apr