6233 Commits

Author SHA1 Message Date
Johan Wikman
582948e690 Add UINT[32|64]_MAX defines 2016-12-02 09:32:14 +02:00
Johan Wikman
f5280fecfe Fix avrouter/CMakeLists.txt
Needed to be updated when binlog was renamed to binlogrouter.
2016-12-01 15:55:25 +02:00
Johan Wikman
1707684992 Move all authenticators into separate subdirectories 2016-12-01 15:43:22 +02:00
Johan Wikman
aef6c7b099 Make directory name equal to the library name
* avro -> avrorouter
* binlog -> binlogrouter
2016-12-01 15:23:42 +02:00
Johan Wikman
a6df875495 Make filter const correct and use snake case
CamelCase is still in use with the printing functions.
2016-12-01 15:20:34 +02:00
Markus Makela
b3e31a3da2 Add creation and destruction of monitors to maxadmin
Maxadmin can now create and destroy monitors. The created monitors are not
started as they would be useless without added servers and configuration
parameters.
2016-11-30 12:43:50 +02:00
Markus Makela
55f1bbfce6 Fix monitor alteration and serialization
When the monitor credentials were being written with snprintf, the source
and destination overlapped.

The serialization didn't add a 'type=monitor' line into the configuration.
2016-11-30 12:41:43 +02:00
Markus Makela
4c4bd24a40 Allow module specific monitor parameters to be altered
Module specific parameters can now be altered at runtime. This allows both
the removal and addition of arbitrary monitor parameters.
2016-11-30 12:41:43 +02:00
Markus Makela
24af4b3225 Clean up hintfilter
The hintfilter no longer needs to process the queries into one buffer as
the client protocol will handle that.
2016-11-30 12:37:36 +02:00
Johan Wikman
7ac31b2674 Cache: Now implements destroyInstance 2016-11-30 10:47:24 +02:00
Markus Makela
7b8497df7a Make sure listener DCBs are removed cleanly from the list
As listener DCBs can be added and removed from the polling system multiple
times, the DCBs need to be reset to a clean state when they are removed.
2016-11-30 10:28:24 +02:00
Markus Makela
42eb8add5d Lock listeners when adding or removing them from epoll
Locking the listener DCB when adding or removing it from epoll will
prevent cases where only a part of the threads have the listener in epoll.
2016-11-30 10:28:23 +02:00
Markus Makela
0689b3df39 Improve the polling statistics
The statistics of the polling system no longer match the implementation it
measures. Modified the statistics to better represent the new system by
calculating the number of epoll events each thread receives.
2016-11-30 10:28:23 +02:00
Markus Makela
1b09faf2e4 Fix crash on debug logging
The debug logging for persistent connections caused a crash if a
non-backend DCB was processed.
2016-11-30 10:28:23 +02:00
Markus Makela
7cbbc6f8f7 Add a mechanism to synchronize persistent pool counts
The polling system now has a concept of messages. This can be used to send
a synchronous message to the polling system which waits for all threads to
process the message before returning.

Currently this is used to flush unused DCBs when server persistent
statistics are reported.
2016-11-30 10:28:23 +02:00
Markus Makela
8573df6ee7 Disable concurrect maxadmin access
The administrative operations in debugcmd.c now share a global lock.
2016-11-30 10:28:23 +02:00
Markus Makela
5aa791d16e Move persistent connections to thread specific lists
Making the lists of persistent DCBs thread specific is both a bug fix and
a performance enhancement. There was a small window where a non-owner
thread could receive events for a DCB. By partitioning the DCBs into
thread specific lists, this is avoided by removing the possibility of DCBs
moving between threads.
2016-11-30 10:28:23 +02:00
Markus Makela
bcbff604b0 Properly store errno on listener epoll errors
When an epoll error occurs for a listener, the errno variable must be
stored in another variable while the listener is removed from all of the
epoll instances.
2016-11-30 10:28:23 +02:00
Markus Makela
bfc60ae940 Remove false debug assertion
Not all routers require statement input.
2016-11-30 10:28:23 +02:00
Markus Makela
32b0f6a607 Iterate using the correct list
The `thread.next` pointer refers to active DCBs in the current thread's
list and the `memdata.next` pointer refers to DCBs about to be freed. The
latter was mixed up with the former due to some changes in the naming.
2016-11-30 10:28:23 +02:00
Markus Makela
5411180a50 Fix DCB validity checks
The DCB was always assumed to be non-NULL.
2016-11-30 10:28:23 +02:00
Markus Makela
b09bf56127 Add missing NULL pointer check to DCB list handling
The thread specific list removal function didn't check whether the last
item was NULL before proceeding to alter the latest tail pointer.
2016-11-30 10:28:23 +02:00
Markus Makela
b32af705e6 Extend routing capabilities
The routing capabilities now define the type of output the reply
processing chain expects. Currently, this only consists of two
capabilities; complete packet output and contiguous buffer output. The
latter implies the former.
2016-11-30 10:28:23 +02:00
Markus Makela
43f248927e Move thread related members of DCB into a substructure
The `thread` structure of a DCB now contains all the members that relate
to thread ownership of the DCB.
2016-11-30 10:28:23 +02:00
Markus Makela
2efa862944 Remove listmanager code
The code prevented scaling by imposing global spinlocks for the DCBs and
SESSIONs. Removing this list means that a thread-local list must be taken
into use to replace it.
2016-11-30 10:28:23 +02:00
Markus Makela
e53b9585dd Add mapping function for DCBs
The dcb_foreach allows a function to be mapped to all DCBs in
MaxScale. This allows the list of DCBs to be iterated in a safe manner
without having to worry about internal locking of the DCB mechanism.
2016-11-30 10:28:23 +02:00
Markus Makela
ed280aa81b Use client DCB to route requests
Using internal DCBs for query routing wasn't needed as the client DCB
could be used. This could also be done by simply routing the query again
with routeQuery.
2016-11-30 10:28:23 +02:00
Markus Makela
fce87f8c8e Add listeners to all epoll instances
Adding the listener DCBs to all epoll instances allows all threads to
accept new connections. This should increate MaxScale's responsiveness.
2016-11-30 10:28:23 +02:00
Markus Makela
5067f3594a Adapt session timeout checks to a per thread model
Each thread will now check their own list of DCBs for timed out sessions.
2016-11-30 10:28:23 +02:00
Markus Makela
30927455ef Add each DCB to the owning thread's list
Each DCB needs to be added to the owning thread's list so that they can be
iterated through. As sessions always have a client DCB, the sessions don't
need to be added to a similar per thread list.

