10969 Commits

Author SHA1 Message Date
Markus Mäkelä
a11d83679e
Fix REST API regression
The threads resource was not pass the schema validation test; no ID field
was defined.
2018-07-09 12:10:36 +03:00
Markus Mäkelä
8470da9313
Fix failing tests
Changed mxs1719 to expect a failure with the query and added monitor waits
to mxs359_read_only.
2018-07-09 12:06:48 +03:00
Marko
40d076b4ce MXS-1849 Fix broken test to work with new schemarouter 2018-07-09 12:00:40 +03:00
Marko
89e83fab4b MXS-1849 Add basic test case 2018-07-09 11:55:54 +03:00
Marko
293279366f MXS-1849 Fix handling of show tables queries in schemarouter
There was a bug in handling of the "show tables from" queries that
caused multiple results to the client. These queries are now handled
correctly.
2018-07-09 11:34:59 +03:00
Markus Mäkelä
bfd3d2975d
Merge branch '2.2' into develop 2018-07-06 14:56:19 +03:00
Johan Wikman
f2b8487577 MXS-1624 Add configuration parameter
With the global configuration parameter 'query_classifier_cache'
the query classification cache can be turned on. At the moment it
does not matter what value it has; its presence simply enables the
caching.

Eventually you will be able to specify how much memory the cache
is allowed to consume.
2018-07-06 12:12:31 +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
b7c5abf73b MXS-1624 Discard QC result if the sql mode has changed
The sql mode affects the result of the query classification.
Consequently, we cannot use the cached result if it was generated
when the sql mode was something else than what it currently is.
2018-07-06 12:12:31 +03:00
Johan Wikman
1be9528227 MXS-1624 Provide initial implemenation of QC caching
The mapping from a canonical statement to the query classification
result is maintained by the class QCInfoCache of which there exist
an instance per thread. That way no locking is needed but the
information will be cached multiple times (but that is a smaller
price to pay). Currently the information is stored in a regular
std::unordered_map, which means that the consumed amount of
memory will just keep on growing unless the number of canonical
statements used by clients happens to have an upper bound.

The LRU cache (that provides means for putting a bound on the
amount of memory used and number of items) used in the cache filter
will be generalized and be taken into use here as well.

The key is now the canonical statement itself, which means that
a fair amount of memory will be used. To preserve memory it might
make sense to use a hashed value instead, although that at least
in principle opens up the possibility for unintended collisions.

This feature will also be made configurable.
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
d01db42679 MXS-1624 Clean up query_classifier.cc
Minor cleanup:
- Unit variables places in anonymous namespace.
- Unit variables accessed via this_unit struct.

This is the first commit of many where the mapping from canonical
statement to query classification result is introduced.

The mapping is placed above the actual query classifier, so that all
query classifiers will benefit from it.

The mapping will be maintained by thread so that there will not be
any synchronization issues. Further, initially a simple map without
upper boundary will be used; if this is found to provide measurable
benefits, the map will then be replaced with an LRU mechanism so
that it becomes possible to specify just how much memory the mapping
may use.
2018-07-06 12:12:31 +03:00
Johan Wikman
c89bdb9626 MXS-1823 Replace meaningless eventq info with meaningful
The evq_length file held the returned number of descriptors from
the last epoll_wait() call. As such it is highly temporal and not
particularly meaningful.

That has now been removed and the instead the average number of
returned descriptors is maintained. That information changes slowly
and thus carries some meaning.
2018-07-06 11:22:42 +03:00
Johan Wikman
d339b89990 MXS-1774 Make rejection of functions optional
It is now possible to prevent the masking filter from rejecting
statements using functions in conjunction with fields to be
masked. So now it is possible to not use the blanket rejection
of the masking filter and replace it with more detailed firewall
rules.
2018-07-06 11:20:31 +03:00
Johan Wikman
43cc6ca3cd MXS-1774 Reject query with masked columns + functions
The masking filter works only on the result-set. However, if
functions are used, the column names will not be available in
the result-set, and hence masking will not take place.

Now, the statement is checked and if functions are used in
conjunction with columns that should be masked, the statement
is rejected. Thus, functions can no longer be used for bypassing
the masking. That was possible earlier as well, but required
manually setting up the firewall filter.
2018-07-06 11:20:31 +03:00
Markus Mäkelä
cb05199bac
Stop MaxScale before fixing replication
Before the state of the backend servers is checked, MaxScale needs to be
stopped to prevent the automated failover from interfering in the start-up
process.
2018-07-05 21:03:57 +03:00
Markus Mäkelä
702f8aaed4
Merge branch '2.2' into develop 2018-07-05 13:53:14 +03:00
Markus Mäkelä
5c610503ba
MXS-1949: Add test case
Added a test case that verifies the bug is fixed.
2018-07-05 13:47:08 +03:00
Markus Mäkelä
f44d305a46
MXS-1949: Fix user injection warning
If a service has no active servers and users are injected, a warning would
be logged. This is a misleading warning if the service has no servers and
should only be logged if the failure to load any users is an unexpected
situation.
2018-07-05 12:49:46 +03:00
Markus Mäkelä
33fa9b26fe
Make version counter in mlist_t volatile
The log manager is the only one that uses the mlist_t versioned list. The
counter that keeps track of the version number was not modified using
atomic operations meaning that the compiler is free to optimize away parts
of the lock-free versioning mechanism that uses it.

