Surrounded every log writing command with LOGIF macro, which tests if the given logfile id matches with those enabled. The comparison is done against local variable and expensive function call is avoided.
This commit is contained in:
@ -44,6 +44,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
extern int lm_enabled_logfiles_bitmask;
|
||||
|
||||
static char *version_str = "V2.0.0";
|
||||
static int gw_create_backend_connection(DCB *backend, SERVER *server, SESSION *in_session);
|
||||
static int gw_read_backend_event(DCB* dcb);
|
||||
@ -119,12 +121,12 @@ static MYSQL_session* gw_get_shared_session_auth_info(
|
||||
if (dcb->session->state != SESSION_STATE_ALLOC) {
|
||||
auth_info = dcb->session->data;
|
||||
} else {
|
||||
skygw_log_write_flush(
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"%lu [gw_get_shared_session_auth_info] Couldn't get "
|
||||
"session authentication info. Session in a wrong state %d.",
|
||||
pthread_self(),
|
||||
dcb->session->state);
|
||||
dcb->session->state)));
|
||||
}
|
||||
spinlock_release(&dcb->session->ses_lock);
|
||||
|
||||
@ -152,7 +154,7 @@ static int gw_read_backend_event(DCB *dcb) {
|
||||
backend_protocol = (MySQLProtocol *) dcb->protocol;
|
||||
CHK_PROTOCOL(backend_protocol);
|
||||
|
||||
skygw_log_write(
|
||||
LOGIF(LD, (skygw_log_write(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu [gw_read_backend_event] Read dcb %p fd %d protocol "
|
||||
"state %d, %s.",
|
||||
@ -160,7 +162,7 @@ static int gw_read_backend_event(DCB *dcb) {
|
||||
dcb,
|
||||
dcb->fd,
|
||||
backend_protocol->state,
|
||||
STRPROTOCOLSTATE(backend_protocol->state));
|
||||
STRPROTOCOLSTATE(backend_protocol->state))));
|
||||
|
||||
|
||||
/* backend is connected:
|
||||
@ -242,17 +244,17 @@ static int gw_read_backend_event(DCB *dcb) {
|
||||
case -1:
|
||||
backend_protocol->state = MYSQL_AUTH_FAILED;
|
||||
|
||||
skygw_log_write_flush(
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Error : backend server didn't "
|
||||
"accept authentication for user "
|
||||
"%s.",
|
||||
current_session->user);
|
||||
current_session->user)));
|
||||
break;
|
||||
case 1:
|
||||
backend_protocol->state = MYSQL_IDLE;
|
||||
|
||||
skygw_log_write_flush(
|
||||
LOGIF(LD, (skygw_log_write_flush(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu [gw_read_backend_event] "
|
||||
"gw_receive_backend_auth succeed. "
|
||||
@ -260,11 +262,11 @@ static int gw_read_backend_event(DCB *dcb) {
|
||||
pthread_self(),
|
||||
dcb,
|
||||
dcb->fd,
|
||||
current_session->user);
|
||||
current_session->user)));
|
||||
break;
|
||||
default:
|
||||
ss_dassert(receive_rc == 0);
|
||||
skygw_log_write_flush(
|
||||
LOGIF(LD, (skygw_log_write_flush(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu [gw_read_backend_event] "
|
||||
"gw_receive_backend_auth read "
|
||||
@ -273,7 +275,7 @@ static int gw_read_backend_event(DCB *dcb) {
|
||||
pthread_self(),
|
||||
dcb,
|
||||
dcb->fd,
|
||||
current_session->user);
|
||||
current_session->user)));
|
||||
rc = 0;
|
||||
goto return_with_lock;
|
||||
break;
|
||||
@ -305,12 +307,12 @@ static int gw_read_backend_event(DCB *dcb) {
|
||||
**/
|
||||
ss_dassert(rsession != NULL);
|
||||
|
||||
skygw_log_write_flush(
|
||||
LOGIF(LD, (skygw_log_write_flush(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu [gw_read_backend_event] "
|
||||
"Call closeSession for backend's "
|
||||
"router client session.",
|
||||
pthread_self());
|
||||
pthread_self())));
|
||||
/* close router_session */
|
||||
router->closeSession(router_instance, rsession);
|
||||
rc = 1;
|
||||
@ -319,14 +321,14 @@ static int gw_read_backend_event(DCB *dcb) {
|
||||
else
|
||||
{
|
||||
ss_dassert(backend_protocol->state == MYSQL_IDLE);
|
||||
skygw_log_write_flush(
|
||||
LOGIF(LD, (skygw_log_write_flush(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu [gw_read_backend_event] "
|
||||
"gw_receive_backend_auth succeed. Fd %d, "
|
||||
"user %s.",
|
||||
pthread_self(),
|
||||
dcb->fd,
|
||||
current_session->user);
|
||||
current_session->user)));
|
||||
|
||||
/* check the delay queue and flush the data */
|
||||
if (dcb->delayq)
|
||||
@ -435,7 +437,7 @@ static int gw_write_backend_event(DCB *dcb) {
|
||||
0,
|
||||
"Writing to backend failed due invalid Maxscale "
|
||||
"state.");
|
||||
skygw_log_write(
|
||||
LOGIF(LD, (skygw_log_write(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu [gw_write_backend_event] Write to backend "
|
||||
"dcb %p fd %d "
|
||||
@ -443,23 +445,23 @@ static int gw_write_backend_event(DCB *dcb) {
|
||||
pthread_self(),
|
||||
dcb,
|
||||
dcb->fd,
|
||||
STRDCBSTATE(dcb->state));
|
||||
STRDCBSTATE(dcb->state))));
|
||||
|
||||
skygw_log_write_flush(
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Error : Attempt to write buffered data to backend "
|
||||
"failed "
|
||||
"due internal inconsistent state.");
|
||||
"due internal inconsistent state.")));
|
||||
|
||||
rc = 0;
|
||||
} else {
|
||||
skygw_log_write(
|
||||
LOGIF(LD, (skygw_log_write(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu [gw_write_backend_event] Dcb %p in state %s "
|
||||
"but there's nothing to write either.",
|
||||
pthread_self(),
|
||||
dcb,
|
||||
STRDCBSTATE(dcb->state));
|
||||
STRDCBSTATE(dcb->state))));
|
||||
rc = 1;
|
||||
}
|
||||
goto return_rc;
|
||||
@ -473,14 +475,14 @@ static int gw_write_backend_event(DCB *dcb) {
|
||||
dcb_drain_writeq(dcb);
|
||||
rc = 1;
|
||||
return_rc:
|
||||
skygw_log_write(
|
||||
LOGIF(LD, (skygw_log_write(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu [gw_write_backend_event] "
|
||||
"wrote to dcb %p fd %d, return %d",
|
||||
pthread_self(),
|
||||
dcb,
|
||||
dcb->fd,
|
||||
rc);
|
||||
rc)));
|
||||
|
||||
return rc;
|
||||
}
|
||||
@ -507,14 +509,14 @@ gw_MySQLWrite_backend(DCB *dcb, GWBUF *queue)
|
||||
/** Free buffer memory */
|
||||
gwbuf_consume(queue, GWBUF_LENGTH(queue));
|
||||
|
||||
skygw_log_write(
|
||||
LOGIF(LD, (skygw_log_write(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu [gw_MySQLWrite_backend] Write to backend failed. "
|
||||
"Backend dcb %p fd %d is %s.",
|
||||
pthread_self(),
|
||||
dcb,
|
||||
dcb->fd,
|
||||
STRDCBSTATE(dcb->state));
|
||||
STRDCBSTATE(dcb->state))));
|
||||
|
||||
spinlock_release(&dcb->authlock);
|
||||
return 0;
|
||||
@ -525,14 +527,14 @@ gw_MySQLWrite_backend(DCB *dcb, GWBUF *queue)
|
||||
* connected with auth ok
|
||||
*/
|
||||
if (backend_protocol->state != MYSQL_IDLE) {
|
||||
skygw_log_write(
|
||||
LOGIF(LD, (skygw_log_write(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu [gw_MySQLWrite_backend] dcb %p fd %d protocol "
|
||||
"state %s.",
|
||||
pthread_self(),
|
||||
dcb,
|
||||
dcb->fd,
|
||||
STRPROTOCOLSTATE(backend_protocol->state));
|
||||
STRPROTOCOLSTATE(backend_protocol->state))));
|
||||
|
||||
backend_set_delayqueue(dcb, queue);
|
||||
spinlock_release(&dcb->authlock);
|
||||
@ -589,24 +591,24 @@ static int gw_error_backend_event(DCB *dcb) {
|
||||
"Closed backend connection.");
|
||||
rc = 1;
|
||||
}
|
||||
skygw_log_write_flush(
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"%lu [gw_error_backend_event] Some error occurred in backend. "
|
||||
"rc = %d",
|
||||
pthread_self(),
|
||||
rc);
|
||||
rc)));
|
||||
rsession = session->router_session;
|
||||
ss_dassert(rsession != NULL);
|
||||
/**
|
||||
* vraa : errorHandle
|
||||
* rsession should never be NULL here.
|
||||
*/
|
||||
skygw_log_write_flush(
|
||||
LOGIF(LD, (skygw_log_write_flush(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu [gw_error_backend_event] "
|
||||
"Call closeSession for backend "
|
||||
"session.",
|
||||
pthread_self());
|
||||
pthread_self())));
|
||||
|
||||
router->closeSession(router_instance, rsession);
|
||||
|
||||
@ -640,15 +642,15 @@ static int gw_create_backend_connection(
|
||||
ss_dassert(protocol != NULL);
|
||||
|
||||
if (protocol == NULL) {
|
||||
skygw_log_write(
|
||||
LOGIF(LD, (skygw_log_write(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu [gw_create_backend_connection] Failed to create "
|
||||
"protocol object for backend connection.",
|
||||
pthread_self());
|
||||
skygw_log_write_flush(
|
||||
pthread_self())));
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Error: Failed to create "
|
||||
"protocol object for backend connection.");
|
||||
"protocol object for backend connection.")));
|
||||
goto return_fd;
|
||||
}
|
||||
|
||||
@ -663,7 +665,7 @@ static int gw_create_backend_connection(
|
||||
ss_dassert(fd > 0);
|
||||
protocol->fd = fd;
|
||||
protocol->state = MYSQL_CONNECTED;
|
||||
skygw_log_write(
|
||||
LOGIF(LD, (skygw_log_write(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu [gw_create_backend_connection] Established "
|
||||
"connection to %s:%i, protocol fd %d client "
|
||||
@ -672,14 +674,14 @@ static int gw_create_backend_connection(
|
||||
server->name,
|
||||
server->port,
|
||||
protocol->fd,
|
||||
session->client->fd);
|
||||
session->client->fd)));
|
||||
break;
|
||||
|
||||
case 1:
|
||||
ss_dassert(fd > 0);
|
||||
protocol->state = MYSQL_PENDING_CONNECT;
|
||||
protocol->fd = fd;
|
||||
skygw_log_write(
|
||||
LOGIF(LD, (skygw_log_write(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu [gw_create_backend_connection] Connection "
|
||||
"pending to %s:%i, protocol fd %d client fd %d.",
|
||||
@ -687,13 +689,13 @@ static int gw_create_backend_connection(
|
||||
server->name,
|
||||
server->port,
|
||||
protocol->fd,
|
||||
session->client->fd);
|
||||
session->client->fd)));
|
||||
break;
|
||||
|
||||
default:
|
||||
ss_dassert(fd == -1);
|
||||
ss_dassert(protocol->state == MYSQL_ALLOC);
|
||||
skygw_log_write(
|
||||
LOGIF(LD, (skygw_log_write(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu [gw_create_backend_connection] Connection "
|
||||
"failed to %s:%i, protocol fd %d client fd %d.",
|
||||
@ -701,7 +703,7 @@ static int gw_create_backend_connection(
|
||||
server->name,
|
||||
server->port,
|
||||
protocol->fd,
|
||||
session->client->fd);
|
||||
session->client->fd)));
|
||||
break;
|
||||
} /**< switch */
|
||||
|
||||
@ -790,11 +792,11 @@ static int backend_write_delayqueue(DCB *dcb)
|
||||
|
||||
if (rc == 0) {
|
||||
/** vraa : errorHandle */
|
||||
skygw_log_write_flush(
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"%lu [backend_write_delayqueue] Some error occurred in "
|
||||
"backend.",
|
||||
pthread_self());
|
||||
pthread_self())));
|
||||
|
||||
mysql_send_custom_error(
|
||||
dcb->session->client,
|
||||
|
||||
@ -33,6 +33,8 @@
|
||||
#include <log_manager.h>
|
||||
#include <mysql_client_server_protocol.h>
|
||||
|
||||
extern int lm_enabled_logfiles_bitmask;
|
||||
|
||||
static char *version_str = "V1.0.0";
|
||||
|
||||
static int gw_MySQLAccept(DCB *listener);
|
||||
@ -462,7 +464,7 @@ int gw_read_client_event(DCB* dcb) {
|
||||
int eno = errno;
|
||||
errno = 0;
|
||||
|
||||
skygw_log_write(
|
||||
LOGIF(LE, (skygw_log_write(
|
||||
LOGFILE_ERROR,
|
||||
"%lu [gw_read_client_event] ioctl FIONREAD for fd "
|
||||
"%d failed. errno %d, %s. dcb->state = %d",
|
||||
@ -470,7 +472,7 @@ int gw_read_client_event(DCB* dcb) {
|
||||
dcb->fd,
|
||||
eno,
|
||||
strerror(eno),
|
||||
dcb->state);
|
||||
dcb->state)));
|
||||
rc = 1;
|
||||
goto return_rc;
|
||||
}
|
||||
@ -605,13 +607,13 @@ int gw_read_client_event(DCB* dcb) {
|
||||
if(rsession == NULL) {
|
||||
/** COM_QUIT */
|
||||
if (mysql_command == '\x01') {
|
||||
skygw_log_write_flush(
|
||||
LOGIF(LD, (skygw_log_write_flush(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu [gw_read_client_event] Client read "
|
||||
"COM_QUIT and rsession == NULL. Closing "
|
||||
"client dcb %p.",
|
||||
pthread_self(),
|
||||
dcb);
|
||||
dcb)));
|
||||
(dcb->func).close(dcb);
|
||||
} else {
|
||||
/* Send a custom error as MySQL command reply */
|
||||
@ -631,12 +633,12 @@ int gw_read_client_event(DCB* dcb) {
|
||||
/** Route COM_QUIT to backend */
|
||||
if (mysql_command == '\x01') {
|
||||
router->routeQuery(router_instance, rsession, queue);
|
||||
skygw_log_write_flush(
|
||||
LOGIF(LD, (skygw_log_write_flush(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu [gw_read_client_event] Routed COM_QUIT to "
|
||||
"backend. Close client dcb %p",
|
||||
pthread_self(),
|
||||
dcb);
|
||||
dcb)));
|
||||
|
||||
/** close client connection */
|
||||
(dcb->func).close(dcb);
|
||||
@ -929,22 +931,22 @@ int gw_MySQLAccept(DCB *listener)
|
||||
* Exceeded system's (ENFILE) or processes
|
||||
* (EMFILE) max. number of files limit.
|
||||
*/
|
||||
skygw_log_write(
|
||||
LOGIF(LD, (skygw_log_write(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu [gw_MySQLAccept] Error %d, %s. ",
|
||||
pthread_self(),
|
||||
eno,
|
||||
strerror(eno));
|
||||
strerror(eno))));
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
skygw_log_write_flush(
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Error %d, %s. "
|
||||
"Failed to accept new client "
|
||||
"connection.",
|
||||
eno,
|
||||
strerror(eno));
|
||||
strerror(eno))));
|
||||
}
|
||||
i++;
|
||||
usleep(100*i*i);
|
||||
@ -960,18 +962,18 @@ int gw_MySQLAccept(DCB *listener)
|
||||
/**
|
||||
* Other error.
|
||||
*/
|
||||
skygw_log_write(
|
||||
LOGIF(LD, (skygw_log_write(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu [gw_MySQLAccept] Error %d, %s.",
|
||||
pthread_self(),
|
||||
eno,
|
||||
strerror(eno));
|
||||
skygw_log_write_flush(
|
||||
strerror(eno))));
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Error %d, %s."
|
||||
"Failed to accept new client connection.",
|
||||
eno,
|
||||
strerror(eno));
|
||||
strerror(eno))));
|
||||
rc = 1;
|
||||
goto return_rc;
|
||||
} /* if (eno == ..) */
|
||||
@ -981,11 +983,11 @@ int gw_MySQLAccept(DCB *listener)
|
||||
|
||||
listener->stats.n_accepts++;
|
||||
#if defined(SS_DEBUG)
|
||||
skygw_log_write_flush(
|
||||
LOGIF(LD, (skygw_log_write_flush(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu [gw_MySQLAccept] Accepted fd %d.",
|
||||
pthread_self(),
|
||||
c_sock);
|
||||
c_sock)));
|
||||
conn_open[c_sock] = true;
|
||||
#endif
|
||||
/* set nonblocking */
|
||||
@ -1003,11 +1005,11 @@ int gw_MySQLAccept(DCB *listener)
|
||||
if (protocol == NULL) {
|
||||
/** delete client_dcb */
|
||||
dcb_close(client_dcb);
|
||||
skygw_log_write_flush(
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"%lu [gw_MySQLAccept] Failed to create "
|
||||
"protocol object for client connection.",
|
||||
pthread_self());
|
||||
pthread_self())));
|
||||
rc = 1;
|
||||
goto return_rc;
|
||||
}
|
||||
@ -1038,25 +1040,25 @@ int gw_MySQLAccept(DCB *listener)
|
||||
dcb_close(client_dcb);
|
||||
|
||||
/** Previous state is recovered in poll_add_dcb. */
|
||||
skygw_log_write_flush(
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"%lu [gw_MySQLAccept] Failed to add dcb %p for "
|
||||
"fd %d to epoll set.",
|
||||
pthread_self(),
|
||||
client_dcb,
|
||||
client_dcb->fd);
|
||||
client_dcb->fd)));
|
||||
rc = 1;
|
||||
goto return_rc;
|
||||
}
|
||||
else
|
||||
{
|
||||
skygw_log_write(
|
||||
LOGIF(LD, (skygw_log_write(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu [gw_MySQLAccept] Added dcb %p for fd "
|
||||
"%d to epoll set.",
|
||||
pthread_self(),
|
||||
client_dcb,
|
||||
client_dcb->fd);
|
||||
client_dcb->fd)));
|
||||
}
|
||||
} /**< while 1 */
|
||||
#if defined(SS_DEBUG)
|
||||
|
||||
@ -33,6 +33,8 @@
|
||||
#include <skygw_utils.h>
|
||||
#include <log_manager.h>
|
||||
|
||||
extern int lm_enabled_logfiles_bitmask;
|
||||
|
||||
extern int gw_read_backend_event(DCB* dcb);
|
||||
extern int gw_write_backend_event(DCB *dcb);
|
||||
extern int gw_MySQLWrite_backend(DCB *dcb, GWBUF *queue);
|
||||
@ -64,13 +66,13 @@ MySQLProtocol* mysql_protocol_init(
|
||||
if (p == NULL) {
|
||||
int eno = errno;
|
||||
errno = 0;
|
||||
skygw_log_write_flush(
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"%lu [mysql_init_protocol] MySQL protocol init failed : "
|
||||
"memory allocation due error %d, %s.",
|
||||
pthread_self(),
|
||||
eno,
|
||||
strerror(eno));
|
||||
strerror(eno))));
|
||||
goto return_p;
|
||||
}
|
||||
p->state = MYSQL_ALLOC;
|
||||
@ -326,7 +328,7 @@ int gw_receive_backend_auth(
|
||||
uint8_t* tmpbuf =
|
||||
(uint8_t *)calloc(1, GWBUF_LENGTH(head)+1);
|
||||
memcpy(tmpbuf, ptr, GWBUF_LENGTH(head));
|
||||
skygw_log_write(
|
||||
LOGIF(LD, (skygw_log_write(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu [gw_receive_backend_auth] Invalid "
|
||||
"authentication message from backend dcb %p "
|
||||
@ -335,12 +337,12 @@ int gw_receive_backend_auth(
|
||||
dcb,
|
||||
dcb->fd,
|
||||
tmpbuf[4],
|
||||
tmpbuf);
|
||||
tmpbuf)));
|
||||
|
||||
skygw_log_write_flush(
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Error : Invalid authentication message from "
|
||||
"backend server. Authentication failed.");
|
||||
"backend server. Authentication failed.")));
|
||||
free(tmpbuf);
|
||||
rc = -1;
|
||||
}
|
||||
@ -356,7 +358,7 @@ int gw_receive_backend_auth(
|
||||
* although no bytes was read.
|
||||
*/
|
||||
rc = 0;
|
||||
skygw_log_write(
|
||||
LOGIF(LD, (skygw_log_write(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu [gw_receive_backend_auth] Read zero bytes from "
|
||||
"backend dcb %p fd %d in state %s. n %d, head %p, len %d",
|
||||
@ -366,13 +368,13 @@ int gw_receive_backend_auth(
|
||||
STRDCBSTATE(dcb->state),
|
||||
n,
|
||||
head,
|
||||
(head == NULL) ? 0 : GWBUF_LENGTH(head));
|
||||
(head == NULL) ? 0 : GWBUF_LENGTH(head))));
|
||||
}
|
||||
else
|
||||
{
|
||||
ss_dassert(n < 0 && head == NULL);
|
||||
rc = -1;
|
||||
skygw_log_write(
|
||||
LOGIF(LD, (skygw_log_write(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu [gw_receive_backend_auth] Reading from backend dcb %p "
|
||||
"fd %d in state %s failed. n %d, head %p, len %d",
|
||||
@ -382,7 +384,7 @@ int gw_receive_backend_auth(
|
||||
STRDCBSTATE(dcb->state),
|
||||
n,
|
||||
head,
|
||||
(head == NULL) ? 0 : GWBUF_LENGTH(head));
|
||||
(head == NULL) ? 0 : GWBUF_LENGTH(head))));
|
||||
}
|
||||
|
||||
return rc;
|
||||
@ -615,7 +617,7 @@ int gw_do_connect_to_backend(
|
||||
if (so < 0) {
|
||||
int eno = errno;
|
||||
errno = 0;
|
||||
skygw_log_write_flush(
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Error: Establishing connection to backend server "
|
||||
"%s:%d failed. Socket creation failed due "
|
||||
@ -623,7 +625,7 @@ int gw_do_connect_to_backend(
|
||||
host,
|
||||
port,
|
||||
eno,
|
||||
strerror(eno));
|
||||
strerror(eno))));
|
||||
rv = -1;
|
||||
goto return_rv;
|
||||
}
|
||||
@ -644,40 +646,40 @@ int gw_do_connect_to_backend(
|
||||
int rc;
|
||||
int oldfd = so;
|
||||
|
||||
skygw_log_write_flush(
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Error: Failed to connect backend server %s:%d, "
|
||||
"due %d, %s.",
|
||||
host,
|
||||
port,
|
||||
eno,
|
||||
strerror(eno));
|
||||
strerror(eno))));
|
||||
/** Close newly created socket. */
|
||||
rc = close(so);
|
||||
|
||||
if (rc != 0) {
|
||||
int eno = errno;
|
||||
errno = 0;
|
||||
skygw_log_write_flush(
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Error: Failed to "
|
||||
"close socket %d due %d, %s.",
|
||||
oldfd,
|
||||
eno,
|
||||
strerror(eno));
|
||||
strerror(eno))));
|
||||
}
|
||||
goto return_rv;
|
||||
}
|
||||
}
|
||||
*fd = so;
|
||||
skygw_log_write_flush(
|
||||
LOGIF(LD, (skygw_log_write_flush(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu [gw_do_connect_to_backend] Connected to backend server "
|
||||
"%s:%d, fd %d.",
|
||||
pthread_self(),
|
||||
host,
|
||||
port,
|
||||
so);
|
||||
so)));
|
||||
#if defined(SS_DEBUG)
|
||||
conn_open[so] = true;
|
||||
#endif
|
||||
@ -1173,13 +1175,13 @@ mysql_send_auth_error (DCB *dcb, int packet_number, int in_affected_rows, const
|
||||
|
||||
if (dcb->state != DCB_STATE_POLLING)
|
||||
{
|
||||
skygw_log_write(
|
||||
LOGIF(LD, (skygw_log_write(
|
||||
LOGFILE_DEBUG,
|
||||
"%lu [mysql_send_auth_error] dcb %p is in a state %s, "
|
||||
"and it is not in epoll set anymore. Skip error sending.",
|
||||
pthread_self(),
|
||||
dcb,
|
||||
STRDCBSTATE(dcb->state));
|
||||
STRDCBSTATE(dcb->state))));
|
||||
return 0;
|
||||
}
|
||||
mysql_errno = 1045;
|
||||
|
||||
@ -37,6 +37,8 @@
|
||||
#include <skygw_utils.h>
|
||||
#include <log_manager.h>
|
||||
|
||||
extern int lm_enabled_logfiles_bitmask;
|
||||
|
||||
/**
|
||||
* @file telnetd.c - telnet daemon protocol module
|
||||
*
|
||||
@ -107,7 +109,9 @@ version()
|
||||
void
|
||||
ModuleInit()
|
||||
{
|
||||
skygw_log_write(LOGFILE_TRACE, "Initialise Telnetd Protocol module.\n");
|
||||
LOGIF(LT, (skygw_log_write(
|
||||
LOGFILE_TRACE,
|
||||
"Initialise Telnetd Protocol module.\n")));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user