Refactor readwritesplit connection creation

The connections for a router session can now be done without a constructed
router session. This simplifies the creation of new router session by
removing the need to handle memory allocations.

Readwritesplit router sessions are now created in the static `create`
function which handles the actual creation of the connections and
allocation of the session itself.
This commit is contained in:
Markus Mäkelä
2017-08-17 08:18:16 +03:00
parent 46b7db1d45
commit ca4dbf5d0d
4 changed files with 108 additions and 87 deletions

View File

@ -101,12 +101,13 @@ enum connection_type
bool select_connect_backend_servers(int router_nservers,
int max_nslaves,
select_criteria_t select_criteria,
MXS_SESSION *session,
RWSplit *router,
RWSplitSession *rses,
const Config& config,
SRWBackendList& backends,
SRWBackend& current_master,
mxs::SessionCommandList* sescmd,
int* expected_responses,
connection_type type);
/*
* The following are implemented in rwsplit_tmp_table_multi.c
*/
@ -118,7 +119,7 @@ void check_create_tmp_table(RWSplitSession *router_cli_ses,
GWBUF *querybuf, uint32_t type);
bool check_for_multi_stmt(GWBUF *buf, void *protocol, uint8_t packet_type);
void close_all_connections(RWSplitSession* rses);
void close_all_connections(SRWBackendList& backends);
uint32_t determine_query_type(GWBUF *querybuf, int command);