520 Commits

Author SHA1 Message Date
vraatikka
17ec98fa3d session was assigned state SESSION_STATE_READY outside protected block, and backend dcb thread saw authentication data and session in SESSION_STATE_ALLOC state, which trapped. Moved state assignment inside protection block. 2013-09-05 19:47:42 +03:00
vraatikka
4f8057034a Protected temporarily with spinlock gethostbyname which is not thread safe. This should be changed permanently so that gethostbyname is replaced with getaddrinfo. 2013-09-05 19:42:59 +03:00
Massimiliano Pinto
8f98ae4751 Removed old mysql protocol files 2013-09-04 15:53:51 +02:00
Massimiliano Pinto
6888735f7b Removed old gateway_mysql_protocol.c
server/core/Makefile updtated
2013-09-04 15:41:08 +02:00
Massimiliano Pinto
b01cf2365e Added log error or ss_dassert instead of silent returning 2013-09-04 15:31:04 +02:00
Mark Riddoch
5c48239372 Fixed doxygen documentation generation 2013-09-04 13:13:54 +02:00
Mark Riddoch
f74f67540f Added spinlock protection for the session association to the DCB and
reworked the reference count mechanism on the session.  Introduced a
FREE state for the session and alter the session destruction flow so
that we only remove the session when all the DCB's have singled they
have finished processing events for the DCB rather than when the first
thread decides to clsoe the DCB.
2013-09-04 12:24:59 +02:00
Massimiliano Pinto
8debc4433c Added a client NULL check in clientReply 2013-09-04 11:37:56 +02:00
Massimiliano Pinto
be27d36f8c Added dcb NULL check in mysql_send_custom_error() 2013-09-04 11:26:14 +02:00
Massimiliano Pinto
61df7eb07d Added checks against NULL in gw_read_backend_event for dcb->session and dcb->session->client 2013-09-04 10:57:08 +02:00
Massimiliano Pinto
db164be946 Added spinlock protection for refcount increase in dcb_connect 2013-09-04 10:00:40 +02:00
Massimiliano Pinto
8e97974216 Fixed return rc after:
routeQuery()
(dcb->func).close(dcb);

This will prevent setting again dcb->sate = DCB_STATE_POLLING in return_rc label.

The log entry for 

[gw_read_client_event] ioctl FIONREAD for fd 21 failed. errno 9, Bad file descriptor. dcb->state = 3

now is not present anymore.
2013-09-03 14:42:47 +02:00
vraatikka
a605b8fd9b Removed unused macros. 2013-09-02 22:21:28 +03:00
vraatikka
3d5c40e450 Removed unused macros. Fixed struct member order so that check field is again the last in struct and it detects memory overflows slightly better. 2013-09-02 21:54:24 +03:00
vraatikka
366441a4bb Added debug assert for checking return value of memory allocation. 2013-09-02 21:53:49 +03:00
vraatikka
c4ce2efd9f Added debug assert for DCB states prior processing. 2013-09-02 21:52:57 +03:00
vraatikka
5487f84532 Added logging to session refcount increment. Some minor improvements. 2013-09-02 21:52:09 +03:00
Massimiliano Pinto
f80bb51db1 dcb_close sets some session fields to NULL:
dcb->session->client = NULL;

dcb->session = NULL;

