6943 Commits

Author SHA1 Message Date
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ä
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ä
41ff01d16d Merge branch '2.0' into 2.1 2017-03-09 10:01:38 +02:00
Johan Wikman
d82f4ad6dc Prevent ignoring return value error
When strtol[l] is used for verifying that a string represents a
number, we are not interested in the actual value.
2017-03-09 09:46:38 +02:00
Timofey Turenko
84a6848f10 Add build information to --version-full
If the Jenkins build information is available, print it in the full
version output.
2017-03-09 09:32:37 +02:00
Markus Mäkelä
d764bb9e1f MXS-1178: Fix master_accept_reads
The order of the servers in the service definition could break the
master_accept_reads functionality.

When the first server defined in the service is a slave, it will always be
picked as the first candidate for reads. The master would only be
considered as a candidate for reads if no previous candidate was
available. For this reason, the master_accept_reads only worked when the
first server in the list was the master.
2017-03-09 07:45:29 +02:00
Markus Mäkelä
fd2df3a863 Always open files with configured block size
If the Avro file already exists, it should be opened with the configured
block size instead of the default block size of 16 kilobytes.
2017-03-08 20:03:45 +02:00
Johan Wikman
a925be4e2a Turn off error in qc_sqlite built
GCC on CentOS6 thinks there is an array-bounds error in the sqlite
code. As that code is outside our hands, it is easiest to instruct
GCC not to treat it as an error.
2017-03-08 17:18:06 +02:00
Markus Mäkelä
c18f94b31b Get socket family from struct sockaddr_storage
The struct sockaddr_storage has a member variable that tells the socket
family.
2017-03-08 17:04:14 +02:00
Johan Wikman
25350d6a08 Update change log and release notes 2017-03-08 13:28:13 +02:00
Johan Wikman
b1521e0545 Log the use of prepared statements
If cache decisions should be logged, we log the presence of
prepared statements as they currently are the primary source
for the cache not caching.
2017-03-07 15:45:29 +02:00
Johan Wikman
e1da03ff21 Update version for 2.1.1 2017-03-07 13:06:07 +02:00
Johan Wikman
07ae37f179 Update commit/rollback rules
Now that WORK is recognized as a parser token, the BEGIN and regular
COMMIT and ROLLBACK rules should use them as well.
2017-03-07 11:49:30 +02:00
Johan Wikman
a6ae60c808 Merge branch '2.0' into 2.1 2017-03-07 11:45:49 +02:00
Esa Korhonen
a7379d7ae2 MXS-1165 MaxInfo endless loop
If one queried in MySQL MaxInfo 'show sessions' or 'show clients',
MaxScale would go in an endless loop and finally crash when memory
ran out. The reason is the rather confusing callback-based dcb-
iterating code. Adding one line fixes the issue, although the iteration
is still rather awkward with calling dcb_foreach for every session/
client.
2017-03-07 10:42:48 +02:00
Johan Wikman
60c69d0f7f Update change log and release notes for 2.0.5 2017-03-07 10:33:50 +02:00
Johan Wikman
4f8fdca6ae Update version to 2.0.5 2017-03-07 10:33:50 +02:00
Markus Mäkelä
dd07feda07 MXS-1025: Parse SAVEPOINT statements
The various forms of the SAVEPOINT/RELEASE/ROLLBACK statements are now
fully parsed.
2017-03-07 08:44:21 +02:00
Markus Mäkelä
b4d81ffe27 Use correct capability for schemarouter
The router should use RCAP_TYPE_CONTIGUOUS_INPUT as it parses the
statements.
2017-03-06 16:35:17 +02:00
Markus Mäkelä
e7b5731976 Fix internal test suite
Two of the tests didn't initialize the random number generator.
2017-03-06 11:06:33 +02:00
Markus Mäkelä
bb22b82461 Merge branch '2.0' into 2.1 2017-03-06 10:38:07 +02:00
Markus Mäkelä
f2fc9b9d9f Add workaround for null value handling in Avro C API
The Avro C API fails to write bytes of size zero. A workaround is to write
a single zero byte for each NULL field of type bytes.

