Commit dcf8e115 authored by Luis Soares's avatar Luis Soares

BUG#49836: Replication of geometric fields is broken after WL#5151

Metadata for geometric fields was not being properly stored by
the slave in its the table definition. This happened because
MYSQL_TYPE_GEOMETRY was not included in the 'switch... case' that
handles field metadata according to the field type. Therefore, it
would default to 0, leading to always have a mismatch between
master's field and slave fields'. 

We fix this by deploying the missing 'case MYSQL_TYPE_GEOMETRY:'.

mysql-test/extra/rpl_tests/type_conversions.test:
  Added some tests for blob fields and also the particular
  case for replicating from/into BLOB into/from GEOMETRY.
sql/field.h:
  As requested by Mats, reverted function added by him in
  changeset:
  http://lists.mysql.com/commits/95313
parent 3543244a
...@@ -12,6 +12,142 @@ connection slave; ...@@ -12,6 +12,142 @@ connection slave;
let $if_is_lossy = `SELECT FIND_IN_SET('ALL_LOSSY', @@SLAVE_TYPE_CONVERSIONS)`; let $if_is_lossy = `SELECT FIND_IN_SET('ALL_LOSSY', @@SLAVE_TYPE_CONVERSIONS)`;
let $if_is_non_lossy = `SELECT FIND_IN_SET('ALL_NON_LOSSY', @@SLAVE_TYPE_CONVERSIONS)`; let $if_is_non_lossy = `SELECT FIND_IN_SET('ALL_NON_LOSSY', @@SLAVE_TYPE_CONVERSIONS)`;
# TINYBLOB
let $source_type = TINYBLOB;
let $target_type = TINYBLOB;
let $source_value = 'aaa';
let $target_value = 'aaa';
let $can_convert = 1;
source extra/rpl_tests/check_type.inc;
let $source_type= TINYBLOB;
let $target_type= BLOB;
let $source_value= 'aaa';
let $target_value= 'aaa';
let $can_convert= $if_is_non_lossy;
source extra/rpl_tests/check_type.inc;
let $source_type= TINYBLOB;
let $target_type= MEDIUMBLOB;
let $source_value= 'aaa';
let $target_value= 'aaa';
let $can_convert= $if_is_non_lossy;
source extra/rpl_tests/check_type.inc;
let $source_type= TINYBLOB;
let $target_type= LONGBLOB;
let $source_value= 'aaa';
let $target_value= 'aaa';
let $can_convert= $if_is_non_lossy;
source extra/rpl_tests/check_type.inc;
# BLOB
let $source_type = BLOB;
let $target_type = TINYBLOB;
let $source_value = 'aaa';
let $target_value = 'aaa';
let $can_convert = $if_is_lossy;
source extra/rpl_tests/check_type.inc;
let $source_type= BLOB;
let $target_type= BLOB;
let $source_value= 'aaa';
let $target_value= 'aaa';
let $can_convert= 1;
source extra/rpl_tests/check_type.inc;
let $source_type= BLOB;
let $target_type= MEDIUMBLOB;
let $source_value= 'aaa';
let $target_value= 'aaa';
let $can_convert= $if_is_non_lossy;
source extra/rpl_tests/check_type.inc;
let $source_type= BLOB;
let $target_type= LONGBLOB;
let $source_value= 'aaa';
let $target_value= 'aaa';
let $can_convert= $if_is_non_lossy;
source extra/rpl_tests/check_type.inc;
# MEDIUMBLOB
let $source_type = MEDIUMBLOB;
let $target_type = TINYBLOB;
let $source_value = 'aaa';
let $target_value = 'aaa';
let $can_convert = $if_is_lossy;
source extra/rpl_tests/check_type.inc;
let $source_type= MEDIUMBLOB;
let $target_type= BLOB;
let $source_value= 'aaa';
let $target_value= 'aaa';
let $can_convert= $if_is_lossy;
source extra/rpl_tests/check_type.inc;
let $source_type= MEDIUMBLOB;
let $target_type= MEDIUMBLOB;
let $source_value= 'aaa';
let $target_value= 'aaa';
let $can_convert= 1;
source extra/rpl_tests/check_type.inc;
let $source_type= MEDIUMBLOB;
let $target_type= LONGBLOB;
let $source_value= 'aaa';
let $target_value= 'aaa';
let $can_convert= $if_is_non_lossy;
source extra/rpl_tests/check_type.inc;
# LONGBLOB
let $source_type = LONGBLOB;
let $target_type = TINYBLOB;
let $source_value = 'aaa';
let $target_value = 'aaa';
let $can_convert = $if_is_lossy;
source extra/rpl_tests/check_type.inc;
let $source_type= LONGBLOB;
let $target_type= BLOB;
let $source_value= 'aaa';
let $target_value= 'aaa';
let $can_convert= $if_is_lossy;
source extra/rpl_tests/check_type.inc;
let $source_type= LONGBLOB;
let $target_type= MEDIUMBLOB;
let $source_value= 'aaa';
let $target_value= 'aaa';
let $can_convert= $if_is_lossy;
source extra/rpl_tests/check_type.inc;
let $source_type= LONGBLOB;
let $target_type= LONGBLOB;
let $source_value= 'aaa';
let $target_value= 'aaa';
let $can_convert= 1;
source extra/rpl_tests/check_type.inc;
# BUG#49836 (additional tests - GEOMETRY TYPE)
let $source_type = GEOMETRY;
let $target_type = BLOB;
let $source_value = PointFromText('POINT(10 10)');
let $target_value = PointFromText('POINT(10 10)');
let $can_convert = 0;
source extra/rpl_tests/check_type.inc;
let $source_type = BLOB;
let $target_type = GEOMETRY;
let $source_value = 'aaa';
let $target_value = 'aaa';
let $can_convert = 0;
source extra/rpl_tests/check_type.inc;
let $source_type = GEOMETRY; let $source_type = GEOMETRY;
let $target_type = GEOMETRY; let $target_type = GEOMETRY;
let $source_value = PointFromText('POINT(10 10)'); let $source_value = PointFromText('POINT(10 10)');
...@@ -739,6 +875,7 @@ let $target_value= b'11111'; ...@@ -739,6 +875,7 @@ let $target_value= b'11111';
let $can_convert = $if_is_lossy; let $can_convert = $if_is_lossy;
source extra/rpl_tests/check_type.inc; source extra/rpl_tests/check_type.inc;
disable_warnings; disable_warnings;
source include/reset_master_and_slave.inc; source include/reset_master_and_slave.inc;
enable_warnings; enable_warnings;
......
...@@ -69,6 +69,24 @@ RESET MASTER; ...@@ -69,6 +69,24 @@ RESET MASTER;
include/start_slave.inc include/start_slave.inc
**** Result of conversions **** **** Result of conversions ****
Source_Type Target_Type All_Type_Conversion_Flags Value_On_Slave Source_Type Target_Type All_Type_Conversion_Flags Value_On_Slave
TINYBLOB TINYBLOB <Correct value>
TINYBLOB BLOB <Correct error>
TINYBLOB MEDIUMBLOB <Correct error>
TINYBLOB LONGBLOB <Correct error>
BLOB TINYBLOB <Correct error>
BLOB BLOB <Correct value>
BLOB MEDIUMBLOB <Correct error>
BLOB LONGBLOB <Correct error>
MEDIUMBLOB TINYBLOB <Correct error>
MEDIUMBLOB BLOB <Correct error>
MEDIUMBLOB MEDIUMBLOB <Correct value>
MEDIUMBLOB LONGBLOB <Correct error>
LONGBLOB TINYBLOB <Correct error>
LONGBLOB BLOB <Correct error>
LONGBLOB MEDIUMBLOB <Correct error>
LONGBLOB LONGBLOB <Correct value>
GEOMETRY BLOB <Correct error>
BLOB GEOMETRY <Correct error>
GEOMETRY GEOMETRY <Correct value> GEOMETRY GEOMETRY <Correct value>
BIT(1) BIT(1) <Correct value> BIT(1) BIT(1) <Correct value>
DATE DATE <Correct value> DATE DATE <Correct value>
...@@ -172,6 +190,24 @@ BIT(5) BIT(6) <Correct error> ...@@ -172,6 +190,24 @@ BIT(5) BIT(6) <Correct error>
BIT(6) BIT(5) <Correct error> BIT(6) BIT(5) <Correct error>
BIT(5) BIT(12) <Correct error> BIT(5) BIT(12) <Correct error>
BIT(12) BIT(5) <Correct error> BIT(12) BIT(5) <Correct error>
TINYBLOB TINYBLOB ALL_NON_LOSSY <Correct value>
TINYBLOB BLOB ALL_NON_LOSSY <Correct value>
TINYBLOB MEDIUMBLOB ALL_NON_LOSSY <Correct value>
TINYBLOB LONGBLOB ALL_NON_LOSSY <Correct value>
BLOB TINYBLOB ALL_NON_LOSSY <Correct error>
BLOB BLOB ALL_NON_LOSSY <Correct value>
BLOB MEDIUMBLOB ALL_NON_LOSSY <Correct value>
BLOB LONGBLOB ALL_NON_LOSSY <Correct value>
MEDIUMBLOB TINYBLOB ALL_NON_LOSSY <Correct error>
MEDIUMBLOB BLOB ALL_NON_LOSSY <Correct error>
MEDIUMBLOB MEDIUMBLOB ALL_NON_LOSSY <Correct value>
MEDIUMBLOB LONGBLOB ALL_NON_LOSSY <Correct value>
LONGBLOB TINYBLOB ALL_NON_LOSSY <Correct error>
LONGBLOB BLOB ALL_NON_LOSSY <Correct error>
LONGBLOB MEDIUMBLOB ALL_NON_LOSSY <Correct error>
LONGBLOB LONGBLOB ALL_NON_LOSSY <Correct value>
GEOMETRY BLOB ALL_NON_LOSSY <Correct error>
BLOB GEOMETRY ALL_NON_LOSSY <Correct error>
GEOMETRY GEOMETRY ALL_NON_LOSSY <Correct value> GEOMETRY GEOMETRY ALL_NON_LOSSY <Correct value>
BIT(1) BIT(1) ALL_NON_LOSSY <Correct value> BIT(1) BIT(1) ALL_NON_LOSSY <Correct value>
DATE DATE ALL_NON_LOSSY <Correct value> DATE DATE ALL_NON_LOSSY <Correct value>
...@@ -275,6 +311,24 @@ BIT(5) BIT(6) ALL_NON_LOSSY <Correct value> ...@@ -275,6 +311,24 @@ BIT(5) BIT(6) ALL_NON_LOSSY <Correct value>
BIT(6) BIT(5) ALL_NON_LOSSY <Correct error> BIT(6) BIT(5) ALL_NON_LOSSY <Correct error>
BIT(5) BIT(12) ALL_NON_LOSSY <Correct value> BIT(5) BIT(12) ALL_NON_LOSSY <Correct value>
BIT(12) BIT(5) ALL_NON_LOSSY <Correct error> BIT(12) BIT(5) ALL_NON_LOSSY <Correct error>
TINYBLOB TINYBLOB ALL_LOSSY <Correct value>
TINYBLOB BLOB ALL_LOSSY <Correct error>
TINYBLOB MEDIUMBLOB ALL_LOSSY <Correct error>
TINYBLOB LONGBLOB ALL_LOSSY <Correct error>
BLOB TINYBLOB ALL_LOSSY <Correct value>
BLOB BLOB ALL_LOSSY <Correct value>
BLOB MEDIUMBLOB ALL_LOSSY <Correct error>
BLOB LONGBLOB ALL_LOSSY <Correct error>
MEDIUMBLOB TINYBLOB ALL_LOSSY <Correct value>
MEDIUMBLOB BLOB ALL_LOSSY <Correct value>
MEDIUMBLOB MEDIUMBLOB ALL_LOSSY <Correct value>
MEDIUMBLOB LONGBLOB ALL_LOSSY <Correct error>
LONGBLOB TINYBLOB ALL_LOSSY <Correct value>
LONGBLOB BLOB ALL_LOSSY <Correct value>
LONGBLOB MEDIUMBLOB ALL_LOSSY <Correct value>
LONGBLOB LONGBLOB ALL_LOSSY <Correct value>
GEOMETRY BLOB ALL_LOSSY <Correct error>
BLOB GEOMETRY ALL_LOSSY <Correct error>
GEOMETRY GEOMETRY ALL_LOSSY <Correct value> GEOMETRY GEOMETRY ALL_LOSSY <Correct value>
BIT(1) BIT(1) ALL_LOSSY <Correct value> BIT(1) BIT(1) ALL_LOSSY <Correct value>
DATE DATE ALL_LOSSY <Correct value> DATE DATE ALL_LOSSY <Correct value>
...@@ -378,6 +432,24 @@ BIT(5) BIT(6) ALL_LOSSY <Correct error> ...@@ -378,6 +432,24 @@ BIT(5) BIT(6) ALL_LOSSY <Correct error>
BIT(6) BIT(5) ALL_LOSSY <Correct value> BIT(6) BIT(5) ALL_LOSSY <Correct value>
BIT(5) BIT(12) ALL_LOSSY <Correct error> BIT(5) BIT(12) ALL_LOSSY <Correct error>
BIT(12) BIT(5) ALL_LOSSY <Correct value> BIT(12) BIT(5) ALL_LOSSY <Correct value>
TINYBLOB TINYBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
TINYBLOB BLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
TINYBLOB MEDIUMBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
TINYBLOB LONGBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
BLOB TINYBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
BLOB BLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
BLOB MEDIUMBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
BLOB LONGBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
MEDIUMBLOB TINYBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
MEDIUMBLOB BLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
MEDIUMBLOB MEDIUMBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
MEDIUMBLOB LONGBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
LONGBLOB TINYBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
LONGBLOB BLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
LONGBLOB MEDIUMBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
LONGBLOB LONGBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
GEOMETRY BLOB ALL_LOSSY,ALL_NON_LOSSY <Correct error>
BLOB GEOMETRY ALL_LOSSY,ALL_NON_LOSSY <Correct error>
GEOMETRY GEOMETRY ALL_LOSSY,ALL_NON_LOSSY <Correct value> GEOMETRY GEOMETRY ALL_LOSSY,ALL_NON_LOSSY <Correct value>
BIT(1) BIT(1) ALL_LOSSY,ALL_NON_LOSSY <Correct value> BIT(1) BIT(1) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
DATE DATE ALL_LOSSY,ALL_NON_LOSSY <Correct value> DATE DATE ALL_LOSSY,ALL_NON_LOSSY <Correct value>
......
...@@ -1817,10 +1817,6 @@ public: ...@@ -1817,10 +1817,6 @@ public:
uint size_of() const { return sizeof(*this); } uint size_of() const { return sizeof(*this); }
int reset(void) { return !maybe_null() || Field_blob::reset(); } int reset(void) { return !maybe_null() || Field_blob::reset(); }
geometry_type get_geometry_type() { return geom_type; }; geometry_type get_geometry_type() { return geom_type; };
uint pack_length_from_metadata(uint field_metadata)
{
return pack_length_no_ptr();
}
}; };
#endif /*HAVE_SPATIAL*/ #endif /*HAVE_SPATIAL*/
......
...@@ -977,6 +977,7 @@ table_def::table_def(unsigned char *types, ulong size, ...@@ -977,6 +977,7 @@ table_def::table_def(unsigned char *types, ulong size,
case MYSQL_TYPE_LONG_BLOB: case MYSQL_TYPE_LONG_BLOB:
case MYSQL_TYPE_DOUBLE: case MYSQL_TYPE_DOUBLE:
case MYSQL_TYPE_FLOAT: case MYSQL_TYPE_FLOAT:
case MYSQL_TYPE_GEOMETRY:
{ {
/* /*
These types store a single byte. These types store a single byte.
......
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