2160 Commits

Author SHA1 Message Date
Markus Makela
affba3cd65 Merge branch '1.2.1-binlog_router_trx' into release-1.4.2 2016-04-15 11:15:01 +03:00
Markus Makela
2855389fe2 Non-critical errors in binlogrouter are now properly logged as warnings
The event distribution error messages were not truly errors but only rare
corner cases that usually don't happen. This doesn't mean that they should
be treated as errors and treating them as warnings is more helpful.
2016-04-15 10:37:21 +03:00
Markus Makela
aabcc4fb12 Added clarifying comments to event distribution code
When a slave transitions from catchup mode to up-to-date mode, it is possible
that events are being distributed and the slave appears to be lagging behind.
The added comment explain why it happens and how it is handled to make the code
clearer.
2016-04-15 10:18:50 +03:00
Markus Makela
312c825b4e Added client IP address to authentication error messages
Client authentication problems are easier to solve when the client IP is logged
in case a failed authentication attempt is made. This will also make it easier
to detect possible security problems.
2016-04-14 20:55:08 +03:00
Markus Makela
25f4238231 Merge branch '1.2.1-binlog_router_trx' into release-1.4.2 2016-04-14 18:52:36 +03:00
Markus Makela
edb1c18e83 Added missing check for error packets
A missing else branch caused the binlogrouter to crash when it
requests non-existent binlog file.
2016-04-14 17:51:42 +03:00
Markus Makela
bb2d549a00 Slaves that are behind the master no longer cause an error to be logged
When a slave transitions from catchup mode to up-to-date mode, an error
message is logged because the slave is at an unexpected position. This
error message should not be logged because it is a possible and an expected
situation.
2016-04-14 12:01:02 +03:00
Markus Makela
6988c0bfed Fixed rotate events never being distributed
The check for rotate event conditions was wrong which led to false error
message about unexpected binlog file and position combinations.

The position of the last event was reset every time a file was opened which
caused problems when the binlog file was rotated. The slave's current positions
were compared to the position where the last event started and because the
last_event_pos variable didn't point to the rotate event of the previous binlog,
the slave's never got the rotate event.
2016-04-14 11:02:03 +03:00
Markus Makela
440bc049c0 Added more information to binlogrouter error messages
The name of the binlog file was added to the log message where a slave
is behind the master but the same file is used. This makes debugging the problem
a bit easier.
2016-04-14 11:02:03 +03:00
Markus Makela
df9f8eba82 Improved binlogrouter event distribution error messages
Added master position and current safe event to log messages about unexpected
slave binlog file positions.
2016-04-14 11:02:03 +03:00
MassimilianoPinto
335b1e095f Added master pos to log message
Added master pos to log message
2016-04-14 11:02:03 +03:00
Markus Makela
52ef8987cb Made sending of events more strict
The decision to send an event to a slave can now only be made in one place.
This will force all events to pass the same checks before they are sent to
the slaves.
2016-04-14 11:02:03 +03:00
Markus Makela
aa7e3461c8 Fixed event position updating
The position of the next event to be written was used as the position
of the current event. This caused the checks for the position of the current
safe event to fail and the non-transaction safe version was used.

This only happened with events that are not done inside a transaction i.e.
DDL statements.
2016-04-14 11:02:03 +03:00
Markus Makela
cf62ac0e6c Added more information to the incomplete transaction error message
The error message now logs the caller role, current safe event and the event
type.
2016-04-14 11:02:01 +03:00
Markus Makela
fe84f9599b Removed messages about incomplete transaction events
The message is logged when a DDL statement is executed. It should not be
logged if trx_safe is on since the current_safe_event should always point
at the event we are sending. The current_safe_event is set to the wrong value
which causes this message to be logged.

