Commit Graph

6193 Commits

Author SHA1 Message Date
daf6f06138 MXS-304: Support nested configuration files
Given a config file "config.cnf", we look for the directory
"config.cnf.d" and recursively in that hierarhcy load all files
whose suffix is ".cnf"; other files are ignored.

Currently duplicate sections are checked on a file by file basis.
That will be changed so that duplicate sections are not allowed
across all the files.
2016-10-31 12:48:38 +02:00
ab372b291b MXS-304: Minor refactoring of config.c
The loading of a single file refactored out into a separate function.
To be used later when multiple files are loaded and processed.
2016-10-31 12:48:38 +02:00
5ca0c730a1 MXS-960: In BRL, accept passwords with "," in them.
strtok_r replaced with a function that ignores delims that appear
within any of the MySQL quotes.
2016-10-31 11:54:15 +02:00
01f3b35fad MXS-961: error in replication stream and checksum calculation
When checksum is in use and there is an error in replication stream
master connection the blr_terminate_master_replication has no effect.

MXS-961: The checksum detection calls
blr_master_delayed_connect(router); and connection is scheduled again.

The fix will break the main loop as soon as the error indicator byte is
seen and no other computation will be done (such as checksum)
2016-10-31 10:18:22 +02:00
5a1af968d2 Take contiguous input capability into use in filters
The filters which require contiguous input now return the
RCAP_TYPE_CONTIGUOUS_INPUT capability flag.
2016-10-31 08:38:05 +02:00
282ed9f8c2 Start MaxScale as the maxscale user with systemd
Systemd allows MaxScale to start as the 'maxscale' user and it should be
done to completely prevent root access for the maxscale process.
2016-10-29 11:03:15 +03:00
0f68fa6028 Removing error messages while executing RESET SLAVE
Removing error messages while executing RESET SLAVE
2016-10-28 18:40:18 +03:00
3c26ea16e2 Add and use FindSQLite.cmake
Added a find_package module for SQLite development libraries.
2016-10-28 12:49:18 +03:00
1be3bb9b8d Minor cleanup of config.[h|c]
- Add const where applicable.
- Cleanup header files.

Fix collateral damage (statistics.c) as well.
2016-10-27 15:55:26 +03:00
bbade8b736 PCRE2_CODE_UNIT_WIDTH must not be defined. 2016-10-27 15:26:41 +03:00
1728e2dc2e Minor cleanup of gateway.c
Pre-parsing of configuration file moved to separate function. To
make it slightly easier to see the forest for the trees.
2016-10-27 14:50:22 +03:00
6c80f2bc0a Cleanup gateway.c include files
- First <maxscale/cdefs.h>
- Then all system, c-runtime, OS include files in alphabetical order.
- Then include files for "3rd-party" software in a loose order of
  importance.
- Then maxscale headers ordered alphabetically.
2016-10-27 14:13:31 +03:00
a390331e42 Feature defines moved to <maxscale/cdefs.h>
Feature defines that affect the available functionality or the
compile time environment should be defined in a common way for
all source.
2016-10-27 14:08:58 +03:00
6cc7a26582 Cache: Add forgotten change 2016-10-27 13:54:22 +03:00
dcfd5b7601 maxrows now handles SHOW statements and SELECT in prepared statements
maxrows now handles SHOW statements and SELECT in prepared statements
2016-10-27 11:34:01 +02:00
0cfb82f146 The MAXROWS_DISCARDING_RESPONSE is handled differently
The MAXROWS_DISCARDING_RESPONSE is handled differently: the OK packet
is sent only after an EOF is seen in a reply even with multiple packet
transmission from the backend
2016-10-27 10:53:07 +02:00
199dd51312 Cache: C_DEBUG removed and debug option extended
The development time C_DEBUG is now removed, and replaced with
a debug option that allows top-level decisions to be logged.
2016-10-27 11:10:36 +03:00
c73c3b390a Addition of MAXROWS_DISCARDING_RESPONSE
Addition of MAXROWS_DISCARDING_RESPONSE

Packets received after sent OK are consumed and not sent
2016-10-27 09:25:08 +02:00
b76cdfd367 qc_sqlite: Pick out prepare name in DEALLOCATE stmt 2016-10-26 21:00:54 +03:00
cbef9b944d qc_sqlite: Pick out the name in an EXECUTE stmt 2016-10-26 20:47:40 +03:00
59b3a1fe36 Handle max_resultset_size in maxrows
Handle max_resultset_size in maxrows
2016-10-26 19:20:25 +02:00
7419ddceca Code review update
Code review update
2016-10-26 19:12:56 +02:00
50db0db316 MXS-934: Set operation of PREPARE statement
The operation of a PREPARE statement will be that of the preparable
statement. That will make it possible to know whether an EXECUTEd
prepared statement e.g. is a SELECT or an UPDATE.
2016-10-26 20:11:26 +03:00
5aa0c32e8f Minor changes
Minor changes
2016-10-26 18:58:07 +02:00
1388686fb7 MXS-957: Fix temporary table detection
Temporary tables which were created from joins with other temporary tables
weren't properly detected as CREATE TEMPORARY TABLE statements.
2016-10-26 17:36:48 +03:00
48af3d21b6 max rows filter first implementation
max rows filter first implementation

Resultsets with more than max_resultset_rows

