Rename readwritesplit router session class
Renamed the struct to RWSplitSession and removed the obsole next pointer.
This commit is contained in:
@ -53,14 +53,14 @@ static int routeQuery(MXS_ROUTER *instance, MXS_ROUTER_SESSION *session, GWBUF *
|
||||
|
||||
static bool rwsplit_process_router_options(RWSplit *router,
|
||||
char **options);
|
||||
static void handle_error_reply_client(MXS_SESSION *ses, ROUTER_CLIENT_SES *rses,
|
||||
static void handle_error_reply_client(MXS_SESSION *ses, RWSplitSession *rses,
|
||||
DCB *backend_dcb, GWBUF *errmsg);
|
||||
static bool handle_error_new_connection(RWSplit *inst,
|
||||
ROUTER_CLIENT_SES **rses,
|
||||
RWSplitSession **rses,
|
||||
DCB *backend_dcb, GWBUF *errmsg);
|
||||
static bool have_enough_servers(ROUTER_CLIENT_SES *rses, const int min_nsrv,
|
||||
static bool have_enough_servers(RWSplitSession *rses, const int min_nsrv,
|
||||
int router_nsrv, RWSplit *router);
|
||||
static bool route_stored_query(ROUTER_CLIENT_SES *rses);
|
||||
static bool route_stored_query(RWSplitSession *rses);
|
||||
|
||||
/**
|
||||
* Internal functions
|
||||
@ -76,7 +76,7 @@ static bool route_stored_query(ROUTER_CLIENT_SES *rses);
|
||||
* @param rses Router client session
|
||||
* @param router_nservers The number of backend servers in total
|
||||
*/
|
||||
int rses_get_max_slavecount(ROUTER_CLIENT_SES *rses)
|
||||
int rses_get_max_slavecount(RWSplitSession *rses)
|
||||
{
|
||||
int conf_max_nslaves;
|
||||
int router_nservers = rses->rses_nbackends;
|
||||
@ -101,7 +101,7 @@ int rses_get_max_slavecount(ROUTER_CLIENT_SES *rses)
|
||||
* @param rses Router client session
|
||||
* @return Replication lag from configuration or very large number
|
||||
*/
|
||||
int rses_get_max_replication_lag(ROUTER_CLIENT_SES *rses)
|
||||
int rses_get_max_replication_lag(RWSplitSession *rses)
|
||||
{
|
||||
int conf_max_rlag;
|
||||
|
||||
@ -131,7 +131,7 @@ int rses_get_max_replication_lag(ROUTER_CLIENT_SES *rses)
|
||||
*
|
||||
* @return backend reference pointer if succeed or NULL
|
||||
*/
|
||||
SRWBackend get_backend_from_dcb(ROUTER_CLIENT_SES *rses, DCB *dcb)
|
||||
SRWBackend get_backend_from_dcb(RWSplitSession *rses, DCB *dcb)
|
||||
{
|
||||
ss_dassert(dcb->dcb_role == DCB_ROLE_BACKEND_HANDLER);
|
||||
CHK_DCB(dcb);
|
||||
@ -294,7 +294,7 @@ static bool handle_max_slaves(Config& config, const char *str)
|
||||
* @param backend_dcb DCB for the backend server that has failed
|
||||
* @param errmsg GWBUF containing the error message
|
||||
*/
|
||||
static void handle_error_reply_client(MXS_SESSION *ses, ROUTER_CLIENT_SES *rses,
|
||||
static void handle_error_reply_client(MXS_SESSION *ses, RWSplitSession *rses,
|
||||
DCB *backend_dcb, GWBUF *errmsg)
|
||||
{
|
||||
|
||||
@ -312,7 +312,7 @@ static void handle_error_reply_client(MXS_SESSION *ses, ROUTER_CLIENT_SES *rses,
|
||||
}
|
||||
}
|
||||
|
||||
static bool reroute_stored_statement(ROUTER_CLIENT_SES *rses, const SRWBackend& old, GWBUF *stored)
|
||||
static bool reroute_stored_statement(RWSplitSession *rses, const SRWBackend& old, GWBUF *stored)
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
@ -382,10 +382,10 @@ static bool reroute_stored_statement(ROUTER_CLIENT_SES *rses, const SRWBackend&
|
||||
* not
|
||||
*/
|
||||
static bool handle_error_new_connection(RWSplit *inst,
|
||||
ROUTER_CLIENT_SES **rses,
|
||||
RWSplitSession **rses,
|
||||
DCB *backend_dcb, GWBUF *errmsg)
|
||||
{
|
||||
ROUTER_CLIENT_SES *myrses = *rses;
|
||||
RWSplitSession *myrses = *rses;
|
||||
SRWBackend backend = get_backend_from_dcb(myrses, backend_dcb);
|
||||
|
||||
MXS_SESSION* ses = backend_dcb->session;
|
||||
@ -469,7 +469,7 @@ static bool handle_error_new_connection(RWSplit *inst,
|
||||
*
|
||||
* @return bool - whether enough, side effect is error logging
|
||||
*/
|
||||
static bool have_enough_servers(ROUTER_CLIENT_SES *rses, const int min_nsrv,
|
||||
static bool have_enough_servers(RWSplitSession *rses, const int min_nsrv,
|
||||
int router_nsrv, RWSplit *router)
|
||||
{
|
||||
bool succp = true;
|
||||
@ -527,7 +527,7 @@ static bool have_enough_servers(ROUTER_CLIENT_SES *rses, const int min_nsrv,
|
||||
* @param rses Router client session
|
||||
* @return True if a stored query was routed successfully
|
||||
*/
|
||||
static bool route_stored_query(ROUTER_CLIENT_SES *rses)
|
||||
static bool route_stored_query(RWSplitSession *rses)
|
||||
{
|
||||
bool rval = true;
|
||||
|
||||
@ -636,7 +636,7 @@ bool reply_is_complete(SRWBackend backend, GWBUF *buffer)
|
||||
return backend->get_reply_state() == REPLY_STATE_DONE;
|
||||
}
|
||||
|
||||
void close_all_connections(ROUTER_CLIENT_SES* rses)
|
||||
void close_all_connections(RWSplitSession* rses)
|
||||
{
|
||||
for (SRWBackendList::iterator it = rses->backends.begin();
|
||||
it != rses->backends.end(); it++)
|
||||
@ -675,7 +675,7 @@ Stats& RWSplit::stats()
|
||||
return m_stats;
|
||||
}
|
||||
|
||||
ROUTER_CLIENT_SES::ROUTER_CLIENT_SES(const Config& config):
|
||||
RWSplitSession::RWSplitSession(const Config& config):
|
||||
rses_config(config)
|
||||
{
|
||||
}
|
||||
@ -737,7 +737,7 @@ static MXS_ROUTER *createInstance(SERVICE *service, char **options)
|
||||
static MXS_ROUTER_SESSION *newSession(MXS_ROUTER *router_inst, MXS_SESSION *session)
|
||||
{
|
||||
RWSplit* router = (RWSplit*)router_inst;
|
||||
ROUTER_CLIENT_SES* client_rses = new (std::nothrow) ROUTER_CLIENT_SES(router->config());
|
||||
RWSplitSession* client_rses = new (std::nothrow) RWSplitSession(router->config());
|
||||
|
||||
if (client_rses == NULL)
|
||||
{
|
||||
@ -821,7 +821,7 @@ static MXS_ROUTER_SESSION *newSession(MXS_ROUTER *router_inst, MXS_SESSION *sess
|
||||
*/
|
||||
static void closeSession(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session)
|
||||
{
|
||||
ROUTER_CLIENT_SES *router_cli_ses = (ROUTER_CLIENT_SES *)router_session;
|
||||
RWSplitSession *router_cli_ses = (RWSplitSession *)router_session;
|
||||
CHK_CLIENT_RSES(router_cli_ses);
|
||||
|
||||
if (!router_cli_ses->rses_closed)
|
||||
@ -863,7 +863,7 @@ static void closeSession(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_sessio
|
||||
*/
|
||||
static void freeSession(MXS_ROUTER *router_instance, MXS_ROUTER_SESSION *router_client_session)
|
||||
{
|
||||
ROUTER_CLIENT_SES *router_cli_ses = (ROUTER_CLIENT_SES *)router_client_session;
|
||||
RWSplitSession *router_cli_ses = (RWSplitSession *)router_client_session;
|
||||
delete router_cli_ses;
|
||||
}
|
||||
|
||||
@ -883,7 +883,7 @@ static void freeSession(MXS_ROUTER *router_instance, MXS_ROUTER_SESSION *router_
|
||||
static int routeQuery(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session, GWBUF *querybuf)
|
||||
{
|
||||
RWSplit *inst = (RWSplit *) instance;
|
||||
ROUTER_CLIENT_SES *rses = (ROUTER_CLIENT_SES *) router_session;
|
||||
RWSplitSession *rses = (RWSplitSession *) router_session;
|
||||
int rval = 0;
|
||||
|
||||
CHK_CLIENT_RSES(rses);
|
||||
@ -1071,7 +1071,7 @@ static void clientReply(MXS_ROUTER *instance,
|
||||
GWBUF *writebuf,
|
||||
DCB *backend_dcb)
|
||||
{
|
||||
ROUTER_CLIENT_SES *router_cli_ses = (ROUTER_CLIENT_SES *)router_session;
|
||||
RWSplitSession *router_cli_ses = (RWSplitSession *)router_session;
|
||||
RWSplit *router_inst = (RWSplit *)instance;
|
||||
DCB *client_dcb = backend_dcb->session->client_dcb;
|
||||
|
||||
@ -1226,7 +1226,7 @@ static void handleError(MXS_ROUTER *instance,
|
||||
{
|
||||
ss_dassert(problem_dcb->dcb_role == DCB_ROLE_BACKEND_HANDLER);
|
||||
RWSplit *inst = (RWSplit *)instance;
|
||||
ROUTER_CLIENT_SES *rses = (ROUTER_CLIENT_SES *)router_session;
|
||||
RWSplitSession *rses = (RWSplitSession *)router_session;
|
||||
CHK_CLIENT_RSES(rses);
|
||||
CHK_DCB(problem_dcb);
|
||||
|
||||
|
@ -440,37 +440,41 @@ typedef std::map<uint64_t, uint8_t> ResponseMap;
|
||||
typedef std::tr1::unordered_map<uint32_t, SRWBackend> ExecMap;
|
||||
|
||||
/**
|
||||
* The client session structure used within this router.
|
||||
* The client session of a RWSplit instance
|
||||
*/
|
||||
struct ROUTER_CLIENT_SES
|
||||
class RWSplitSession
|
||||
{
|
||||
ROUTER_CLIENT_SES(const Config& config);
|
||||
RWSplitSession(const RWSplitSession&);
|
||||
RWSplitSession& operator=(const RWSplitSession&);
|
||||
|
||||
skygw_chk_t rses_chk_top;
|
||||
bool rses_closed; /**< true when closeSession is called */
|
||||
SRWBackendList backends; /**< List of backend servers */
|
||||
SRWBackend current_master; /**< Current master server */
|
||||
SRWBackend target_node; /**< The currently locked target node */
|
||||
Config rses_config; /**< copied config info from router instance */
|
||||
int rses_nbackends;
|
||||
enum ld_state load_data_state; /**< Current load data state */
|
||||
bool have_tmp_tables;
|
||||
uint64_t rses_load_data_sent; /**< How much data has been sent */
|
||||
DCB* client_dcb;
|
||||
uint64_t sescmd_count;
|
||||
int expected_responses; /**< Number of expected responses to the current query */
|
||||
GWBUF* query_queue; /**< Queued commands waiting to be executed */
|
||||
class RWSplit *router; /**< The router instance */
|
||||
struct ROUTER_CLIENT_SES *next;
|
||||
TableSet temp_tables; /**< Set of temporary tables */
|
||||
mxs::SessionCommandList sescmd_list; /**< List of executed session commands */
|
||||
ResponseMap sescmd_responses; /**< Response to each session command */
|
||||
uint64_t sent_sescmd; /**< ID of the last sent session command*/
|
||||
uint64_t recv_sescmd; /**< ID of the most recently completed session command */
|
||||
PSManager ps_manager; /**< Prepared statement manager*/
|
||||
ClientHandleMap ps_handles; /**< Client PS handle to internal ID mapping */
|
||||
ExecMap exec_map; /**< Map of COM_STMT_EXECUTE statement IDs to Backends */
|
||||
skygw_chk_t rses_chk_tail;
|
||||
public:
|
||||
RWSplitSession(const Config& config);
|
||||
|
||||
// TODO: Make member variables private
|
||||
skygw_chk_t rses_chk_top;
|
||||
bool rses_closed; /**< true when closeSession is called */
|
||||
SRWBackendList backends; /**< List of backend servers */
|
||||
SRWBackend current_master; /**< Current master server */
|
||||
SRWBackend target_node; /**< The currently locked target node */
|
||||
Config rses_config; /**< copied config info from router instance */
|
||||
int rses_nbackends;
|
||||
enum ld_state load_data_state; /**< Current load data state */
|
||||
bool have_tmp_tables;
|
||||
uint64_t rses_load_data_sent; /**< How much data has been sent */
|
||||
DCB* client_dcb;
|
||||
uint64_t sescmd_count;
|
||||
int expected_responses; /**< Number of expected responses to the current query */
|
||||
GWBUF* query_queue; /**< Queued commands waiting to be executed */
|
||||
RWSplit* router; /**< The router instance */
|
||||
TableSet temp_tables; /**< Set of temporary tables */
|
||||
mxs::SessionCommandList sescmd_list; /**< List of executed session commands */
|
||||
ResponseMap sescmd_responses; /**< Response to each session command */
|
||||
uint64_t sent_sescmd; /**< ID of the last sent session command*/
|
||||
uint64_t recv_sescmd; /**< ID of the most recently completed session command */
|
||||
PSManager ps_manager; /**< Prepared statement manager*/
|
||||
ClientHandleMap ps_handles; /**< Client PS handle to internal ID mapping */
|
||||
ExecMap exec_map; /**< Map of COM_STMT_EXECUTE statement IDs to Backends */
|
||||
skygw_chk_t rses_chk_tail;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -34,17 +34,17 @@ do{ \
|
||||
/*
|
||||
* The following are implemented in rwsplit_mysql.c
|
||||
*/
|
||||
bool route_single_stmt(RWSplit *inst, ROUTER_CLIENT_SES *rses,
|
||||
bool route_single_stmt(RWSplit *inst, RWSplitSession *rses,
|
||||
GWBUF *querybuf);
|
||||
void closed_session_reply(GWBUF *querybuf);
|
||||
void print_error_packet(ROUTER_CLIENT_SES *rses, GWBUF *buf, DCB *dcb);
|
||||
void print_error_packet(RWSplitSession *rses, GWBUF *buf, DCB *dcb);
|
||||
void check_session_command_reply(GWBUF *writebuf, SRWBackend bref);
|
||||
bool execute_sescmd_in_backend(SRWBackend& backend_ref);
|
||||
bool handle_target_is_all(route_target_t route_target,
|
||||
RWSplit *inst, ROUTER_CLIENT_SES *rses,
|
||||
RWSplit *inst, RWSplitSession *rses,
|
||||
GWBUF *querybuf, int packet_type, uint32_t qtype);
|
||||
uint8_t determine_packet_type(GWBUF *querybuf, bool *non_empty_packet);
|
||||
void log_transaction_status(ROUTER_CLIENT_SES *rses, GWBUF *querybuf, uint32_t qtype);
|
||||
void log_transaction_status(RWSplitSession *rses, GWBUF *querybuf, uint32_t qtype);
|
||||
bool is_packet_a_query(int packet_type);
|
||||
bool send_readonly_error(DCB *dcb);
|
||||
|
||||
@ -52,34 +52,34 @@ bool send_readonly_error(DCB *dcb);
|
||||
* The following are implemented in readwritesplit.c
|
||||
*/
|
||||
int router_handle_state_switch(DCB *dcb, DCB_REASON reason, void *data);
|
||||
SRWBackend get_backend_from_dcb(ROUTER_CLIENT_SES *rses, DCB *dcb);
|
||||
int rses_get_max_slavecount(ROUTER_CLIENT_SES *rses);
|
||||
int rses_get_max_replication_lag(ROUTER_CLIENT_SES *rses);
|
||||
SRWBackend get_backend_from_dcb(RWSplitSession *rses, DCB *dcb);
|
||||
int rses_get_max_slavecount(RWSplitSession *rses);
|
||||
int rses_get_max_replication_lag(RWSplitSession *rses);
|
||||
|
||||
/*
|
||||
* The following are implemented in rwsplit_route_stmt.c
|
||||
*/
|
||||
|
||||
bool route_single_stmt(RWSplit *inst, ROUTER_CLIENT_SES *rses,
|
||||
bool route_single_stmt(RWSplit *inst, RWSplitSession *rses,
|
||||
GWBUF *querybuf);
|
||||
SRWBackend get_target_backend(ROUTER_CLIENT_SES *rses, backend_type_t btype,
|
||||
SRWBackend get_target_backend(RWSplitSession *rses, backend_type_t btype,
|
||||
char *name, int max_rlag);
|
||||
route_target_t get_route_target(ROUTER_CLIENT_SES *rses, uint8_t command,
|
||||
route_target_t get_route_target(RWSplitSession *rses, uint8_t command,
|
||||
uint32_t qtype, HINT *hint);
|
||||
void handle_multi_temp_and_load(ROUTER_CLIENT_SES *rses, GWBUF *querybuf,
|
||||
void handle_multi_temp_and_load(RWSplitSession *rses, GWBUF *querybuf,
|
||||
uint8_t packet_type, uint32_t *qtype);
|
||||
SRWBackend handle_hinted_target(ROUTER_CLIENT_SES *rses, GWBUF *querybuf,
|
||||
SRWBackend handle_hinted_target(RWSplitSession *rses, GWBUF *querybuf,
|
||||
route_target_t route_target);
|
||||
SRWBackend handle_slave_is_target(RWSplit *inst, ROUTER_CLIENT_SES *rses,
|
||||
SRWBackend handle_slave_is_target(RWSplit *inst, RWSplitSession *rses,
|
||||
uint8_t cmd, uint32_t id);
|
||||
bool handle_master_is_target(RWSplit *inst, ROUTER_CLIENT_SES *rses,
|
||||
bool handle_master_is_target(RWSplit *inst, RWSplitSession *rses,
|
||||
SRWBackend* dest);
|
||||
bool handle_got_target(RWSplit *inst, ROUTER_CLIENT_SES *rses,
|
||||
bool handle_got_target(RWSplit *inst, RWSplitSession *rses,
|
||||
GWBUF *querybuf, SRWBackend& target, bool store);
|
||||
bool route_session_write(ROUTER_CLIENT_SES *rses, GWBUF *querybuf,
|
||||
bool route_session_write(RWSplitSession *rses, GWBUF *querybuf,
|
||||
uint8_t command, uint32_t type);
|
||||
|
||||
void process_sescmd_response(ROUTER_CLIENT_SES* rses, SRWBackend& bref,
|
||||
void process_sescmd_response(RWSplitSession* rses, SRWBackend& bref,
|
||||
GWBUF** ppPacket, bool* reconnect);
|
||||
/*
|
||||
* The following are implemented in rwsplit_select_backends.c
|
||||
@ -97,22 +97,22 @@ bool select_connect_backend_servers(int router_nservers,
|
||||
select_criteria_t select_criteria,
|
||||
MXS_SESSION *session,
|
||||
RWSplit *router,
|
||||
ROUTER_CLIENT_SES *rses,
|
||||
RWSplitSession *rses,
|
||||
connection_type type);
|
||||
|
||||
/*
|
||||
* The following are implemented in rwsplit_tmp_table_multi.c
|
||||
*/
|
||||
void check_drop_tmp_table(ROUTER_CLIENT_SES *router_cli_ses, GWBUF *querybuf);
|
||||
bool is_read_tmp_table(ROUTER_CLIENT_SES *router_cli_ses,
|
||||
void check_drop_tmp_table(RWSplitSession *router_cli_ses, GWBUF *querybuf);
|
||||
bool is_read_tmp_table(RWSplitSession *router_cli_ses,
|
||||
GWBUF *querybuf,
|
||||
uint32_t type);
|
||||
void check_create_tmp_table(ROUTER_CLIENT_SES *router_cli_ses,
|
||||
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);
|
||||
uint32_t determine_query_type(GWBUF *querybuf, int packet_type, bool non_empty_packet);
|
||||
|
||||
void close_all_connections(ROUTER_CLIENT_SES* rses);
|
||||
void close_all_connections(RWSplitSession* rses);
|
||||
|
||||
/**
|
||||
* @brief Extract text identifier of a PREPARE or EXECUTE statement
|
||||
|
@ -120,7 +120,7 @@ is_packet_a_query(int packet_type)
|
||||
* @param qtype Query type
|
||||
*/
|
||||
void
|
||||
log_transaction_status(ROUTER_CLIENT_SES *rses, GWBUF *querybuf, uint32_t qtype)
|
||||
log_transaction_status(RWSplitSession *rses, GWBUF *querybuf, uint32_t qtype)
|
||||
{
|
||||
if (rses->load_data_state == LOAD_DATA_INACTIVE)
|
||||
{
|
||||
@ -181,7 +181,7 @@ log_transaction_status(ROUTER_CLIENT_SES *rses, GWBUF *querybuf, uint32_t qtype)
|
||||
* @return bool indicating whether the session can continue
|
||||
*/
|
||||
bool handle_target_is_all(route_target_t route_target, RWSplit *inst,
|
||||
ROUTER_CLIENT_SES *rses, GWBUF *querybuf,
|
||||
RWSplitSession *rses, GWBUF *querybuf,
|
||||
int packet_type, uint32_t qtype)
|
||||
{
|
||||
bool result = false;
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
extern int (*criteria_cmpfun[LAST_CRITERIA])(const SRWBackend&, const SRWBackend&);
|
||||
|
||||
static SRWBackend get_root_master_backend(ROUTER_CLIENT_SES *rses);
|
||||
static SRWBackend get_root_master_backend(RWSplitSession *rses);
|
||||
|
||||
/**
|
||||
* Find out which of the two backend servers has smaller value for select
|
||||
@ -61,7 +61,7 @@ static SRWBackend compare_backends(SRWBackend a, SRWBackend b, select_criteria_t
|
||||
return p(a, b) < 0 ? a : b;
|
||||
}
|
||||
|
||||
void handle_connection_keepalive(RWSplit *inst, ROUTER_CLIENT_SES *rses,
|
||||
void handle_connection_keepalive(RWSplit *inst, RWSplitSession *rses,
|
||||
SRWBackend& target)
|
||||
{
|
||||
ss_dassert(target);
|
||||
@ -91,7 +91,7 @@ void handle_connection_keepalive(RWSplit *inst, ROUTER_CLIENT_SES *rses,
|
||||
ss_dassert(nserv < rses->rses_nbackends);
|
||||
}
|
||||
|
||||
uint32_t get_stmt_id(ROUTER_CLIENT_SES* rses, GWBUF* buffer)
|
||||
uint32_t get_stmt_id(RWSplitSession* rses, GWBUF* buffer)
|
||||
{
|
||||
uint32_t rval = 0;
|
||||
|
||||
@ -123,7 +123,7 @@ void replace_stmt_id(GWBUF* buffer, uint32_t id)
|
||||
* @return true if routing succeed or if it failed due to unsupported query.
|
||||
* false if backend failure was encountered.
|
||||
*/
|
||||
bool route_single_stmt(RWSplit *inst, ROUTER_CLIENT_SES *rses,
|
||||
bool route_single_stmt(RWSplit *inst, RWSplitSession *rses,
|
||||
GWBUF *querybuf)
|
||||
{
|
||||
route_target_t route_target;
|
||||
@ -275,7 +275,7 @@ bool route_single_stmt(RWSplit *inst, ROUTER_CLIENT_SES *rses,
|
||||
* backends being used, otherwise false.
|
||||
*
|
||||
*/
|
||||
bool route_session_write(ROUTER_CLIENT_SES *rses, GWBUF *querybuf,
|
||||
bool route_session_write(RWSplitSession *rses, GWBUF *querybuf,
|
||||
uint8_t command, uint32_t type)
|
||||
{
|
||||
/** The SessionCommand takes ownership of the buffer */
|
||||
@ -383,7 +383,7 @@ bool route_session_write(ROUTER_CLIENT_SES *rses, GWBUF *querybuf,
|
||||
*
|
||||
* @return True if a backend was found
|
||||
*/
|
||||
SRWBackend get_target_backend(ROUTER_CLIENT_SES *rses, backend_type_t btype,
|
||||
SRWBackend get_target_backend(RWSplitSession *rses, backend_type_t btype,
|
||||
char *name, int max_rlag)
|
||||
{
|
||||
CHK_CLIENT_RSES(rses);
|
||||
@ -557,7 +557,7 @@ SRWBackend get_target_backend(ROUTER_CLIENT_SES *rses, backend_type_t btype,
|
||||
* @return bitfield including the routing target, or the target server name
|
||||
* if the query would otherwise be routed to slave.
|
||||
*/
|
||||
route_target_t get_route_target(ROUTER_CLIENT_SES *rses, uint8_t command,
|
||||
route_target_t get_route_target(RWSplitSession *rses, uint8_t command,
|
||||
uint32_t qtype, HINT *hint)
|
||||
{
|
||||
bool trx_active = session_trx_is_active(rses->client_dcb->session);
|
||||
@ -754,7 +754,7 @@ route_target_t get_route_target(ROUTER_CLIENT_SES *rses, uint8_t command,
|
||||
* @param qtype Query type
|
||||
*/
|
||||
void
|
||||
handle_multi_temp_and_load(ROUTER_CLIENT_SES *rses, GWBUF *querybuf,
|
||||
handle_multi_temp_and_load(RWSplitSession *rses, GWBUF *querybuf,
|
||||
uint8_t packet_type, uint32_t *qtype)
|
||||
{
|
||||
/** Check for multi-statement queries. If no master server is available
|
||||
@ -851,7 +851,7 @@ handle_multi_temp_and_load(ROUTER_CLIENT_SES *rses, GWBUF *querybuf,
|
||||
*
|
||||
* @return bool - true if succeeded, false otherwise
|
||||
*/
|
||||
SRWBackend handle_hinted_target(ROUTER_CLIENT_SES *rses, GWBUF *querybuf,
|
||||
SRWBackend handle_hinted_target(RWSplitSession *rses, GWBUF *querybuf,
|
||||
route_target_t route_target)
|
||||
{
|
||||
char *named_server = NULL;
|
||||
@ -930,7 +930,7 @@ SRWBackend handle_hinted_target(ROUTER_CLIENT_SES *rses, GWBUF *querybuf,
|
||||
*
|
||||
* @return bool - true if succeeded, false otherwise
|
||||
*/
|
||||
SRWBackend handle_slave_is_target(RWSplit *inst, ROUTER_CLIENT_SES *rses,
|
||||
SRWBackend handle_slave_is_target(RWSplit *inst, RWSplitSession *rses,
|
||||
uint8_t cmd, uint32_t stmt_id)
|
||||
{
|
||||
int rlag_max = rses_get_max_replication_lag(rses);
|
||||
@ -975,7 +975,7 @@ SRWBackend handle_slave_is_target(RWSplit *inst, ROUTER_CLIENT_SES *rses,
|
||||
*
|
||||
* @param rses Router session
|
||||
*/
|
||||
static void log_master_routing_failure(ROUTER_CLIENT_SES *rses, bool found,
|
||||
static void log_master_routing_failure(RWSplitSession *rses, bool found,
|
||||
SRWBackend& old_master, SRWBackend& curr_master)
|
||||
{
|
||||
char errmsg[MAX_SERVER_ADDRESS_LEN * 2 + 100]; // Extra space for error message
|
||||
@ -1039,7 +1039,7 @@ static void log_master_routing_failure(ROUTER_CLIENT_SES *rses, bool found,
|
||||
*
|
||||
* @return bool - true if succeeded, false otherwise
|
||||
*/
|
||||
bool handle_master_is_target(RWSplit *inst, ROUTER_CLIENT_SES *rses,
|
||||
bool handle_master_is_target(RWSplit *inst, RWSplitSession *rses,
|
||||
SRWBackend* dest)
|
||||
{
|
||||
SRWBackend target = get_target_backend(rses, BE_MASTER, NULL, MAX_RLAG_UNDEFINED);
|
||||
@ -1085,7 +1085,7 @@ static inline bool query_creates_reply(mysql_server_cmd_t cmd)
|
||||
*
|
||||
* @return True on success
|
||||
*/
|
||||
bool handle_got_target(RWSplit *inst, ROUTER_CLIENT_SES *rses,
|
||||
bool handle_got_target(RWSplit *inst, RWSplitSession *rses,
|
||||
GWBUF *querybuf, SRWBackend& target, bool store)
|
||||
{
|
||||
/**
|
||||
@ -1178,7 +1178,7 @@ bool handle_got_target(RWSplit *inst, ROUTER_CLIENT_SES *rses,
|
||||
* @return The backend that points to the master server or an empty reference
|
||||
* if the master cannot be found
|
||||
*/
|
||||
static SRWBackend get_root_master_backend(ROUTER_CLIENT_SES *rses)
|
||||
static SRWBackend get_root_master_backend(RWSplitSession *rses)
|
||||
{
|
||||
SRWBackend candidate;
|
||||
SERVER master = {};
|
||||
|
@ -54,7 +54,7 @@ static bool valid_for_slave(const SERVER *server, const SERVER *master)
|
||||
*
|
||||
* @return The best slave backend reference or NULL if no candidates could be found
|
||||
*/
|
||||
SRWBackend get_slave_candidate(ROUTER_CLIENT_SES* rses, const SERVER *master,
|
||||
SRWBackend get_slave_candidate(RWSplitSession* rses, const SERVER *master,
|
||||
int (*cmpfun)(const SRWBackend&, const SRWBackend&))
|
||||
{
|
||||
SRWBackend candidate;
|
||||
@ -198,7 +198,7 @@ int (*criteria_cmpfun[LAST_CRITERIA])(const SRWBackend&, const SRWBackend&) =
|
||||
* @param rses Router client session
|
||||
*/
|
||||
static void log_server_connections(select_criteria_t criteria,
|
||||
ROUTER_CLIENT_SES* rses)
|
||||
RWSplitSession* rses)
|
||||
{
|
||||
MXS_INFO("Servers and %s connection counts:",
|
||||
criteria == LEAST_GLOBAL_CONNECTIONS ? "all MaxScale" : "router");
|
||||
@ -246,7 +246,7 @@ static void log_server_connections(select_criteria_t criteria,
|
||||
*
|
||||
* @return The root master reference or NULL if no master is found
|
||||
*/
|
||||
static SERVER_REF* get_root_master(ROUTER_CLIENT_SES* rses)
|
||||
static SERVER_REF* get_root_master(RWSplitSession* rses)
|
||||
{
|
||||
SERVER_REF *master_host = NULL;
|
||||
|
||||
@ -291,7 +291,7 @@ bool select_connect_backend_servers(int router_nservers,
|
||||
select_criteria_t select_criteria,
|
||||
MXS_SESSION *session,
|
||||
RWSplit *router,
|
||||
ROUTER_CLIENT_SES *rses,
|
||||
RWSplitSession *rses,
|
||||
connection_type type)
|
||||
{
|
||||
/* get the root Master */
|
||||
|
@ -26,7 +26,7 @@
|
||||
* Functions for session command handling
|
||||
*/
|
||||
|
||||
void process_sescmd_response(ROUTER_CLIENT_SES* rses, SRWBackend& backend,
|
||||
void process_sescmd_response(RWSplitSession* rses, SRWBackend& backend,
|
||||
GWBUF** ppPacket, bool* pReconnect)
|
||||
{
|
||||
if (backend->session_command_count())
|
||||
|
@ -44,7 +44,7 @@
|
||||
* @param querybuf GWBUF containing the query
|
||||
* @param type The type of the query resolved so far
|
||||
*/
|
||||
void check_drop_tmp_table(ROUTER_CLIENT_SES *router_cli_ses, GWBUF *querybuf)
|
||||
void check_drop_tmp_table(RWSplitSession *router_cli_ses, GWBUF *querybuf)
|
||||
{
|
||||
if (qc_is_drop_table_query(querybuf))
|
||||
{
|
||||
@ -75,7 +75,7 @@ void check_drop_tmp_table(ROUTER_CLIENT_SES *router_cli_ses, GWBUF *querybuf)
|
||||
* @param type The type of the query resolved so far
|
||||
* @return The type of the query
|
||||
*/
|
||||
bool is_read_tmp_table(ROUTER_CLIENT_SES *router_cli_ses,
|
||||
bool is_read_tmp_table(RWSplitSession *router_cli_ses,
|
||||
GWBUF *querybuf,
|
||||
uint32_t qtype)
|
||||
{
|
||||
@ -125,7 +125,7 @@ bool is_read_tmp_table(ROUTER_CLIENT_SES *router_cli_ses,
|
||||
* @param querybuf GWBUF containing the query
|
||||
* @param type The type of the query resolved so far
|
||||
*/
|
||||
void check_create_tmp_table(ROUTER_CLIENT_SES *router_cli_ses,
|
||||
void check_create_tmp_table(RWSplitSession *router_cli_ses,
|
||||
GWBUF *querybuf, uint32_t type)
|
||||
{
|
||||
if (qc_query_is_type(type, QUERY_TYPE_CREATE_TMP_TABLE))
|
||||
|
Reference in New Issue
Block a user