build_gateway.inc
Removed MARIADB_SRC_PATH Added MYSQL_ROOT - root directory where MariaDB headers are installed Added MYSQL_HEADERS - -I notation for three header directories Added EMBEDDED_LIB - for embedded library directory Added ERRMSG - for errmsg.sys file log_manager.cc Little fixes log_manager/makefile Updated header include directive makefile.inc Removed DEBUGGER and BACKGR as unnecessary Added LIB for embedded library file name query_classifier/makefile Updated header include directives and embedded library directory query_classifier/query_classifier.cc clean up server/core/Makefile Updated header include directives and embedded library directory Added libaio and install of errmsg.sys server/core/dcb.c clean up server/core/gateway.c Added --language and --skip-innodb to mysql_library_init command-line arguments list clean up server/core/load_utils.c clean up server/modules/monitor/Makefile server/modules/routing/readwritesplit/Makefile Updated header include directives and embedded library directory utils/skygw_debug.h http://bugs.skysql.com/show_bug.cgi?id=369 utils/skygw_types.h utils/skygw_utils.cc clean up
This commit is contained in:
@ -9,24 +9,41 @@
|
|||||||
#
|
#
|
||||||
# Set debug flags
|
# Set debug flags
|
||||||
#
|
#
|
||||||
DEBUG :=
|
DEBUG :=
|
||||||
DEBUGGER :=
|
|
||||||
DEBUGGER_PATH :=
|
|
||||||
DEBUGGER_BIN :=
|
|
||||||
#
|
#
|
||||||
# Set build env
|
# Set build env
|
||||||
#
|
#
|
||||||
UNIX :=
|
UNIX := Y
|
||||||
|
|
||||||
#
|
#
|
||||||
# Set path for root directory, that is, path to directory where
|
# Set MaxScale branch directory
|
||||||
# makefile.inc and build_gateway.inc are located.
|
|
||||||
# ROOT_PATH is used in makefile.
|
|
||||||
#
|
#
|
||||||
ROOT_PATH := /home/jdoe/maxscale
|
ROOT_PATH := $(HOME)/src/bazaar/tmp/maxscale
|
||||||
|
|
||||||
# MARIADB_SRC_PATH may be defined either as an environment variable or
|
#
|
||||||
# specifically here
|
# Set prefix to MySQL Resources
|
||||||
ifndef $(MARIADB_SRC_PATH)
|
#
|
||||||
MARIADB_SRC_PATH := /packages/mariadb/5.5
|
MYSQL_ROOT := $(HOME)/usr/include/mysql
|
||||||
|
|
||||||
|
#
|
||||||
|
# Set prefix of the path to development headers
|
||||||
|
#
|
||||||
|
MYSQL_HEADERS := -I$(MYSQL_ROOT)/ -I$(MYSQL_ROOT)/private/ -I$(MYSQL_ROOT)/extra/
|
||||||
|
|
||||||
|
#
|
||||||
|
# Set DYNLIB=Y if you want to link MaxScale with dynamic embedded lib
|
||||||
|
#
|
||||||
|
DYNLIB :=
|
||||||
|
|
||||||
|
#
|
||||||
|
# Set path to Embedded MySQL Server
|
||||||
|
#
|
||||||
|
EMBEDDED_LIB := $(HOME)/usr/lib64
|
||||||
|
ifdef DYNLIB
|
||||||
|
EMBEDDED_LIB := $(HOME)/usr/lib64/dynlib
|
||||||
endif
|
endif
|
||||||
|
#
|
||||||
|
# Set path to MySQL errors file
|
||||||
|
#
|
||||||
|
ERRMSG := $(HOME)/usr/share/mysql
|
||||||
@ -38,7 +38,9 @@
|
|||||||
#define MAXNBLOCKBUFS 10
|
#define MAXNBLOCKBUFS 10
|
||||||
|
|
||||||
/** for procname */
|
/** for procname */
|
||||||
#define _GNU_SOURCE
|
#if !defined(_GNU_SOURCE)
|
||||||
|
# define _GNU_SOURCE
|
||||||
|
#endif
|
||||||
|
|
||||||
extern char *program_invocation_name;
|
extern char *program_invocation_name;
|
||||||
extern char *program_invocation_short_name;
|
extern char *program_invocation_short_name;
|
||||||
@ -264,7 +266,7 @@ static void blockbuf_register(blockbuf_t* bb);
|
|||||||
static void blockbuf_unregister(blockbuf_t* bb);
|
static void blockbuf_unregister(blockbuf_t* bb);
|
||||||
static bool logfile_set_enabled(logfile_id_t id, bool val);
|
static bool logfile_set_enabled(logfile_id_t id, bool val);
|
||||||
static char* add_slash(char* str);
|
static char* add_slash(char* str);
|
||||||
static bool file_exists_and_is_writable(char* filename);
|
static bool file_exists_and_is_writable(char* filename, bool* writable);
|
||||||
static bool file_is_symlink(char* filename);
|
static bool file_is_symlink(char* filename);
|
||||||
|
|
||||||
|
|
||||||
@ -609,7 +611,6 @@ static int logmanager_write_log(
|
|||||||
blockbuf_t* bb_c;
|
blockbuf_t* bb_c;
|
||||||
int timestamp_len;
|
int timestamp_len;
|
||||||
int i;
|
int i;
|
||||||
bool write_syslog;
|
|
||||||
|
|
||||||
CHK_LOGMANAGER(lm);
|
CHK_LOGMANAGER(lm);
|
||||||
|
|
||||||
@ -1612,7 +1613,6 @@ static bool logfiles_init(
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
bool store_shmem;
|
bool store_shmem;
|
||||||
bool write_syslog;
|
bool write_syslog;
|
||||||
char* syslog_ident;
|
|
||||||
|
|
||||||
if (syslog_id_str != NULL)
|
if (syslog_id_str != NULL)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -28,7 +28,7 @@ lib: libcomp liblink
|
|||||||
|
|
||||||
libcomp:
|
libcomp:
|
||||||
$(CPP) -c $(CFLAGS) \
|
$(CPP) -c $(CFLAGS) \
|
||||||
-I$(MARIADB_SRC_PATH)/include/ \
|
$(MYSQL_HEADERS) \
|
||||||
-I../utils/ -I./ \
|
-I../utils/ -I./ \
|
||||||
-fPIC ./log_manager.cc -o log_manager.o $(LDLIBS)
|
-fPIC ./log_manager.cc -o log_manager.o $(LDLIBS)
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ install: liblink
|
|||||||
depend:
|
depend:
|
||||||
@rm -f depend
|
@rm -f depend
|
||||||
$(CPP) -M $(CFLAGS) \
|
$(CPP) -M $(CFLAGS) \
|
||||||
-I$(MARIADB_SRC_PATH)/include/ \
|
$(MYSQL_HEADERS) \
|
||||||
-I../utils/ -I./ \
|
-I../utils/ -I./ \
|
||||||
$(SRCS) > depend
|
$(SRCS) > depend
|
||||||
|
|
||||||
|
|||||||
22
makefile.inc
22
makefile.inc
@ -16,11 +16,12 @@
|
|||||||
NOHUP := nohup
|
NOHUP := nohup
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUGGER
|
LIB := libmysqld.a
|
||||||
BACKGR := >> /dev/null &
|
|
||||||
#else
|
ifdef DYNLIB
|
||||||
BACKGR :=
|
LIB := libmysqld.so.18
|
||||||
#endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
CFLAGS := $(CFLAGS) -Wall
|
CFLAGS := $(CFLAGS) -Wall
|
||||||
LDLIBS := $(LDLIBS) -pthread
|
LDLIBS := $(LDLIBS) -pthread
|
||||||
@ -35,14 +36,7 @@ ifdef DEBUG
|
|||||||
CFLAGS := $(CFLAGS) -ggdb -O0 -pthread $(DEBUG_FLAGS)
|
CFLAGS := $(CFLAGS) -ggdb -O0 -pthread $(DEBUG_FLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
ifdef PROF
|
ifdef PROF
|
||||||
CFLAGS := $(CFLAGS) -DSS_PROF
|
CFLAGS := $(CFLAGS) -DSS_PROF
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef DEBUGGER
|
|
||||||
DEBUG := Y
|
|
||||||
LAUNCH_DEBUGGER := $(NOHUP) $(DEBUGGER_PATH)/$(DEBUGGER_BIN) \
|
|
||||||
$(DEBUGGER_PARAMS)
|
|
||||||
else
|
|
||||||
LAUNCH_DEBUGGER :=
|
|
||||||
endif
|
|
||||||
@ -29,20 +29,17 @@ lib: libcomp liblink
|
|||||||
|
|
||||||
libcomp:
|
libcomp:
|
||||||
$(CPP) -c $(CFLAGS) \
|
$(CPP) -c $(CFLAGS) \
|
||||||
-I$(MARIADB_SRC_PATH)/libmysqld/ \
|
$(MYSQL_HEADERS) \
|
||||||
-I$(MARIADB_SRC_PATH)/include/ \
|
|
||||||
-I$(MARIADB_SRC_PATH)/sql \
|
|
||||||
-I$(MARIADB_SRC_PATH)/regex/ \
|
|
||||||
-I$(ROOT_PATH)/log_manager/ \
|
-I$(ROOT_PATH)/log_manager/ \
|
||||||
-I./ \
|
-I./ \
|
||||||
-fPIC ./query_classifier.cc -o query_classifier.o
|
-fPIC ./query_classifier.cc -o query_classifier.o
|
||||||
|
|
||||||
liblink:
|
liblink:
|
||||||
$(CPP) -shared \
|
$(CPP) -shared \
|
||||||
-L$(MARIADB_SRC_PATH)/libmysqld \
|
-L$(EMBEDDED_LIB) \
|
||||||
-Wl,-soname,libquery_classifier.so \
|
-Wl,-soname,libquery_classifier.so \
|
||||||
-Wl,-rpath,$(DEST)/lib \
|
-Wl,-rpath,$(DEST)/lib \
|
||||||
-Wl,-rpath,$(MARIADB_SRC_PATH)/libmysqld \
|
-Wl,-rpath,$(EMBEDDED_LIB) \
|
||||||
-o libquery_classifier.so.1.0.1 ./query_classifier.o \
|
-o libquery_classifier.so.1.0.1 ./query_classifier.o \
|
||||||
$(LDLIBS) $(LDMYSQL) $(CPP_LDLIBS)
|
$(LDLIBS) $(LDMYSQL) $(CPP_LDLIBS)
|
||||||
$(DEL) ./libquery_classifier.so
|
$(DEL) ./libquery_classifier.so
|
||||||
@ -55,10 +52,7 @@ install: liblink
|
|||||||
depend:
|
depend:
|
||||||
@rm -f depend
|
@rm -f depend
|
||||||
$(CPP) -M $(CFLAGS) \
|
$(CPP) -M $(CFLAGS) \
|
||||||
-I$(MARIADB_SRC_PATH)/libmysqld/ \
|
$(MYSQL_HEADERS) \
|
||||||
-I$(MARIADB_SRC_PATH)/include/ \
|
|
||||||
-I$(MARIADB_SRC_PATH)/sql \
|
|
||||||
-I$(MARIADB_SRC_PATH)/regex/ \
|
|
||||||
-I$(ROOT_PATH)/log_manager/ \
|
-I$(ROOT_PATH)/log_manager/ \
|
||||||
-I./ \
|
-I./ \
|
||||||
$(SRCS) > depend
|
$(SRCS) > depend
|
||||||
|
|||||||
@ -371,7 +371,6 @@ static skygw_query_type_t resolve_query_type(
|
|||||||
skygw_query_type_t qtype = QUERY_TYPE_UNKNOWN;
|
skygw_query_type_t qtype = QUERY_TYPE_UNKNOWN;
|
||||||
LEX* lex;
|
LEX* lex;
|
||||||
Item* item;
|
Item* item;
|
||||||
int ftype;
|
|
||||||
/**
|
/**
|
||||||
* By default, if sql_log_bin, that is, recording data modifications
|
* By default, if sql_log_bin, that is, recording data modifications
|
||||||
* to binary log, is disabled, gateway treats operations normally.
|
* to binary log, is disabled, gateway treats operations normally.
|
||||||
|
|||||||
@ -42,7 +42,7 @@ UTILSPATH := $(ROOT_PATH)/utils
|
|||||||
CC=cc
|
CC=cc
|
||||||
|
|
||||||
CFLAGS=-c -I/usr/include -I../include -I../inih \
|
CFLAGS=-c -I/usr/include -I../include -I../inih \
|
||||||
-I$(MARIADB_SRC_PATH)/include/ \
|
$(MYSQL_HEADERS) \
|
||||||
-I$(LOGPATH) -I$(UTILSPATH) \
|
-I$(LOGPATH) -I$(UTILSPATH) \
|
||||||
-Wall -g
|
-Wall -g
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ include ../../makefile.inc
|
|||||||
LDFLAGS=-rdynamic -L$(LOGPATH) \
|
LDFLAGS=-rdynamic -L$(LOGPATH) \
|
||||||
-Wl,-rpath,$(DEST)/lib \
|
-Wl,-rpath,$(DEST)/lib \
|
||||||
-Wl,-rpath,$(LOGPATH) -Wl,-rpath,$(UTILSPATH) \
|
-Wl,-rpath,$(LOGPATH) -Wl,-rpath,$(UTILSPATH) \
|
||||||
-Wl,-rpath,$(MARIADB_SRC_PATH)/libmysqld
|
-Wl,-rpath,$(EMBEDDED_LIB)
|
||||||
|
|
||||||
SRCS= atomic.c buffer.c spinlock.c gateway.c \
|
SRCS= atomic.c buffer.c spinlock.c gateway.c \
|
||||||
gw_utils.c utils.c dcb.c load_utils.c session.c service.c server.c \
|
gw_utils.c utils.c dcb.c load_utils.c session.c service.c server.c \
|
||||||
@ -71,8 +71,8 @@ KOBJS=maxkeys.o secrets.o utils.o
|
|||||||
POBJS=maxpasswd.o secrets.o utils.o
|
POBJS=maxpasswd.o secrets.o utils.o
|
||||||
|
|
||||||
LIBS=-L../inih/extra -linih -lssl -lstdc++ \
|
LIBS=-L../inih/extra -linih -lssl -lstdc++ \
|
||||||
-L$(MARIADB_SRC_PATH)/libmysqld \
|
-L$(EMBEDDED_LIB) \
|
||||||
-lz -lm -lcrypt -lcrypto -ldl -pthread -llog_manager \
|
-lz -lm -lcrypt -lcrypto -ldl -laio -pthread -llog_manager \
|
||||||
-lmysqld
|
-lmysqld
|
||||||
|
|
||||||
all: maxscale maxkeys maxpasswd
|
all: maxscale maxkeys maxpasswd
|
||||||
@ -103,6 +103,7 @@ depend:
|
|||||||
install: maxscale maxkeys maxpasswd
|
install: maxscale maxkeys maxpasswd
|
||||||
@mkdir -p $(DEST)/bin
|
@mkdir -p $(DEST)/bin
|
||||||
install -D maxscale maxkeys maxpasswd $(DEST)/bin
|
install -D maxscale maxkeys maxpasswd $(DEST)/bin
|
||||||
install -D $(MARIADB_SRC_PATH)/libmysqld/libmysqld.so.18 $(DEST)/lib
|
install -D $(EMBEDDED_LIB)/$(LIB) $(DEST)/lib
|
||||||
|
install -D $(ERRMSG)/errmsg.sys $(DEST)/MaxScale/mysql
|
||||||
|
|
||||||
include depend.mk
|
include depend.mk
|
||||||
|
|||||||
@ -893,7 +893,6 @@ int saved_errno = 0;
|
|||||||
void
|
void
|
||||||
dcb_close(DCB *dcb)
|
dcb_close(DCB *dcb)
|
||||||
{
|
{
|
||||||
bool succp;
|
|
||||||
int rc;
|
int rc;
|
||||||
CHK_DCB(dcb);
|
CHK_DCB(dcb);
|
||||||
|
|
||||||
|
|||||||
@ -37,7 +37,7 @@
|
|||||||
*
|
*
|
||||||
* @endverbatim
|
* @endverbatim
|
||||||
*/
|
*/
|
||||||
#define _XOPEN_SOURCE 500
|
#define _XOPEN_SOURCE 700
|
||||||
#include <ftw.h>
|
#include <ftw.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <gw.h>
|
#include <gw.h>
|
||||||
@ -81,6 +81,8 @@ extern int lm_enabled_logfiles_bitmask;
|
|||||||
static char* server_options[] = {
|
static char* server_options[] = {
|
||||||
"SkySQL Gateway",
|
"SkySQL Gateway",
|
||||||
"--datadir=",
|
"--datadir=",
|
||||||
|
"--language=",
|
||||||
|
"--skip-innodb",
|
||||||
"--default-storage-engine=myisam",
|
"--default-storage-engine=myisam",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
@ -90,6 +92,8 @@ const int num_elements = (sizeof(server_options) / sizeof(char *)) - 1;
|
|||||||
const char* default_cnf_fname = "etc/MaxScale.cnf";
|
const char* default_cnf_fname = "etc/MaxScale.cnf";
|
||||||
|
|
||||||
static char* server_groups[] = {
|
static char* server_groups[] = {
|
||||||
|
"embedded",
|
||||||
|
"server",
|
||||||
"embedded",
|
"embedded",
|
||||||
"server",
|
"server",
|
||||||
"server",
|
"server",
|
||||||
@ -97,7 +101,7 @@ static char* server_groups[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* The data directory we created for this gateway instance */
|
/* The data directory we created for this gateway instance */
|
||||||
static char datadir[1024] = "";
|
static char datadir[PATH_MAX+1] = "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* exit flag for log flusher.
|
* exit flag for log flusher.
|
||||||
@ -695,32 +699,6 @@ static bool file_is_writable(
|
|||||||
return succp;
|
return succp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char* create_and_test_filename(
|
|
||||||
char* path,
|
|
||||||
char* fname)
|
|
||||||
{
|
|
||||||
char* fname_path;
|
|
||||||
|
|
||||||
fname_path = (char*) malloc(strlen(path)+
|
|
||||||
strlen("/etc/")+
|
|
||||||
strlen(fname)+
|
|
||||||
1);
|
|
||||||
if (fname_path == NULL)
|
|
||||||
{
|
|
||||||
goto return_fname_path;
|
|
||||||
}
|
|
||||||
sprintf(fname_path, "%s/etc/%s", path, fname);
|
|
||||||
|
|
||||||
if (!file_is_readable(fname_path))
|
|
||||||
{
|
|
||||||
free(fname_path);
|
|
||||||
fname_path = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return_fname_path:
|
|
||||||
return fname_path;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @node Expand path expression and if fname is provided, concatenate
|
* @node Expand path expression and if fname is provided, concatenate
|
||||||
@ -899,12 +877,12 @@ int main(int argc, char **argv)
|
|||||||
int eno = 0; /**<! local variable for errno */
|
int eno = 0; /**<! local variable for errno */
|
||||||
int opt;
|
int opt;
|
||||||
void** threads; /**<! thread list */
|
void** threads; /**<! thread list */
|
||||||
char mysql_home[1024];
|
char mysql_home[PATH_MAX+1];
|
||||||
char ddopt[1024];
|
char datadir_arg[10+PATH_MAX+1]; /**<! '--datadir=' + PATH_MAX */
|
||||||
|
char language_arg[11+PATH_MAX+1]; /**<! '--language=' + PATH_MAX */
|
||||||
char* home_dir = NULL; /**<! home dir, to be freed */
|
char* home_dir = NULL; /**<! home dir, to be freed */
|
||||||
char* cnf_file_path = NULL; /**<! conf file, to be freed */
|
char* cnf_file_path = NULL; /**<! conf file, to be freed */
|
||||||
char* cnf_file_arg = NULL; /**<! conf filename from cmd-line arg */
|
char* cnf_file_arg = NULL; /**<! conf filename from cmd-line arg */
|
||||||
char* lib_dir = NULL; /**<! directory for dyn libs */
|
|
||||||
void* log_flush_thr = NULL;
|
void* log_flush_thr = NULL;
|
||||||
ssize_t log_flush_timeout_ms = 0;
|
ssize_t log_flush_timeout_ms = 0;
|
||||||
sigset_t sigset;
|
sigset_t sigset;
|
||||||
@ -1043,7 +1021,7 @@ int main(int argc, char **argv)
|
|||||||
"the log from the following log files : \n\n");
|
"the log from the following log files : \n\n");
|
||||||
|
|
||||||
r = sigfillset(&sigset);
|
r = sigfillset(&sigset);
|
||||||
/*r=1;/**/
|
|
||||||
if (r != 0)
|
if (r != 0)
|
||||||
{
|
{
|
||||||
eno = errno;
|
eno = errno;
|
||||||
@ -1053,7 +1031,7 @@ int main(int argc, char **argv)
|
|||||||
goto return_main;
|
goto return_main;
|
||||||
}
|
}
|
||||||
r = sigdelset(&sigset, SIGHUP);
|
r = sigdelset(&sigset, SIGHUP);
|
||||||
/*r=1;/**/
|
|
||||||
if (r != 0)
|
if (r != 0)
|
||||||
{
|
{
|
||||||
char* logerr = "Failed to delete signal SIGHUP from the "
|
char* logerr = "Failed to delete signal SIGHUP from the "
|
||||||
@ -1065,7 +1043,7 @@ int main(int argc, char **argv)
|
|||||||
goto return_main;
|
goto return_main;
|
||||||
}
|
}
|
||||||
r = sigdelset(&sigset, SIGTERM);
|
r = sigdelset(&sigset, SIGTERM);
|
||||||
/*r=1;/**/
|
|
||||||
if (r != 0)
|
if (r != 0)
|
||||||
{
|
{
|
||||||
char* logerr = "Failed to delete signal SIGTERM from the "
|
char* logerr = "Failed to delete signal SIGTERM from the "
|
||||||
@ -1077,7 +1055,7 @@ int main(int argc, char **argv)
|
|||||||
goto return_main;
|
goto return_main;
|
||||||
}
|
}
|
||||||
r = sigprocmask(SIG_SETMASK, &sigset, NULL);
|
r = sigprocmask(SIG_SETMASK, &sigset, NULL);
|
||||||
/*r=1;/**/
|
|
||||||
if (r != 0) {
|
if (r != 0) {
|
||||||
char* logerr = "Failed to set the signal set for MaxScale."
|
char* logerr = "Failed to set the signal set for MaxScale."
|
||||||
" Exiting.";
|
" Exiting.";
|
||||||
@ -1096,7 +1074,7 @@ int main(int argc, char **argv)
|
|||||||
char* fprerr = "Failed to initialize signal handlers. Exiting.";
|
char* fprerr = "Failed to initialize signal handlers. Exiting.";
|
||||||
char* logerr = NULL;
|
char* logerr = NULL;
|
||||||
l = signal_set(SIGHUP, sighup_handler);
|
l = signal_set(SIGHUP, sighup_handler);
|
||||||
/*l=1;/**/
|
|
||||||
if (l != 0)
|
if (l != 0)
|
||||||
{
|
{
|
||||||
logerr = strdup("Failed to set signal handler for "
|
logerr = strdup("Failed to set signal handler for "
|
||||||
@ -1104,7 +1082,7 @@ int main(int argc, char **argv)
|
|||||||
goto sigset_err;
|
goto sigset_err;
|
||||||
}
|
}
|
||||||
l = signal_set(SIGTERM, sigterm_handler);
|
l = signal_set(SIGTERM, sigterm_handler);
|
||||||
/*l=1;/**/
|
|
||||||
if (l != 0)
|
if (l != 0)
|
||||||
{
|
{
|
||||||
logerr = strdup("Failed to set signal handler for "
|
logerr = strdup("Failed to set signal handler for "
|
||||||
@ -1112,7 +1090,7 @@ int main(int argc, char **argv)
|
|||||||
goto sigset_err;
|
goto sigset_err;
|
||||||
}
|
}
|
||||||
l = signal_set(SIGINT, sigint_handler);
|
l = signal_set(SIGINT, sigint_handler);
|
||||||
/*l=1; /**/
|
|
||||||
if (l != 0)
|
if (l != 0)
|
||||||
{
|
{
|
||||||
logerr = strdup("Failed to set signal handler for "
|
logerr = strdup("Failed to set signal handler for "
|
||||||
@ -1131,7 +1109,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
eno = pthread_sigmask(SIG_BLOCK, &sigpipe_mask, &saved_mask);
|
eno = pthread_sigmask(SIG_BLOCK, &sigpipe_mask, &saved_mask);
|
||||||
/*eno=EINTR; /**/
|
|
||||||
if (eno != 0)
|
if (eno != 0)
|
||||||
{
|
{
|
||||||
char* logerr = "Failed to initialise signal mask for MaxScale. "
|
char* logerr = "Failed to initialise signal mask for MaxScale. "
|
||||||
@ -1166,7 +1144,6 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
sprintf(mysql_home, "%s/mysql", home_dir);
|
sprintf(mysql_home, "%s/mysql", home_dir);
|
||||||
setenv("MYSQL_HOME", mysql_home, 1);
|
setenv("MYSQL_HOME", mysql_home, 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1234,8 +1211,16 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
if (!strcmp(server_options[i], "--datadir="))
|
if (!strcmp(server_options[i], "--datadir="))
|
||||||
{
|
{
|
||||||
sprintf(ddopt, "--datadir=%s", datadir);
|
snprintf(datadir_arg, 10+PATH_MAX+1, "--datadir=%s", datadir);
|
||||||
server_options[i] = ddopt;
|
server_options[i] = datadir_arg;
|
||||||
|
}
|
||||||
|
else if (!strcmp(server_options[i], "--language="))
|
||||||
|
{
|
||||||
|
snprintf(language_arg,
|
||||||
|
11+PATH_MAX+1,
|
||||||
|
"--language=%s/mysql",
|
||||||
|
home_dir);
|
||||||
|
server_options[i] = language_arg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1246,12 +1231,23 @@ int main(int argc, char **argv)
|
|||||||
char* fprerr = "Failed to initialise the MySQL library. "
|
char* fprerr = "Failed to initialise the MySQL library. "
|
||||||
"Exiting.";
|
"Exiting.";
|
||||||
print_log_n_stderr(false, true, fprerr, fprerr, 0);
|
print_log_n_stderr(false, true, fprerr, fprerr, 0);
|
||||||
|
|
||||||
|
if (mysql_errno(NULL) == 2000)
|
||||||
|
{
|
||||||
|
fprintf(stderr,
|
||||||
|
"*\n* Error : %s\n* Ensure that you have "
|
||||||
|
"MySQL error messages file, errmsg.sys in "
|
||||||
|
"\n* %s\n*\n",
|
||||||
|
mysql_error(NULL),
|
||||||
|
language_arg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
skygw_log_write_flush(
|
skygw_log_write_flush(
|
||||||
LOGFILE_ERROR,
|
LOGFILE_ERROR,
|
||||||
"Error : mysql_library_init failed. It is a "
|
"Error : mysql_library_init failed. It is a "
|
||||||
"mandatory component, required by router services and "
|
"mandatory component, required by router services and "
|
||||||
"the MaxScale core. Error %s, %s : %d. Exiting.",
|
"the MaxScale core. Error %d, %s, %s : %d. Exiting.",
|
||||||
|
mysql_errno(NULL),
|
||||||
mysql_error(NULL),
|
mysql_error(NULL),
|
||||||
__FILE__,
|
__FILE__,
|
||||||
__LINE__);
|
__LINE__);
|
||||||
|
|||||||
@ -70,9 +70,9 @@ char *(*ver)();
|
|||||||
void *(*ep)(), *modobj;
|
void *(*ep)(), *modobj;
|
||||||
MODULES *mod;
|
MODULES *mod;
|
||||||
|
|
||||||
if ((mod = find_module(module)) == NULL)
|
if ((mod = find_module(module)) == NULL)
|
||||||
{
|
{
|
||||||
/*
|
/**
|
||||||
* The module is not already loaded
|
* The module is not already loaded
|
||||||
*
|
*
|
||||||
* Search of the shared object.
|
* Search of the shared object.
|
||||||
|
|||||||
@ -24,11 +24,11 @@ UTILSPATH := $(ROOT_PATH)/utils
|
|||||||
|
|
||||||
CC=cc
|
CC=cc
|
||||||
CFLAGS=-c -fPIC -I. -I/usr/include -I../include -I../../include -I$(LOGPATH) \
|
CFLAGS=-c -fPIC -I. -I/usr/include -I../include -I../../include -I$(LOGPATH) \
|
||||||
-I$(UTILSPATH) -I$(MARIADB_SRC_PATH)/include/ -Wall -g
|
-I$(UTILSPATH) $(MYSQL_HEADERS) -Wall -g
|
||||||
|
|
||||||
LDFLAGS=-shared -L$(LOGPATH) -Wl,-rpath,$(DEST)/lib \
|
LDFLAGS=-shared -L$(LOGPATH) -Wl,-rpath,$(DEST)/lib \
|
||||||
-Wl,-rpath,$(LOGPATH) -Wl,-rpath,$(UTILSPATH) \
|
-Wl,-rpath,$(LOGPATH) -Wl,-rpath,$(UTILSPATH) \
|
||||||
-Wl,-rpath,$(MARIADB_SRC_PATH)/libmysqld
|
-Wl,-rpath,$(EMBEDDED_LIB)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ GALERAOBJ=$(GALERASRCS:.c=.o)
|
|||||||
SRCS=$(MYSQLSRCS)
|
SRCS=$(MYSQLSRCS)
|
||||||
OBJ=$(SRCS:.c=.o)
|
OBJ=$(SRCS:.c=.o)
|
||||||
LIBS=$(UTILSPATH)/skygw_utils.o -llog_manager \
|
LIBS=$(UTILSPATH)/skygw_utils.o -llog_manager \
|
||||||
-L$(MARIADB_SRC_PATH)/libmysqld -lmysqld
|
-L$(EMBEDDED_LIB) -lmysqld
|
||||||
MODULES=libmysqlmon.so libgaleramon.so
|
MODULES=libmysqlmon.so libgaleramon.so
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -27,14 +27,14 @@ QCLASSPATH := $(ROOT_PATH)/query_classifier
|
|||||||
CC=cc
|
CC=cc
|
||||||
CFLAGS=-c -fPIC -I/usr/include -I../../include -I../../../include \
|
CFLAGS=-c -fPIC -I/usr/include -I../../include -I../../../include \
|
||||||
-I$(LOGPATH) -I$(UTILSPATH) -I$(QCLASSPATH) \
|
-I$(LOGPATH) -I$(UTILSPATH) -I$(QCLASSPATH) \
|
||||||
-I$(MARIADB_SRC_PATH)/include -Wall -g
|
$(MYSQL_HEADERS) -Wall -g
|
||||||
|
|
||||||
include ../../../../makefile.inc
|
include ../../../../makefile.inc
|
||||||
|
|
||||||
LDFLAGS=-shared -L$(LOGPATH) -L$(QCLASSPATH) -L$(MARIADB_SRC_PATH)/libmysqld \
|
LDFLAGS=-shared -L$(LOGPATH) -L$(QCLASSPATH) -L$(EMBEDDED_LIB) \
|
||||||
-Wl,-rpath,$(DEST)/lib \
|
-Wl,-rpath,$(DEST)/lib \
|
||||||
-Wl,-rpath,$(LOGPATH) -Wl,-rpath,$(UTILSPATH) -Wl,-rpath,$(QCLASSPATH) \
|
-Wl,-rpath,$(LOGPATH) -Wl,-rpath,$(UTILSPATH) -Wl,-rpath,$(QCLASSPATH) \
|
||||||
-Wl,-rpath,$(MARIADB_SRC_PATH)/libmysqld
|
-Wl,-rpath,$(EMBEDDED_LIB)
|
||||||
|
|
||||||
SRCS=readwritesplit.c
|
SRCS=readwritesplit.c
|
||||||
OBJ=$(SRCS:.c=.o)
|
OBJ=$(SRCS:.c=.o)
|
||||||
|
|||||||
@ -125,7 +125,7 @@ typedef enum skygw_chk_t {
|
|||||||
# define STRQTYPE(t) ((t) == QUERY_TYPE_WRITE ? "QUERY_TYPE_WRITE" : \
|
# define STRQTYPE(t) ((t) == QUERY_TYPE_WRITE ? "QUERY_TYPE_WRITE" : \
|
||||||
((t) == QUERY_TYPE_READ ? "QUERY_TYPE_READ" : \
|
((t) == QUERY_TYPE_READ ? "QUERY_TYPE_READ" : \
|
||||||
((t) == QUERY_TYPE_SESSION_WRITE ? "QUERY_TYPE_SESSION_WRITE" : \
|
((t) == QUERY_TYPE_SESSION_WRITE ? "QUERY_TYPE_SESSION_WRITE" : \
|
||||||
((t) == QUERY_TYPE_UNKNOWN ? "QUERY_TYPE_UNKNWON" : \
|
((t) == QUERY_TYPE_UNKNOWN ? "QUERY_TYPE_UNKNOWN" : \
|
||||||
((t) == QUERY_TYPE_LOCAL_READ ? "QUERY_TYPE_LOCAL_READ" : \
|
((t) == QUERY_TYPE_LOCAL_READ ? "QUERY_TYPE_LOCAL_READ" : \
|
||||||
"Unknown query type")))))
|
"Unknown query type")))))
|
||||||
|
|
||||||
|
|||||||
@ -36,9 +36,12 @@
|
|||||||
|
|
||||||
#define UINTLEN(i) (i<10 ? 1 : (i<100 ? 2 : (i<1000 ? 3 : CALCLEN(i))))
|
#define UINTLEN(i) (i<10 ? 1 : (i<100 ? 2 : (i<1000 ? 3 : CALCLEN(i))))
|
||||||
|
|
||||||
#if defined(__USE_POSIX)
|
#if !defined(PATH_MAX)
|
||||||
# define PATH_MAX _POSIX_PATH_MAX
|
# if defined(__USE_POSIX)
|
||||||
#else
|
# define PATH_MAX _POSIX_PATH_MAX
|
||||||
# define PATH_MAX 256
|
# else
|
||||||
|
# define PATH_MAX 256
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* SKYGW_TYPES_H */
|
#endif /* SKYGW_TYPES_H */
|
||||||
|
|||||||
@ -1713,8 +1713,8 @@ bool skygw_file_write(
|
|||||||
bool flush)
|
bool flush)
|
||||||
{
|
{
|
||||||
bool succp = false;
|
bool succp = false;
|
||||||
int err = 0;
|
|
||||||
#if !defined(LAPTOP_TEST)
|
#if !defined(LAPTOP_TEST)
|
||||||
|
int err = 0;
|
||||||
size_t nwritten;
|
size_t nwritten;
|
||||||
int fd;
|
int fd;
|
||||||
static int writecount;
|
static int writecount;
|
||||||
|
|||||||
Reference in New Issue
Block a user