Commit Graph

3657 Commits

Author SHA1 Message Date
fd176c4122 Merge branch '2.2' into develop 2018-09-11 12:57:19 +03:00
c04073a96c MXS-2040 Increase default monitor timeouts
All three timeouts are now three seconds. This should reduce the amount of
timeout errors users get during failover/switchover.
2018-09-11 12:31:41 +03:00
94a567f4ca Remove redundant Worker method
The Worker::get_local_statistics was a duplicate of Worker::statistics.
2018-09-10 14:14:21 +03:00
58c0b4f5f4 MXS-1632: Remove the unused statistics code
The statistics code was almost completely unused.
2018-09-10 14:14:20 +03:00
108638b0cf Format with Uncrustify 0.67 2018-09-10 13:31:39 +03:00
d11c78ad80 Format all sources with Uncrustify
Formatted all sources and manually tuned some files to make the code look
neater.
2018-09-10 13:22:49 +03:00
8c03b626c4 Make users diagnostic deterministic
The output from Users::diagnostic is now ordered by first inserting the
usernames into a std::set.
2018-09-10 11:21:06 +03:00
c81173e320 Move C++ code out of C headers
The additions into the server.h header used C++ language which caused C
programs to fail to compile. Moved the implementation of the EMAverage
class into the private Server class in the server.hh header and exposed it
via functions in the server.h header. Also temporarily moved
almost_equal_server_scores into the public server.hh as there is no
service.hh header.
2018-09-10 11:21:06 +03:00
c447e5cf15 Uncrustify maxscale
See script directory for method. The script to run in the top level
MaxScale directory is called maxscale-uncrustify.sh, which uses
another script, list-src, from the same directory (so you need to set
your PATH). The uncrustify version was 0.66.
2018-09-09 22:26:19 +03:00
91acbc0994 MXS-1777 Turn server weights to their inverses, and make them doubles.
The math becomes simpler when the weight is inverted, i.e. a simple multiplication
to get the (inverse) score. Inverse weights are normalized to the range [0..1] where a lower
number is a higher weight,
The enum select_criteria_t is used to provide a std::function that takes the backends
as vector  (rather than the prior pairwise compares) and returns the best backend.
2018-09-05 17:45:28 +03:00
6351ab9c73 MXS-1777: Initial version of routing based on query response time.
The main piece of code, slave selection (backend_cmp_response_time), uses the available
method of pair-wise comparison of slaves. This will be changed to selection using all
available slaves, along with removal of hard coded values.
2018-09-05 17:05:06 +03:00
1e6509423a MXS-1777: Add an EMAverage to the server struct, and a new slave selection criteria.
This is to support calculating the average from a session, and the slave selection criteria to be able to route based on averages. This commit, like the next one, have TODOs which you should feel free to comment on. Undecided things.
2018-09-05 17:05:06 +03:00
19b059d303 Add std::function overload to RoutingWorker::broadcast
This makes it easier to collect distributed results from multiple workers.
2018-09-04 13:04:08 +03:00
26dfb19ea4 Make routingworker.hh public
Given that worker.hh was public, it made sense to make routingworker.hh
public as well. This removes the need to include private headers in
modules and allows C++ constructs to be used in C++ code when previously
only the C API was available.
2018-09-04 13:04:08 +03:00
bd2e23fb85 Add mxs::rworker_local<T> datatype
The mxs::rworker_local<T> is a convenience type that provides fast read
access with thread-safe updates. It is intended to be used with data that
is read often but updated rarely e.g. configuration data for routers.
2018-09-04 13:04:08 +03:00
763e1395ae Print port with 'enable-statement-logging' 2018-09-03 11:08:33 +03:00
2b42011250 Merge branch '2.2' into develop 2018-09-03 10:48:26 +03:00
79ba89fba1 MXS-2034 Set query_retry_timeout
Was setting query_retry instead.
2018-09-03 10:46:32 +03:00
32c4e60516 Do not re-initialize the log
Do not re-initialize the log without it having been finished
in between.
2018-08-30 15:03:06 +03:00
a13e95951b Merge branch '2.2' into develop 2018-08-30 11:37:49 +03:00
5f4aa46552 MXS-2027: Store LOAD DATA state inside MXS_SESSION
By storing the data gathere by readwritesplit inside the session, the
protocol will be aware of the state of the LOAD DATA LOCAL INFILE
execution. This prevents misinterpretation of the data which previously
led to closed connections, effectively rendering LOAD DATA LOCAL INFILE
unusable.

