Merge branch 'develop' into blr
Conflicts: server/core/dcb.c server/modules/include/blr.h server/modules/routing/binlog/STATUS server/modules/routing/binlog/blr.c server/modules/routing/binlog/blr_file.c server/modules/routing/binlog/blr_master.c server/modules/routing/binlog/blr_slave.c
This commit is contained in:
@ -43,6 +43,14 @@
|
||||
* 27/09/2013 Massimiliano Pinto Changed in gw_read_backend_event the check for dcb_read(), now is if rc < 0
|
||||
*
|
||||
*/
|
||||
#include <modinfo.h>
|
||||
|
||||
MODULE_INFO info = {
|
||||
MODULE_API_PROTOCOL,
|
||||
MODULE_ALPHA_RELEASE,
|
||||
GWPROTOCOL_VERSION,
|
||||
"The MySQL to backend server protocol"
|
||||
};
|
||||
|
||||
extern int lm_enabled_logfiles_bitmask;
|
||||
|
||||
@ -282,7 +290,13 @@ static int gw_read_backend_event(DCB *dcb) {
|
||||
} /* switch */
|
||||
}
|
||||
|
||||
if (backend_protocol->state == MYSQL_AUTH_FAILED) {
|
||||
if (backend_protocol->state == MYSQL_AUTH_FAILED)
|
||||
{
|
||||
/**
|
||||
* protocol state won't change anymore,
|
||||
* lock can be freed
|
||||
*/
|
||||
spinlock_release(&dcb->authlock);
|
||||
spinlock_acquire(&dcb->delayqlock);
|
||||
/*<
|
||||
* vraa : errorHandle
|
||||
@ -306,12 +320,14 @@ static int gw_read_backend_event(DCB *dcb) {
|
||||
/* try reload users' table for next connection */
|
||||
service_refresh_users(dcb->session->client->service);
|
||||
|
||||
while (session->state != SESSION_STATE_ROUTER_READY)
|
||||
while (session->state != SESSION_STATE_ROUTER_READY &&
|
||||
session->state != SESSION_STATE_STOPPING)
|
||||
{
|
||||
ss_dassert(
|
||||
session->state == SESSION_STATE_READY ||
|
||||
session->state ==
|
||||
SESSION_STATE_ROUTER_READY);
|
||||
SESSION_STATE_ROUTER_READY ||
|
||||
session->state == SESSION_STATE_STOPPING);
|
||||
/**
|
||||
* Session shouldn't be NULL at this point
|
||||
* anymore. Just checking..
|
||||
@ -319,10 +335,19 @@ static int gw_read_backend_event(DCB *dcb) {
|
||||
if (session->client->session == NULL)
|
||||
{
|
||||
rc = 1;
|
||||
goto return_with_lock;
|
||||
goto return_rc;
|
||||
}
|
||||
usleep(1);
|
||||
}
|
||||
|
||||
if (session->state == SESSION_STATE_STOPPING)
|
||||
{
|
||||
goto return_rc;
|
||||
}
|
||||
spinlock_acquire(&session->ses_lock);
|
||||
session->state = SESSION_STATE_STOPPING;
|
||||
spinlock_release(&session->ses_lock);
|
||||
|
||||
/**
|
||||
* rsession shouldn't be NULL since session
|
||||
* state indicates that it was initialized
|
||||
@ -340,7 +365,7 @@ static int gw_read_backend_event(DCB *dcb) {
|
||||
/* close router_session */
|
||||
router->closeSession(router_instance, rsession);
|
||||
rc = 1;
|
||||
goto return_with_lock;
|
||||
goto return_rc;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -357,8 +382,7 @@ static int gw_read_backend_event(DCB *dcb) {
|
||||
/* check the delay queue and flush the data */
|
||||
if (dcb->delayq)
|
||||
{
|
||||
backend_write_delayqueue(dcb);
|
||||
rc = 1;
|
||||
rc = backend_write_delayqueue(dcb);
|
||||
goto return_with_lock;
|
||||
}
|
||||
}
|
||||
@ -569,9 +593,8 @@ gw_MySQLWrite_backend(DCB *dcb, GWBUF *queue)
|
||||
snprintf(str, len+1, "%s", startpoint);
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Error : Routing query \"%s\" failed due to "
|
||||
"authentication failure.",
|
||||
str)));
|
||||
"Error : Unable to write to backend due to "
|
||||
"authentication failure.")));
|
||||
/** Consume query buffer */
|
||||
while ((queue = gwbuf_consume(
|
||||
queue,
|
||||
@ -669,6 +692,10 @@ static int gw_error_backend_event(DCB *dcb) {
|
||||
|
||||
if (session->state == SESSION_STATE_ROUTER_READY)
|
||||
{
|
||||
spinlock_acquire(&session->ses_lock);
|
||||
session->state = SESSION_STATE_STOPPING;
|
||||
spinlock_release(&session->ses_lock);
|
||||
|
||||
rsession = session->router_session;
|
||||
/*<
|
||||
* rsession should never be NULL here.
|
||||
@ -874,34 +901,36 @@ static int backend_write_delayqueue(DCB *dcb)
|
||||
|
||||
spinlock_acquire(&dcb->delayqlock);
|
||||
|
||||
if (dcb->delayq == NULL)
|
||||
{
|
||||
spinlock_release(&dcb->delayqlock);
|
||||
rc = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
localq = dcb->delayq;
|
||||
dcb->delayq = NULL;
|
||||
|
||||
spinlock_release(&dcb->delayqlock);
|
||||
rc = dcb_write(dcb, localq);
|
||||
}
|
||||
|
||||
if (rc == 0) {
|
||||
/*< vraa : errorHandle */
|
||||
/**
|
||||
* This error can be muted because it is often due
|
||||
* unexpected dcb state which means that concurrent thread
|
||||
* already wrote the queue and closed dcb.
|
||||
*/
|
||||
#if 0
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"%lu [backend_write_delayqueue] Some error occurred in "
|
||||
"backend.",
|
||||
pthread_self())));
|
||||
#endif
|
||||
"Error : failed to write buffered data to back-end "
|
||||
"server. Buffer was empty of back-end was disconnected "
|
||||
"during operation.")));
|
||||
|
||||
mysql_send_custom_error(
|
||||
dcb->session->client,
|
||||
1,
|
||||
0,
|
||||
"Unable to write to backend server. Connection was "
|
||||
"closed.");
|
||||
"Failed to write buffered data to back-end server. "
|
||||
"Buffer was empty or back-end was disconnected during "
|
||||
"operation.");
|
||||
dcb_close(dcb);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user