7196 Commits

Author SHA1 Message Date
Markus Mäkelä
b9fae58891 Favor pointers over references
The use of a pointer instead of a reference conveys the message that the
lifetime of the object being pointed can, and most likely will, exceed the
lifetime of the function.

Also shuffled the member variables and internal functions around and
removed unneeded function declarations.
2017-03-31 14:12:01 +03:00
Markus Mäkelä
02796e7304 Move #pragma to first line in each header
The `#pragma once` is now on the first line of each header.
2017-03-31 14:12:01 +03:00
Markus Mäkelä
14cfd482de Fix variable naming and usage
Don't use `this->` when it's not needed. Use snake_case for member
variables. Initialize the members using a initialization list.
2017-03-31 14:12:01 +03:00
Markus Mäkelä
a10aa85736 Clean up routeQuery and clientReply
Moved parts of the functionality into subfunctions. Reordered code to
remove redundant logic.
2017-03-31 14:12:01 +03:00
Markus Mäkelä
39903e40b7 Rename member variables
Renamed and cleaned up schemarouter member variables. Removed unused
variables.
2017-03-31 14:12:00 +03:00
Markus Mäkelä
ac641e0f22 Use router template in schemarouter
The schemarouter now uses the router template.
2017-03-31 14:12:00 +03:00
Markus Mäkelä
b2ff0c5a0f Clean up schemarouter headers
Cleaned up the headers, removed unused structures. Changed some members to
strings instead of char arrays. Switch to router templates should now be
easier.
2017-03-31 14:12:00 +03:00
Markus Mäkelä
d151512d20 Take new sharding implementation into use
The sharding implementation now uses a class to abstract the details of
the shard. This allows for different design where each session makes a
copy of the global shard map which is then used for the duration of the
session. In addition to making the desing a bit clearer to understand, it
also removes lock competition between threads.

Due to the change to C++, the main entry points need to be wrapped in the
exception-safety macros. The next step in the refactoring will be to use
the router template. This will remove the need to manually define them.
2017-03-31 14:12:00 +03:00
Markus Mäkelä
9587b2ecfc Remove unused schemarouter code
The temporary table detection in schemarouter was not used.
2017-03-31 14:12:00 +03:00
Markus Mäkelä
bda0fd2db0 Replace session command implementation
The schemarouter now uses the new session commands. It uses a standard
library container to manage the execution and storage of session commands.

The session command history is disabled until a more complete refactoring
can be done.
2017-03-31 14:12:00 +03:00
Markus Mäkelä
1ba399a62a Use size_t in all functions
Some of the protocol modules use ssize_t instead of size_t.

Split the function that counts the number of response packets a session
command will receive into two parts. This allows it to be reused
elsewhere.
2017-03-31 14:12:00 +03:00
Markus Mäkelä
d8abefff5f Add session command class
The class abstracts the session commands and the lists of session commands
using standard library containers.
2017-03-31 14:12:00 +03:00
Markus Mäkelä
9e4e70a337 Move shard map handling into a separate file
Moved the handling of shard maps into another file.
2017-03-31 14:12:00 +03:00
Markus Mäkelä
a5fd53e9a0 Compile schemarouter as C++
Compile schemarouter as C++ so that refactoring into more coherent parts
is easier.
2017-03-31 14:12:00 +03:00
Markus Mäkelä
509a5c6ed3 Fix error handling for binlogrouter
The binlogrouter error handling closed the DCB twice. This was caused by
the change in the way the DCB error handling is done.

The protocol modules now also call the error handling routine even if the
router session is NULL. This enables the binlogrouter to manage
authentication failures correctly instead of trying to reconnect again.
2017-03-31 14:11:46 +03:00
Esa Korhonen
3f62ea2c41 Update MaxAdmin documentation and release notes
This is mostly about MaxAdmin file load removal. Also added a note on
NamedServerFilter and MaxAdmin editing mode changes.
2017-03-30 14:33:34 +03:00
Esa Korhonen
b41074c92b Disable MaxAdmin automatic file reading
Previously, MaxAdmin would interpret any non-option words in the
command line as either a filename or, if the file could not be opened,
as MaxAdmin commands. This made it possible to mix filenames and
commands if there was a matching filename in the folder. For example
"maxadmin show services" would read commands from a file named
"show services" if it existed. This update removes this feature. To
read commands from a file, use either shell redirection "maxadmin <
mycommands" or the "source"-command inside maxadmin.
2017-03-30 14:33:34 +03:00
Esa Korhonen
a395db174e Add HintRouter documentation 2017-03-30 13:28:01 +03:00
Esa Korhonen
07cc42927a Fix session close in RoundRobinRouter
SERVER_REF->connections was decremented from the wrong struct.
2017-03-30 13:26:51 +03:00
Esa Korhonen
88b87aceb5 HintRouter: use a subfunction for connecting to backends
Also, removed needless runtime capabilities + other fixes according to
comments.
2017-03-29 11:13:03 +03:00
MassimilianoPinto
37e9d74253 Merge branch 'develop' into MXS-1075 2017-03-29 10:00:57 +02:00
MassimilianoPinto
d8c048e47d MXS-1075: GTID slave request cleanup
GTID slave request routine cleanup and general cleanup as well
2017-03-29 09:28:52 +02:00
Markus Mäkelä
043f6c92b8 Fix connection_keepalive documentation
The version number was wrong.
2017-03-28 21:20:43 +03:00
MassimilianoPinto
a236b14eef MXS-1075: Sqlite db for GTID - file, pos mapping
Use sqlite3 database instead of hash tables for GTID - file, pos mapping
2017-03-28 10:23:09 +02:00
Esa Korhonen
526ba7d706 HintRouter: cleanup + statistics for diagnosis entrypoint
General code cleanup. Routing error detection now more robust.
Remove some unused code. Debug messages now use "unique_name" when
referring to servers.
2017-03-28 11:09:48 +03:00
Esa Korhonen
90c249a8b2 HintRouter: Support various hint types, round-robin rotate slaves
Supports hint types:
-master
-slave
-named server
-all

