Commit Graph

12514 Commits

Author SHA1 Message Date
d44cf7b20e MXS-2208 Allow dbfw parser to be compiled as C
maxsbase/log.h will turn into C++, but the flex and bison
generated files are by default C.
2018-12-10 12:50:07 +02:00
80805292ef MXS-2208 Compile avro as C++
An unantecipated sidestep in the path of introducing a small
HTTP library to maxbase.
2018-12-10 12:50:07 +02:00
f2fcf79fb2 Cleanup server.hh
Simplify type definitions.
2018-12-05 16:45:32 +02:00
7ca421fe5f MXS-2196: Fix persistent connections
The connections now use the correct parameter.
2018-12-05 15:30:44 +02:00
3cc34f0696 MXS-2196: Don't loop over persistent connections
When doing a loop over each DCB, don't process DCBs without sessions. For
now this is correct behavior as only DCBs in the persistent pool have no
session.
2018-12-05 15:30:44 +02:00
77477d9648 MXS-2196: Rename dcb_role_t to DCB::Role 2018-12-05 15:30:44 +02:00
0b9241913c Merge branch '2.3' into develop 2018-12-05 13:45:24 +02:00
467231480f Merge branch '2.3.2' into 2.3 2018-12-05 13:27:39 +02:00
8d77ddec63 MXS-2208 Add simple Http library
- Built on top of Curl
- Currently only GET
2018-12-05 12:48:42 +02:00
bec9455a74 MXS-2205 Combine routingworker.h with routingworker.hh 2018-12-05 11:12:20 +02:00
9f721f725e MXS-2205 Convert maxscale/protocol/mysql.h to .hh 2018-12-05 11:12:20 +02:00
0d09b56f58 MXS-2025 RWBackends as a vector of unique_ptr:s
For lifetime management keep RWBackends in a vector of unique_ptrs.
RWSplitSession keeps the unique_ptrs very private, and provides a vector
of plain pointers for all other interfaces.
2018-12-05 10:23:57 +02:00
91f6f374a8 MXS-2025 Use PRWBackends in backend selection. 2018-12-05 10:23:57 +02:00
20b62a3f3d MXS-2025 Change RWBackend usage to a vector of raw ptrs.
This is essentially just a search and replace to change SRWBackend to
RWBackend* and SRWBackendList to PRWBackends, a vector of a raw
pointers. In the next few commits vector<unique_ptr<RWBackend>>
will be used for life time management.

There are a lot of diffs from the global search and replace. Only a few manual
edits had to be done.

list-src -x build | xargs sed -ri 's/SRWBackends/prwbackends/g'
list-src -x build | xargs sed -ri 's/const mxs::SRWBackend\&/const mxs::RWBackend\*/g'
list-src -x build | xargs sed -ri 's/const SRWBackend\&/const RWBackend\*/g'
list-src -x build | xargs sed -ri 's/mxs::SRWBackend\&/mxs::RWBackend\*/g'
list-src -x build | xargs sed -ri 's/mxs::SRWBackend/mxs::RWBackend\*/g'
list-src -x build | xargs sed -ri 's/SRWBackend\(\)/nullptr/g'
list-src -x build | xargs sed -ri 's/mxs::SRWBackend\&/mxs::RWBackend\*/g'
list-src -x build | xargs sed -ri 's/mxs::SRWBackend/mxs::RWBackend\*/g'
list-src -x build | xargs sed -ri 's/SRWBackend\&/RWBackend\*/g'
list-src -x build | xargs sed -ri 's/SRWBackend\b/RWBackend\*/g'
list-src -x build | xargs sed -ri 's/prwbackends/PRWBackends/g'
2018-12-05 10:23:57 +02:00
a6cacbec17 Update MariaDBMonitor documentation
Updates troubleshooting section.
2018-12-04 18:05:38 +02:00
d96a7dedc5 MXS-2205 Convert maxscale/poll.h to .hh 2018-12-04 14:51:02 +02:00
4dd2dad426 Fix maxsql dependencies
The connector-c was not declared as a dependency which caused parallel
builds to fail.
2018-12-04 14:00:34 +02:00
711fbd4f19 MXS-2196: Fix removal of failed listeners
When a listener was created at runtime but it failed to start, it would
not be automatically removed from the system. This caused the MaxCtrl
cluster sync test to fail.
2018-12-04 11:50:43 +02:00
ceb6094623 MXS-2196: Fix filter unit tests
Fixed the use of DCBs and sessions in the mock testing framework and
adapted them to the changes done to the objects in question. Extended the
testing utility functions to allow preloading modules as well as making it
possible to only partially initialize the query classifier.
2018-12-04 11:50:43 +02:00
4b8393b2ee MXS-2196: Fix most NPM unit test failures
The REST API and MaxCtrl tests relied upon the implicit sessions that were
created by the listeners. This can be corrected and improved by creating
an actual connection to MaxScale to check that a client session is indeed
created.
2018-12-04 11:50:43 +02:00
cb18670013 MXS-2196: Fix core unit tests
Fixed the tests so that they properly allocate a service and a listener
for it after which a new session and a DCB are created.
2018-12-04 11:50:43 +02:00
43c33e9f4a MXS-2196: Allocate a session before allocating DCBs
Allocating the session before a DCB guarantees that at no point will a DCB
have a null session. This further clarifies the concept of the session and
also allows the listener reference to be moved there.

