Commit Graph

6202 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
573faff987 Add module command documentation for avrorouter
The documentation lists the one command it implements.
2016-11-30 10:28:16 +02:00
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
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
d52145054f Cache: Now use CacheRules instead of CACHE_RULES 2016-11-30 10:22:53 +02:00
2e4ac55aa4 cache: Add CacheRules class
Easier to use in a C++ context than the C API
2016-11-30 10:22:53 +02:00
2a2c530857 Cache: Trivial cleanup of inmemory storage 2016-11-30 10:22:53 +02:00
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
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
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
b87ea735fb Cache: Correct examples in documentation 2016-11-30 10:22:53 +02:00
e5a9eceff4 Cache: Fix prev/next twiddling 2016-11-30 10:22:53 +02:00
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
e597523c47 Cache: Allow storage modules to specify capabilites
Will be used to decide whether a LRUStorage facade is needed in front
of the actual storage or not.
2016-11-30 10:22:53 +02:00
1701979696 Cache: Add LRU storage
The LRUStorage hierarchy implements the decorator pattern and
is capable of providing LRU behaviour to any underlying storage.
There are two concrete classes - LRUStorageST and LRUStorageMT -
that can be used in single thread and multiple thread contentx,
respectively.

Also tests the convention of placing _ as suffix on member
variables.
2016-11-30 10:22:53 +02:00
07c602d81c Add creation and destruction of monitors
Monitors can now be created and destroyed at runtime. The configurations
for new monitors are persisted to disk.
2016-11-29 15:04:19 +02:00
4ff4e69592 Add stopping and starting of listeners to maxadmin
Listeners can now be stopped and started individually.
2016-11-29 15:04:19 +02:00
ecdeb009b3 Fix dbfwfilter regression
The query throttling functionality was broken by the move to the per
thread rule system. One way to fix this is to move the session specific
throttling information into the client session itself. This allows for a
simpler system with no direct dependencies on the rules or users
themselves.
2016-11-29 14:19:08 +02:00
075968e947 Allow avrorouter converstion to be started and stopped
The modulecmd functionality allows the avrorouter to easily control the
conversion process with one command. The conversion can now be started and
stopped by the user.

This also fixes a bug where the conversion would stop if there were no
binlog files present when the service was started.
2016-11-29 14:19:08 +02:00
c01430e3fc Fix module commands with no arguments
Passing zero as the argument count would lead to a malloc for zero
bytes which would always cause a failure.
2016-11-29 14:19:08 +02:00
05303f5b7e Fix memory leaks in maxinfo (modified for develop-branch)
MXS-1009. This commit adds a gwbuf_free after maxinfo_execute() to
free a buffer with an sql-query after it has been processed. Also,
the parse tree in maxinfo_execute_query() is now freed. The tree_free-
function was renamed to maxinfo_tree_free, since it is now globally
available.

This commit has additional changes (in relation to the 1.4.4 branch)
to remove errors caused by differences in the html and sql-sides of
MaxInfo.
2016-11-29 13:08:20 +02:00
fa58fdcde8 Cache: Make Storage abstract
Storage is now abstract with StorageReal (that uses an actual
storage module) derived from it. This to prepare for a stackable
case where LRU behaviour is implemented in front of the actual
physcal storage.
2016-11-29 11:23:23 +02:00
b4ddf23ba3 Cache: Now uses unordered_map instead of HASHTABLE 2016-11-29 11:23:23 +02:00
02265c5dc2 Cache: All functions now named using snake case
Exception is where the call goes across a plugin boundary, as
is the current MaxScale convention.
2016-11-29 11:23:23 +02:00
a2daacd465 Cache: Add options for choose sharing mode
Now possible to use same cache for all threads or separate cache
for each.
2016-11-29 11:23:23 +02:00
933e09d245 Cache: Add per thread Cache
The per thread cache is implemented so that there is one single
thread cache per thread.

This uses shared_ptr, which is available in different places
depending on which GCC version is default on the target platform.
So, before this is merged to develop, that needs to be sorted out.
2016-11-29 11:23:23 +02:00
910a349f86 Cache: Store name as string and not as char* 2016-11-29 11:23:23 +02:00
4f1f71a05a Cache: Make config and storage factory sharable
In antecipation of a CachePT (cache per thread), rearrange things
so that the storage factory and config can be shared between cache
instances.
2016-11-29 11:23:23 +02:00
c3319b24a6 Cache: Wrongly protected methods made public 2016-11-29 11:23:23 +02:00
124453b756 Cache: Add simple cache
A simple cache is one that does not transparently use multiple
storages in the background. That will be the case when a separate
cache per thread is used. Both CacheST and CacheMT are now derived
from CacheSimple.

A fair amount of what used to be in Cache has now been moved to
CacheSimple. What remains is what surely is common for all cache
types.
2016-11-29 11:23:23 +02:00
5bae5b8b8d Cache: Add cache for single thread 2016-11-29 11:23:23 +02:00
279bf7e2fa Cache: Change key from char ptr to struct 2016-11-29 11:23:23 +02:00
c1c447985d Cache: Make it possible to specify thread model for storage 2016-11-29 11:23:23 +02:00
7a0d6307fe Cache: Make Cache abstract
The methods that need to be different depending on the thread model
are now pure virtual.
2016-11-29 11:23:23 +02:00
3ba8525063 Remove old .gitignore files
The files were used to deal with old Makefile builds.
2016-11-28 14:37:26 +02:00
691989ff04 Split the service header into internal and external parts
The service header in include/maxscale/ contains the public part of the
service API. These functions can be safely used by the modules.

The internal header located in service/core/maxscale/ is used by the core
to initialize MaxScale at startup or to provide other services in a more
controlled way (the config_runtime, for example).
2016-11-28 14:37:26 +02:00
88677946f8 Add destruction of listeners
The listeners aren't really destroyed and are only stopped. Further
changes are required so that they won't be started again once they have
been destroyed.
2016-11-28 14:37:26 +02:00
6ea4e50f2c Clean up service.h
Most of the service header functions now contain the relevant
documentation. Cleaned up small parts of it and renamed functions to be
more consistent.
2016-11-28 14:37:26 +02:00
ff3173d588 Cache: Remove obsolete method 2016-11-25 13:44:41 +02:00
68f70ee5b2 Cache: Prepare for ST, MT, and PT caches
With a small cost it is possible to prepare for a single-thread,
multi-thread and cache-per-thread specific cases.
2016-11-25 13:03:48 +02:00
a71d1f0877 Cache: Param processing moved to cachefilter.cc
This in antecipation of different Cache instances being created
depending on passed arguments.
2016-11-25 11:08:36 +02:00
f8f0ef8d34 Cache: Ensure no C++ exceptions can escape 2016-11-25 09:32:35 +02:00
14c8a5bb5f Cache: Take Cache class into use
Now the basic structure is in place:

- cachefilter.cc is the MaxScale filter interface.
- Cache is the actual cache class that will also handle LRU issues.
- SessionCache (sessioncache.cc) is the session specific cache class
  that using Cache acts as the cache for a particular session.
  If an item is stale, then one SessionCache will update it.
- StorageFactory is the component that is capable of loading a module
  providing storage facilities.
- Storage is the actual key/value store.
2016-11-25 09:32:35 +02:00
719cffd596 Cache: Add Cache class.
This class provides the cache function used by the session caches.

Not taken into use yet.
2016-11-25 09:32:35 +02:00