Commit Graph

377 Commits

Author SHA1 Message Date
23a7562d3a Replace skygw_ type prefix with qc_.
- skygw_query_type_t renamed to qc_query_type_t.
- skygw_query_op_t renamed to qc_query_op_t.
2016-01-11 12:06:21 +02:00
2f42246880 Rename query classifier functions consistently.
All public query classifier functions now have the prefix qc_.
2016-01-11 12:04:52 +02:00
cba190f84c Checks for temporary tables are only done if they have been created
Previously all queries were inspected for CREATE, DROP and SELECT statements
which targeted temporary tables even if they haven't been created.
2016-01-08 11:16:43 +02:00
b84e739cfa All queries related to prepared statement are sent to the master
The preparation and closing of prepared statements was sent to all servers
even though the execution was always sent to the master. With this change,
all queries which interact with prepared statements are only sent to the master.

The sending of statement preparations to all servers is a problem when a
statement which depends on a database or a table is created and the DDL
statement which created that table has not yet been replicated to the
slaves.

In addition to fixing the aforementioned problem, this change should also
reduce unnecessary network traffic to slaves and improve the overall
performance of the prepared statements.
2016-01-08 11:16:30 +02:00
d6afe70c6f Fix to MXS-323: Routers properly handle client DCB errors
All routers now detect if a client DCB is passed to handleError and
take the appropriate action.
2015-12-02 18:01:14 +02:00
02da87f737 Fix to MXS-439: Weightby value of 0 no longer causes a crash
A weightby parameter with a value of 0 no longer causes SIGFPE and the
invalid weight value is set to the correct value of 1.
2015-11-30 19:06:04 +02:00
8ae187622c Fixed weightby overflow being silently ignored in readwritesplit
If individual servers had a weightby parameter value greater than INT_MAX * 1000
the integer used for calculation would overflow and the server would end up
having a negative weight. This would cause all connections to pile up on this
server.

The same overflow was possible for the sum of all the weightby parameter values
even if no single parameter exceeded the limit.
2015-11-25 22:43:46 +02:00
038877b8db Fixed minor format errors and resource leaks
Some format strings used integer values for unsigned integers.
Memory and file descriptors leaked in some error conditions.
2015-11-25 12:43:49 +02:00
a8535f42af Remove all traces of logfile_t
The earlier log file based approach for enabling and disabling
messages has now been completely replaced with the syslog priority
based approach.

Similarly as with log files before it is now possible to enable
and disable a log priority for a particular session, even though
it apparently has not been used much.

The local test-programs of the logging has got minimal attention
only to make them compile. They should get an overhaul as they did
not work before either.
2015-11-23 19:10:53 +02:00
422d6f5ab2 Updated readwritesplit default values
The combination of only one slave being used and the slave_selection_criteria
being LEAST_CURRENT_OPERATIONS can possibly cause a connection pileup on one
slave server. This would skew the query distribution heavily towards the first
available slave even if multiple slave were being used.

Having the maximum number of slave servers to be equal to the total amount of
available slaves allows for a more even and responsive distribution of the
query traffic.
2015-11-20 05:57:51 +02:00
ee7793312b Broken error message fixed in readwritesplit.c
When converting the skygw_ logging calls to MXS_ equivalents,
some part of the error message got lost.
2015-11-18 20:51:11 +02:00
d59c6a3570 readwritesplit: skygw_log_writes replaced. 2015-11-18 12:28:40 +02:00
1de202ca20 LOGIF removed from readwritesplit 2015-11-17 12:51:08 +02:00
a355e1beef Printf format checking added to logging function.
Printf format checking added to logging function and all
issues that were revealed by that fixed.
2015-11-16 12:40:49 +02:00
30d1fc66b7 getCapabilities no longer takes arguments and returns an int. 2015-11-11 18:14:03 +02:00
dee20fe077 Merge remote-tracking branch 'origin/develop' into MXS-329-develop-20151111
# Conflicts:
#	server/core/CMakeLists.txt
#	server/core/buffer.c
#	server/core/service.c
#	server/modules/filter/tee.c
#	server/modules/monitor/mysql_mon.c
#	server/modules/routing/binlog/blr.c
#	server/modules/routing/binlog/blr_slave.c
#	server/modules/routing/debugcmd.c
#	server/modules/routing/readwritesplit/readwritesplit.c
#	utils/skygw_utils.cc

- resolved.
2015-11-11 11:08:02 +00:00
834a88aeda Log variables moved to log_manager.h
The log manager variables lm_enabled_log_files_bitmask, log_ses_count
and tls_log_info that earlier were declared separately in every
c-file are now declared in the log_manager.h header.
2015-11-04 14:26:53 +02:00
0accf869de Fix to MXS-365: https://mariadb.atlassian.net/browse/MXS-365 Added tracking of LOAD DATA LOCAL INFILE
While a LOAD DATA LOCAL INFILE query is being executed, all queries will be sent to the master
and they will not be processed as normal packets.
2015-11-04 12:47:55 +02:00
d6230e68ef Moved warnings about session command history limits to message log. 2015-11-04 09:12:37 +02:00
5112d4118f Fix to MXS-409: https://mariadb.atlassian.net/browse/MXS-409
Prepared statements are sent to the master instead of all servers.

