7416 Commits

Author SHA1 Message Date
Markus Mäkelä
5c0429466c Always include Jansson header directory
The directory is always included even if we are not building the Jansson
library ourselves.
2017-05-03 14:16:37 +03:00
Markus Mäkelä
dd8a10f466 Remove old polling message system
The old polling message system is obsolete now that the worker messages
are implemented. The old system was only used to clean up the persistent
connection pool of a server.
2017-05-03 14:16:35 +03:00
Markus Mäkelä
4c6e0c75a5 Allow execution of tasks from within worker threads
It is now possible to define whether tasks are executed immediately or put
on the event queue of the worker thread. If task execution is in automatic
mode and the current executing thread is a worker thread, the
Task->execute method is called immediately.

This allows tasks to be posted from within worker threads. This is
intended to be used when purging of stale persistent connections and
printing diagnostic output via MaxAdmin. All of these actions are done
from within a worker thread.
2017-05-03 14:03:23 +03:00
Markus Mäkelä
6f24c04a4f Compile core unit tests as C++
Since the core source is C++, the tests should also be C++.
2017-05-03 14:02:25 +03:00
MassimilianoPinto
758dc72f06 Merge branch 'MXS-1209' into develop 2017-05-03 12:56:12 +02:00
MassimilianoPinto
c07350e710 Merge branch 'develop' into MXS-1209 2017-05-03 12:54:19 +02:00
Johan Wikman
ab31cd4b1a Use O_DIRECT, but only if available.
TODO: The kernel version should be looked up at startup and made
      generally available so that it is readily available for
      anybody interested.
2017-05-03 13:39:26 +03:00
MassimilianoPinto
6c7013ab00 MXS-1209: blr_start_master_registration() handles the replication protocol registration
New routine blr_start_master_registration() handles the replication
protocol registration
2017-05-03 08:40:49 +02:00
MassimilianoPinto
b0837dc635 MXS-1209: added blr_register_cache_response
New routine blr_register_cache_response() in use.
2017-05-03 08:30:05 +02:00
MassimilianoPinto
1b5bf65260 MXS-1209: blr_register_send_command() in use for all registration phases
blr_register_send_command() in use for all registration phases
2017-05-02 11:10:55 +02:00
Johan Wikman
00b6c10089 Adjust Worker terminology
- Posting a task to a worker for execution (without implicit wait)
  is called "post".
- Posting a task to every worker for execution (without implicit wait)
  is called "broadcast".

In these cases the task must be provided as a pointer or auto_ptr, to
indicate that the provided pointer must remain alive for longer than
the duration of the function call.

- Posting a task to a worker for execution *and* waiting for all workers
  to have executed the task is called "execute" and the two variants are
  now called "execute_concurrently" and "execute_serially".

In these cases the task is provided as a reference, since the functions
will return only when all workers have (in concurrent or serial fashion)
executed the task. That is, it need not remain alive for longer than the
duration of the function call.
2017-05-02 11:32:08 +03:00
Johan Wikman
1b58a75f42 Add concurrent execution helper to Worker
Concurrently executing a task on all workers *and* waiting until
all workers have executed the task seems to be common enough to
warrant a helper function for that purpose.
2017-05-02 10:54:29 +03:00
Esa Korhonen
bfd94c2b31 KILL [CONNECTION | QUERY] support, part1
Preparation for adding KILL syntax support.
Session id changed to uint32 everywhere. Added atomic op.
Session id can be acquired before session_alloc().
Added session_alloc_with_id(), which is given a session id number.
Worker object has a session_id->SESSION* mapping, not used yet.
2017-05-02 10:29:55 +03:00
MassimilianoPinto
3c6006a010 MXS-1209: added blr_register_send_command()
MXS-1209: added blr_register_send_command()
2017-05-02 09:11:15 +02:00
Esa Korhonen
46da2d3ad2 Add entry on proxy protocol to release notes 2017-05-02 10:07:30 +03:00
MassimilianoPinto
5cef78b7d4 MXS-1209: blr_master.c cleanup
Further optimisations will come with new registration phases
2017-04-28 18:08:33 +02:00
MassimilianoPinto
23c166ba37 Merge branch 'develop' into MXS-1209 2017-04-28 16:43:49 +02:00
MassimilianoPinto
2c6d08325a MXS-1209: blr_master.c cleanup
blr_master.c cleanup continues
2017-04-28 16:22:26 +02:00
Markus Mäkelä
ab33f05f7a Use correct __atomic builtins for atomic_add
The atomic_add function should return the old value.
2017-04-28 16:27:20 +03:00
Esa Korhonen
c90c870727 Add proxy protocol setting documentation 2017-04-28 15:28:51 +03:00
Markus Mäkelä
97e57d92ff Check GCC version instead of C++ standard
The C++11 standard in pre-4.8 GCC versions lacks the thread_local
implementation. For those versions, the __thread qualifier should be used.
2017-04-28 14:53:37 +03:00
Markus Mäkelä
601976dede Use __atomic builtins only where they are supported
Use the newer __atomic builtins only with GCC >= 4.7. The older __sync
builtins are used elsewhere.
2017-04-28 14:53:37 +03:00
Johan Wikman
6a3d99afe5 Prevent adding DCBs on non-worker threads 2017-04-28 12:56:38 +03:00
MassimilianoPinto
1203a8211a MXS-1209: blr_master.c cleanup
blr_master.c cleanup continues
2017-04-28 11:40:11 +02:00
MassimilianoPinto
07e95d03ec Merge branch 'develop' into MXS-1209 2017-04-27 18:08:04 +02:00
Johan Wikman
fae4b2d99a MXS-1209: Ensure master is connected to in main worker 2017-04-27 18:05:22 +02:00
MassimilianoPinto
4ab1156cef Merge branch 'develop' into MXS-1209 2017-04-27 18:04:18 +02:00
MassimilianoPinto
9a34aa5c7f Fprintf removed
Fprintf removed
2017-04-27 18:03:34 +02:00
Esa Korhonen
8f50269338 Add proxy protocol support
Adds a server-specific parameter, "use_proxy_protocol". If enabled,
a header string is sent to the backend when a routing session connection
changes state to MXS_AUTH_STATE_CONNECTED. The string contains the real
client IP and port.
2017-04-27 12:29:46 +03:00
Johan Wikman
a4f9beb1ad MXS-1209: Ensure master is connected to in main worker 2017-04-27 11:00:07 +03:00
MassimilianoPinto
1e98de7b15 Added extra debug fprintf
Added extra debug fprintf
2017-04-27 09:15:32 +02:00
Johan Wikman
deb11ae6eb Merge branch '2.1' into develop 2017-04-27 09:11:02 +03:00
MassimilianoPinto
de8febf9a9 Binlogrouter: set poll.thread.id from mxs_worker_get_current_id()
As 'client' is the fake DCB that emulates a client session,
poll.thread.id for the "dummy client" must be set to the current
thread_id that calls blr_start_master()

