diff --git a/build_gateway.inc b/build_gateway.inc index 253c179ee..600fdac5d 100644 --- a/build_gateway.inc +++ b/build_gateway.inc @@ -9,24 +9,41 @@ # # Set debug flags # -DEBUG := -DEBUGGER := -DEBUGGER_PATH := -DEBUGGER_BIN := +DEBUG := + # # Set build env # -UNIX := +UNIX := Y # -# Set path for root directory, that is, path to directory where -# makefile.inc and build_gateway.inc are located. -# ROOT_PATH is used in makefile. +# Set MaxScale branch directory # -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 -ifndef $(MARIADB_SRC_PATH) - MARIADB_SRC_PATH := /packages/mariadb/5.5 +# +# Set prefix to MySQL Resources +# +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 +# +# Set path to MySQL errors file +# +ERRMSG := $(HOME)/usr/share/mysql \ No newline at end of file diff --git a/log_manager/log_manager.cc b/log_manager/log_manager.cc index 3cc1d0aca..a1dfe566d 100644 --- a/log_manager/log_manager.cc +++ b/log_manager/log_manager.cc @@ -38,7 +38,9 @@ #define MAXNBLOCKBUFS 10 /** for procname */ -#define _GNU_SOURCE +#if !defined(_GNU_SOURCE) +# define _GNU_SOURCE +#endif extern char *program_invocation_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 bool logfile_set_enabled(logfile_id_t id, bool val); 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); @@ -609,7 +611,6 @@ static int logmanager_write_log( blockbuf_t* bb_c; int timestamp_len; int i; - bool write_syslog; CHK_LOGMANAGER(lm); @@ -1612,7 +1613,6 @@ static bool logfiles_init( int i = 0; bool store_shmem; bool write_syslog; - char* syslog_ident; if (syslog_id_str != NULL) { diff --git a/log_manager/makefile b/log_manager/makefile index 227b82753..b210570aa 100644 --- a/log_manager/makefile +++ b/log_manager/makefile @@ -28,7 +28,7 @@ lib: libcomp liblink libcomp: $(CPP) -c $(CFLAGS) \ - -I$(MARIADB_SRC_PATH)/include/ \ + $(MYSQL_HEADERS) \ -I../utils/ -I./ \ -fPIC ./log_manager.cc -o log_manager.o $(LDLIBS) @@ -46,7 +46,7 @@ install: liblink depend: @rm -f depend $(CPP) -M $(CFLAGS) \ - -I$(MARIADB_SRC_PATH)/include/ \ + $(MYSQL_HEADERS) \ -I../utils/ -I./ \ $(SRCS) > depend diff --git a/makefile.inc b/makefile.inc index dd80850b8..f0bfa0316 100644 --- a/makefile.inc +++ b/makefile.inc @@ -16,11 +16,12 @@ NOHUP := nohup #endif -#ifdef DEBUGGER - BACKGR := >> /dev/null & -#else - BACKGR := -#endif +LIB := libmysqld.a + +ifdef DYNLIB + LIB := libmysqld.so.18 +endif + CFLAGS := $(CFLAGS) -Wall LDLIBS := $(LDLIBS) -pthread @@ -35,14 +36,7 @@ ifdef DEBUG CFLAGS := $(CFLAGS) -ggdb -O0 -pthread $(DEBUG_FLAGS) endif + ifdef PROF CFLAGS := $(CFLAGS) -DSS_PROF -endif - -ifdef DEBUGGER - DEBUG := Y - LAUNCH_DEBUGGER := $(NOHUP) $(DEBUGGER_PATH)/$(DEBUGGER_BIN) \ - $(DEBUGGER_PARAMS) -else - LAUNCH_DEBUGGER := -endif +endif \ No newline at end of file diff --git a/query_classifier/makefile b/query_classifier/makefile index 5682a7b87..9a9e52f33 100644 --- a/query_classifier/makefile +++ b/query_classifier/makefile @@ -29,20 +29,17 @@ lib: libcomp liblink libcomp: $(CPP) -c $(CFLAGS) \ - -I$(MARIADB_SRC_PATH)/libmysqld/ \ - -I$(MARIADB_SRC_PATH)/include/ \ - -I$(MARIADB_SRC_PATH)/sql \ - -I$(MARIADB_SRC_PATH)/regex/ \ + $(MYSQL_HEADERS) \ -I$(ROOT_PATH)/log_manager/ \ -I./ \ -fPIC ./query_classifier.cc -o query_classifier.o liblink: $(CPP) -shared \ - -L$(MARIADB_SRC_PATH)/libmysqld \ + -L$(EMBEDDED_LIB) \ -Wl,-soname,libquery_classifier.so \ -Wl,-rpath,$(DEST)/lib \ - -Wl,-rpath,$(MARIADB_SRC_PATH)/libmysqld \ + -Wl,-rpath,$(EMBEDDED_LIB) \ -o libquery_classifier.so.1.0.1 ./query_classifier.o \ $(LDLIBS) $(LDMYSQL) $(CPP_LDLIBS) $(DEL) ./libquery_classifier.so @@ -55,10 +52,7 @@ install: liblink depend: @rm -f depend $(CPP) -M $(CFLAGS) \ - -I$(MARIADB_SRC_PATH)/libmysqld/ \ - -I$(MARIADB_SRC_PATH)/include/ \ - -I$(MARIADB_SRC_PATH)/sql \ - -I$(MARIADB_SRC_PATH)/regex/ \ + $(MYSQL_HEADERS) \ -I$(ROOT_PATH)/log_manager/ \ -I./ \ $(SRCS) > depend diff --git a/query_classifier/query_classifier.cc b/query_classifier/query_classifier.cc index 689ea8dd2..3be29f1a2 100644 --- a/query_classifier/query_classifier.cc +++ b/query_classifier/query_classifier.cc @@ -371,7 +371,6 @@ static skygw_query_type_t resolve_query_type( skygw_query_type_t qtype = QUERY_TYPE_UNKNOWN; LEX* lex; Item* item; - int ftype; /** * By default, if sql_log_bin, that is, recording data modifications * to binary log, is disabled, gateway treats operations normally. diff --git a/server/core/Makefile b/server/core/Makefile index 4d94b246a..36aec19e7 100644 --- a/server/core/Makefile +++ b/server/core/Makefile @@ -42,7 +42,7 @@ UTILSPATH := $(ROOT_PATH)/utils CC=cc CFLAGS=-c -I/usr/include -I../include -I../inih \ - -I$(MARIADB_SRC_PATH)/include/ \ + $(MYSQL_HEADERS) \ -I$(LOGPATH) -I$(UTILSPATH) \ -Wall -g @@ -51,7 +51,7 @@ include ../../makefile.inc LDFLAGS=-rdynamic -L$(LOGPATH) \ -Wl,-rpath,$(DEST)/lib \ -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 \ 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 LIBS=-L../inih/extra -linih -lssl -lstdc++ \ - -L$(MARIADB_SRC_PATH)/libmysqld \ - -lz -lm -lcrypt -lcrypto -ldl -pthread -llog_manager \ + -L$(EMBEDDED_LIB) \ + -lz -lm -lcrypt -lcrypto -ldl -laio -pthread -llog_manager \ -lmysqld all: maxscale maxkeys maxpasswd @@ -103,6 +103,7 @@ depend: install: maxscale maxkeys maxpasswd @mkdir -p $(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 diff --git a/server/core/dcb.c b/server/core/dcb.c index ebaa0da50..d78c4994e 100644 --- a/server/core/dcb.c +++ b/server/core/dcb.c @@ -893,7 +893,6 @@ int saved_errno = 0; void dcb_close(DCB *dcb) { - bool succp; int rc; CHK_DCB(dcb); diff --git a/server/core/gateway.c b/server/core/gateway.c index ec97ee4b2..01e911a82 100644 --- a/server/core/gateway.c +++ b/server/core/gateway.c @@ -37,7 +37,7 @@ * * @endverbatim */ -#define _XOPEN_SOURCE 500 +#define _XOPEN_SOURCE 700 #include #include #include @@ -81,6 +81,8 @@ extern int lm_enabled_logfiles_bitmask; static char* server_options[] = { "SkySQL Gateway", "--datadir=", + "--language=", + "--skip-innodb", "--default-storage-engine=myisam", NULL }; @@ -90,6 +92,8 @@ const int num_elements = (sizeof(server_options) / sizeof(char *)) - 1; const char* default_cnf_fname = "etc/MaxScale.cnf"; static char* server_groups[] = { + "embedded", + "server", "embedded", "server", "server", @@ -97,7 +101,7 @@ static char* server_groups[] = { }; /* The data directory we created for this gateway instance */ -static char datadir[1024] = ""; +static char datadir[PATH_MAX+1] = ""; /** * exit flag for log flusher. @@ -695,32 +699,6 @@ static bool file_is_writable( 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 @@ -899,12 +877,12 @@ int main(int argc, char **argv) int eno = 0; /**