The planned functionality to store the types of the prepared statements was not implemented
and all executions of prepared statements are sent to the master. Because of this the preparations
should be all sent to the master server instead of sending them to all servers.
2015-10-19 09:01:58 +03:00
e38ea9d07d Correct missing return value. 2015-10-02 16:19:59 +01:00
4f316419c5 Merge branch 'develop' into MXS-329 2015-09-30 12:47:28 +03:00
96f76a1f2e Changed the way max_sescmd_history works and combined disable_sescmd_history and disable_slave_recovery.
Before these changes when max_sescmd_history was used the session
was closed when the limit was exceeded. With this change, when the
limit is exceeded the recovery of slaves and the session command history
are both disabled. This will allow the sessions to continue while still
keeping the old functionality of limited salve replacement.

The disable_sescmd_history and disable_slave_recovery parameters were combined
so that disabling the session command history will also disable slave recovery.
This way no harm can be done with disable_sescmd_history.
2015-09-29 12:03:22 +03:00
db0e2e881f Double free prevented.
routeQuery calls route_single_stmt, which requires the GWBUF to be
contiguous. Earlier it was made contiguous (if needed) in
route_single_stmt. However, since the process of making a GWBUF
contiguous causes the original buffer to be freed, this would lead
to a double free later in routeQuery that frees the passed buffer.

This is prevented now by making the buffer contiguous before calling
route_single_stmt.
2015-09-29 10:57:45 +03:00
2231d0870c Place checks in callback routines because DCB will not always contain a reference to a router session, and the associated data will be invalid in this case. 2015-09-25 12:17:18 +01:00
2dfb9e3c11 Merge branch 'develop' into MXS-329 2015-09-24 17:59:36 +03:00
561891aac5 Fix for double free, possible fix for bug601.
In the end of execute_sescmd_in_backend the buffer was consumed
in case the protocol function failed. Or actually if it returned
something else but 1.

In the case of mysql_backend, the buffer is always freed when
authorizing and either consumed or placed on the dcb writequeue
when the data is written.

That is, it is never ok to consume the buffer in this function.
The end-result is likely to be an abort.
2015-09-21 13:45:15 +03:00
88716c35fb Various changes to block loopholes in different cases and tidy up. 2015-09-21 09:23:22 +01:00
31c6666278 Ensure DCB for closing session does not become persistent; remove bref_was_not_in_use. 2015-09-17 14:38:56 +01:00
dc3b0b067b Revert the dcb_close changes in handleError. 2015-09-17 13:35:18 +01:00
1ad8e27c91 Try a different arrangement of DCB closures in handleError of read-write split. 2015-09-17 13:27:25 +01:00
357c4bcae5 Add to or take from persistent pool only if server is running; add conditions to DCB close in read-write handleError to check backend reference was in use. 2015-09-17 12:53:59 +01:00
583c9b62fe Close DCB in handleError only if it can be found in a backend reference. 2015-09-17 11:58:19 +01:00
30239f395a Fix bref when backend server fails, error message if fails. 2015-09-15 20:07:56 +01:00
fdbe070e80 Change abort to error message when read connection router finds mismatch between router client session DCB and given backend DCB; improve order of actions when closing DCB in read-write router. 2015-09-15 15:22:44 +01:00
535523f9d7 Added an upper limit to trace log message length for queries. 2015-09-11 14:29:58 +03:00
cfeaf7d6e9 Merge remote-tracking branch 'origin/develop' into MXS-329
Conflicts:
	server/core/session.c
2015-09-10 13:07:27 +01:00
f6916a23bd Move responsibility for closing DCB on error to router error handling. Check that routers remove or disable links to closed DCB. 2015-09-09 09:33:00 +01:00
986c918d52 Remove ERRACT_RESET action from router error handler; remove sole call from mysql_client. Correct comments on parameters for router error handlers. 2015-09-09 08:31:59 +01:00
70a7a5f2f6 Fix to MXS-328: https://mariadb.atlassian.net/browse/MXS-328
Removed gwbuf_free when the write fails.
2015-08-27 09:16:00 +03:00
b3be72022c Fixed use_sql_variables_in=master not working. 2015-08-25 21:53:54 +03:00
37ac158791 Changes to try to eliminate setting dcb->session to NULL with risk of crashing system. 2015-08-24 12:12:43 +01:00
5adae0ff3b Added missing return value. 2015-08-23 20:46:16 +03:00
f014598d39 Added NULL checks. 2015-08-21 17:42:03 +03:00
3f26c306c5 Added more function parameter checks. 2015-08-18 22:19:26 +03:00
eac31b2618 Added master/slave percentage to readwritesplit diagnostic output. 2015-08-17 07:59:40 +03:00
a9e7eee718 Added missing spinlock calls to temporary table checks. 2015-08-14 20:43:01 +03:00
65bb80a3f1 Added more NULL checks to temporary table functions in readwritesplit. 2015-08-13 16:09:35 +03:00
100f8ebd66 Removed unnecessary memory allocation. 2015-08-03 20:02:13 +03:00
086160b82d Added missing initialization of value. 2015-07-23 18:06:12 +03:00