3983 Commits

Author SHA1 Message Date
Markus Mäkelä
c96bd64aa8 Rename MODULE_INFO to MXS_MODULE
The MODULE_INFO is now the main object which is used by modules to convey
information to the MaxScale core. The MXS_MODULE name is more apt as it
now contains the actual module definition.

The old MODULES structure was moved into load_utils.c as an internal
implementation and was renamed so that it is not confused with the new
MODULE structure.
2017-01-03 18:01:14 +02:00
Markus Mäkelä
d42c6b455d Remove webserver.c
The file was never used.
2017-01-03 18:01:13 +02:00
Markus Mäkelä
b00e0328d5 Create a macro for module declarations
The modules are now declared with a common macro. This allows future
additions to the module loading process while also making the loaded
symbol name a constant.
2017-01-03 18:01:13 +02:00
Markus Mäkelä
ae0577c695 Move module object inside MODULE_INFO
This allows modules to only expose one entry point with a consistent
signature. In the future, this could be used to implement declarations of
module parameters.
2017-01-03 18:01:13 +02:00
Markus Mäkelä
6c53999c97 Combine ModuleInit and GetModuleObject
The two functions can be combined into one as both are called only
once. This removes the need for the explicit ModuleInit function.
2017-01-03 18:01:13 +02:00
Markus Mäkelä
7df29aa1ec Move version entry point into MODULE_INFO
The MODULE_INFO can easily hold the version information of the
module. This removes the need for a explicit version entry point.
2017-01-03 18:01:13 +02:00
Markus Mäkelä
d3907882d6 Clean up the module handling functions
Cleaned up the loading and unloading of modules. Declared variables closer
to where they are used.
2017-01-03 18:01:13 +02:00
Johan Wikman
bbee47ee13 Fix release build breakage 2017-01-03 14:48:11 +02:00
Johan Wikman
78928dc575 Make session_[getUser|get_remote] const correct
- Rename session_getUser to session_get_user
- Change session_get_user and session_get_remote to take a const
  SESSION* as argument and to return a const char*.
- Change server_get_persistent, so that user is passed as const.
- Update all users of these functions as appropriate.
2017-01-02 16:16:37 +02:00
Johan Wikman
58dea62e24 Remove Gatekeeper 2017-01-02 10:00:40 +02:00
Markus Mäkelä
eaf3633728 Only flush tables to disk at the end of the binlog
Currently, when the avrorouter finishes reading a binlog file or when a
certain number of rows or transactions is reached, it will flush all
tables to disk. This is quite slow as events can easily be written faster
into the binlog than they can be processed by avrorouter.

A solution to this would be to only sync the tables (close the Avro block)
instead of flushing them to disk. This would allow more efficient
processing of the files while still retaining the safe shutdown that
flushing offers.
2017-01-02 09:31:21 +02:00
Johan Wikman
18008dec6d Rename mxs_mysql_account_to_pcre
The function is not capable of doing the right thing for an entire
account string, but only separately for user and host names, so the
function name should reflect that.
2016-12-29 11:47:08 +02:00
Johan Wikman
997bec868f Move transforming function to common place
Move function for converting a MySQL account string to an
equivalent PCRE one, from Cache's rules.cc to mysql_utils.
2016-12-29 11:09:06 +02:00
Johan Wikman
c6e155cf2b Move quote triming function to common place
Function for removing MySQL quote characters surrounding a
string moved from Cache's rules.cc to common place and renamed.

The function was now moved to mysql_utils.[h|c], which is in
maxscale-common, and not to the perhaps more appropriate place
protocol/mysql.h, as the latter would have implied that MySQLCommon
would have to be linked to, which actually might be the right thing
to do. However, that has to wait until protocol/mysql.h gets an
overhaul.
2016-12-29 11:09:06 +02:00
Johan Wikman
b40872e600 Prefix le[int|str]-functions with "mxs_" 2016-12-29 10:10:11 +02:00
Johan Wikman
c008d794c7 Add const correctness to mysql_util.h 2016-12-27 15:52:55 +02:00
Markus Mäkelä
25c3c33134 Added user creation command to CDCPlainAuth
Users for the CDC protocol can be created through the new `add_user`
module command.
2016-12-23 15:41:48 +02:00
Johan Wikman
c186956e0e Add skeleton masking filter 2016-12-23 09:05:08 +02:00
MassimilianoPinto
65ca6a4be8 MaxRows: 0x0 detection in handle_rows() removed
The 0x0 detection handle_rows was added for MULTI result detection, now
moved in handle_expecting_response.

Additionally 0x0 conflicts with empty string data.

