8428 Commits

Author SHA1 Message Date
Johan Wikman
4c100a305e MXS-1364 Simplify grammar rules 2017-08-24 09:58:18 +03:00
Johan Wikman
bea56f40b2 MXS-1364 Disable irrelevant tests that do not pass 2017-08-24 09:58:18 +03:00
Johan Wikman
2d6ac6c682 MXS-1364 Collect columns referred to by group_concat 2017-08-24 09:58:18 +03:00
Johan Wikman
83ae19cd68 MXS-1364 Collect field usage of CASE and BETWEEN 2017-08-24 09:58:18 +03:00
Johan Wikman
72831c86ac DCBEVENTQ removed
No longer used for anything
2017-08-24 09:57:42 +03:00
Johan Wikman
11dffd0d93 Remove unused variables 2017-08-24 09:57:42 +03:00
Markus Mäkelä
64642a4d6d MXS-1346: Add new rule to dbfwfilter documentation
Added the new rule to the documentation and mentioned it in the release
notes.
2017-08-24 09:46:03 +03:00
Markus Mäkelä
c05bb3593a MXS-1346: Take the new query classifier features into use
The function usage by column is now used by the dbfwfilter. This finishes
the implementation of blocking function usage per column.
2017-08-24 09:46:03 +03:00
Markus Mäkelä
da74ebb959 Add error string helper function to dbfwfilter
The helper function is a wrapper for snprintf and strdup which removes
some of the redundant code in dbfwfilter.
2017-08-24 09:46:02 +03:00
Markus Mäkelä
ae2b9fd30d Fix hang with queries larger than 2^24 bytes
Readwritesplit didn't track multi-packet queries which resulted in them
being confused for pipelined queries.
2017-08-24 09:46:02 +03:00
Markus Mäkelä
2ef9fbc47a MXS-1346: Add uses_function type rule
The uses_function type rule matches when any of the columns given as
values uses a function. With this, columns can be denied from being used
with a function.
2017-08-24 09:46:02 +03:00
MassimilianoPinto
0aa1b8a4d0 MXS-1344: MySQL monitor detects MaxScale Binlog Server
If MaxScale Binlog Server is detected by MySQL monitor, then Server
status is ‘Relay Master, Running’ without ‘Slave’: this way Binlog
Server cannot be used by any statement routing.
Additionally SELECT for replication lag is skipped as well.
2017-08-23 14:11:17 +02:00
MassimilianoPinto
1c4ae9f89a MXS-1344: Allow SET SQL_MODE='' statement from mysql monitor
When SET SQL_MODE='' statement is received from mysql monitor an OK
packet is sent.
2017-08-23 14:11:16 +02:00
MassimilianoPinto
965173dd88 MXS-1344: Binlog server reports real master id and its server id in monitor queries
MXS-1344: Binlog server reports the real master id in SHOW SLAVE STATUS
| SHOW ALL SLAVES STATUS, no matter the value of ‘master_id’ identity
parameter.

Binlog server report its own server id or the identity value of
‘master_id’ in MySQL monitor query SELECT @@global.server_id,
@@read_only;

Note: SELECT @@global.server_id (no other fields) still reports the
real master server id or the value set in ‘master_id’
2017-08-23 14:11:16 +02:00
Markus Mäkelä
cbe58b5355 MXS-620: Add start/stop maxscale to MaxCtrl
The commands allow all services in MaxScale to be either stopped or
started.
2017-08-22 21:15:12 +03:00
Markus Mäkelä
ae5260bec7 MXS-1288: Deprecate reload config
The `reload config` command is now deprecated. The same functionality can
be found in the MaxScale REST API.
2017-08-22 21:15:12 +03:00
Johan Wikman
c34140abd8 MXS-1364 Improve collection of arguments to IN 2017-08-22 11:01:50 +03:00
Johan Wikman
17db8e9705 MXS-1364 Collect function column access in qc_mysqlembedded
Initial support, more updates will be needed.
2017-08-22 11:01:50 +03:00
Johan Wikman
de9c1ef109 MXS-1364 Collect information of arguments to operators 2017-08-22 11:01:50 +03:00
Johan Wikman
597aacb313 MXS-1364 Compare should report function column usage 2017-08-22 11:01:50 +03:00
Johan Wikman
feebc85d98 MXS-1364 Report true name and not alias name
With this change, in the case of a statement like

  select a as b from t where length(b) = 1

