6915 Commits

Author SHA1 Message Date
Markus Mäkelä
b4d81ffe27 Use correct capability for schemarouter
The router should use RCAP_TYPE_CONTIGUOUS_INPUT as it parses the
statements.
2017-03-06 16:35:17 +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ä
f2fc9b9d9f Add workaround for null value handling in Avro C API
The Avro C API fails to write bytes of size zero. A workaround is to write
a single zero byte for each NULL field of type bytes.

Also added an option to configure the Avro block size in case very large
records are written.
2017-03-04 10:12:18 +02:00
Markus Mäkelä
09df0acb00 Fix binlog rotation detection
The rotations of binlogs weren't detected as the file names weren't
compared.

Moved the indexing of the binlogs to the end of the binlog
processing. This way the files can be flushed multiple times before they
are indexed.
2017-03-04 00:31: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
Markus Mäkelä
916cb4df08 Rename failover and failover_recovery
The names of the parameters were misleading as MaxScale doesn't perform
the actual failover but only detects if one has been done.
2017-03-03 18:45:20 +02:00
Markus Mäkelä
0581ab1afe Extend failover documentation
The documentation now explains more clearly why the parameter is needed
and how it performs the checks.
2017-03-03 18:45:20 +02:00
Markus Mäkelä
09ef292283 Update dbfwfilter build configuration
The filter now uses a more recent syntax to declare the function name
prefixes. This removes a build warning.
2017-03-03 18:44:58 +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ä
789c14197d Merge branch '2.0' into 2.1 2017-03-02 14:05:42 +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
Markus Mäkelä
075ca42482 Expand slave_selection_criteria documentation
Added a section about how `slave_selection_criteria` and
`max_slave_connections` affect each other.
2017-03-02 13:33:45 +02:00
Markus Mäkelä
e2869052bd MXS-1081: Fix VARCHAR field processing
The data length is stored in the field metadata instead of the data being
encoded as a length encoded string.
2017-03-02 13:14:07 +02:00
Johan Wikman
da5edadcda MXS-1150: Do not cache non-cachable functions
The resultset of SELECTs that use functions whose result will
always vary or whose result depend upon the user executing the
query should not be cached. The list of functions is the same
as that specified for the query cache of MariaDB:
https://mariadb.com/kb/en/mariadb/query-cache/
2017-03-02 13:13:31 +02:00
Markus Mäkelä
e01a6a0d58 Fix field name parsing
The fix to field name parsing didn't properly break the loop when the
backtick character was detected.
2017-03-02 13:12:45 +02:00
Markus Mäkelä
e4b4dad94a Add more debug assertions to avro row processing
The debug assertions check that the event pointer isn't moving beyond
allocated memory.
2017-03-02 13:11:52 +02:00
Johan Wikman
923ed9329d Add better cache debugging
Now the statement and the decision is logged. Easier to figure
out why something is or is not cached.
2017-03-02 12:35:53 +02:00
Johan Wikman
4902ed7cf5 MXS-1137: Do not cache when [user|system] vars are used
If user or system variables are used in a SELECT statement, then
the result will not be cached. That ensures that the wrong result
will not be returned.
2017-03-02 12:35:53 +02:00
Johan Wikman
aa51528481 Factor out caching decision making 2017-03-02 12:35:53 +02:00
Markus Mäkelä
97115fae6a Fix threads documentation
The description of the `auto` value was wrong. The algorithm is:

    CPU count - 1
2017-03-02 12:21:06 +02:00
Markus Mäkelä
0de9561b5a MXS-1146: Fix command tracking for large packets
The current command was updated with invalid data when the packet size
exceeded 2^24 bytes.
2017-03-02 12:21:05 +02:00
Markus Mäkelä
7daafd33fc Restrict master failover to non-slave servers
If all but one server in a cluster fail and `failover` is enabled for
mysqlmon, the last server would be used as if it were a master. With this
change, the restrictions on failover also require that the last server is
not configured as a slave.

This change will prevent unintended failovers from happening when network
connectivity is bad. It also allows external actors to clear the slave
configuration from the last remaining server to signal MaxScale that the
server can be used as a master.
2017-03-02 09:41:38 +02:00
MassimilianoPinto
1d48a24d6a MXS-1149: removed send_ok_upstream() routine
send_ok_upstream is no longer in use, just remove it
2017-03-01 14:53:37 +01:00
MassimilianoPinto
c9592aa05e MXS-1149: maxrows should return empty resultset instead of OK
maxrows returns empty resultset instead of OK.

The response with coulmndefs is sent then an EOF without flags is added.

Limitations: in case of MULTI_RESULT sets only the first one coulmndefs
is sent with EOF
2017-03-01 14:48:35 +01:00
Johan Wikman
eefa63be33 Use qc_query_is_type 2017-03-01 14:46:35 +02:00
Johan Wikman
82049b8ed1 Use cache as long as a trx only performes reads
As before, the cache will be used if there is no ongoing transaction
(includes autocommit being on), or if there is an explicitly read-
only transaction.

