Commit 50808b21 authored by unknown's avatar unknown

Fix for BUG#35570 "CHECKSUM TABLE unreliable if LINESTRING field (same content...

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:
  checksums are identical; without the code fix they were all different
mysql-test/t/myisam.test:
  test that same tables give same checksums
sql/sql_table.cc:
  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.
parent 3651e328
...@@ -2033,4 +2033,19 @@ t1 CREATE TABLE `t1` ( ...@@ -2033,4 +2033,19 @@ t1 CREATE TABLE `t1` (
`c` char(1) DEFAULT NULL `c` char(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 TRANSACTIONAL=1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 TRANSACTIONAL=1
drop table t1; 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 End of 5.1 tests
...@@ -1285,5 +1285,19 @@ create table t1 (n int not null, c char(1)) transactional=1; ...@@ -1285,5 +1285,19 @@ create table t1 (n int not null, c char(1)) transactional=1;
show create table t1; show create table t1;
drop 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
...@@ -7261,8 +7261,14 @@ bool mysql_checksum_table(THD *thd, TABLE_LIST *tables, ...@@ -7261,8 +7261,14 @@ bool mysql_checksum_table(THD *thd, TABLE_LIST *tables,
if (! thd->variables.old_mode && if (! thd->variables.old_mode &&
f->is_real_null(0)) f->is_real_null(0))
continue; continue;
if ((f->type() == MYSQL_TYPE_BLOB) || enum_field_types field_type= f->type();
(f->type() == MYSQL_TYPE_VARCHAR)) /*
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; String tmp;
f->val_str(&tmp); f->val_str(&tmp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment