3016 Commits

Author SHA1 Message Date
Markus Mäkelä
8be44a8cda Merge branch '2.1' into develop 2017-03-06 11:25:44 +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ä
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
4cd9309b30 Add skeleton hint router
The hint router will perform its scheduling solely based upon hints
provided by a filter (e.g. namedserverfilter) placed before it.
2017-03-03 15:35:37 +02:00
Johan Wikman
b3e8ea9b5a Merge branch '2.1' into develop 2017-03-03 13:37:14 +02:00
Markus Mäkelä
789c14197d Merge branch '2.0' into 2.1 2017-03-02 14:05:42 +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ä
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
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
MassimilianoPinto
c926577a3c Fix wrong value in debug message
Fix wrong value in debug message
2017-02-27 16:35:11 +01: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
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ä
68f99ae305 Remove unused DCB callback code
The highwater and lowwater callbacks were never registered for the client
DCBs in the binlogrouter.

The DCB hangup callbacks were never called by the core and were replaced
with fake hangup events in an earlier version.
2017-02-27 09:25:15 +02:00
Markus Mäkelä
c3cc46ae04 Add deflate compression to avrorouter
The avrorouter can now compress the Avro files using the deflate algorithm
provided by zlib.
2017-02-21 16:19:09 +02:00
Markus Mäkelä
c47ef968f7 Add initial support for deflate compression in maxavro
Maxavro now supports reading records with the zlib deflate
algorithm.

With this change, each data block is read into memory in one IO
operation. This allows the library to decompress the data block if
necessary.

The avrorouter does not yet use compression when writing the records.
2017-02-21 16:14:47 +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ä
1d8d526a01 Merge branch '2.1' into develop 2017-02-20 18:39:41 +02:00
MassimilianoPinto
6fd025376c Missing NULL check
Missing NULL check added
2017-02-20 16:21:37 +01: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
MassimilianoPinto
446f65a9cf MXS-1142: maxbinlogcheck to remove transaction from binlog
maxbinlogcheck with new -T $pos option can find the BEGIN of
transaction where $pos belongs to and then replace all events in
between with IGNORABLE events
2017-02-16 17:33:27 +01:00
MassimilianoPinto
755a3601ec MXS-1141: maxbinlogcheck to replace an event with ignorable event
maxbinlogcheck utility can replace an event at pos with an ignorable
event

New option is -R, —replace

-R $pos

The -R needs -f as file will be modified
2017-02-16 12:23:26 +01:00
Johan Wikman
7a6c38bd13 Merge branch '2.1' into develop 2017-02-16 11:10:11 +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
MassimilianoPinto
a0b599730c Detect and store MariaDB GTID
If Binlog Server is running with MariaDB 10 compatibility then the
found GTID is stored in router->mariadb_gtid
2017-02-15 08:29:38 +01:00
Johan Wikman
71707c8505 Merge branch '2.1' into develop 2017-02-15 08:48:36 +02:00