Commit Graph

7422 Commits

Author SHA1 Message Date
c10f56bea1 Fix binlogfilter build failure
The macros weren't apparently included so swapped them to explicit format
strings.
2018-10-05 11:00:08 +03:00
75ea1b6ea1 Fix formatting of new(std::nothrow)
The code previously formatted everything as `new( std::nothrow)`.
2018-10-04 21:50:44 +03:00
a398da58a4 Add sleep to execute_cmd_time_limit
If the query fails instantly, the retries end up busy-looping. Now
each try is at least one second.
2018-10-04 20:19:57 +03:00
707506feae A slave must have running slaves to be a relay master
This prevents some questionable status assignments, but also means that
the Relay Master status can be lost if a slave goes down. This is
contrary to Master status which is not lost if slaves go down. Fixes
mxs1961_standalone_rejoin.
2018-10-04 20:16:29 +03:00
374ae2fc9b Only redirect usable slaves
Prevents pointless retrying/waiting when redirecting slaves.
2018-10-04 20:11:12 +03:00
3b1b63d939 MXS-1777 Change LOWEST_RESPONSE_TIME to ADAPTIVE_ROUTING
LOWEST_RESPONSE_TIME is not quite correct, and marketing material
will call it Adaptive Routing, so better match that.
2018-10-04 19:26:16 +03:00
ef948042f0 Fix race in housekeeper
Could and indeed did lead to housekeeper exiting immediately.
2018-10-04 18:06:12 +03:00
e56492c23f MXS-1777 Make "Sample Max" of the server EMAverage adaptive
A rather simple but very effective method as testing shows.
2018-10-04 17:53:57 +03:00
19f8e1697b Make the Server's EMAverage a member
The combined effort of all workers of updating EMAverage is needed for precision,
statistics and making parts of it adaptive (rather than hardcoded or configured).
2018-10-04 17:53:57 +03:00
ada91f2d53 MXS-1777 Make sure slower servers are sampled sufficiently 2018-10-04 17:53:57 +03:00
415c7fa2d7 MXS-1777 MXS-1777 ResponseStat improvements (take 2).
Fix comments.
Fix a bug in make_valid().
Change sync time (when the average should be pushed to the server EMA)
to only depend on time, not use sample_max. This decreases the amount of
sync calls, and allows for a much shorter sync time. Testing shows this to be
more stabel and allows to make sample_max adaptive .
2018-10-04 17:53:57 +03:00
80c731f02a Fix verify_master_failure
The log message had changed, changed test to match. Also, the remaining
delay is now printed.
2018-10-04 13:38:10 +03:00
86ae0c3e4d MXS-1845 Remove unneeded code & cleanup 2018-10-04 13:38:10 +03:00
a1b3a005dd MXS-1845 Relax cluster operation support requirements
Support for more complicated topologies is quite close to completion and
in any case the function was too aggressive.
2018-10-04 13:09:28 +03:00
661bdd5b82 Work around debug assertions in binlogrouter
The binlogrouter uses buffers across worker threads which is no longer OK
in 2.3. The correct solution would be to store data in something other
than a GWBUF (e.g. std::vector) and protect the sharing with a mutex. The
current solution simply works around the assertions by using macros
instead of functions.
2018-10-04 12:48:27 +03:00
30eb21914f MXS-1845 Switchover cleanup
Several small changes:
Binlog is flushed at the end of old master demotion.
Only new master is required to catch up to old master.
Use the same replication check method as failover.
2018-10-04 11:45:33 +03:00
49e85d9a28 MXS-1845 Add demotion code
The master demotion in switchover now uses query retrying with
the switchover time limit.
2018-10-04 11:45:33 +03:00
a4747f5b03 Revert the last commit, and an additional fix to the
"Fix code for warnings:" commit.
2018-10-03 17:22:10 +03:00
5892ef18af MXS-1777 ResponseStat improvements
Fix comments.
Fix a bug in make_valid().
Change sync time (when the average should be pushed to the server EMA)
to only depend on time, not use sample_max. This decreases the amount of
sync calls, and allows for a much shorter sync time. Testing shows this to be
more stabel and allow better control of the sample_max.
2018-10-03 16:35:06 +03:00
268e689dc5 Fix code for warnings: unused-but-set-variable and warn_unused_result. 2018-10-03 16:33:24 +03:00
b33b888b07 Remove atomic operations from buffers
As buffers are meant to be used only within a particular session, the
atomic operations are no longer necessary and can thus be removed. This
removes the extra overhead that the atomic operations add.
2018-10-03 12:12:59 +03:00
a645467827 Clean up buffer.cc
Cleaned up the code by removing gotos and initializing variables when they
are declared. Also added some space to some functions that felt cramped.
2018-10-03 12:12:59 +03:00
8ad045c019 Remove extra header
The curl header isn't needed nor is it present when building.
2018-10-03 11:58:02 +03:00
8b9fdaa0cb Remove HTTP functionality
It wasn't used so it can be removed.
2018-10-03 08:41:45 +03:00
d866cb3a21 Add bias value to server score calculations
By biasing the values of all counter type scores to positive integers, the
server weights are always taken into use.

