387 Commits

Author SHA1 Message Date
Markus Makela
c47d2f3791 Added session timeouts.
The parameter 'connection_timeout' for services takes a value as seconds.
All sessions that have been idle for longer than this will be disconnected.
2015-02-20 22:16:43 +02:00
Markus Makela
fc969acc73 Added optional stripping of escape characters from database names when laoding users. 2015-02-20 21:07:12 +02:00
Mark Riddoch
a022775342 Addition of show eventtimes and /events/times URL to maxinfo 2015-02-20 11:53:47 +00:00
Mark Riddoch
8eb14235d1 Addition of DCB and Poll statistics in show status output 2015-02-20 10:05:50 +00:00
Markus Makela
ea55572ab8 Merge branch 'develop' into MAX-324 2015-02-20 04:45:48 +02:00
markus456
c2cd3f4c3d Merge pull request #73 from tanji/serversjson
Output server list in JSON format
2015-02-19 16:56:02 +02:00
Mark Riddoch
11e65f02f0 Addition of maxinfo show modules and show monitors commands 2015-02-19 13:32:48 +00:00
Mark Riddoch
2f218cba3a Addition of maxinfo commands
show sessions
	show clients
	show listeners
	show services
	show servers
2015-02-19 12:55:39 +00:00
Mark Riddoch
3898a995ad Addition of show services command 2015-02-19 11:07:24 +00:00
Mark Riddoch
e0e5652f5e Fixed bug in resultset_make_row
Addition of resultset_stream_json
2015-02-19 11:06:31 +00:00
Guillaume Lefranc
72eb89a787 Add forgotten include of JSON function 2015-02-19 11:22:17 +01:00
Mark Riddoch
8e941f7523 Addition of the MaxInfo filter and the generic MaxScale resultset 2015-02-18 17:25:13 +00:00
Markus Makela
65e2572ad0 Made config_truth_value non-static. 2015-02-18 13:16:06 +02:00
Markus Makela
03456b931b Added "yes" and "no" to the config truth value check and added the function to the header. 2015-02-18 11:45:01 +02:00
Markus Makela
da029140cd dcb_call_foreach now only calls the callbacks for those DCBs that are connected to the server. 2015-02-18 05:36:39 +02:00
Markus Makela
46ec9abe29 Added optional parameters for services that allow all servers to be used when building the list of users. 2015-02-09 07:19:13 +02:00
Markus Makela
0d4761ade8 Merge branch 'develop' into MAX-324 2015-02-06 23:27:59 +02:00
Mark Riddoch
d4f5ca6bcb Merge branch 'blr' into develop
Addition of hashtable load and save. Caching of auth information
2015-02-06 11:52:51 +00:00
Mark Riddoch
bc0d303b27 Add saving of hashtables to a file
Cache the user information to file in order to allow authentication without backend databases
2015-02-06 11:44:29 +00:00
MassimilianoPinto
98cbc34c6c Fix for bug #714
Fix for bug #714
2015-02-06 11:26:48 +01:00
Markus Makela
86bed0541c Merge branch 'develop' into MAX-324 2015-02-04 13:01:43 +02:00
Mark Riddoch
0083e62c41 Merge branch 'blr' into develop 2015-02-03 17:19:06 +00:00
Mark Riddoch
0a9509168b Addition of cache for server responses. This allows cached responses to be sent
if there is no master avaiable when MaxScale starts
2015-01-28 08:44:13 +00:00
Markus Makela
db1ea422a0 Merge branch 'develop' into MAX-324
Conflicts:
	server/core/modutil.c
