Commit Graph

62 Commits

Author SHA1 Message Date
0c45eb5d17 Take SessionCommand into use in readwritesplit
Readwritesplit now uses the SessionCommand class as a "master list" of
executed session commands. This allows the session commands to be easily
copied over to slaves that are taken into use after session commands have
already been executed.

Currently, the code doesn't execute the session command history when a
mid-session reconnection occurs. A method to cleanly copy the session
commands needs to be exposed by the Backend class.
2017-06-22 10:40:17 +03:00
b48bb4fc5e Refactor auxiliary routing functions
Refactored some of the functions used to calculate servers. Removed
redundant checks and moved the ack_write() call to the right place.
2017-06-22 10:40:17 +03:00
ab56cd0074 Use Backend in readwritesplit.cc
Removed old router property code as it is no longer needed when
SessionCommand class used by the Backend class is taken into use.

Removed unnecessary code that is implemented as a part of the Backend
class.

Changed functions to return references to Backends instead of handling raw
DCBs. This introduces a few cases where the code returns a reference when
no reference is actually available. These cases are solved by having an
empty static shared_ptr that is returned in these cases. This is done to
silence any compiler warnings that returning references to local variables
would bring as these should never happen if the code is functioning
properly.
2017-06-22 10:40:16 +03:00
5a5effdf7a Take Backend into use in rwsplit_select_backends.cc
This is the first step to taking the Backend class into use. It is now
used in rwsplit_select_backends.cc and readwritesplit.hh. The module is
not yet functional and doesn't even compile.

Added some helper functions to the Backend class to get easier access to
the server referenced by the SERVER_REF and to check the state of the
backend.
2017-06-22 10:40:16 +03:00
05fef4b23e Duplicate connections to the Backend class
Creating duplicate connections using the Backend class allows the
connections and their handling to be tested at the same time that the old
system is in place. This should make it somewhat easier to grasp what
changes and where when the new implementation is taken into use.
2017-06-22 10:40:16 +03:00
dc8c20bf6a Store session commands also as SessionCommand
The session commands are now duplicated as SessionCommand objects This
allows for an easier migration from the old session command implementation
to the new one.
2017-06-22 10:40:16 +03:00
1ffe04571c Integrate the temporary tables into the router session
Removed the temporary table router property and moved the set of tables
into the router session.
2017-06-22 10:40:16 +03:00
dfc1d0a413 Always include debug members in objects
Having the structures be of the same size with and without debug mode is
beneficial when debugging release binaries.
2017-06-22 10:40:16 +03:00
93660c19ed Reorganize readwritesplit.cc
Reorganized the main source file of readwritesplit. The internal functions
are first followed by the API entry points. The actual module definition
is the last declared object in the file.
2017-06-22 10:40:16 +03:00
cb7f257ea0 Refactor rewadwritesplit temporary table handling
The temporary table detection and handling now uses C++ containers to
store the set of temporary tables. The detection also uses the new query
classifier field info API to detect which tables and databases are
targeted.
2017-06-22 10:40:16 +03:00
f5a0526f2c Use new instead of malloc
Using new instead of malloc is required for proper initialization of C++
classes.
2017-06-22 10:40:15 +03:00
c77dcea807 Compile readwritesplit as C++
Compiling readwritesplit as C++ allows the use of C++ containers.
2017-06-22 10:40:15 +03:00