Merge branch 'develop' into MAX-324
This commit is contained in:
@ -385,7 +385,7 @@ getDatabases(SERVICE *service, MYSQL *con)
|
||||
"%s: Unable to load database grant information, MaxScale "
|
||||
"authentication will proceed without including database "
|
||||
"permissions. To correct this GRANT select permission "
|
||||
"on msql.db to the user %s.",
|
||||
"on mysql.db to the user %s.",
|
||||
service->name, service_user)));
|
||||
}
|
||||
|
||||
|
@ -991,7 +991,7 @@ static void usage(void)
|
||||
" -f|--config=... relative|absolute pathname of MaxScale configuration file\n"
|
||||
" (default: $MAXSCALE_HOME/etc/MaxScale.cnf)\n"
|
||||
" -l|--log=... log to file or shared memory\n"
|
||||
" -lfile or -lshm - defaults to shared memory\n"
|
||||
" -lfile or -lshm - defaults to file\n"
|
||||
" -v|--version print version info and exit\n"
|
||||
" -?|--help show this help\n"
|
||||
, progname);
|
||||
@ -1039,6 +1039,7 @@ int main(int argc, char **argv)
|
||||
int l;
|
||||
int i;
|
||||
int n;
|
||||
intptr_t thread_id;
|
||||
int n_threads; /*< number of epoll listener threads */
|
||||
int n_services;
|
||||
int eno = 0; /*< local variable for errno */
|
||||
@ -1052,7 +1053,7 @@ int main(int argc, char **argv)
|
||||
char* cnf_file_arg = NULL; /*< conf filename from cmd-line arg */
|
||||
void* log_flush_thr = NULL;
|
||||
int option_index;
|
||||
int logtofile = 0; /* Use shared memory or file */
|
||||
int logtofile = 1; /* Use shared memory or file */
|
||||
ssize_t log_flush_timeout_ms = 0;
|
||||
sigset_t sigset;
|
||||
sigset_t sigpipe_mask;
|
||||
@ -1788,9 +1789,9 @@ int main(int argc, char **argv)
|
||||
/*<
|
||||
* Start server threads.
|
||||
*/
|
||||
for (n = 0; n < n_threads - 1; n++)
|
||||
for (thread_id = 0; thread_id < n_threads - 1; thread_id++)
|
||||
{
|
||||
threads[n] = thread_start(poll_waitevents, (void *)(n + 1));
|
||||
threads[thread_id] = thread_start(poll_waitevents, (void *)(thread_id + 1));
|
||||
}
|
||||
LOGIF(LM, (skygw_log_write(LOGFILE_MESSAGE,
|
||||
"MaxScale started with %d server threads.",
|
||||
@ -1803,9 +1804,9 @@ int main(int argc, char **argv)
|
||||
/*<
|
||||
* Wait server threads' completion.
|
||||
*/
|
||||
for (n = 0; n < n_threads - 1; n++)
|
||||
for (thread_id = 0; thread_id < n_threads - 1; thread_id++)
|
||||
{
|
||||
thread_wait(threads[n]);
|
||||
thread_wait(threads[thread_id]);
|
||||
}
|
||||
/*<
|
||||
* Wait the flush thread.
|
||||
|
@ -678,12 +678,14 @@ void *key, *value;
|
||||
if (!(*keywrite)(fd, key))
|
||||
{
|
||||
close(fd);
|
||||
hashtable_iterator_free(iter);
|
||||
return -1;
|
||||
}
|
||||
if ((value = hashtable_fetch(table, key)) == NULL ||
|
||||
(*valuewrite)(fd, value) == 0)
|
||||
{
|
||||
close(fd);
|
||||
hashtable_iterator_free(iter);
|
||||
return -1;
|
||||
}
|
||||
rval++;
|
||||
@ -691,10 +693,13 @@ void *key, *value;
|
||||
}
|
||||
|
||||
/* Now go back and write the count of entries */
|
||||
lseek(fd, 7L, SEEK_SET);
|
||||
write(fd, &rval, sizeof(rval));
|
||||
|
||||
if(lseek(fd, 7L, SEEK_SET) != -1)
|
||||
{
|
||||
write(fd, &rval, sizeof(rval));
|
||||
}
|
||||
|
||||
close(fd);
|
||||
hashtable_iterator_free(iter);
|
||||
return rval;
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include <stdio.h>
|
||||
#include <secrets.h>
|
||||
|
||||
main(int argc, char **argv)
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
if (argc != 2)
|
||||
{
|
||||
|
@ -28,10 +28,12 @@
|
||||
* @endverbatim
|
||||
*/
|
||||
#include <memlog.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
static MEMLOG *memlogs = NULL;
|
||||
static SPINLOCK *memlock = SPINLOCK_INIT;
|
||||
static SPINLOCK memlock = SPINLOCK_INIT;
|
||||
|
||||
/**
|
||||
* Create a new instance of a memory logger.
|
||||
|
@ -206,6 +206,10 @@ GWBUF *addition;
|
||||
/* New SQL is shorter */
|
||||
memcpy(ptr, sql, newlength);
|
||||
GWBUF_RTRIM(orig, (length - 1) - newlength);
|
||||
ptr = GWBUF_DATA(orig);
|
||||
*ptr++ = (newlength + 1) & 0xff;
|
||||
*ptr++ = ((newlength + 1) >> 8) & 0xff;
|
||||
*ptr++ = ((newlength + 1) >> 16) & 0xff;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -237,7 +241,7 @@ char *
|
||||
modutil_get_SQL(GWBUF *buf)
|
||||
{
|
||||
unsigned int len, length;
|
||||
unsigned char *ptr, *dptr, *rval = NULL;
|
||||
char *ptr, *dptr, *rval = NULL;
|
||||
|
||||
if (!modutil_is_SQL(buf))
|
||||
return rval;
|
||||
|
@ -15,7 +15,6 @@
|
||||
*
|
||||
* Copyright MariaDB Corporation Ab 2013-2014
|
||||
*/
|
||||
#include <my_config.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
@ -438,7 +437,7 @@ poll_waitevents(void *arg)
|
||||
{
|
||||
struct epoll_event events[MAX_EVENTS];
|
||||
int i, nfds, timeout_bias = 1;
|
||||
int thread_id = (int)arg;
|
||||
intptr_t thread_id = (intptr_t)arg;
|
||||
DCB *zombies = NULL;
|
||||
int poll_spins = 0;
|
||||
|
||||
|
@ -221,7 +221,7 @@ GWPROTOCOL *funcs;
|
||||
|
||||
{
|
||||
/* Try loading authentication data from file cache */
|
||||
char *ptr, path[4096];
|
||||
char *ptr, path[4097];
|
||||
strcpy(path, "/usr/local/skysql/MaxScale");
|
||||
if ((ptr = getenv("MAXSCALE_HOME")) != NULL)
|
||||
{
|
||||
@ -251,6 +251,7 @@ GWPROTOCOL *funcs;
|
||||
{
|
||||
/* Save authentication data to file cache */
|
||||
char *ptr, path[4096];
|
||||
int mkdir_rval = 0;
|
||||
strcpy(path, "/usr/local/skysql/MaxScale");
|
||||
if ((ptr = getenv("MAXSCALE_HOME")) != NULL)
|
||||
{
|
||||
@ -259,10 +260,33 @@ GWPROTOCOL *funcs;
|
||||
strncat(path, "/", 4096);
|
||||
strncat(path, service->name, 4096);
|
||||
if (access(path, R_OK) == -1)
|
||||
mkdir(path, 0777);
|
||||
{
|
||||
mkdir_rval = mkdir(path, 0777);
|
||||
}
|
||||
|
||||
if(mkdir_rval)
|
||||
{
|
||||
skygw_log_write(LOGFILE_ERROR,"Error : Failed to create directory '%s': [%d] %s",
|
||||
path,
|
||||
errno,
|
||||
strerror(errno));
|
||||
mkdir_rval = 0;
|
||||
}
|
||||
|
||||
strncat(path, "/.cache", 4096);
|
||||
if (access(path, R_OK) == -1)
|
||||
mkdir(path, 0777);
|
||||
{
|
||||
mkdir_rval = mkdir(path, 0777);
|
||||
}
|
||||
|
||||
if(mkdir_rval)
|
||||
{
|
||||
skygw_log_write(LOGFILE_ERROR,"Error : Failed to create directory '%s': [%d] %s",
|
||||
path,
|
||||
errno,
|
||||
strerror(errno));
|
||||
mkdir_rval = 0;
|
||||
}
|
||||
strncat(path, "/dbusers", 4096);
|
||||
dbusers_save(service->users, path);
|
||||
}
|
||||
|
Reference in New Issue
Block a user