7038 Commits

Author SHA1 Message Date
Markus Mäkelä
85b8a963bd Document mysqlmon server state backup
The functionality is now documented in the MySQL Monitor documentation.
2017-03-17 11:29:05 +02:00
Markus Mäkelä
44f53663ea Keep server state backup even on controlled shutdown
The server state information should be persisted even if a controlled
shutdown is done. This will allow the monitor to retain the server state
information across a restart.
2017-03-17 11:26:49 +02:00
Markus Mäkelä
08cc7a9515 Make MySQL monitor crash-safe
The MySQL monitor stores the server states in a backup file which can be
used to restore the state of the servers even if MaxScale is stoppen in an
uncontrolled fashion.
2017-03-17 11:12:48 +02:00
Johan Wikman
7165b4306f Implement first version of HintRouter
The hintrouter is now in principle capable of routing requests
to the master or to some slave (in a round robin fashion) based
upon hints set by some earlier filter.

Note that as the router is completely oblivious of transaction
boundaries, using it with transactions and autocommit being off
will not make anyone happy.

Recognizing transaction boundaries using regexes and then pinning
the server until transaction commit would be needed.
2017-03-17 10:56:53 +02:00
Esa Korhonen
9dbabb666a Rebase NamedServerFilter to develop
Fix conflicts due to ipv6 changes.
Change SourceHost->m_address to string.
SourceHost generation is now cleaner.
2017-03-15 16:19:53 +02:00
Esa Korhonen
ab7b1c227e Refactor nameserverfilter, now uses filter template
Move most of the functions under the filter or session-classes.
Class definitions moved to a header file. General cleanup. Some features
are still incoming.
2017-03-15 16:19:53 +02:00
Esa Korhonen
32fe220a1b NamedServerFilter multiple "match"-"server"-pairs
The filter now accepts (in addition to the old "match" and "server")
parameters of the form "matchN" and "serverN", where N is a decimal
number with two digits, i.e 01, 02, 03 .. 20. When routing queries,
the regural expressions will be tested one by one, and the servers
from the first match will be added as hints. Also, a single "server"-
setting may contain multiple servers separated by ','. The server
names are not verified to be actual servers, this is up to the user.
2017-03-15 16:19:53 +02:00
Esa Korhonen
3129efb3f7 Add new parameter type MXS_MODULE_PARAM_SERVERLIST
This is a list of servers, separated by commas. When queried as a
config setting, returns a null-terminated array of SERVER*:s. The
commit includes a serverlist parsing function, which should probably
be used anywhere a similarly formed string is parsed.
2017-03-15 11:48:46 +02:00
Esa Korhonen
dd82c46596 Remove two checks that always return false
At the point this function is called, the servers and services are
not yet created.
2017-03-14 11:09:54 +02:00
Markus Mäkelä
8c7618035b Merge branch '2.1' into develop 2017-03-14 10:45:25 +02:00
Markus Mäkelä
7b3c287ac3 Close sessions in MaxScale core
The core now provides a simple function to close a session. This removes
the need for the modules to directly call the API entry points when the
session should be closed. It is also in line with the style that other
objects, namely the DCBs, use. This makes the new session_close very
similar to dcb_close.
2017-03-14 10:45:10 +02:00
Markus Mäkelä
29be8436e5 Remove unused readconnroute code
The state change code was not used.
2017-03-14 10:45:10 +02:00
Markus Mäkelä
9952676052 Move UNIX domain socket creation to utils.c
The network socket code is now completely inside utils.c.
2017-03-14 10:45:10 +02:00
MassimilianoPinto
573615889b Binlog Server doesn't ask for any maxwell query if the option is not set
If ‘maxwell-compatibility’ option is not set, no SET/SELECT are sent to
master during slave registration phase
2017-03-14 09:28:04 +01:00
Markus Mäkelä
fbcd25342c Add 2.1.2 release notes
Created release notes for 2.1.2 and added the new features into it. Also
updated the MySQLAuth limitations in the limitations document.
2017-03-14 10:11:57 +02:00
Markus Mäkelä
4d561c5f6a Detect password usage based on token length
The client protocol module can resolve whether a password was used based
on the information the authenticators gather before authentication is
done. It uses the authentication token length as the basis on which it
makes the decision.
2017-03-13 19:42:38 +02:00
Markus Mäkelä
147a1f88eb Merge branch '2.1-ipv6' into develop 2017-03-13 13:18:08 +02:00
Markus Mäkelä
9c325104b7 Use correct size for snprintf
The mysql authenticator used the size of the pointer for the snprintf size
parameter instead of the actual size of the destination buffer.
2017-03-13 10:45:56 +02:00
Markus Mäkelä
086650bb4d Fix loading of users from multiple servers
The users were deleted before each individual server was queried. This
caused authentication to fail if the authentication data was loaded from
multiple servers.
2017-03-13 10:45:56 +02:00
Markus Mäkelä
e8ef701409 Combine socket creation code
The client connection and the server listener sockets used largely similar
code. Combining them allows for simpler protocol code.