will be skipped and empty result set is returned to client.
Not yet tested with multi_statements
[MaxRows]
type=filter
module=maxrows
max_resultset_rows=10
debug=15
2016-10-26 15:58:06 +02:00
23fdf1776c qc: Pick out the name in a PREPARE statement 2016-10-26 14:42:25 +03:00
7499c1e1bf qc: Add minimal support for qc_get_prepare_name
If the query is a PREPARE or EXECUTE statement, then qc_get_prepare_name
will return the name of the prepared statement.
2016-10-26 14:36:37 +03:00
19e017e499 QC: Documentation cleaned up and moved to header 2016-10-26 14:22:41 +03:00
dc97de57c2 qc: Some minor cleanup
- qc_types_to_string renamed to qc_typemask_to_string
- qc_get_qtype_str removed, duplicate of qc_typemask_to_string
2016-10-26 10:21:11 +03:00
d7ce3ad75b Replace include guards with #pragma once 2016-10-26 08:23:15 +03:00
f2bee763f8 qc_sqlite: Take MXS_MODULE_NAME into use 2016-10-25 21:11:58 +03:00
8f8823dc41 qc_sqlite: Protect against misuse
- Ensure contiguous buffer of expected size.
- Ensure COM_QUERY content.
2016-10-25 20:56:14 +03:00
46c2b6e76a Only parse COM_QUERY packets 2016-10-25 20:28:50 +03:00
8391579206 Update cache with new capabilities
Now that a filter can express that the transaction state is tracked,
the cache implementation can be simplified. We do not need to cater
for the case that a "too short" or "too long" a packet would be
delivered.

Further, since the autocommit mode and transaction state of the session
are tracked, the filter can cache data when it is safe to do so. In
practice that means when either AUTOCOMMIT is ON and no explicit
transaction is active or when a READ ONLY transaction is active,
irrespective of the autocommit state.

In principle it would be possible to tentatively cache data during
a transaction, and if the transaction is committed successfully
flush the tentatively cached data to the actual cache, but that will
be for another day.
2016-10-25 16:21:31 +03:00
f961f87e5e Update autocommit mode and transaction state
The transaction state only reflects explicitly started transactions.
Thus, by looking at the autocommit mode and the transaction state a
component can figure out whether the current statement will be committed
or not.
2016-10-25 16:21:31 +03:00
041df39819 Move transaction state management to the right place
The transaction state must be updated after a buffer has been split
into buffer containing individual packets.

NOTE: The actual updating of the transaction state and the autocommit
      mode is currently wrong, but will be updated in a subsequent change.
2016-10-25 16:21:31 +03:00
7e822aed4d MXS-862: Add SQLite based authentication checks
The authentication checks make sure that a user has all the required
grants to access the database. This prevents the creation of unnecessary
backend connections reducing the overall load on the database.

Doing preliminary authentication in MaxScale enables the creation of more
informative error messages.
2016-10-25 13:44:47 +03:00
4c286b85e6 Add new capability types 2016-10-24 15:33:24 +03:00
28ecba4022 Use service capabilities
Now the capabilities of routers and filters alike will be honoured.
2016-10-24 15:19:37 +03:00
bd18a7d8ed Add service capabilities
The service capabilities are the union of the capabilities of the
router and all filters.
2016-10-24 15:13:16 +03:00
3915b4e7c7 Exclude MXS_DEBUG in release builds
Now, MXS_DEBUG turns into a nop in release builds.
2016-10-24 14:00:51 +03:00
1a2e0ba3ee Check log priority before logging
With this change, whether something should be logged or, that is,
whether the used log priority is enabled or not, is checked before
the logging function is called. That should save a few cycles.

Now mxs_log_message() always logs a message, without consideration
for whether the priority is enabled or not. The inline function
mxs_log_is_priority_enabled() returns true if a particular priority
is enabled and the MXS_LOG_MESSAGE() macro (that MXS_ERROR etc. are
expanded into) call that before calling the actual logging function.
2016-10-24 14:00:51 +03:00
bd4542139c Install third-party license file
Some of the libraries used by MaxScale are distributed under BSD
licenses. The BSD license requires that the license text is included with
the binary distributions.
2016-10-24 13:18:39 +03:00
d961864635 Fix tests and limit internal test set size
Some of the tests depended on a working installation where modules are all
located at the default paths. These tests now explicitly set the module
directory which fixes the immediate problem.

Disabled the starting of services in the service test as this will fail
with real modules. The dummy internal modules aren't build and should be
removed in a later commit. In general, it might be better to do service
level testing outside the internal test suite.
2016-10-24 13:16:59 +03:00
cff90ffee8 Fix HTTPD protocol authentication
The HTTPD protocol mistakenly assumed that the `authenticator` parameter
of a listener would be NULL if the default authenticator is used.

Recent changes modified it so that the value is never NULL and
`NullAuthDeny` would be used for protocols which did not implement the
auth_default entry point.
2016-10-24 13:16:59 +03:00
367d4407db Fix build failures when using C++11
Some parts of the code weren't C++11 compatible and the build would fail
with newer compilers.
2016-10-24 12:47:05 +03:00
d53a6d2899 MXS-942: Don't return information_schema as the parsed database
When a DESCRIBE <table> or a SHOW COLUMNS IN <table> query is done, the
actual query is performed on tables in the information_schema
database. This might be what actually happens on the backend server but
this information is not really useful when we need to know which database
the query targets.

By passing the actual table names instead of the underlying table names,
the schemarouter is able to detect where these statements should be
routed.
2016-10-24 12:31:44 +03:00
db2cccbd8f Replace getCapabilities() with getCapabilities(void)
The latter means no args, the former means any args.
2016-10-24 11:19:43 +03:00
59a4152d8a Add getCapabilities to filters
Common capabilities are now defined in routing.h. The common
capabilities can be defined using bits 0 - 15.

Router capabilities are defined using bits 16-31 and filter
capabilities (should there ever be such) using bits 32-47.

So, to find out the capabilities of a service you only need to
OR the capabilities of the router and all filters together.

For instance, if a single filter needs statement based routing,
then that is what is done.
2016-10-24 11:19:43 +03:00