Commit Graph

7490 Commits

Author SHA1 Message Date
4ab1156cef Merge branch 'develop' into MXS-1209 2017-04-27 18:04:18 +02:00
9a34aa5c7f Fprintf removed
Fprintf removed
2017-04-27 18:03:34 +02:00
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
a4f9beb1ad MXS-1209: Ensure master is connected to in main worker 2017-04-27 11:00:07 +03:00
1e98de7b15 Added extra debug fprintf
Added extra debug fprintf
2017-04-27 09:15:32 +02:00
deb11ae6eb Merge branch '2.1' into develop 2017-04-27 09:11:02 +03:00
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
e10dd1329d Merge branch 'develop' into MXS-1209 2017-04-26 16:21:39 +02:00
2428468f47 MXS-1209: blr_master.c cleanup
blr_master.c cleanup continues
2017-04-26 16:06:42 +02:00
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
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
728c780187 Expose current worker id to c-files 2017-04-26 13:17:23 +03:00
c8c2822c7b Link storage_rocksdb with lz4 2017-04-26 13:15:23 +03:00
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
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
870027dffe MXS-1209: Cleaning up Master registration phase
Master registration phase is using new routines
2017-04-26 08:14:26 +02:00
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
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
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
ea39b15bbb Add safety check and rename ref mgmt functions 2017-04-25 13:20:14 +03:00
55011c2951 Add safety check and rename ref mgmt functions 2017-04-25 13:10:01 +03:00
1eb409a666 Add possibility to wait several times on a semaphore 2017-04-25 13:10:01 +03:00
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
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
f91d415be1 Add simple test for atomic operations
The test runs some simple tests with the atomic operations in MaxScale.
2017-04-24 15:58:28 +03:00
122337569c Add atomic store and load operations
Added abstractions for storing and loading 32-bit and 64-bit values
atomically. The functions currently use the GCC __atomic builtin atomics.
2017-04-24 15:58:28 +03:00
8174690f77 Introduce concept of Worker tasks
A Worker::Task is an object that can be sent to a worker for
execution. The task is sent to the worker using the messaging
mechanism where the `execute` function of the task will be
called in the thread context of the worker.

There are two kinds of tasks; regular tasks and disposable tasks.
The former are just sent to the worker for execution while the
latter are sent and subsequently disposed of, once the task has
been executed.

A disposable task can be sent to either one worker or to all
workers. In the latter case, the task will be deleted once it
has been executed by all workers.

A semaphore can be associated with a regular task. Once the task
has been executed by the worker, the semaphore will automatically
be posted. That way, it is trivial to send a task for execution
to a worker and wait until the task has been executed. For instance:

    Semaphore sem;
    MyTask task;

    pWorker->execute(&task, &sem);
    sem.wait();

    const MyResult& result = task.result();

The low level mechanism for posting and broadcasting messages will
be removed.
2017-04-24 14:52:54 +03:00
172cdbc5a3 Update comment regarding use of level-triggered events 2017-04-24 10:51:45 +03:00
b0922576be Add Semaphore class
A simple Semaphore class that makes it simpler and less
erroprone to use a semaphore.
2017-04-23 18:54:18 +03:00
c5fd2bdb81 Add listening sockets to shared epoll instance
All sorts of additional cleaning up can now be performed.
2017-04-22 17:02:52 +03:00
56b411aea9 Add shared epoll instance to workers
All workers share an epoll instance that is added level-triggered
to the epoll instance of each Worker. This is intended to be used
together with listening sockets.

When a listening socket is added to the shared epoll instance the
effect is that EPOLLIN will be active for it whenever there is a
connection pending on a listening socket added to that epoll
instance.

When that occurs all workers in their epoll_wait()-calls will return.
When the workers subsequently call epoll_wait() on the shared epoll
instance, that will return with an event provided some other thread(s)
has not yet called accept() on the listening socket.