Due to the false positives caused by this, the message is removed.
2016-04-07 12:51:38 +03:00
Markus Makela
bb94ffb9ea Added more information to duplicate event error message
The message now states the location where it was called from and the amount
of events received from the master. In addition to this, new logging was
added when unsafe events are sent to slaves when transaction safety is enabled.
2016-04-06 17:30:25 +03:00
Markus Makela
0ce48474eb Added logging for safe event and current event mismatch
If the position being currently processed is not the current safe event,
a log message is written.
2016-04-05 16:57:39 +03:00
Markus Makela
ed9356562c Added DCB write queue to error message
The duplicate event error message now logs the length of the slave's
write queue. This will tell how much data is still buffered inside MaxScale
when duplicate events are detected.
2016-04-05 15:01:30 +03:00
Johan Wikman
0493196ecc Disconnect slave if duplicate event detected
If a duplicate event is detected the state of the slave is set
to BLRS_ERRORED and the connection is closed. That way the
duplicate event will not break the slave, and it will pick
up its state when it reconnects.
2016-03-31 10:57:23 +03:00
Johan Wikman
51e60000dd Add duplicate event detection & logging.
When an event is sent to a slave, we store information about the
event and who sent it, so that we can detect if the same event is
sent twice. If a duplicate event is detected, we log information
about it.
2016-03-31 10:50:47 +03:00
Markus Makela
3c8bba26c9 MXS-646: Namedserverfilter ignores user and source
The namedserverfilter did not check if it was active for the session
before adding a routing hint to it.
2016-03-23 14:00:55 +02:00
Markus Makela
19016f4a9b Removed false debug assertion in readwritesplit
The readwritesplit assumed that the execution of a session command would
always succeed. This is not the case when a write to the backend server
fails and it is not something that shouldn't happen.
2016-03-21 14:04:13 +02:00
Markus Makela
4ee1f304ca MXS-585 regression: Authentication packets are now processed in contiguous memory
The client side authentication assumed that it was processing contiguous memory.
This caused the authentication to fail when packets were received in multiple
parts. Transforming the buffer chain into one contiguous buffer fixes this problem.
2016-03-18 11:22:13 +02:00
Markus Makela
34c3d2c230 MXS-627: Changed the default version string
The default version string is now `5.5.5-10.0.0 <MaxScale version>-maxscale`.
This fill fix Java connector issues related to version string processing.
2016-03-18 10:25:18 +02:00
Johan Wikman
f551099af9 Reformat blr.h
By oversight was not reformatted when the source was.
2016-03-17 17:06:23 +02:00
Johan Wikman
5070b81473 Reformat binlog router. 2016-03-15 12:56:41 +02:00
Markus Makela
fd34cd4014 Fixed luafilter build failures
The luafilter referred to the old session client DCB name and linked against
log_manager and utils but not maxscale-common.
2016-03-08 10:35:36 +02:00
Markus Makela
3973ba36be Simplified tee filter packet handling logic
Inverting the default action of not routing packets to always routing packets
makes the code simpler to understand. Removing some of the not so useful debug
logging also makes the code more readable and easier to understand.
2016-03-07 16:21:48 +02:00
Markus Makela
60714135c4 Merge branch 'develop-MXS-544-merge' into develop 2016-03-07 10:17:17 +02:00
Markus Makela
7bae03f3b8 Added missing PCRE link flags to binlogrouter
MariaDB 10.0 might require it to be linked against system PCRE. This will allow
the binlogrouter to be built with MariaDB 10.0 embedded libraries.
2016-03-05 06:23:35 +02:00
Markus Makela
609912ae90 Fixed readwritesplit server weight calculations
The server weights were ignored for the first connection and servers with a
weight of 0 would get connections if the connection count was high enough.

This fixes the weighting behavior so that when connections are created,
servers with a weight of 0 will be ignored as long as there is a server
with a positive weight available.

With this change, three servers configured with weights 2, 1 and 0 would
get connections balanced in the following way:

weight = 2, 66% of connections
weight = 1, 33% of connections
weight = 0, 0% of connections