This change is a temporary solution to a problem that needs to be solved
at the protocol level. The changes required to implement this are too big
to add into a bug fix release.
2018-08-29 18:10:51 +03:00
a593d00c65 Simplify failed master detection
No longer depends on monitor events as the other operations do not
either. The active_event/new_event detection was removed, as these
only protect against a rare situation. A similar feature which
protects all the cluster modifications will be implemented later.
2018-08-29 17:04:05 +03:00
54dca0963a Only serialize active server parameters 2018-08-29 11:23:00 +03:00
73288829b5 Remove default values for protocol
The parameter is the module name so it needs to be in the configuration.
2018-08-29 11:23:00 +03:00
e260d493fd Disallow duplicate server parameters
By replacing server_add_parameter and server_update_parameter with a
single server_set_parameter function, duplication of parameters is
prevented.
2018-08-29 11:23:00 +03:00
d9ddf0f720 Reinstate implicit log initialization
As some of the functionality depends on the log being default initialized
in the case an error occurs, the code needed to be reinstated.
2018-08-29 11:06:12 +03:00
9adc08a686 Move log initialization into a function
This will be of help when the implicit log initialization is added back.
2018-08-29 11:06:11 +03:00
8b653133a7 Add shutdown detection
The maxscale_is_shutting_down function is used to detect when MaxScale
should stop. This fixes a race condition in the code where the workers has
not yet been initialized but a termination signal has been received. It
also replaces the misuse of the service_should_stop variable with a proper
function.
2018-08-29 11:06:11 +03:00
a29851a42c MXS-2026 Use qc_init(...)/qc_end()
Use qc_init(...)/qc_end() for initializing QC in test-programs.
2018-08-29 09:47:13 +03:00
ce715e03aa MXS-2026 Make QC default initialization simpler
In test-programs and alike, QC can now be initialized with
one function instead of three.
2018-08-29 09:47:13 +03:00
5c1a1c2700 MXS-2026 Separate QC process and thread initialization
qc_thread_init() must now explicitly be called in every thread
and not just in other threads but the one where qc_process_init()
is called.

This change was caused by QC_INIT_SELF initialization actually
being performed in query_classifier.cc. Before this change, there
actually was a leak in the routing worker running in the main
thread, the query classification cache was created twice.
2018-08-29 09:47:13 +03:00
2f7ed85b3f MXS-2026 Keep COM_QUERY and COM_STMT_PREPARE separate 2018-08-27 14:21:34 +03:00
25c0d3da14 Always treat unloadable modules as an error
When the loading of a module fails, be it due to a typo or a problem in
the library, the configuration is labeled as invalid.
2018-08-27 14:03:39 +03:00
c92aa02961 Don't use log before initialization
The print_log_n_stderr function used to implicitly initialize the log
manager. As this is no longer done, no logging must be done before the log
manager is initialized.
2018-08-27 14:03:39 +03:00
8cfc966561 MXS-1929: Update unit tests with monitor changes
The user is a mandatory parameter and needs to be passed when a monitor is
created.
2018-08-23 15:46:47 +03:00
3eb7072972 MXS-1929: Improve runtime monitor creation
The monitor JSON is now more closely inspected before the actual monitor
is allocated. This prevents creation of monitors without credentials which
was previously possible.

The monitor alteration was also changed to stop and start the monitor only
once instead of stopping and starting after each parameter
modification. This prevents multi-parameter updates from failing due to
monitors seeing a partial set of the new values. Currently only the
`replication_user` and `replication_password` parameters could cause this.
2018-08-23 15:46:47 +03:00
fe124b79cc MXS-1929: Fix state of services created at runtime
If a service was created at runtime, it would be in the Allocated state
until it was stopped. The serviceStart function isn't necessary from a
functional point of view (a new service cannot have listeners that need
starting) but it does set the correct state and it's the "right" thing to
do.
2018-08-23 15:46:46 +03:00
065ee50d53 MXS-1929: Start monitors after creation
Monitors created via the REST API that were started and configured
successfully should also be started. This removes the extra step of
starting the monitor after creating it.
2018-08-23 15:46:46 +03:00
a6bef0a80d Add credentials for remove REST API calls
The base URL and credentials used for REST API calls can now be defined in
the [maxscale] section. This allows encrypted passwords to be used.
2018-08-23 15:46:46 +03:00
fe7d7475a4 Improve PID file check
The executable name of the PID is now checked to be maxscale. This fixes
the problem where MaxScale would refuse to start if a stale PID file had a
PID of a process that's not a MaxScale process.
2018-08-23 15:46:46 +03:00
ad36a50e97 Remove log initialization form print_log_n_stderr
The log manager must not be initialized twice. If an error is to be logged
to a file, the log manager has already been initialized.
2018-08-23 15:46:46 +03:00
1692765503 Enable query classifier cache by default
Enabling it will give a performance improvement and it offloads work from
the CPU. This leads to better and more complete utilization of system
resources.
2018-08-23 15:46:45 +03:00
13c04324cf Add master extraction via REST API
The master server of a monitor can now be extracted with the
mon_get_external_master function. It uses the REST API to find a master
server in the set of servers monitored by a monitor.
2018-08-23 15:46:45 +03:00
934600f8fc Add minimal HTTP GET test
The test does a request and prints the responses. It is done to see that
the functionality works. Also added a timeout of 10 seconds to both the
connection and data transfer phases.
2018-08-23 15:46:45 +03:00
f8fb9510c9 Add HTTP GET function
The function performs a HTTP GET on a URL and returns the HTTP response.
2018-08-23 15:46:45 +03:00
75c298f63c MXS-2011 Make listener_set_ssl_version() const correct 2018-08-23 09:24:46 +03:00
8e7b012852 Don't call some of atexit functions twice
Registering of atexit functions was fixed so these functions don't need
to be called here anymore.
2018-08-22 22:51:32 +03:00
5485f83e75 MXS-1929: Always store the module name parameter
Services, monitors and filters all use the parameters for object
serialization. This means that when the object is created, the module
parameter must be in the parameter list.
2018-08-22 16:43:17 +03:00
276ff70506 MXS-1929: Prevent alterations to filters and servers
These parameters must not be altered at runtime via the `alter service` or
`alter monitor` commands.
2018-08-22 16:43:17 +03:00
ab9a9f92cb MXS-2020 Remove maxscale/debug.h
- Removed from all files.
- maxbase/assert.h included where necessary.
2018-08-22 11:35:35 +03:00