Skip to content

Commit 56ff6f1

Browse files
committed
InnoDB: Remove dead code for DATA_POINT and DATA_VAR_POINT
The POINT data type is being treated just like any other geometry data type in InnoDB. The fixed-length data type DATA_POINT had been introduced in WL#6942 based on a misunderstanding and without appropriate review. Because of fundamental design problems (such as a DEFAULT POINT(0 0) value secretly introduced by InnoDB), the code was disabled in Oracle Bug#20415831 fix. This patch removes the dead code and definitions that were left behind by the Oracle Bug#20415831 patch.
1 parent cf2789b commit 56ff6f1

File tree

13 files changed

+17
-187
lines changed

13 files changed

+17
-187
lines changed

storage/innobase/btr/btr0btr.cc

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4673,29 +4673,12 @@ btr_index_rec_validate(
46734673
rec_get_nth_field_offs(offsets, i, &len);
46744674

46754675
/* Note that if fixed_size != 0, it equals the
4676-
length of a fixed-size column in the clustered index,
4677-
except the DATA_POINT, whose length would be MBR_LEN
4678-
when it's indexed in a R-TREE. We should adjust it here.
4676+
length of a fixed-size column in the clustered index.
4677+
We should adjust it here.
46794678
A prefix index of the column is of fixed, but different
46804679
length. When fixed_size == 0, prefix_len is the maximum
46814680
length of the prefix index column. */
46824681

4683-
if (dict_field_get_col(field)->mtype == DATA_POINT) {
4684-
ut_ad(fixed_size == DATA_POINT_LEN);
4685-
if (dict_index_is_spatial(index)) {
4686-
/* For DATA_POINT data, when it has R-tree
4687-
index, the fixed_len is the MBR of the point.
4688-
But if it's a primary key and on R-TREE
4689-
as the PK pointer, the length shall be
4690-
DATA_POINT_LEN as well. */
4691-
ut_ad((field->fixed_len == DATA_MBR_LEN
4692-
&& i == 0)
4693-
|| (field->fixed_len == DATA_POINT_LEN
4694-
&& i != 0));
4695-
fixed_size = field->fixed_len;
4696-
}
4697-
}
4698-
46994682
if ((field->prefix_len == 0
47004683
&& len != UNIV_SQL_NULL && fixed_size
47014684
&& len != fixed_size)

storage/innobase/data/data0type.cc

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -193,14 +193,6 @@ dtype_print(const dtype_t* type)
193193
fputs("DATA_BLOB", stderr);
194194
break;
195195

196-
case DATA_POINT:
197-
fputs("DATA_POINT", stderr);
198-
break;
199-
200-
case DATA_VAR_POINT:
201-
fputs("DATA_VAR_POINT", stderr);
202-
break;
203-
204196
case DATA_GEOMETRY:
205197
fputs("DATA_GEOMETRY", stderr);
206198
break;

storage/innobase/dict/dict0dict.cc

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2891,22 +2891,9 @@ dict_index_add_col(
28912891
field = dict_index_get_nth_field(index, index->n_def - 1);
28922892

28932893
field->col = col;
2894-
/* DATA_POINT is a special type, whose fixed_len should be:
2895-
1) DATA_MBR_LEN, when it's indexed in R-TREE. In this case,
2896-
it must be the first col to be added.
2897-
2) DATA_POINT_LEN(be equal to fixed size of column), when it's
2898-
indexed in B-TREE,
2899-
3) DATA_POINT_LEN, if a POINT col is the PRIMARY KEY, and we are
2900-
adding the PK col to other B-TREE/R-TREE. */
2901-
/* TODO: We suppose the dimension is 2 now. */
2902-
if (dict_index_is_spatial(index) && DATA_POINT_MTYPE(col->mtype)
2903-
&& index->n_def == 1) {
2904-
field->fixed_len = DATA_MBR_LEN;
2905-
} else {
2906-
field->fixed_len = static_cast<unsigned int>(
2907-
dict_col_get_fixed_size(
2908-
col, dict_table_is_comp(table)));
2909-
}
2894+
field->fixed_len = static_cast<unsigned int>(
2895+
dict_col_get_fixed_size(
2896+
col, dict_table_is_comp(table)));
29102897

29112898
if (prefix_len && field->fixed_len > prefix_len) {
29122899
field->fixed_len = (unsigned int) prefix_len;

storage/innobase/handler/ha_innodb.cc

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5971,14 +5971,6 @@ innobase_match_index_columns(
59715971
spatial index on it and we intend to use DATA_GEOMETRY
59725972
for legacy GIS data types which are of var-length. */
59735973
switch (col_type) {
5974-
case DATA_POINT:
5975-
case DATA_VAR_POINT:
5976-
if (DATA_POINT_MTYPE(mtype)
5977-
|| mtype == DATA_GEOMETRY
5978-
|| mtype == DATA_BLOB) {
5979-
break;
5980-
}
5981-
/* Fall through */
59825974
case DATA_GEOMETRY:
59835975
if (mtype == DATA_BLOB) {
59845976
break;
@@ -7969,12 +7961,6 @@ build_template_field(
79697961
prebuilt->templ_contains_blob = TRUE;
79707962
}
79717963

7972-
if (templ->type == DATA_POINT) {
7973-
/* We set this only when it's DATA_POINT, but not
7974-
DATA_VAR_POINT */
7975-
prebuilt->templ_contains_fixed_point = TRUE;
7976-
}
7977-
79787964
return(templ);
79797965
}
79807966

@@ -8059,7 +8045,6 @@ ha_innobase::build_template(
80598045

80608046
/* Prepare to build m_prebuilt->mysql_template[]. */
80618047
m_prebuilt->templ_contains_blob = FALSE;
8062-
m_prebuilt->templ_contains_fixed_point = FALSE;
80638048
m_prebuilt->mysql_prefix_len = 0;
80648049
m_prebuilt->n_template = 0;
80658050
m_prebuilt->idx_cond_n_cols = 0;
@@ -8950,8 +8935,6 @@ calc_row_difference(
89508935
switch (col_type) {
89518936

89528937
case DATA_BLOB:
8953-
case DATA_POINT:
8954-
case DATA_VAR_POINT:
89558938
case DATA_GEOMETRY:
89568939
o_ptr = row_mysql_read_blob_ref(&o_len, o_ptr, o_len);
89578940
n_ptr = row_mysql_read_blob_ref(&n_len, n_ptr, n_len);
@@ -11714,10 +11697,6 @@ create_table_info_t::create_table_def()
1171411697
}
1171511698
}
1171611699

11717-
if (col_type == DATA_POINT) {
11718-
col_len = DATA_POINT_LEN;
11719-
}
11720-
1172111700
is_virtual = (innobase_is_v_fld(field)) ? DATA_VIRTUAL : 0;
1172211701
is_stored = innobase_is_s_fld(field);
1172311702

storage/innobase/handler/handler0alter.cc

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1760,7 +1760,6 @@ innobase_col_to_mysql(
17601760
memcpy(dest, data, len);
17611761
break;
17621762

1763-
case DATA_VAR_POINT:
17641763
case DATA_GEOMETRY:
17651764
case DATA_BLOB:
17661765
/* Skip MySQL BLOBs when reporting an erroneous row
@@ -1785,7 +1784,6 @@ innobase_col_to_mysql(
17851784
case DATA_FLOAT:
17861785
case DATA_DOUBLE:
17871786
case DATA_DECIMAL:
1788-
case DATA_POINT:
17891787
/* Above are the valid column types for MySQL data. */
17901788
ut_ad(flen == len);
17911789
/* fall through */
@@ -3011,29 +3009,6 @@ innobase_check_foreigns(
30113009
return(false);
30123010
}
30133011

3014-
/** Get the default POINT value in MySQL format
3015-
@param[in] heap memory heap where allocated
3016-
@param[in] length length of MySQL format
3017-
@return mysql format data */
3018-
static
3019-
const byte*
3020-
innobase_build_default_mysql_point(
3021-
mem_heap_t* heap,
3022-
ulint length)
3023-
{
3024-
byte* buf = static_cast<byte*>(mem_heap_alloc(
3025-
heap, DATA_POINT_LEN + length));
3026-
3027-
byte* wkb = buf + length;
3028-
3029-
ulint len = get_wkb_of_default_point(SPDIMS, wkb, DATA_POINT_LEN);
3030-
ut_ad(len == DATA_POINT_LEN);
3031-
3032-
row_mysql_store_blob_ref(buf, length, wkb, len);
3033-
3034-
return(buf);
3035-
}
3036-
30373012
/** Convert a default value for ADD COLUMN.
30383013
30393014
@param heap Memory heap where allocated
@@ -3060,16 +3035,6 @@ innobase_build_col_map_add(
30603035

30613036
const byte* mysql_data = field->ptr;
30623037

3063-
if (dfield_get_type(dfield)->mtype == DATA_POINT) {
3064-
/** If the DATA_POINT field is NOT NULL, we need to
3065-
give it a default value, since DATA_POINT is a fixed length
3066-
type, we couldn't store a value of length 0, like other
3067-
geom types. Server doesn't provide the default value, and
3068-
we would use POINT(0 0) here instead. */
3069-
3070-
mysql_data = innobase_build_default_mysql_point(heap, size);
3071-
}
3072-
30733038
row_mysql_store_col_in_innobase_format(
30743039
dfield, buf, true, mysql_data, size, comp);
30753040
}
@@ -4703,12 +4668,6 @@ prepare_inplace_alter_table_dict(
47034668

47044669
}
47054670

4706-
if (col_type == DATA_POINT) {
4707-
/* DATA_POINT should be of fixed length,
4708-
instead of the pack_length(blob length). */
4709-
col_len = DATA_POINT_LEN;
4710-
}
4711-
47124671
if (dict_col_name_is_reserved(field->field_name)) {
47134672
dict_mem_table_free(ctx->new_table);
47144673
my_error(ER_WRONG_COLUMN_NAME, MYF(0),

storage/innobase/include/data0type.h

Lines changed: 6 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -77,28 +77,18 @@ binary strings */
7777
charset-collation for tables created with it
7878
can also be latin1_swedish_ci */
7979

80-
/* DATA_POINT&DATA_VAR_POINT are for standard geometry datatype 'point' and
81-
DATA_GEOMETRY include all other standard geometry datatypes as described in
82-
OGC standard(line_string, polygon, multi_point, multi_polygon,
80+
/* DATA_GEOMETRY includes all standard geometry datatypes as described in
81+
OGC standard(point, line_string, polygon, multi_point, multi_polygon,
8382
multi_line_string, geometry_collection, geometry).
8483
Currently, geometry data is stored in the standard Well-Known Binary(WKB)
8584
format (http://www.opengeospatial.org/standards/sfa).
86-
We use BLOB as underlying datatype for DATA_GEOMETRY and DATA_VAR_POINT
87-
while CHAR for DATA_POINT */
85+
We use BLOB as the underlying datatype. */
8886
#define DATA_GEOMETRY 14 /* geometry datatype of variable length */
89-
/* The following two are disabled temporarily, we won't create them in
90-
get_innobase_type_from_mysql_type().
91-
TODO: We will enable DATA_POINT/them when we come to the fixed-length POINT
92-
again. */
93-
#define DATA_POINT 15 /* geometry datatype of fixed length POINT */
94-
#define DATA_VAR_POINT 16 /* geometry datatype of variable length
95-
POINT, used when we want to store POINT
96-
as BLOB internally */
9787
#define DATA_MTYPE_MAX 63 /* dtype_store_for_order_and_null_size()
9888
requires the values are <= 63 */
9989

10090
#define DATA_MTYPE_CURRENT_MIN DATA_VARCHAR /* minimum value of mtype */
101-
#define DATA_MTYPE_CURRENT_MAX DATA_VAR_POINT /* maximum value of mtype */
91+
#define DATA_MTYPE_CURRENT_MAX DATA_GEOMETRY /* maximum value of mtype */
10292
/*-------------------------------------------*/
10393
/* The 'PRECISE TYPE' of a column */
10494
/*
@@ -211,15 +201,6 @@ store the charset-collation number; one byte is left unused, though */
211201
/* Maximum multi-byte character length in bytes, plus 1 */
212202
#define DATA_MBMAX 5
213203

214-
/* For DATA_POINT of dimension 2, the length of value in btree is always 25,
215-
which is the summary of:
216-
SRID_SIZE(4) + WKB_HEADER_SIZE(1+4) + POINT_DATA_SIZE(8*2).
217-
So the length of physical record or POINT KEYs on btree are 25.
218-
GIS_TODO: When we support multi-dimensions DATA_POINT, we should get the
219-
length from corresponding column or index definition, instead of this MACRO
220-
*/
221-
#define DATA_POINT_LEN 25
222-
223204
/* Pack mbminlen, mbmaxlen to mbminmaxlen. */
224205
#define DATA_MBMINMAXLEN(mbminlen, mbmaxlen) \
225206
unsigned((mbmaxlen) * DATA_MBMAX + (mbminlen))
@@ -229,18 +210,12 @@ length from corresponding column or index definition, instead of this MACRO
229210
/* Get mbmaxlen from mbminmaxlen. */
230211
#define DATA_MBMAXLEN(mbminmaxlen) unsigned((mbminmaxlen) / DATA_MBMAX)
231212

232-
/* For checking if a geom_type is POINT */
233-
#define DATA_POINT_MTYPE(mtype) ((mtype) == DATA_POINT \
234-
|| (mtype) == DATA_VAR_POINT)
235-
236213
/* For checking if mtype is GEOMETRY datatype */
237-
#define DATA_GEOMETRY_MTYPE(mtype) (DATA_POINT_MTYPE(mtype) \
238-
|| (mtype) == DATA_GEOMETRY)
214+
#define DATA_GEOMETRY_MTYPE(mtype) ((mtype) == DATA_GEOMETRY)
239215

240216
/* For checking if mtype is BLOB or GEOMETRY, since we use BLOB as
241-
the underling datatype of GEOMETRY(not DATA_POINT) data. */
217+
the underlying datatype of GEOMETRY data. */
242218
#define DATA_LARGE_MTYPE(mtype) ((mtype) == DATA_BLOB \
243-
|| (mtype) == DATA_VAR_POINT \
244219
|| (mtype) == DATA_GEOMETRY)
245220

246221
/* For checking if data type is big length data type. */

storage/innobase/include/data0type.ic

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,6 @@ dtype_get_fixed_size_low(
504504
case DATA_INT:
505505
case DATA_FLOAT:
506506
case DATA_DOUBLE:
507-
case DATA_POINT:
508507
return(len);
509508
case DATA_MYSQL:
510509
if (prtype & DATA_BINARY_TYPE) {
@@ -533,7 +532,6 @@ dtype_get_fixed_size_low(
533532
case DATA_BINARY:
534533
case DATA_DECIMAL:
535534
case DATA_VARMYSQL:
536-
case DATA_VAR_POINT:
537535
case DATA_GEOMETRY:
538536
case DATA_BLOB:
539537
return(0);
@@ -580,7 +578,6 @@ dtype_get_min_size_low(
580578
case DATA_INT:
581579
case DATA_FLOAT:
582580
case DATA_DOUBLE:
583-
case DATA_POINT:
584581
return(len);
585582
case DATA_MYSQL:
586583
if (prtype & DATA_BINARY_TYPE) {
@@ -603,7 +600,6 @@ dtype_get_min_size_low(
603600
case DATA_BINARY:
604601
case DATA_DECIMAL:
605602
case DATA_VARMYSQL:
606-
case DATA_VAR_POINT:
607603
case DATA_GEOMETRY:
608604
case DATA_BLOB:
609605
return(0);
@@ -637,9 +633,7 @@ dtype_get_max_size_low(
637633
case DATA_BINARY:
638634
case DATA_DECIMAL:
639635
case DATA_VARMYSQL:
640-
case DATA_POINT:
641636
return(len);
642-
case DATA_VAR_POINT:
643637
case DATA_GEOMETRY:
644638
case DATA_BLOB:
645639
break;

storage/innobase/include/row0mysql.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -681,12 +681,6 @@ struct row_prebuilt_t {
681681
not to be confused with InnoDB
682682
externally stored columns
683683
(VARCHAR can be off-page too) */
684-
unsigned templ_contains_fixed_point:1;/*!< TRUE if the
685-
template contains a column with
686-
DATA_POINT. Since InnoDB regards
687-
DATA_POINT as non-BLOB type, the
688-
templ_contains_blob can't tell us
689-
if there is DATA_POINT */
690684
mysql_row_templ_t* mysql_template;/*!< template used to transform
691685
rows fast between MySQL and Innobase
692686
formats; memory for this template

storage/innobase/rem/rem0cmp.cc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,6 @@ cmp_whole_field(
378378
case DATA_MYSQL:
379379
return(innobase_mysql_cmp(prtype,
380380
a, a_length, b, b_length));
381-
case DATA_POINT:
382-
case DATA_VAR_POINT:
383381
case DATA_GEOMETRY:
384382
return(cmp_geometry_field(mtype, prtype, a, a_length, b,
385383
b_length));
@@ -437,11 +435,6 @@ cmp_data(
437435
case DATA_SYS:
438436
pad = ULINT_UNDEFINED;
439437
break;
440-
case DATA_POINT:
441-
case DATA_VAR_POINT:
442-
/* Since DATA_POINT has a fixed length of DATA_POINT_LEN,
443-
currently, pad is not needed. Meanwhile, DATA_VAR_POINT acts
444-
the same as DATA_GEOMETRY */
445438
case DATA_GEOMETRY:
446439
ut_ad(prtype & DATA_BINARY_TYPE);
447440
pad = ULINT_UNDEFINED;

storage/innobase/rem/rem0rec.cc

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,6 @@ rec_init_offsets_comp_ordinary(
308308

309309
if (!field->fixed_len
310310
|| (temp && !dict_col_get_fixed_size(col, temp))) {
311-
ut_ad(col->mtype != DATA_POINT);
312311
/* Variable-length field: read the length */
313312
len = *lens--;
314313
/* If the maximum length of the field is up
@@ -445,9 +444,6 @@ rec_init_offsets(
445444
if (UNIV_UNLIKELY(!field->fixed_len)) {
446445
const dict_col_t* col
447446
= dict_field_get_col(field);
448-
/* DATA_POINT should always be a fixed
449-
length column. */
450-
ut_ad(col->mtype != DATA_POINT);
451447
/* Variable-length field: read the length */
452448
len = *lens--;
453449
/* If the maximum length of the field
@@ -858,8 +854,6 @@ rec_get_converted_size_comp_prefix_low(
858854
}
859855

860856
ut_ad(len <= col->len || DATA_LARGE_MTYPE(col->mtype)
861-
|| (DATA_POINT_MTYPE(col->mtype)
862-
&& len == DATA_MBR_LEN)
863857
|| (col->len == 0 && col->mtype == DATA_VARCHAR));
864858

865859
fixed_len = field->fixed_len;
@@ -1337,8 +1331,6 @@ rec_convert_dtuple_to_rec_comp(
13371331
*lens-- = (byte) (len >> 8) | 0xc0;
13381332
*lens-- = (byte) len;
13391333
} else {
1340-
/* DATA_POINT would have a fixed_len */
1341-
ut_ad(dtype_get_mtype(type) != DATA_POINT);
13421334
ut_ad(len <= dtype_get_len(type)
13431335
|| DATA_LARGE_MTYPE(dtype_get_mtype(type))
13441336
|| !strcmp(index->name,

0 commit comments

Comments
 (0)