it will be reported that length accesses a and not b.
2017-08-22 11:01:50 +03:00
Johan Wikman
6812ae51fc MXS-1364 Collect function field usage
In qc_sqlite the fields that a particular function refers to are now
collected and reported. Qc_mysqlembedded needs to be updated accordingly
and also the compare utility. For subsequent commits.
2017-08-22 11:01:50 +03:00
Johan Wikman
65bf471bd7 MXS-1364 Factor out field name extraction
Will be used when function field usage is collected.
2017-08-22 11:01:50 +03:00
Johan Wikman
365371e7b5 MXS-1364 Provide function field usage information
Only API change, implementations follow.
2017-08-22 11:01:50 +03:00
Markus Mäkelä
655f8b9170 Close binlogrouter connections in thread 0
The internal connections of the binlogrouter should be closed in the same
thread that created them. This should be the "main" thread, i.e. thread 0,
that starts the original binlogrouter service.
2017-08-21 20:30:36 +03:00
Markus Mäkelä
27a706341b Increase timeouts for long tests
Increased timeouts for different_size_rwsplit and other tests of the same
type.
2017-08-21 10:57:59 +03:00
Markus Mäkelä
80ef13c7f2 MXS-1354: Update mxs729_maxadmin test
Updated test to check the new behavior of the admin users.
2017-08-19 10:19:55 +03:00
Markus Mäkelä
cc8fb995cd MXS-1354: Make new users backwards compatible
The `add user` and `enable account` commands create fully privileged
administrative users like they did in 2.1. This makes the addition of
read-only users backwards compatible.

Updated and expanded the documentation on administrative interface
users. Added entries into the release notes as well as the upgrading
document about relevant changes between 2.1 and 2.2.
2017-08-19 09:27:15 +03:00
Esa Korhonen
e2fb5b4ddf Add Dockerfile
The Dockerfile is used to build a Docker image with all MaxScale
dependencied included. A short readme for using the image is attached.
2017-08-18 18:32:40 +03:00
Esa Korhonen
8b08d61487 Update MaxScale man page 2017-08-18 18:31:49 +03:00
MassimilianoPinto
7c296d746f Binlog server: handle filestem in blr_handle_missing_files()
Routine blr_handle_missing_files() is called by
blr_handle_fake_rotate().

Field ‘filestem’ is updated in order to avoid wrong file name creation.

Additionally router is not creating any missing filenames if
router->binlog_name is empty (no previous binlog files)
2017-08-18 09:45:24 +02:00
Markus Mäkelä
6cc3986db5 MXS-1354: Prevent removal of last admin account
Removing the last admin account is now forbidden. This should prevent most
cases where users could lock themselves out of the administrative
interface.

This change does allow a non-root network user to be the last admin
account. In practice this does not prevent the root user from gaining
access to maxadmin. Access can be gained by removing the users file and
restarting MaxScale or by editing the users file by hand.
2017-08-18 10:28:21 +03:00
Markus Mäkelä
828649ba99 MXS-1354: Add user authorization to maxadmin
All commands that modify the internal state of MaxScale now require admin
level authorization.
2017-08-18 10:28:21 +03:00
Markus Mäkelä
9f81f0775f MXS-1354: Rename user account type enum
Renamed the enum and its values.
2017-08-18 10:28:21 +03:00
Markus Mäkelä
6ee7ed6a38 MXS-1354: Add creation of basic/admin users to maxctrl
The type of the created user can now be specified with the --type option.