In addition, the cache will be used and populated during any other
transaction as long as only pure read statements are executed. After
first non-read statement, the use of the cache is disabled.
2017-03-01 11:08:52 +02:00
Johan Wikman
f1ea0b03d1 Change order of testing whether caching should be used
First we check the transaction state, then we check whether it is
a SELECT. In the next step, we will widen the cases when caching
is used.
2017-03-01 11:08:52 +02:00
Johan Wikman
7bf7b1a47a Simplify logic for when deciding whether to cache
The autocommit state is now included in the result returned
from session_trx_is_active(), so it need not be checked separately.

This is preparatory work for MXS-1136 that will change the approach
so that the cache is used and populated in a non readonly transaction
*until* the first non-read statement is encountered.
2017-03-01 11:08:52 +02:00
Johan Wikman
7bcb60aaa6 MXS-1077: Add missing close 2017-03-01 10:47:20 +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
Esa Korhonen
d617a0b7b9 Move testfilter, router etc to examples
Also changed Plugin devel manual to match. Modified roundrobinrouter
to use static_cast due to the change in router api definitions.
2017-02-28 17:51:48 +02:00
Esa Korhonen
37f80a7dd8 Plugin development manual
Plenty of additions and restructuring compared to the first version.
Add it to Documentation.
2017-02-28 17:51:12 +02:00
Markus Mäkelä
b2cd90bb08 Only use get_bref_from_dcb with backend DCBs
Altered the function to assert that the DCB is a backend DCB in addition
to the existing assertions for non-NULL backend reference on function
return.

Move the fetching of the backend reference after the type of the DCB is
inspected in handleError. This removes the need to handle the case where
the returned bref is NULL and the DCB is a client DCB.
2017-02-28 11:28:22 +02:00
Johan Wikman
ef28808967 Update release notes for 2.1.1
Session specific logging levels removed.
2017-02-27 14:47:44 +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
cb380d09f8 Deprecate session specific log priorities
They are not particularly useful, they surely are not used
and impose a small cost for every event extracted from the
poll sets.

This commit only removes the maxadmin commands, subsequent
commits will remove the actual code.
2017-02-27 14:40:11 +02:00
Johan Wikman
d44e38b15b Remove deprecated logging functionality 2017-02-27 14:40:00 +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
Johan Wikman
0a8eaa81df Add volatile to spinlock variables
Otherwise the loop inside spinlock_acquire will turn into an
eternal loop when optimizations have been turned on.
2017-02-27 13:32:28 +02:00
Johan Wikman
870a72ae71 Inherit maxscale::Filter from MXS_FILTER
All use of reinterpret_cast can be removed. No cast needed when
the C++ instances are returned, and static_cast is sufficient for
downcasting.
2017-02-27 11:11:04 +02:00
Markus Mäkelä
677e8aaabf Remove spinlocks from readwritesplit
Spinlocks are no longer necessary as the threading model only allows a
specific thread to access the router session.
2017-02-27 11:02:58 +02:00
Johan Wikman
d834c1bbdc Compile sqlite explicitly in single thread mode
As every thread has a separate (in-memory) database, i.e. not
just a separate _connection_, sqlite can be compiled in singe-thread
mode, which means that there will be *no* locking.
2017-02-27 10:39:20 +02:00
Johan Wikman
560bd1e507 Update MXS_ROUTER_OBJECT APIs
Now the type MXS_ROUTER_SESSION is used in MXS_ROUTER_OBJECT.
All routers updated accordingly.
2017-02-27 10:17:57 +02:00
Johan Wikman
d7f7c01f47 Replace void* with struct mxs_router
Using an empty struct instead of void* to represent the opaque
filter and filter session types, means that C++ filter types
simply can derive from them. That brings conceptual clarity and
also means that the C++ instances can be returned from the module
callbacks without casts. When provided as argument they can be
downcast using static_cast instead of reinterpret_cast.

In a subsequent change, the prototypes of MXS_ROUTER_OBJECT will
be updated and routers modified accordingly.
2017-02-27 09:45:09 +02:00
Johan Wikman
6406f6b4e1 Replace void* with struct mxs_filter
Using an empty struct instead of void* to represent the opaque
filter and filter session types, means that C++ filter types
simply can derive from them. That brings conceptual clarity and
also means that the C++ instances can be returned from the module
callbacks without casts. When provided as argument they can be
downcast using static_cast instead of reinterpret_cast.

Similar types to be provided for routers.
2017-02-27 09:31:24 +02:00
Markus Mäkelä
9aa22c6eb4 Fix server version detection of 10.2 flags
The code used the wrong version string. Instead of using the server
version string, it used the service version string.
2017-02-21 11:27:04 +02:00
Markus Mäkelä
644b139b00 Add support for 10.2 server capabilities
Added support for 10.2 server capabilities and cleaned up the server
capability flags.
2017-02-21 11:27:03 +02:00