Merge branch 'develop' into firewall
This commit is contained in:
@ -184,7 +184,8 @@ char c;
|
|||||||
}
|
}
|
||||||
|
|
||||||
cmd = malloc(len);
|
cmd = malloc(len);
|
||||||
strcpy(cmd, argv[optind]);
|
int arglen;
|
||||||
|
memcpy(cmd, argv[optind], (arglen = strlen(argv[optind])) < 8192 ? arglen : 8192);
|
||||||
for (i = optind +1; i < argc; i++) {
|
for (i = optind +1; i < argc; i++) {
|
||||||
strcat(cmd, " ");
|
strcat(cmd, " ");
|
||||||
strcat(cmd, argv[i]);
|
strcat(cmd, argv[i]);
|
||||||
@ -317,6 +318,7 @@ int keepalive = 1;
|
|||||||
{
|
{
|
||||||
fprintf(stderr, "Unable to connect to MaxScale at %s, %s: %s\n",
|
fprintf(stderr, "Unable to connect to MaxScale at %s, %s: %s\n",
|
||||||
hostname, port, strerror(errno));
|
hostname, port, strerror(errno));
|
||||||
|
close(so);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (setsockopt(so, SOL_SOCKET,
|
if (setsockopt(so, SOL_SOCKET,
|
||||||
|
@ -78,7 +78,12 @@ int main(int argc, char** argv)
|
|||||||
for(i = 0;i<iterations;i++){
|
for(i = 0;i<iterations;i++){
|
||||||
|
|
||||||
sprintf(message,"message|%ld",msg_index++);
|
sprintf(message,"message|%ld",msg_index++);
|
||||||
memset(message + strlen(message),' ',block_size - strlen(message));
|
int msgsize = block_size - strlen(message);
|
||||||
|
if(msgsize < 0 || msgsize > 8192){
|
||||||
|
fprintf(stderr,"Error: Message too long");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
memset(message + strlen(message), ' ', msgsize);
|
||||||
memset(message + block_size - 1,'\0',1);
|
memset(message + block_size - 1,'\0',1);
|
||||||
if(interval > 0 && i % interval == 0){
|
if(interval > 0 && i % interval == 0){
|
||||||
err = skygw_log_write_flush(LOGFILE_ERROR, message);
|
err = skygw_log_write_flush(LOGFILE_ERROR, message);
|
||||||
@ -90,7 +95,6 @@ int main(int argc, char** argv)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
usleep(100);
|
usleep(100);
|
||||||
//printf("%s\n",message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
skygw_log_flush(LOGFILE_ERROR);
|
skygw_log_flush(LOGFILE_ERROR);
|
||||||
|
@ -1049,10 +1049,11 @@ char** skygw_get_table_names(GWBUF* querybuf,int* tblsize, bool fullnames)
|
|||||||
TABLE_LIST* tbl;
|
TABLE_LIST* tbl;
|
||||||
int i = 0,
|
int i = 0,
|
||||||
currtblsz = 0;
|
currtblsz = 0;
|
||||||
char **tables,
|
char **tables = NULL,
|
||||||
**tmp;
|
**tmp = NULL;
|
||||||
|
|
||||||
if((lex = get_lex(querybuf)) == NULL)
|
if( (lex = get_lex(querybuf)) == NULL ||
|
||||||
|
lex->current_select == NULL )
|
||||||
{
|
{
|
||||||
goto retblock;
|
goto retblock;
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ int main(int argc, char** argv)
|
|||||||
*(qbuff->sbuf->data + 1) = (unsigned char)(psize>>8);
|
*(qbuff->sbuf->data + 1) = (unsigned char)(psize>>8);
|
||||||
*(qbuff->sbuf->data + 2) = (unsigned char)(psize>>16);
|
*(qbuff->sbuf->data + 2) = (unsigned char)(psize>>16);
|
||||||
*(qbuff->sbuf->data + 4) = 0x03;
|
*(qbuff->sbuf->data + 4) = 0x03;
|
||||||
strcpy((char*)(qbuff->start + 5),readbuff);
|
memcpy(qbuff->start + 5,readbuff,psize + 1);
|
||||||
parse_query(qbuff);
|
parse_query(qbuff);
|
||||||
tok = skygw_get_canonical(qbuff);
|
tok = skygw_get_canonical(qbuff);
|
||||||
fprintf(outfile,"%s\n",tok);
|
fprintf(outfile,"%s\n",tok);
|
||||||
|
@ -45,8 +45,8 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
input = fopen(argv[1],"rb");
|
input = fopen(argv[1],"rb");
|
||||||
expected = fopen(argv[2],"rb");
|
expected = fopen(argv[2],"rb");
|
||||||
|
memset(buffer,0,buffsz);
|
||||||
while((rd = fread(buffer,sizeof(char),buffsz,input))){
|
while((rd = fread(buffer,sizeof(char),buffsz - 1,input))){
|
||||||
|
|
||||||
/**Fill the read buffer*/
|
/**Fill the read buffer*/
|
||||||
if(strsz + rd >= buffsz){
|
if(strsz + rd >= buffsz){
|
||||||
@ -167,7 +167,7 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
gwbuf_free(buff);
|
gwbuf_free(buff);
|
||||||
}
|
}
|
||||||
|
memset(buffer,0,buffsz);
|
||||||
}
|
}
|
||||||
fclose(input);
|
fclose(input);
|
||||||
fclose(expected);
|
fclose(expected);
|
||||||
|
@ -116,10 +116,12 @@ char fname[1024], *home;
|
|||||||
char uname[80], passwd[80];
|
char uname[80], passwd[80];
|
||||||
|
|
||||||
initialise();
|
initialise();
|
||||||
if ((home = getenv("MAXSCALE_HOME")) != NULL)
|
if ((home = getenv("MAXSCALE_HOME")) != NULL && strlen(home) < 1024){
|
||||||
sprintf(fname, "%s/etc/passwd", home);
|
sprintf(fname, "%s/etc/passwd", home);
|
||||||
else
|
}
|
||||||
|
else{
|
||||||
sprintf(fname, "/usr/local/skysql/MaxScale/etc/passwd");
|
sprintf(fname, "/usr/local/skysql/MaxScale/etc/passwd");
|
||||||
|
}
|
||||||
if ((fp = fopen(fname, "r")) == NULL)
|
if ((fp = fopen(fname, "r")) == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
if ((rval = users_alloc()) == NULL)
|
if ((rval = users_alloc()) == NULL)
|
||||||
@ -150,10 +152,12 @@ FILE *fp;
|
|||||||
char fname[1024], *home, *cpasswd;
|
char fname[1024], *home, *cpasswd;
|
||||||
|
|
||||||
initialise();
|
initialise();
|
||||||
if ((home = getenv("MAXSCALE_HOME")) != NULL)
|
if ((home = getenv("MAXSCALE_HOME")) != NULL && strlen(home) < 1024){
|
||||||
sprintf(fname, "%s/etc/passwd", home);
|
sprintf(fname, "%s/etc/passwd", home);
|
||||||
else
|
}
|
||||||
|
else{
|
||||||
sprintf(fname, "/usr/local/skysql/MaxScale/etc/passwd");
|
sprintf(fname, "/usr/local/skysql/MaxScale/etc/passwd");
|
||||||
|
}
|
||||||
|
|
||||||
if (users == NULL)
|
if (users == NULL)
|
||||||
{
|
{
|
||||||
@ -246,7 +250,7 @@ char* admin_remove_user(
|
|||||||
/**
|
/**
|
||||||
* Open passwd file and remove user from the file.
|
* Open passwd file and remove user from the file.
|
||||||
*/
|
*/
|
||||||
if ((home = getenv("MAXSCALE_HOME")) != NULL) {
|
if ((home = getenv("MAXSCALE_HOME")) != NULL && strlen(home) < 1024) {
|
||||||
sprintf(fname, "%s/etc/passwd", home);
|
sprintf(fname, "%s/etc/passwd", home);
|
||||||
sprintf(fname_tmp, "%s/etc/passwd_tmp", home);
|
sprintf(fname_tmp, "%s/etc/passwd_tmp", home);
|
||||||
} else {
|
} else {
|
||||||
@ -310,7 +314,12 @@ char* admin_remove_user(
|
|||||||
* Unmatching lines are copied to tmp file.
|
* Unmatching lines are copied to tmp file.
|
||||||
*/
|
*/
|
||||||
if (strncmp(uname, fusr, strlen(uname)+1) != 0) {
|
if (strncmp(uname, fusr, strlen(uname)+1) != 0) {
|
||||||
fsetpos(fp, &rpos); /** one step back */
|
if(fsetpos(fp, &rpos) != 0){ /** one step back */
|
||||||
|
LOGIF(LE, (skygw_log_write_flush(
|
||||||
|
LOGFILE_ERROR,
|
||||||
|
"Error : Unable to set stream position. ")));
|
||||||
|
|
||||||
|
}
|
||||||
fgets(line, LINELEN, fp);
|
fgets(line, LINELEN, fp);
|
||||||
fputs(line, fp_tmp);
|
fputs(line, fp_tmp);
|
||||||
}
|
}
|
||||||
|
@ -517,9 +517,11 @@ void* gwbuf_get_buffer_object_data(
|
|||||||
}
|
}
|
||||||
/** Unlock */
|
/** Unlock */
|
||||||
spinlock_release(&buf->gwbuf_lock);
|
spinlock_release(&buf->gwbuf_lock);
|
||||||
|
if(bo){
|
||||||
return bo->bo_data;
|
return bo->bo_data;
|
||||||
}
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return pointer to next buffer object or NULL
|
* @return pointer to next buffer object or NULL
|
||||||
|
@ -461,6 +461,7 @@ int error_count = 0;
|
|||||||
|
|
||||||
if (!succp)
|
if (!succp)
|
||||||
{
|
{
|
||||||
|
if(param){
|
||||||
LOGIF(LM, (skygw_log_write(
|
LOGIF(LM, (skygw_log_write(
|
||||||
LOGFILE_MESSAGE,
|
LOGFILE_MESSAGE,
|
||||||
"* Warning : invalid value type "
|
"* Warning : invalid value type "
|
||||||
@ -470,6 +471,12 @@ int error_count = 0;
|
|||||||
((SERVICE*)obj->element)->name,
|
((SERVICE*)obj->element)->name,
|
||||||
param->name,
|
param->name,
|
||||||
param->value)));
|
param->value)));
|
||||||
|
}else{
|
||||||
|
LOGIF(LE, (skygw_log_write(
|
||||||
|
LOGFILE_ERROR,
|
||||||
|
"Error : parameter was NULL")));
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} /*< if (rw_split) */
|
} /*< if (rw_split) */
|
||||||
@ -1306,6 +1313,7 @@ SERVER *server;
|
|||||||
|
|
||||||
if (!succp)
|
if (!succp)
|
||||||
{
|
{
|
||||||
|
if(param){
|
||||||
LOGIF(LM, (skygw_log_write(
|
LOGIF(LM, (skygw_log_write(
|
||||||
LOGFILE_MESSAGE,
|
LOGFILE_MESSAGE,
|
||||||
"* Warning : invalid value type "
|
"* Warning : invalid value type "
|
||||||
@ -1315,6 +1323,11 @@ SERVER *server;
|
|||||||
((SERVICE*)obj->element)->name,
|
((SERVICE*)obj->element)->name,
|
||||||
param->name,
|
param->name,
|
||||||
param->value)));
|
param->value)));
|
||||||
|
}else{
|
||||||
|
LOGIF(LE, (skygw_log_write(
|
||||||
|
LOGFILE_ERROR,
|
||||||
|
"Error : parameter was NULL")));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1346,7 +1359,7 @@ SERVER *server;
|
|||||||
serviceSetUser(obj->element,
|
serviceSetUser(obj->element,
|
||||||
user,
|
user,
|
||||||
auth);
|
auth);
|
||||||
if (enable_root_user)
|
if (enable_root_user && service)
|
||||||
serviceEnableRootUser(service, atoi(enable_root_user));
|
serviceEnableRootUser(service, atoi(enable_root_user));
|
||||||
|
|
||||||
if (allow_localhost_match_wildcard_host)
|
if (allow_localhost_match_wildcard_host)
|
||||||
|
@ -855,9 +855,6 @@ static int uh_cmpfun( void* v1, void* v2) {
|
|||||||
if (v1 == NULL || v2 == NULL)
|
if (v1 == NULL || v2 == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (hu1 == NULL || hu2 == NULL)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (hu1->user == NULL || hu2->user == NULL)
|
if (hu1->user == NULL || hu2->user == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -961,9 +958,6 @@ char *mysql_format_user_entry(void *data)
|
|||||||
|
|
||||||
entry = (MYSQL_USER_HOST *) data;
|
entry = (MYSQL_USER_HOST *) data;
|
||||||
|
|
||||||
if (entry == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
mysql_user = (char *) calloc(mysql_user_len, sizeof(char));
|
mysql_user = (char *) calloc(mysql_user_len, sizeof(char));
|
||||||
|
|
||||||
if (mysql_user == NULL)
|
if (mysql_user == NULL)
|
||||||
|
@ -1155,10 +1155,9 @@ dcb_close(DCB *dcb)
|
|||||||
} else {
|
} else {
|
||||||
LOGIF(LE, (skygw_log_write(
|
LOGIF(LE, (skygw_log_write(
|
||||||
LOGFILE_ERROR,
|
LOGFILE_ERROR,
|
||||||
"%lu [dcb_close] Error : Removing dcb %p in state %s from "
|
"Error : Removing DCB fd == %d in state %s from "
|
||||||
"poll set failed.",
|
"poll set failed.",
|
||||||
pthread_self(),
|
dcb->fd,
|
||||||
dcb,
|
|
||||||
STRDCBSTATE(dcb->state))));
|
STRDCBSTATE(dcb->state))));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1670,7 +1669,7 @@ static bool dcb_set_state_nomutex(
|
|||||||
"Old state %s > new state %s.",
|
"Old state %s > new state %s.",
|
||||||
pthread_self(),
|
pthread_self(),
|
||||||
dcb,
|
dcb,
|
||||||
STRDCBSTATE(*old_state),
|
(old_state == NULL ? "NULL" : STRDCBSTATE(*old_state)),
|
||||||
STRDCBSTATE(new_state))));
|
STRDCBSTATE(new_state))));
|
||||||
}
|
}
|
||||||
return succp;
|
return succp;
|
||||||
|
@ -479,6 +479,11 @@ static bool resolve_maxscale_conf_fname(
|
|||||||
goto return_succp;
|
goto return_succp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/** Allocate memory for use of realpath */
|
||||||
|
*cnf_full_path = (char *)malloc(PATH_MAX+1);
|
||||||
|
}
|
||||||
/*<
|
/*<
|
||||||
* 3. argument is valid relative pathname
|
* 3. argument is valid relative pathname
|
||||||
* '-f ../myconf.cnf'
|
* '-f ../myconf.cnf'
|
||||||
@ -1521,7 +1526,12 @@ int main(int argc, char **argv)
|
|||||||
* machine.
|
* machine.
|
||||||
*/
|
*/
|
||||||
sprintf(datadir, "%s/data%d", home_dir, getpid());
|
sprintf(datadir, "%s/data%d", home_dir, getpid());
|
||||||
mkdir(datadir, 0777);
|
if(mkdir(datadir, 0777) != 0){
|
||||||
|
LOGIF(LE,(skygw_log_write_flush(
|
||||||
|
LOGFILE_ERROR,
|
||||||
|
"Error : Directory creation failed due to %s.",
|
||||||
|
strerror(errno))));
|
||||||
|
}
|
||||||
|
|
||||||
if (!daemon_mode)
|
if (!daemon_mode)
|
||||||
{
|
{
|
||||||
@ -1700,10 +1710,6 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
thread_wait(threads[n]);
|
thread_wait(threads[n]);
|
||||||
}
|
}
|
||||||
free(threads);
|
|
||||||
free(home_dir);
|
|
||||||
free(cnf_file_path);
|
|
||||||
|
|
||||||
/*<
|
/*<
|
||||||
* Wait the flush thread.
|
* Wait the flush thread.
|
||||||
*/
|
*/
|
||||||
@ -1727,6 +1733,10 @@ int main(int argc, char **argv)
|
|||||||
unlink_pidfile();
|
unlink_pidfile();
|
||||||
|
|
||||||
return_main:
|
return_main:
|
||||||
|
free(threads);
|
||||||
|
free(home_dir);
|
||||||
|
free(cnf_file_path);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
} /*< End of main */
|
} /*< End of main */
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ unsigned char mask;
|
|||||||
{
|
{
|
||||||
bitmask->bits = realloc(bitmask->bits,
|
bitmask->bits = realloc(bitmask->bits,
|
||||||
(bitmask->length + BIT_LENGTH_INC) / 8);
|
(bitmask->length + BIT_LENGTH_INC) / 8);
|
||||||
memset(bitmask + (bitmask->length / 8), 0,
|
memset(bitmask->bits + (bitmask->length / 8), 0,
|
||||||
BIT_LENGTH_INC / 8);
|
BIT_LENGTH_INC / 8);
|
||||||
bitmask->length += (BIT_LENGTH_INC / 8);
|
bitmask->length += (BIT_LENGTH_INC / 8);
|
||||||
}
|
}
|
||||||
@ -150,7 +150,7 @@ unsigned char mask;
|
|||||||
{
|
{
|
||||||
bitmask->bits = realloc(bitmask->bits,
|
bitmask->bits = realloc(bitmask->bits,
|
||||||
(bitmask->length + BIT_LENGTH_INC) / 8);
|
(bitmask->length + BIT_LENGTH_INC) / 8);
|
||||||
memset(bitmask + (bitmask->length / 8), 0,
|
memset(bitmask->bits + (bitmask->length / 8), 0,
|
||||||
BIT_LENGTH_INC / 8);
|
BIT_LENGTH_INC / 8);
|
||||||
bitmask->length += (BIT_LENGTH_INC / 8);
|
bitmask->length += (BIT_LENGTH_INC / 8);
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
*/
|
*/
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <errno.h>
|
||||||
#include <filter.h>
|
#include <filter.h>
|
||||||
#include <modinfo.h>
|
#include <modinfo.h>
|
||||||
#include <modutil.h>
|
#include <modutil.h>
|
||||||
@ -170,10 +171,11 @@ int i;
|
|||||||
|
|
||||||
if ((my_instance = calloc(1, sizeof(QLA_INSTANCE))) != NULL)
|
if ((my_instance = calloc(1, sizeof(QLA_INSTANCE))) != NULL)
|
||||||
{
|
{
|
||||||
if (options)
|
if (options){
|
||||||
my_instance->filebase = strdup(options[0]);
|
my_instance->filebase = strdup(options[0]);
|
||||||
else
|
}else{
|
||||||
my_instance->filebase = strdup("qla");
|
my_instance->filebase = strdup("qla");
|
||||||
|
}
|
||||||
my_instance->source = NULL;
|
my_instance->source = NULL;
|
||||||
my_instance->userName = NULL;
|
my_instance->userName = NULL;
|
||||||
my_instance->match = NULL;
|
my_instance->match = NULL;
|
||||||
@ -196,8 +198,10 @@ int i;
|
|||||||
my_instance->userName = strdup(params[i]->value);
|
my_instance->userName = strdup(params[i]->value);
|
||||||
else if (!strcmp(params[i]->name, "filebase"))
|
else if (!strcmp(params[i]->name, "filebase"))
|
||||||
{
|
{
|
||||||
if (my_instance->filebase)
|
if (my_instance->filebase){
|
||||||
free(my_instance->filebase);
|
free(my_instance->filebase);
|
||||||
|
my_instance->filebase = NULL;
|
||||||
|
}
|
||||||
my_instance->source = strdup(params[i]->value);
|
my_instance->source = strdup(params[i]->value);
|
||||||
}
|
}
|
||||||
else if (!filter_standard_parameter(params[i]->name))
|
else if (!filter_standard_parameter(params[i]->name))
|
||||||
@ -219,7 +223,9 @@ int i;
|
|||||||
my_instance->match)));
|
my_instance->match)));
|
||||||
free(my_instance->match);
|
free(my_instance->match);
|
||||||
free(my_instance->source);
|
free(my_instance->source);
|
||||||
|
if(my_instance->filebase){
|
||||||
free(my_instance->filebase);
|
free(my_instance->filebase);
|
||||||
|
}
|
||||||
free(my_instance);
|
free(my_instance);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -235,7 +241,9 @@ int i;
|
|||||||
regfree(&my_instance->re);
|
regfree(&my_instance->re);
|
||||||
free(my_instance->match);
|
free(my_instance->match);
|
||||||
free(my_instance->source);
|
free(my_instance->source);
|
||||||
|
if(my_instance->filebase){
|
||||||
free(my_instance->filebase);
|
free(my_instance->filebase);
|
||||||
|
}
|
||||||
free(my_instance);
|
free(my_instance);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -265,10 +273,17 @@ char *remote, *userName;
|
|||||||
(char *)malloc(strlen(my_instance->filebase) + 20))
|
(char *)malloc(strlen(my_instance->filebase) + 20))
|
||||||
== NULL)
|
== NULL)
|
||||||
{
|
{
|
||||||
|
LOGIF(LE, (skygw_log_write(
|
||||||
|
LOGFILE_ERROR,
|
||||||
|
"Error : Memory allocation for qla filter "
|
||||||
|
"file name failed due to %d, %s.",
|
||||||
|
errno,
|
||||||
|
strerror(errno))));
|
||||||
free(my_session);
|
free(my_session);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
my_session->active = 1;
|
my_session->active = 1;
|
||||||
|
|
||||||
if (my_instance->source
|
if (my_instance->source
|
||||||
&& (remote = session_get_remote(session)) != NULL)
|
&& (remote = session_get_remote(session)) != NULL)
|
||||||
{
|
{
|
||||||
@ -276,16 +291,45 @@ char *remote, *userName;
|
|||||||
my_session->active = 0;
|
my_session->active = 0;
|
||||||
}
|
}
|
||||||
userName = session_getUser(session);
|
userName = session_getUser(session);
|
||||||
if (my_instance->userName && userName && strcmp(userName,
|
|
||||||
my_instance->userName))
|
if (my_instance->userName &&
|
||||||
|
userName &&
|
||||||
|
strcmp(userName,my_instance->userName))
|
||||||
|
{
|
||||||
my_session->active = 0;
|
my_session->active = 0;
|
||||||
sprintf(my_session->filename, "%s.%d", my_instance->filebase,
|
}
|
||||||
|
sprintf(my_session->filename, "%s.%d",
|
||||||
|
my_instance->filebase,
|
||||||
my_instance->sessions);
|
my_instance->sessions);
|
||||||
my_instance->sessions++;
|
my_instance->sessions++;
|
||||||
if (my_session->active)
|
|
||||||
my_session->fp = fopen(my_session->filename, "w");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (my_session->active)
|
||||||
|
{
|
||||||
|
my_session->fp = fopen(my_session->filename, "w");
|
||||||
|
|
||||||
|
if (my_session->fp == NULL)
|
||||||
|
{
|
||||||
|
LOGIF(LE, (skygw_log_write(
|
||||||
|
LOGFILE_ERROR,
|
||||||
|
"Error : Opening output file for qla "
|
||||||
|
"fileter failed due to %d, %s",
|
||||||
|
errno,
|
||||||
|
strerror(errno))));
|
||||||
|
free(my_session->filename);
|
||||||
|
free(my_session);
|
||||||
|
my_session = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOGIF(LE, (skygw_log_write(
|
||||||
|
LOGFILE_ERROR,
|
||||||
|
"Error : Memory allocation for qla filter failed due to "
|
||||||
|
"%d, %s.",
|
||||||
|
errno,
|
||||||
|
strerror(errno))));
|
||||||
|
}
|
||||||
return my_session;
|
return my_session;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,7 +391,7 @@ routeQuery(FILTER *instance, void *session, GWBUF *queue)
|
|||||||
TEE_INSTANCE *my_instance = (TEE_INSTANCE *)instance;
|
TEE_INSTANCE *my_instance = (TEE_INSTANCE *)instance;
|
||||||
TEE_SESSION *my_session = (TEE_SESSION *)session;
|
TEE_SESSION *my_session = (TEE_SESSION *)session;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
int length, rval, residual;
|
int length, rval, residual = 0;
|
||||||
GWBUF *clone = NULL;
|
GWBUF *clone = NULL;
|
||||||
|
|
||||||
if (my_session->residual)
|
if (my_session->residual)
|
||||||
|
@ -270,6 +270,7 @@ int n_connect = 0;
|
|||||||
if (client_dcb == NULL)
|
if (client_dcb == NULL)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
close(so);
|
||||||
return n_connect;
|
return n_connect;
|
||||||
}
|
}
|
||||||
client_dcb->fd = so;
|
client_dcb->fd = so;
|
||||||
|
@ -298,6 +298,7 @@ int n_connect = 0;
|
|||||||
if (client_dcb == NULL)
|
if (client_dcb == NULL)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
close(so);
|
||||||
return n_connect;
|
return n_connect;
|
||||||
}
|
}
|
||||||
client_dcb->fd = so;
|
client_dcb->fd = so;
|
||||||
|
@ -1356,7 +1356,7 @@ static route_target_t get_route_target (
|
|||||||
hint = hint->next;
|
hint = hint->next;
|
||||||
} /*< while (hint != NULL) */
|
} /*< while (hint != NULL) */
|
||||||
/** If nothing matches then choose the master */
|
/** If nothing matches then choose the master */
|
||||||
if ((target & (TARGET_ALL|TARGET_SLAVE|TARGET_MASTER)) == target)
|
if ((target & (TARGET_ALL|TARGET_SLAVE|TARGET_MASTER)) == 0)
|
||||||
{
|
{
|
||||||
target = TARGET_MASTER;
|
target = TARGET_MASTER;
|
||||||
}
|
}
|
||||||
@ -1520,13 +1520,20 @@ skygw_query_type_t is_read_tmp_table(
|
|||||||
}
|
}
|
||||||
|
|
||||||
free(hkey);
|
free(hkey);
|
||||||
free(tbl[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
free(tbl);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(tsize > 0)
|
||||||
|
{
|
||||||
|
for(i = 0; i<tsize;i++)
|
||||||
|
{
|
||||||
|
free(tbl[i]);
|
||||||
|
}
|
||||||
|
free(tbl);
|
||||||
|
}
|
||||||
|
|
||||||
return qtype;
|
return qtype;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2631,7 +2638,12 @@ static bool select_connect_backend_servers(
|
|||||||
/* get the root Master */
|
/* get the root Master */
|
||||||
master_host = get_root_master(backend_ref, router_nservers);
|
master_host = get_root_master(backend_ref, router_nservers);
|
||||||
|
|
||||||
/** Master is already chosen and connected. This is slave failure case */
|
/**
|
||||||
|
* Master is already chosen and connected. It means that the function
|
||||||
|
* was called from error handling function or from some other similar
|
||||||
|
* function where session was already established but new slaves needed
|
||||||
|
* to be selected.
|
||||||
|
*/
|
||||||
if (*p_master_ref != NULL &&
|
if (*p_master_ref != NULL &&
|
||||||
BREF_IS_IN_USE((*p_master_ref)))
|
BREF_IS_IN_USE((*p_master_ref)))
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user