Commit Graph

6391 Commits

Author SHA1 Message Date
eda84a1f96 Cache: Add TesterStorage class
A class dedicated for performing basic testing of Storages.
2016-12-16 12:42:45 +02:00
179762ff0a Cache: Add Tester class
A Tester class that simplifies the creation of various cache tests.
It provides the basic mechanisms for reading statements from MySQL/
MariaDB test files, for converting statements into equivalent
cache items (key + statement) and for running various tasks in
separate threads for a specific amount of time.
2016-12-16 12:42:45 +02:00
2751640a02 Adjust for RocksDB behaviour
RocksDB returns success when deleting a non-existing key. To deal
with that the book-keeping of LRUStorage is used and the real
underlying storage is used only if LRUStorage thinks a particular
key exists.
2016-12-16 12:42:45 +02:00
bb9b5a87c1 Log a message when persisted configurations are used
If no message is logged, it will be very hard to figure out where some
configurations are coming from. For this reason, it's good to log a
message whenever a persistent configuration change is taken into use.
2016-12-16 10:28:06 +02:00
11d1875399 Handle batched reads from cloned sessions
Readwritesplit should route all queries from cloned sessions to the
master. This allows batch statements to be safely routed.

Native readwritesplit sessions only support batched writes as batched
reads aren't very common. Once readwritesplit supports batched reads, the
special handling for cloned DCBs can be removed.
2016-12-16 10:27:56 +02:00
4d431b787a Remove rwsplit transaction tracking
The transaction tracking is done by the client protocol so readwritesplit
doesn't need to do it.
2016-12-16 10:27:56 +02:00
7454ef1d0b MXS-1064: Encryption options to "show service ..."
The binlog encryption options are reported by “show service
$service_name” of binlog router if the encryption is enabled.
2016-12-16 08:48:36 +01:00
3a96482c23 Remove unnecessary memory barrier
The memory barrier is not needed here. Declaring poll_msg as volatile
should help with preveting some unwanted optimizations. Most likely
even that is unnecessary.

This came up when testing maxadmin "show servers", which is
surprisingly slow compared to the other commands. This change does
not help because the slowness is caused by the polling loop sleeping.
In a more busy environment the command would probably complete faster.
This should be looked at later.
2016-12-15 15:54:24 +02:00
f59c6d67c3 Expand testrawstorage
Now also rudimentary tests the LRU mechanism, which at the same
time makes the name a misnomer. These will be split into separate
programs to allow tests to be run individually.
2016-12-15 10:17:39 +02:00
8019bf71e0 Honour max_size also with existing values
If an exiting value is updated and the new size would cause the
maximum size to be exceeded, we must evict items so that we stay
below the boundary.
2016-12-15 10:17:39 +02:00
8864753edf Rename things to make it clearer 2016-12-15 10:17:39 +02:00
c81394445b Cache: Plug some leaks 2016-12-15 10:17:39 +02:00
a8a5bafdb6 Fix pointer manipulation in LRUStorage
The head and tail pointers were not properly updated in
all circumstances.
2016-12-15 10:17:39 +02:00
9f08e1300f Make Cache/Storage const correct
- From the outside, all actions getting data from the cache/storage
  are const.
- Update documentation.
2016-12-15 10:17:39 +02:00
e5cd9ba47e Refactor testrawstorage slightly
Different storage tests will be added to the same file.
2016-12-15 10:17:39 +02:00
f9a7edc7d2 Fix tee filter
With the addition of filter capabilities, the tee filter should work with
all sorts of routers that require at most the RCAP_TYPE_CONTIGUOUS_INPUT
capability.

Due to a recent discovery of the server's capability to process multiple
requests, the filter can safely send data from one service to another
without waiting for the earlier replies.

This also fixes a minor problem with the cloning of DCBs where the backend
DCBs could end up in the wrong thread's pool.
2016-12-14 23:55:33 +02:00
1b7a0a80ee Add luafilter documentation
The luafilter documentation describes the mechanics of how MaxScale will
call the lua scripts.
2016-12-14 23:55:19 +02:00
c9b56fca75 Add system configuration to GSSAPI documentation
The GSSAPI authenticator documentation now has a section on how to set up
the environment.
2016-12-14 11:23:17 +02:00
04d5eaf5f3 Add documentation for runtime config changes
The MaxAdmin document now lists and describes the new runtime
configuration change commands.
2016-12-14 11:23:17 +02:00
916320cf67 Clean up maxadmin help output
The detailed output of the new help command was a bit too densely packed
for some commands.