CLIENT_DEPRECATE_EOF is not supported right now
2016-12-22 17:03:57 +01:00
Markus Mäkelä
b9b3bfaa78 Use configured principal name
The default principal name was used instead of the configured one.
2016-12-22 17:55:05 +02:00
Markus Mäkelä
5664321df0 Add username and network address to newSession
The luafilter now provides the username and the network address of the
client for the newSession entry point.
2016-12-22 17:55:05 +02:00
Markus Mäkelä
47ac20adea Refer to sessions by ID instead of memory address
Using the unique ID for the session is easier to use than an address. This
also allows the removal of all pointer values from the maxadmin output
which is never useful to the end user.
2016-12-22 17:55:05 +02:00
Markus Mäkelä
2bdda586f7 Remove CLI service modes
The modes weren't used and provided access to raw memory which is not
safe.
2016-12-22 17:55:05 +02:00
Markus Mäkelä
7cbd62db52 Fix show dbusers
The functionality was broken by the change where the users were moved from
the service to the listener.
2016-12-22 17:55:05 +02:00
Markus Mäkelä
d50e25b688 Merge branch 'develop-2.0-merge-dec22' into develop 2016-12-22 17:54:45 +02:00
Johan Wikman
91dd2d9fb8 Cache: Plug a leak
In case the stale item must be refreshed, the stale value must be
freed as it will not be sent to the client.
2016-12-22 17:27:32 +02:00
Johan Wikman
bc496e94bb Cache: Remove break when converting switch to if 2016-12-22 17:27:32 +02:00
Markus Mäkelä
520d28b27d Merge branch '2.0' into develop 2016-12-22 13:40:16 +02:00
MassimilianoPinto
cb73263b93 MaxRows: EOF/OK is not checked while receiving a large packet
EOF / OK packet is not being checked while receiving a large packet.
If so no extra data inspection will be done.
2016-12-22 12:28:23 +01:00
Johan Wikman
c7dfd1b0bd Cache: Introduce soft and hard TTL
- Hard TTL; the maximum time a value will be used from the cache.
- Soft TLL; the time after which the cache value should be updated
  from the server.

So as not to unnecessarily fetch the same value multiple times, when
the soft TTL has been reached, the value will be updated for the first
client, while all other clients will use the stale value until it has
become updated.

With different soft and hard TTLs there is a definite upper bound for
how old a value can be used.
2016-12-22 12:09:46 +02:00
Johan Wikman
97fcb94daa Cache: Always return staleness
In order for the LRU storage to correctly track the state in the
real storage, we always need to know stale-state of a returned
(or not returned) value.

The return type is now not an a pure enumeration, but a 16-bit
enumeration plus a 16-bit bitmask that can be used for conveying
more information.
2016-12-22 12:09:46 +02:00
Johan Wikman
2ea436a5c7 Cache: Test TTL behaviour 2016-12-22 12:09:46 +02:00
Johan Wikman
69acb8b9aa Cache: Fix review issues 2016-12-22 12:09:46 +02:00
Johan Wikman
e90f0d31a6 Cache: Pass argument as reference when it must be non-NULL 2016-12-22 12:09:46 +02:00
Johan Wikman
3f2c6d844b Cache: Use consistent naming in storage imlementations
- CamelCase for all C++ class and template names
- snake_case for all variables, including member variables and
  member functions
  - Static member functions start with a capital letter
- Member variables prefixed with m_
- Static member variables prefixed with s_
- Null terminated character string variables prefixed with z
- Pointers prefixed with p
- Smart-pointers prefixed with s
- Where a z, p, or s prefix is present, the following letter is
  capitalized, i.e., pEntry and not pentry.
2016-12-22 12:09:46 +02:00
Johan Wikman
3967a0b8c2 Cache: Provide Storage boiler-plate using template
All storage modules must implement the same interface and use the
same exception guards. Consequently that is conveniently provided
using a template.
2016-12-22 12:09:46 +02:00
Johan Wikman
ee422fd3ec Cache: Provide storage config as an object
Now all storage configuration values are provided in a single object.
That way it'll be easier to provide more if necessary and also makes
it straightforward to fetch the configuration, which makes it possible,
for instance, to adapt tests according to the way the storage has been
configured.
2016-12-22 12:09:46 +02:00
Johan Wikman
34b3f5c06e Cache: Invert test for capabilities 2016-12-22 12:09:46 +02:00
Markus Mäkelä
ae49e0e580 Add custom usage for CDC schema generator
The usage prints the required arguments and describes what this tool is
intended for.
2016-12-22 10:03:30 +02:00
Markus Mäkelä
06d362765c Use pending status only with running monitors
If a monitor is stopped, it is OK to modify the state of the server
without putting it into the pending status variable.
2016-12-22 10:03:30 +02:00
MassimilianoPinto
6da835ee44 MXS-1068: Maxrows filter doesn't count properly the result rows with size greater than16MBytes
16MBytes packets are now handled in MULTI result sets as well.
MAXROWS_DISCARDING_RESPONSE state has been removed.
Two new flags control large packets and result discarding
2016-12-21 10:06:59 +01:00
Dong Young Yoon
5d1b94de88 assigns the target server before gwbuf_append() 2016-12-20 13:04:01 +02:00
Dong Young Yoon
65b6ba6b1e added a comment explaining log format. 2016-12-20 13:04:01 +02:00
Dong Young Yoon
3e6cbeff19 1. Applied changes suggested from Markus.
2. tpmfilter now prints username of the client instead of the hostname
of the target server.
2016-12-20 13:04:01 +02:00
Dong Young Yoon
2866ef8dae added default values for options. 2016-12-20 13:04:01 +02:00
Dong Young Yoon
7776d55963 tpmfilter now prints which server the query has been executed on. 2016-12-20 13:04:01 +02:00
Markus Mäkelä
cb243f47a0 Remove usage of LUA_OK
LUA_OK is not defined in Lua 5.1.
2016-12-20 12:40:26 +02:00
Johan Wikman
036a6de0f1 Cache: Add more storage tests
- Check LRU behaviour
- Limit both by count and size
2016-12-20 10:06:54 +02:00
Johan Wikman
ec12786f49 Cache: Do not update head when accessing tail
Accessing the tail is only for debugging purposes, so it should not
cause the head item to change.
2016-12-20 10:01:29 +02:00
Markus Mäkelä
ae8c21929f Serialize server weighting parameters
The server weighting parameters couldn't be altered online and they
weren't serialized to disk. Only servers that are created online will have
their weighting parameters persisted to disk.
2016-12-19 18:40:14 +02:00