8568 Commits

Author SHA1 Message Date
Markus Mäkelä
dd178875a3 Log OpenSSL errors when SSL initialization fails
When the SSL fails to initialize, the errors from OpenSSL should be
logged. This helps to diagnose what is wrong if the error relates to the
certificate files or private keys.
2017-09-11 12:49:11 +03:00
Markus Mäkelä
3ca172f380 MXS-1390: Clean up services resource documentation
Cleaned up the documentation and reformatted the parameter list of
listener creation to be made out of links.

Added some comments to the resource declarations in resource.cc to prevent
the order of them from being altered.
2017-09-11 12:49:11 +03:00
Markus Mäkelä
1a196bc865 MXS-1390: Add SSL documentation to servers resource
The servers resource now shows the SSL parameters in the example
output. It also lists the parameters in the list of valid values for
parameters in the server creation section.
2017-09-11 12:49:11 +03:00
Markus Mäkelä
486024aaf4 MXS-1390: Add missing SSL parameter processing to servers resource
Added missing SSL parameters to servers resource output as well as added
the processing of these parameters when servers are created. It is
preferable to define servers as either encrypter or plain and to prevent
the modification of this at runtime.
2017-09-11 12:49:11 +03:00
Markus Mäkelä
3d5ac7e32d Clean up variable types in config_runtime.cc
Used std::string and created a typedef for std::set<std::string>.
2017-09-11 12:49:11 +03:00
Markus Mäkelä
819a76dea9 Fix broken link in Documentation-Contents.md
The notification service document was removed.
2017-09-11 12:49:11 +03:00
Markus Mäkelä
6b27111eab MXS-1390: Update monitor resource documentation
Added missing DELETE request documentation and cleaned up formatting.
2017-09-11 12:49:11 +03:00
Markus Mäkelä
81a3ff6c27 Fix REST API authentication errors
The authentication errors were not sent as the connection was closed
immediately. The reason for this was the fact that if a client request
uploaded data with bad credentials, MaxScale would not send a response if
the connection was kept open. Closing the socket solved the hang but
caused confusing errors on the client side.

The libmicrohttpd library appears to require full processing of any data
uploaded by a client request before a request can be sent. With this
change, the clients receive proper authentication errors in all cases.
2017-09-11 12:49:11 +03:00
Markus Mäkelä
5abb30c357 MXS-1390: Add missing self-link to module command output
The module commands now produce functional self-links. The links most
often require parameters so they are not of great use.
2017-09-11 12:49:11 +03:00
Markus Mäkelä
6cf90ceb15 MXS-1390: Update MaxAdmin documentation
Added the missing documentation for the alteration of
admin_log_auth_failures.
2017-09-11 12:49:11 +03:00
Markus Mäkelä
d8e88af017 MXS-1390: Update MaxScale and service resource documentation
Added module command and individual listener resource
documentation. Cleaned up formatting of values in the MaxScale resource
document.
2017-09-11 12:49:11 +03:00
Markus Mäkelä
c0411445a8 MXS-1390: Update users resource documentation
Updated the users resource documentation with the new changes that were
added when user authorization was added.
2017-09-11 12:49:11 +03:00
Markus Mäkelä
d2b474e021 Fix enabled admin users being shown as basic users
The enabled admins for the Linux users were shown as basic users. This was
caused by the separation of the two admin types.