If the server with the weight of 2 would go down, the server with the weight
of 1 would get 100% of the connections. If both servers with positive weights
go down, the server with the weight of 0 would be used.
2016-03-04 15:06:24 +02:00
Johan Wikman
a86903f3d0 Remove obsolete declarations.
And dummy definitions as well.
2016-03-04 14:10:34 +02:00
Johan Wikman
bb4f7bd285 Remove obsolete declarations.
And dummy definitions as well.
2016-03-04 13:10:05 +02:00
Johan Wikman
739fe7039c Use new functions for accessing start- and uptime. 2016-03-04 11:55:47 +02:00
Johan Wikman
5a3d511f44 Use new functions for accessing start- and uptime. 2016-03-04 11:47:12 +02:00
Markus Makela
dd9f7fbbb7 Fixed rwsplit length calculations for multi-statements
The calculations used the amount of bytes read instead of amount of bytes
available and also read one byte too much.
2016-03-04 09:56:18 +02:00
Johan Wikman
59edee26c6 Fix misses in slavelag.c formatting.
astyle is more thorough.
2016-03-04 09:01:43 +02:00
Johan Wikman
6b4ffc8506 Cleanup slavelag.c
Untabification, indentation, Allman, etc.
2016-03-04 08:43:35 +02:00
Markus Makela
d1837e0e4a Added more error logging and fixed parsing of packets in readwritesplit
Readwritesplit tried to parse COM_PING packets which only have one byte of
payload. This would cause the queries to fail to parsed.
2016-03-04 07:55:03 +02:00
Markus Makela
d3da98b58f Merge branch 'MXS-544' into develop-MXS-544-merge 2016-03-03 21:39:39 +02:00
Markus Makela
1a2bd8b234 Added FindLua.cmake from KitWare's repo for CMake 3.4.3
Some platforms did not have the FindLua.cmake file which caused errors on
configuration. Moved the invocation of find_package to the filter CMakeLists.txt
so that it is only called if the luafilter is built.
2016-03-03 16:42:48 +02:00
Markus Makela
76f06572ed Fix to multi-statement processing
Renamed is_mysql_comment_start to is_mysql_statement_end because it checks
whether a statement truly ends instead of just checking comment block starts.

The calculations for buffer length in readwritesplit now use the payload size
instead of the buffer size.
2016-03-03 10:44:11 +02:00
Markus Makela
8b6595aa68 Improvements and fixes to strchr_esc_mysql
The C style comments were not ignored and the -- style comments
did not check for the trailing whitespace and made return values char*.

The creation of a stored procedure would prevent sessions from using
any of the slave servers because readwritesplit would interpret
the creation statement as a multi-statement query.

Parts of modutil and readwritesplit now compare pointers to pointers instead of
converting pointers to integers.
2016-03-02 21:34:22 +02:00
Markus Makela
2589630b8e Unknown SQL commands are treated as writes
This will prevent any possible damage to a slave by new or unexpected commands.
2016-03-02 21:27:34 +02:00
Markus Makela
9bfef5c7c1 Improved multi-statement detection in readwritesplit
Now comment blocks and identifiers quoted with backticks are taken into
consideration when multi-statements are processed.
2016-03-02 21:27:34 +02:00
Markus Makela
e1a8a6f373 Luafilter is not built by default
The luafilter requires the lua development libraries so it isn't built
by default.
2016-03-02 13:37:00 +02:00
Markus Makela
b2742f02b9 More formatting of code
Code formatting.
2016-03-02 13:28:12 +02:00
Markus Makela
2204a245c9 General cleaning up of the luafilter
Renamed variables to make their use more clear and cmake now looks for the Lua
libraries.
2016-03-02 13:28:12 +02:00
Markus Makela
140d284eed Updated documentation for luafilter
Added more documentation to functions about how, when and with what parameters
the Lua functions are called with. Also adjusted the module version to experimental.
2016-03-02 13:27:24 +02:00
Markus Makela
1c74ca0ec7 Cleaned up the luafilter. 2016-03-02 13:27:24 +02:00