1118 Commits

Author SHA1 Message Date
VilhoRaatikka
6d672cb967 Added status bit BREF_QUERY_ACTIVE to indicate if a query, other than session command, sent to backend for execution. The flag is cleared when the first packet belonging to the response arrives.
The flag is part of the active operation counting, which is utilized in load balancing. The active operation count per backend is used by default as criteria when router chooses to which backend a query should be routed.
2014-06-30 13:44:34 +03:00
VilhoRaatikka
3e3c1af211 Clean up 2014-06-30 13:43:25 +03:00
VilhoRaatikka
862d504a74 Enabled set and clear the flag BREF_WAITING_RESULT. It is actually a counter which is modified with atomic operations only. Setting and clearing BREF_WAITING_RESULT also includes atomic increment and decrement of corresponding backend server's current operations counter, backend_server->stats.n_current_ops. 2014-06-30 11:00:04 +03:00
VilhoRaatikka
fcf67716fd Added mechanism for choosing slave for a query based on the current load in all connected slaves. Counting operations is not correctly done here. Reading values and choosing accordingly is done.
Fixed several things in session command reply processing.
2014-06-29 22:21:30 +03:00
VilhoRaatikka
20637ee224 Removed unnecessary SERVER pointer from dcb.c:dcb_call_foreach(), changed declaration and call accordingly. 2014-06-27 10:54:11 +03:00
VilhoRaatikka
edf9f0c59c Listed and described shortly max_slave_connections and server_options=slave_selection_criteria parameters. 2014-06-27 10:50:56 +03:00
Vilho Raatikka
22827e7c8d Merge pull request #6 from skysql/MAX-99
Max 99
2014-06-25 18:06:22 +03:00
VilhoRaatikka
1d1da398d4 Merge branch 'develop' into MAX-99
Conflicts:
	server/modules/routing/readwritesplit/readwritesplit.c
2014-06-25 17:50:29 +03:00
VilhoRaatikka
dff18bf9bb Necessary checks and macros for prepared statement support implementation. 2014-06-25 17:37:37 +03:00
VilhoRaatikka
7ff14e23a5 Support for prepared statement, namely support for following comands : COM_STMT_PREPARE, COM_STMT_EXECUTE, COM_STMT_SEND_LONG_DATA, COM_STMT_RESET, COM_STMT_CLOSE, SQLCOM_PREPARE, SQLCOM_EXECUTE, SQLCOM_DEALLOCATE_PREPARE (DEALLOCATE/DROP PREPARE stmt).
All prepare commands are executed in every backend server currently connected.

All executes are routed to master. If stmt type was recorded in prepare phase in rwsplit router, read-only stmts could be routed to slaves.

COM_STMT_PREPARE gets arbitrary number of response packets from backend database. Since statements are prepared in every backend server and only one multi-packet response can be replied to client, redundant multi-packet responses are discarded. This is done in router. Mechanisms from session command handling are utilized with little changes: router must identify when response consists of multiple packets so that it knows to calculate the number of packets in response and that it is able to discard correct number of packets.

Information to the reply-handling router is provided by backend protocol, which includes a ordered list of commands of commands sent to protocol-owning backend server. A command is stored to protocol struct in mysql_backend.c:gw_MySQLWrite_backend if the statement buffer's type has GWBUF_TYPE_SINGLE_STMT set in mysql_client.c:route_by_statement. GWBUF_TYPE_SINGLE_STATEMENT indicates that there is single statement in the buffer, as opposite to Read Connection router, which accepts streaming input from client.
2014-06-25 17:15:46 +03:00
VilhoRaatikka
2d128de85f Replaced MySQL command macros with enumerated type. Each command has prefix 'MYSQL_' otherwise they match with those listed in mariadb-5.5 mysql_com.h.
Added server command list structure which is included in MySQLProtocol. It holds command and number of response packets the command causes backend server to send as a response. Added set of functions related to protocol command and response packets counting etc.
2014-06-25 15:48:55 +03:00
VilhoRaatikka
d30ff534b9 In dcb.c:dcb_read if there is nothing anymore to read from socket, it wasn't caught anyway. Added test for that case and immediate exit in that case. 2014-06-25 15:37:44 +03:00
Mark Riddoch
792ae454f4 Add support for #!../maxadmin scripts
Add the --help option

Add quoting for executing command with arguments that contain whitespace
2014-06-25 10:00:59 +01:00
Mark Riddoch
e0596b7d72 Merge branch 'develop' into MAX-65 2014-06-25 08:28:17 +01:00
VilhoRaatikka
65c42b93cf If backend fails and sets session state to SESSION_STATE_STOPPING before session is in state SESSION_STATE_ROUTER_READY, sessoin.c:session_alloc overwrites the session state by SESSION_STATE_ROUTER_READY. Protected session state modification and added check before changing the state.
cloesSession was called in session.c:session_free if all DCBs had been removed their references to session. closeSession, however, is function which handles closing router. Router is responsible for closing all backend DCBs (=connections). Thus, calling sessionClose after all backend connections had been removed already is unnecessary and causes assertion traps.