There is a local copy of dcb->seesion before setting it to NULL
2013-09-02 19:33:55 +02:00
Massimiliano Pinto
31cda5ad65 Added session refcount in session.h
The refcount is incremented in dcb_connect and in mysql_client.c after session_alloc
2013-09-02 10:26:34 +02:00
vraatikka
b86d3f3dfd Holding error log's block buffer registration until all logs were written caused deadlock if block buffers were full. Now buffer registrations don't overlap. 2013-09-02 10:30:50 +03:00
vraatikka
ce0085a078 Clean up. 2013-09-01 00:37:49 +03:00
vraatikka
757a043386 Replaced oinlined protocol creation with call to mysql_protocol_init. Clean up. 2013-09-01 00:36:31 +03:00
vraatikka
9df2040a8a Removed unused variables, changed call to mysql_protocol_init to reflect new prototype. 2013-09-01 00:32:57 +03:00
vraatikka
88ffcaa3d4 Removed 'extern' keyword from function declaration in headers. Functions are 'extern' by default.
Changed mysql_protocol_init prototype and implementation to return MySQLProtocol pointer instead of boolean.
2013-09-01 00:30:46 +03:00
vraatikka
9bf0f58526 introduce mysql_protocol_init. 2013-08-31 23:54:35 +03:00
vraatikka
3dff91e80f In gw_create_backend_connection, replaced inlined protocol init with call to mysql_protocol_init (mysql_common.c). Replaced fprintfs with logging commands. 2013-08-31 23:51:54 +03:00
vraatikka
c23168ed71 gw_do_connect_to_backend returned zero in case where connect failed with errno EINPROGRESS. Should have returned 1 to indicate that connection will be established asynchronously.
In the same case, checking for error by using getsockopt should be done when select returns, not after connect (man 2 connect).
2013-08-31 23:45:40 +03:00
vraatikka
9d6b13c288 Replaced macros with enumereted type. 2013-08-31 12:04:02 +03:00
Mark Riddoch
a445b6ff37 Fixes for NULL test for function returns such as malloc() - as reported by Coverity 2013-08-29 13:34:21 +02:00
Mark Riddoch
03725cabe3 Fixed compile issue in dcb.h 2013-08-29 13:17:19 +02:00
vraatikka
94a8ad68d3 Checked for bug #178. Added error logs to suitabl places. 2013-08-29 09:50:16 +03:00
vraatikka
527df6c7f3 Merge, mostly. 2013-08-28 23:26:09 +03:00
vraatikka
48165bf5cd Removed unused protocol_mutex and references to it. 2013-08-28 23:25:27 +03:00
vraatikka
134c33776e Added consistency check fields, and switched macros to enumerated types. 2013-08-28 23:23:05 +03:00
vraatikka
50a3cfdf49 Commented out some dead code. 2013-08-28 23:17:18 +03:00
vraatikka
ae9fce8591 Added write and read lock to DCB to protect concurrent threads fro executing EPOLLIN and EPOLLOUT events on same descriptor, respectively. Added consistency checks and trace logging. 2013-08-28 23:09:37 +03:00
vraatikka
f2f119f692 Removed some dead code 2013-08-28 23:08:51 +03:00
vraatikka
9a8e271417 client->data is copied to session->data already in session_alloc to ensure that authentication information is set when background connection is started to establish in concurrent thread. 2013-08-28 23:06:09 +03:00
vraatikka
786468fc5d Added status checks, removed some dead code, changed macros to enumerated types, renamed variables to reflect better what they mean. 2013-08-28 22:59:53 +03:00
vraatikka
8c8475740a Switched to booleans defined in stdbool.h 2013-08-28 22:49:27 +03:00
vraatikka
34b26ad85f Changed enum-type boolean to whta is defined in stdbool.h, and in practise replaced TRUEs and FALSEs with true, and false, respectively. 2013-08-28 22:47:14 +03:00
Massimiliano Pinto
ff109c6319 dcb->state set wheere missing or changed 2013-08-27 10:52:43 +02:00
Massimiliano Pinto
d0d68a69ca Added DCB_STATE_XXX in EPOLLIN/EPOLLOUT handlers and in accept() 2013-08-27 10:08:03 +02:00
vraatikka
49036894f5 In gw_connect_to_backend, first create socket, and establish socket connection, then in the end, dcb is added to epoll set. 2013-08-24 00:18:46 +03:00
vraatikka
df5f2f29b2 Removed undefined function declaration. Added trace and error log. 2013-08-23 23:25:12 +03:00
vraatikka
e345b23bcf Merge 2013-08-23 22:47:16 +03:00
vraatikka
6f0ccd7b42 Added static simple_mutex_t epoll_wait_mutex, which is acquired and released in poll_waitevents. 2013-08-23 22:45:06 +03:00
vraatikka
0a182913a1 in gw_MySQLAccept moved authentication packet send before adding new dcb to epoll set. 2013-08-23 22:39:42 +03:00
vraatikka
0612dae890 Added error log printing. 2013-08-23 22:31:08 +03:00
vraatikka
17975a1252 Fixed indentation. 2013-08-23 22:29:31 +03:00