Added missing values for the `alter server` command help output.
2016-12-14 11:23:17 +02:00
0ba4c82fbb Clean up MaxAdmin documentation
The document wraps paragraphs at 80 characters and uses triple backtick
bloks for code sections instead of indentation.

Also fixed a few typos and reworded some parts.
2016-12-14 11:23:17 +02:00
4bd5486924 When printing services also print the related backends
MXS-1060. In MaxAdmin, running "list services" will now list the
backends of each service. When running "show services", the backend
names are now printed (previously just the addresses and protocols).
2016-12-14 09:41:47 +02:00
7047cdf6c6 MXS-867: Key file Key Management for binlog encryption
Binlog server option ‘encryption_key_file=’ can now use the same key
file the MariaDB 10.1 server might have  in my.cnf:
‘file_key_management_filename=‘

Note: the file content must be in clear, no key encryption.
2016-12-13 15:51:43 +01:00
8068cc0544 MaxAdmin documentation update
Small additions to MaxAdmin documentation and changelog due to
recent changes.
2016-12-13 16:36:04 +02:00
5e2cbf3809 Cache: Provide access to head, tail, size, items
In order to be able to test the LRU mechanism properly you need
to be able to access the head and tail from the outside. The same
is regarding the size and items in the cache. In order to be able
to test that the guarantees are upheld, you need to be able to
access those values from the outside.
2016-12-13 12:37:28 +02:00
80c77413ba Cache: Do not use random indexes when testing
It would seem that the likelyhood of different threads accessing
the same items at the same time is greater if each thread continuosly
loops across all items from beginning to finish. That will also ensure
that head and tail surely are accessed. In addition, some function names
have been disambiguated.
2016-12-13 12:37:28 +02:00
75b2895ec2 Cache: If LRUStorage is used, create ST real storage
If the underlying storage does not support max_count and/or max_size
and it accordinly is decorated with LRUStorage, then create the real
storage as single-threaded. Since LRUStorage will do locking it is of
no use to do locking in the real storage as well.
2016-12-13 12:37:28 +02:00
651e1122c2 Fix minor issues in testrawstorage
- Release memory
- Set libdir
- Adjust output
2016-12-13 12:37:28 +02:00
f71be685b6 Cache: Test raw storage
Here we create a number of threads and then randomly start getting
putting and deleting values. The intent is to test that the locking
behaviour of the storage modules is correctly implemented.
2016-12-13 12:37:28 +02:00
3cbfd3f1d0 Cache: Create MT storage if that is asked for 2016-12-13 12:37:28 +02:00
8bf1e50479 Cache: Provide access to raw storage
In order to be able to test the underlying storage separately
direct access to it must be provided (without intermediate LRU
storage).
2016-12-13 12:37:28 +02:00
423b54ef82 Cache: 0 is now default of integer parameters
0 is now the default of all cache configuration parameters and in
all cases the meaning is the same; that is, no limit. Internally
all limits but ttl are now for the sake of consistency 64-bit.
2016-12-13 12:37:28 +02:00
e1a1c8b1cd Cache: Add key generation test
Smoke test for detecting errors in key generation. The input file
is a number of .test-files from the server combined into a single
one. We simply check that a unique key is generated for each
statement.
2016-12-13 12:37:28 +02:00
4239182aa0 Fix diagnostics on filter template
Diagnostics can be required on both instance and session level,
so both cases need to be handled explicitly.

