Commit Graph

3243 Commits

Author SHA1 Message Date
60955ba70d Clean up mysqlmon after pull request merge
The pull request introduced some minor whitespace errors.
2016-09-20 09:23:58 +03:00
e849297fc8 line length now less than 110 characters 2016-09-20 09:23:58 +03:00
48456833da fixed memleak and potential call of mysql_num_rows with NULL 2016-09-20 09:23:58 +03:00
73c974c286 Remove automatic create database - requires too powerful database user. 2016-09-20 09:23:58 +03:00
ec42413db8 Initial changes to implement test before creating maxscale_schema. 2016-09-20 09:23:57 +03:00
883c581d25 Addition of START_ENCRYPTION_EVENT
Addition of START_ENCRYPTION_EVENT when encrypt_binlog=1 in Binlog
Server option.
Event is not sent to any slave.
MaxBinlogCheck understands the new event added in MariaDB 10.1.7: the
number of events = 164 as reported by FormatDescriptionEvent
2016-09-19 17:43:47 +02:00
695fed4912 Code review update for Ignorable events
Code review update for Ignorable events
2016-09-19 11:07:17 +02:00
92ef33327e MXS-870: Handle non-contiguous session command responses
Session command responses with multiple packets could be spread across
multiple, non-contiguous buffers. If a buffer contained a complete packet
and some extra data but it wasn't contiguous, the debug assertion in
gwbuf_clone_portion would fail. With release builds, it would cause
eventual out-of-bounds memory access when the response would be sent to
the client.
2016-09-19 09:58:20 +03:00
26f87c2bd8 An IGNORABLE event is added into binlog when a gap between two events is detected
An IGNORABLE event is added into binlog when a gap between two events
is detected.

New routines create and write special events.

Special events are not sent to slaves.
2016-09-16 14:55:37 +02:00
8e5fa51efa Addition of MARIADB10_START_ENCRYPTION_EVENT
Addition of MARIADB10_START_ENCRYPTION_EVENT and its description in
event_names_mariadb10 array
2016-09-16 09:49:17 +02:00
89f9f4a42f Lock writeq before inspecting it
Looking at the contents of the writeq should be done under a spinlock
otherwise it is possible that another thread grabs the queue.
2016-09-16 10:05:50 +03:00
2a4addc298 Clear waiting results flag on client errors
When a backend causes an error and it should be sent to the client, the
backend reference was closed but the waiting results state was not
cleared. This caused a debug assertion to be hit.
2016-09-16 09:58:56 +03:00
5ba7dd49ed Merge branch 'develop' into binlog_server_wait_data 2016-09-15 14:51:00 +02:00
b60f000a4c Format tpmfilter
The filter is now formatted with the astyle config.
2016-09-15 12:21:54 +03:00
08d2529312 Merge branch 'develop' into pull-102 2016-09-15 10:26:53 +03:00
029e6574da MXS-812: Always reset counters when backend is closed
The active operation counters are now closed every time a backend referece
is taken out of use. This should fix a few debug assertions that were hit
in tests.
2016-09-15 08:31:15 +03:00
ff7634113b Assign Relay Master only to running servers
The Relay Master status was set for servers that were down. The check for
valid master and node IDs was missing which caused a false positive.
2016-09-15 07:13:10 +03:00
b138a43ab8 cache: 64KiB is more appropriate default than 64MiB 2016-09-14 14:39:27 +03:00
8a12bd6487 Implement parameter handling for cache 2016-09-14 14:11:27 +03:00
9790eaaf20 storage_rocksdb explicity dependent on RocksDB 2016-09-13 11:45:03 +03:00
2cb6bdcf67 Fix typo on build variable 2016-09-13 11:45:03 +03:00
293b125e12 Define namespace function using explicit scope 2016-09-13 11:45:03 +03:00
cf86b80584 Link storage_rocksdb with libraries required by RocksDB 2016-09-13 11:45:03 +03:00
7fe981c22f Cache: Handle TTL manually
The RocksDB TTL database only honours the TTL when the database
is compacted. If the database is not compacted, stale values will
be returned until the end of time.

Here we utilize the knowledge that the TTL is stored after the
actual value and use the root database for getting the value,
thereby getting access to the timestamp.

