Commit Graph

1712 Commits

Author SHA1 Message Date
076599ee5e MXS-1220: Make the parameters of the diagnostic entry points const
The diagnostic entry points should not modify the state of the object
being diagnosed.
2017-05-04 09:14:03 +03:00
bc3cfe0221 MXS-1220: Fix memory leaks
Some of the JSON objects created in the diagnostic functions leaked
memory.
2017-05-04 09:14:03 +03:00
ec6f3d566b MXS-1220: Implement JSON diagnostics in binlogrouter
The binlogrouter now implements the JSON diagnistics entry point.
2017-05-04 09:12:16 +03:00
eb3ff1cc7b MXS-1220: Implement JSON diagnostics for most routers
All routers except the binlogrouter now fully implement the JSON
diagnostic entry point. The binlogrouter needs to be handled in a separate
commit as it produces a large amount of diagnostic output.
2017-05-04 09:12:15 +03:00
9d108a58de MXS-1220: Use new diagnostics in avrorouter
The avrorouter now implements the new diagnostics API entry point.
2017-05-04 09:12:15 +03:00
c07350e710 Merge branch 'develop' into MXS-1209 2017-05-03 12:54:19 +02:00
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
b0837dc635 MXS-1209: added blr_register_cache_response
New routine blr_register_cache_response() in use.
2017-05-03 08:30:05 +02:00
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
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
3c6006a010 MXS-1209: added blr_register_send_command()
MXS-1209: added blr_register_send_command()
2017-05-02 09:11:15 +02:00
5cef78b7d4 MXS-1209: blr_master.c cleanup
Further optimisations will come with new registration phases
2017-04-28 18:08:33 +02:00
2c6d08325a MXS-1209: blr_master.c cleanup
blr_master.c cleanup continues
2017-04-28 16:22:26 +02:00
1203a8211a MXS-1209: blr_master.c cleanup
blr_master.c cleanup continues
2017-04-28 11:40:11 +02:00
fae4b2d99a MXS-1209: Ensure master is connected to in main worker 2017-04-27 18:05:22 +02:00
9a34aa5c7f Fprintf removed
Fprintf removed
2017-04-27 18:03:34 +02: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
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
2428468f47 MXS-1209: blr_master.c cleanup
blr_master.c cleanup continues
2017-04-26 16:06:42 +02:00
870027dffe MXS-1209: Cleaning up Master registration phase
Master registration phase is using new routines
2017-04-26 08:14:26 +02: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
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
8fe31f360d Remove multi-packet additions to response parsing
The additions to the packet parsing code weren't necessary once the
statement output change was reverted.
2017-04-20 14:18:40 +03:00
673631084a MXS-1203: Fix response tracking of LOAD DATA LOCAL INFILE
When responses are being tracked, the execution of a LOAD DATA LOCAL
INFILE requires special handling. The readwritesplit now has a simple
state machine for the handling of the LOAD DATA LOCAL INFILE command. This
should also make the code a bit more readable.
2017-04-20 14:18:40 +03:00
ea38d511e3 MXS-1203: Process multiple results correctly with readwritesplit
The readwritesplit didn't correctly process the response packets that
contained more than one part of a multi-result response. By processing the
packets in a loop, this problem is avoided.

Removed some of the more "unique" ways of sending error messages in favor
of simply writing the error to the client DCB. This removes the need for
extra logic in the clientReply response handling.
2017-04-20 14:18:40 +03:00
a1c7ee438d MXS-1203: Fix current command tracking with statement routing
When statement based routing was used, it was possible that the current
statement being executed wasn't properly updated. Readwritesplit requires
it to track whether a command will create a response.
2017-04-20 14:18:40 +03:00
6f468c573e MXS-1203: Fix readwritesplit routing decision logging
The info level logging could print binary data as if it were a
null-terminated string. Also cleaned up the function to make it a bit more
manageable.
2017-04-20 14:18:39 +03:00
66cf571412 MXS-1203: Better handling of batch queries
When batched queries are done through readwritesplit, it will now handle
them one by one. This allows batched queries to be used with
readwritesplit but it does impose a performance penalty when compared to
direct execution on the backend.
2017-04-20 14:18:39 +03:00
7844680c7d Add possibilty to execute function in thread
Now possible to send a function and arguments to a specific worker
thread for execution.

In particular, this will be used for transferring the injection of
fake hangup events into DCBs, related to a particular server, from
the monitor thread to the worker threads, thus removing the need
for locks.
2017-04-20 13:51:16 +03:00
bb6e0767cc Add first version of MXS_WORKER
MXS_WORKER is an abstraction of a worker aka worker thread.
It has a pipe whose read descriptor is added to the worker/thread
specific poll set and a write descriptor used for sending messages
to the worker.

The worker exposes a function mxs_worker_post_message using which
messages can be sent to the worker. These messages can be sent from
any thread but will be delivered on the thread dedicated for the
worker.

To illustrate how it works, maxadmin has been provided with a new
command "ping workers" that sends a message to every worker, which
then logs a message to the log.