2015-01-20 04:25:40 +02:00
VilhoRaatikka
fca674b16a modutil.c: added modutil_reply_auth_error
mysql_backend.c:gw_change_user: instead of setting flags directly to replybuffer, set server command to backend's protocol object and reply the message directly to backend where flags are set and it is replied back to client.
2015-01-19 00:01:08 +02:00
VilhoRaatikka
f5d8e2366a modutil.c:modutil_reply_routing_error: Removed GWBUF type flag setting and added flags argument to function prototype so that the caller can set necessary flags and they are then copied to GWBUF which is first created in modutil_reply_rounting_error. 2015-01-17 23:07:06 +02:00
VilhoRaatikka
6d2b38d4b6 Complementary fix to #694,http://bugs.mariadb.com/show_bug.cgi?id=694
RWSplit router handles query processing errors that happened in router by sending parse error reply to client. routeQuery fails only when backend has failed.
2015-01-17 22:40:52 +02:00
VilhoRaatikka
da77da803b Complementory fix to bug #694, http://bugs.mariadb.com/show_bug.cgi?id=694
Added new error action to router.h, added functionality to reset error flag from DCB in handleError. Error is reset before every new routing call.
2015-01-16 11:13:42 +02:00
Markus Makela
f54d4a76aa Final implementation of client session based sharding. 2015-01-15 20:24:01 +02:00
Markus Makela
88a26f03ab Fix to bug 685: http://bugs.mariadb.com/show_bug.cgi?id=685
Added the missing detection of partial packets in the buffers.
2015-01-15 13:13:09 +02:00
Markus Makela
7f4675cd57 Fix to bug 685: http://bugs.mariadb.com/show_bug.cgi?id=685
Added the missing ERR packet detection to modutil functions.
2015-01-13 21:32:04 +02:00
Markus Makela
d194af0733 Moved result set processing functions to modutil.c from tee.c. 2015-01-13 09:45:58 +02:00
Markus Makela
cd99849581 Fix #2 to bug 680: http://bugs.mariadb.com/show_bug.cgi?id=680"
When no users are loaded from backends, instead of counting it as a failure the service is started and the next time a client connects an attempt to load the users from the backends is made.
2015-01-05 17:38:45 +02:00
Markus Makela
6adccb3c17 Fix to bug 680: http://bugs.mariadb.com/show_bug.cgi?id=680
service.h:Added the 'serviceStartFailed' function which tries to start services with successfully started routers but no successfully started listeners.
mysql_mon.c:Added a call to ServiceStartFailed when servers come available.
2015-01-05 13:38:39 +02:00
Markus Makela
b3d79f7273 Merge branch 'release-1.0GA' into bug_679_fix 2015-01-02 20:57:28 +02:00
Markus Makela
95cd0b93cb Fix to bug 679: http://bugs.mariadb.com/show_bug.cgi?id=679
Added server references to services instead of using a raw pointers to server instances.
Changed all references to service->database to service->dbref.
2015-01-02 20:55:38 +02:00
VilhoRaatikka
6228be4284 Fix to bug #678, http://bugs.skysql.com/show_bug.cgi?id=678
tee.c:routeQuery cloned partial MySQL packets to be routed to child router. Problems were due to the use of gwbuf_clone and modutil_MySQL_query which clone/examine only the first buffer from the buffer list which composes GWBUF.
modutil.c: Added function modutil_MySQL_query_len which calculates MySQL packet length and the missing bytecount
2015-01-02 18:32:57 +02:00
Markus Makela
e6607dca40 tee.c:
Added clientReply and setUpstream entry points
    Tee filter now waits for the branch session to be replied to and if the reply isn't received in five seconds it closes the branch session.
dcb.h:
    Added the DCBF_REPLIED flag that is currently only set in dcb_null_write
dcb.c:
    The DCBF_REPLIED flag is now set in dcb_null_write
2014-12-30 17:40:47 +02:00
VilhoRaatikka
beacd524da Fix to bug #662, http://bugs.mariadb.com/show_bug.cgi?id=662
dbusers.c: Added function for setting read, write and connection timeout values. Set default timeouts for getUsers. Defaults are listed in service.c
gateway.c:shutdown_server is called whenever MaxScale is to be shut down. Added call for service_shutdown to shutdown_server.
service.c:service_alloc: replaced malloc with calloc and removed unnecessary zero/NULL initialization statements as a consequence.
	serviceStart: Exit serviceStartPort loop if shutdown flag is set for the service.
	serviceStartAll: Exit serviceStart loop if shutdown flag is set for the service.
service.c: Added service_shutdown which sets shutdown flag for each service found in allServices list.
service.h: Added prototype for service_shutdown
2014-12-29 13:45:24 +02:00
VilhoRaatikka
f0d8ed0cf2 Fix to #657, http://bugs.mariadb.com/show_bug.cgi?id=657
session.c:session_free:if session is child of another service (tee in this case), it is the parent which releases child's allocated memory back to the system. This now also includes the child router session.
dcb.h: Added DCB_IS_CLONE macro
tee.c:freeSession:if parent session triggered closing of tee, then child session may not be closed yet. In that case free the child session first and only then free child router session and release child session's memory back to system.
tee.c:routeQuery: only route if child session is ready for routing. Log if session is not ready for routing and set tee session inactive
mysql_client.c:gw_client_close:if DCB is cloned one don't close the protocol because they it is shared with the original DCB.
2014-12-23 00:26:57 +02:00
VilhoRaatikka
6b6ac2f95f Partial fix to bug #657, http://bugs.mariadb.com/show_bug.cgi?id=657
dcb.c:dcb_clone: set same close function than in the original DCB so that routing session will become closed when client DCB is closed.
session.h:introduce a new state which indicates that SESSION structure can be freed next, SESSION_STATE_TO_BE_FREED. State is needed to separate the state before and after memory free. Memory is freed in different situation depending on whether the session is parent or child session. Child sessions are freed in their parent.
Also introduce a new member in SESSION struct, ses_is_child, to indicate whether SESSION has a parent session which is responsible for releasing the memory of it.