Ideally, the session itself would allocate and assign the client DCB but
since the Listener is the only one who does it, it's acceptable for now.
2018-12-04 11:50:43 +02:00
692127a2cb MXS-2196: Remove the dummy session
As each connection now immediately gets a session the dummy session is no
longer required. The next step would be to combine parts of the session
and the client DCB into one entity. This would prevent the possibility of
a client DCB with no associated session. Backend DCBs are different as
they can move from one session to another when the persistent connection
pool is in use.
2018-12-04 11:50:43 +02:00
a2f5cc9d09 MXS-2196: Rename struct session to struct MXS_SESSION 2018-12-04 11:50:43 +02:00
da9816b7e7 MXS-2196: Always allocate a session
Whenever a client DCB is accepted, a session for it is allocated. This
simplifies the handling of shared data between DCBs by allowing it to be
placed inside the session object. Currently, the data is stashed away in
the client DCB.
2018-12-04 11:50:43 +02:00
180e150ba1 MXS-2196: Split session startup into two parts
The session allocation now has two distinct parts: the initialization of
the session itself and the creation of the router and filter
sessions. This allows sessions to be allocated the moment a client DCB is
created instead of only after the authentication is complete. With this
change, the need for the dummy session is removed.
2018-12-04 11:50:43 +02:00
13769a0e8c MXS-2196: Remove listener DCB type
Removed all code and references to the listener type DCBs. Also removed
the DCB type macros and replaced them with a member function.
2018-12-04 11:50:43 +02:00
7aa60b4a24 MXS-2196: Start listeners after worker threads
If the startup of the listeners requires communication with all of the
workers, the workers must be up and running for that to happen.

Due to the fact that the main thread is still a worker thread, the
initialization code is not extra straightforward. By queuing an event to
the main worker, the startup of all listeners is done at a fully
operational state with all workers fully functional.

The service initialization code was also flawed in the sense that it would
cause a deadlock if any of the threads would have to check for the user
permissions. This is mainly a problem with the authenticator modules but
the benefits of the per service pre-loading of users is most likely
superficial. In theory startup will be faster as each thread now queries
the users in parallel.
2018-12-04 11:50:43 +02:00
015c581a5b MXS-2196: Remove unnecessary functions
The functions for starting listeners aren't needed as the listen method
can be called directly.
2018-12-04 11:50:43 +02:00
3df38bc887 MXS-2196: Make client DCB creation private to Listener
The functions that the Listener uses are now private functions. Also moved
the function documentation into the headers.
2018-12-04 11:50:43 +02:00
cca3d15b90 MXS-2196: Simplify client accept code
The code that waited for some time if a system resource limit was reached
made the lower level code more complex than it should be. If such a
situation would be encountered, it is unlikely that the code would make a
noticeable difference.

Also renamed the functions to better represent what they do.
2018-12-04 11:50:43 +02:00
8046a314e5 MXS-2196: Move DCB initialization into DCB constructor
More of the DCB initialization is now done in the DCB constructor. This
makes the creation of new DCBs simpler but it can be even simpler. By
passing the file descriptor that the DCB should use into the constructor
almost all of the initialization would be done inside it.

