Commit Graph

1668 Commits

Author SHA1 Message Date
623acfe1b5 Build MaxScale in debug mode for Travis
The internal test set depends on SS_DEBUG being defined and it is only
defined for debug builds.
2016-10-18 21:58:59 +03:00
fe8ebda11e MXS-828: Log warning if both syslog and maxlog disabled
A warning is logged to stderr if both syslog and maxlog are
disabled. Earlier a note was unconditionally written to stdout
for each.
2016-10-17 14:02:16 +03:00
f0cf391c18 include/maxscale/gw.h removed.
In a subsequent change, the includes of server/core/*.c will be
cleaned up, and if there is a common set of include files, needed
by most, then a server/core/maxscale/core.h that includes those
will be introduced.
2016-10-17 12:17:09 +03:00
63b5c10f31 Move daemonize() to gateway.c
The one remaining function in gw_utils.c was moved to gateway.c,
so gw_utils.c could be removed.
2016-10-17 12:17:09 +03:00
e6d7ca4ed9 GW_NOINTR_CALL removed.
Used in just one place inside MaxScale so better to simply write
it explcitly.
2016-10-17 12:17:09 +03:00
b27774e674 Rename MAX_BUFFER_SIZE
MAX_BUFFER_SIZE, which is used for limiting the amount of the data
read from a socket renamed to MXS_MAX_NW_READ_BUFFER_SIZE and moved
from gw.h to limits.h.

Consider removing altogether. Difficult to justify since non-blocking
reads are used and the amount of available data is known.
2016-10-17 12:17:09 +03:00
8aafa34d66 Hard limits moved to limits.h
Limits used with SO_[RCV|SEND]BUF moved from gw.h to limits.h and
renamed so that the prefix is MXS_.
2016-10-17 10:11:13 +03:00
d5cf74bd24 Cleanup gw.h, part 1.
Gw.h contained a fair amount of obsolete function declarations,
duplicate declarations of functions declared in utils.h and
declarations of functions that conceptually are similar to those
in utils.h.

The obsolete and duplicate ones were removed and all but one of
the remaining moved to utils.h. Correspondingly the implementation
was moved from gw_utils.c to utils.c.

The one remaining function - gw_daemonize() - is not really worthy
of a file of its own, so that is to be moved to gateway.c after which
gw_utils.c can be removed.

Gw.h still contains defines that are duplicated in
maxscale/protocol/mysql.h. The ones in gw.h are to be removed. It
appears that the entire gw.h will disappear.
2016-10-15 11:18:14 +03:00
1333da0712 Remove skygw_utils.h
The general purpose stuff in skygw_utils.h was moved to utils.h
and the corresponding implementation from skygw_utils.cc to utils.c.
Includes updated accordingly.

Skygw_utils.h is now only used by log_manager and by mlist, which
is only used by log_manager. Consequently, skygw_utils.h was moved
to server/maxscale.

Utils.h needs a separate overhaul.
2016-10-14 19:50:54 +03:00
68e53567a0 Make mlist.h private
Mlist is only used by log_manager so for the time being it is moved
under server/core/maxscale. Eventually it may be included in log_manager
itself.
2016-10-14 15:55:33 +03:00
cd26c69ffb Remove slist
Not used by anybody, so better to remove it.
2016-10-14 15:52:27 +03:00
03dbc6df80 Remove dependency on skygw_utils.h
- STRERROR_BUFLEN moved to cdefs.h and renamed to MXS_STRERROR_BUFLEN.
  Better would be to provide a 'const char* mxs_strerror(int errno)'
  that would have a thread specific buffer for the error message.
- MIN and MAX also moved to defs.h as MXS_MIN and MXS_MAX.
- Now only mlist.h of the headers depend upon skygw_utils.h.
2016-10-14 15:42:02 +03:00
bff2cfb7e5 Remove skygw_types.h
Some stuff moved to maxscale/utils.h. Further cleanup still needed.
2016-10-14 14:24:31 +03:00
0800bf4a59 Rename skygw_debug.h to debug.h
Also remove unneded includes in debug.h
2016-10-14 13:48:10 +03:00
1a978be6b6 Cleanup header files
- All now include maxscale/cdefs.h as the very first file.
- MXS_[BEGIN|END]_DECLS added to all C-headers.
  Strictly speaking not necessary for private headers, but
  does not hurt either.
- Include guards moved to the very top of the file.
- #pragma once added.
2016-10-14 11:54:37 +03:00
2fe58ebe5b Move test_utils.h to server/core/test 2016-10-13 22:59:39 +03:00
d04cb54b9f maxscale/maxscale_pcre2.h renamed to maxscale/pcre2.h 2016-10-13 22:59:39 +03:00
76430e060f maxconfig.h renamed to config.h 2016-10-13 22:59:39 +03:00
3a18b64bdd mysql_client_server_protocol.h moved.
Moved to include/maxscale/protocol/mysql.h
2016-10-13 22:59:39 +03:00
e41589be10 Move headers from server/include to include/maxscale
- Headers now to be included as <maxscale/xyz.h>
- First step, no cleanup of headers has been made. Only moving
  from one place to another + necessary modifications.
2016-10-13 16:19:20 +03:00
ef5bbd9353 Remove trailing NULLs from throttling message 2016-10-13 16:04:27 +03:00
9d8c5cd410 MXS-862: Add authenticator options and instances
Authenticators now have a similar mechanism to the `router_options`
parameter which enables configurable authentication.

The authenticators also have a new initialize entry point which is similar
to the createInstance entry point of the filters and routers. The value of
`authenticator_options` is passed as a parameter to this function. The
return vaulue of the `initialize` entry point is passed to the `create`
entry point.
2016-10-13 15:58:18 +03:00
cb7c112764 MXS-862: Create common MySQL library
The MySQLCommon library contains functions used by both the protocol and
authenticator modules. The contents of the modutil.c file could also be
moved to this file if the functions in that file are only used by modules
and not the core.
2016-10-13 15:51:52 +03:00
dfeb5c46c9 MXS-862: Add create/destroy and remove plugin_name entry points
The create and destroy entry points allow authenticators to store data in
the DCB. This data is not shared by other DCBs related to the same
session.

The plugin_name entry point wasn't really useful as the plugins would
still need to send a AuthSwitchRequest packet if they wanted to change the
authentication mechanism.
2016-10-13 15:51:51 +03:00
6d057f8152 MXS-862: Move backend authentication from MySQLBackend to MySQLBackendAuth
The authentication for backend connections is now done in the
MySQLBackendAuth module. This is also the default authentication module
for backend connections created by MySQLBackend.
2016-10-13 15:51:51 +03:00
35d9b35609 MXS-862: Refactor backend authentication handling
The backend responses are now read in one place and the functions just
read the data. The protocol level will now handle the packet gathering
process and the authentication part just inspects the data.

Backend connections now load authenticators when they are being
connected. In the future, this enables the use of authentication modules
for backend connection.
2016-10-13 15:51:50 +03:00
cd11971d5d Log more precise DCB write error messages
The DCB error messages now log the type of the DCB and the remote address
in addition to the system error message. The file descriptor and memory
address are no longer printed in the error message as they are not useful
to the end user. The fd and address are now logged at debug level with a
more verbose error message.
2016-10-13 15:51:50 +03:00
cc01ce5c16 Remove obsolete parts from testlog.c
The code used the log manager in the wrong way which caused the test to
hang from time to time.
2016-10-03 15:40:49 +03:00
fbf5c331f1 Merge branch '2.0.1' into develop 2016-10-03 15:21:04 +03:00
91759ef323 Use MXS_ALERT when logging the stack of a crash
As MXS_ERROR is throttled you'd risk missing some part of the stack.
2016-09-30 10:48:04 +03:00
93b755fc33 Add MXS_ALERT
As errors and warnings are throttled, there is a need for being able
to log severe errors without ever having them throttled (e.g. when
logging the stack in conjunction with a crash).

MXS_ALERT should only be used in a context where the process is known
to be going down, either via crash or explicit exit.
2016-09-30 10:44:59 +03:00
3d5cfee348 housekeeper: Copy data to prevent access of freed data 2016-09-29 09:34:54 +03:00
c919511ba7 Implement simple failover mode into mysqlmon
The mysqlmon simple failover mode allows it to direct write traffic to a
secondary node. This enables a very simple failover mode with MaxScale
when it is used in a two node master-slave setup.
2016-09-26 11:00:16 +03:00
e484aac6f0 Use CLOCK_MONOTONIC instead of CLOCK_MONOTONIC_RAW
The CLOCK_MONOTONIC_RAW isn't supported on all of the platforms, namely
CentOS 5.
2016-09-22 10:09:25 +03:00
0a951d5e65 Merge branch 'develop-2.0-merge' into develop 2016-09-22 09:49:10 +03:00
08d980b433 Trim and squeeze whitespace when canonicalizing queries
The canonical form of the query should ignore changes in whitespace as the
semantics of the query stays the same regardless of the amount of
whitespace.
2016-09-21 10:58:24 +03:00
ca9021b835 Merge branch '2.0' into develop 2016-09-21 02:51:27 +03:00
3992135325 Move authentication return codes to gw_authenticator.h
The MYSQL_* authentication return codes are now in gw_authenticator.h so
that all authenticators can use them. Also dropped the MYSQL_ prefix from
the return codes and added AUTH_INCOMPLETE for a generic
authentication-in-progress return code.
2016-09-20 11:44:17 +03:00
35d4be14d2 Make service and monitor permissions checks optional
MaxScale shouldn't require the service and monitor user checks. It makes
sense to disable the checks to speed up the startup process when the user
knows that the permissions are OK.
2016-09-20 10:30:53 +03: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
da9c7db231 Fix Travis builds
The travis builds failed due to outdated build scripts. The queuemanager
also failed to build on non-Debug builds.
2016-09-15 07:13:10 +03:00
8baba28450 Cleanup modutil_get_next_MySQL_packet
- Single entry/single exit.
- Variables declared as they are needed.
- The GWBUF_EMPTY check removed as it only looks at the first buffer
  in a chain. That is, if there had been a non-empty chain where the
  first buffer is empty, the function would incorrectly have reported
  that the buffer contains no packet.
- Documentation updated.
2016-09-14 15:13:25 +03:00
4597cdf7b9 Use gwbuf_split in modutil_get_next_MySQL_packet
Earlier, a copy was made.
2016-09-14 15:13:25 +03:00
65ccc6b8fb CMakeLists.txt cleanup
- maxscale-common no longer linked with libaio as it is not used.
2016-09-14 11:31:01 +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
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
d8bff00fa5 FAKE_CODE variables declared in header, defined in c-file 2016-09-12 15:09:05 +03:00
0b4320fb1d Merge branch '2.0' into develop 2016-09-12 09:39:26 +03:00
2d229927fe Fix broken if in poll.c
One if was not working due to an extra semicolon at the end of the line.
2016-09-12 06:46:56 +03:00