4275 Commits

Author SHA1 Message Date
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
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
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
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
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
Markus Mäkelä
e7c7caebad Add option for failover recovery in mysqlmon
The `failover_recovery` option allows failed servers to rejoin the
cluster. This should make using MaxScale with two node clusters easier.

One use case for this is when the replication-manager promotes the last
node in the cluster as the master. When this is done, the slave
configuration is cleared and the read-only mode is disabled. Since the
failover requires that the server is not configured as a slave and that it
is not in read-only mode, it is safe to use `failover_recovery` with
replication-manager.
2017-02-20 11:20:53 +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
413654ab3a Update links in default template 2017-02-16 11:09:28 +02:00
Markus Mäkelä
272896b50e Fix luafilter build failure
The filter used the old getCapabilities signature.
2017-02-16 10:16:10 +02:00
Markus Mäkelä
431cf885c3 Fix devel package
The devel package didn't install generated headers and the template
`header.h.in` files were installed instead.
2017-02-15 09:31:14 +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
3a3b31ebb4 NullFilter capabilities are now instance specific
There can now in one configuration be multiple Null filters,
each with its own set of capabilities.
2017-02-14 13:55:50 +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
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
Markus Mäkelä
4bd743d3ce Use correct Avro function
The avrorouter used the 32-bit function to store 64-bit integers. This
caused incorrect values to be stored.
2017-02-13 16:23:26 +02:00
Markus Mäkelä
0b892c9714 Add missing newline to avrorouter output
The schema was not terminated with a newline.
2017-02-13 16:23:22 +02:00
Markus Mäkelä
10e74225c0 Add missing error detection
If the file fails to seek to the correct position, the indexing should
stop.
2017-02-13 16:18:43 +02:00
Esa Korhonen
7e23789364 Fix one last compilation error
Fix one ignored return value in Avro, caused compilation to fail.
2017-02-13 14:46:43 +02:00
Markus Mäkelä
acd66b4eb3 Fix compiler warnings
Added missing checks for return values of various function calls. Fixed
binlogrouter strerror_r usage and wrong buffer sizes.
2017-02-13 11:44:38 +02:00
Markus Mäkelä
eb1e163bdf Only update index file if file is flushed to disk
There's no point in indexing the file if it hasn't been synced to
disk. Any attempts to index the file will fail if the file still has an
open data block.
2017-02-12 04:38:24 +02:00
Markus Mäkelä
cf63e4cb9e Remove false debug assertion
If MaxScale is started without the appropriate permissions to the paths
pointed by default values, the debug assertion fails even though the
parameter is valid but not usable.
2017-02-10 18:49:22 +02:00
Markus Mäkelä
d2c3be8728 Fix compiler flag usage
The compiler flags overwrote the default values that CMake generates
instead of appending to them.
2017-02-10 17:19:46 +02:00
Markus Mäkelä
04b2475553 Fix random_jkiss initialization
The initialization function used another function which expected
initialization to be done.
2017-02-10 14:17:54 +02:00
Markus Mäkelä
334e71b079 Initialize random number generator in main
The random number generator can be initialized when MaxScale's other
systems are being initialized. This removes the need to initialized it
when the function is used for the first time.
2017-02-10 13:02:39 +02:00
Markus Mäkelä
fb21b99983 Fix DATE and DATETIME months
The month values for DATE and DATETIME were off by one.
2017-02-09 16:50:14 +02:00
Markus Mäkelä
47a1cdad5d Fix binlog integer conversion
The binlog integers were stored as unsigned values instead of signed ones.
2017-02-09 16:01:03 +02:00
Johan Wikman
d76be99cc5 Improve error message
A parameter may be wrong because the parameter name is wrong or
the value of the parameter is wrong. That needs to be reflected in
the error message.
2017-02-09 15:02:34 +02:00
Johan Wikman
b46bc47c87 Add NullFilter filter module
NullFilter is a filter module that does nothing, except reports
capabilities as defined in the configuration file. It's purpose
is only to make it simple to benchmark the performance impact
various routing capabilities have.

Note that since getCapabilities() currently does *not* take an
instance pointer as parameter, all NullFilter instances will
report the same capabilities, the ones specified for the last
filter to have been loaded.
2017-02-09 15:02:34 +02:00
Markus Mäkelä
ce5cd69eb3 Remove unused locks and variables
Removed unused spinlocks from DCBs, sessions and the MySQL protocol
structs. They were used in a context where only one thread has access to
the structure.

Removed unused member variables from DCBs.
2017-02-08 15:31:17 +02:00
Markus Mäkelä
517ecd9a12 Remove unnecessary spinlocks from random_jkiss
Removing the locks will increase the randomness of the random number
generation by introducing race conditions into the code.
2017-02-08 14:39:16 +02:00