2025 Commits

Author SHA1 Message Date
Esa Korhonen
558a264e6d Server list handling functions consistency
The functions handling servers lists now act with a bit more
consistency, always returning the array size instead of NULL-
terminating arrays.
2017-03-20 09:44:14 +02:00
Esa Korhonen
3129efb3f7 Add new parameter type MXS_MODULE_PARAM_SERVERLIST
This is a list of servers, separated by commas. When queried as a
config setting, returns a null-terminated array of SERVER*:s. The
commit includes a serverlist parsing function, which should probably
be used anywhere a similarly formed string is parsed.
2017-03-15 11:48:46 +02:00
Esa Korhonen
dd82c46596 Remove two checks that always return false
At the point this function is called, the servers and services are
not yet created.
2017-03-14 11:09:54 +02:00
Markus Mäkelä
7b3c287ac3 Close sessions in MaxScale core
The core now provides a simple function to close a session. This removes
the need for the modules to directly call the API entry points when the
session should be closed. It is also in line with the style that other
objects, namely the DCBs, use. This makes the new session_close very
similar to dcb_close.
2017-03-14 10:45:10 +02:00
Markus Mäkelä
9952676052 Move UNIX domain socket creation to utils.c
The network socket code is now completely inside utils.c.
2017-03-14 10:45:10 +02:00
Markus Mäkelä
147a1f88eb Merge branch '2.1-ipv6' into develop 2017-03-13 13:18:08 +02:00
Markus Mäkelä
e8ef701409 Combine socket creation code
The client connection and the server listener sockets used largely similar
code. Combining them allows for simpler protocol code.

Cleaned up parts of the DCB listener creation and moved the parsing of the
network binding configuration to a higher level.
2017-03-13 10:45:56 +02:00
Markus Mäkelä
66ba7f3c80 Simplify network socket creation code
The socket creation code in mysql_backend.c wasn't MySQL specific and it
could be used for all non-blocking network connections. Thus, it makes
sense to move it to a common file where other protocol modules can use
it.

The address resolution code now uses `getaddrinfo` to resolve all
addresses instead of manually handling wildcard hosts. This allows the
same code to be used for all addresses.
2017-03-13 10:45:55 +02:00
Markus Mäkelä
37dd561470 Add support for IPv6
Both the listeners and servers now support IPv6 addresses.

The namedserverfilter does not yet use the new structures and needs to be
fixed in a following commit.
2017-03-13 10:45:55 +02:00
Johan Wikman
82247f9143 Add mxs_strerror
Thread-safe version of strerror; thread local buffer used for storing
the message. The performance penalty of a thread local buffer is not
likely to be significant, since this is only called in an error
situation that anyway is likely to interrupt the normal processing.
2017-03-13 10:45:55 +02:00
Markus Mäkelä
b796967df8 Add diagnostic entry point to authenticators
The authenticators should have a similar way to print diagnostic
information as filter and routers do. This allows the authenticators to
print the users in their own format.

In the future, all the diagnostic entry points should be changed so that
they return a structure that contains the information in a standard
form. This information can then be formatted in different ways by other
modules.
2017-03-13 10:45:54 +02:00
Markus Mäkelä
48d70fa4a8 Replace get_users implementation with new version
The get_users function now combines the functionality of the old get_users
and get_all_users. This removes large parts of similar code.

Removed the listener resources as MySQLAuth was the only one that used it.
2017-03-13 10:45:52 +02:00
Markus Mäkelä
b53ef249f9 Add comment to Jenkins build variables
One of the values is separated by two spaces. Adding a comment will
prevent any accidental fixes to this comparison operation.
2017-03-13 09:14:35 +02:00
Markus Mäkelä
6da8cfe97e Fix assignment of master status on failed servers
When the real root master server went down, it still received the master
status bit due to how the replication tree was built. The bit should only
be set for servers that are running.