session.c:session_unlink_dcb:when last session reference is removed set SESSION->state=SESSION_STATE_TO_BE_FREED
session.c:session_free:only free the memory if session is not child session. If it is child, session is left to be freed by the parent (in tee filter's freeSession, for example).

tee.c:newSession:mark branch session to child.
tee.c:freeSession:if child session memory is ready to be freed, free it.

mysql_mon.c:monitorMain:when backend server's status changes so that it is not running anymore or doesn't have any of the states - master, slave, ndb, joined - call for each DCB the callback-function DCB_REASON_NOT_RESPONDING if specified. Earlier callbacks were called if there was any change in the state of the server being monitored.
2014-12-22 16:24:07 +02:00
VilhoRaatikka
ac97fcd764 Removed redundancy from error and message logs.
server.c: Added new member to SERVER->master_err_is_logged. It is used if server loses master status. It causes error log print in readwritesplit router's eror handling. Initial value is false and it is set always to false when server's status is set to master.
Added message log printing to mysql monitor, if master status changes to something else. It is not warning or error but only information which probably interests the user.

readwritesplit.c:Muted warnings and error printings in cases if slaves are not found if it is allowed to have a master only.
readwritesplit.c:Corrected error log printing in case where master lost its status. REdundant prints are removed.
2014-12-18 19:12:01 +02:00
Mark Riddoch
a655e394ac Merge branch 'blr' into release-1.0GA
Conflicts:
	server/core/service.c
2014-12-16 15:44:19 +00:00
VilhoRaatikka
a4968f2521 Complete fix candidate for #645, http://bugs.skysql.com/show_bug.cgi?id=645 and #648, http://bugs.skysql.com/show_bug.cgi?id=648
tee.c:closeSession removed unnecessary dcb_free, router/service closes all backend DCBs and the client DCB, and client DCB is the one that was tried to free in closeSession.
readwritesplit.c:routeQuery now handles untyped and typed GWBUFs. Untyped means that read buffer may consist of incomplete and multiple MySQL packets. Typed buffer always consists of a single MySQL packet (which can be split to many buffers inside GWBUF).
Fixed Coverity cases #84840 and #84841
2014-12-14 11:26:15 +02:00
VilhoRaatikka
c31f971999 Fix candidate for #645, http://bugs.skysql.com/show_bug.cgi?id=645 and #648, http://bugs.skysql.com/show_bug.cgi?id=648
If readwritesplit.c:routeQuery gets a GWBUF whose type is UNDEFINED, then each MySQL packet is extracted from input buffer and passed to new function, route_single_stmt. Each extracted packet is stored in separate GWBUF and added types GWBUF_TYPE_MYSQL and GWBUG_TYPE_SINGLE_STMT which makes it possible to execute session commands and process reply packets properly.

Code nedes still cleaning but this is for testing atm.
2014-12-13 01:55:40 +02:00
Mark Riddoch
26e3486966 Fix for router instance creation failure 2014-12-09 09:54:04 +00:00
Mark Riddoch
43ed77b52b Bug 515 Conditional arguemnt to gw_write 2014-11-19 16:43:21 +00:00
Mark Riddoch
d3c8770852 Merge branch 'blr' into develop
Conflicts:
	client/maxadmin.c
	server/core/CMakeLists.txt
	server/core/dcb.c
	server/core/gateway.c
	server/core/poll.c
	server/core/test/CMakeLists.txt
	server/core/test/makefile
	server/include/poll.h
	server/modules/routing/debugcmd.c
2014-11-19 12:00:55 +00:00
Markus Makela
2556097a98 Added commands to debugcmd.c that enable and disable logs for a single session.
Added the session id to dprintAllSessions and dprintSession output.
2014-11-19 12:25:33 +02:00
VilhoRaatikka
fd11e6a7f5 Session-specific logging. Added functions
void session_enable_log(SESSION* ses, logfile_id_t id)
and
void session_disable_log(SESSION* ses, logfile_id_t id)

Which switch specific log type on/off if the log type in question is not generally enabled.

Each thread carries a thread-specific struct log_info_t which includes members for current session id and bitfield for enabled log types for the current session. That information is checked before actual log write functions are called.

Each file where session-specific logging is used, must include the following exports:

/** Defined in log_manager.cc */
extern int            lm_enabled_logfiles_bitmask;
extern size_t         log_ses_count[];
extern __thread log_info_t tls_log_info;
2014-11-19 00:08:59 +02:00