Skip to content

Commit b85a186

Browse files
author
Luis Soares
committed
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:'.
1 parent 62b1099 commit b85a186

File tree

4 files changed

+211
-5
lines changed

4 files changed

+211
-5
lines changed

mysql-test/extra/rpl_tests/type_conversions.test

Lines changed: 138 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,142 @@ connection slave;
1212
let $if_is_lossy = `SELECT FIND_IN_SET('ALL_LOSSY', @@SLAVE_TYPE_CONVERSIONS)`;
1313
let $if_is_non_lossy = `SELECT FIND_IN_SET('ALL_NON_LOSSY', @@SLAVE_TYPE_CONVERSIONS)`;
1414

15+
# TINYBLOB
16+
17+
let $source_type = TINYBLOB;
18+
let $target_type = TINYBLOB;
19+
let $source_value = 'aaa';
20+
let $target_value = 'aaa';
21+
let $can_convert = 1;
22+
source extra/rpl_tests/check_type.inc;
23+
24+
let $source_type= TINYBLOB;
25+
let $target_type= BLOB;
26+
let $source_value= 'aaa';
27+
let $target_value= 'aaa';
28+
let $can_convert= $if_is_non_lossy;
29+
source extra/rpl_tests/check_type.inc;
30+
31+
let $source_type= TINYBLOB;
32+
let $target_type= MEDIUMBLOB;
33+
let $source_value= 'aaa';
34+
let $target_value= 'aaa';
35+
let $can_convert= $if_is_non_lossy;
36+
source extra/rpl_tests/check_type.inc;
37+
38+
let $source_type= TINYBLOB;
39+
let $target_type= LONGBLOB;
40+
let $source_value= 'aaa';
41+
let $target_value= 'aaa';
42+
let $can_convert= $if_is_non_lossy;
43+
source extra/rpl_tests/check_type.inc;
44+
45+
# BLOB
46+
47+
let $source_type = BLOB;
48+
let $target_type = TINYBLOB;
49+
let $source_value = 'aaa';
50+
let $target_value = 'aaa';
51+
let $can_convert = $if_is_lossy;
52+
source extra/rpl_tests/check_type.inc;
53+
54+
let $source_type= BLOB;
55+
let $target_type= BLOB;
56+
let $source_value= 'aaa';
57+
let $target_value= 'aaa';
58+
let $can_convert= 1;
59+
source extra/rpl_tests/check_type.inc;
60+
61+
let $source_type= BLOB;
62+
let $target_type= MEDIUMBLOB;
63+
let $source_value= 'aaa';
64+
let $target_value= 'aaa';
65+
let $can_convert= $if_is_non_lossy;
66+
source extra/rpl_tests/check_type.inc;
67+
68+
let $source_type= BLOB;
69+
let $target_type= LONGBLOB;
70+
let $source_value= 'aaa';
71+
let $target_value= 'aaa';
72+
let $can_convert= $if_is_non_lossy;
73+
source extra/rpl_tests/check_type.inc;
74+
75+
# MEDIUMBLOB
76+
77+
let $source_type = MEDIUMBLOB;
78+
let $target_type = TINYBLOB;
79+
let $source_value = 'aaa';
80+
let $target_value = 'aaa';
81+
let $can_convert = $if_is_lossy;
82+
source extra/rpl_tests/check_type.inc;
83+
84+
let $source_type= MEDIUMBLOB;
85+
let $target_type= BLOB;
86+
let $source_value= 'aaa';
87+
let $target_value= 'aaa';
88+
let $can_convert= $if_is_lossy;
89+
source extra/rpl_tests/check_type.inc;
90+
91+
let $source_type= MEDIUMBLOB;
92+
let $target_type= MEDIUMBLOB;
93+
let $source_value= 'aaa';
94+
let $target_value= 'aaa';
95+
let $can_convert= 1;
96+
source extra/rpl_tests/check_type.inc;
97+
98+
let $source_type= MEDIUMBLOB;
99+
let $target_type= LONGBLOB;
100+
let $source_value= 'aaa';
101+
let $target_value= 'aaa';
102+
let $can_convert= $if_is_non_lossy;
103+
source extra/rpl_tests/check_type.inc;
104+
105+
# LONGBLOB
106+
107+
let $source_type = LONGBLOB;
108+
let $target_type = TINYBLOB;
109+
let $source_value = 'aaa';
110+
let $target_value = 'aaa';
111+
let $can_convert = $if_is_lossy;
112+
source extra/rpl_tests/check_type.inc;
113+
114+
let $source_type= LONGBLOB;
115+
let $target_type= BLOB;
116+
let $source_value= 'aaa';
117+
let $target_value= 'aaa';
118+
let $can_convert= $if_is_lossy;
119+
source extra/rpl_tests/check_type.inc;
120+
121+
let $source_type= LONGBLOB;
122+
let $target_type= MEDIUMBLOB;
123+
let $source_value= 'aaa';
124+
let $target_value= 'aaa';
125+
let $can_convert= $if_is_lossy;
126+
source extra/rpl_tests/check_type.inc;
127+
128+
let $source_type= LONGBLOB;
129+
let $target_type= LONGBLOB;
130+
let $source_value= 'aaa';
131+
let $target_value= 'aaa';
132+
let $can_convert= 1;
133+
source extra/rpl_tests/check_type.inc;
134+
135+
# BUG#49836 (additional tests - GEOMETRY TYPE)
136+
137+
let $source_type = GEOMETRY;
138+
let $target_type = BLOB;
139+
let $source_value = PointFromText('POINT(10 10)');
140+
let $target_value = PointFromText('POINT(10 10)');
141+
let $can_convert = 0;
142+
source extra/rpl_tests/check_type.inc;
143+
144+
let $source_type = BLOB;
145+
let $target_type = GEOMETRY;
146+
let $source_value = 'aaa';
147+
let $target_value = 'aaa';
148+
let $can_convert = 0;
149+
source extra/rpl_tests/check_type.inc;
150+
15151
let $source_type = GEOMETRY;
16152
let $target_type = GEOMETRY;
17153
let $source_value = PointFromText('POINT(10 10)');
@@ -739,7 +875,8 @@ let $target_value= b'11111';
739875
let $can_convert = $if_is_lossy;
740876
source extra/rpl_tests/check_type.inc;
741877