This change fixes a problem with dcb_hangup_foreach that the removal of
the list manager introduced. Now the hangup events are properly injected
for the DCBs that connect to the server in question.
2016-11-30 10:28:23 +02:00
Markus Makela
fe56e65903 Use service capabilities in response processing
The MySQLBackend protocol now only checks for complete packets if the
service requires statement based routing. This should remove unnecessary
processing when data is only streamed from the backend to the client.
2016-11-30 10:28:22 +02:00
Markus Makela
abc0681248 Temporarily disable listmanager debug checks
Since the listmanager code isn't used, the debug assertions will always
fail. They should be disabled until the listmanager code can converted to
the per-thread model.
2016-11-30 10:28:22 +02:00
Markus Makela
51842333d7 Temporarily take out the listmanager from use
The listmanager code uses a global spinlock which might cause problems
with multiple threads.
2016-11-30 10:28:22 +02:00
Markus Makela
68d3fc1092 Remove the DCB write queue locking
Since only one thread can append to the DCBs write queue at a time, there
is no need to lock it.
2016-11-30 10:28:22 +02:00
Markus Makela
076b810c1e Create thread specific zombie queues
Because each thread has their own epoll file descriptor and only one
thread can process a DCB, it makes sense to move to a per thread zombie
queue. This removes one of the last restrictions on scalability.
2016-11-30 10:28:22 +02:00
Markus Makela
f77f78360e Insert fake events under a lock
The thread-specific spinlock needs to be acquired before a fake event is
inserted from a non-polling thread. The usual situation is when a monitor
thread inserts a hangup event for a DCB.

Other, less common cases are when session timeouts have been enabled and
the DCB needs to be closed. Here it is better to insert a fake hangup
event instead of directly closing the DCB from an external thread.
2016-11-30 10:28:22 +02:00
Markus Makela
8efdaa1ea6 Move fake events to a thread-specific queue
The fake poll events are now stored in thread specific queues. This
removes the need for the poll event queue.
2016-11-30 10:28:22 +02:00
Markus Makela
b79210c760 Create thread specific epoll instances
Having a unique epoll instance for each thread allows a lot of the locking
from poll.c to be removed. The downside to this is that each session can
have only one thread processing events for it which might reduce
performance with very low client counts.
2016-11-30 10:28:22 +02:00
Markus Makela
573faff987 Add module command documentation for avrorouter
The documentation lists the one command it implements.
2016-11-30 10:28:16 +02:00
Johan Wikman
9175295542 Cache: Now also CacheRules is shared
Unnecessary methods were also removed from CachePT and CacheMT
as it does not make sense to create more than one single instance
of those per filter instance. Consequently there is no need for
them to be able to use an existing StorageFactory (and CacheRules).
2016-11-30 10:22:53 +02:00
Johan Wikman
93103fd64a Cache: shared_ptr used with CacheRules and StorageFactory
shared_ptr is now used for managing the lifetime of CacheRules
and StorageFactory instances.
2016-11-30 10:22:53 +02:00
Johan Wikman
d52145054f Cache: Now use CacheRules instead of CACHE_RULES 2016-11-30 10:22:53 +02:00
Johan Wikman
2e4ac55aa4 cache: Add CacheRules class
Easier to use in a C++ context than the C API
2016-11-30 10:22:53 +02:00
Johan Wikman
2a2c530857 Cache: Trivial cleanup of inmemory storage 2016-11-30 10:22:53 +02:00
Johan Wikman
2423031df8 Cache: Use lock guard for locking spinlocks
Now the locks will always be release, also in the presence of an
unantecipated exception.
2016-11-30 10:22:53 +02:00
Johan Wikman
efa8713b17 Cache: Include inmemory storage in build
Add logging note to storage_rocksdb at the same time.
2016-11-30 10:22:53 +02:00
Johan Wikman
23bb7c4de7 Cache: Add in memory storage
Storage implementation that simply uses std::unordered_map as
storage structure.
2016-11-30 10:22:53 +02:00
Johan Wikman
b87ea735fb Cache: Correct examples in documentation 2016-11-30 10:22:53 +02:00
Johan Wikman
e5a9eceff4 Cache: Fix prev/next twiddling 2016-11-30 10:22:53 +02:00
Johan Wikman
9c1b9c188e Cache: Enable LRU eviction
The maximum count and maximum size of the cache can now be
specified and a storage can declare what capabilities it has.
If a storage modile cannot enforce the maximum count or maximum
size limits, the storage is decorated with an LRU storage that
can.
2016-11-30 10:22:53 +02:00