Added tests that check that enabled Linux accounts show the correct type
in the output.
2017-09-11 12:49:11 +03:00
Markus Mäkelä
a3402dfebf MXS-1390: Update main REST API document
Updated the document and removed faulty information.
2017-09-11 12:49:11 +03:00
MassimilianoPinto
847496d4fa Fix for testbinlog.c library set and object creation checks
Fix for testbinlog.c library set and object creation checks
2017-09-11 10:02:15 +02:00
MassimilianoPinto
6606983181 MXS-1383: abort slave connection if requested filename doesn't exist
MXS-1383: abort slave connection if requested filename doesn't exist
2017-09-08 18:43:01 +02:00
MassimilianoPinto
9617119aa9 Added blr_abort_change_master() routine
Added blr_abort_change_master() routine
2017-09-08 14:25:09 +02:00
MassimilianoPinto
ac0de09c7c Fix log message when GTID is in use
Fix log message when GTID is in use
2017-09-08 14:25:09 +02:00
Johan Wikman
402b27ad01 MXS-1392 Remove remnats of DCB reference counting 2017-09-08 12:41:41 +03:00
Johan Wikman
70a4ad6532 MXS-1392 Take new zombie mechanism into use
Next commit will remove the remnants of the reference counting
mechanism.
2017-09-08 12:41:41 +03:00
Johan Wikman
8414ce6e80 MXS-1392 Re-introduce zombie queue
- Extend Worker interface so that zombies can be registered
- Call deletion function at the end of event loop
2017-09-08 12:41:41 +03:00
Johan Wikman
be94066b77 MXS-1392 Manage DCB lifetime using refcounts
Now it is also possible to ensure that a DCB stays alive while
a task referring to it is posted from one worker to another.
That will be implemented in a subsequent commit.
2017-09-08 12:41:41 +03:00
Johan Wikman
bf42d845cf MXS-1392 Remove dcb_free
Not used and with reference counting it must not be available either.
2017-09-08 12:41:41 +03:00
Johan Wikman
7e17e2cd56 MXS-1392 Add reference count to MXS_POLL_DATA
The polling mechanism can now optionally be used for managing
the lifetime of an object placed into the poll set.

If a MXS_POLL_DATA has a non-null 'free', then the reference count
of the data will be increased before calling the handler and
decreased after. In that case, if the reference count reaches 0,
the free function will be called.

Note that the reference counts of *all* MXS_POLL_DATAs returned
by 'epoll_wait' will be increased before the events are delivered
to the handlers individually for each MXS_POLL_DATA, and then once
all events have been delivered, the reference count of each
MXS_POLL_DATA will be decreased.

This ensure that if there are interdependencies between different
MXS_POLL_DATAs returned by one call to 'epoll_wait', the case that
an MXS_POLL_DATA is deleted before its events have been delivered
can be avoided by using the reference count for lifetime management.

In subsequent commits, the reference count will be taken into use
in the lifetime management of DCBs.
2017-09-08 12:41:41 +03:00
MassimilianoPinto
daef8ad5d7 With GTID master registration always get filename from GTID repo
With GTID master registration always get filename from GTID repo.

The filestem option is not written if binlog_name is not set: this is
not needed by GTID registration.
router->fileroot is set when last name is loaded from GTID repo.
2017-09-08 10:48:35 +02:00
Markus Mäkelä
1e2e43a96e MXS-1389: Add test for uses_function
The test uses a uses_function type rule to restrict access to the name and
address columns.
2017-09-08 09:31:38 +03:00
Markus Mäkelä
bca1e34d27 MXS-1389: Add missing basic rule type
The basic rule type that matches everything was not created when a rule
with only an optional part was defined. This caused a crash when only one
rule with only an optional part was created. This was caused by the
expectation that the list of rules was never empty.
2017-09-08 09:31:38 +03:00
Markus Mäkelä
a4975edbba MXS-1389: Fix rule reloading and query parsing requirements
Reloading of rules now properly uses the current rule file if no argument
was provided. The rule version counter also used atomic operations for the
sake of correctness.

