Commit Graph

2373 Commits

Author SHA1 Message Date
12dba14c5c MXS-936: fixed compilation error with "debug" build
MXS-936: fixed compilation error with "debug" build
2016-11-10 13:22:26 +01:00
21add3a8b4 Merge branch 'develop' into MXS-936 2016-11-10 12:02:40 +01:00
77946b6adc MXS-936: destroyInstance of binlog server is now updated
MXS-936: destroyInstance of binlog server was not updated: not it takes
the ROUTER * parameter.
2016-11-10 12:01:41 +01:00
e9030f71bd MXS-936: AVRO shutdown update
AVRO shutdown detection is only in the loop that processes new files.

Flushing and status saving is done anyway
2016-11-10 10:16:39 +01:00
bc1c2e1152 Ensure exit is possible
If shutdown has been initiated (via maxadmin or by sending a
SIGINT or SIGTERM) and a SIGTERM is received, the process
is terminated.

If shutdown has been initiated (via maxadmin or by sending a
SIGINT or SIGTERM) and a SIGINT (Ctrl-C) is received, a warning
is printed that shutdown is in progess. Then, if an additional
SIGINT is received, the process is terminated.

So, in practice:
- If MaxScale is running as a daemon, the first SIGTERM initiates
  shutdown and a second one unconditionally terminates the process.
- If MaxScale is running in the console, the first Ctrl-C initiates
  shutdown, the second prints a warning and the third terminates
  the process.

This is to ensure that MaxScale can be forced to exit, in
case some thread is hung for whatever reason, and is thus preventing
the controlled shutdown.
2016-11-10 11:09:59 +02:00
62049a5bb4 MXS-936: AVRO converter_func update
MXS-936: AVRO converter_func update: added new checks for pending
shutdown
2016-11-09 17:26:28 +01:00
802152d7d3 MXS-936: avro router converter routine handles shutdown
MXS-936: avro router converter routine handles shutdown
2016-11-09 16:26:05 +01:00
da152353dd Merge branch 'develop' into MXS-936 2016-11-09 16:21:40 +01:00
4e36e86820 MXS-936: destroyInstance added for filters
MXS-936: destroyInstance added for filters
2016-11-08 17:09:49 +01:00
ef79686a3a Add option to use a unified log file for qlafilter
The qlafilter now has an option to log all messages to a single
file instead of session-specific files. Session ids are printed
to the beginning of the line when using this mode. Documentation
updated to match. Also, added an option to flush after every
write.
2016-11-08 15:31:31 +02:00
de18f25cb8 MXS-936: add shutdown hooks
First part: add shutdown hooks for routers.

Binlog is the first one with a  destroyInstance() routine
2016-11-08 11:12:37 +01:00
689366b6b7 Fix possible writes to closed DCBs
When persistent connections were used, it was possible that the injection
of COM_CHANGE_USER statements caused a crash when a DCB in the wrong state
was accessed.

For MySQL protocol modules, the `data` member of the client DCB points to
the shared session data, a MYSQL_session struct, but for sessions in the
persistent pool, it points to NULL. The boolean, `was_persistent`, tells
whether a DCB was just taken from the pool or it has been in use.