This affects both startup and START SLAVE (via mysql client)
2017-04-26 17:38:22 +02:00
MassimilianoPinto
e10dd1329d Merge branch 'develop' into MXS-1209 2017-04-26 16:21:39 +02:00
MassimilianoPinto
2428468f47 MXS-1209: blr_master.c cleanup
blr_master.c cleanup continues
2017-04-26 16:06:42 +02:00
MassimilianoPinto
656cb3c517 Added depth and SERVER_SLAVE_OF_EXTERNAL_MASTER for build_mysql51_replication_tree
Now build_mysql51_replication_tree assigns depth and handles
SERVER_SLAVE_OF_EXTERNAL_MASTER status
2017-04-26 13:40:28 +03:00
MassimilianoPinto
57700215ac MXS-1244: MySQL monitor "detect_replication_lag=true" doesn't work with "mysql51_replication=true"
Added the missing handle->master assignment
2017-04-26 13:39:55 +03:00
Johan Wikman
728c780187 Expose current worker id to c-files 2017-04-26 13:17:23 +03:00
Johan Wikman
c8c2822c7b Link storage_rocksdb with lz4 2017-04-26 13:15:23 +03:00
Johan Wikman
48ed7792a5 Arrange so that startup connections are handled by main Worker
When the Worker mechanism has been initialized the current_worker_id
of the calling thread is set to 0. That way, connections can be created
after Worker::init() has been called, but before the workers have been
started. Such connections will be handled by the worker that is running
in the main thread.
2017-04-26 10:57:50 +03:00
Markus Mäkelä
5bf79637c6 Document the service users refresh interval
The interval between refreshes of the database users list wasn't
documented.
2017-04-26 09:47:59 +03:00
MassimilianoPinto
870027dffe MXS-1209: Cleaning up Master registration phase
Master registration phase is using new routines
2017-04-26 08:14:26 +02:00
Markus Mäkelä
4cdb7bc49b Use Semaphore multi-wait
The dcb_foreach_parallel now uses the correct method of the Semaphore
class.
2017-04-25 15:05:24 +03:00
Markus Mäkelä
c3df805b22 Make dcb_foreach thread-safe
The function was no longer thread-safe as it used the obsolete per-thread
spinlocks to iterate over the DCBs. Now the function uses the newly added
WorkerTask class to iterate over them.

Since the new WorkerTask mechanism is far superion to dcb_foreach, the
latter is now deprecated.
2017-04-25 15:04:42 +03:00
Markus Mäkelä
963ff0216d Allow serial execution of worker tasks
The Worker::execute_on_all_wait is intended to be used with dcb_foreach
which expects a single-threaded context for its function.
2017-04-25 15:04:42 +03:00
Johan Wikman
ea39b15bbb Add safety check and rename ref mgmt functions 2017-04-25 13:20:14 +03:00
Johan Wikman
55011c2951 Add safety check and rename ref mgmt functions 2017-04-25 13:10:01 +03:00
Johan Wikman
1eb409a666 Add possibility to wait several times on a semaphore 2017-04-25 13:10:01 +03:00
Esa Korhonen
f1efe72f66 Additional documentation cleanup for 2.1
Mostly just reflow text (=linebreaks) for better diffs. Some small changes.
Remove Debug-And-Diagnostic-Support.md.
2017-04-25 10:04:31 +03:00
Markus Mäkelä
19cf8c489e Rename atomic store and load functions
The atomic store and load functions are now called atomic_store_X and
atomic_load_X where X is one of int32, int64 or uint64.
2017-04-24 16:11:34 +03:00