The rule parsing is now only required for DML type statements that should
be fully parsed.
2017-09-08 09:31:38 +03:00
Markus Mäkelä
26f0c08522 MXS-1389: Allow mandatory commands to pass
All commands that are deemed mandatory must be allowed to pass through the
filter.
2017-09-08 09:31:38 +03:00
Markus Mäkelä
f0a9866a87 MXS-1389: Fix fwf test SQL
The SQL executed by the test that was expected to pass wasn't correct
SQL. It appears that a CAST from an INTEGER to a TEXT value is not
possible.
2017-09-08 09:31:38 +03:00
Markus Mäkelä
a08179afcb MXS-1346: make value comparisons case-insensitive
All values for columns, function and function_usage rules should be
compared in a case-insensitive way.
2017-09-08 09:31:38 +03:00
Markus Mäkelä
40582c38fb MXS-1389: Fix fwf test rules
The new tests now use the correct syntax for the rule files.
2017-09-08 09:31:38 +03:00
Markus Mäkelä
a041bfcb5f Make the fwf test less verbose
The test was very verbose which made spotting the failure cases harder.
2017-09-08 09:31:38 +03:00
Markus Mäkelä
9ed0524699 MXS-1346: Fix at_times time period calculcation
The time period matched for one extra second.
2017-09-08 09:31:38 +03:00
Markus Mäkelä
68baf582c8 Deprecate deny and allow in dbfwfilter rules
The `deny` and `allow` tokens are replaced with `match` which better
describes the action. Use of the old tokens causes a warning to be logged.
2017-09-08 09:31:38 +03:00
Markus Mäkelä
11bf5d2412 MXS-1389: Add tests for function use with columns
The test checks that only the functions that aren't allowed are blocked.
2017-09-08 09:31:38 +03:00
Markus Mäkelä
7272d9401d MXS-1346: Fix the at_times rule
The rule used the values from the QuerySpeed struct instead of the values
in the rule itself.
2017-09-08 09:31:38 +03:00
Markus Mäkelä
b9698f15e7 MXS-1346: Clear value stack when a new rule is created
The values on the stack are cleared when a new rule is created.
2017-09-08 09:31:37 +03:00
Markus Mäkelä
1fcf4ef59a MXS-1346: Allow combination of function and columns rules
The `function` type rule can now be combined with the `columns` type rule
to form a new rule which matches if specific columns use specific
functions.
2017-09-08 09:31:37 +03:00
Markus Mäkelä
a955e4a623 MXS-1346: Only parse text queries
Only text format queries (COM_QUERY, COM_STMT_PREPARE) can be parsed by
the query classifier.

Also fixed invalid use of a NULL value in a string constructor.
2017-09-08 09:31:37 +03:00
Markus Mäkelä
2ccdd93d44 MXS-1346: Fix rule handling
The call to update_rules is needed before each query to make sure that the
rules are up to date.

The check whether the rule was active was inverted.
2017-09-08 09:31:37 +03:00
Markus Mäkelä
6067c21c1b MXS-1346: Use the filter template in dbfwfilter
The dbfwfilter now uses the MaxScale filter template. Also fixed up some
of the filter template documentation.
2017-09-08 09:31:37 +03:00
Markus Mäkelä
fc1435d0c2 MXS-1346: Hide DbfwSession internals
The DbfwSession now only exposes the necessary methods with the exception
of the DOWNSTREAM and UPSTREAM structures. These will be handled when the
session implements the filter template.
2017-09-08 09:31:37 +03:00
Markus Mäkelä
dc7b25d0fe MXS-1346: Make Dbfw a proper class
The Dbfw class now only exposes the necessary methods which are required.
2017-09-08 09:31:37 +03:00
Markus Mäkelä
cf2e8d8b34 MXS-1346: Add DbfwSession method implementations
Added the implementation of the DbfwSession methods.
2017-09-08 09:31:36 +03:00
Markus Mäkelä
f5401c5244 MXS-1346: Rename dbfwfilter instance and session
Renamed the structures to C++ naming style and added initial declarations
for DbfwSession methods.

The DbfwSession methods are not yet fully implemented which is why parts
of the class are still public. The intention is to use the filter template
when the session class is sufficiently refactored.
2017-09-08 09:31:36 +03:00
Markus Mäkelä
fa6f155d29 MXS-1346: Make Rule methods const
Most of the methods can be const functions.
2017-09-08 09:31:36 +03:00
Markus Mäkelä
3648b5e702 MXS-1346: Clean up dbfwfilter.cc
Remove redundant code, move assignments to struct constructors, organize
variable declarations, use standard library functions.
2017-09-08 09:31:36 +03:00
Markus Mäkelä
4c4ea94319 MXS-1346: Clean up unused code
Removed the rule type enum and replaced it with a string description of
the type. Moved the rule type and name strings as private to the Rule
class. Replaced the need_full_parsing of the base class with a simple
constant.

Removed the unused array of rule names as well and the STRLINK structure
and the functions that use it.
2017-09-08 09:31:36 +03:00
Markus Mäkelä
594956178d MXS-1346: Implement LimitQueriesRule::matches_query
Moved the code into the LimitQueriesRule class and cleaned it up. Renamed
the QUERYSPEED struct and added simple constructor.
2017-09-08 09:31:36 +03:00