From d569cff98f8237c731f6fa8fdd2cdff85459d3f9 Mon Sep 17 00:00:00 2001 From: Oleksandr Kovtunenko Date: Tue, 8 Jan 2019 11:58:35 +0200 Subject: [PATCH 1/9] try to Fix MXS-2206 (#185) * try to Fix MXS-2206 * use sort -v * return empty line --- BUILD/install_build_deps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILD/install_build_deps.sh b/BUILD/install_build_deps.sh index 8ea0bc45f..df67add78 100755 --- a/BUILD/install_build_deps.sh +++ b/BUILD/install_build_deps.sh @@ -89,7 +89,7 @@ fi sudo tar xzf cmake-3.7.1-Linux-x86_64.tar.gz -C /usr/ --strip-components=1 cmake_version=`cmake --version | grep "cmake version" | awk '{ print $3 }'` -if [ "$cmake_version" \< "3.7.1" ] ; then +if [ "`echo -e "3.7.1\n$cmake_version"|sort -V|head -n 1`" != "3.7.1" ] ; then echo "cmake does not work! Trying to build from source" wget -q https://cmake.org/files/v3.7/cmake-3.7.1.tar.gz --no-check-certificate tar xzf cmake-3.7.1.tar.gz From f94ddadc18b34714aa3af4eb487513905f555c99 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Tue, 8 Jan 2019 15:13:20 +0200 Subject: [PATCH 2/9] MXS-2242 Add test that reveals problem --- query_classifier/test/maxscale.test | 3 +++ 1 file changed, 3 insertions(+) diff --git a/query_classifier/test/maxscale.test b/query_classifier/test/maxscale.test index bb9cdf905..693961846 100644 --- a/query_classifier/test/maxscale.test +++ b/query_classifier/test/maxscale.test @@ -115,3 +115,6 @@ PREPARE a FROM @sql; # MXS-2207 SET STATEMENT max_statement_time=30 FOR UPDATE tbl SET a = 42; + +# MXS-2242 +SELECT X(coordinates), Y(coordinates), ST_X(coordinates), ST_Y(coordinates) FROM data; From 2895f361d9a7a27ec6cd48dfac0d79522cb300c8 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Tue, 8 Jan 2019 15:14:15 +0200 Subject: [PATCH 3/9] MXS-2242 Add change that fixes the problem A whole slew of missing builtin functions were added, not just the ones directly relevant for MXS-2242. --- .../qc_sqlite/builtin_functions.c | 115 ++++++++++++++++-- 1 file changed, 107 insertions(+), 8 deletions(-) diff --git a/query_classifier/qc_sqlite/builtin_functions.c b/query_classifier/qc_sqlite/builtin_functions.c index 7839441ed..7e0458cd4 100644 --- a/query_classifier/qc_sqlite/builtin_functions.c +++ b/query_classifier/qc_sqlite/builtin_functions.c @@ -187,25 +187,124 @@ static const char* BUILTIN_FUNCTIONS[] = // Geometry Properties // https://mariadb.com/kb/en/mariadb/geometry-properties/ - // TODO + "boundary", + "dimension", + "envelope", + "geometryn", + "geometrytype", + "isclosed", + "isempty", + "isring", + "issimple", + "numgeometries", + "srid", + "st_boundary", + "st_dimension", + "st_envelope", + "st_geometryn", + "st_geometrytype", + "st_isclosed", + "st_isempty", + "st_isring", + "st_issimple", + "st_numgeometries", + "st_relate", + "st_srid", // Geometry Relations - // TODO + // https://mariadb.com/kb/en/library/geometry-relations/ + "contains", + "crosses", + "disjoint", + "equals", + "intersects", + "overlaps", + "st_contains", + "st_crosses", + "st_difference", + "st_disjoint", + "st_distance", + "st_equals", + "st_intersects", + "st_length", + "st_overlaps", + "st_touches", + "st_within", + "touches", + "within", // LineString Properties - // TODO + // https://mariadb.com/kb/en/library/linestring-properties/ + "endpoint", + "glength", + "numpoints", + "pointn", + "startpoint", + "st_endpoint", + "st_numpoints", + "st_pointn", + "st_startpoint", // MBR - // TODO + // https://mariadb.com/kb/en/library/mbr-minimum-bounding-rectangle/ + "mbrcontains", + "mbrdisjoint", + "mbrequal", + "mbrintersects", + "mbroverlaps", + "mbrtouches", + "mbrwithin", - // Point Propertoes - // TODO + // Point Properties + // https://mariadb.com/kb/en/library/point-properties/ + "st_x", + "st_y", + "x", + "y", // Polygon Properties - // TODO + // https://mariadb.com/kb/en/library/polygon-properties/ + "area", + "centroid", + "exteriorring", + "interiorringn", + "numinteriorrings", + "st_area", + "st_centroid", + "st_exteriorring", + "st_interiorringn", + "st_numinteriorrings", // WKB - // TODO + // https://mariadb.com/kb/en/library/wkb/ + "asbinary", + "aswkb", + "mlinefromwkb", + "mpointfromwkb", + "mpolyfromwkb", + "geomcollfromwkb", + "geometrycollectionfromwkb", + "geometryfromwkb", + "geomfromwkb", + "linefromwkb", + "linestringfromwkb", + "multilinestringfromwkb", + "multipointfromwkb", + "multipolygonfromwkb", + "pointfromwkb", + "polyfromwkb", + "polygonfromwkb", + "st_asbinary", + "st_aswkb", + "st_geomcollfromwkb", + "st_geometrycollectionfromwkb", + "st_geometryfromwkb", + "st_geomfromwkb", + "st_linefromwkb", + "st_linestringfromwkb", + "st_pointfromwkb", + "st_polyfromwkb", + "st_polygonfromwkb", // WKT // https://mariadb.com/kb/en/mariadb/wkt/ From 9cba1bdc37cab22186a78f0ecfb64366bd8cca59 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Tue, 8 Jan 2019 15:58:20 +0200 Subject: [PATCH 4/9] Update release notes --- Documentation/Release-Notes/MaxScale-2.2.19-Release-Notes.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/Release-Notes/MaxScale-2.2.19-Release-Notes.md b/Documentation/Release-Notes/MaxScale-2.2.19-Release-Notes.md index 543b613f3..0b5d80166 100644 --- a/Documentation/Release-Notes/MaxScale-2.2.19-Release-Notes.md +++ b/Documentation/Release-Notes/MaxScale-2.2.19-Release-Notes.md @@ -10,6 +10,7 @@ report on [our Jira](https://jira.mariadb.org/projects/MXS). ## Bug fixes +* [MXS-2242](https://jira.mariadb.org/browse/MXS-2242) MaxScale does not recognize builtin read-only functions * [MXS-2238](https://jira.mariadb.org/browse/MXS-2238) MaxScale fails to send large CDC schemas * [MXS-2234](https://jira.mariadb.org/browse/MXS-2234) Add extra info to log when MaxScale loads persisted configuration files * [MXS-2232](https://jira.mariadb.org/browse/MXS-2232) version_string prefix 5.5.5- is always added From c0ebf663e3611374f5425634d4d0ce6ebd40830a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Thu, 22 Nov 2018 14:42:26 +0200 Subject: [PATCH 5/9] Make the error message a const char* const This prevents linker errors if the source files are used directly. --- connectors/cdc-connector/cdc_connector.cpp | 2 ++ connectors/cdc-connector/cdc_connector.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/connectors/cdc-connector/cdc_connector.cpp b/connectors/cdc-connector/cdc_connector.cpp index 6391aa3ae..a4b57abe6 100644 --- a/connectors/cdc-connector/cdc_connector.cpp +++ b/connectors/cdc-connector/cdc_connector.cpp @@ -169,6 +169,8 @@ template <> void Closer::close(int fd) namespace CDC { +const char* const TIMEOUT = "Request timed out"; + /** * Public functions */ diff --git a/connectors/cdc-connector/cdc_connector.h b/connectors/cdc-connector/cdc_connector.h index b44408d4a..48510853e 100644 --- a/connectors/cdc-connector/cdc_connector.h +++ b/connectors/cdc-connector/cdc_connector.h @@ -32,7 +32,7 @@ namespace CDC // The error strings returned by the getError library. These can be used to // check for the most common errors (which right now is only the timeout). -static const char* TIMEOUT = "Request timed out"; +extern const char* const TIMEOUT; // The typedef for the Row type class Row; From d9faea4979c454c2b3b8bb099140821f0234039c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Fri, 23 Nov 2018 22:58:34 +0200 Subject: [PATCH 6/9] Fix -Wshadow warnings The cdc_connector.h won't built with -Wshadow if the variable and method names match. --- connectors/cdc-connector/cdc_connector.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/connectors/cdc-connector/cdc_connector.h b/connectors/cdc-connector/cdc_connector.h index 48510853e..0899b9cbb 100644 --- a/connectors/cdc-connector/cdc_connector.h +++ b/connectors/cdc-connector/cdc_connector.h @@ -118,14 +118,14 @@ public: */ ValueMap fields() const { - ValueMap fields; + ValueMap flds; for (size_t i = 0; i < m_keys->size(); i++) { - fields[(*m_keys)[i]] = (*m_types)[i]; + flds[(*m_keys)[i]] = (*m_types)[i]; } - return fields; + return flds; } private: From a456168fd029aaea57be6fd3de58dec0fee4946d Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Tue, 8 Jan 2019 20:22:05 +0200 Subject: [PATCH 7/9] MXS-2248 Add test that reveals problem --- query_classifier/test/maxscale.test | 3 +++ 1 file changed, 3 insertions(+) diff --git a/query_classifier/test/maxscale.test b/query_classifier/test/maxscale.test index 693961846..9c8e9825e 100644 --- a/query_classifier/test/maxscale.test +++ b/query_classifier/test/maxscale.test @@ -118,3 +118,6 @@ SET STATEMENT max_statement_time=30 FOR UPDATE tbl SET a = 42; # MXS-2242 SELECT X(coordinates), Y(coordinates), ST_X(coordinates), ST_Y(coordinates) FROM data; + +# MXS-2248 +SELECT curdate() + interval '60' day; From e64b034334b42ece7282bdd28111b7b58db58ef5 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Tue, 8 Jan 2019 20:23:21 +0200 Subject: [PATCH 8/9] MXS-2248 Add change that fixes the problem Any kind of expression is legal after INTERVAL. --- query_classifier/qc_sqlite/sqlite-src-3110100/src/parse.y | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/query_classifier/qc_sqlite/sqlite-src-3110100/src/parse.y b/query_classifier/qc_sqlite/sqlite-src-3110100/src/parse.y index 9310d4d38..d6a8eab66 100644 --- a/query_classifier/qc_sqlite/sqlite-src-3110100/src/parse.y +++ b/query_classifier/qc_sqlite/sqlite-src-3110100/src/parse.y @@ -2110,10 +2110,10 @@ expr(A) ::= expr(X) BITAND|BITOR|LSHIFT|RSHIFT(OP) expr(Y). expr(A) ::= expr(X) PLUS|MINUS(OP) expr(Y). {spanBinaryExpr(&A,pParse,@OP,&X,&Y);} %ifdef MAXSCALE -expr(A) ::= INTERVAL INTEGER(X) id. { +expr(A) ::= INTERVAL expr(X) id. { // Here we could check that id is one of MICROSECOND, SECOND, MINUTE // HOUR, DAY, WEEK, etc. - spanExpr(&A, pParse, @X, &X); + A=X; // We simply ignore 'INTERVAL' } %endif expr(A) ::= expr(X) STAR|SLASH|REM(OP) expr(Y). From 27b3ab28e0bb9c01a8af374e2c004f6393836720 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Wed, 9 Jan 2019 09:13:07 +0200 Subject: [PATCH 9/9] Update 2.2.19 release notes --- Documentation/Release-Notes/MaxScale-2.2.19-Release-Notes.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/Release-Notes/MaxScale-2.2.19-Release-Notes.md b/Documentation/Release-Notes/MaxScale-2.2.19-Release-Notes.md index 0b5d80166..498339da5 100644 --- a/Documentation/Release-Notes/MaxScale-2.2.19-Release-Notes.md +++ b/Documentation/Release-Notes/MaxScale-2.2.19-Release-Notes.md @@ -10,6 +10,7 @@ report on [our Jira](https://jira.mariadb.org/projects/MXS). ## Bug fixes +* [MXS-2248](https://jira.mariadb.org/browse/MXS-2248) INSERT sent to all nodes * [MXS-2242](https://jira.mariadb.org/browse/MXS-2242) MaxScale does not recognize builtin read-only functions * [MXS-2238](https://jira.mariadb.org/browse/MXS-2238) MaxScale fails to send large CDC schemas * [MXS-2234](https://jira.mariadb.org/browse/MXS-2234) Add extra info to log when MaxScale loads persisted configuration files