From 00f77bbe6956b3eb1f323ea77c2cb877b90c26ba Mon Sep 17 00:00:00 2001 From: Esa Korhonen Date: Wed, 18 Jan 2017 10:36:18 +0200 Subject: [PATCH] Fix some leftovers from the SESSION->MXS_SESSION and related renames Renames only. --- .../Reference/How-errors-are-handled-in-MaxScale.md | 4 ++-- include/maxscale/filter.hh | 8 ++++---- include/maxscale/session.h | 10 +++++----- server/core/dcb.c | 2 +- server/modules/protocol/CDC/cdc.c | 2 +- server/modules/routing/readconnroute/readconnroute.c | 2 +- server/modules/routing/readwritesplit/readwritesplit.c | 2 +- server/modules/routing/schemarouter/schemarouter.c | 2 +- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Documentation/Reference/How-errors-are-handled-in-MaxScale.md b/Documentation/Reference/How-errors-are-handled-in-MaxScale.md index e902a8e4f..4e212b187 100644 --- a/Documentation/Reference/How-errors-are-handled-in-MaxScale.md +++ b/Documentation/Reference/How-errors-are-handled-in-MaxScale.md @@ -38,7 +38,7 @@ When client protocol module receives query from client the protocol state is (ty ### Backend failure -When mysql_client.c:gw_read_client_event calls either route_by_statement or directly SESSION_ROUTE_QUERY script, which calls the routeQuery function of the head session’s router. routeQuery returns 1 if succeed, or 0 in case of error. Success here means that query was routed and reply will be sent to the client while error means that routing failed because of backend (server/servers/service) failure or because of side effect of backend failure. +When mysql_client.c:gw_read_client_event calls either route_by_statement or directly MXS_SESSION_ROUTE_QUERY script, which calls the routeQuery function of the head session’s router. routeQuery returns 1 if succeed, or 0 in case of error. Success here means that query was routed and reply will be sent to the client while error means that routing failed because of backend (server/servers/service) failure or because of side effect of backend failure. In case of backend failure, error is replied to client and handleError is called to resolve backend problem. handleError is called with action ERRACT_NEW_CONNECTION which tells to error handler that it should try to find a replacement for failed backend. Handler will return true if there are enough backend servers for session’s needs. If handler returns false it means that session can’t continue processing further queries and will be closed. Client will be sent an error message and dcb_close is called for client DCB. @@ -52,5 +52,5 @@ Reasons for "backend failure" in rwsplit: ### Router error -In cases where SESSION_ROUTE_QUERY has returned successfully (=1) query may not be successfully processed in backend or even sent to it. It is possible that router fails in routing the particular query but there is no such error which would prevent session from continuing. In this case router handles error silently by creating and adding MySQL error to first available backend’s (incoming) eventqueue where it is found and sent to client (clientReply). +In cases where MXS_SESSION_ROUTE_QUERY has returned successfully (=1) query may not be successfully processed in backend or even sent to it. It is possible that router fails in routing the particular query but there is no such error which would prevent session from continuing. In this case router handles error silently by creating and adding MySQL error to first available backend’s (incoming) eventqueue where it is found and sent to client (clientReply). diff --git a/include/maxscale/filter.hh b/include/maxscale/filter.hh index 8e6c87ad1..780bb9526 100644 --- a/include/maxscale/filter.hh +++ b/include/maxscale/filter.hh @@ -153,9 +153,9 @@ protected: FilterSession(MXS_SESSION* pSession); protected: - MXS_SESSION* m_pSession; /*< The SESSION this filter session is associated with. */ - Downstream m_down; /*< The downstream component. */ - Upstream m_up; /*< The upstream component. */ + MXS_SESSION* m_pSession; /*< The MXS_SESSION this filter session is associated with. */ + Downstream m_down; /*< The downstream component. */ + Upstream m_up; /*< The upstream component. */ }; @@ -180,7 +180,7 @@ protected: * public: * static MyFilter* create(const char* zName, char** pzOptions, FILTER_PARAMETER** ppParams); * - * MyFilterSession* newSession(SESSION* pSession); + * MyFilterSession* newSession(MXS_SESSION* pSession); * * void diagnostics(DCB* pDcb); * static uint64_t getCapabilities(); diff --git a/include/maxscale/session.h b/include/maxscale/session.h index 8b78df697..d44179d41 100644 --- a/include/maxscale/session.h +++ b/include/maxscale/session.h @@ -204,7 +204,7 @@ typedef struct session * the replies to the first element in the pipeline of filters and * the protocol. */ -#define SESSION_ROUTE_REPLY(sess, buf) \ +#define MXS_SESSION_ROUTE_REPLY(sess, buf) \ ((sess)->tail.clientReply)((sess)->tail.instance, \ (sess)->tail.session, (buf)) @@ -243,7 +243,7 @@ RESULTSET *sessionGetList(SESSIONLISTFILTER); * @note The return value is valid only if either a router or a filter * has declared that it needs RCAP_TYPE_TRANSACTION_TRACKING. * - * @param ses The SESSION object. + * @param ses The MXS_SESSION object. * @return The transaction state. */ mxs_session_trx_state_t session_get_trx_state(const MXS_SESSION* ses); @@ -253,7 +253,7 @@ mxs_session_trx_state_t session_get_trx_state(const MXS_SESSION* ses); * * NOTE: Only the protocol object may call this. * - * @param ses The SESSION object. + * @param ses The MXS_SESSION object. * @param new_state The new transaction state. * * @return The previous transaction state. @@ -350,7 +350,7 @@ static inline bool session_set_autocommit(MXS_SESSION* ses, bool autocommit) * This creates an additional reference to a session whose unique ID matches @c id. * * @param id Unique session ID - * @return Reference to a SESSION or NULL if the session was not found + * @return Reference to a MXS_SESSION or NULL if the session was not found * * @note The caller must free the session reference by calling session_put_ref */ @@ -363,7 +363,7 @@ MXS_SESSION* session_get_by_id(int id); * as long as it is needed. * * @param session Session reference to get - * @return Reference to a SESSION + * @return Reference to a MXS_SESSION * * @note The caller must free the session reference by calling session_put_ref */ diff --git a/server/core/dcb.c b/server/core/dcb.c index 5edcf2c1c..949b4fefe 100644 --- a/server/core/dcb.c +++ b/server/core/dcb.c @@ -594,7 +594,7 @@ dcb_process_victim_queue(int threadid) /** After these calls, the DCB should be treated as if it were freed. * Whether it is actually freed depends on the type of the DCB and how - * many DCBs are linked to it via the SESSION object. */ + * many DCBs are linked to it via the MXS_SESSION object. */ dcb->state = DCB_STATE_DISCONNECTED; dcb_remove_from_list(dcb); dcb_final_free(dcb); diff --git a/server/modules/protocol/CDC/cdc.c b/server/modules/protocol/CDC/cdc.c index 93f293c0e..12f69d6f7 100644 --- a/server/modules/protocol/CDC/cdc.c +++ b/server/modules/protocol/CDC/cdc.c @@ -184,7 +184,7 @@ cdc_read_event(DCB* dcb) // gwbuf_set_type(head, GWBUF_TYPE_CDC); // the router will close the client connection - //rc = SESSION_ROUTE_QUERY(session, head); + //rc = MXS_SESSION_ROUTE_QUERY(session, head); // buffer not handled by router right now, consume it gwbuf_free(head); diff --git a/server/modules/routing/readconnroute/readconnroute.c b/server/modules/routing/readconnroute/readconnroute.c index ae6597d37..50a085924 100644 --- a/server/modules/routing/readconnroute/readconnroute.c +++ b/server/modules/routing/readconnroute/readconnroute.c @@ -674,7 +674,7 @@ static void clientReply(ROUTER *instance, void *router_session, GWBUF *queue, DCB *backend_dcb) { ss_dassert(backend_dcb->session->client_dcb != NULL); - SESSION_ROUTE_REPLY(backend_dcb->session, queue); + MXS_SESSION_ROUTE_REPLY(backend_dcb->session, queue); } /** diff --git a/server/modules/routing/readwritesplit/readwritesplit.c b/server/modules/routing/readwritesplit/readwritesplit.c index cc92ed0c4..be03452cb 100644 --- a/server/modules/routing/readwritesplit/readwritesplit.c +++ b/server/modules/routing/readwritesplit/readwritesplit.c @@ -765,7 +765,7 @@ static void clientReply(ROUTER *instance, void *router_session, GWBUF *writebuf, if (writebuf != NULL && client_dcb != NULL) { /** Write reply to client DCB */ - SESSION_ROUTE_REPLY(backend_dcb->session, writebuf); + MXS_SESSION_ROUTE_REPLY(backend_dcb->session, writebuf); } /** Unlock router session */ rses_end_locked_router_action(router_cli_ses); diff --git a/server/modules/routing/schemarouter/schemarouter.c b/server/modules/routing/schemarouter/schemarouter.c index a36c2db38..4546819e9 100644 --- a/server/modules/routing/schemarouter/schemarouter.c +++ b/server/modules/routing/schemarouter/schemarouter.c @@ -2470,7 +2470,7 @@ static void clientReply(ROUTER* instance, PTR_IS_ERR(cmd) ? "ERR" : PTR_IS_OK(cmd) ? "OK" : "RSET", state & INIT_UNINT ? "UNINIT" : state & INIT_MAPPING ? "MAPPING" : "READY", router_cli_ses->rses_client_dcb->session); - SESSION_ROUTE_REPLY(backend_dcb->session, writebuf); + MXS_SESSION_ROUTE_REPLY(backend_dcb->session, writebuf); } /** Unlock router session */ rses_end_locked_router_action(router_cli_ses);