Cleaned up parts of the DCB listener creation and moved the parsing of the
network binding configuration to a higher level.
2017-03-13 10:45:56 +02:00
Markus Mäkelä
7bc47fd5a4 Return the localhost_match_wildcard_host warning
When a local address is used which could match the wildcard host, a
warning is again logged.
2017-03-13 10:45:56 +02:00
Markus Mäkelä
ea55667096 Add back the missing netmask handling code
The netmask code was mistakenly removed when the authentication was moved
to the SQLite based system.
2017-03-13 10:45:56 +02:00
Markus Mäkelä
d88d02ee95 Fix namedserverfilter source parameter
The `source` parameter was broken by the IPv6 change. Now the filter no
longer uses functions from the core to resolve the network addresses.
2017-03-13 10:45:55 +02:00
Markus Mäkelä
894679d611 Fix hostname resolution in MySQLAuth
The hostname resolution was broken by the move to IPv6.
2017-03-13 10:45:55 +02:00
Markus Mäkelä
66ba7f3c80 Simplify network socket creation code
The socket creation code in mysql_backend.c wasn't MySQL specific and it
could be used for all non-blocking network connections. Thus, it makes
sense to move it to a common file where other protocol modules can use
it.

The address resolution code now uses `getaddrinfo` to resolve all
addresses instead of manually handling wildcard hosts. This allows the
same code to be used for all addresses.
2017-03-13 10:45:55 +02:00
Markus Mäkelä
37dd561470 Add support for IPv6
Both the listeners and servers now support IPv6 addresses.

The namedserverfilter does not yet use the new structures and needs to be
fixed in a following commit.
2017-03-13 10:45:55 +02:00
Johan Wikman
82247f9143 Add mxs_strerror
Thread-safe version of strerror; thread local buffer used for storing
the message. The performance penalty of a thread local buffer is not
likely to be significant, since this is only called in an error
situation that anyway is likely to interrupt the normal processing.
2017-03-13 10:45:55 +02:00
Markus Mäkelä
405b944abb Use on-disk database for MySQLAuth users
The SQLite database is now always created on disk. This will remove the
need to dump the database users from the in-memory database to the
persisted on-disk database.

This change will also make the authentication compatible with older SQLite
implementations which lack the URI-based database strings found in newer
versions.
2017-03-13 10:45:55 +02:00
Markus Mäkelä
71b3ee70a4 Fix empty password detection
If a user was defined without a password, the authentication would fail.
2017-03-13 10:45:54 +02:00
Markus Mäkelä
adb9b5049b Fix user cache directory permissions
The user cache directory is only used by the maxscale user so only the
maxscale user should have access to it.
2017-03-13 10:45:54 +02:00
Markus Mäkelä
b796967df8 Add diagnostic entry point to authenticators
The authenticators should have a similar way to print diagnostic
information as filter and routers do. This allows the authenticators to
print the users in their own format.

