Format router modules
Formatted router modules with Astyle.
This commit is contained in:
@ -36,32 +36,32 @@
|
||||
* @verbatim
|
||||
* Revision History
|
||||
*
|
||||
* Date Who Description
|
||||
* 14/06/2013 Mark Riddoch Initial implementation
|
||||
* 25/06/2013 Mark Riddoch Addition of checks for current server state
|
||||
* 26/06/2013 Mark Riddoch Use server with least connections since
|
||||
* startup if the number of current
|
||||
* connections is the same for two servers
|
||||
* Addition of master and slave options
|
||||
* 27/06/2013 Vilho Raatikka Added skygw_log_write command as an example
|
||||
* and necessary headers.
|
||||
* 17/07/2013 Massimiliano Pinto Added clientReply routine:
|
||||
* called by backend server to send data to client
|
||||
* Included maxscale/protocol/mysql.h
|
||||
* with macros and MySQL commands with MYSQL_ prefix
|
||||
* avoiding any conflict with the standard ones
|
||||
* in mysql.h
|
||||
* 22/07/2013 Mark Riddoch Addition of joined router option for Galera
|
||||
* clusters
|
||||
* 31/07/2013 Massimiliano Pinto Added a check for candidate server, if NULL return
|
||||
* 12/08/2013 Mark Riddoch Log unsupported router options
|
||||
* 04/09/2013 Massimiliano Pinto Added client NULL check in clientReply
|
||||
* 22/10/2013 Massimiliano Pinto errorReply called from backend, for client error reply
|
||||
* or take different actions such as open a new backend connection
|
||||
* 20/02/2014 Massimiliano Pinto If router_options=slave, route traffic to master if no slaves available
|
||||
* 06/03/2014 Massimiliano Pinto Server connection counter is now updated in closeSession
|
||||
* 24/06/2014 Massimiliano Pinto New rules for selecting the Master server
|
||||
* 27/06/2014 Mark Riddoch Addition of server weighting
|
||||
* Date Who Description
|
||||
* 14/06/2013 Mark Riddoch Initial implementation
|
||||
* 25/06/2013 Mark Riddoch Addition of checks for current server state
|
||||
* 26/06/2013 Mark Riddoch Use server with least connections since
|
||||
* startup if the number of current
|
||||
* connections is the same for two servers
|
||||
* Addition of master and slave options
|
||||
* 27/06/2013 Vilho Raatikka Added skygw_log_write command as an example
|
||||
* and necessary headers.
|
||||
* 17/07/2013 Massimiliano Pinto Added clientReply routine:
|
||||
* called by backend server to send data to client
|
||||
* Included maxscale/protocol/mysql.h
|
||||
* with macros and MySQL commands with MYSQL_ prefix
|
||||
* avoiding any conflict with the standard ones
|
||||
* in mysql.h
|
||||
* 22/07/2013 Mark Riddoch Addition of joined router option for Galera
|
||||
* clusters
|
||||
* 31/07/2013 Massimiliano Pinto Added a check for candidate server, if NULL return
|
||||
* 12/08/2013 Mark Riddoch Log unsupported router options
|
||||
* 04/09/2013 Massimiliano Pinto Added client NULL check in clientReply
|
||||
* 22/10/2013 Massimiliano Pinto errorReply called from backend, for client error reply
|
||||
* or take different actions such as open a new backend connection
|
||||
* 20/02/2014 Massimiliano Pinto If router_options=slave, route traffic to master if no slaves available
|
||||
* 06/03/2014 Massimiliano Pinto Server connection counter is now updated in closeSession
|
||||
* 24/06/2014 Massimiliano Pinto New rules for selecting the Master server
|
||||
* 27/06/2014 Mark Riddoch Addition of server weighting
|
||||
* 11/06/2015 Martin Brampton Remove decrement n_current (moved to dcb.c)
|
||||
* 09/09/2015 Martin Brampton Modify error handler
|
||||
* 25/09/2015 Martin Brampton Block callback processing when no router session in the DCB
|
||||
@ -168,8 +168,8 @@ static inline void free_readconn_instance(ROUTER_INSTANCE *router)
|
||||
* Create an instance of the router for a particular service
|
||||
* within the gateway.
|
||||
*
|
||||
* @param service The service this router is being create for
|
||||
* @param options An array of options for this query router
|
||||
* @param service The service this router is being create for
|
||||
* @param options An array of options for this query router
|
||||
*
|
||||
* @return The instance data for this new instance
|
||||
*/
|
||||
@ -257,14 +257,14 @@ createInstance(SERVICE *service, char **options)
|
||||
instances = inst;
|
||||
spinlock_release(&instlock);
|
||||
|
||||
return(ROUTER *) inst;
|
||||
return (ROUTER *) inst;
|
||||
}
|
||||
|
||||
/**
|
||||
* Associate a new session with this instance of the router.
|
||||
*
|
||||
* @param instance The router instance data
|
||||
* @param session The session itself
|
||||
* @param instance The router instance data
|
||||
* @param session The session itself
|
||||
* @return Session specific data for this session
|
||||
*/
|
||||
static void *
|
||||
@ -445,7 +445,7 @@ newSession(ROUTER *instance, SESSION *session)
|
||||
MXS_INFO("New session for server %s. Connections : %d",
|
||||
candidate->server->unique_name, candidate->connections);
|
||||
|
||||
return(void *) client_rses;
|
||||
return (void *) client_rses;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -480,8 +480,8 @@ static void freeSession(ROUTER* router_instance, void* router_client_ses)
|
||||
* Close a session with the router, this is the mechanism
|
||||
* by which a router may cleanup data structure etc.
|
||||
*
|
||||
* @param instance The router instance data
|
||||
* @param router_session The session being closed
|
||||
* @param instance The router instance data
|
||||
* @param router_session The session being closed
|
||||
*/
|
||||
static void
|
||||
closeSession(ROUTER *instance, void *router_session)
|
||||
@ -532,7 +532,7 @@ static void log_closed_session(mysql_server_cmd_t mysql_command, bool is_closed,
|
||||
{
|
||||
sprintf(msg, "Server '%s' was removed from the service.", ref->server->unique_name);
|
||||
}
|
||||
else if(SERVER_IN_MAINT(ref->server))
|
||||
else if (SERVER_IN_MAINT(ref->server))
|
||||
{
|
||||
sprintf(msg, "Server '%s' is in maintenance.", ref->server->unique_name);
|
||||
}
|
||||
@ -546,9 +546,9 @@ static void log_closed_session(mysql_server_cmd_t mysql_command, bool is_closed,
|
||||
* This is simply a case of sending it to the connection that was
|
||||
* chosen when we started the client session.
|
||||
*
|
||||
* @param instance The router instance
|
||||
* @param router_session The router session returned from the newSession call
|
||||
* @param queue The queue of data buffers to route
|
||||
* @param instance The router instance
|
||||
* @param router_session The router session returned from the newSession call
|
||||
* @param queue The queue of data buffers to route
|
||||
* @return if succeed 1, otherwise 0
|
||||
*/
|
||||
static int
|
||||
@ -598,18 +598,18 @@ routeQuery(ROUTER *instance, void *router_session, GWBUF *queue)
|
||||
|
||||
switch (mysql_command)
|
||||
{
|
||||
case MYSQL_COM_CHANGE_USER:
|
||||
rc = backend_dcb->func.auth(backend_dcb, NULL, backend_dcb->session,
|
||||
queue);
|
||||
break;
|
||||
case MYSQL_COM_QUERY:
|
||||
if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_INFO))
|
||||
{
|
||||
trc = modutil_get_SQL(queue);
|
||||
}
|
||||
default:
|
||||
rc = backend_dcb->func.write(backend_dcb, queue);
|
||||
break;
|
||||
case MYSQL_COM_CHANGE_USER:
|
||||
rc = backend_dcb->func.auth(backend_dcb, NULL, backend_dcb->session,
|
||||
queue);
|
||||
break;
|
||||
case MYSQL_COM_QUERY:
|
||||
if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_INFO))
|
||||
{
|
||||
trc = modutil_get_SQL(queue);
|
||||
}
|
||||
default:
|
||||
rc = backend_dcb->func.write(backend_dcb, queue);
|
||||
break;
|
||||
}
|
||||
|
||||
MXS_INFO("Routed [%s] to '%s'%s%s",
|
||||
@ -627,8 +627,8 @@ return_rc:
|
||||
/**
|
||||
* Display router diagnostics
|
||||
*
|
||||
* @param instance Instance of the router
|
||||
* @param dcb DCB to send diagnostics to
|
||||
* @param instance Instance of the router
|
||||
* @param dcb DCB to send diagnostics to
|
||||
*/
|
||||
static void
|
||||
diagnostics(ROUTER *router, DCB *dcb)
|
||||
@ -686,8 +686,8 @@ clientReply(ROUTER *instance, void *router_session, GWBUF *queue, DCB *backend_d
|
||||
* @param router_session The router session
|
||||
* @param message The error message to reply
|
||||
* @param problem_dcb The DCB related to the error
|
||||
* @param action The action: ERRACT_NEW_CONNECTION or ERRACT_REPLY_CLIENT
|
||||
* @param succp Result of action: true if router can continue
|
||||
* @param action The action: ERRACT_NEW_CONNECTION or ERRACT_REPLY_CLIENT
|
||||
* @param succp Result of action: true if router can continue
|
||||
*
|
||||
*/
|
||||
static void handleError(ROUTER *instance, void *router_session, GWBUF *errbuf,
|
||||
@ -812,8 +812,8 @@ static uint64_t getCapabilities(void)
|
||||
* and the SERVER_MASTER bitval
|
||||
* Servers are checked even if they are in 'maintenance'
|
||||
*
|
||||
* @param servers The list of servers
|
||||
* @return The Master found
|
||||
* @param servers The list of servers
|
||||
* @return The Master found
|
||||
*
|
||||
*/
|
||||
|
||||
@ -831,8 +831,8 @@ static SERVER_REF *get_root_master(SERVER_REF *servers)
|
||||
master_host = ref;
|
||||
}
|
||||
else if (ref->server->depth < master_host->server->depth ||
|
||||
(ref->server->depth == master_host->server->depth &&
|
||||
ref->weight > master_host->weight))
|
||||
(ref->server->depth == master_host->server->depth &&
|
||||
ref->weight > master_host->weight))
|
||||
{
|
||||
/**
|
||||
* This master has a lower depth than the candidate master or
|
||||
@ -863,29 +863,29 @@ static int handle_state_switch(DCB* dcb, DCB_REASON reason, void * routersession
|
||||
}
|
||||
switch (reason)
|
||||
{
|
||||
case DCB_REASON_CLOSE:
|
||||
dcb->func.close(dcb);
|
||||
break;
|
||||
case DCB_REASON_DRAINED:
|
||||
/** Do we need to do anything? */
|
||||
break;
|
||||
case DCB_REASON_HIGH_WATER:
|
||||
/** Do we need to do anything? */
|
||||
break;
|
||||
case DCB_REASON_LOW_WATER:
|
||||
/** Do we need to do anything? */
|
||||
break;
|
||||
case DCB_REASON_ERROR:
|
||||
dcb->func.error(dcb);
|
||||
break;
|
||||
case DCB_REASON_HUP:
|
||||
dcb->func.hangup(dcb);
|
||||
break;
|
||||
case DCB_REASON_NOT_RESPONDING:
|
||||
dcb->func.hangup(dcb);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case DCB_REASON_CLOSE:
|
||||
dcb->func.close(dcb);
|
||||
break;
|
||||
case DCB_REASON_DRAINED:
|
||||
/** Do we need to do anything? */
|
||||
break;
|
||||
case DCB_REASON_HIGH_WATER:
|
||||
/** Do we need to do anything? */
|
||||
break;
|
||||
case DCB_REASON_LOW_WATER:
|
||||
/** Do we need to do anything? */
|
||||
break;
|
||||
case DCB_REASON_ERROR:
|
||||
dcb->func.error(dcb);
|
||||
break;
|
||||
case DCB_REASON_HUP:
|
||||
dcb->func.hangup(dcb);
|
||||
break;
|
||||
case DCB_REASON_NOT_RESPONDING:
|
||||
dcb->func.hangup(dcb);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user