Also added an option to configure the Avro block size in case very large
records are written.
2017-03-04 10:12:18 +02:00
Markus Mäkelä
09df0acb00 Fix binlog rotation detection
The rotations of binlogs weren't detected as the file names weren't
compared.

Moved the indexing of the binlogs to the end of the binlog
processing. This way the files can be flushed multiple times before they
are indexed.
2017-03-04 00:31:07 +02:00
Markus Mäkelä
dadc0d6a9d Fix DATETIME and BLOB processing
The old DATETIME format wasn't processed properly which caused a
corruption of following events.

A BLOB type value could be non-NULL but still have no data. In this case,
the value should be stored as a null Avro value.
2017-03-04 00:26:51 +02:00
Markus Mäkelä
916cb4df08 Rename failover and failover_recovery
The names of the parameters were misleading as MaxScale doesn't perform
the actual failover but only detects if one has been done.
2017-03-03 18:45:20 +02:00
Markus Mäkelä
0581ab1afe Extend failover documentation
The documentation now explains more clearly why the parameter is needed
and how it performs the checks.
2017-03-03 18:45:20 +02:00
Markus Mäkelä
09ef292283 Update dbfwfilter build configuration
The filter now uses a more recent syntax to declare the function name
prefixes. This removes a build warning.
2017-03-03 18:44:58 +02:00
Johan Wikman
76e56a2688 Perform SSL cleanup 2017-03-03 13:28:27 +02:00
Esa Korhonen
7b67cfd1ef Variables written to in signal handlers should be volatile 2017-03-03 09:41:56 +02:00
Markus Mäkelä
789c14197d Merge branch '2.0' into 2.1 2017-03-02 14:05:42 +02:00
Markus Mäkelä
3bafcae343 MXS-759: Attempt to create PID directory
When MaxScale is started, it will attempt to create the PID directory. If
the directory does not exist and MaxScale is able to create it, MaxScale
will successfully start whereas it previously failed to do so.

If MaxScale lacks the permissions to create the directory, an error
message is printed to the user explaining the reason why MaxScale fails to
start.
2017-03-02 13:50:31 +02:00
Markus Mäkelä
075ca42482 Expand slave_selection_criteria documentation
Added a section about how `slave_selection_criteria` and
`max_slave_connections` affect each other.
2017-03-02 13:33:45 +02:00
Markus Mäkelä
e2869052bd MXS-1081: Fix VARCHAR field processing
The data length is stored in the field metadata instead of the data being
encoded as a length encoded string.
2017-03-02 13:14:07 +02:00
Johan Wikman
da5edadcda MXS-1150: Do not cache non-cachable functions
The resultset of SELECTs that use functions whose result will
always vary or whose result depend upon the user executing the
query should not be cached. The list of functions is the same
as that specified for the query cache of MariaDB:
https://mariadb.com/kb/en/mariadb/query-cache/
2017-03-02 13:13:31 +02:00
Markus Mäkelä
e01a6a0d58 Fix field name parsing
The fix to field name parsing didn't properly break the loop when the
backtick character was detected.
2017-03-02 13:12:45 +02:00
Markus Mäkelä
e4b4dad94a Add more debug assertions to avro row processing
The debug assertions check that the event pointer isn't moving beyond
allocated memory.
2017-03-02 13:11:52 +02:00
Johan Wikman
923ed9329d Add better cache debugging
Now the statement and the decision is logged. Easier to figure
out why something is or is not cached.
2017-03-02 12:35:53 +02:00
Johan Wikman
4902ed7cf5 MXS-1137: Do not cache when [user|system] vars are used
If user or system variables are used in a SELECT statement, then
the result will not be cached. That ensures that the wrong result
will not be returned.
2017-03-02 12:35:53 +02:00
Johan Wikman
aa51528481 Factor out caching decision making 2017-03-02 12:35:53 +02:00
Markus Mäkelä
97115fae6a Fix threads documentation
The description of the `auto` value was wrong. The algorithm is:

    CPU count - 1
2017-03-02 12:21:06 +02:00