A default action, which is performed when no hint exists or on error,
can be set. The different actions are analogous to the hint types.

A maximum connection number for slaves can be set. If more slaves are
configured for the service, the filter will rotate slaves for new sessions.

Within a session with multiple slaves, the "route_to_slave"-hint will
also rotate among the slave backends.
2017-03-28 11:09:48 +03:00
Esa Korhonen
ddcd1f960c HintRouter: Use shared_ptr for Dcb-wrapper
The Dcb also accepts a null-value at creation, indicating an empty dcb.
2017-03-28 11:04:36 +03:00
Johan Wikman
58c1c1a3ca Remove BLOCKING_POLL
The code was not correct anymore and correcting it does not seem
worthwhile.
2017-03-27 11:12:37 +03:00
MassimilianoPinto
69ae85c400 Merge branch 'develop' into MXS-1075 2017-03-27 09:53:49 +02:00
MassimilianoPinto
8e24f847e6 Fix compile errors in Centos 6
Fix compile errors in Centos 6
2017-03-27 09:49:21 +02:00
MassimilianoPinto
72c2a3ca18 Merge branch 'develop' into MXS-1075 2017-03-27 08:38:07 +02:00
Markus Mäkelä
710012ac5d MXS-827: Add connection keepalive
The readwritesplit now sends COM_PING queries to backend servers that have
been idle for too long. The option is configured with the
`connection_keepalive` parameter.
2017-03-26 13:57:25 +03:00
Johan Wikman
e3bae59e1a Fix C++ issues in debug mode 2017-03-24 12:54:52 +02:00
Johan Wikman
3755a5a7b0 Compile modulecmd.c as C++ 2017-03-24 11:19:01 +02:00
Johan Wikman
1e3e09f81c Compile mysql_binlog and mysql_utils as C++ 2017-03-24 11:14:07 +02:00
Johan Wikman
8d7653bdff Compile listener and ssl as C++ 2017-03-24 11:11:15 +02:00
Johan Wikman
b04e8b93c9 Compile statistics, thread, users and util as C++ 2017-03-24 11:05:55 +02:00
Johan Wikman
b5c44be4c8 Add missing MXS_[BEGIN|END]_DECLS 2017-03-24 10:59:05 +02:00
Johan Wikman
65e36a81bf Compile spinlock.c as C++ 2017-03-24 10:58:19 +02:00
Johan Wikman
bb1b7f9755 Compile server, service and session as C++ 2017-03-24 10:52:09 +02:00
Johan Wikman
ec39b54dea Compile secrets.c as C++ 2017-03-24 09:51:56 +02:00
Johan Wikman
a068c53286 Compile resultset.c as C++ 2017-03-24 09:45:42 +02:00
Johan Wikman
503c760848 Compile random_jkiss.c as C++ 2017-03-24 09:42:38 +02:00
Johan Wikman
a9c2580da4 Compile poll.c as C++ 2017-03-24 09:35:11 +02:00
Johan Wikman
d19ae82a63 Fix rebase 2017-03-24 09:29:53 +02:00
Johan Wikman
83fd79e280 Compile queuemanager.c as C++ 2017-03-24 09:21:20 +02:00
Johan Wikman
6acd58e86c Compile monitor.c as C++ 2017-03-24 09:21:20 +02:00
Johan Wikman
640f0d5139 Compile modutil.c as C++ 2017-03-24 09:21:20 +02:00
Johan Wikman
44fe995574 Compile mlist.c as C++ 2017-03-24 09:21:20 +02:00
Johan Wikman
419c55e5be Compile misc.c as C++ 2017-03-24 09:21:20 +02:00