The `was_persistent` status wasn't properly reset for connections that
were put into the pool which caused a COM_CHANGE_USER statement to be
injected for stale connections in the pool which caused a crash when the
NULL `data` member was accessed.
2016-11-08 09:24:00 +02:00
7358d932e6 Fix maxrows CMakeLists.txt
There was an add_subdirectory call to a nonexistent `test` directory.
2016-11-08 09:12:47 +02:00
eaef39c008 Merge branch 'develop' into MXS-930 2016-11-07 16:21:06 +01:00
c36e5f6ba4 C_DEBUG removed and added a check for packetlen < MAXROWS_EOF_PACKET_LEN
C_DEBUG removed.
A check is now made for packetlen < MAXROWS_EOF_PACKET_LEN.
An empty result set, OK, is send in such situation
2016-11-07 16:19:38 +01:00
a163e31b9a Remove BACKEND structure from readwritesplit
The BACKEND structure is no longer created for the instance. This allows
sessions to dynamically create new servers.
2016-11-07 14:10:18 +02:00
a097204c70 MXS-922: Move server weight calculation into the core
The core now does the server weight calculation instead of each router
module doing the same thing.
2016-11-07 14:10:18 +02:00
9fa1a0cfec Replace qc_get_affected_fields with qc_get_field_info
qc_get_affected_fields that returned the fields as one string with
fields interspared with spaces, will be removed.
2016-11-07 11:03:22 +02:00
9f01a4612d EOF flags are now read in case 0xfe
EOF flags are now read in case 0xfe and minor improvements
2016-11-07 10:01:05 +01:00
5b7e5aa36f SERVER_MORE_RESULTS_EXIST is now detected
The filter can detect SERVER_MORE_RESULTS_EXIST which means the server
is sending more result sets: example:

DROP PROCEDURE IF EXISTS multi;
DELIMITER $$
CREATE PROCEDURE multi() BEGIN
  SELECT 1;
  SELECT id FROM t2 limit 40;
  set @a=4;
  SELECT 2;
END$$
DELIMITER ;

MySQL> call multi()
2016-11-04 15:48:14 +01:00
094586adbc Merge branch 'develop' into MXS-930 2016-11-04 15:29:40 +01:00
f38b510d2b MXS-962: Add nonpositive priority for Galera nodes
If a Galera node has a nonpositive priority, the node will never be chosen
as the master. This gives the user more control over how the master is
chosen.
2016-11-03 22:22:25 +02:00
8778e0c81e Make Users const correct 2016-11-03 09:35:49 +02:00
45f463c438 Require GCC 4.8 for RocksDB
GCC 4.8 is the first GCC version that fully implements C++11
2016-11-03 09:27:58 +02:00
02d28a8d8d Always use format strings in dcb_printf
The luafilter didn't use a format string with dcb_printf which can lead to
unexpected results if the returned string contains printf special
characters.
2016-11-03 09:23:36 +02:00
ab487e687f qc: Remove QUERY_IS_TYPE macro
Explicit call to qc_query_is_type() instead.
2016-11-02 15:50:21 +02:00
8a6e3fb49f Merge branch 'develop' into MXS-930 2016-11-02 08:57:40 +01:00
5085b41d20 Reset persistent MySQL connections
When a persistent connection is taken from the pool, the state is reset
with a COM_CHANGE_USER on the next write. This allows reuse of persistent
connections without having to worry about the state of the MySQL session.
2016-11-01 10:50:07 +02:00
5a1af968d2 Take contiguous input capability into use in filters
The filters which require contiguous input now return the
RCAP_TYPE_CONTIGUOUS_INPUT capability flag.
2016-10-31 08:38:05 +02:00
3c26ea16e2 Add and use FindSQLite.cmake
Added a find_package module for SQLite development libraries.
2016-10-28 12:49:18 +03:00
bbade8b736 PCRE2_CODE_UNIT_WIDTH must not be defined. 2016-10-27 15:26:41 +03:00
6cc7a26582 Cache: Add forgotten change 2016-10-27 13:54:22 +03:00
dcfd5b7601 maxrows now handles SHOW statements and SELECT in prepared statements
maxrows now handles SHOW statements and SELECT in prepared statements
2016-10-27 11:34:01 +02:00
0cfb82f146 The MAXROWS_DISCARDING_RESPONSE is handled differently
The MAXROWS_DISCARDING_RESPONSE is handled differently: the OK packet
is sent only after an EOF is seen in a reply even with multiple packet
transmission from the backend
2016-10-27 10:53:07 +02:00
199dd51312 Cache: C_DEBUG removed and debug option extended
The development time C_DEBUG is now removed, and replaced with
a debug option that allows top-level decisions to be logged.
2016-10-27 11:10:36 +03:00
c73c3b390a Addition of MAXROWS_DISCARDING_RESPONSE
Addition of MAXROWS_DISCARDING_RESPONSE