Also fixed a false state change event when the master status bit was
manually cleared from the downed root master server.
2017-03-12 09:40:21 +02:00
Markus Mäkelä
415001a4cd Merge branch '2.1' into develop 2017-03-09 10:02:36 +02:00
Markus Mäkelä
41ff01d16d Merge branch '2.0' into 2.1 2017-03-09 10:01:38 +02:00
Johan Wikman
d82f4ad6dc Prevent ignoring return value error
When strtol[l] is used for verifying that a string represents a
number, we are not interested in the actual value.
2017-03-09 09:46:38 +02:00
Markus Mäkelä
e1a1959bc2 Replace strerror_r with mxs_strerror
The mxs_strerror function requires no local buffer, thus making it simpler
and cleaner to use.
2017-03-09 09:36:57 +02:00
Timofey Turenko
84a6848f10 Add build information to --version-full
If the Jenkins build information is available, print it in the full
version output.
2017-03-09 09:32:37 +02:00
Markus Mäkelä
c18f94b31b Get socket family from struct sockaddr_storage
The struct sockaddr_storage has a member variable that tells the socket
family.
2017-03-08 17:04:14 +02:00
Esa Korhonen
d7e48f93bb NamedServerFilter PCRE2 matching and refactoring
Change to modutil_extract_SQL(), add pcre2_data to filter session.
The pattern is now jit-compiled for maximum speed. Move general
pcre2 error printing to a function and macro. Add instance-level
statistics so the filter always prints diagnostic info. Add a mention
of PCRE2 to release notes.
2017-03-08 14:01:38 +02:00
Esa Korhonen
5c0ec3e356 Make hint.c/hint.h const correct
Not a rigorous pass, just added const to the more obvious places.
2017-03-08 09:50:53 +02:00
Esa Korhonen
a7379d7ae2 MXS-1165 MaxInfo endless loop
If one queried in MySQL MaxInfo 'show sessions' or 'show clients',
MaxScale would go in an endless loop and finally crash when memory
ran out. The reason is the rather confusing callback-based dcb-
iterating code. Adding one line fixes the issue, although the iteration
is still rather awkward with calling dcb_foreach for every session/
client.
2017-03-07 10:42:48 +02:00
Markus Mäkelä
8be44a8cda Merge branch '2.1' into develop 2017-03-06 11:25:44 +02:00
Markus Mäkelä
e7b5731976 Fix internal test suite
Two of the tests didn't initialize the random number generator.
2017-03-06 11:06:33 +02:00
Markus Mäkelä
bb22b82461 Merge branch '2.0' into 2.1 2017-03-06 10:38:07 +02:00
Markus Mäkelä
dadc0d6a9d Fix DATETIME and BLOB processing
The old DATETIME format wasn't processed properly which caused a
corruption of following events.

A BLOB type value could be non-NULL but still have no data. In this case,
the value should be stored as a null Avro value.
2017-03-04 00:26:51 +02:00
Johan Wikman
7f9fdd0f3d Add router template
Using the class RouterSession and the template Router, a router
module can be defined. The way they are intended to be used are
as follows:

  class MyRouterSession : public maxscale::RouterSession
  {
      ...
  };

  class MyRouter : public maxscale::Router<MyRouter, MyRouterSession>
  {
      ...
  }

  ...

  extern "C" MXS_MODULE* MXS_CREATE_MODULE()
  {
     static MXS_MODULE module =
     {
         ...
         &MyRouter::s_object,
         ...
     };

     return &module;
  }
2017-03-03 15:30:25 +02:00
Johan Wikman
b3e8ea9b5a Merge branch '2.1' into develop 2017-03-03 13:37:14 +02:00
Johan Wikman
76e56a2688 Perform SSL cleanup 2017-03-03 13:28:27 +02:00
Esa Korhonen
7b67cfd1ef Variables written to in signal handlers should be volatile 2017-03-03 09:41:56 +02:00
Markus Mäkelä
3bafcae343 MXS-759: Attempt to create PID directory
When MaxScale is started, it will attempt to create the PID directory. If
the directory does not exist and MaxScale is able to create it, MaxScale
will successfully start whereas it previously failed to do so.