Simply removed the call.
2014-06-24 21:59:42 +03:00
VilhoRaatikka
c30e270768 Removed dcb->command from DCB structure as it was used for session commands but not anymore.
Corrected debug assertion in dcb_final_free because DCB can be freed also when DCB is being created, that is, state is DCB_STATE_ALLOC.
2014-06-24 21:56:15 +03:00
VilhoRaatikka
442ac7fefb Added GWBUF type GWBUF_TYPE_SINGLE_STMT to indicate that buffer only includes single complete stmt. Added macro for checking the flag and changed existing routines as necessary. 2014-06-24 21:51:54 +03:00
VilhoRaatikka
619aeb4afa Query classifier can keep parse tree after the function that created it returns. Parse tree can then be queried from outside. Added skygw_query_classifier_get_stmtname which returns the name of statement, and skygw_query_classifier_free which frees mysql handle, parse tree and thread context (thd). 2014-06-24 21:45:00 +03:00
Mark Riddoch
a652e875b5 Support for multipacket statements
Remove double free in cloned DCB's
2014-06-24 17:59:29 +01:00
Mark Riddoch
6bfa8897cd Fix compiler warning 2014-06-24 11:51:25 +01:00
Mark Riddoch
e650930487 Cleanup up branch session on close. 2014-06-23 10:10:04 +01:00
Mark Riddoch
7067e43b44 Core changes to support tee filter. 2014-06-20 17:49:40 +01:00
Mark Riddoch
e98b5d411e Addition of tee filter 2014-06-20 11:47:07 +01:00
Mark Riddoch
c759767a91 Use new session entry points to get remote and user rather than dereference
the DCB directly.
2014-06-19 16:07:21 +01:00
Mark Riddoch
058d553973 Addition of user and source to all filter
Bug fix in timestamp for topfilter
2014-06-19 14:02:41 +01:00
Mark Riddoch
11a85971f1 Merge branch 'develop' into MAX-65 2014-06-18 17:47:21 +01:00
Mark Riddoch
2e42c9170d Merge branch 'develop' of github.com:skysql/MaxScale into develop 2014-06-18 17:46:51 +01:00
Mark Riddoch
4d257897d3 Merge branch 'develop' of github.com:skysql/MaxScale into develop
Conflicts:
	server/core/session.c
	server/modules/protocol/mysql_backend.c
	server/modules/routing/readwritesplit/readwritesplit.c

Resolved.

Addition of user in topfilter report and general tidyup
2014-06-18 17:45:57 +01:00
Timofey Turenko
dc359f8e90 fix .spec 2014-06-18 18:51:50 +03:00
Timofey Turenko
e48f4ee8fe Require libedit-devel only for CentOS 6 2014-06-18 18:44:36 +03:00
Mark Riddoch
107500f40a Regex Filter Documentation 2014-06-18 15:28:09 +01:00
Mark Riddoch
3def4c1c73 Merge branch 'develop' into MAX-111 2014-06-18 12:30:00 +01:00
Mark Riddoch
421995af94 Disable use of libedit if it is not installed on the machine 2014-06-18 12:28:59 +01:00
MassimilianoPinto
b2d7d28b10 fix for slave set with mariadb 10 replication
fix for slave set with mariadb 10 replication
2014-06-18 11:46:29 +02:00
Timofey Turenko
188a91dab2 add build-depends on libedit-devel 2014-06-17 19:38:18 +03:00
Timofey Turenko
d0cae12ca5 fix build-depends in .spec 2014-06-17 17:41:29 +03:00
Timofey Turenko
62c5937ae1 fix build-depends in .spec 2014-06-17 17:18:40 +03:00
VilhoRaatikka
e7fa80a591 Code clean up 2014-06-17 16:15:19 +03:00
VilhoRaatikka
49163a4c43 Merge branch 'develop' into MAX-11 2014-06-16 19:53:19 +03:00
VilhoRaatikka
4f03c775e5 sescmd_cursor_reset didn't reset cursor's property pointer which made reset ineffective. 2014-06-16 13:40:45 +03:00
Mark Riddoch
189793f992 Clean up some compiler warnings 2014-06-16 08:40:04 +01:00
Mark Riddoch
9f6a1061c6 Config fix 2014-06-16 08:10:34 +01:00
Mark Riddoch
850603171b Improvements to CLI commands and client 2014-06-16 07:57:12 +01:00
Mark Riddoch
70ba1f028a Fixed bug in generation of execution time in report 2014-06-15 23:03:41 +01:00
VilhoRaatikka
0200ca4e24 Some things weren't switched off from product build. 2014-06-16 00:31:14 +03:00
VilhoRaatikka
5bcae64538 When protocol closes DCB it calls dcb_close instead of dcb->func.close. dcb_close then calls dcb->func.close. This is now changed to all protocols and routers.
Rwsplit handles ERRACT_NEW_CONNECTION by clearing backend reference, removing callbacks and associating backend reference with new backend server. If it succeeds and the router session can continue, handleError returns true. Otherwise false. When ever false is returned it means that session must be closed.

Rwsplit now tolerates backend failures in a way that it searches new backends when monitor, backend, or client operation fails due to backend failure.
2014-06-15 23:44:07 +03:00
Mark Riddoch
8103ac6052 Merge branch 'develop' into MAX-65 2014-06-14 12:54:08 +01:00
Mark Riddoch
c2fa112407 Remove .swp file which was added by mistake 2014-06-13 23:42:21 +01:00
Mark Riddoch
719503e471 Addition of new client utility, maxadmin.
Supporting protocol for the admin interface

New routing module, cli, which shares source with debugcli

Tidyup output of lsit commands
2014-06-13 23:40:07 +01:00
VilhoRaatikka
09d20d1059 Modified dcb_call_foreach so that it doesn't hold spinlock (dcbspin) continuously because it caused deadlock when new slaves were tried to connect with.
Fixed a few smallish things.
2014-06-13 14:52:04 +03:00