This fixes the case when weights were ignored until all score base values
were larger than zero (the mxs922_server test).
2018-10-03 08:41:44 +03:00
ea971a664e Fix readconnroute debug assertion
If the DCB is closed in handleError, it would be NULL in closeSession. To
only close the DCB in one place, the handleError can be reduced to writing
an error to the client and marking the failure as a fatal one.
2018-10-03 08:41:44 +03:00
4216ffa384 Use std:🧵:hardware_concurrency
Using a standard-defined value is better than a system specific one.
2018-10-03 08:41:43 +03:00
e10f34d6aa Remove size restrictions from network reads
The reads now read as much of the data as is available to reduce the
number of distinct malloc calls that need to be made. The SSL_read also
now allocates the buffer before reading into it so that the amount of
copying is reduced.

Also removed some of the not quite helpful debug messages.
2018-10-03 08:41:43 +03:00
1ed708559d Assert that buffers are thread-local
Cross-thread usage of buffers should not happen and the debug assertions
help verify it.
2018-10-03 08:41:43 +03:00
304286e5fa Remove unused code
The BUFFER_TRACE code was not in use and did not work as the HASHTABLE was
removed.
2018-10-03 08:41:42 +03:00
d14b9bfe43 MXS-1845 Cluster stabilization rewrite
No longer writes events to the master, as this creates problems if the
promoted server was not the overall master. Instead, the slave status
output is inspected.
2018-10-02 11:09:16 +03:00
1ca5d02abb MXS-1845 Add redirection code
Should work with multimaster replication.
2018-10-02 11:09:16 +03:00
75f9921ca2 Merge branch '2.2' into develop 2018-10-02 10:18:09 +03:00
288fbc8c33 MXS-2075: Only enable stdout redirection for maxscale
The stdout redirection must not be enabled for the other programs as they
are not run as daemon processes.
2018-10-02 09:44:02 +03:00
62e5f988c5 MXS-2075: Redirect stdout and stderr to the log
If the log file is successfully opened, both stdout and stderr are
redirected to it. This helps catch ASAN reports without having to read the
system journal files.

As the output is redirected to a file, some of the output was made visible
only in non-daemon mode. This helps keep the log file clean and readable.
2018-10-02 09:44:02 +03:00
f65c890287 MXS-2049: Forward client credentials to backend server
Instead of requesting another set of credentials, the client credentials
are simply forwarded to the backend MariaDB server.
2018-10-02 09:44:01 +03:00
93d866c6a7 MXS-2073: Add missing TCP_NODELAY for client sockets
The client connections had the Nagle algorithm enabled which could cause
bad performance with smaller workloads. The common network configuration
code in utils.cc, currently used by the backend connections, sets it
properly.
2018-10-02 09:44:00 +03:00
6b8443aba6 MXS-1845 Complete server promotion code
Now copies slave connections from the previous master. Promotion
code taken into use.
2018-10-01 18:06:39 +03:00
dbbadf1f53 Merge branch '2.2' into develop 2018-10-01 13:10:41 +03:00
c65edd1298 Enhance StopWatch
Clean up, comments and enhancements. StopWatch lap() didn't mean lap-time, but elapsed time. Changed meaning to lap-time and added split() for split-time.
2018-10-01 09:30:24 +03:00
ceb763c9be Fix buffer size in cache rules
If a database, table and a column was defined, the null terminating
character would be written past the end of the buffer.
2018-09-30 22:35:13 +03:00
bb8245d2c1 Merge branch '2.2' into develop 2018-09-30 21:26:47 +03:00
77b53b0889 MXS-2067: Fix build failures
The luafilter didn't include the <mutex> header and mqfilter used the
wrong lock type.
2018-09-30 19:37:12 +03:00
9278da1f54 MXS-2067: Remove spinlock.h
Removed the spinlock.h header and replaced with plain pthread types and
functions.
2018-09-28 12:18:24 +03:00
c95adf1f2e Add prefix to Server member variables
Added the m_ prefix to Server member variables.
2018-09-28 12:18:24 +03:00
3ee5d9a8ea MXS-2067: Move server lock into Server class
The lock for the server is now only visible to the MaxScale core. Changing
the type to std::mutex also allows the use of RAII lock guards.
2018-09-28 12:18:23 +03:00
c0bc611f03 Remove unnecessary readconnroute code
The check for a closed session should never be needed as the core
correctly orders the calls to the module functions. The version numbering
was also not used.

Fixed the incrementation of the query counter so that it uses relaxed
atomic operations.
2018-09-28 12:18:23 +03:00
ab4f870927 MXS-2067: Replace most SPINLOCKs
Replaced SPINLOCK with std::mutex where possible, leaving out the more
complex cases. The big offenders remaining are the binlogrouter and the
gateway.cc OpenSSL locks.
2018-09-28 12:18:23 +03:00
50451166bb MXS-2067: Remove spinlock.hh
Replaced the C++ versions with standard library mutexes.
2018-09-28 12:18:23 +03:00
fc1e36429c MXS-2067: Replace SPINLOCK with pthread_mutex_t
Replaced the SPINLOCK implementation with pthread_mutex_t. The SPINLOCK
interface is still used and will be removed later on.
2018-09-28 12:18:23 +03:00