In the future, all the diagnostic entry points should be changed so that
they return a structure that contains the information in a standard
form. This information can then be formatted in different ways by other
modules.
2017-03-13 10:45:54 +02:00
Markus Mäkelä
f225b29756 Fix injection of service user
The parameters that were given to the user creation function were in the
wrong order.
2017-03-13 10:45:54 +02:00
Markus Mäkelä
2dd79e2e0c Make sure user cache directory exists
The cache directory needs to be created by the authenticator itself.
2017-03-13 10:45:54 +02:00
Markus Mäkelä
a3a2a24c97 Return correct value for failed db authentication
The unknown database error was never triggered as all authentication
errors returned MXS_AUTH_FAILED.
2017-03-13 10:45:54 +02:00
Markus Mäkelä
b2c018a986 Don't users with a pre-4.1 password
The old error message and behavior was lost with the new implementation.
2017-03-13 10:45:53 +02:00
Markus Mäkelä
5494b262d3 Reorder SQL statements when persisting users
The statements are now executed in a more controlled order and a failure
of one will skip the others. The transaction is also rolled back if it
fails.
2017-03-13 10:45:53 +02:00
Markus Mäkelä
0488f8a052 Fix enable_root_user
The option was inverted.
2017-03-13 10:45:53 +02:00
Markus Mäkelä
04899f3a3e Remove unused code from MySQLAuth
Removed the old implementation of MySQL authentication. The user printing
functionality still expects a hashtable which should be fixed.
2017-03-13 10:45:53 +02:00
Markus Mäkelä
b206300975 Exact hostnames grants take precedence over wildcard grants
MariaDB and others match grants first by exact hostname/IP and then by
wildcard. If there are no exact matches, the wildcard grant should be
picked. This can be tested by having different passwords for localhost and
remote address.

The SQLite based authentication should first check for an exact match and
then only after that should it try to match the hostname to a wildcard
grant.
2017-03-13 10:45:53 +02:00
Markus Mäkelä
ba16b8ca1c Fix memory leak in dbusers.c
The MySQL connection was created twice.
2017-03-13 10:45:52 +02:00
Markus Mäkelä
b376d9043a Use new authentication for reauthentication
This fixes the reauthentication of users that was missing from the new
implementation. Now COM_CHANGE_USER should work properly.
2017-03-13 10:45:52 +02:00
Markus Mäkelä
48d70fa4a8 Replace get_users implementation with new version
The get_users function now combines the functionality of the old get_users
and get_all_users. This removes large parts of similar code.

Removed the listener resources as MySQLAuth was the only one that used it.
2017-03-13 10:45:52 +02:00
Markus Mäkelä
62763e2505 Store SQLite tables on disk
The SQLite database users are cached on disk. This allows the binlogrouter
to authenticate users without a connection to the master server.
2017-03-13 10:45:52 +02:00
Markus Mäkelä
2f4df0c21e Store databases in the SQLite database
The databases are now also stored in the sqlite database. This allows the
`resource` member of the USERS struct to be removed in the future.
2017-03-13 10:45:51 +02:00
Markus Mäkelä
041c0f1f2d Use SQLite3 based authentication
The user data is now stored inside a SQLite3 database. By storing the data
inside a database, we remove the restriction that the previous hashtable
based implementation had.
2017-03-13 10:45:51 +02:00
Markus Mäkelä
d4a06c61de Move reauthentication to authenticators
Currently the only situation where a user needs to be authenticated after
the initial authentication is when a COM_CHANGE_USER is being
executed. This was previously handled by directly calling a function in
the MySQLAuth authenticator.

The new entry in the API of the authenticators is very specific to MySQL
and should be reviewed once other protocols are added.
2017-03-13 10:45:51 +02:00
Markus Mäkelä
b53ef249f9 Add comment to Jenkins build variables
One of the values is separated by two spaces. Adding a comment will
prevent any accidental fixes to this comparison operation.
2017-03-13 09:14:35 +02:00
Markus Mäkelä
6da8cfe97e Fix assignment of master status on failed servers
When the real root master server went down, it still received the master
status bit due to how the replication tree was built. The bit should only
be set for servers that are running.

Also fixed a false state change event when the master status bit was
manually cleared from the downed root master server.
2017-03-12 09:40:21 +02:00
Johan Wikman
4f03c53bdf Update 2.1.1 release notes 2017-03-09 10:10:34 +02:00
Markus Mäkelä
415001a4cd Merge branch '2.1' into develop 2017-03-09 10:02:36 +02:00