summaryrefslogtreecommitdiff
path: root/sql/gcalc_tools.cc
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2011-09-04 23:48:17 +0500
committerAlexey Botchkov <holyfoot@askmonty.org>2011-09-04 23:48:17 +0500
commit6dfa30e938babc2cac59f2d5eac1f4d46a361b93 (patch)
tree7f217d1026f46a6bf52c8cbe3f884cbd4cf12b6b /sql/gcalc_tools.cc
parenteefff87652cde1cb0c986fd167ed057e87230250 (diff)
downloadmariadb-git-6dfa30e938babc2cac59f2d5eac1f4d46a361b93.tar.gz
bug 839341 100% CPU usage with ST_UNION in maria-5.3-gis.
Line loops weren't recognized when collect results. Fixed by checking if we got the same beginning point of the line. per-file comments: mysql-test/r/gis-precise.result bug 839341 100% CPU usage with ST_UNION in maria-5.3-gis. test result updated. mysql-test/t/gis-precise.test bug 839341 100% CPU usage with ST_UNION in maria-5.3-gis. test case added. sql/gcalc_tools.cc bug 839341 100% CPU usage with ST_UNION in maria-5.3-gis. check if we get the beginning node of the linestring, then cut the loop.
Diffstat (limited to 'sql/gcalc_tools.cc')
-rw-r--r--sql/gcalc_tools.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/sql/gcalc_tools.cc b/sql/gcalc_tools.cc
index 0d5c1c52d61..e502d54a160 100644
--- a/sql/gcalc_tools.cc
+++ b/sql/gcalc_tools.cc
@@ -1158,6 +1158,7 @@ int Gcalc_operation_reducer::get_line_result(res_point *cur,
Gcalc_result_receiver *storage)
{
res_point *next;
+ res_point *cur_orig= cur;
int move_upward= 1;
if (cur->glue)
{
@@ -1171,6 +1172,14 @@ int Gcalc_operation_reducer::get_line_result(res_point *cur,
if (!next)
{
next= cur->glue;
+ if (next == cur_orig)
+ {
+ /* It's the line loop */
+ cur= cur_orig;
+ cur->glue->glue= NULL;
+ move_upward= 1;
+ break;
+ }
move_upward^= 1;
}
}