878+
742879
disable_warnings;
743880
source include/reset_master_and_slave.inc;
744881
enable_warnings;
745-
enable_query_log;
882+
enable_query_log;

mysql-test/suite/rpl/r/rpl_typeconv.result

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,24 @@ RESET MASTER;
6969
include/start_slave.inc
7070
**** Result of conversions ****
7171
Source_Type Target_Type All_Type_Conversion_Flags Value_On_Slave
72+
TINYBLOB TINYBLOB <Correct value>
73+
TINYBLOB BLOB <Correct error>
74+
TINYBLOB MEDIUMBLOB <Correct error>
75+
TINYBLOB LONGBLOB <Correct error>
76+
BLOB TINYBLOB <Correct error>
77+
BLOB BLOB <Correct value>
78+
BLOB MEDIUMBLOB <Correct error>
79+
BLOB LONGBLOB <Correct error>
80+
MEDIUMBLOB TINYBLOB <Correct error>
81+
MEDIUMBLOB BLOB <Correct error>
82+
MEDIUMBLOB MEDIUMBLOB <Correct value>
83+
MEDIUMBLOB LONGBLOB <Correct error>
84+
LONGBLOB TINYBLOB <Correct error>
85+
LONGBLOB BLOB <Correct error>
86+
LONGBLOB MEDIUMBLOB <Correct error>
87+
LONGBLOB LONGBLOB <Correct value>
88+
GEOMETRY BLOB <Correct error>
89+
BLOB GEOMETRY <Correct error>
7290
GEOMETRY GEOMETRY <Correct value>
7391
BIT(1) BIT(1) <Correct value>
7492
DATE DATE <Correct value>
@@ -172,6 +190,24 @@ BIT(5) BIT(6) <Correct error>
172190
BIT(6) BIT(5) <Correct error>
173191
BIT(5) BIT(12) <Correct error>
174192
BIT(12) BIT(5) <Correct error>
193+
TINYBLOB TINYBLOB ALL_NON_LOSSY <Correct value>
194+
TINYBLOB BLOB ALL_NON_LOSSY <Correct value>
195+
TINYBLOB MEDIUMBLOB ALL_NON_LOSSY <Correct value>
196+
TINYBLOB LONGBLOB ALL_NON_LOSSY <Correct value>
197+
BLOB TINYBLOB ALL_NON_LOSSY <Correct error>
198+
BLOB BLOB ALL_NON_LOSSY <Correct value>
199+
BLOB MEDIUMBLOB ALL_NON_LOSSY <Correct value>
200+
BLOB LONGBLOB ALL_NON_LOSSY <Correct value>
201+
MEDIUMBLOB TINYBLOB ALL_NON_LOSSY <Correct error>
202+
MEDIUMBLOB BLOB ALL_NON_LOSSY <Correct error>
203+
MEDIUMBLOB MEDIUMBLOB ALL_NON_LOSSY <Correct value>
204+
MEDIUMBLOB LONGBLOB ALL_NON_LOSSY <Correct value>
205+
LONGBLOB TINYBLOB ALL_NON_LOSSY <Correct error>
206+
LONGBLOB BLOB ALL_NON_LOSSY <Correct error>
207+
LONGBLOB MEDIUMBLOB ALL_NON_LOSSY <Correct error>
208+
LONGBLOB LONGBLOB ALL_NON_LOSSY <Correct value>
209+
GEOMETRY BLOB ALL_NON_LOSSY <Correct error>
210+
BLOB GEOMETRY ALL_NON_LOSSY <Correct error>
175211
GEOMETRY GEOMETRY ALL_NON_LOSSY <Correct value>
176212
BIT(1) BIT(1) ALL_NON_LOSSY <Correct value>
177213
DATE DATE ALL_NON_LOSSY <Correct value>
@@ -275,6 +311,24 @@ BIT(5) BIT(6) ALL_NON_LOSSY <Correct value>
275311
BIT(6) BIT(5) ALL_NON_LOSSY <Correct error>
276312
BIT(5) BIT(12) ALL_NON_LOSSY <Correct value>
277313
BIT(12) BIT(5) ALL_NON_LOSSY <Correct error>
314+
TINYBLOB TINYBLOB ALL_LOSSY <Correct value>
315+
TINYBLOB BLOB ALL_LOSSY <Correct error>
316+
TINYBLOB MEDIUMBLOB ALL_LOSSY <Correct error>
317+
TINYBLOB LONGBLOB ALL_LOSSY <Correct error>
318+
BLOB TINYBLOB ALL_LOSSY <Correct value>
319+
BLOB BLOB ALL_LOSSY <Correct value>
320+
BLOB MEDIUMBLOB ALL_LOSSY <Correct error>
321+
BLOB LONGBLOB ALL_LOSSY <Correct error>
322+
MEDIUMBLOB TINYBLOB ALL_LOSSY <Correct value>
323+
MEDIUMBLOB BLOB ALL_LOSSY <Correct value>
324+
MEDIUMBLOB MEDIUMBLOB ALL_LOSSY <Correct value>
325+
MEDIUMBLOB LONGBLOB ALL_LOSSY <Correct error>
326+
LONGBLOB TINYBLOB ALL_LOSSY <Correct value>
327+
LONGBLOB BLOB ALL_LOSSY <Correct value>
328+
LONGBLOB MEDIUMBLOB ALL_LOSSY <Correct value>
329+
LONGBLOB LONGBLOB ALL_LOSSY <Correct value>
330+
GEOMETRY BLOB ALL_LOSSY <Correct error>
331+
BLOB GEOMETRY ALL_LOSSY <Correct error>
278332
GEOMETRY GEOMETRY ALL_LOSSY <Correct value>
279333
BIT(1) BIT(1) ALL_LOSSY <Correct value>
280334
DATE DATE ALL_LOSSY <Correct value>
@@ -378,6 +432,24 @@ BIT(5) BIT(6) ALL_LOSSY <Correct error>
378432
BIT(6) BIT(5) ALL_LOSSY <Correct value>
379433
BIT(5) BIT(12) ALL_LOSSY <Correct error>
380434
BIT(12) BIT(5) ALL_LOSSY <Correct value>
435+
TINYBLOB TINYBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
436+
TINYBLOB BLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
437+
TINYBLOB MEDIUMBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
438+
TINYBLOB LONGBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
439+
BLOB TINYBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
440+
BLOB BLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
441+
BLOB MEDIUMBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
442+
BLOB LONGBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
443+
MEDIUMBLOB TINYBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
444+
MEDIUMBLOB BLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
445+
MEDIUMBLOB MEDIUMBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
446+
MEDIUMBLOB LONGBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
447+
LONGBLOB TINYBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
448+
LONGBLOB BLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
449+
LONGBLOB MEDIUMBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
450+
LONGBLOB LONGBLOB ALL_LOSSY,ALL_NON_LOSSY <Correct value>
451+
GEOMETRY BLOB ALL_LOSSY,ALL_NON_LOSSY <Correct error>
452+
BLOB GEOMETRY ALL_LOSSY,ALL_NON_LOSSY <Correct error>
381453
GEOMETRY GEOMETRY ALL_LOSSY,ALL_NON_LOSSY <Correct value>
382454
BIT(1) BIT(1) ALL_LOSSY,ALL_NON_LOSSY <Correct value>
383455
DATE DATE ALL_LOSSY,ALL_NON_LOSSY <Correct value>

sql/field.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1817,10 +1817,6 @@ class Field_geom :public Field_blob {
18171817
uint size_of() const { return sizeof(*this); }
18181818
int reset(void) { return !maybe_null() || Field_blob::reset(); }
18191819
geometry_type get_geometry_type() { return geom_type; };
1820-
uint pack_length_from_metadata(uint field_metadata)
1821-
{
1822-
return pack_length_no_ptr();
1823-
}
18241820
};
18251821
#endif /*HAVE_SPATIAL*/
18261822

sql/rpl_utility.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -977,6 +977,7 @@ table_def::table_def(unsigned char *types, ulong size,
977977
case MYSQL_TYPE_LONG_BLOB:
978978
case MYSQL_TYPE_DOUBLE:
979979
case MYSQL_TYPE_FLOAT:
980+
case MYSQL_TYPE_GEOMETRY:
980981
{
981982
/*
982983
These types store a single byte.

0 commit comments

Comments
 (0)