To prevent this optimization, the variable is declared volatile. A rewrite
is direly needed but it cannot be done in 2.2.
2018-07-05 12:47:28 +03:00
Markus Mäkelä
f5110209f7
MXS-1942: Use MaxScale version in MaxCtrl
Displaying the MaxScale version helps identify which package the
executable was bundled with. As the MaxCtrl source is a part of MaxScale,
there's no need for separate versioning.
2018-07-05 12:47:28 +03:00
Markus Mäkelä
9e039ed024
Fix typo in DEB install scripts
The package suffix was wrong.
2018-07-05 12:01:38 +03:00
Markus Mäkelä
7954de0da6
Always log commit ID
There's no good reason to not include the commit ID in release build
startup messages.
2018-07-05 12:01:38 +03:00
Markus Mäkelä
bbf3909296
MXS-1958: Add test case
The test case verifies that the problem exists.
2018-07-05 12:01:38 +03:00
Markus Mäkelä
d301109b1a
Update release document
Use more precise git commands for pushing a single tag.
2018-07-05 12:01:38 +03:00
Johan Wikman
152eed7f63 Merge branch '2.2' into develop 2018-07-05 09:45:18 +03:00
Johan Wikman
f1d7303919 Update 2.2 version number 2018-07-05 09:44:13 +03:00
Johan Wikman
4f634c5010 Merge branch '2.2' into develop 2018-07-05 09:41:00 +03:00
Johan Wikman
7765aff74b Update 2.2.11 release date 2018-07-05 09:38:09 +03:00
Marko
d3c1ec4742 MXS-1664 Add --runtimedir config parameter 2018-07-04 22:38:28 +03:00
Marko
40376bd12a MXS-1849 Fix connecting to empty databases in schemarouter
Empty databases were not mapped to ServerMap because they had no tables
to map. Modified the query to also include empty databases making it
possible to also connect to empty databases through schemarouter.
2018-07-04 22:25:09 +03:00
Marko
33ff20622f MXS-1858 Don't save duplicate of a command in MaxAdmin 2018-07-04 22:22:15 +03:00
Markus Mäkelä
2e88ce4132
Merge branch '2.2' into develop 2018-07-04 22:01:01 +03:00
Markus Mäkelä
1aa5dcf659
Do rsync without --delete
rsync with the --delete flag will destroy artifacts generated by other
jobs. This broke the build_all job.
2018-07-04 15:41:18 +03:00
Markus Mäkelä
6b9ae5b220
Fix bug626
Removed the excessive comments in favor of a simplified description. Use
stack-allocated TestConnections and simplify assertions.

The main change is the different SQL used to update the user with the old
password. Direct modification of the `mysql`.`user` database isn't very
neat but it guarantees that the value is updated.
2018-07-04 15:41:17 +03:00
Markus Mäkelä
d98ffb5d0a
Always stop MaxScale before test
The test should stop MaxScale at the start unless the manual debug flag is
given on the command line. This fixes the connection failure of mxs1719
but reveals a problem with the filter itself.
2018-07-04 13:51:10 +03:00
Markus Mäkelä
88431f14d7
Fix cache_basic configuration
The test requires the old default values.
2018-07-04 13:51:10 +03:00
Markus Mäkelä
3f9a204116
Log unknown users and wrong passwords separately
If authentication fails due to a wrong password, a different error message
is logged. This should help resolve problems with user management.
2018-07-04 13:51:09 +03:00
Markus Mäkelä
be7d31c6ff
Update 2.2.11 release notes
Added fixed bugs to release notes, fixed documentation links.
2018-07-04 13:51:09 +03:00
Markus Mäkelä
79acbae4e5
Fix cache test build failure
The change in defaults caused the test to fail.
2018-07-04 13:51:09 +03:00
Timofey Turenko
05e8773161 fix typo in chmod for all binary repository dirs and files 2018-07-04 09:11:32 +03:00
Timofey Turenko
afdf28c0b9
Access rights for binary repository files and dirs (#178)
fix typo in chmod for all binary repository dirs and files
2018-07-04 09:08:55 +03:00
Markus Mäkelä
44ef4912e8
Merge branch '2.2' into develop 2018-07-03 21:13:41 +03:00
Timofey Turenko
45752e0a45 chmod for all binary repository dirs and files 2018-07-03 16:14:09 +03:00
Markus Mäkelä
b98c0841b4
Enable and fix -Wextra warnings
Fixed all warnings that were present with -Wextra.
2018-07-03 15:07:19 +03:00
Markus Mäkelä
fb1c28c702
MXS-1948: Do round-robin worker assignment
Due to the skewed accept distribution without SO_REUSEPORT, we use
round-robin assignment of workers for new client connections. This
provides better performance as work is more likely to be evenly
distributed across all threads.

Using a least-busy-worker algorithm would provide a more stable result but
this is not trivially simple to implement. For this reason, the
round-robin based approach was chosen for 2.2.
2018-07-03 12:49:59 +03:00
Markus Mäkelä
e455e7f15d
MXS-1953: Always initialize the GWBUF spinlock
The spinlock in the buffer is used but it was not always initialized. Also
added missing initialization of the SERVER pointer.
2018-07-03 11:32:36 +03:00
Esa Korhonen
34f61bc4f2 Close connections before starting loop
The connections should be closed after the check queries.
2018-07-03 10:32:06 +03:00