Additional refactoring are needed, since there currently are overlaps
and undesirable interactions between the poll mechanism, the thread
mechanism and the worker mechanism.

This is visible currently, for instance, by it not being possible to
shut down MaxScale. The reason is that the workers should be shut down
first, then the poll mechanism and finally the threads. The shutdown
need to be arranged so that a shutdown message is sent to the workers
who then cause the polling loop to exit, which will cause the threads
to exit.

That can be arranged cleanly by making poll_waitevents() a "method"
of the worker, which implies that the poll set becomes a "member
variable" of the worker.

To be continued.
2017-04-20 13:51:16 +03:00
5704ae5ffd Allow paths to be created if they don't exist
A module can now declare a path parameter for a directory that does not
yet exist. If the directory does not exist, MaxScale will create the
directory with the requested permissions.
2017-04-20 13:26:16 +03:00
e4941044aa MXS-1209: blr_slave_query cleanup
New routine: blr_handle_set_stmt is in use
2017-04-19 18:04:41 +02:00
aa3559c6e9 MXS-1209: blr_slave_query cleanup
new routine: blr_handle_show_stmt
2017-04-19 16:02:07 +02:00
e09f1db4a6 MXS-1209: blr_slave_query cleanup
new routine: blr_handle_maxwell_stmt
2017-04-19 14:11:59 +02:00
dfede32266 Add cast int->uint64_t
Needed for compiling on Centos6.
2017-04-06 13:00:30 +03:00
e0a12820b6 Binlogserver sends GTID_LIST Fake Event when a MariaDB 10 slave connects with GTID
Now sending GTID_LIST Fake Event when a MariaDB10 Slave connects with
GTID
2017-04-06 09:04:19 +02:00
ce6b52ab39 Rename schemarouter internal functions
Renamed the functions to better describe what they do.
2017-04-06 09:22:21 +03:00
c37c5abfeb Use collectable resultset type for database mapping
When the databases are mapped, it is desirable to get the complete
response in one contiguous buffer. This removes the need to manually
process the partial packets in the router code.
2017-04-06 09:22:21 +03:00
2310381465 Make variables of Backend private
The variables are no longer directly manipulated by the session level
code.
2017-04-06 09:22:21 +03:00
0d7f987598 Move state checks inside the Backend class
The class now has methods to query its internal state.
2017-04-06 09:22:20 +03:00
ad1c05b015 Merge branch '2.1' into develop 2017-04-05 11:35:13 +03:00
0f2f9d48b7 Improve maxadmin help messages
The help messages are now more descriptive and have usage information in
them. This should help users use the commands without relying on the
online documentation.
2017-04-03 12:09:59 +03:00
cbc1e864d9 Use RFC 3986 compliant addresses in log messages
When log messages are written with both address and port information, IPv6
addresses can cause confusion if the normal address:port formatting is
used. The RFC 3986 suggests that all IPv6 addresses are expressed as a
bracket enclosed address optionally followed by the port that is separate
from the address by a colon.

In practice, the "all interfaces" address and port number 3306 can be
written in IPv4 numbers-and-dots notation as 0.0.0.0:3306 and in IPv6
notation as [::]:3306. Using the latter format in log messages keeps the
output consistent with all types of addresses.

The details of the standard can be found at the following addresses:

     https://www.ietf.org/rfc/rfc3986.txt

     https://www.rfc-editor.org/std/std66.txt
2017-03-31 14:12:58 +03:00
5c1c89c835 Remove unused buffer types
A part of the buffer types weren't used or provided no real functionality.
2017-03-31 14:12:02 +03:00
c59ed30da1 Simplify error handling
The error handlers are now simpler as the Backend class handles the
closing of the connections.
2017-03-31 14:12:02 +03:00
a3396a06b8 Fix shared_ptr usage
The std::shared_ptr type was used instead of std::tr1::shared_ptr. A NULL
pointer was also implicitly cast into a Backend pointer which caused
compilation problems on some platforms with the tr1 version of shared_ptr.
2017-03-31 14:12:02 +03:00
6e218adc1d Make connections and command queues internal to Backends
The SERVER_REF and DCB members of the Backend class are now
private. Access to the stored SERVER_REF is provided with the backend()
function. No accompanying setter function is provided as the backend
server should not change during the lifetime of the session.

The creation of the internal DCB is hidden behind the connect()
function. It simplifies the process of connecting to a server by removing
the need to manually do the bookkeeping of the server reference connection
counts. Access to the DCB is provided by the dcb() function.

The closing of the backend is done with the close() function which
contains the code that was previously in closeSession. If the backend
isn't closed when the destructor is called, it will be done
automatically. This should prevent connection leakage.

The pending command queues and the methods used to write them are now also
internal to the backends. They are simple wrappers around dcb->func.write
and the interfaces provided by the Buffer class. The mapping command queue
is still public. It needs to be combined with the generic command queue.
2017-03-31 14:12:02 +03:00
66fa4fbc7d Use shared pointers to Backend classes
The schemarouter now uses shared pointers. This removes the need to copy
the class.

Following changes move the member variables inside the Backend class.
2017-03-31 14:12:02 +03:00