It's still worthwhile using the TTL database as that'll give
us compaction and the removal of stale items.
2016-09-13 11:45:03 +03:00
a96d215aa0 Make it possible to include internal RocksDB headers
The RocksDB storage will need to refer to some internal
RocksDB files.
2016-09-13 11:45:03 +03:00
a76c05e8db MXS-797 Add initial version of RocksDB storage
RocksDB is cloned from github and version v4.9 (latest at the time of
this writing) is checked out.

RocksDB can only be compiled as C++11, which means that RocksDB and hence
storage_rocksdb can be built only if the GCC version is >= 4.7.

The actual storage implementation is quite straightforward.

- The key is a SHA512 of the entire query. That will be changed so that
  the database/table name is stored in the beginning of the key unhashed
  as that will cause cached items from the same table to be stored
  together. Assumption is that if you access something from a particular
  table, chances are you will access something else as well.
- When the SO is loaded, the initialization function will created a
  subdirectory storage_rocksdb under the MaxScale cache directory.
- For each instance, the RocksDB cache is created into a directory
  whose name is the same as the cache filter name in the configuration
  file, under that directory.
- The storage API's get and put functions are then mapped directly on
  top of RockDB's equivalent functions.
2016-09-13 11:45:03 +03:00
0c55385525 Merge branch 'develop' of git://github.com/dongyoungy/MaxScale into pull-102
Merged and fixed merge problems.
2016-09-13 10:47:05 +03:00
6dc75d4b9c MXS-860: Detect whether replication is configured
The `detect_stale_slave` functionality used to only work when MaxScale had
the knowledge that a master server has existed and that replication was
working at some point in time. This might be a "safe" way to do it in
regards to staleness of the data but in practice it is preferrable to
always allow slave to be used for reads.

This change adds the missing functionality to the monitor by assigning
slave status to all servers which are configured as replication slaves
when no master can be found.

The new member variable that was added to the SERVER should be removed in
2.1 where the server_info offers the same functionalty without "polluting"
the SERVER type.
2016-09-12 15:59:08 +03:00
36e243e07d Refactor monitor_mysql_db functions
The different server monitoring functions all did similar work and
combining them into one function makes the whole process of monitoring a
server simpler.
2016-09-12 15:57:27 +03:00
4cd36161ee Fix stale master detection in multimaster mode
The MySQL monitor now correctly assigns stale status to master servers.
2016-09-12 15:57:27 +03:00
506ef1b9f6 Assign master status only to root level masters
If a relay master server is found in the replication tree, it should not
get the master status. Previously all master servers were assigned the
master status regardless of their depth in the replication tree.

By comparing the depth value of each potential master, the monitor can
find the right master at the root of the replication tree.
2016-09-12 15:57:27 +03:00
46c8a6f66b MXS-839: Detect multi-master topologies with mysqlmon
The mysqlmon now supports proper detection of multi-master topologies by
building a directed graph out of the monitored server. If cycles are found from
this graph, they are assigned a master group ID. All servers with a positive
master group ID will receive the Master status unless they have `@@read_only`
enabled.

This new functionality can be enabled with the 'multimaster' boolean
parameter.
2016-09-12 15:57:27 +03:00
d745781bd0 MXS-839: Store additional server information in mysqlmon
Mysqlmon now stores the values of read_only, slave_sql_running,
slave_io_running, the name and position of the masters binlog and the
replication configuration status of the slave.

This allows more detailed server information to be displayed with the
`show monitor <name>` diagnostic interface. In addition to this, the new
structure used to store them provides an easy way to store information
that is specific to a monitor and the servers it monitors.

These new status variables can be used to implement better multi-master
detection in mysqlmon by using the value of read_only to resolve
situations where multiple master candidates are available.
2016-09-12 15:57:27 +03:00
cbf3ae0f8f Move gatekeeper and ccrfilter into the core
The filters should be a part of the core package.
2016-09-12 15:55:27 +03:00
c50df875da Merge branch 'develop' into binlog_server_wait_data 2016-09-12 09:03:06 +02:00
0b4320fb1d Merge branch '2.0' into develop 2016-09-12 09:39:26 +03:00
0d157b16f8 Fix luafilter build failure
The createInstance used the old signature.
2016-09-12 06:50:07 +03:00
7a144079b9 MXS-812: Fix active operation counters
When a client executes commands which do not return results (for example
inserting BLOB data via the C API), readwritesplit expects a result for
each sent packet. This is a somewhat of a false assumption but it clears
itself out when the session is closed normally. If the session is closed
due to an error, the counter is not decremented.