In addition, some reinterpret_casts were changed into static_casts.
Reinterpret_cast needs to be used with the instance, which is a
void** but static_cast is sufficient for the session, which is void*.
2016-12-13 12:28:31 +02:00
aa2de52054 Factor out .test-reading capability
The capability for reading MySQL/MariaDB .test-files has now been
factored out from the compare.cc test program. That way, the
functionality can be used from other test programs as well.
2016-12-13 12:15:57 +02:00
00e2149760 Add mention retry_failed_reads in release notes
The release notes now mention the new `retry_failed_reads` option for
readwritesplit.
2016-12-13 09:22:51 +02:00
a0f6dd8abc Fix crash on double creation of listeners
When the listeners were created twice, MaxScale would crash when the users
were loaded. This is caused by the fact that the DCB for the listener is
NULL for failed listeners.
2016-12-13 09:12:58 +02:00
7a04259fc0 MXS-756: Retry reads on slave failure
If a slave fails while a non-critical read is being executed, the read is
retried on a different server. This is controlled by the new
`retry_failed_reads` option.

Only selects done that are done outside of a transaction and with
autocommit enabled are retried.
2016-12-13 09:12:58 +02:00
a66c8fb919 Fix crash on NULL client DCB in mysql_backend.c
It is possible that a session is in the dummy state (a transient state)
when a backend write occurs. The check for the client protocol NULL-ness
should extend to the client DCB itself.
2016-12-13 08:28:57 +02:00
101fc82fa0 Documentation update for maxbinlogcheck utility
New options related to encryption: -K and -A.
Binlog event header is printed with -H option
2016-12-12 22:00:11 +01:00
ff4d56813e MaxRows filter can handle 16MBytes packets
16 MBytes and larger packet are handled.
Note: a 16MBytes packet is seen as a row by the filter.
2016-12-12 22:00:11 +01:00
38af20569c MaxAdmin defaults to Emacs-mode and other small changes
1. MaxAdmin now defaults to Emacs-mode. To activate Vim-mode, give
the option 'i' when starting.
2. "history" and "source"-commands are parsed correctly.
3. Added a check to DoSource() so that empty commands are not sent.
MaxScale doesn't respond to empty commands which would cause MaxAdmin
to wait forever.
2016-12-12 17:34:35 +02:00
259e944b3d Server status changes now happen under a lock
MXS-873 To prevent monitors and MaxAdmin from interfering with each other,
changes to the server status flags now happen under a lock. To avoid
interfering with monitor logic, the monitors now acquire locks to all
of their servers at the start of the monitor loop and release them
before sleeping.
2016-12-12 15:04:05 +02:00
162ae04d20 MXS-867: Binlog server encryption key has same format as MariaDB key file
Default algorithm is now AES_CBC.
The MariaDB 10.1 key file cannot be read as it might contain more than
1 rows.
2016-12-12 14:01:54 +01:00
5ccdfe54bd Hack binlogrouter to work with resultset buffering
The binlogrouter needs to manipulate the protocol structures in order for
the resultset buffering to work correctly. If the state isn't manipulated
for COM_QUERY statements, the resultsets aren't buffered and will be
routed in separate buffers.
2016-12-12 11:56:41 +02:00
03681db687 Fix crash with binlogrouter
If the client protocol isn't set, the command shouldn't be either.
2016-12-12 11:55:49 +02:00
0b44fe1c04 Only buffer result sets for COM_QUERY statements
When a non-COM_QUERY statement is sent, the result set should not be
buffered.
2016-12-12 11:39:54 +02:00
106f482f45 Add result set buffering to MySQLBackend
The backend MySQL protocol module now supports a new routing capability
which allows result sets to be gathered into one buffer before they are
routed onward. This should not be used by modules that expect large
result sets as the result set is buffered in memory.

Adding a limit on how large of a result set could be buffered would allow
relatively safe use of this routing capability without compromising the
stability of the system.
2016-12-12 10:48:53 +02:00
d543ecb483 Remove servers from destroyed monitors
A destroyed monitor should not have any servers added to it. This allows
the servers that once were monitored by a destroyed monitor to be added to
new monitors.
2016-12-12 10:48:53 +02:00
cb218804ef Detect double monitoring of servers
Adding a server to multiple monitors is forbidden. This should be detected
and reported to the end user.

The information provided by the config_runtime system to the client isn't
as detailed as it could be. Some sort of an error message stack should be
added so that client facing interfaces could properly report the reason
for the failure. Currently the only way to detect the reason of the
failure is to parse the log files.
2016-12-12 10:48:53 +02:00