Expanded tests that cover the user creation. Also added a test case that
checks that basic users are only allowed to read through the REST API.
2017-08-18 10:28:21 +03:00
Markus Mäkelä
9d24a63c10 MXS-1354: Add user account types to REST API
The user accounts can now be created with a specific account type. This
allows read-only users to be created for the REST API.
2017-08-18 10:28:21 +03:00
Markus Mäkelä
ec045b7ab6 MXS-1354: Add creation of basic user via MaxAdmin
MaxAdmin can now create basic users for both network and UNIX domain
socket use. Currently the basic and admin types have the same permissions
in maxadmin but for the REST API, only admin accounts can modify MaxScale.
2017-08-18 10:28:21 +03:00
Markus Mäkelä
2708942762 MXS-1354: Store users in a new format
The users are now stored as an array of JSON objects. Legacy users are
automatically upgraded once they are loaded and a backup of the original
users file is created.

Removed the password parameter from the `remove user` maxadmin command as
well as all of the relevant functions. Requiring that an administrator
knows the password of the account to be deleted is not a sound requirement
now that, at least in theory, two types of accounts can be created.
2017-08-18 10:28:20 +03:00
Markus Mäkelä
a3e7fd4f23 MXS-1354: Add utility functions to User class
Added a utility function for checking if an admin user has been
created. Removed unused promote and demote commands which can be replaced
with a call to remove and add.
2017-08-18 10:28:20 +03:00
Markus Mäkelä
158ae75dd2 MXS-1354: Add missing function declaration in adminusers header
The header is generated at configuration time so the changes need to be
done in the .in file.
2017-08-18 10:28:20 +03:00
Markus Mäkelä
3aebe0f91e MXS-1354: Add JSON serialization of users
The users can now be dumped and loaded as JSON objects. This allows easier
parsing and handling of users while still retaining the possibility to
manually edit the output. Added tests for dumping and loading the JSON
form users.

Also fixed a deadlock in Users::remove() where the same lock was acquired
twice and a faulty test case where failed authentication was expected to
work.
2017-08-18 10:28:20 +03:00
Markus Mäkelä
253d6d211f MXS-1354: Allow creation of basic users
The type of the user being created is defined at creation time. This
allows the creation of basic users.

Although the users can be created internally, they cannot yet be created
via maxadmin or the REST API.
2017-08-18 10:28:20 +03:00
Markus Mäkelä
829d8a1224 MXS-1354: Rename enums to better represent their use
Renamed permission types to PERM_BASIC and PERM_ADMIN to better represent
how the permission types are used.
2017-08-18 10:28:20 +03:00
Markus Mäkelä
4a179d973b MXS-1354: Add missing locking to the Users class
The Users class now performs locking when a method is called. This will
prevent concurrent access to the internal map of users.

Added missing const versions of SpinLockGuard.
2017-08-18 10:28:20 +03:00
Markus Mäkelä
a48758a9d8 MXS-1354: Take REST API authorization into use
GET requests are allowed for all users while POST, PATCH, DELETE and PUT
requests are reserved for administrative users.
2017-08-18 10:28:20 +03:00
Markus Mäkelä
06afbd14eb MXS-1354: Add permissions to admin users
The admin users now have a concept of write and read permissions. This
allows restricted read-only access to be granted to users.
2017-08-18 10:28:20 +03:00
Markus Mäkelä
c323f0a551 MXS-1354: Remove external linkage from User class
The User class is no longer declared with external linkage.
2017-08-18 10:28:20 +03:00
Markus Mäkelä
e627740777 MXS-1354: Enable muting of admin interface authentication failures
The warnings generated by the admin interface can now be silenced.
2017-08-18 10:28:20 +03:00
Markus Mäkelä
f0c2843195 MXS-1354: Fix diagnostic output
The tests failed due to changes in the diagnostic output.
2017-08-18 10:28:20 +03:00
Markus Mäkelä
af4e852649 MXS-1354: Take refactored users into use
The refactored interface is now in use. The only module that used it
directly was the CDC protocol module. This should probably be changed so
that it uses the adminusers interface instead of the users interface
directly.
2017-08-18 10:28:20 +03:00