Each sesssion should only increase the number of active operation on a
server by one operation. By checking that the session is not already
executing an operation before incrementing the active operation count the
runtime operation count will be correct.
2016-09-09 16:57:18 +03:00
a32b4bdf6b Add missing examples to installation
The CDC examples are now installed if the CDC protocol module is built.
2016-09-09 16:01:16 +03:00
d7f79942be Merge branch '2.0' into develop 2016-09-09 15:12:58 +03:00
a474dad753 Fix crash when multiple MySQL monitors monitor same servers
The monitors always freed and reallocated the memory for the slaves. It
was always of the same size so a static array of that size should also
work.
2016-09-08 13:02:27 +03:00
874e32edc9 Develop merge
Develop merge
2016-09-08 08:53:32 +02:00
4e3de4c56d Rename and relocate CDC Python examples
Moved the CDC example scripts into the protocol directory and added the .py
suffix. Fixed all references to these scripts.
2016-09-05 10:32:37 +03:00
c7907ed728 Fix minor leak in maxscaled.c 2016-09-02 13:58:34 +03:00
a9b0a5550c Allow socket and address/port to be used with maxadmin
It's now possible to use both a Unix domain socket and host/port
when connecting with MaxAdmin to MaxScale.

By default MaxAdmin will attempt to use the default Unix domain
socket, but if host and/or port has been specified, then an inet
socket will be used.

maxscaled will authenticate the connection attempt differently
depending on whether a Unix domain socket is used or not. If
a Unix domain socket is used, then the Linux user id will be
used for the authorization, otherwise the 1.4.3 username/password
handshake will be performed.

adminusers has now been extended so that there is one set of
functions for local users (connecting locally over a Unix socket)
and one set of functions for remote users (connecting locally
or remotely over an Inet socket).

The local users are stored in the new .../maxscale-users and the
remote users in .../passwd. That is, the old users of a 1.4
installation will work as such in 2.0.

One difference is that there will be *no* default remote user.
That is, remote users will always have to be added manually using
a local user.

The implementation is shared; the local and remote alternatives
use common functions to which the hashtable and filename to be
used are forwarded.

The commands "[add|remove] user" behave now exactly like they did
in 1.4.3, and also all existing users work out of the box.

In addition there is now the commands "[enable|disable] account"
using which Linux accounts can be enabled for MaxAdmin usage.
2016-09-02 13:47:16 +03:00
8ac9ecdf07 Compilation error fix
Compilation error fix
2016-09-01 17:59:04 +02:00
4e1cb56710 Added support for ANNOTATE_ROWS_EVENT in COM_BINLOG_DUMP
Now registration with MariaDB server supports ANNOTATE_ROWS_EVENT.
Request flag is in COM_BINLOG_DUMP packet
2016-09-01 17:44:41 +02:00
d337aa0476 Backport hint priority change to 2.0
The change in readwritesplit routing priorities, where hints have the
highest priority, gives users more options to control how readwritesplit
acts.

For example, this allows read-only stored procedures to be routed to
slaves by adding a hint to the query:

       CALL myproc(); -- maxscale route to slave

The readwritesplit documentation also warns the user not to use routing
hints unless they can be absolutely sure that no damage will be done.
2016-08-31 17:44:26 +03:00
099263709e Allow routers to control when users are loaded
The binlogrouter requires that users are not loaded at startup. This
allows it to inject the service user into the list of valid MySQL users so
that the binlogrouter can be controlled via the listeners.
2016-08-31 07:02:30 +03:00
9a3da88e63 Move loading of user data to authenticator modules
The authenticator modules now load the user data when the new loadusers
entry point is called. This new entry point is optional.

At the moment the code that was in service.c was just moved into the
modules but the ground work for allowing different user loading mechanisms
is done.

Further improvements need to be made so that the authenticators behave
more like routers and filters. This work includes the creation of a
AUTHENTICATOR module object, addition of createInstance entry points for
authenticators and implementing it for all authenticators.
2016-08-31 07:02:30 +03:00