777 Commits

Author SHA1 Message Date
Markus Mäkelä
c1f930d23d
Fix query classifier initialization data race
The initialization code does some modification to the global code
(something about a page cache) and causes warnings with TSAN.
2018-08-13 10:28:02 +03:00
Johan Wikman
f14380243b Rename cppdefs.hh to ccdefs.hh
For obvious reasons; the c++ suffix is .cc and not .cpp
2018-08-10 07:50:18 +03:00
Johan Wikman
f584b481eb MXS-1992 Add program for measuring cache performance
With this program it is possible to find out the difference in
performance between cached and non-cached query classification.
2018-08-01 11:10:34 +03:00
Johan Wikman
e7913cc022 MXS-1624 Update qc_setup() prototype
Now takes a structure that, if present, enables the query
classification caching and specifies the properties of the
cache.

For the time being no actual properties are yet available.
2018-07-06 12:12:31 +03:00
Johan Wikman
a044929661 MXS-1624 Allow the closing of an info object
If an info object can be dupped, it must also be possible to
close it.
2018-07-06 12:12:31 +03:00
Johan Wikman
295bae5673 MXS-1624 Implement qc_dup
Only for qc_sqlite.

After a second look qc_mysqlembedded will not support dupping
the statement information. Without additional changes, simply stashing
an info object away, parsing another new GWBUF, deleting that and
then using the stashed away info object will not work; the THD object
will be corrupted. As qc_mysqlembedded is _only_ used for verifying the
sqlite-based parser this is not important anyway.
2018-07-06 12:12:31 +03:00
Johan Wikman
4e168f36f7 MXS-1624 Make the QC info object explicit
The query classifier stores information about the statement carried
by a GWBUF in the GWBUF itself. We need to be able to store that
object out side the lifetime of the GWBUF. So, we require that a
query classifier is capable of duplicating references to that object.
2018-07-06 12:12:31 +03:00
Johan Wikman
cc0299aee6 Update change date of 2.3 2018-06-25 10:07:52 +03:00
Markus Mäkelä
75ddfe4c14
Merge branch '2.2' into develop 2018-06-21 14:02:00 +03:00
Johan Wikman
254084fc5e MXS-1935 Accept "PREPARE name FROM @var" 2018-06-21 12:51:47 +03:00
Johan Wikman
457d74f6b4 MXS-1935 Add test that exposes problem
"PREPARE a FROM @var" is not classified.
2018-06-21 12:51:47 +03:00
Johan Wikman
45bda0f72e MXS-1936 Make qc_mysqlembedded compatible with qc_sqlite
qc_mysqlembedded must also be updated to handle the new type
QUERY_TYPE_DEALLOC_PREPARE. Some adjustements were also needed
elsewhere.
2018-06-21 12:51:47 +03:00
Markus Mäkelä
8094c67ac2
Merge branch '2.2' into develop 2018-06-13 00:25:56 +03:00
Johan Wikman
d9100278b0 MXS-1719 Update qc test parser
The recent change to the qc_sqlite parser also requires some
modifications to the parser used for reading .test-files.
2018-06-12 17:35:49 +03:00
Johan Wikman
776f199d01 MXS-1719 Treat # comments the same way as -- comments
sqlite does not treat # as the start of a to-end-of-line
comment. It cannot trivially be treated as such because at
startup sqlite parses statements containing the #-character.
Thus, only after sqlite has been initialized can it be treated
the same way as --.
2018-06-12 17:35:49 +03:00
dapeng huang
cd136b11a7 MXS-1891: dealloc named prepare should route to all (#174)
* dealloc named prepare route to all

* add newline

* erase from ps manager too

* little refactor
2018-06-12 10:45:11 +03:00
Markus Mäkelä
4a3216d483
Merge branch '2.2' into develop 2018-06-04 16:00:19 +03:00
Markus Mäkelä
cddcc6d7d5
MXS-1896: Distinct LOAD DATA LOCAL INFILE from LOAD DATA INFILE
The two operations return different types of results and need to be
treated differently in order for them to be handled correctly in 2.2.

This fixes the unexpected internal state errors that happened in all 2.2
versions due to a wrong assumption made by readwritesplit. This fix is not
necessary for newer versions as the LOAD DATA LOCAL INFILE processing is
done with a simpler, and more robust, method.
2018-06-04 15:17:48 +03:00
Johan Wikman
765806a633 Merge branch '2.2' into develop 2018-05-18 13:40:27 +03:00
Johan Wikman
001ae8e29a MXS-1874 Handle SET STATEMENT ... FOR ...
The SET STATEMENT ... FOR part can be ignored and the type
of the statement be whatever the type of the part following
FOR is.
2018-05-18 12:35:44 +03:00
Johan Wikman
b12f037b24 MXS-1874 Fix leak in qc_mysqlembedded 2018-05-18 12:35:44 +03:00
Johan Wikman
f665125f1c MXS-1874 Add test that reveals problem 2018-05-18 12:35:44 +03:00
Johan Wikman
fd9e5af849 Merge branch '2.2' into develop 2018-04-26 13:23:32 +03:00
Johan Wikman
9cf44b3092 MXS-1829 Recognise PREVIOUS in addition to NEXT
Earlier only "SELECT NEXT VALUE FOR SEQ" was parsed
properly, while "SELECT PREVIOUS VALUE FOR SEQ" was not.
Now the latter statement is also parsed properly.
2018-04-26 13:14:23 +03:00
Johan Wikman
b2cc9e5107 MXS-1829 Add test that reveals problem 2018-04-26 12:44:30 +03:00
Markus Mäkelä
f4bdf3012d
Merge branch '2.2' into develop 2018-04-23 14:20:32 +03:00
Markus Mäkelä
d67320e06a
Fix more GCC 8 build failures
Fixed string truncation warnings by reducing max parameter lengths by one
where applicable. The binlogrouter filename lengths are slightly different
so using memcpy to work around the warnings is an adequate "solution"
until the root of the problem is solved.

Removed unnecessary CMake policy settings from qc_sqlite. Adding a
self-dependency on the source file of an external project has no effect
and only caused warnings to be logged.
2018-04-23 14:02:54 +03:00
Markus Mäkelä
ec33fcf87d
Merge branch '2.2' into develop 2018-04-13 14:53:00 +03:00
Johan Wikman
3d8d2beaaa MXS-1787 Provide alias map when parsing an expression list
A statement like "CALL p1((SELECT f1()), ?);" needs an collection
for storing aliases when being parsed.
2018-04-13 13:50:28 +03:00
Johan Wikman
94af85b948 MXS-1787 Add test that exposes problem 2018-04-13 13:50:28 +03:00
Johan Wikman
296bac45c1 Merge branch '2.2' into develop 2018-03-21 15:18:11 +02:00
Johan Wikman
5d54267d19 MXS-1730 Add change that fixes the problem
ENGINE is a keyword but not a reserved word, so it must
silently convert into an identifier if it is used in a
context where it cannot be used as a keyword.
2018-03-21 14:58:09 +02:00
Johan Wikman
9208d3a70c MXS-1730 Add test-case that reveals the problem 2018-03-21 14:57:35 +02:00
Johan Wikman
0e3874781f Fix merge breakage 2018-03-21 14:20:54 +02:00
Johan Wikman
a996ea58ef Merge branch '2.1' into 2.2 2018-03-21 13:27:51 +02:00
Johan Wikman
041b775150 MXS-1730 Add change that fixes the problem
ENGINE is a keyword but not a reserved word, so it must
silently convert into an identifier if it is used in a
context where it cannot be used as a keyword.
2018-03-21 13:25:06 +02:00
Johan Wikman
5be9a8d7f8 MXS-1730 Add test-case that reveals the problem 2018-03-21 13:25:06 +02:00
Markus Mäkelä
cb170eb88e
MXS-1702: Move canonicalization test into core
Moved the test into the core where it belongs.
2018-03-20 13:53:54 +02:00
Johan Wikman
39d3c42c94 Merge branch '2.1' into 2.2 2018-03-01 17:52:42 +02:00
Johan Wikman
0c206ff428 MXS-1688 Handle ...INTERVAL N <unit>
"INTERVAL N <unit>" is now handled as an expression in itself and
as asuch will cause both statements such as

  "SELECT '2008-12-31 23:59:59' + INTERVAL 1 SECOND;"

and

  "select id from db2.t1 where DATE_ADD("2017-06-15", INTERVAL 10 DAY) < "2017-06-15";"

to be handled correctly. The compare test program contains some
heuristic checking, as the the embedded parser will in all cases
report date manipulation as the use of the add_date_interval()
function.
2018-03-01 17:39:03 +02:00
Johan Wikman
b7cc793c40 MXS-1688 Add test that reveals DATE_ADD problem 2018-03-01 17:39:03 +02:00
Johan Wikman
9b36ba5e0a MXS-1677: Don't assume all queries are in text form
After a temporary table is created, readwritesplit will check whether a
query drops or targets that temporary table. The check for query type was
missing from the table dropping part of the code. The temporary table read
part was checking that the query is a text form query.

Added a debug assertion to the query parsing function in qc_sqlite to
catch this type of interface misuse.
2018-02-24 17:02:51 +02:00
Markus Mäkelä
bce5627ee3
Fix out-of-bounds read on invalid query message
When the parsing of a query failed, the message would treat the parameter
as a string as the printf format was `%*s` instead of `%.*s`.

The manpage of printf states the following about the precision specifier:

    ... or the maximum number of characters to be printed from a string
        for `s` and `S` conversions.

This means that the field length specifier is somewhat meaningless for
strings.
2018-02-16 20:49:27 +02:00
Johan Wikman
5c10d0ae92 Merge branch '2.1' into 2.2 2018-02-12 14:00:08 +02:00
Johan Wikman
cd1604f915 Merge branch '2.0' into 2.1 2018-02-12 13:44:51 +02:00
Johan Wikman
9b03cf46d1 qc_sqlite and qc_mysqlembedded marked as GA 2018-02-12 13:40:26 +02:00
Johan Wikman
7f045beb59 Fix include conflict in qc_mysqlembedded
qc_mysqlembedded must include the headers from the embedded
library and not from Connector-C.

So, it must be ensured the embedded library include directories
are first.
2018-02-08 12:44:30 +02:00
Markus Mäkelä
4089b6b6fd
MXS-1647: Detect API version mismatch
If the API versions do not match, MaxScale will treat this as an
error. The API versioning would allow backwards compatible changes but the
functionality to handle that is not implemented in MaxScale.

Updated API versions based on changes done to module APIs in 2.2.
2018-02-06 14:51:07 +02:00
Johan Wikman
ef1ec2e524 MXS-1591 Mark GET_LOCK(...) et.al. as WRITE
The follwing statements

    SELECT GET_LOCK('lock1',10);
    SELECT IS_FREE_LOCK('lock1');
    SELECT IS_USED_LOCK('lock1');
    SELECT RELEASE_LOCK('lock1');

are now classified as QUERY_TYPE_READ|QUERY_TYPE_WRITE. That will
make cooperative locking work if these functions are used inside
non-read-only transactions and outside transanctions.
2018-01-29 15:25:21 +02:00
Johan Wikman
f129dd56be MXS-1595 Rename mysqlclient to mariadbclient
Documentation update will follow.
2018-01-05 10:01:50 +02:00