Removed undefined function declaration. Added trace and error log.

This commit is contained in:
vraatikka
2013-08-23 23:25:12 +03:00
parent e345b23bcf
commit df5f2f29b2

View File

@ -41,7 +41,6 @@
*/ */
static char *version_str = "V2.0.0"; static char *version_str = "V2.0.0";
int gw_mysql_connect(char *host, int port, char *dbname, char *user, uint8_t *passwd, MySQLProtocol *conn);
static int gw_create_backend_connection(DCB *backend, SERVER *server, SESSION *in_session); static int gw_create_backend_connection(DCB *backend, SERVER *server, SESSION *in_session);
static int gw_read_backend_event(DCB* dcb); static int gw_read_backend_event(DCB* dcb);
static int gw_write_backend_event(DCB *dcb); static int gw_write_backend_event(DCB *dcb);
@ -170,8 +169,7 @@ static int gw_read_backend_event(DCB *dcb) {
LOGFILE_ERROR, LOGFILE_ERROR,
"%lu [gw_read_backend_event] caught " "%lu [gw_read_backend_event] caught "
"MYSQL_FAILED_AUTHENTICATION from " "MYSQL_FAILED_AUTHENTICATION from "
"gw_receive_backend_auth. Fd %d, user %s. " "gw_receive_backend_auth. Fd %d, user %s.",
"Closing the session.",
pthread_self(), pthread_self(),
dcb->fd, dcb->fd,
current_session->user); current_session->user);
@ -193,8 +191,20 @@ static int gw_read_backend_event(DCB *dcb) {
spinlock_release(&session->ses_lock); spinlock_release(&session->ses_lock);
if (rsession != NULL) { if (rsession != NULL) {
skygw_log_write(
LOGFILE_TRACE,
"%lu [gw_read_backend_event] Call "
"closeSession for backend session.",
pthread_self());
/* close the active session */ /* close the active session */
router->closeSession(router_instance, rsession); router->closeSession(router_instance, rsession);
} else {
skygw_log_write(
LOGFILE_TRACE,
"%lu [gw_read_backend_event] "
"closeSession already called for "
"backend session.",
pthread_self());
} }
return 1; return 1;
@ -379,23 +389,19 @@ static int gw_create_backend_connection(DCB *backend, SERVER *server, SESSION *s
memcpy(&backend->fd, &protocol->fd, sizeof(backend->fd)); memcpy(&backend->fd, &protocol->fd, sizeof(backend->fd));
switch (rv) { switch (rv) {
case 0: case 0:
//fprintf(stderr, "Connected to backend mysql server: fd is %i\n", backend->fd); //fprintf(stderr, "Connected to backend mysql server: fd is %i\n", backend->fd);
protocol->state = MYSQL_CONNECTED; protocol->state = MYSQL_CONNECTED;
break; break;
case 1: case 1:
//fprintf(stderr, ">>> Connection is PENDING to backend mysql server: fd is %i\n", backend->fd); //fprintf(stderr, ">>> Connection is PENDING to backend mysql server: fd is %i\n", backend->fd);
protocol->state = MYSQL_PENDING_CONNECT; protocol->state = MYSQL_PENDING_CONNECT;
break; break;
default: default:
fprintf(stderr, ">>> ERROR: NOT Connected to the backend mysql server!!!\n"); fprintf(stderr, ">>> ERROR: NOT Connected to the backend mysql server!!!\n");
backend->fd = -1; backend->fd = -1;
break; break;
} }
@ -404,7 +410,6 @@ static int gw_create_backend_connection(DCB *backend, SERVER *server, SESSION *s
} }
backend->state = DCB_STATE_POLLING; backend->state = DCB_STATE_POLLING;
return backend->fd; return backend->fd;
} }