Moving Item_func_spatial_rel from Item_bool_func to Item_bool_func2.
to make OP(const,field) use indexes.
- MBR functions supported OP(const,field) optimization in 10.0,
but were inintentionally broken in an earlier 10.1 change that introduced
a common parent for Item_func_spatial_mbr_rel and Item_func_spatial_precise_rel.
- Precise functions never supported optimization for OP(const,field).
Now both MBR and precise functions support OP(const,field) optimization.
includes:
* remove some remnants of "Bug#14521864: MYSQL 5.1 TO 5.5 BUGS PARTITIONING"
* introduce LOCK_share, now LOCK_ha_data is strictly for engines
* rea_create_table() always creates .par file (even in "frm-only" mode)
* fix a 5.6 bug, temp file leak on dummy ALTER TABLE
get_mm_leaf function can store all sorts of spatial features in
one type of field it receives from an Item_field.
So we just allow that by setting the type of this field to GEOMETRY.
per-file comments:
mysql-test/r/gis-rtree.result
result updated
mysql-test/t/gis-rtree.test
test case added.
sql/opt_range.cc
set geom_type=GEOMETRY if we got Field_geom.
Optimizator fails using index with ST_Within(g, constant_poly).
per-file comments:
mysql-test/r/gis-rt-precise.result
test result fixed.
mysql-test/r/gis-rtree.result
test result fixed.
mysql-test/suite/maria/r/maria-gis-rtree-dynamic.result
test result fixed.
mysql-test/suite/maria/r/maria-gis-rtree-trans.result
test result fixed.
mysql-test/suite/maria/r/maria-gis-rtree.result
test result fixed.
storage/maria/ma_rt_index.c
Use MBR_INTERSECT mode when optimizing the select WITH ST_Within.
storage/myisam/rt_index.c
Use MBR_INTERSECT mode when optimizing the select WITH ST_Within.
Problem: in case of wrong data insert into indexed GEOMETRY fields
(e.g. NULL value for a not NULL field) MyISAM reported
"ERROR 126 (HY000): Incorrect key file for table; try to repair it"
due to misuse of the key deletion function.
Fix: always use R-tree key functions for R-tree based indexes
and B-tree key functions for B-tree based indexes.
mysql-test/r/gis-rtree.result:
Bug#11764487: myisam corruption with insert ignore and invalid spatial data
- test result.
mysql-test/t/gis-rtree.test:
Bug#11764487: myisam corruption with insert ignore and invalid spatial data
- test case.
storage/myisam/mi_update.c:
Bug#11764487: myisam corruption with insert ignore and invalid spatial data
- handling update errors check for HA_ERR_NULL_IN_SPATIAL as well to be
consistent with mi_write();
- always use keyinfo->ck_delete()/ck_insert() instead of _mi_ck_delete()/_mi_ck_write()
to handle index properly, as it may be of B-tree or R-tree type.
storage/myisam/mi_write.c:
Bug#11764487: myisam corruption with insert ignore and invalid spatial data
- always use keyinfo->ck_delete() instead of _mi_ck_delete() to handle
index properly, as it may be of B-tree or R-tree type.
Invalid memory read if HANDLER ... READ NEXT is executed
after failed (e.g. empty table) HANDLER ... READ FIRST.
The problem was that we attempted to perform READ NEXT,
whereas there is no pivot available from failed READ FIRST.
With this fix READ NEXT after failed READ FIRST equals
to READ FIRST.
This bug affects MyISAM tables only.
mysql-test/r/gis-rtree.result:
Restore a test case for BUG51357.
mysql-test/r/handler_myisam.result:
A test case for BUG#51877.
mysql-test/t/gis-rtree.test:
Restore a test case for BUG51357.
mysql-test/t/handler_myisam.test:
A test case for BUG#51877.
storage/myisam/mi_rnext.c:
"search first" failed. This means we have no pivot for
"search next", or in other words MI_INFO::lastkey is
likely uninitialized.
Normally SQL layer would never request "search next" if
"search first" failed. But HANDLER may do anything.
As mi_rnext() without preceeding mi_rkey()/mi_rfirst()
equals to mi_rfirst(), we must restore original state
as if failing mi_rfirst() was not called.
Spatial indexes were not checking for out-of-record condition in
the handler next command when the previous command didn't found
rows.
Fixed by making the rtree index to check for end of rows condition
before re-using the key from the previous search.
Fixed another crash if the tree has changed since the last search.
Added a test case for the other error.
- Moved some code from innodb_plugin to xtradb, to ensure that all tests runs
- Did changes in pbxt and maria storage engines becasue of changes in thd->query
- Reverted wrong code in sql_table.cc for how ROW_FORMAT is used.
This is a re-commit of Monty's merge to eliminate an extra commit from
MySQL-5.1.42 that was accidentally included in the merge.
This is a merge of the MySQL 5.1.41 clone-off (clone-5.1.41-build). In
case there are any extra changes done before final MySQL 5.1.41
release, these will need to be merged later before MariaDB 5.1.41
release.
Problem: involving a spatial index for "non-spatial" queries
(that don't containt MBRXXX() functions) may lead to failed assert.
Fix: don't use spatial indexes in such cases.
mysql-test/r/gis-rtree.result:
Fix for bug#48258: Assertion failed when using a spatial index
- test result.
mysql-test/t/gis-rtree.test:
Fix for bug#48258: Assertion failed when using a spatial index
- test case.
sql/opt_range.cc:
Fix for bug#48258: Assertion failed when using a spatial index
- allow only spatial functions (MBRXXX) for itMBR keyparts.
the Point() and Linestring() functions create WKB representation of an
object instead of an real geometry object.
That produced bugs when these were inserted into tables.
GIS tests fixed accordingly.
per-file messages:
mysql-test/r/gis-rtree.result
Bug#38990 Arbitrary data input plus GIS functions causes mysql server crash
test result
mysql-test/r/gis.result
Bug#38990 Arbitrary data input plus GIS functions causes mysql server crash
test result
mysql-test/t/gis-rtree.test
Bug#38990 Arbitrary data input plus GIS functions causes mysql server crash
test fixed - GeomFromWKB invocations removed
mysql-test/t/gis.test
Bug#38990 Arbitrary data input plus GIS functions causes mysql server crash
test fixed - AsWKB invocations added
sql/item_geofunc.cc
Bug#38990 Arbitrary data input plus GIS functions causes mysql server crash
Point() and similar functions to create a proper object
Fixed the usage of spatial data (and Point in specific) with
non-spatial indexes.
Several problems :
- The length of the Point class was not updated to include the
spatial reference system identifier. Fixed by increasing with 4
bytes.
- The storage length of the spatial columns was not accounting for
the length that is prepended to it. Fixed by treating the
spatial data columns as blobs (and thus increasing the storage
length)
- When creating the key image for comparison in index read wrong
key image was created (the one needed for and r-tree search,
not the one for b-tree/other search). Fixed by treating the
spatial data columns as blobs (and creating the correct kind of
image based on the index type).
mysql-test/r/bdb_gis.result:
Bug #30825: bdb tests
mysql-test/r/gis-rtree.result:
Bug #30825: key length changed
mysql-test/r/gis.result:
Bug #30825: MyISAM tests
mysql-test/r/innodb_gis.result:
Bug #30825: InnoDB tests
mysql-test/t/bdb_gis.test:
Bug #30825: bdb tests
mysql-test/t/gis.test:
Bug #30825: MyISAM tests
mysql-test/t/innodb_gis.test:
Bug #30825: InnoDB tests
sql/field.cc:
Bug #30825: Removed Field_geom::get_key_image as Field_blog::get_key_image
takes type parameter into consideration and is a superset of
Field_geom::get_key_image()
sql/field.h:
Bug #30825: Removed Field_geom::get_key_image as Field_blog::get_key_image
takes type parameter into consideration and is a superset of
Field_geom::get_key_image()
sql/sql_select.h:
Bug #30825: Geometry data are a blob derivate
sql/sql_table.cc:
Bug #30825: Increased key length to accomodate for
spatial reference system identifier (srid)
sql/sql_yacc.yy:
Bug #30825: Increased key length to accomodate for
spatial reference system identifier (srid)
sql/table.cc:
Bug #30825: It stores a length for spatial data
as well, so increase the storage length (as it's
done for blobs).
mysql-test/include/gis_keys.inc:
Bug #30825: Test file for spatial data and non-spatial indexes
into mysql.com:/home/hf/work/30286/my51-30286
mysql-test/r/gis-rtree.result:
Auto merged
mysql-test/t/gis-rtree.test:
Auto merged
storage/myisam/rt_index.c:
Auto merged
storage/myisam/rt_mbr.c:
Auto merged
into mysql.com:/home/hf/work/30286/my50-30286
myisam/rt_index.c:
Auto merged
myisam/rt_mbr.c:
Auto merged
mysql-test/t/gis-rtree.test:
Auto merged
mysql-test/r/gis-rtree.result:
merging
As the result of DOUBLE claculations can be bigger
than DBL_MAX constant we use in code, we shouldn't use this constatn
as a biggest possible value.
Particularly the rtree_pick_key function set 'min_area= DBL_MAX' relying
that any rtree_area_increase result will be less so we return valid
key. Though in rtree_area_increase function we calculate the area
of the rectangle, so the result can be 'inf' if the rectangle is
huge enough, which is bigger than DBL_MAX.
Code of the rtree_pick_key modified so we always return a valid key.
myisam/rt_index.c:
Bug #30286 spatial index cause corruption and server crash!
always set the best_key with the first key we get, so we always return
somthing valid.
myisam/rt_mbr.c:
Bug #30286 spatial index cause corruption and server crash!
function comment extended
mysql-test/r/gis-rtree.result:
Bug #30286 spatial index cause corruption and server crash!
test result
mysql-test/t/gis-rtree.test:
Bug #30286 spatial index cause corruption and server crash!
test case
into magare.gmz:/home/kgeorge/mysql/work/B29325-merge-5.1-opt
client/mysql.cc:
Auto merged
include/my_base.h:
Auto merged
mysql-test/r/ctype_collate.result:
Auto merged
mysql-test/r/gis-rtree.result:
Auto merged
mysql-test/t/gis-rtree.test:
Auto merged
storage/myisam/mi_create.c:
Auto merged
strings/ctype-simple.c:
Auto merged
mysys/my_conio.c:
5.0-opt -> 5.1.-opt merge
storage/myisam/sp_key.c:
5.0-opt -> 5.1.-opt merge
1. Threat MBR for a key as double[] and convert it only
when about to store it on disk.
2. Remove the redundant function get_double().
myisam/sp_key.c:
Bug #29070:
1. threat MBR for a key as double[] and convert it only
when about to store it on disk.
2. remove the redundant function get_double()
mysql-test/r/gis-rtree.result:
Bug #29070: test case
mysql-test/t/gis-rtree.test:
Bug #29070: test case
into mysql.com:/home/hf/work/mrg/mysql-5.1-opt
mysql-test/r/gis-rtree.result:
Auto merged
mysql-test/t/gis-rtree.test:
Auto merged
sql/sql_parse.cc:
Auto merged
storage/myisam/ha_myisam.cc:
Auto merged
It was syntactically correct to define
spatial keys over parts of columns (e.g.
ALTER TABLE t1 ADD x GEOMETRY NOT NULL,
ADD SPATIAL KEY (x(32))).
This may lead to undefined results and/or
interpretation.
Fixed by not allowing partial column
specification in a SPATIAL index definition.
mysql-test/r/alter_table.result:
Bug #26794: 5.1 part
test case
mysql-test/r/gis-rtree.result:
Bug #26794: 5.1 part
updated the tests to the new syntax
mysql-test/t/alter_table.test:
Bug #26794: 5.1 part
test case
mysql-test/t/gis-rtree.test:
Bug #26794: 5.1 part
updated the tests to the new syntax
sql/sql_table.cc:
Bug #26794: 5.1 part
Disable defining SPATIAL KEYS with sub-key parts
Different set of conditions is used to verify
the validity of index definitions over a GEOMETRY
column in ALTER TABLE and CREATE TABLE.
The difference was on how sub-keys notion validity
is checked.
Fixed by extending the CREATE TABLE condition to
support the cases allowed in ALTER TABLE.
Made the SHOW CREATE TABLE not to display spatial
indexes using the sub-key notion.
mysql-test/r/alter_table.result:
Bug #26794: test case
mysql-test/r/gis-rtree.result:
Bug #26794: fixed SHOW CREATE TABLE output.
mysql-test/t/alter_table.test:
Bug #26794: test case
sql/field.cc:
Bug #26794: Allow sub-keys for GEOMETRY
sql/sql_show.cc:
Bug #26794: Don't show sub-key notion
in SHOW CREATE TABLE for SPATIAL indexes.
sql/sql_table.cc:
Bug #26794: Allow sub-keys for GEOMETRY
into magare.gmz:/home/kgeorge/mysql/work/B26794-5.1-opt
mysql-test/r/gis-rtree.result:
Auto merged
sql/field.cc:
Auto merged
sql/sql_show.cc:
Auto merged
sql/sql_table.cc:
Auto merged
mysql-test/r/alter_table.result:
tests merge
mysql-test/t/alter_table.test:
tests merge
Different set of conditions is used to verify
the validity of index definitions over a GEOMETRY
column in ALTER TABLE and CREATE TABLE.
The difference was on how sub-keys notion validity
is checked.
Fixed by extending the CREATE TABLE condition to
support the cases allowed in ALTER TABLE.
Made the SHOW CREATE TABLE not to display spatial
indexes using the sub-key notion.
mysql-test/r/alter_table.result:
Bug #26794: test case
mysql-test/r/gis-rtree.result:
Bug #26794: fixed SHOW CREATE TABLE output.
mysql-test/t/alter_table.test:
Bug #26794: test case
sql/field.cc:
Bug #26794: Allow sub-keys for GEOMETRY
sql/sql_show.cc:
Bug #26794: Don't show sub-key notion
in SHOW CREATE TABLE for SPATIAL indexes.
sql/sql_table.cc:
Bug #26794: Allow sub-keys for GEOMETRY
into chilla.local:/home/mydev/mysql-5.1-bug25673
mysql-test/r/gis-rtree.result:
Auto merged
mysql-test/t/gis-rtree.test:
Auto merged
storage/myisam/rt_index.c:
Auto merged
storage/myisam/rt_key.c:
Auto merged
storage/myisam/rt_split.c:
Auto merged
into chilla.local:/home/mydev/mysql-5.0-bug25673
myisam/rt_index.c:
Auto merged
myisam/rt_key.c:
Auto merged
mysql-test/t/gis-rtree.test:
Auto merged
myisam/rt_split.c:
Bug#25673 - spatial index corruption, error 126 incorrect key file for table
Manual merge from 4.1
mysql-test/r/gis-rtree.result:
Bug#25673 - spatial index corruption, error 126 incorrect key file for table
Manual merge from 4.1
incorrect key file for table
In certain cases it could happen that deleting a row could
corrupt an RTREE index.
According to Guttman's algorithm, page underflow is handled
by storing the page in a list for later re-insertion. The
keys from the stored pages have to be inserted into the
remaining pages of the same level of the tree. Hence the
level number is stored in the re-insertion list together
with the page.
In the MySQL RTree implementation the level counts from zero
at the root page, increasing numbers for levels down the tree.
If during re-insertion of the keys the tree height grows, all
level numbers become invalid. The remaining keys will be
inserted at the wrong level.
The fix is to increment the level numbers stored in the
reinsert list after a split of the root block during reinsertion.
myisam/rt_index.c:
Bug#25673 - spatial index corruption, error 126
incorrect key file for table
Added a loop in rtree_delete() to increment the level numbers
stored in the reinsert list after a split of the root block
during reinsertion.
Added comments and DBUG statements.
myisam/rt_key.c:
Bug#25673 - spatial index corruption, error 126
incorrect key file for table
Added DBUG statements.
myisam/rt_split.c:
Bug#25673 - spatial index corruption, error 126
incorrect key file for table
Added DBUG statements.
mysql-test/r/gis-rtree.result:
Bug#25673 - spatial index corruption, error 126
incorrect key file for table
Added the test result.
mysql-test/t/gis-rtree.test:
Bug#25673 - spatial index corruption, error 126
incorrect key file for table
Added a test.
into macbook.local:/Users/kgeorge/mysql/work/merge-5.1-opt
mysql-test/r/distinct.result:
Auto merged
mysql-test/r/gis-rtree.result:
Auto merged
mysql-test/r/ps.result:
Auto merged
mysql-test/r/subselect.result:
Auto merged
mysql-test/r/udf.result:
Auto merged
mysql-test/t/gis-rtree.test:
Auto merged
mysql-test/t/ps.test:
Auto merged
mysql-test/t/subselect.test:
Auto merged
mysql-test/t/udf.test:
Auto merged
sql/item_subselect.cc:
Auto merged
sql/item_subselect.h:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_select.cc:
Auto merged
storage/myisam/mi_check.c:
Auto merged
sql/sql_udf.cc:
SCCS merged
spatial index
While executing OPTIMIZE TABLE on MyISAM tables the server re-creates the
index file(s) in order to sort them physically by the key. This cannot be
done for R-tree indexes as it makes no sense.
The server was not checking the type of the index and was accessing an
R-tree index as if it was a B-tree.
Fixed by preventing sorting the index file if it contains an R-tree index.
myisam/mi_check.c:
Bug #23578: Corruption prevents Optimize table from working properly with a
spatial index
- disable sorting the index file if it contains an R-tree index.
mysql-test/r/gis-rtree.result:
Bug #23578: Corruption prevents Optimize table from working properly with a
spatial index
- test case
mysql-test/t/gis-rtree.test:
Bug #23578: Corruption prevents Optimize table from working properly with a
spatial index
- test case
into mysql.com:/home/hf/work/21790/my51-21790
mysql-test/t/gis-rtree.test:
Auto merged
sql/handler.cc:
Auto merged
mysql-test/r/gis-rtree.result:
merging
We issued UNKNOWN ERROR initially in this place and forgot to
fix it when we implemented informative error message for this
mysql-test/r/gis-rtree.result:
test result
mysql-test/t/gis-rtree.test:
test case
sql/handler.cc:
let's issue informative error message here