Packets received after sent OK are consumed and not sent
2016-10-27 09:25:08 +02:00
59b3a1fe36 Handle max_resultset_size in maxrows
Handle max_resultset_size in maxrows
2016-10-26 19:20:25 +02:00
7419ddceca Code review update
Code review update
2016-10-26 19:12:56 +02:00
5aa0c32e8f Minor changes
Minor changes
2016-10-26 18:58:07 +02:00
48af3d21b6 max rows filter first implementation
max rows filter first implementation

Resultsets with more than max_resultset_rows

will be skipped and empty result set is returned to client.
Not yet tested with multi_statements
[MaxRows]
type=filter
module=maxrows
max_resultset_rows=10
debug=15
2016-10-26 15:58:06 +02:00
dc97de57c2 qc: Some minor cleanup
- qc_types_to_string renamed to qc_typemask_to_string
- qc_get_qtype_str removed, duplicate of qc_typemask_to_string
2016-10-26 10:21:11 +03:00
46c2b6e76a Only parse COM_QUERY packets 2016-10-25 20:28:50 +03:00
8391579206 Update cache with new capabilities
Now that a filter can express that the transaction state is tracked,
the cache implementation can be simplified. We do not need to cater
for the case that a "too short" or "too long" a packet would be
delivered.

Further, since the autocommit mode and transaction state of the session
are tracked, the filter can cache data when it is safe to do so. In
practice that means when either AUTOCOMMIT is ON and no explicit
transaction is active or when a READ ONLY transaction is active,
irrespective of the autocommit state.

In principle it would be possible to tentatively cache data during
a transaction, and if the transaction is committed successfully
flush the tentatively cached data to the actual cache, but that will
be for another day.
2016-10-25 16:21:31 +03:00
f961f87e5e Update autocommit mode and transaction state
The transaction state only reflects explicitly started transactions.
Thus, by looking at the autocommit mode and the transaction state a
component can figure out whether the current statement will be committed
or not.
2016-10-25 16:21:31 +03:00
041df39819 Move transaction state management to the right place
The transaction state must be updated after a buffer has been split
into buffer containing individual packets.

NOTE: The actual updating of the transaction state and the autocommit
      mode is currently wrong, but will be updated in a subsequent change.
2016-10-25 16:21:31 +03:00
7e822aed4d MXS-862: Add SQLite based authentication checks
The authentication checks make sure that a user has all the required
grants to access the database. This prevents the creation of unnecessary
backend connections reducing the overall load on the database.

Doing preliminary authentication in MaxScale enables the creation of more
informative error messages.
2016-10-25 13:44:47 +03:00
28ecba4022 Use service capabilities
Now the capabilities of routers and filters alike will be honoured.
2016-10-24 15:19:37 +03:00
3915b4e7c7 Exclude MXS_DEBUG in release builds
Now, MXS_DEBUG turns into a nop in release builds.
2016-10-24 14:00:51 +03:00
d961864635 Fix tests and limit internal test set size
Some of the tests depended on a working installation where modules are all
located at the default paths. These tests now explicitly set the module
directory which fixes the immediate problem.

Disabled the starting of services in the service test as this will fail
with real modules. The dummy internal modules aren't build and should be
removed in a later commit. In general, it might be better to do service
level testing outside the internal test suite.
2016-10-24 13:16:59 +03:00
cff90ffee8 Fix HTTPD protocol authentication
The HTTPD protocol mistakenly assumed that the `authenticator` parameter
of a listener would be NULL if the default authenticator is used.

Recent changes modified it so that the value is never NULL and
`NullAuthDeny` would be used for protocols which did not implement the
auth_default entry point.
2016-10-24 13:16:59 +03:00