Also removed the unused path member variable.
2018-12-04 11:50:43 +02:00
6cf672195a MXS-2196: Move dcb_accept into listener.cc
Moved the code into listener.cc as it's the only place where it is
used. Placed the DCB callback assignment into the DCB constructor as it
depended on static functions that were in dcb.cc.
2018-12-04 11:50:43 +02:00
b3fbc6aa3d MXS-2196: Remove DCB from Listener
Replaced the DCB with a single file descriptor that the listener listens
on and which is added to all of the workers. The Listener also extends the
MXB_POLL_DATA which allows it to handle epoll events.

Moved the code that creates the listening socket into listener.cc where it
belongs and did a minor cleanup of it.
2018-12-04 11:50:43 +02:00
3791fdded7 MXS-2196: Pass client DCB to MXS_PROTOCOL::accept
By doing the actual accepting of the new DCB in the core, the protocol
modules can only do the actual protocol level work. This removes some of
the redundant code that was in the protocol modules.
2018-12-04 11:50:43 +02:00
192562d930 MXS-2196: Don't force epoll flags
The epoll event flags are now fully controlled by the caller of the
Worker::add_fd function. This makes the mechanism more generic and allows
both edge triggered and level triggered behavior.
2018-12-04 11:50:43 +02:00
7ea22c3d16 Execute service_internal_restart on main worker
The task needs to be executed on a routing worker as it accesses
authenticator data that at least for MySQLAuth is worker specific.
2018-12-04 11:50:43 +02:00
e46104c32a MXS-2196: Use Listener in MXS_PROTOCOL::accept 2018-12-04 11:50:43 +02:00
45827dd433 MXS-2196: Store listener reference in DCB
By storing the reference in the DCB, the two-way dependency between the
listeners and services is severed. Now the services have no direct link to
listeners and after the destruction of a listener it will be freed once
all connections through it have closed.

Due to the fact that a listener itself has a DCB that must point to a
valid listener, a self-reference is stored in the listener DCB. This is
extremely confusing and is only here to keep the code functional until the
DCB part of the listener can be factored out.
2018-12-04 11:50:43 +02:00
7a87ff9ce1 MXS-2196: Remove redundant DCB member variables
The variables held duplicate information already present in other parts of
the system.
2018-12-04 11:50:43 +02:00
694d4a4003 MXS-2196: Make DCB a C++ struct
Allocating DCB with new allows the use of C++ objects in the DCB
struct. Also the explicit poll field can be replaced by inheriting from
MXB_POLL_DATA.
2018-12-04 11:50:43 +02:00
e365b97c6e MXS-2196: Rename struct dcb to struct DCB
Renamed the DCB struct and removed the typedef.
2018-12-04 11:50:43 +02:00
ad12ff6d06 MXS-2196: Rename dcb.h to dcb.hh 2018-12-04 11:50:43 +02:00
3b5e45ceee MXS-2196: Combine session.h and session.hh
Combined the public session headers into one.
2018-12-04 11:43:38 +02:00
5a79dbfb53 MXS-2196: Track listener state
The listener now tracks its own the state instead of using the session
state.
2018-12-04 11:39:53 +02:00
ccc91df0c7 MXS-2196: Pass Listener into dcb_accept
Modified the functions to use a listener instead of a DCB in the accepting
process. This removes some of the dependenices that the listeners have on
the DCB system.
2018-12-04 11:39:53 +02:00
9c679edea6 MXS-2196: Preload DCB entry points in Listener
By loading the entry points required by a DCB when the Listener is
created, the extra cost of finding the module is removed. It also
simplifies DCB creation by removing the possibility of all failures to
load modules at DCB creation time.
2018-12-04 11:39:53 +02:00
c858f7f080 MXS-2196: Use smart pointers for lifetime management
The listeners no longer internally track whether they are active or
not. All of the heavy lifting is now done by std::shared_ptr.
2018-12-04 11:39:53 +02:00
a10b6c2e89 MXS-2196: Take Listener into use 2018-12-04 11:39:52 +02:00
330719c8f9 MXS-2196: Store listener references in Service
By storing a shared pointer to the listeners in the services, they will be
available as long as the service using them exists. This enables clean
destruction of listeners that still have open sessions.

The listener creation code now separately creates the listener and links
it to the service. Also replaced relevant parts of the related code with
the listener implemented versions of it.
2018-12-04 11:39:52 +02:00