As each worker extracts just one event at a time and calls accept just
once before calling epoll_wait(), it means that the client connections
will be distributed evenly across all workers, provided the load on
the workers is roughly the same. If it isn't then a worker with less
load will get more connections to handle (which will even out the load).
2017-04-21 21:24:20 +03:00
a27bec5e88 Add return value to Worker::init()
Cleaner to return status than exit upon failure.
2017-04-21 19:57:45 +03:00
2cc3382a46 Add JDBC batch execution limitation to documentation
Readwritesplit doesn't properly handle batched statement execution in
2.1.3. This is now reflected by the limitations document.
2017-04-21 13:55:25 +03:00
d1959549fe Update limitations document
Add note about prepared statements, transaction state and
autocommit mode.
2017-04-21 12:31:21 +03:00
d7e37b94ce Add notes on MariaDB 10.2 2017-04-21 12:09:03 +03:00
defbb9e23b Update upgrade documentation and link to it 2017-04-21 11:27:16 +03:00
e8dfccb4c8 2.1 doc esak (#127)
* Update MySQL-Replication-Read-Write-Splitting-Tutorial.md

* Update MySQL-Replication-Read-Write-Splitting-Tutorial.md

* Update MySQL-Replication-Read-Write-Splitting-Tutorial.md

* Update MySQL-Cluster-Setup.md

* Update Administration-Tutorial.md

* Update Administration-Tutorial.md

* Update Galera-Cluster-Connection-Routing-Tutorial.md

* Update CLI.md

* Update ReadWriteSplit.md

* Update Tee-Filter.md

* Update CCRFilter.md

* Update RabbitMQ-Filter.md

* Update Debug-And-Diagnostic-Support.md

* Update MaxBinlogCheck.md

* Update Configuration-Guide.md

* Update Module-Commands.md
2017-04-21 10:49:20 +03:00
adb2cc1517 MXS-1209: blr_slave_query cleanup
New routine: blr_handle_admin_stmt() is in use
2017-04-20 15:48:26 +02:00
371598fc8f MXS-1209: blr_slave_query cleanup
Added blr_handle_admin_stmt()
2017-04-20 15:19:49 +02:00
73c38230fe Update README.md 2017-04-20 16:03:41 +03:00
008d86f99a Update 2.1 Change Log 2017-04-20 16:03:41 +03:00
0f7b29f8bf Add 2.1.3 release notes 2017-04-20 16:03:41 +03:00
09086994bf 2.1 doc johan (#126)
* Update Documentation-Contents.md

* Update SchemaRouter-technical.md

* Update Plugin-development-guide.md

* Update Replication-Proxy-Binlog-Router-Tutorial.md

* Update MaxScale-HA-with-lsyncd.md

* Update MaxScale-Information-Schema.md

* Update Galera-Cluster-Read-Write-Splitting-Tutorial.md

* Update GSSAPI-Authenticator.md
2017-04-20 14:59:52 +03:00
695ba19965 Massimiliano pinto doc update 2.1 (#125)
* Update Nagios-Plugins.md

* Update MM-Monitor.md

* Update Nagios-Plugins.md

* Update Nagios-Plugins.md

* Update Galera-Cluster-Connection-Routing-Tutorial.md

* Update Galera-Cluster-Connection-Routing-Tutorial.md

* Update RabbitMQ-Setup-And-MaxScale-Integration.md

* Update MaxScale-Tutorial.md

* Update Cache.md

* Update Transaction-Performance-Monitoring-Filter.md

* Update RabbitMQ-Consumer-Client.md

* Update Building-MaxScale-from-Source-Code.md

* Update MariaDB-MaxScale-Installation-Guide.md

* Update Install-MariaDB-MaxScale-Using-a-Tarball.md

* Update RabbitMQ-Setup-And-MaxScale-Integration.md

* Update RabbitMQ-Consumer-Client.md
2017-04-20 13:36:13 +02:00
b0bec7b9b8 Always read Avro headers from file
The headers were read from memory as if they were in compressed
format. This mistake was caused by the fact that the function names were
changed.
2017-04-20 14:22:55 +03:00
9a221c46f3 Process PS responses in readwritesplit
When a prepared statement preparation is being routed to the master, the
response is now collected into one buffer before being sent back. This
allows proper processing of pipelined prepared statements.
2017-04-20 14:22:55 +03:00
36d06960bf Combine query preparation into one function
The same operations of protocol state and inspections of the buffer were
done in multiple places. Combining these into one function removes the
duplicated code.
2017-04-20 14:22:55 +03:00
73dd9bd025 Allow collection of prepared statement responses
The backend MySQL protocol can now collect prepared statement preparation
responses as well as result sets. This removes the need to parse and
collect the preparation responses at the router level.
2017-04-20 14:22:55 +03:00
a88e98035f Clean up MySQL protocol debug logging
Removed pthread_self calls from the backend modules. This makes the debug
logging easier to parse when the messages aren't prefixed with the verbose
thread ID.
2017-04-20 14:22:55 +03:00
cf2272f479 Clean up DCB debug logging
All debug messages from dcb.cc were prefixed with the pthread ID of the
current thread. If the thread ID is needed, it should be logged by the log
manager.
2017-04-20 14:21:35 +03:00