If MaxScale lacks the permissions to create the directory, an error
message is printed to the user explaining the reason why MaxScale fails to
start.
2017-03-02 13:50:31 +02:00
Johan Wikman
18ee9114db [Je|T]malloc libraries must be first
If alternative malloc implementations are to be used, their
library must appear first on the link line.
2017-02-28 20:28:25 +02:00
Johan Wikman
fd92d76f0a Avoid accessing tls data
The thread id is copied to a local variable to avoid having
__tls_get_addr from unnecessarily being called over and over
again. Together that used to amount to some 1% of the execution
time.
2017-02-28 20:28:25 +02:00
Johan Wikman
65457f1724 Remove support for session specific log priorities
No need to maintain information in thread local storage,
which just added complexity and also incurred a slight
performance penalty.
2017-02-27 14:41:01 +02:00
Johan Wikman
bf4d00d6e3 Add temporary fixes to hashtable
These fixes prevent loops turning into eternal loops when
optimizations have been turned on.

The right remedy is to remove the internal locks from hashtable
and use external locks instead.
2017-02-27 13:36:51 +02:00
Markus Mäkelä
4e223adeff Simplify DCB writing code
Due to the changes in the threading model, the DCB write code can be
simplified by a great amount.

Since only one thread can write to a DCB, it's safe to assume that no new
data is added to the write queue of a DCB while it is being drained. This
removes the need for the code that tracks whether a concurrent DCB write
attempt was made.

Because the high and low water callbacks weren't used by any module, it is
safe to remove them. They offer no real benefits over the drain callback.
2017-02-27 09:25:15 +02:00
Markus Mäkelä
1d8d526a01 Merge branch '2.1' into develop 2017-02-20 18:39:41 +02:00
Markus Mäkelä
61f2d96a58 Merge branch '2.0' into 2.1 2017-02-20 11:17:49 +02:00
Markus Mäkelä
f54c0a5b81 Initialize RNG in maxkeys/maxpasswd
The initialization needs to be done in each of the executables before the
random number generator is used.
2017-02-20 11:07:44 +02:00
Johan Wikman
71707c8505 Merge branch '2.1' into develop 2017-02-15 08:48:36 +02:00
Johan Wikman
49cc2b52e3 Merge branch '2.1.0' into 2.1 2017-02-15 08:44:55 +02:00
Johan Wikman
5648f708af Update license to BSL 1.1 2017-02-14 21:42:28 +02:00
Johan Wikman
0838401b32 Merge branch '2.1' into develop 2017-02-14 17:54:27 +02:00
Johan Wikman
2a49cd6451 getCapabilities now get the instance as argument
Allows the capabilities to be different depending on how the
filter/router has been configured.
2017-02-14 13:55:22 +02:00
Johan Wikman
5f0346f5a9 Remove support for session specific log priorities
No need to maintain information in thread local storage,
which just added complexity and also incurred a slight
performance penalty.
2017-02-14 12:35:24 +02:00
Johan Wikman
20da2c7db8 Add mxs_strerror
Thread-safe version of strerror; thread local buffer used for storing
the message. The performance penalty of a thread local buffer is not
likely to be significant, since this is only called in an error
situation that anyway is likely to interrupt the normal processing.
2017-02-14 09:39:03 +02:00
Markus Mäkelä
f7cc548093 Format mysql_binlog.c
The lines were too long.
2017-02-13 16:23:26 +02:00
Markus Mäkelä
7a35ec71da Fix DECIMAL conversion
The DECIMAL type was not correctly converted to positive integers. The
0x80 bit was set only for negative numbers when it needed to be XOR-ed for
all values.
2017-02-13 16:23:26 +02:00
Markus Mäkelä
f9732d7041 Fix DECIMAL handling in Avrorouter
The DECIMAL value type is now properly handled in Avrorouter. It is
processed into an Avro double value when before it was ignored and
replaced with a zero integer.

Backported to the 2.0 branch.
2017-02-13 16:23:26 +02:00