diff options
author | Luis Soares <luis.soares@sun.com> | 2009-12-24 01:07:35 +0000 |
---|---|---|
committer | Luis Soares <luis.soares@sun.com> | 2009-12-24 01:07:35 +0000 |
commit | dcf8e115369c4e97ae092d091365ee07e2f819ed (patch) | |
tree | d9feb8cda6dbcb666d91d58206d5b0e334a7e32a | |
parent | 3543244a12a6cd7688923f6c7b61ca548826a0e4 (diff) | |
download | mariadb-git-dcf8e115369c4e97ae092d091365ee07e2f819ed.tar.gz |
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
-rw-r--r-- | mysql-test/extra/rpl_tests/type_conversions.test | 139 | ||||
-rw-r--r-- | mysql-test/suite/rpl/r/rpl_typeconv.result | 72 | ||||
-rw-r--r-- | sql/field.h | 4 | ||||
-rw-r--r-- | sql/rpl_utility.cc | 1 |
4 files changed, 211 insertions, 5 deletions
diff --git a/mysql-test/extra/rpl_tests/type_conversions.test b/mysql-test/extra/rpl_tests/type_conversions.test index 791e07c4822..731eef8f41e 100644 --- a/mysql-test/extra/rpl_tests/type_conversions.test +++ b/mysql-test/extra/rpl_tests/type_conversions.test @@ -12,6 +12,142 @@ connection slave; 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)`; +# 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 $target_type = GEOMETRY; let $source_value = PointFromText('POINT(10 10)'); @@ -739,7 +875,8 @@ let $target_value= b'11111'; let $can_convert = $if_is_lossy; source extra/rpl_tests/check_type.inc; + disable_warnings; source include/reset_master_and_slave.inc; enable_warnings; -enable_query_log;
\ No newline at end of file +enable_query_log; diff --git a/mysql-test/suite/rpl/r/rpl_typeconv.result b/mysql-test/suite/rpl/r/rpl_typeconv.result index 34ec81973ae..89096153c14 100644 --- a/mysql-test/suite/rpl/r/rpl_typeconv.result +++ b/mysql-test/suite/rpl/r/rpl_typeconv.result @@ -69,6 +69,24 @@ RESET MASTER; include/start_slave.inc **** Result of conversions **** 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> BIT(1) BIT(1) <Correct value> DATE DATE <Correct value> @@ -172,6 +190,24 @@ BIT(5) BIT(6) <Correct error> BIT(6) BIT(5) <Correct error> BIT(5) BIT(12) <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> BIT(1) BIT(1) 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> BIT(6) BIT(5) ALL_NON_LOSSY <Correct error> BIT(5) BIT(12) ALL_NON_LOSSY <Correct value> 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> BIT(1) BIT(1) ALL_LOSSY <Correct value> DATE DATE ALL_LOSSY <Correct value> @@ -378,6 +432,24 @@ BIT(5) BIT(6) ALL_LOSSY <Correct error> BIT(6) BIT(5) ALL_LOSSY <Correct value> BIT(5) BIT(12) ALL_LOSSY <Correct error> 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> BIT(1) BIT(1) ALL_LOSSY,ALL_NON_LOSSY <Correct value> DATE DATE ALL_LOSSY,ALL_NON_LOSSY <Correct value> diff --git a/sql/field.h b/sql/field.h index 192f0c8e460..041610f5385 100644 --- a/sql/field.h +++ b/sql/field.h @@ -1817,10 +1817,6 @@ public: uint size_of() const { return sizeof(*this); } int reset(void) { return !maybe_null() || Field_blob::reset(); } geometry_type get_geometry_type() { return geom_type; }; - uint pack_length_from_metadata(uint field_metadata) - { - return pack_length_no_ptr(); - } }; #endif /*HAVE_SPATIAL*/ diff --git a/sql/rpl_utility.cc b/sql/rpl_utility.cc index e8e22216b38..1971077ab65 100644 --- a/sql/rpl_utility.cc +++ b/sql/rpl_utility.cc @@ -977,6 +977,7 @@ table_def::table_def(unsigned char *types, ulong size, case MYSQL_TYPE_LONG_BLOB: case MYSQL_TYPE_DOUBLE: case MYSQL_TYPE_FLOAT: + case MYSQL_TYPE_GEOMETRY: { /* These types store a single byte. |