Merge branch 'develop' into MAX-324
Conflicts: server/core/modutil.c
This commit is contained in:
@ -7,8 +7,7 @@ enable_testing()
|
|||||||
set_variables()
|
set_variables()
|
||||||
set_maxscale_version()
|
set_maxscale_version()
|
||||||
|
|
||||||
set(CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" CACHE INTERNAL "Prefix prepended to install directories." FORCE)
|
set(CMAKE_INSTALL_PREFIX "/usr/local/skysql/maxscale" CACHE PATH "Prefix prepended to install directories.")
|
||||||
|
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/")
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/")
|
||||||
|
|
||||||
@ -100,7 +99,9 @@ add_subdirectory(utils)
|
|||||||
add_subdirectory(log_manager)
|
add_subdirectory(log_manager)
|
||||||
add_subdirectory(query_classifier)
|
add_subdirectory(query_classifier)
|
||||||
add_subdirectory(server)
|
add_subdirectory(server)
|
||||||
add_subdirectory(client)
|
if(NOT WITHOUT_MAXADMIN)
|
||||||
|
add_subdirectory(client)
|
||||||
|
endif()
|
||||||
if(BUILD_RABBITMQ)
|
if(BUILD_RABBITMQ)
|
||||||
find_package(RabbitMQ)
|
find_package(RabbitMQ)
|
||||||
add_subdirectory(rabbitmq_consumer)
|
add_subdirectory(rabbitmq_consumer)
|
||||||
@ -175,13 +176,13 @@ endif()
|
|||||||
|
|
||||||
|
|
||||||
add_custom_target(buildtests
|
add_custom_target(buildtests
|
||||||
COMMAND ${CMAKE_COMMAND} -DDEPS_OK=Y -DBUILD_TESTS=Y -DBUILD_TYPE=Debug -DINSTALL_DIR=${CMAKE_BINARY_DIR} -DINSTALL_SYSTEM_FILES=N ${CMAKE_SOURCE_DIR}
|
COMMAND ${CMAKE_COMMAND} -DDEPS_OK=Y -DBUILD_TESTS=Y -DBUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR} -DINSTALL_SYSTEM_FILES=N ${CMAKE_SOURCE_DIR}
|
||||||
COMMAND make
|
COMMAND make
|
||||||
COMMENT "Building test suite..." VERBATIM
|
COMMENT "Building test suite..." VERBATIM
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_target(testall
|
add_custom_target(testall
|
||||||
COMMAND ${CMAKE_COMMAND} -DDEPS_OK=Y -DBUILD_TESTS=Y -DBUILD_TYPE=Debug -DINSTALL_DIR=${CMAKE_BINARY_DIR} -DINSTALL_SYSTEM_FILES=N ${CMAKE_SOURCE_DIR}
|
COMMAND ${CMAKE_COMMAND} -DDEPS_OK=Y -DBUILD_TESTS=Y -DBUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR} -DINSTALL_SYSTEM_FILES=N ${CMAKE_SOURCE_DIR}
|
||||||
COMMAND make install
|
COMMAND make install
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/server/test/MaxScale_test.cnf ${CMAKE_BINARY_DIR}/etc/MaxScale.cnf
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/server/test/MaxScale_test.cnf ${CMAKE_BINARY_DIR}/etc/MaxScale.cnf
|
||||||
COMMAND /bin/sh -c "${CMAKE_BINARY_DIR}/bin/maxscale -c ${CMAKE_BINARY_DIR} &>/dev/null"
|
COMMAND /bin/sh -c "${CMAKE_BINARY_DIR}/bin/maxscale -c ${CMAKE_BINARY_DIR} &>/dev/null"
|
||||||
@ -215,7 +216,7 @@ endif()
|
|||||||
# Testall target with Valgrind
|
# Testall target with Valgrind
|
||||||
if(VALGRIND_FOUND)
|
if(VALGRIND_FOUND)
|
||||||
add_custom_target(testall-valgrind
|
add_custom_target(testall-valgrind
|
||||||
COMMAND ${CMAKE_COMMAND} -DDEPS_OK=Y -DBUILD_TESTS=Y -DBUILD_TYPE=Debug -DINSTALL_DIR=${CMAKE_BINARY_DIR} -DINSTALL_SYSTEM_FILES=N ${CMAKE_SOURCE_DIR}
|
COMMAND ${CMAKE_COMMAND} -DDEPS_OK=Y -DBUILD_TESTS=Y -DBUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR} -DINSTALL_SYSTEM_FILES=N ${CMAKE_SOURCE_DIR}
|
||||||
COMMAND make install
|
COMMAND make install
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/server/test/MaxScale_test.cnf ${CMAKE_BINARY_DIR}/etc/MaxScale.cnf
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/server/test/MaxScale_test.cnf ${CMAKE_BINARY_DIR}/etc/MaxScale.cnf
|
||||||
COMMAND /bin/sh -c "valgrind --track-fds=yes --leak-check=full --show-leak-kinds=all --log-file=${CMAKE_BINARY_DIR}/valgrind.log ${CMAKE_BINARY_DIR}/bin/maxscale -c ${CMAKE_BINARY_DIR} &>/dev/null"
|
COMMAND /bin/sh -c "valgrind --track-fds=yes --leak-check=full --show-leak-kinds=all --log-file=${CMAKE_BINARY_DIR}/valgrind.log ${CMAKE_BINARY_DIR}/bin/maxscale -c ${CMAKE_BINARY_DIR} &>/dev/null"
|
||||||
|
@ -2,12 +2,19 @@
|
|||||||
# The following variables are set:
|
# The following variables are set:
|
||||||
# MYSQLCONFIG_FOUND - System has MySQL and the tool was found
|
# MYSQLCONFIG_FOUND - System has MySQL and the tool was found
|
||||||
# MYSQLCONFIG_EXECUTABLE - The MySQL configuration tool executable
|
# MYSQLCONFIG_EXECUTABLE - The MySQL configuration tool executable
|
||||||
|
# MYSQL_VERSION - The MySQL version number
|
||||||
find_program(MYSQLCONFIG_EXECUTABLE mysql_config)
|
find_program(MYSQLCONFIG_EXECUTABLE mysql_config)
|
||||||
if(MYSQLCONFIG_EXECUTABLE MATCHES "MYSQLCONFIG_EXECUTABLE-NOTFOUND")
|
if(MYSQLCONFIG_EXECUTABLE MATCHES "MYSQLCONFIG_EXECUTABLE-NOTFOUND")
|
||||||
message(FATAL_ERROR "Cannot find mysql_config.")
|
message(FATAL_ERROR "Cannot find mysql_config.")
|
||||||
set(MYSQLCONFIG_FOUND FALSE CACHE INTERNAL "")
|
set(MYSQLCONFIG_FOUND FALSE CACHE INTERNAL "")
|
||||||
unset(MYSQLCONFIG_EXECUTABLE)
|
unset(MYSQLCONFIG_EXECUTABLE)
|
||||||
else()
|
else()
|
||||||
|
execute_process(COMMAND ${MYSQLCONFIG_EXECUTABLE} --version OUTPUT_VARIABLE MYSQL_VERSION)
|
||||||
|
string(REPLACE "\n" "" MYSQL_VERSION ${MYSQL_VERSION})
|
||||||
message(STATUS "mysql_config found: ${MYSQLCONFIG_EXECUTABLE}")
|
message(STATUS "mysql_config found: ${MYSQLCONFIG_EXECUTABLE}")
|
||||||
|
message(STATUS "MySQL version: ${MYSQL_VERSION}")
|
||||||
|
if(MYSQL_VERSION VERSION_LESS 5.5.40)
|
||||||
|
message(WARNING "Required MySQL version is 5.5.40 or greater.")
|
||||||
|
endif()
|
||||||
set(MYSQLCONFIG_FOUND TRUE CACHE INTERNAL "")
|
set(MYSQLCONFIG_FOUND TRUE CACHE INTERNAL "")
|
||||||
endif()
|
endif()
|
||||||
|
79
Makefile
79
Makefile
@ -1,79 +0,0 @@
|
|||||||
# This file is distributed as part of the MariaDB Corporation MaxScale. It is free
|
|
||||||
# software: you can redistribute it and/or modify it under the terms of the
|
|
||||||
# GNU General Public License as published by the Free Software Foundation,
|
|
||||||
# version 2.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
||||||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
||||||
# details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License along with
|
|
||||||
# this program; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
#
|
|
||||||
# Copyright MariaDB Corporation Ab 2013
|
|
||||||
#
|
|
||||||
# Revision History
|
|
||||||
# Date Who Description
|
|
||||||
# 16/07/13 Mark Riddoch Initial implementation
|
|
||||||
|
|
||||||
include build_gateway.inc
|
|
||||||
|
|
||||||
DEST=$(HOME)/usr/local/skysql
|
|
||||||
|
|
||||||
#
|
|
||||||
# A special build of MaxScale is done for tests.
|
|
||||||
# HAVE_SRV carries information whether test MaxScale server
|
|
||||||
# is built already or not.
|
|
||||||
# HAVE_SRV == Y when test server is built,
|
|
||||||
# HAVE_SRV == N when not.
|
|
||||||
# It prevents unnecessary recompilation and also clean-up
|
|
||||||
# in the middle of the test.
|
|
||||||
#
|
|
||||||
HAVE_SRV := N
|
|
||||||
|
|
||||||
.PHONY: buildtestserver
|
|
||||||
|
|
||||||
all:
|
|
||||||
(cd log_manager; make)
|
|
||||||
(cd query_classifier; make)
|
|
||||||
(cd server; make)
|
|
||||||
(cd client; make)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
echo '#define MAXSCALE_VERSION "'`cat $(ROOT_PATH)/VERSION`'"' > $(ROOT_PATH)/server/include/version.h
|
|
||||||
(cd log_manager; make clean)
|
|
||||||
(cd query_classifier; make clean)
|
|
||||||
(cd server; make clean)
|
|
||||||
(cd client; touch depend.mk; make clean)
|
|
||||||
|
|
||||||
depend:
|
|
||||||
(cd log_manager; make depend)
|
|
||||||
(cd query_classifier; make depend)
|
|
||||||
(cd server; make depend)
|
|
||||||
(cd client; touch depend.mk; make depend)
|
|
||||||
|
|
||||||
install:
|
|
||||||
(cd server; make DEST=$(DEST) install)
|
|
||||||
(cd log_manager; make DEST=$(DEST) install)
|
|
||||||
(cd query_classifier;touch depend; make DEST=$(DEST) install)
|
|
||||||
(cd client; make DEST=$(DEST) install)
|
|
||||||
|
|
||||||
cleantests:
|
|
||||||
$(MAKE) -C test cleantests
|
|
||||||
|
|
||||||
buildtests:
|
|
||||||
$(MAKE) -C test buildtests
|
|
||||||
|
|
||||||
testall:
|
|
||||||
$(MAKE) -C test HAVE_SRV=$(HAVE_SRV) testall
|
|
||||||
|
|
||||||
buildtestserver:
|
|
||||||
$(MAKE) DEBUG=Y DYNLIB=Y DEST=$(ROOT_PATH)/server/test clean depend all install
|
|
||||||
$(eval HAVE_SRV := Y)
|
|
||||||
|
|
||||||
documentation:
|
|
||||||
doxygen doxygate
|
|
||||||
|
|
||||||
|
|
320
README
320
README
@ -31,144 +31,81 @@ issues and communicate with the MaxScale community.
|
|||||||
Bugs can be reported in the MariaDB Corporation bugs database
|
Bugs can be reported in the MariaDB Corporation bugs database
|
||||||
[bug.mariadb.com](http://bugs.mariadb.com)
|
[bug.mariadb.com](http://bugs.mariadb.com)
|
||||||
|
|
||||||
|
\section Dependency List
|
||||||
|
|
||||||
|
Before building MaxScale from source, make sure you have installed all the dependencies for your system.
|
||||||
|
To install MariaDB packages configure MariaDB repositories for your system:
|
||||||
|
see instruction [here](https://downloads.mariadb.org/mariadb/repositories/)
|
||||||
|
The full list of dependencies for the most common distros:
|
||||||
|
|
||||||
|
All RHEL, CentOS and Fedora versions:
|
||||||
|
|
||||||
|
gcc gcc-c++ ncurses-devel bison glibc-devel cmake libgcc perl make libtool
|
||||||
|
openssl-devel libaio libaio-devel librabbitmq-devel
|
||||||
|
|
||||||
|
RHEL 6, 7, CentOS 6, 7, Fedora:
|
||||||
|
|
||||||
|
libedit-devel
|
||||||
|
|
||||||
|
RHEL 7, CentOS 7:
|
||||||
|
|
||||||
|
mariadb-devel mariadb-embedded-devel
|
||||||
|
|
||||||
|
RHEL 5, 7, CentOS 5, 6, Fedora 19, 20
|
||||||
|
|
||||||
|
MariaDB-devel MariaDB-server
|
||||||
|
|
||||||
|
Fedora 19, 20
|
||||||
|
|
||||||
|
systemtap-sdt-devel
|
||||||
|
|
||||||
|
to build RPM package:
|
||||||
|
|
||||||
|
rpm-build
|
||||||
|
|
||||||
|
Ubuntu 14.04, Debian 'jessie'
|
||||||
|
|
||||||
|
cmake
|
||||||
|
gcc g++ ncurses-dev bison build-essential libssl-dev libaio-dev
|
||||||
|
perl make libtool librabbitmq-dev libmariadbclient-dev
|
||||||
|
libmariadbd-dev mariadb-server
|
||||||
|
|
||||||
|
Other Ubuntu and Debian
|
||||||
|
|
||||||
|
MariaDB embedded library have to be manually extracted from tarball:
|
||||||
|
https://downloads.mariadb.org/interstitial/mariadb-5.5.41/bintar-linux-glibc_214-x86_64/mariadb-5.5.41-linux-glibc_214-x86_64.tar.gz
|
||||||
|
for old systems with glibc < 2.14:
|
||||||
|
https://downloads.mariadb.org/interstitial/mariadb-5.5.41/bintar-linux-x86_64/mariadb-5.5.41-linux-x86_64.tar.gz
|
||||||
|
|
||||||
|
To build DEB package:
|
||||||
|
dpkg-dev
|
||||||
|
|
||||||
|
OpenSUSE (mariadb-devel package, build fails):
|
||||||
|
gcc gcc-c++ ncurses-devel bison glibc-devel cmake libgcc_s1 perl
|
||||||
|
make libtool libopenssl-devel libaio libaio-devel
|
||||||
|
libedit-devel librabbitmq-devel
|
||||||
|
MariaDB-devel MariaDB-client MariaDB-server (if zypper ask which MariaDB client should be installed 'MariaDB-client' or 'mariadb-client'
|
||||||
|
please select 'MariaDB-client')
|
||||||
|
|
||||||
|
|
||||||
|
If you do not wish to install the MariaDB packages you can use the bundled RPM unpacking script:
|
||||||
|
|
||||||
|
./unpack_rpm.sh <location of MariaDB RPMs> <extraction destination>
|
||||||
|
|
||||||
|
This looks for MariaDB RPMs and unpacks them into the destination directory. This location
|
||||||
|
can then be passed to CMake to specify the location of the headers, libraries and other required files.
|
||||||
|
|
||||||
\section Building Building MaxScale
|
\section Building Building MaxScale
|
||||||
|
|
||||||
Edit the file build_gateway.inc in your MaxScale directory and set
|
Once you have installed all of MaxScale's dependencies you are ready to build MaxScale using CMake.
|
||||||
the ROOT_PATH to the directory in which you have installed the
|
|
||||||
MaxScale source code. Set the INC_PATH/MYSQL_ROOT/MYSQL_HEADERS variables
|
|
||||||
to the location in which you have installed the developer package
|
|
||||||
for MariaDB or checked out the source code of MariaDB and the
|
|
||||||
location of your MariaDB include files.
|
|
||||||
|
|
||||||
The include files, static embedded library and other files may come
|
|
||||||
from the RPMs packages:
|
|
||||||
|
|
||||||
MariaDB-5.5.34-centos6-x86_64-common.rpm
|
|
||||||
MariaDB-5.5.34-centos6-x86_64-compat.rpm
|
|
||||||
MariaDB-5.5.34-centos6-x86_64-devel.rpm
|
|
||||||
|
|
||||||
Please backup any existing my.cnf file before installing the RPMs
|
|
||||||
|
|
||||||
Install the RPM files using:
|
|
||||||
|
|
||||||
rpm -i MariaDB-5.5.34-centos6-x86_64-common.rpm MariaDB-5.5.34-centos6-x86_64-compat.rpm MariaDB-5.5.34-centos6-x86_64-devel.rpm
|
|
||||||
|
|
||||||
Note, if you wish to relocate the package to avoid an existing MariaDB
|
|
||||||
or MySQL installation you will need to use the --force option in addition
|
|
||||||
to the --relocate option.
|
|
||||||
|
|
||||||
rpm -i --force --relocate=/usr/=$PREFIX/usr/ MariaDB-5.5.34-centos6-x86_64-common.rpm MariaDB-5.5.34-centos6-x86_64-compat.rpm MariaDB-5.5.34-centos6-x86_64-devel.rpm
|
|
||||||
|
|
||||||
You can also use the included 'unpack_rpm.sh' script to unpack the RPMs without installing them.
|
|
||||||
|
|
||||||
./unpack_rpm <location of MariaDB RPMs> <extraction destination>
|
|
||||||
|
|
||||||
This README assumes $PREFIX = $HOME.
|
|
||||||
|
|
||||||
MaxScale may be built with the embedded MariaDB library either linked
|
|
||||||
dynamically or statically.
|
|
||||||
|
|
||||||
To build with the embedded libmysqld linked dynamically from an
|
|
||||||
existing MariaDB source setup
|
|
||||||
|
|
||||||
set DYNLIB := Y
|
|
||||||
copy the libmysqld.so in $(HOME)/usr/lib64/dynlib
|
|
||||||
|
|
||||||
To build with the embedded libmysqld linked statically
|
|
||||||
|
|
||||||
If DYNLIB is not set MaxScale will be built using the static library
|
|
||||||
found in $(HOME)/usr/lib64
|
|
||||||
|
|
||||||
This libmysqld.a comes from the RPM or it is copied from an existing
|
|
||||||
MariaDB setup. The file embedded_priv.h is not available in the RPM
|
|
||||||
packages, please get it from an existing MariaDB setup and copy it
|
|
||||||
to one of the path in MYSQL_HEADERS
|
|
||||||
|
|
||||||
|
|
||||||
The ERRMSG variable points to the errmsg.sys file that is required
|
|
||||||
by the embedded library.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
ERRMSG := $(HOME)/usr/share/mysql
|
|
||||||
|
|
||||||
|
|
||||||
Please note the errmsg.sys file is NOT included in the RPMs at the
|
|
||||||
current time, it must be taken from an existing MariaDB setup. The
|
|
||||||
version of the errmsg.sys file must match the version of the developer
|
|
||||||
package you are using. A version mismatch will cause the library to fail
|
|
||||||
to initialise.
|
|
||||||
|
|
||||||
You may get the one in the 'english' folder:
|
|
||||||
|
|
||||||
Example /usr/local/mariadb/share/english/errmsg.sys
|
|
||||||
|
|
||||||
|
|
||||||
Go to the MaxScale directory and do:
|
|
||||||
|
|
||||||
make depend
|
|
||||||
|
|
||||||
to update all the dependency files and then do:
|
|
||||||
|
|
||||||
make
|
|
||||||
|
|
||||||
make install
|
|
||||||
|
|
||||||
You may set the DEST variable for the target install location, example:
|
|
||||||
|
|
||||||
make DEST=/some/path
|
|
||||||
|
|
||||||
make DEST=/some/path install
|
|
||||||
|
|
||||||
|
|
||||||
If DEST is not set the default install location is:
|
|
||||||
|
|
||||||
DEST=$(HOME)/usr/local/skysql
|
|
||||||
|
|
||||||
This should get you all the things built that you need.
|
|
||||||
|
|
||||||
Other make targets are available
|
|
||||||
|
|
||||||
clean - Removes compiled code and shared objects
|
|
||||||
install - Installs the binary and the modules in the location defined by the
|
|
||||||
make variable DEST
|
|
||||||
|
|
||||||
ctags - Build tags files for the vi editor
|
|
||||||
|
|
||||||
documentation - Build the doxygen documentation
|
|
||||||
|
|
||||||
depend - Update the dependencies used by the makefiles
|
|
||||||
|
|
||||||
Two files are required for the libmysqld library that is used within MaxScale,
|
|
||||||
errmsg,sys and a my.cnf file with the following:
|
|
||||||
|
|
||||||
External libraries/packages required:
|
|
||||||
|
|
||||||
openssl and openssl-devel
|
|
||||||
libaio
|
|
||||||
|
|
||||||
Note: on CentOS 6 do:
|
|
||||||
|
|
||||||
ln -s /lib64/libaio.so.1 /lib64/libaio.so
|
|
||||||
|
|
||||||
[mysqld]
|
|
||||||
max_connections=4096
|
|
||||||
|
|
||||||
Please check errmsg.sys is found in the MaxScale install_dir DEST/MaxScale/mysql
|
|
||||||
|
|
||||||
\section Building Building MaxScale with CMake
|
|
||||||
|
|
||||||
You can also build MaxScale with CMake which makes the build process a bit more simple.
|
|
||||||
|
|
||||||
All the same dependencies are required as with the normal MaxScale build with the addition of CMake
|
|
||||||
version 2.6 for regular builds and 2.8.12 or newer if you wish to generate packages.
|
|
||||||
|
|
||||||
CMake tries to find all the required directories and files on its own but if it can't find them or you wish to
|
CMake tries to find all the required directories and files on its own but if it can't find them or you wish to
|
||||||
explicitly state the locations you can pass additional options to CMake by using the -D flag. To confirm the variable
|
explicitly state the locations you can pass additional options to CMake by using the -D flag. To confirm the variable
|
||||||
values, you can run CMake in interactive mode by using the -i flag or use a CMake GUI (for example, ccmake for command line).
|
values, you can run CMake in interactive mode by using the -i flag or use a CMake GUI (for example, ccmake for command line).
|
||||||
|
|
||||||
It is highly recommended to make a separate build directory to build into. This keeps the source and build trees clean and
|
It is highly recommended to make a separate build directory to build into.
|
||||||
makes it easy to get rid of everything you built by simply deleting the build directory.
|
This keeps the source and build trees clean and makes it easy to get rid
|
||||||
|
of everything you built by simply deleting the build directory.
|
||||||
|
|
||||||
To build MaxScale using CMake:
|
To build MaxScale using CMake:
|
||||||
|
|
||||||
@ -184,45 +121,57 @@ To build MaxScale using CMake:
|
|||||||
|
|
||||||
make install
|
make install
|
||||||
|
|
||||||
This generates the required makefiles in the current directory, compiles and links all the programs and installs
|
This generates the required makefiles in the current directory, compiles
|
||||||
|
and links all the programs and installs
|
||||||
all the required files in their right places.
|
all the required files in their right places.
|
||||||
|
|
||||||
If you have your headers and libraries in non-standard locations, you can define those locations at configuration time as such:
|
If you have your headers and libraries in non-standard locations, you can
|
||||||
|
define those locations at configuration time as such:
|
||||||
|
|
||||||
cmake -D<variable>=<value>
|
cmake -D<variable>=<value>
|
||||||
|
|
||||||
By default, MaxScale installs to '/usr/local/skysql/maxscale' and places init.d scripts and ldconfig files into their folders. Change the INSTALL_DIR
|
|
||||||
variable to your desired installation directory and set INSTALL_SYSTEM_FILES=N to prevent the init.d script and ldconfig file installation.
|
|
||||||
|
|
||||||
If you run into any trouble while configuring CMake, you can always remove the 'CMakeCache.txt' file to clear CMake's
|
This libmysqld.a comes from the RPM or it is copied from an existing
|
||||||
internal cache. This resets all values to their defaults and can be used to fix a 'stuck' configuration of CMake. This
|
MariaDB setup. The file embedded_priv.h is not available in the RPM
|
||||||
is also a good reason why you should always build into a separate directory, because you can safely wipe the build directory clean without the
|
packages, please get it from an existing MariaDB setup and copy it
|
||||||
danger of deleting important files when something goes wrong.
|
to one of the path in MYSQL_HEADERS
|
||||||
|
|
||||||
The default values that CMake uses can be found in the 'macros.cmake' file. If you wish to change these, edit the 'macros.cmake' file
|
The ERRMSG variable points to the errmsg.sys file that is required
|
||||||
or define the variables manually at configuration time.
|
by the embedded library. If you unpacked the RPMs using the script
|
||||||
|
you need to provide the location of the errmsg.sys file when you
|
||||||
|
are configuring the build system.
|
||||||
|
|
||||||
All the variables that control the CMake build process:
|
Example:
|
||||||
|
|
||||||
INSTALL_DIR=<path> Installation directory
|
cmake -DERRMSG=/home/user/share/english/errmsg.sys ..
|
||||||
|
|
||||||
BUILD_TYPE=<type> Type of the build. One of None, Debug, DebugSymbols, Optimized. (default None)
|
|
||||||
DebugSymbols enables debugging symbols, Debug enables debugging symbols and code, Optimized builds an optimized version.
|
|
||||||
|
|
||||||
INSTALL_SYSTEM_FILES=[Y|N] Install startup scripts and ld configuration files
|
Please note the errmsg.sys file is NOT included in the RPMs at the
|
||||||
EMBEDDED_LIB=<path> Path to the embedded library location (libmysqld.a for static and libmysqld.so for dynamic)
|
current time, it must be taken from an existing MariaDB setup. The
|
||||||
MYSQL_DIR=<path> Path to MySQL headers
|
version of the errmsg.sys file must match the version of the developer
|
||||||
ERRMSG=<path> Path to errmsg.sys file
|
package you are using. A version mismatch will cause the library to fail
|
||||||
STATIC_EMBEDDED=[Y|N] Whether to link the static or the dynamic verson of the library
|
to initialise.
|
||||||
GCOV=[Y|N] Generate gcov output
|
|
||||||
OLEVEL=<0-3> Level of optimization
|
By default, MaxScale installs to '/usr/local/skysql/maxscale' and places init.d scripts
|
||||||
BUILD_TESTS=[Y|N] Build tests
|
and ldconfig files into their folders. Change the CMAKE_INSTALL_PREFIX variable to your desired
|
||||||
DEPS_OK=[Y|N] Check dependencies, use N when you want to force a recheck of values
|
installation directory and set INSTALL_SYSTEM_FILES=N to prevent the init.d script and
|
||||||
DEBUG_OUTPUT=[Y|N] Produce debugging output when configuring CMake
|
ldconfig file installation.
|
||||||
RABBITMQ_LIBRARIES=<path> Path to RabbitMQ-C libraries
|
|
||||||
RABBITMQ_HEADERS=<path> Path to RabbitMQ-C headers
|
If you run into any trouble while configuring CMake, you can always remove the
|
||||||
MYSQLCLIENT_LIBRARIES=<path> Path to MySQL client libraries
|
'CMakeCache.txt' file to clear CMake's internal cache. This resets all values to their
|
||||||
MYSQLCLIENT_HEADERS=<path> Path to MySQL client headers
|
defaults and can be used to fix a 'stuck' configuration of CMake. This is also a good
|
||||||
|
reason why you should always build into a separate directory, because you can safely
|
||||||
|
wipe the build directory clean without the danger of deleting important files when
|
||||||
|
something goes wrong. Building 'out-of-source' also allows you to have multiple
|
||||||
|
configurations of MaxScale at the same time.
|
||||||
|
|
||||||
|
The default values that CMake uses can be found in the 'macros.cmake' file.
|
||||||
|
If you wish to change these, edit the 'macros.cmake' file or define the
|
||||||
|
variables manually at configuration time.
|
||||||
|
|
||||||
|
To display all CMake variables with their descriptions:
|
||||||
|
|
||||||
|
cmake -LH <path to source>
|
||||||
|
|
||||||
\section Running Running MaxScale
|
\section Running Running MaxScale
|
||||||
|
|
||||||
@ -235,58 +184,37 @@ modules it will search using a predescribed search path. The rules are:
|
|||||||
|
|
||||||
2. Look in $MAXSCALE_HOME/modules
|
2. Look in $MAXSCALE_HOME/modules
|
||||||
|
|
||||||
3. Look in /usr/local/skysql/MaxScale/modules
|
3. Look in /usr/local/skysql/maxscale/modules
|
||||||
|
|
||||||
Configuration is read by default from the file
|
Configuration is read by default from the file
|
||||||
$MAXSCALE_HOME/etc/MaxScale.cnf, /etc/MaxScale.cnf, an example file
|
$MAXSCALE_HOME/etc/MaxScale.cnf, /etc/MaxScale.cnf, an example file
|
||||||
is included in the root of the source tree. The default value of
|
is included in in the installation and can be found in the etc/ folder.
|
||||||
MAXSCALE_HOME can be overriden by use of the -c flag on the command
|
The default value of MAXSCALE_HOME can be overriden by using the -c flag
|
||||||
line. This should be immediately followed by the path to the MaxScale
|
on the command line. This should be immediately followed by the path to
|
||||||
home directory.
|
the MaxScale home directory.
|
||||||
|
|
||||||
The -f flag can be used to set the name and the location of the configuration
|
The -f flag can be used to set the name and the location of the configuration
|
||||||
file. Without path expression the file is read from $MAXSCALE_HOME/etc directory.
|
file. Without path expression the file is read from $MAXSCALE_HOME/etc directory.
|
||||||
|
|
||||||
\section Testing Running MaxScale testsuite
|
\section Testing Running MaxScale testsuite
|
||||||
|
|
||||||
To run "make testall" you need to have three mysqld servers running
|
To run "make testall" you need to have four mysqld servers running
|
||||||
on localhost:
|
on localhost. It assumes a master-slave replication setup with one slave and
|
||||||
|
three slaves.
|
||||||
|
|
||||||
* a master on port 3000, with server_id=2
|
The ports to which these servers are listening and the credentials to use for testing
|
||||||
* a slave on port 3001, server_id doesn't matter
|
can be specified in the 'macros.cmake' file.
|
||||||
* a slave on port 3002, server_id doesn't matter
|
|
||||||
|
|
||||||
On the master full privileges on the databases "test" and "FOO"
|
On the master full privileges on the databases "test" and "FOO"
|
||||||
are needed, on the saves SELECT permissions on test.* should
|
are needed, on the saves SELECT permissions on test.* should
|
||||||
be sufficient.
|
be sufficient.
|
||||||
|
|
||||||
You can use different port numbers but you'll have to change
|
When you run the 'make testall' target after configuring the build with CMake
|
||||||
the server settings at the end of server/test/MaxScale_test.cnf then.
|
a local version of MaxScale is installed into the build folder. After this a MaxScale
|
||||||
|
instance is started and the test set is executed.
|
||||||
You also always need to edit the top level test.inc file,
|
|
||||||
this file contains appropriate default values for the
|
|
||||||
test setup as described above, these are only given as
|
|
||||||
comments though ...
|
|
||||||
|
|
||||||
You can then run the full testsuite using
|
|
||||||
|
|
||||||
make testall
|
|
||||||
|
|
||||||
in the top level directory. After testing has finished you
|
|
||||||
can find a full testlog in test/test_maxscale.log
|
|
||||||
|
|
||||||
You may also find additional information in the following
|
|
||||||
component specific logs:
|
|
||||||
|
|
||||||
utils/test/testutils.log
|
|
||||||
query_classifier/test/testqclass.log
|
|
||||||
server/test/MaxScale/log/skygw_msg1.log
|
|
||||||
server/test/MaxScale/log/skygw_err1.log
|
|
||||||
server/test/MaxScale/log/skygw_trace1.log
|
|
||||||
server/test/MaxScale/log/skygw_debug1.log
|
|
||||||
server/test/testserver.log
|
|
||||||
server/core/test/testhash.log
|
|
||||||
test/test_maxscale.log
|
|
||||||
|
|
||||||
|
After testing has finished you can find a full testlog
|
||||||
|
generated by CTest in Testing/Temporary/ directory and MaxScale's
|
||||||
|
log files in the log/ directory of the build root.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
19
SETUP
19
SETUP
@ -8,29 +8,26 @@ in the README file and execute make install.
|
|||||||
|
|
||||||
Simply set the environment variable MAXSCALE_HOME to point to the
|
Simply set the environment variable MAXSCALE_HOME to point to the
|
||||||
MaxScale directory, found inside the path into which the files have been copied,
|
MaxScale directory, found inside the path into which the files have been copied,
|
||||||
e.g. MAXSCALE_HOME=/usr/local/skysql/maxscale/MaxScale
|
e.g. MAXSCALE_HOME=/usr/local/skysql/maxscale
|
||||||
|
|
||||||
Also you will need to optionaly set LD_LIBRARY_PATH to include the 'lib' folder,
|
Also you will need to optionaly set LD_LIBRARY_PATH to include the 'lib' folder,
|
||||||
found inside the path into which the files have been copied,
|
found inside the path into which the files have been copied,
|
||||||
e.g. LD_LIBRARY_PATH=/usr/local/skysql/maxscale/lib
|
e.g. LD_LIBRARY_PATH=/usr/local/skysql/maxscale/lib
|
||||||
|
|
||||||
Because we need the libmysqld library for parsing we must create a
|
|
||||||
valid my.cnf file to enable the library to be used. Copy the my.cnf
|
|
||||||
to $MAXSCALE_HOME/mysql/my.cnf.
|
|
||||||
|
|
||||||
To start MaxScale execute the command 'maxscale' from the bin folder,
|
To start MaxScale execute the command 'maxscale' from the bin folder,
|
||||||
e.g. /usr/local/skysql/maxscale/bin/maxscale
|
e.g. /usr/local/skysql/maxscale/bin/maxscale or by using the
|
||||||
|
installed init.d script.
|
||||||
|
|
||||||
Configuration
|
Configuration
|
||||||
|
|
||||||
You need to edit the file MaxScale.cnf in $MAXSCALE_HOME/etc, you should
|
You need to create and edit the file MaxScale.cnf in $MAXSCALE_HOME/etc.
|
||||||
define the set of server definitions you require, with the addresses
|
You should define the set of server definitions you require, with the addresses
|
||||||
and ports of those servers. Also define the listening ports for your
|
and ports of those servers. Also define the listening ports for your
|
||||||
various services.
|
various services.
|
||||||
|
|
||||||
In order to view the internal activity of the gateway you can telnet to
|
In order to view the internal activity of MaxScale you can telnet to
|
||||||
the port defined for the telnet listener. Initially you may login with
|
the port defined for the telnet listener. Initially you may login with
|
||||||
the user name of "admin" and the password "skysql". Once connected type
|
the user name of "admin" and the password "skysql". Once connected type
|
||||||
help for an overview of the commands and help <command> for the more
|
help for an overview of the commands and help <command> for the more
|
||||||
detailed help on commands. Use the add user command to add a new user,
|
detailed help on commands. Use the 'add user' command to add a new user
|
||||||
this will also remove the admin/skysql user.
|
which will also remove the admin/skysql user.
|
||||||
|
@ -1,68 +0,0 @@
|
|||||||
#
|
|
||||||
# This file includes all dynamically changing build-related
|
|
||||||
# variables.
|
|
||||||
#
|
|
||||||
# Current values are to satisfy MaxScale build process.
|
|
||||||
#
|
|
||||||
# Modify to match with your needs. Do not commit any private
|
|
||||||
# changes to this file!
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
#
|
|
||||||
# Set debug flags
|
|
||||||
#
|
|
||||||
DEBUG := ${MAXSCALE_DEBUG}
|
|
||||||
|
|
||||||
#
|
|
||||||
# Set build env
|
|
||||||
#
|
|
||||||
UNIX := Y
|
|
||||||
|
|
||||||
#
|
|
||||||
# Set MaxScale branch directory
|
|
||||||
#
|
|
||||||
ROOT_PATH := $(HOME)/${MAXSCALE_SOURCE}
|
|
||||||
|
|
||||||
INC_PATH := $(HOME)/usr/include
|
|
||||||
#
|
|
||||||
# Set prefix to MySQL Resources
|
|
||||||
#
|
|
||||||
MYSQL_ROOT := $(INC_PATH)/mysql
|
|
||||||
|
|
||||||
#
|
|
||||||
# Set prefix of the path to development headers
|
|
||||||
#
|
|
||||||
MYSQL_HEADERS := -I$(INC_PATH) -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 := ${MAXSCALE_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
|
|
||||||
|
|
||||||
#
|
|
||||||
# Build a binary that produces profile data
|
|
||||||
#
|
|
||||||
PROFILE := N
|
|
||||||
|
|
||||||
#
|
|
||||||
# Build a binary that produces code coverage data
|
|
||||||
#
|
|
||||||
GCOV := N
|
|
||||||
|
|
||||||
# Build optional RabbitMQ filter
|
|
||||||
# Requires librabbitmq-devel
|
|
||||||
#
|
|
||||||
BUILD_RABBITMQ := N
|
|
@ -1,83 +0,0 @@
|
|||||||
# This file is distributed as part of MaxScale. It is free
|
|
||||||
# software: you can redistribute it and/or modify it under the terms of the
|
|
||||||
# GNU General Public License as published by the Free Software Foundation,
|
|
||||||
# version 2.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
||||||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
||||||
# details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License along with
|
|
||||||
# this program; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
#
|
|
||||||
# Copyright MariaDB Corporation Ab 2014
|
|
||||||
#
|
|
||||||
# Revision History
|
|
||||||
# Date Who Description
|
|
||||||
# 13/06/14 Mark Riddoch Initial implementation of MaxScale
|
|
||||||
# client program
|
|
||||||
# 18/06/14 Mark Riddoch Addition of conditional for histedit
|
|
||||||
|
|
||||||
include ../build_gateway.inc
|
|
||||||
include ../makefile.inc
|
|
||||||
|
|
||||||
ifeq ($(wildcard /usr/include/histedit.h), )
|
|
||||||
HISTLIB=
|
|
||||||
HISTFLAG=
|
|
||||||
else
|
|
||||||
HISTLIB=-ledit
|
|
||||||
HISTFLAG=-DHISTORY
|
|
||||||
endif
|
|
||||||
|
|
||||||
CC=cc
|
|
||||||
|
|
||||||
CFLAGS=-c -Wall -g $(HISTFLAG) -I ../server/include
|
|
||||||
|
|
||||||
SRCS= maxadmin.c
|
|
||||||
|
|
||||||
HDRS=
|
|
||||||
|
|
||||||
OBJ=$(SRCS:.c=.o)
|
|
||||||
|
|
||||||
LIBS=$(HISTLIB)
|
|
||||||
|
|
||||||
all: maxadmin
|
|
||||||
|
|
||||||
cleantests:
|
|
||||||
$(MAKE) -C test cleantests
|
|
||||||
|
|
||||||
buildtests:
|
|
||||||
$(MAKE) -C test buildtests
|
|
||||||
|
|
||||||
runtests:
|
|
||||||
$(MAKE) -C test runtests
|
|
||||||
|
|
||||||
testall:
|
|
||||||
$(MAKE) -C test testall
|
|
||||||
|
|
||||||
maxadmin: $(OBJ)
|
|
||||||
$(CC) $(LDFLAGS) $(OBJ) $(LIBS) -o $@
|
|
||||||
|
|
||||||
|
|
||||||
.c.o:
|
|
||||||
$(CC) $(CFLAGS) $< -o $@
|
|
||||||
|
|
||||||
|
|
||||||
clean:
|
|
||||||
$(DEL) $(OBJ) maxadmin
|
|
||||||
$(DEL) *.so
|
|
||||||
|
|
||||||
tags:
|
|
||||||
ctags $(SRCS) $(HDRS)
|
|
||||||
|
|
||||||
depend:
|
|
||||||
@$(DEL) depend.mk
|
|
||||||
cc -M $(CFLAGS) $(SRCS) > depend.mk
|
|
||||||
|
|
||||||
install: maxadmin
|
|
||||||
@mkdir -p $(DEST)/bin
|
|
||||||
install -D maxadmin $(DEST)/bin
|
|
||||||
|
|
||||||
include depend.mk
|
|
195
client/test/maxadmin_test.sh
Normal file → Executable file
195
client/test/maxadmin_test.sh
Normal file → Executable file
@ -26,6 +26,76 @@ else
|
|||||||
echo "Auth test (long option): Passed"
|
echo "Auth test (long option): Passed"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# Test enable|disable heartbeat|root without, with invalid and with long invalid argument
|
||||||
|
#
|
||||||
|
for op in enable disable
|
||||||
|
do
|
||||||
|
for cmd in heartbeat root
|
||||||
|
do
|
||||||
|
maxadmin -pskysql $op $cmd >& /dev/null
|
||||||
|
if [ $? -eq "1" ]; then
|
||||||
|
echo "$op $cmd (missing arg): Failed"
|
||||||
|
failure=`expr $failure + 1`
|
||||||
|
else
|
||||||
|
passed=`expr $passed + 1`
|
||||||
|
echo "$op $cmd (missing arg): Passed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
maxadmin -pskysql $op $cmd qwerty >& /dev/null
|
||||||
|
if [ $? -eq "1" ]; then
|
||||||
|
echo "$op $cmd (invalid arg): Failed"
|
||||||
|
failure=`expr $failure + 1`
|
||||||
|
else
|
||||||
|
passed=`expr $passed + 1`
|
||||||
|
echo "$op $cmd (invalied arg): Passed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
maxadmin -pskysql $op $cmd xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx >& /dev/null
|
||||||
|
if [ $? -eq "1" ]; then
|
||||||
|
echo "$op $cmd (long invalid arg): Failed"
|
||||||
|
failure=`expr $failure + 1`
|
||||||
|
else
|
||||||
|
passed=`expr $passed + 1`
|
||||||
|
echo "$op $cmd (long invalid arg): Passed"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
#
|
||||||
|
# Test reload dbusers with short, and long garbage and without argument
|
||||||
|
#
|
||||||
|
maxadmin -pskysql reload dbusers qwerty >& /dev/null
|
||||||
|
if [ $? -eq "1" ]; then
|
||||||
|
echo "Reload dbusers (invalid arg): Failed"
|
||||||
|
failure=`expr $failure + 1`
|
||||||
|
else
|
||||||
|
passed=`expr $passed + 1`
|
||||||
|
echo "Reload dbusers (invalid arg): Passed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
maxadmin -pskysql reload dbusers xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx >& /dev/null
|
||||||
|
if [ $? -eq "1" ]; then
|
||||||
|
echo "Reload dbusers (long invalid arg): Failed"
|
||||||
|
failure=`expr $failure + 1`
|
||||||
|
else
|
||||||
|
passed=`expr $passed + 1`
|
||||||
|
echo "Reload dbusers (long invalid arg): Passed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
maxadmin -pskysql reload dbusers >& /dev/null
|
||||||
|
if [ $? -eq "1" ]; then
|
||||||
|
echo "Reload dbusers (missing arg): Failed"
|
||||||
|
failure=`expr $failure + 1`
|
||||||
|
else
|
||||||
|
passed=`expr $passed + 1`
|
||||||
|
echo "Reload dbusers (missing arg): Passed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# Test enable|disable log debug|trace|message|error
|
||||||
|
#
|
||||||
maxadmin -pskysql enable log debug >& /dev/null
|
maxadmin -pskysql enable log debug >& /dev/null
|
||||||
if [ $? -eq "1" ]; then
|
if [ $? -eq "1" ]; then
|
||||||
echo "Enable debug log: Failed"
|
echo "Enable debug log: Failed"
|
||||||
@ -44,6 +114,26 @@ else
|
|||||||
echo "Enable trace log: Passed"
|
echo "Enable trace log: Passed"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
maxadmin -pskysql enable log message >& /dev/null
|
||||||
|
if [ $? -eq "1" ]; then
|
||||||
|
echo "Enable message log: Failed"
|
||||||
|
failure=`expr $failure + 1`
|
||||||
|
else
|
||||||
|
passed=`expr $passed + 1`
|
||||||
|
echo "Enable message log: Passed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
maxadmin -pskysql enable log error >& /dev/null
|
||||||
|
if [ $? -eq "1" ]; then
|
||||||
|
echo "Enable error log: Failed"
|
||||||
|
failure=`expr $failure + 1`
|
||||||
|
else
|
||||||
|
passed=`expr $passed + 1`
|
||||||
|
echo "Enable error log: Passed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
maxadmin -pskysql disable log debug >& /dev/null
|
maxadmin -pskysql disable log debug >& /dev/null
|
||||||
if [ $? -eq "1" ]; then
|
if [ $? -eq "1" ]; then
|
||||||
echo "Disable debug log: Failed"
|
echo "Disable debug log: Failed"
|
||||||
@ -62,6 +152,70 @@ else
|
|||||||
echo "Disable trace log: Passed"
|
echo "Disable trace log: Passed"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# Test restart monitor|service without, with invalid and with long invalid argument
|
||||||
|
#
|
||||||
|
for cmd in monitor service
|
||||||
|
do
|
||||||
|
maxadmin -pskysql restart $cmd >& /dev/null
|
||||||
|
if [ $? -eq "1" ]; then
|
||||||
|
echo "Restart $cmd (missing arg): Failed"
|
||||||
|
failure=`expr $failure + 1`
|
||||||
|
else
|
||||||
|
passed=`expr $passed + 1`
|
||||||
|
echo "Restart $cmd (missing arg): Passed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
maxadmin -pskysql restart $cmd xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx >& /dev/null
|
||||||
|
if [ $? -eq "1" ]; then
|
||||||
|
echo "Restart $cmd (long invalid arg): Failed"
|
||||||
|
failure=`expr $failure + 1`
|
||||||
|
else
|
||||||
|
passed=`expr $passed + 1`
|
||||||
|
echo "Restart $cmd (long invalid arg): Passed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
maxadmin -pskysql restart $cmd qwerty >& /dev/null
|
||||||
|
if [ $? -eq "1" ]; then
|
||||||
|
echo "Restart $cmd (invalid arg): Failed"
|
||||||
|
failure=`expr $failure + 1`
|
||||||
|
else
|
||||||
|
passed=`expr $passed + 1`
|
||||||
|
echo "Restart $cmd (invalid arg): Passed"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
#
|
||||||
|
# Test set server qwerty master withaout, with invalid and with long invalid arg
|
||||||
|
#
|
||||||
|
maxadmin -pskysql set server qwerty >& /dev/null
|
||||||
|
if [ $? -eq "1" ]; then
|
||||||
|
echo "Set server qwerty (missing arg): Failed"
|
||||||
|
failure=`expr $failure + 1`
|
||||||
|
else
|
||||||
|
passed=`expr $passed + 1`
|
||||||
|
echo "Set server (missing arg): Passed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
maxadmin -pskysql set server qwerty mamaster >& /dev/null
|
||||||
|
if [ $? -eq "1" ]; then
|
||||||
|
echo "Set server qwerty (invalid arg): Failed"
|
||||||
|
failure=`expr $failure + 1`
|
||||||
|
else
|
||||||
|
passed=`expr $passed + 1`
|
||||||
|
echo "Set server qwerty (invalid arg): Passed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
maxadmin -pskysql set server qwerty xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx >& /dev/null
|
||||||
|
if [ $? -eq "1" ]; then
|
||||||
|
echo "Set server qwerty (long invalid arg): Failed"
|
||||||
|
failure=`expr $failure + 1`
|
||||||
|
else
|
||||||
|
passed=`expr $passed + 1`
|
||||||
|
echo "Set server qwerty (long invalid arg): Passed"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
for cmd in clients dcbs filters listeners modules monitors services servers sessions threads
|
for cmd in clients dcbs filters listeners modules monitors services servers sessions threads
|
||||||
do
|
do
|
||||||
maxadmin -pskysql list $cmd | grep -s '-' >& /dev/null
|
maxadmin -pskysql list $cmd | grep -s '-' >& /dev/null
|
||||||
@ -112,13 +266,14 @@ fi
|
|||||||
|
|
||||||
maxadmin -pskysql set server $master maint >& /dev/null
|
maxadmin -pskysql set server $master maint >& /dev/null
|
||||||
if [ $? -eq "1" ]; then
|
if [ $? -eq "1" ]; then
|
||||||
echo "set server: Failed"
|
echo "set server $master maint: Failed"
|
||||||
failure=`expr $failure + 1`
|
failure=`expr $failure + 1`
|
||||||
else
|
else
|
||||||
passed=`expr $passed + 1`
|
passed=`expr $passed + 1`
|
||||||
echo "set server: Passed"
|
echo "set server $master maint: Passed"
|
||||||
fi
|
fi
|
||||||
maxadmin -pskysql list servers | grep $master | grep -s Maint >& /dev/null
|
|
||||||
|
maxadmin -pskysql list servers | grep $master | grep -s 'Maint' >& /dev/null
|
||||||
if [ $? -eq "1" ]; then
|
if [ $? -eq "1" ]; then
|
||||||
echo "set maintenance mode: Failed"
|
echo "set maintenance mode: Failed"
|
||||||
failure=`expr $failure + 1`
|
failure=`expr $failure + 1`
|
||||||
@ -126,6 +281,7 @@ else
|
|||||||
passed=`expr $passed + 1`
|
passed=`expr $passed + 1`
|
||||||
echo "set maintenance mode: Passed"
|
echo "set maintenance mode: Passed"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
maxadmin -pskysql clear server $master maint >& /dev/null
|
maxadmin -pskysql clear server $master maint >& /dev/null
|
||||||
if [ $? -eq "1" ]; then
|
if [ $? -eq "1" ]; then
|
||||||
echo "clear server: Failed"
|
echo "clear server: Failed"
|
||||||
@ -134,7 +290,7 @@ else
|
|||||||
passed=`expr $passed + 1`
|
passed=`expr $passed + 1`
|
||||||
echo "clear server: Passed"
|
echo "clear server: Passed"
|
||||||
fi
|
fi
|
||||||
maxadmin -pskysql list servers | grep $master | grep -s Maint >& /dev/null
|
maxadmin -pskysql list servers | grep $master | grep -s 'Maint' >& /dev/null
|
||||||
if [ $? -eq "0" ]; then
|
if [ $? -eq "0" ]; then
|
||||||
echo "clear maintenance mode: Failed"
|
echo "clear maintenance mode: Failed"
|
||||||
failure=`expr $failure + 1`
|
failure=`expr $failure + 1`
|
||||||
@ -164,6 +320,37 @@ do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
#
|
||||||
|
# Test show dcb|eventq|eventstats|filter|monitor|server|service|session with invalid arg
|
||||||
|
#
|
||||||
|
for cmd in dcb eventq filter monitor server service sessions
|
||||||
|
do
|
||||||
|
maxadmin -pskysql show $cmd qwerty | grep -s '-' >& /dev/null
|
||||||
|
if [ $? -eq "0" ]; then
|
||||||
|
echo "show $cmd (invalid arg): Failed"
|
||||||
|
failure=`expr $failure + 1`
|
||||||
|
else
|
||||||
|
passed=`expr $passed + 1`
|
||||||
|
echo "show $cmd (invalid arg): Passed"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
#
|
||||||
|
# Test shutdown monitor|service with invalid extra argument
|
||||||
|
#
|
||||||
|
for cmd in monitor service
|
||||||
|
do
|
||||||
|
maxadmin -pskysql shutdown $cmd qwerty | grep -s '-' >& /dev/null
|
||||||
|
if [ $? -eq "0" ]; then
|
||||||
|
echo "Shutdown $cmd (invalid extra arg):Failed"
|
||||||
|
failure=`expr $failure + 1`
|
||||||
|
else
|
||||||
|
passed=`expr $passed + 1`
|
||||||
|
echo "Shutdown $cmd (invalid extra arg):Passed"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
sessions=`maxadmin -pskysql list sessions | awk -F\| '/Listener/ { if ( NF > 1 ) print $1 }'`
|
sessions=`maxadmin -pskysql list sessions | awk -F\| '/Listener/ { if ( NF > 1 ) print $1 }'`
|
||||||
if [ $? -eq "1" ]; then
|
if [ $? -eq "1" ]; then
|
||||||
echo "Get listener sessions: Failed"
|
echo "Get listener sessions: Failed"
|
||||||
|
10
debian/changelog
vendored
10
debian/changelog
vendored
@ -1,10 +0,0 @@
|
|||||||
maxscale (1.0-beta) UNRELEASED; urgency=low
|
|
||||||
|
|
||||||
* Beta release
|
|
||||||
|
|
||||||
-- Timofey Turenko <timofey.turenko@mariadb.com> Fri, 05 Jul 2014 14:00:00 +0200
|
|
||||||
maxscale (0.7-1) UNRELEASED; urgency=low
|
|
||||||
|
|
||||||
* Initial release. (Closes: #XXXXXX)
|
|
||||||
|
|
||||||
-- Timofey Turenko <timofey.turenko@mariadb.com> Tue, 11 Mar 2014 22:59:35 +0200
|
|
1
debian/compat
vendored
1
debian/compat
vendored
@ -1 +0,0 @@
|
|||||||
8
|
|
15
debian/control
vendored
15
debian/control
vendored
@ -1,15 +0,0 @@
|
|||||||
Source: maxscale
|
|
||||||
Maintainer: Timofey Turenko
|
|
||||||
Section: misc
|
|
||||||
Priority: optional
|
|
||||||
Standards-Version: 3.9.2
|
|
||||||
Build-Depends: debhelper (>= 8), gcc, g++, ncurses-dev, bison, build-essential, libssl-dev, libaio-dev, libmariadbclient-dev, libmariadbd-dev, mariadb-server, cmake, perl, make, libtool,
|
|
||||||
|
|
||||||
Package: maxscale
|
|
||||||
Architecture: any
|
|
||||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
|
||||||
Description: MaxScale
|
|
||||||
The MariaDB Corporation MaxScale is an intelligent proxy that allows forwarding of
|
|
||||||
database statements to one or more database servers using complex rules,
|
|
||||||
a semantic understanding of the database statements and the roles of
|
|
||||||
the various servers within the backend cluster of databases.
|
|
3
debian/install
vendored
3
debian/install
vendored
@ -1,3 +0,0 @@
|
|||||||
maxscale.conf etc/ld.so.conf.d/
|
|
||||||
etc/ubuntu/init.d/maxscale etc/init.d/
|
|
||||||
binaries/* /usr/local/skysql/maxscale/
|
|
4
debian/postinst
vendored
4
debian/postinst
vendored
@ -1,4 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
ln -s /lib64/libaio.so.1 /lib64/libaio.so
|
|
||||||
/sbin/ldconfig
|
|
11
debian/rules
vendored
11
debian/rules
vendored
@ -1,11 +0,0 @@
|
|||||||
#!/usr/bin/make -f
|
|
||||||
%:
|
|
||||||
$(MAKE) ROOT_PATH=$(shell pwd) HOME="" clean
|
|
||||||
$(MAKE) ROOT_PATH=$(shell pwd) HOME="" depend
|
|
||||||
$(MAKE) ROOT_PATH=$(shell pwd) HOME=""
|
|
||||||
$(MAKE) DEST="$(shell pwd)/binaries" ROOT_PATH=$(shell pwd) HOME="" ERRMSG="/usr/share/mysql/english" EMBEDDED_LIB="$(mysql_config --variable=pkglibdir)" install
|
|
||||||
dh $@
|
|
||||||
override_dh_usrlocal:
|
|
||||||
override_dh_auto_clean:
|
|
||||||
override_dh_auto_build:
|
|
||||||
override_dh_auto_install:
|
|
@ -1,157 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# maxscale: The MariaDB Corporation MaxScale database proxy
|
|
||||||
#
|
|
||||||
# description: MaxScale provides database specific proxy functionality
|
|
||||||
#
|
|
||||||
# processname: maxscale
|
|
||||||
#
|
|
||||||
### BEGIN INIT INFO
|
|
||||||
# Provides: maxscale
|
|
||||||
# Required-Start: $syslog $local_fs
|
|
||||||
# Required-Stop: $syslog $local_fs
|
|
||||||
# Default-Start: 2 3 4 5
|
|
||||||
# Default-Stop: 0 1 6
|
|
||||||
# Short-Description: The maxscale database proxy
|
|
||||||
# Description: MaxScale is a database proxy server that can be used to front end
|
|
||||||
# database clusters offering different routing, filtering and protocol choices
|
|
||||||
### END INIT INFO
|
|
||||||
|
|
||||||
#############################################
|
|
||||||
# MaxScale HOME, PIDFILE, LIB
|
|
||||||
#############################################
|
|
||||||
|
|
||||||
export MAXSCALE_HOME=/usr/local/skysql/maxscale
|
|
||||||
export MAXSCALE_PIDFILE=$MAXSCALE_HOME/log/maxscale.pid
|
|
||||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MAXSCALE_HOME/lib
|
|
||||||
|
|
||||||
###############################
|
|
||||||
# LSB Exit codes (non-Status)
|
|
||||||
###############################
|
|
||||||
_RETVAL_GENERIC=1
|
|
||||||
_RETVAL_NOT_INSTALLED=5
|
|
||||||
_RETVAL_NOT_RUNNING=7
|
|
||||||
|
|
||||||
###############################
|
|
||||||
# LSB Status action Exit codes
|
|
||||||
###############################
|
|
||||||
_RETVAL_STATUS_OK=0
|
|
||||||
_RETVAL_STATUS_NOT_RUNNING=3
|
|
||||||
|
|
||||||
# Sanity checks.
|
|
||||||
[ -x $MAXSCALE_HOME/bin/maxscale ] || exit $_RETVAL_NOT_INSTALLED
|
|
||||||
|
|
||||||
# Source function library.
|
|
||||||
. /etc/rc.d/init.d/functions
|
|
||||||
|
|
||||||
# we can rearrange this easily
|
|
||||||
processname=maxscale
|
|
||||||
servicename=maxscale
|
|
||||||
|
|
||||||
RETVAL=0
|
|
||||||
|
|
||||||
start() {
|
|
||||||
echo -n $"Starting MaxScale: "
|
|
||||||
my_check=`status -p $MAXSCALE_PIDFILE $MAXSCALE_HOME/bin/maxscale`
|
|
||||||
CHECK_RET=$?
|
|
||||||
[ $CHECK_RET -eq 0 ] && echo -n " found $my_check" && success && CHECK_RET=0
|
|
||||||
|
|
||||||
daemon --pidfile $MAXSCALE_PIDFILE $MAXSCALE_HOME/bin/maxscale >& /dev/null
|
|
||||||
|
|
||||||
RETVAL=$?
|
|
||||||
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$servicename
|
|
||||||
|
|
||||||
if [ $CHECK_RET -ne 0 ]; then
|
|
||||||
sleep 2
|
|
||||||
my_check=`status -p $MAXSCALE_PIDFILE $MAXSCALE_HOME/bin/maxscale`
|
|
||||||
CHECK_RET=$?
|
|
||||||
[ $CHECK_RET -eq 0 ] && echo -n $my_check && success || failure
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Return rigth code
|
|
||||||
if [ $RETVAL -ne 0 ]; then
|
|
||||||
failure
|
|
||||||
RETVAL=$_RETVAL_NOT_RUNNING
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo
|
|
||||||
|
|
||||||
return $RETVAL
|
|
||||||
}
|
|
||||||
|
|
||||||
stop() {
|
|
||||||
echo -n $"Stopping MaxScale: "
|
|
||||||
killproc -p $MAXSCALE_PIDFILE -TERM
|
|
||||||
|
|
||||||
RETVAL=$?
|
|
||||||
|
|
||||||
echo
|
|
||||||
|
|
||||||
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$servicename
|
|
||||||
|
|
||||||
# Return rigth code
|
|
||||||
if [ $RETVAL -ne 0 ]; then
|
|
||||||
RETVAL=$_RETVAL_NOT_RUNNING
|
|
||||||
fi
|
|
||||||
|
|
||||||
return $RETVAL
|
|
||||||
}
|
|
||||||
|
|
||||||
reload() {
|
|
||||||
echo -n $"Reloading MaxScale: "
|
|
||||||
|
|
||||||
killproc -p $MAXSCALE_PIDFILE $MAXSCALE_HOME/bin/maxscale -HUP
|
|
||||||
RETVAL=$?
|
|
||||||
echo
|
|
||||||
}
|
|
||||||
|
|
||||||
# See how we were called.
|
|
||||||
case "$1" in
|
|
||||||
start)
|
|
||||||
start
|
|
||||||
;;
|
|
||||||
stop)
|
|
||||||
stop
|
|
||||||
;;
|
|
||||||
status)
|
|
||||||
# return 0 on success
|
|
||||||
# return 3 on any error
|
|
||||||
|
|
||||||
echo -n $"Checking MaxScale status: "
|
|
||||||
status -p $MAXSCALE_PIDFILE 'MaxScale'
|
|
||||||
RETVAL=$?
|
|
||||||
|
|
||||||
if [ $RETVAL -ne 0 ]; then
|
|
||||||
echo -ne "\033[1A"
|
|
||||||
[ $RETVAL -eq 1 ] && warning || failure
|
|
||||||
echo -ne "\033[1B"
|
|
||||||
|
|
||||||
RETVAL=$_RETVAL_STATUS_NOT_RUNNING
|
|
||||||
else
|
|
||||||
echo -ne "\033[1A"
|
|
||||||
success
|
|
||||||
echo -ne "\033[1B"
|
|
||||||
RETVAL=$_RETVAL_STATUS_OK
|
|
||||||
fi
|
|
||||||
|
|
||||||
exit $RETVAL
|
|
||||||
;;
|
|
||||||
restart)
|
|
||||||
stop
|
|
||||||
start
|
|
||||||
;;
|
|
||||||
condrestart)
|
|
||||||
if [ -f /var/lock/subsys/$servicename ]; then
|
|
||||||
stop
|
|
||||||
start
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
reload)
|
|
||||||
reload
|
|
||||||
RETVAL=$?
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
exit $RETVAL
|
|
@ -21,7 +21,7 @@
|
|||||||
# MaxScale HOME, PIDFILE, LIB
|
# MaxScale HOME, PIDFILE, LIB
|
||||||
#############################################
|
#############################################
|
||||||
|
|
||||||
export MAXSCALE_HOME=@INSTALL_DIR@
|
export MAXSCALE_HOME=@CMAKE_INSTALL_PREFIX@
|
||||||
export MAXSCALE_PIDFILE=$MAXSCALE_HOME/log/maxscale.pid
|
export MAXSCALE_PIDFILE=$MAXSCALE_HOME/log/maxscale.pid
|
||||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MAXSCALE_HOME/lib
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MAXSCALE_HOME/lib
|
||||||
|
|
||||||
|
@ -1,145 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# maxscale: The MariaDB Corporation MaxScale database proxy
|
|
||||||
#
|
|
||||||
# description: MaxScale provides database specific proxy functionality
|
|
||||||
#
|
|
||||||
# processname: maxscale
|
|
||||||
#
|
|
||||||
### BEGIN INIT INFO
|
|
||||||
# Provides: maxscale
|
|
||||||
# Required-Start: $syslog $local_fs
|
|
||||||
# Required-Stop: $syslog $local_fs
|
|
||||||
# Default-Start: 2 3 4 5
|
|
||||||
# Default-Stop: 0 1 6
|
|
||||||
# Short-Description: The maxscale database proxy
|
|
||||||
# Description: MaxScale is a database proxy server that can be used to front end
|
|
||||||
# database clusters offering different routing, filtering and protocol choices
|
|
||||||
### END INIT INFO
|
|
||||||
|
|
||||||
#############################################
|
|
||||||
# MaxScale HOME, PIDFILE, LIB
|
|
||||||
#############################################
|
|
||||||
|
|
||||||
export MAXSCALE_HOME=/usr/local/skysql/maxscale
|
|
||||||
export MAXSCALE_PIDFILE=$MAXSCALE_HOME/log/maxscale.pid
|
|
||||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MAXSCALE_HOME/lib
|
|
||||||
|
|
||||||
###############################
|
|
||||||
# LSB Exit codes (non-Status)
|
|
||||||
###############################
|
|
||||||
_RETVAL_GENERIC=1
|
|
||||||
_RETVAL_NOT_INSTALLED=5
|
|
||||||
_RETVAL_NOT_RUNNING=7
|
|
||||||
|
|
||||||
###############################
|
|
||||||
# LSB Status action Exit codes
|
|
||||||
###############################
|
|
||||||
_RETVAL_STATUS_OK=0
|
|
||||||
_RETVAL_STATUS_NOT_RUNNING=3
|
|
||||||
|
|
||||||
# Sanity checks.
|
|
||||||
[ -x $MAXSCALE_HOME/bin/maxscale ] || exit $_RETVAL_NOT_INSTALLED
|
|
||||||
|
|
||||||
#################################
|
|
||||||
# stop/start/status related vars
|
|
||||||
#################################
|
|
||||||
NAME=maxscale
|
|
||||||
DAEMON=$MAXSCALE_HOME/bin/maxscale
|
|
||||||
|
|
||||||
# Source function library.
|
|
||||||
. /lib/lsb/init-functions
|
|
||||||
|
|
||||||
# we can rearrange this easily
|
|
||||||
processname=maxscale
|
|
||||||
servicename=maxscale
|
|
||||||
|
|
||||||
RETVAL=0
|
|
||||||
|
|
||||||
start() {
|
|
||||||
log_daemon_msg "Starting MaxScale"
|
|
||||||
start_daemon -p $MAXSCALE_PIDFILE $DAEMON 2> /dev/null
|
|
||||||
|
|
||||||
sleep 2
|
|
||||||
|
|
||||||
status_of_proc -p $MAXSCALE_PIDFILE $DAEMON $NAME
|
|
||||||
|
|
||||||
log_end_msg $?
|
|
||||||
}
|
|
||||||
|
|
||||||
stop() {
|
|
||||||
log_daemon_msg "Stopping MaxScale"
|
|
||||||
killproc -p $PIDFILE $DAEMON 2>&1 /dev/null
|
|
||||||
|
|
||||||
maxscale_wait_stop
|
|
||||||
|
|
||||||
log_end_msg $?
|
|
||||||
}
|
|
||||||
|
|
||||||
reload() {
|
|
||||||
log_daemon_msg "Reloading MaxScale"
|
|
||||||
|
|
||||||
killproc -p $MAXSCALE_PIDFILE $DAEMON 1
|
|
||||||
|
|
||||||
log_end_msg $?
|
|
||||||
}
|
|
||||||
|
|
||||||
maxscale_wait_stop() {
|
|
||||||
PIDTMP=$(pidofproc -p $MAXSCALE_PIDFILE $MAXSCALE_HOME/bin/maxscale)
|
|
||||||
kill -TERM "${PIDTMP:-}" 2> /dev/null;
|
|
||||||
if [ -n "${PIDTMP:-}" ] && kill -0 "${PIDTMP:-}" 2> /dev/null; then
|
|
||||||
local i=0
|
|
||||||
while kill -0 "${PIDTMP:-}" 2> /dev/null; do
|
|
||||||
if [ $i = '60' ]; then
|
|
||||||
break
|
|
||||||
STATUS=2
|
|
||||||
fi
|
|
||||||
[ "$VERBOSE" != no ] && log_progress_msg "."
|
|
||||||
sleep 1
|
|
||||||
i=$(($i+1))
|
|
||||||
done
|
|
||||||
return $STATUS
|
|
||||||
else
|
|
||||||
return $STATUS
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# See how we were called.
|
|
||||||
case "$1" in
|
|
||||||
start)
|
|
||||||
start
|
|
||||||
;;
|
|
||||||
stop)
|
|
||||||
stop
|
|
||||||
;;
|
|
||||||
status)
|
|
||||||
# return 0 on success
|
|
||||||
# return 3 on any error
|
|
||||||
|
|
||||||
log_daemon_msg "Checking MaxScale"
|
|
||||||
status_of_proc -p $MAXSCALE_PIDFILE $DAEMON $NAME
|
|
||||||
RETVAL=$?
|
|
||||||
|
|
||||||
if [ $RETVAL -ne 0 ]; then
|
|
||||||
[ $RETVAL -eq 1 ]
|
|
||||||
|
|
||||||
RETVAL=$_RETVAL_STATUS_NOT_RUNNING
|
|
||||||
else
|
|
||||||
RETVAL=$_RETVAL_STATUS_OK
|
|
||||||
fi
|
|
||||||
|
|
||||||
log_end_msg $RETVAL
|
|
||||||
;;
|
|
||||||
restart)
|
|
||||||
stop
|
|
||||||
start
|
|
||||||
;;
|
|
||||||
reload)
|
|
||||||
reload
|
|
||||||
RETVAL=$?
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo $"Usage: $0 {start|stop|status|restart|reload}"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
exit $RETVAL
|
|
2
etc/ubuntu/init.d/maxscale.in
Normal file → Executable file
2
etc/ubuntu/init.d/maxscale.in
Normal file → Executable file
@ -21,7 +21,7 @@
|
|||||||
# MaxScale HOME, PIDFILE, LIB
|
# MaxScale HOME, PIDFILE, LIB
|
||||||
#############################################
|
#############################################
|
||||||
|
|
||||||
export MAXSCALE_HOME=@INSTALL_DIR@
|
export MAXSCALE_HOME=@CMAKE_INSTALL_PREFIX@
|
||||||
export MAXSCALE_PIDFILE=$MAXSCALE_HOME/log/maxscale.pid
|
export MAXSCALE_PIDFILE=$MAXSCALE_HOME/log/maxscale.pid
|
||||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MAXSCALE_HOME/lib
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MAXSCALE_HOME/lib
|
||||||
|
|
||||||
|
@ -1,72 +0,0 @@
|
|||||||
include ../build_gateway.inc
|
|
||||||
include ../makefile.inc
|
|
||||||
|
|
||||||
CC = gcc
|
|
||||||
CPP = g++
|
|
||||||
|
|
||||||
SRCS := log_manager.cc
|
|
||||||
UTILS_PATH := $(ROOT_PATH)/utils
|
|
||||||
CUR_DIR := $(shell pwd)
|
|
||||||
|
|
||||||
ifeq ($(ADD_DEBUG_TAGS),Y)
|
|
||||||
CFLAGS += -DSS_LOG_DEBUG
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
makeall: clean all
|
|
||||||
|
|
||||||
clean:
|
|
||||||
$(MAKE) -C $(UTILS_PATH) clean
|
|
||||||
- $(DEL) *.o
|
|
||||||
- $(DEL) *.so
|
|
||||||
- $(DEL) *.so.1.0.1
|
|
||||||
- $(DEL) *~
|
|
||||||
- $(DEL) depend
|
|
||||||
|
|
||||||
all: utils lib
|
|
||||||
|
|
||||||
|
|
||||||
utils:
|
|
||||||
$(MAKE) -C $(UTILS_PATH) clean all
|
|
||||||
|
|
||||||
lib: libcomp liblink
|
|
||||||
|
|
||||||
libcomp:
|
|
||||||
$(CPP) -c $(CFLAGS) \
|
|
||||||
$(MYSQL_HEADERS) \
|
|
||||||
-I$(UTILS_PATH) -I./ \
|
|
||||||
-fPIC ./log_manager.cc -o log_manager.o $(LDLIBS)
|
|
||||||
|
|
||||||
liblink:
|
|
||||||
$(CPP) -shared \
|
|
||||||
-Wl,-soname,liblog_manager.so \
|
|
||||||
-o liblog_manager.so.1.0.1 log_manager.o \
|
|
||||||
$(LDLIBS) $(CPP_LDLIBS)
|
|
||||||
$(DEL) ./liblog_manager.so
|
|
||||||
$(LINK) ./liblog_manager.so.1.0.1 ./liblog_manager.so
|
|
||||||
|
|
||||||
install: liblink
|
|
||||||
install liblog_manager.so.1.0.1 liblog_manager.so $(DEST)/lib
|
|
||||||
|
|
||||||
depend:
|
|
||||||
@$(DEL) depend
|
|
||||||
$(CPP) -M $(CFLAGS) \
|
|
||||||
$(MYSQL_HEADERS) \
|
|
||||||
-I$(UTILS_PATH) -I./ \
|
|
||||||
$(SRCS) > depend
|
|
||||||
|
|
||||||
cleantests:
|
|
||||||
$(MAKE) -C test cleantests
|
|
||||||
|
|
||||||
buildtests:
|
|
||||||
$(MAKE) -C test DEBUG=Y buildtests
|
|
||||||
|
|
||||||
runtests:
|
|
||||||
$(MAKE) -C test runtests
|
|
||||||
|
|
||||||
testall:
|
|
||||||
$(MAKE) -C test testall
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
include depend
|
|
@ -1,85 +0,0 @@
|
|||||||
# cleantests - clean local and subdirectories' tests
|
|
||||||
# buildtests - build all local and subdirectories' tests
|
|
||||||
# runtests - run all local tests
|
|
||||||
# testall - clean, build and run local and subdirectories' tests
|
|
||||||
|
|
||||||
include ../../build_gateway.inc
|
|
||||||
include ../../makefile.inc
|
|
||||||
include ../../test.inc
|
|
||||||
|
|
||||||
CC = gcc
|
|
||||||
CPP = g++
|
|
||||||
|
|
||||||
TESTPATH := $(shell pwd)
|
|
||||||
TESTLOG := $(TESTPATH)/testlog.log
|
|
||||||
LOG_MANAGER_PATH:= $(ROOT_PATH)/log_manager
|
|
||||||
TESTAPP := $(TESTPATH)/testlog
|
|
||||||
UTILS_PATH := $(ROOT_PATH)/utils
|
|
||||||
|
|
||||||
# Use two threads by default
|
|
||||||
ifndef NTHR
|
|
||||||
NTHR=2
|
|
||||||
endif
|
|
||||||
|
|
||||||
testall:
|
|
||||||
$(MAKE) cleantests
|
|
||||||
$(MAKE) DEBUG=Y buildtests
|
|
||||||
$(MAKE) runtests
|
|
||||||
|
|
||||||
cleantests:
|
|
||||||
- $(DEL) *.o
|
|
||||||
- $(DEL) *.log
|
|
||||||
- $(DEL) testlog
|
|
||||||
- $(DEL) testorder
|
|
||||||
- $(DEL) *~
|
|
||||||
|
|
||||||
buildtests:
|
|
||||||
$(MAKE) -C $(LOG_MANAGER_PATH) ADD_DEBUG_TAGS=Y
|
|
||||||
$(CC) $(CFLAGS) \
|
|
||||||
-L$(LOG_MANAGER_PATH) \
|
|
||||||
-Wl,-rpath,$(DEST)/lib \
|
|
||||||
-Wl,-rpath,$(LOG_MANAGER_PATH)/ \
|
|
||||||
-o testlog \
|
|
||||||
-I$(MARIADB_SRC_PATH)/include \
|
|
||||||
-I$(LOG_MANAGER_PATH) -I$(UTILS_PATH) testlog.c \
|
|
||||||
-lstdc++ -llog_manager $(LDLIBS) \
|
|
||||||
$(UTILS_PATH)/skygw_utils.o
|
|
||||||
$(CC) $(CFLAGS) \
|
|
||||||
-L$(LOG_MANAGER_PATH) \
|
|
||||||
-Wl,-rpath,$(DEST)/lib \
|
|
||||||
-Wl,-rpath,$(LOG_MANAGER_PATH)/ \
|
|
||||||
-o testorder \
|
|
||||||
-I$(MARIADB_SRC_PATH)/include \
|
|
||||||
-I$(LOG_MANAGER_PATH) -I$(UTILS_PATH) testorder.c \
|
|
||||||
-lstdc++ -llog_manager $(LDLIBS) \
|
|
||||||
$(UTILS_PATH)/skygw_utils.o
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
runtests:
|
|
||||||
@echo "" > $(TESTLOG)
|
|
||||||
@echo "-------------------------------" >> $(TESTLOG)
|
|
||||||
@echo $(shell date) >> $(TESTLOG)
|
|
||||||
@echo "Test Log Manager" >> $(TESTLOG)
|
|
||||||
@echo "-------------------------------" >> $(TESTLOG)
|
|
||||||
@echo "" >> $(TESTLOG)
|
|
||||||
@echo "Use 1 thread" >> $(TESTLOG)
|
|
||||||
@echo "" >> $(TESTLOG)
|
|
||||||
@-$(LAUNCH_DEBUGGER) $(TESTAPP) "-t 1" 2>>$(TESTLOG)
|
|
||||||
@echo "" >> $(TESTLOG)
|
|
||||||
@echo "Use 8 threads" >> $(TESTLOG)
|
|
||||||
@echo "" >> $(TESTLOG)
|
|
||||||
@-$(LAUNCH_DEBUGGER) $(TESTAPP) "-t 8" 2>>$(TESTLOG)
|
|
||||||
@echo "" >> $(TESTLOG)
|
|
||||||
@echo "Use 16 threads" >> $(TESTLOG)
|
|
||||||
@echo "" >> $(TESTLOG)
|
|
||||||
@-$(LAUNCH_DEBUGGER) $(TESTAPP) "-t 16" 2>>$(TESTLOG)
|
|
||||||
@echo "" >> $(TEST_MAXSCALE_LOG)
|
|
||||||
@echo "Test Message Order" >> $(TEST_MAXSCALE_LOG)
|
|
||||||
@echo "" >> $(TEST_MAXSCALE_LOG)
|
|
||||||
./logorder.sh 500 0 500 $(TEST_MAXSCALE_LOG)
|
|
||||||
@echo "Log Manager PASSED" >> $(TESTLOG)
|
|
||||||
@echo "" >> $(TESTLOG)
|
|
||||||
|
|
||||||
# @cat $(TESTLOG) >> $(TEST_MAXSCALE_LOG)
|
|
51
macros.cmake
51
macros.cmake
@ -17,9 +17,6 @@ endmacro()
|
|||||||
|
|
||||||
macro(set_variables)
|
macro(set_variables)
|
||||||
|
|
||||||
# Installation directory
|
|
||||||
set(INSTALL_DIR "/usr/local/skysql/maxscale/" CACHE PATH "MaxScale installation directory.")
|
|
||||||
|
|
||||||
# Build type
|
# Build type
|
||||||
set(BUILD_TYPE "None" CACHE STRING "Build type, possible values are:None, Debug, DebugSymbols, Optimized.")
|
set(BUILD_TYPE "None" CACHE STRING "Build type, possible values are:None, Debug, DebugSymbols, Optimized.")
|
||||||
|
|
||||||
@ -129,7 +126,7 @@ debugmsg("Search returned: ${MYSQL_DIR_LOC}")
|
|||||||
message(STATUS "Using custom errmsg.sys found at: ${ERRMSG_FILE}")
|
message(STATUS "Using custom errmsg.sys found at: ${ERRMSG_FILE}")
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
find_file(ERRMSG_FILE errmsg.sys PATHS /usr/share/mysql /usr/local/share/mysql PATH_SUFFIXES english)
|
find_file(ERRMSG_FILE errmsg.sys PATHS /usr/share /usr/share/mysql /usr/local/share/mysql PATH_SUFFIXES english mysql/english)
|
||||||
if(${ERRMSG_FILE} MATCHES "NOTFOUND")
|
if(${ERRMSG_FILE} MATCHES "NOTFOUND")
|
||||||
set(DEPS_OK FALSE CACHE BOOL "If all the dependencies were found.")
|
set(DEPS_OK FALSE CACHE BOOL "If all the dependencies were found.")
|
||||||
message(FATAL_ERROR "Fatal Error: The errmsg.sys file was not found, please define the path to it by using -DERRMSG=<path>")
|
message(FATAL_ERROR "Fatal Error: The errmsg.sys file was not found, please define the path to it by using -DERRMSG=<path>")
|
||||||
@ -145,7 +142,7 @@ debugmsg("Search returned: ${MYSQL_DIR_LOC}")
|
|||||||
if (DEFINED EMBEDDED_LIB)
|
if (DEFINED EMBEDDED_LIB)
|
||||||
if( NOT (IS_DIRECTORY ${EMBEDDED_LIB}) )
|
if( NOT (IS_DIRECTORY ${EMBEDDED_LIB}) )
|
||||||
debugmsg("EMBEDDED_LIB is not a directory: ${EMBEDDED_LIB}")
|
debugmsg("EMBEDDED_LIB is not a directory: ${EMBEDDED_LIB}")
|
||||||
if(${CMAKE_VERSION} VERSION_LESS 2.12 )
|
if(${CMAKE_VERSION} VERSION_LESS 2.8.12 )
|
||||||
set(COMP_VAR PATH)
|
set(COMP_VAR PATH)
|
||||||
else()
|
else()
|
||||||
set(COMP_VAR DIRECTORY)
|
set(COMP_VAR DIRECTORY)
|
||||||
@ -218,53 +215,9 @@ debugmsg("Search returned: ${MYSQL_DIR_LOC}")
|
|||||||
unset(DEB_FNC)
|
unset(DEB_FNC)
|
||||||
unset(RPM_FNC)
|
unset(RPM_FNC)
|
||||||
|
|
||||||
#Find the MySQL client library
|
|
||||||
# find_library(MYSQLCLIENT_LIBRARIES NAMES mysqlclient PATH_SUFFIXES mysql mariadb)
|
|
||||||
# if(${MYSQLCLIENT_LIBRARIES} MATCHES "NOTFOUND")
|
|
||||||
# set(MYSQLCLIENT_FOUND FALSE CACHE INTERNAL "")
|
|
||||||
# message(STATUS "Cannot find MySQL client library: Login tests disabled.")
|
|
||||||
# else()
|
|
||||||
# set(MYSQLCLIENT_FOUND TRUE CACHE INTERNAL "")
|
|
||||||
# message(STATUS "Found MySQL client library: ${MYSQLCLIENT_LIBRARIES}")
|
|
||||||
# endif()
|
|
||||||
|
|
||||||
#Check RabbitMQ headers and libraries
|
#Check RabbitMQ headers and libraries
|
||||||
if(BUILD_RABBITMQ)
|
if(BUILD_RABBITMQ)
|
||||||
find_package(RabbitMQ)
|
find_package(RabbitMQ)
|
||||||
# include(CheckCSourceCompiles)
|
|
||||||
#
|
|
||||||
# if(DEFINED RABBITMQ_LIB)
|
|
||||||
# find_library(RMQ_LIB rabbitmq PATHS ${RABBITMQ_LIB} NO_DEFAULT_PATH)
|
|
||||||
# else()
|
|
||||||
# find_library(RMQ_LIB rabbitmq)
|
|
||||||
# endif()
|
|
||||||
# if(RMQ_LIB MATCHES "NOTFOUND")
|
|
||||||
# set(DEPS_OK FALSE CACHE BOOL "If all the dependencies were found.")
|
|
||||||
# message(FATAL_ERROR "Cannot find RabbitMQ libraries, please define the path to the libraries with -DRABBITMQ_LIB=<path>")
|
|
||||||
# else()
|
|
||||||
# set(RABBITMQ_LIB ${RMQ_LIB} CACHE PATH "Path to RabbitMQ libraries" FORCE)
|
|
||||||
# message(STATUS "Using RabbitMQ libraries found at: ${RABBITMQ_LIB}")
|
|
||||||
# endif()
|
|
||||||
#
|
|
||||||
# if(DEFINED RABBITMQ_HEADERS)
|
|
||||||
# find_file(RMQ_HEADERS amqp.h PATHS ${RABBITMQ_HEADERS} NO_DEFAULT_PATH)
|
|
||||||
# else()
|
|
||||||
# find_file(RMQ_HEADERS amqp.h)
|
|
||||||
# endif()
|
|
||||||
# if(RMQ_HEADERS MATCHES "NOTFOUND")
|
|
||||||
# set(DEPS_OK FALSE CACHE BOOL "If all the dependencies were found.")
|
|
||||||
# message(FATAL_ERROR "Cannot find RabbitMQ headers, please define the path to the headers with -DRABBITMQ_HEADERS=<path>")
|
|
||||||
# else()
|
|
||||||
# set(RABBITMQ_HEADERS ${RMQ_HEADERS} CACHE PATH "Path to RabbitMQ headers" FORCE)
|
|
||||||
# message(STATUS "Using RabbitMQ headers found at: ${RABBITMQ_HEADERS}")
|
|
||||||
# endif()
|
|
||||||
#
|
|
||||||
# set(CMAKE_REQUIRED_INCLUDES ${RABBITMQ_HEADERS})
|
|
||||||
# check_c_source_compiles("#include <amqp.h>\n int main(){if(AMQP_DELIVERY_PERSISTENT){return 0;}return 1;}" HAVE_RMQ50)
|
|
||||||
# if(NOT HAVE_RMQ50)
|
|
||||||
# message(FATAL_ERROR "Old version of RabbitMQ-C library found. Version 0.5 or newer is required.")
|
|
||||||
# endif()
|
|
||||||
#
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endmacro()
|
endmacro()
|
||||||
|
53
makefile.inc
53
makefile.inc
@ -1,53 +0,0 @@
|
|||||||
#
|
|
||||||
# This file is static. It handles the dynamic content of build.inc,
|
|
||||||
# for example, by setting compiler flags etc.
|
|
||||||
|
|
||||||
# Changes to environment, such as building directories etc. are made to
|
|
||||||
# build_gateway.inc.
|
|
||||||
# A template file build_gateway_l2x64.inc is stored in directory 'config'.
|
|
||||||
# Template can't be used as such, but hopefully only little modifications are
|
|
||||||
# needed, such as setting build directory etc.
|
|
||||||
#
|
|
||||||
|
|
||||||
#ifdef UNIX
|
|
||||||
DEL := rm -fr
|
|
||||||
LINK := ln -s
|
|
||||||
COPY := cp
|
|
||||||
NOHUP := nohup
|
|
||||||
#endif
|
|
||||||
|
|
||||||
LIB := libmysqld.a
|
|
||||||
|
|
||||||
ifdef DYNLIB
|
|
||||||
LIB := libmysqld.so.18
|
|
||||||
endif
|
|
||||||
|
|
||||||
# -O2 -g -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -fPIC
|
|
||||||
|
|
||||||
CFLAGS := $(CFLAGS) -Wall
|
|
||||||
LDLIBS := $(LDLIBS) -pthread -lm
|
|
||||||
LDMYSQL := -lmysqld
|
|
||||||
CPP_LDLIBS := -lstdc++
|
|
||||||
|
|
||||||
#
|
|
||||||
# Compiler flags, httpd arguments and debugger options
|
|
||||||
#
|
|
||||||
ifdef DEBUG
|
|
||||||
DEBUG_FLAGS := -DSS_DEBUG -pipe -Wformat -Werror=format-security -fstack-protector --param=ssp-buffer-size=4 -fPIC
|
|
||||||
CFLAGS := $(CFLAGS) -ggdb -O0 -pthread $(DEBUG_FLAGS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
ifdef PROF
|
|
||||||
CFLAGS := $(CFLAGS) -DSS_PROF
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq "$(PROFILE)" "Y"
|
|
||||||
CFLAGS += -pg
|
|
||||||
LDFLAGS += -pg
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq "$(GCOV)" "Y"
|
|
||||||
CFLAGS += -fprofile-arcs -ftest-coverage
|
|
||||||
LIBS += -lgcov
|
|
||||||
endif
|
|
@ -1,2 +0,0 @@
|
|||||||
/usr/local/skysql/maxscale/modules
|
|
||||||
/usr/local/skysql/maxscale/lib
|
|
@ -1,2 +1,2 @@
|
|||||||
@INSTALL_DIR@/modules
|
@CMAKE_INSTALL_PREFIX@/modules
|
||||||
@INSTALL_DIR@/lib
|
@CMAKE_INSTALL_PREFIX@/lib
|
||||||
|
@ -1,66 +0,0 @@
|
|||||||
%define _topdir %(echo $PWD)/
|
|
||||||
%define name maxscale
|
|
||||||
%define release beta
|
|
||||||
%define version 1.0
|
|
||||||
%define install_path /usr/local/skysql/maxscale/
|
|
||||||
|
|
||||||
BuildRoot: %{buildroot}
|
|
||||||
Summary: maxscale
|
|
||||||
License: GPL
|
|
||||||
Name: %{name}
|
|
||||||
Version: %{version}
|
|
||||||
Release: %{release}
|
|
||||||
Source: %{name}-%{version}-%{release}.tar.gz
|
|
||||||
Prefix: /
|
|
||||||
Group: Development/Tools
|
|
||||||
#Requires:
|
|
||||||
|
|
||||||
%if 0%{?suse_version}
|
|
||||||
BuildRequires: gcc gcc-c++ ncurses-devel bison glibc-devel cmake libgcc_s1 perl make libtool libopenssl-devel libaio libaio-devel mariadb libedit-devel librabbitmq-devel
|
|
||||||
%else
|
|
||||||
BuildRequires: gcc gcc-c++ ncurses-devel bison glibc-devel cmake libgcc perl make libtool openssl-devel libaio libaio-devel librabbitmq-devel
|
|
||||||
%if 0%{?rhel} == 6
|
|
||||||
BuildRequires: libedit-devel
|
|
||||||
%endif
|
|
||||||
%if 0%{?rhel} == 7
|
|
||||||
BuildRequires: mariadb-devel mariadb-embedded-devel libedit-devel
|
|
||||||
%else
|
|
||||||
BuildRequires: MariaDB-devel MariaDB-server
|
|
||||||
%endif
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%description
|
|
||||||
MaxScale
|
|
||||||
|
|
||||||
%prep
|
|
||||||
|
|
||||||
%setup -q
|
|
||||||
|
|
||||||
%build
|
|
||||||
#ln -s /lib64/libaio.so.1 /lib64/libaio.so
|
|
||||||
make ROOT_PATH=`pwd` HOME="" $DEBUG_FLAG1 $DEBUG_FLAG2 clean
|
|
||||||
make ROOT_PATH=`pwd` HOME="" $DEBUG_FLAG1 $DEBUG_FLAG2 depend
|
|
||||||
make ROOT_PATH=`pwd` HOME="" $DEBUG_FLAG1 $DEBUG_FLAG2
|
|
||||||
make DEST=`pwd`/binaries ROOT_PATH=`pwd` HOME="" ERRMSG="/usr/share/mysql/english" $DEBUG_FLAG1 $DEBUG_FLAG2 install
|
|
||||||
|
|
||||||
%post
|
|
||||||
ln -s /lib64/libaio.so.1 /lib64/libaio.so
|
|
||||||
/sbin/ldconfig
|
|
||||||
|
|
||||||
%install
|
|
||||||
mkdir -p $RPM_BUILD_ROOT/etc/ld.so.conf.d/
|
|
||||||
mkdir -p $RPM_BUILD_ROOT/etc/init.d/
|
|
||||||
mkdir -p $RPM_BUILD_ROOT%{install_path}
|
|
||||||
cp -r binaries/* $RPM_BUILD_ROOT%{install_path}
|
|
||||||
cp maxscale.conf $RPM_BUILD_ROOT/etc/ld.so.conf.d/
|
|
||||||
cp etc/init.d/maxscale $RPM_BUILD_ROOT/etc/init.d/
|
|
||||||
|
|
||||||
%clean
|
|
||||||
|
|
||||||
%files
|
|
||||||
%defattr(-,root,root)
|
|
||||||
%{install_path}
|
|
||||||
/etc/ld.so.conf.d/maxscale.conf
|
|
||||||
/etc/init.d/maxscale
|
|
||||||
|
|
||||||
%changelog
|
|
@ -1,79 +0,0 @@
|
|||||||
include ../build_gateway.inc
|
|
||||||
include ../makefile.inc
|
|
||||||
|
|
||||||
CC = gcc
|
|
||||||
CPP = g++
|
|
||||||
|
|
||||||
SRCS := query_classifier.cc
|
|
||||||
UTILS_PATH := $(ROOT_PATH)/utils
|
|
||||||
QUERY_CLASSIFIER_PATH := $(ROOT_PATH)/query_classifier
|
|
||||||
LOG_MANAGER_PATH := $(ROOT_PATH)/log_manager
|
|
||||||
SERVER_INC_PATH := $(ROOT_PATH)/server/include
|
|
||||||
MODULE_INC_PATH := $(ROOT_PATH)/server/modules/include
|
|
||||||
|
|
||||||
makeall: clean all
|
|
||||||
|
|
||||||
clean:
|
|
||||||
$(MAKE) -C $(UTILS_PATH) clean
|
|
||||||
- $(DEL) query_classifier.o
|
|
||||||
- $(DEL) libquery_classifier.so
|
|
||||||
- $(DEL) libquery_classifier.so.1.0.1
|
|
||||||
- $(DEL) *~
|
|
||||||
- $(DEL) depend
|
|
||||||
|
|
||||||
all: utils lib
|
|
||||||
|
|
||||||
cleantests:
|
|
||||||
$(MAKE) -C test cleantests
|
|
||||||
|
|
||||||
buildtests:
|
|
||||||
$(MAKE) -C test DEBUG=Y DYNLIB=Y buildtests
|
|
||||||
|
|
||||||
runtests:
|
|
||||||
$(MAKE) -C test runtests
|
|
||||||
|
|
||||||
testall:
|
|
||||||
$(MAKE) -C test testall
|
|
||||||
|
|
||||||
utils:
|
|
||||||
$(MAKE) -C $(UTILS_PATH) clean all
|
|
||||||
|
|
||||||
lib: libcomp liblink
|
|
||||||
|
|
||||||
libcomp:
|
|
||||||
$(CPP) -c $(CFLAGS) \
|
|
||||||
$(MYSQL_HEADERS) \
|
|
||||||
-I$(LOG_MANAGER_PATH) \
|
|
||||||
-I$(SERVER_INC_PATH) \
|
|
||||||
-I$(MODULE_INC_PATH) \
|
|
||||||
-I$(UTILS_PATH) \
|
|
||||||
-I./ \
|
|
||||||
-fPIC ./query_classifier.cc -o query_classifier.o
|
|
||||||
|
|
||||||
liblink:
|
|
||||||
$(CPP) -shared \
|
|
||||||
-L$(EMBEDDED_LIB) \
|
|
||||||
-Wl,-soname,libquery_classifier.so \
|
|
||||||
-Wl,-rpath,$(DEST)/lib \
|
|
||||||
-Wl,-rpath,$(EMBEDDED_LIB) \
|
|
||||||
-o libquery_classifier.so.1.0.1 ./query_classifier.o \
|
|
||||||
$(LDLIBS) $(LDMYSQL) $(CPP_LDLIBS)
|
|
||||||
$(DEL) ./libquery_classifier.so
|
|
||||||
$(LINK) ./libquery_classifier.so.1.0.1 ./libquery_classifier.so
|
|
||||||
|
|
||||||
|
|
||||||
install: liblink
|
|
||||||
install ./libquery_classifier.so.1.0.1 ./libquery_classifier.so $(DEST)/lib
|
|
||||||
|
|
||||||
depend:
|
|
||||||
@$(DEL) depend
|
|
||||||
$(CPP) -M $(CFLAGS) \
|
|
||||||
$(MYSQL_HEADERS) \
|
|
||||||
-I$(LOG_MANAGER_PATH) \
|
|
||||||
-I$(SERVER_INC_PATH) \
|
|
||||||
-I$(MODULE_INC_PATH) \
|
|
||||||
-I$(UTILS_PATH) \
|
|
||||||
-I./ \
|
|
||||||
$(SRCS) > depend
|
|
||||||
|
|
||||||
include depend
|
|
@ -391,29 +391,6 @@ return_here:
|
|||||||
return failp;
|
return failp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set new query type if new is more restrictive than old.
|
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* @param qtype Existing type
|
|
||||||
*
|
|
||||||
* @param new_type New query type
|
|
||||||
*
|
|
||||||
* @return Query type as an unsigned int value which must be casted to qtype.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @details The implementation relies on that enumerated values correspond
|
|
||||||
* to the restrictiviness of the value. That is, smaller value means less
|
|
||||||
* restrictive, for example, QUERY_TYPE_READ is smaller than QUERY_TYPE_WRITE.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
static u_int32_t set_query_type(
|
|
||||||
u_int32_t* qtype,
|
|
||||||
u_int32_t new_type)
|
|
||||||
{
|
|
||||||
*qtype = MAX(*qtype, new_type);
|
|
||||||
return *qtype;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detect query type by examining parsed representation of it.
|
* Detect query type by examining parsed representation of it.
|
||||||
@ -817,7 +794,7 @@ static skygw_query_type_t resolve_query_type(
|
|||||||
break;
|
break;
|
||||||
} /**< switch */
|
} /**< switch */
|
||||||
/**< Set new query type */
|
/**< Set new query type */
|
||||||
type |= set_query_type(&type, func_qtype);
|
type |= func_qtype;
|
||||||
}
|
}
|
||||||
#if defined(UPDATE_VAR_SUPPORT)
|
#if defined(UPDATE_VAR_SUPPORT)
|
||||||
/**
|
/**
|
||||||
@ -1118,6 +1095,7 @@ char** skygw_get_table_names(GWBUF* querybuf, int* tblsize, bool fullnames)
|
|||||||
lex->current_select = lex->current_select->next_select_in_list();
|
lex->current_select = lex->current_select->next_select_in_list();
|
||||||
} /*< while(lex->current_select) */
|
} /*< while(lex->current_select) */
|
||||||
retblock:
|
retblock:
|
||||||
|
if(tblsize)
|
||||||
*tblsize = i;
|
*tblsize = i;
|
||||||
return tables;
|
return tables;
|
||||||
}
|
}
|
||||||
@ -1229,6 +1207,7 @@ inline void add_str(char** buf, int* buflen, int* bufsize, char* str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(*buflen > 0){
|
if(*buflen > 0){
|
||||||
|
if(*buf)
|
||||||
strcat(*buf," ");
|
strcat(*buf," ");
|
||||||
}
|
}
|
||||||
strcat(*buf,str);
|
strcat(*buf,str);
|
||||||
|
@ -1,62 +0,0 @@
|
|||||||
# cleantests - clean local and subdirectories' tests
|
|
||||||
# buildtests - build all local and subdirectories' tests
|
|
||||||
# runtests - run all local tests
|
|
||||||
# testall - clean, build and run local and subdirectories' tests
|
|
||||||
|
|
||||||
include ../../../build_gateway.inc
|
|
||||||
include ../../../makefile.inc
|
|
||||||
include ../../../test.inc
|
|
||||||
|
|
||||||
CC = gcc
|
|
||||||
CPP = g++
|
|
||||||
|
|
||||||
TESTPATH := $(shell pwd)
|
|
||||||
TESTLOG := $(TESTPATH)/testqclass.log
|
|
||||||
QUERY_CLASSIFIER_PATH := $(ROOT_PATH)/query_classifier
|
|
||||||
LOG_MANAGER_PATH := $(ROOT_PATH)/log_manager
|
|
||||||
UTILS_PATH := $(ROOT_PATH)/utils
|
|
||||||
CORE_PATH := $(ROOT_PATH)/server/core
|
|
||||||
TESTAPP = $(TESTPATH)/canonizer
|
|
||||||
|
|
||||||
LDFLAGS=-L$(QUERY_CLASSIFIER_PATH) \
|
|
||||||
-L$(LOG_MANAGER_PATH) \
|
|
||||||
-L$(EMBEDDED_LIB) \
|
|
||||||
-Wl,-rpath,$(DEST)/lib \
|
|
||||||
-Wl,-rpath,$(EMBEDDED_LIB) \
|
|
||||||
-Wl,-rpath,$(LOG_MANAGER_PATH) \
|
|
||||||
-Wl,-rpath,$(QUERY_CLASSIFIER_PATH)
|
|
||||||
|
|
||||||
LIBS=-lstdc++ -lpthread -lquery_classifier -lz -ldl -lssl -laio -lcrypt -lcrypto -lrt -lm \
|
|
||||||
-llog_manager $(UTILS_PATH)/skygw_utils.o $(CORE_PATH)/buffer.o $(CORE_PATH)/atomic.o $(CORE_PATH)/spinlock.o $(CORE_PATH)/hint.o
|
|
||||||
|
|
||||||
CFLAGS=-g $(MYSQL_HEADERS) \
|
|
||||||
-I$(QUERY_CLASSIFIER_PATH) \
|
|
||||||
$(MYSQL_HEADERS) \
|
|
||||||
-I$(ROOT_PATH)/server/include \
|
|
||||||
-I$(UTILS_PATH)
|
|
||||||
|
|
||||||
|
|
||||||
testall:
|
|
||||||
$(MAKE) cleantests
|
|
||||||
$(MAKE) buildtests
|
|
||||||
$(MAKE) runtests
|
|
||||||
|
|
||||||
cleantests:
|
|
||||||
- $(DEL) *.o
|
|
||||||
- $(DEL) *~
|
|
||||||
- $(DEL) canonizer
|
|
||||||
- $(DEL) aria_log*
|
|
||||||
- $(DEL) ib*
|
|
||||||
|
|
||||||
buildtests: $(OBJS)
|
|
||||||
cp $(ERRMSG)/errmsg.sys .
|
|
||||||
$(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) canonizer.c -o $(TESTAPP) $(LDLIBS) $(LDMYSQL)
|
|
||||||
|
|
||||||
runtests:
|
|
||||||
@echo "" > $(TESTLOG)
|
|
||||||
@echo "-------------------------------" >> $(TESTLOG)
|
|
||||||
@echo $(shell date) >> $(TESTLOG)
|
|
||||||
@echo "Canonical Query Tests" >> $(TESTLOG)
|
|
||||||
@echo "-------------------------------" >> $(TESTLOG)
|
|
||||||
@echo "" >> $(TESTLOG)
|
|
||||||
./canontest.sh $(TESTLOG) input.sql output.sql expected.sql
|
|
0
query_classifier/test/canonical_tests/expected.sql
Executable file → Normal file
0
query_classifier/test/canonical_tests/expected.sql
Executable file → Normal file
0
query_classifier/test/canonical_tests/input.sql
Executable file → Normal file
0
query_classifier/test/canonical_tests/input.sql
Executable file → Normal file
@ -1,83 +0,0 @@
|
|||||||
# cleantests - clean local and subdirectories' tests
|
|
||||||
# buildtests - build all local and subdirectories' tests
|
|
||||||
# runtests - run all local tests
|
|
||||||
# testall - clean, build and run local and subdirectories' tests
|
|
||||||
|
|
||||||
include ../../build_gateway.inc
|
|
||||||
include ../../makefile.inc
|
|
||||||
include ../../test.inc
|
|
||||||
|
|
||||||
CC = gcc
|
|
||||||
CPP = g++
|
|
||||||
|
|
||||||
TESTPATH := $(shell pwd)
|
|
||||||
TESTLOG := $(TESTPATH)/testqclass.log
|
|
||||||
QUERY_CLASSIFIER_PATH := $(ROOT_PATH)/query_classifier
|
|
||||||
LOG_MANAGER_PATH := $(ROOT_PATH)/log_manager
|
|
||||||
UTILS_PATH := $(ROOT_PATH)/utils
|
|
||||||
TESTAPP = $(TESTPATH)/testmain
|
|
||||||
|
|
||||||
testall:buildtests
|
|
||||||
$(MAKE) -C canonical_tests testall
|
|
||||||
testalllaters:
|
|
||||||
$(MAKE) cleantests
|
|
||||||
$(MAKE) DEBUG=Y DYNLIB=Y buildtests
|
|
||||||
$(MAKE) runtests
|
|
||||||
|
|
||||||
|
|
||||||
cleantests:
|
|
||||||
- $(DEL) testmain.o
|
|
||||||
- $(DEL) testmain
|
|
||||||
- $(DEL) data
|
|
||||||
- $(DEL) *~
|
|
||||||
|
|
||||||
buildtests:
|
|
||||||
@echo ""
|
|
||||||
@echo "*********************************************************"
|
|
||||||
@echo "Query classifier test disabled for now. vraa 4.7.2014"
|
|
||||||
@echo "*********************************************************"
|
|
||||||
@echo ""
|
|
||||||
|
|
||||||
buildtestslaters:
|
|
||||||
$(CC) $(CFLAGS) \
|
|
||||||
-L$(QUERY_CLASSIFIER_PATH) \
|
|
||||||
-L$(LOG_MANAGER_PATH) \
|
|
||||||
-L$(EMBEDDED_LIB) \
|
|
||||||
-Wl,-rpath,$(DEST)/lib \
|
|
||||||
-Wl,-rpath,$(EMBEDDED_LIB) \
|
|
||||||
-Wl,-rpath,$(LOG_MANAGER_PATH) \
|
|
||||||
-Wl,-rpath,$(QUERY_CLASSIFIER_PATH) \
|
|
||||||
-o testmain -DSS_DEBUG \
|
|
||||||
$(MYSQL_HEADERS) \
|
|
||||||
-I$(QUERY_CLASSIFIER_PATH) \
|
|
||||||
-I./ \
|
|
||||||
-I$(UTILS_PATH) \
|
|
||||||
testmain.c \
|
|
||||||
$(UTILS_PATH)/skygw_utils.o \
|
|
||||||
-lquery_classifier -lz -ldl -lssl -laio -lcrypt -lrt \
|
|
||||||
-llog_manager \
|
|
||||||
$(LDLIBS) $(LDMYSQL)
|
|
||||||
|
|
||||||
runtests:
|
|
||||||
@echo "" > $(TESTLOG)
|
|
||||||
@echo "-------------------------------" >> $(TESTLOG)
|
|
||||||
@echo $(shell date) >> $(TESTLOG)
|
|
||||||
@echo "Test Query Classifier" >> $(TESTLOG)
|
|
||||||
@echo "-------------------------------" >> $(TESTLOG)
|
|
||||||
@echo "Query Classifier NOT TESTED due deprecated tests. vraa 4.7.2014" >> $(TESTLOG)
|
|
||||||
@cat $(TESTLOG) >> $(TEST_MAXSCALE_LOG)
|
|
||||||
|
|
||||||
|
|
||||||
runtestslaters:
|
|
||||||
@echo "" > $(TESTLOG)
|
|
||||||
@echo "-------------------------------" >> $(TESTLOG)
|
|
||||||
@echo $(shell date) >> $(TESTLOG)
|
|
||||||
@echo "Test Query Classifier" >> $(TESTLOG)
|
|
||||||
@echo "-------------------------------" >> $(TESTLOG)
|
|
||||||
@ -$(LAUNCH_DEBUGGER) $(TESTAPP) $(BACKGR) 2>> $(TESTLOG)
|
|
||||||
ifeq ($?, 0)
|
|
||||||
@echo "Query Classifier PASSED" >> $(TESTLOG)
|
|
||||||
else
|
|
||||||
@echo "Query Classifier FAILED" >> $(TESTLOG)
|
|
||||||
endif
|
|
||||||
@cat $(TESTLOG) >> $(TEST_MAXSCALE_LOG)
|
|
@ -1,19 +1,63 @@
|
|||||||
if(RABBITMQ_FOUND AND MYSQLCLIENT_FOUND)
|
cmake_minimum_required(VERSION 2.6)
|
||||||
|
include(../macros.cmake)
|
||||||
|
enable_testing()
|
||||||
|
set_variables()
|
||||||
|
set(CMAKE_INSTALL_PREFIX "/usr/local/skysql/rabbitmq-consumer" CACHE PATH "Prefix prepended to install directories.")
|
||||||
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/../")
|
||||||
|
|
||||||
include_directories(${MYSQLCLIENT_HEADERS})
|
project("RabbitMQ Consumer")
|
||||||
add_executable (consumer consumer.c)
|
|
||||||
|
|
||||||
if(MYSQLCLIENT_FOUND)
|
|
||||||
target_link_libraries(consumer ${MYSQLCLIENT_LIBRARIES} rabbitmq inih)
|
find_package(RabbitMQ)
|
||||||
elseif(MYSQLCLIENT_STATIC_FOUND)
|
find_package(MySQLClient)
|
||||||
target_link_libraries(consumer ${MYSQLCLIENT_STATIC_LIBRARIES} rabbitmq inih)
|
|
||||||
|
set(CMAKE_C_FLAGS "-Wall -fPIC")
|
||||||
|
set(CMAKE_CXX_FLAGS "-Wall -fPIC")
|
||||||
|
include_directories(${MYSQLCLIENT_HEADERS})
|
||||||
|
include_directories(inih)
|
||||||
|
add_subdirectory(inih)
|
||||||
|
add_executable (consumer consumer.c)
|
||||||
|
|
||||||
|
if(MYSQLCLIENT_FOUND)
|
||||||
|
target_link_libraries(consumer ${MYSQLCLIENT_LIBRARIES} rabbitmq inih ssl crypt crypto dl z m pthread)
|
||||||
|
elseif(MYSQLCLIENT_STATIC_FOUND)
|
||||||
|
target_link_libraries(consumer ${MYSQLCLIENT_STATIC_LIBRARIES} rabbitmq inih ssl crypt crypto dl z m pthread)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
install(TARGETS consumer DESTINATION bin)
|
||||||
|
install(FILES consumer.cnf DESTINATION etc)
|
||||||
|
|
||||||
|
if(${CMAKE_VERSION} VERSION_LESS 2.8.12)
|
||||||
|
message(WARNING "CMake version is ${CMAKE_VERSION}. Building of packages requires version 2.8.12 or greater.")
|
||||||
|
else()
|
||||||
|
# See if we are on a RPM-capable or DEB-capable system
|
||||||
|
find_program(RPMBUILD rpmbuild)
|
||||||
|
find_program(DEBBUILD dpkg-buildpackage)
|
||||||
|
set(CPACK_GENERATOR "TGZ")
|
||||||
|
if(NOT ( ${RPMBUILD} STREQUAL "RPMBUILD-NOTFOUND" ) )
|
||||||
|
message(STATUS "Generating RPM packages")
|
||||||
|
set(CPACK_GENERATOR "${CPACK_GENERATOR};RPM")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
install(TARGETS consumer DESTINATION bin)
|
if(NOT ( ${DEBBUILD} STREQUAL "DEBBUILD-NOTFOUND" ) )
|
||||||
install(FILES consumer.cnf DESTINATION etc)
|
set(CPACK_GENERATOR "${CPACK_GENERATOR};DEB")
|
||||||
|
execute_process(COMMAND dpgk --print-architecture OUTPUT_VARIABLE DEB_ARCHITECTURE)
|
||||||
else()
|
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${DEB_ARCHITECTURE})
|
||||||
|
set (CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
|
||||||
message(FATAL_ERROR "Error: Can not find requred libraries and headers: librabbitmq libmysqlclient")
|
message(STATUS "Generating DEB packages for ${DEB_ARCHITECTURE}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "RabbitMQ Consumer")
|
||||||
|
set(CPACK_PACKAGE_VERSION_MAJOR "1")
|
||||||
|
set(CPACK_PACKAGE_VERSION_MINOR "0")
|
||||||
|
set(CPACK_PACKAGE_VERSION_PATCH "0")
|
||||||
|
set(CPACK_PACKAGE_CONTACT "MariaDB Corporation Ab")
|
||||||
|
set(CPACK_PACKAGE_FILE_NAME "rabbitmq-consumer-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
|
||||||
|
set(CPACK_PACKAGE_NAME "rabbitmq-consumer")
|
||||||
|
set(CPACK_PACKAGE_VENDOR "MariaDB Corporation Ab")
|
||||||
|
set(CPACK_PACKAGING_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
|
||||||
|
set(CPACK_RPM_PACKAGE_NAME "rabbitmq-consumer")
|
||||||
|
set(CPACK_RPM_PACKAGE_VENDOR "MariaDB Corporation Ab")
|
||||||
|
set(CPACK_RPM_PACKAGE_LICENSE "GPLv2")
|
||||||
|
include(CPack)
|
||||||
endif()
|
endif()
|
||||||
|
20
rabbitmq_consumer/COPYRIGHT
Normal file
20
rabbitmq_consumer/COPYRIGHT
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
This source code is distributed as part of MariaDB Corporation MaxScale. It is free
|
||||||
|
software: you can redistribute it and/or modify it under the terms of the
|
||||||
|
GNU General Public License as published by the Free Software Foundation,
|
||||||
|
version 2.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along with
|
||||||
|
this program; if not, write to the Free Software Foundation, Inc., 51
|
||||||
|
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
|
Copyright MariaDB Corporation Ab 2013
|
||||||
|
|
||||||
|
MariaDB Corporation Corporation Ab
|
||||||
|
Tekniikantie 12
|
||||||
|
02150 Espoo
|
||||||
|
Finland
|
340
rabbitmq_consumer/LICENSE
Normal file
340
rabbitmq_consumer/LICENSE
Normal file
@ -0,0 +1,340 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 2, June 1991
|
||||||
|
|
||||||
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||||
|
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
License is intended to guarantee your freedom to share and change free
|
||||||
|
software--to make sure the software is free for all its users. This
|
||||||
|
General Public License applies to most of the Free Software
|
||||||
|
Foundation's software and to any other program whose authors commit to
|
||||||
|
using it. (Some other Free Software Foundation software is covered by
|
||||||
|
the GNU Library General Public License instead.) You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
this service if you wish), that you receive source code or can get it
|
||||||
|
if you want it, that you can change the software or use pieces of it
|
||||||
|
in new free programs; and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
|
These restrictions translate to certain responsibilities for you if you
|
||||||
|
distribute copies of the software, or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must give the recipients all the rights that
|
||||||
|
you have. You must make sure that they, too, receive or can get the
|
||||||
|
source code. And you must show them these terms so they know their
|
||||||
|
rights.
|
||||||
|
|
||||||
|
We protect your rights with two steps: (1) copyright the software, and
|
||||||
|
(2) offer you this license which gives you legal permission to copy,
|
||||||
|
distribute and/or modify the software.
|
||||||
|
|
||||||
|
Also, for each author's protection and ours, we want to make certain
|
||||||
|
that everyone understands that there is no warranty for this free
|
||||||
|
software. If the software is modified by someone else and passed on, we
|
||||||
|
want its recipients to know that what they have is not the original, so
|
||||||
|
that any problems introduced by others will not reflect on the original
|
||||||
|
authors' reputations.
|
||||||
|
|
||||||
|
Finally, any free program is threatened constantly by software
|
||||||
|
patents. We wish to avoid the danger that redistributors of a free
|
||||||
|
program will individually obtain patent licenses, in effect making the
|
||||||
|
program proprietary. To prevent this, we have made it clear that any
|
||||||
|
patent must be licensed for everyone's free use or not licensed at all.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License applies to any program or other work which contains
|
||||||
|
a notice placed by the copyright holder saying it may be distributed
|
||||||
|
under the terms of this General Public License. The "Program", below,
|
||||||
|
refers to any such program or work, and a "work based on the Program"
|
||||||
|
means either the Program or any derivative work under copyright law:
|
||||||
|
that is to say, a work containing the Program or a portion of it,
|
||||||
|
either verbatim or with modifications and/or translated into another
|
||||||
|
language. (Hereinafter, translation is included without limitation in
|
||||||
|
the term "modification".) Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running the Program is not restricted, and the output from the Program
|
||||||
|
is covered only if its contents constitute a work based on the
|
||||||
|
Program (independent of having been made by running the Program).
|
||||||
|
Whether that is true depends on what the Program does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Program's
|
||||||
|
source code as you receive it, in any medium, provided that you
|
||||||
|
conspicuously and appropriately publish on each copy an appropriate
|
||||||
|
copyright notice and disclaimer of warranty; keep intact all the
|
||||||
|
notices that refer to this License and to the absence of any warranty;
|
||||||
|
and give any other recipients of the Program a copy of this License
|
||||||
|
along with the Program.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy, and
|
||||||
|
you may at your option offer warranty protection in exchange for a fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Program or any portion
|
||||||
|
of it, thus forming a work based on the Program, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) You must cause the modified files to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
b) You must cause any work that you distribute or publish, that in
|
||||||
|
whole or in part contains or is derived from the Program or any
|
||||||
|
part thereof, to be licensed as a whole at no charge to all third
|
||||||
|
parties under the terms of this License.
|
||||||
|
|
||||||
|
c) If the modified program normally reads commands interactively
|
||||||
|
when run, you must cause it, when started running for such
|
||||||
|
interactive use in the most ordinary way, to print or display an
|
||||||
|
announcement including an appropriate copyright notice and a
|
||||||
|
notice that there is no warranty (or else, saying that you provide
|
||||||
|
a warranty) and that users may redistribute the program under
|
||||||
|
these conditions, and telling the user how to view a copy of this
|
||||||
|
License. (Exception: if the Program itself is interactive but
|
||||||
|
does not normally print such an announcement, your work based on
|
||||||
|
the Program is not required to print an announcement.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Program,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Program, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Program.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Program
|
||||||
|
with the Program (or with a work based on the Program) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may copy and distribute the Program (or a work based on it,
|
||||||
|
under Section 2) in object code or executable form under the terms of
|
||||||
|
Sections 1 and 2 above provided that you also do one of the following:
|
||||||
|
|
||||||
|
a) Accompany it with the complete corresponding machine-readable
|
||||||
|
source code, which must be distributed under the terms of Sections
|
||||||
|
1 and 2 above on a medium customarily used for software interchange; or,
|
||||||
|
|
||||||
|
b) Accompany it with a written offer, valid for at least three
|
||||||
|
years, to give any third party, for a charge no more than your
|
||||||
|
cost of physically performing source distribution, a complete
|
||||||
|
machine-readable copy of the corresponding source code, to be
|
||||||
|
distributed under the terms of Sections 1 and 2 above on a medium
|
||||||
|
customarily used for software interchange; or,
|
||||||
|
|
||||||
|
c) Accompany it with the information you received as to the offer
|
||||||
|
to distribute corresponding source code. (This alternative is
|
||||||
|
allowed only for noncommercial distribution and only if you
|
||||||
|
received the program in object code or executable form with such
|
||||||
|
an offer, in accord with Subsection b above.)
|
||||||
|
|
||||||
|
The source code for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For an executable work, complete source
|
||||||
|
code means all the source code for all modules it contains, plus any
|
||||||
|
associated interface definition files, plus the scripts used to
|
||||||
|
control compilation and installation of the executable. However, as a
|
||||||
|
special exception, the source code distributed need not include
|
||||||
|
anything that is normally distributed (in either source or binary
|
||||||
|
form) with the major components (compiler, kernel, and so on) of the
|
||||||
|
operating system on which the executable runs, unless that component
|
||||||
|
itself accompanies the executable.
|
||||||
|
|
||||||
|
If distribution of executable or object code is made by offering
|
||||||
|
access to copy from a designated place, then offering equivalent
|
||||||
|
access to copy the source code from the same place counts as
|
||||||
|
distribution of the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
4. You may not copy, modify, sublicense, or distribute the Program
|
||||||
|
except as expressly provided under this License. Any attempt
|
||||||
|
otherwise to copy, modify, sublicense or distribute the Program is
|
||||||
|
void, and will automatically terminate your rights under this License.
|
||||||
|
However, parties who have received copies, or rights, from you under
|
||||||
|
this License will not have their licenses terminated so long as such
|
||||||
|
parties remain in full compliance.
|
||||||
|
|
||||||
|
5. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Program or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Program (or any work based on the
|
||||||
|
Program), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Program or works based on it.
|
||||||
|
|
||||||
|
6. Each time you redistribute the Program (or any work based on the
|
||||||
|
Program), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute or modify the Program subject to
|
||||||
|
these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties to
|
||||||
|
this License.
|
||||||
|
|
||||||
|
7. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Program at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Program by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Program.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under
|
||||||
|
any particular circumstance, the balance of the section is intended to
|
||||||
|
apply and the section as a whole is intended to apply in other
|
||||||
|
circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system, which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
8. If the distribution and/or use of the Program is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Program under this License
|
||||||
|
may add an explicit geographical distribution limitation excluding
|
||||||
|
those countries, so that distribution is permitted only in or among
|
||||||
|
countries not thus excluded. In such case, this License incorporates
|
||||||
|
the limitation as if written in the body of this License.
|
||||||
|
|
||||||
|
9. The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program
|
||||||
|
specifies a version number of this License which applies to it and "any
|
||||||
|
later version", you have the option of following the terms and conditions
|
||||||
|
either of that version or of any later version published by the Free
|
||||||
|
Software Foundation. If the Program does not specify a version number of
|
||||||
|
this License, you may choose any version ever published by the Free Software
|
||||||
|
Foundation.
|
||||||
|
|
||||||
|
10. If you wish to incorporate parts of the Program into other free
|
||||||
|
programs whose distribution conditions are different, write to the author
|
||||||
|
to ask for permission. For software which is copyrighted by the Free
|
||||||
|
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||||
|
make exceptions for this. Our decision will be guided by the two goals
|
||||||
|
of preserving the free status of all derivatives of our free software and
|
||||||
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||||
|
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||||
|
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||||
|
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||||
|
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||||
|
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||||
|
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||||
|
REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||||
|
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||||
|
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||||
|
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||||
|
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||||
|
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
convey the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program is interactive, make it output a short notice like this
|
||||||
|
when it starts in an interactive mode:
|
||||||
|
|
||||||
|
Gnomovision version 69, Copyright (C) year name of author
|
||||||
|
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, the commands you use may
|
||||||
|
be called something other than `show w' and `show c'; they could even be
|
||||||
|
mouse-clicks or menu items--whatever suits your program.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||||
|
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1989
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
This General Public License does not permit incorporating your program into
|
||||||
|
proprietary programs. If your program is a subroutine library, you may
|
||||||
|
consider it more useful to permit linking proprietary applications with the
|
||||||
|
library. If this is what you want to do, use the GNU Library General
|
||||||
|
Public License instead of this License.
|
@ -1,15 +0,0 @@
|
|||||||
include buildconfig.inc
|
|
||||||
|
|
||||||
CC=gcc
|
|
||||||
CFLAGS=-c -Wall -g -Iinih $(INCLUDE_DIRS)
|
|
||||||
LDFLAGS= $(LIBRARY_DIRS) -lrabbitmq -lmysqlclient
|
|
||||||
SRCS= inih/ini.c consumer.c
|
|
||||||
OBJ=$(SRCS:.c=.o)
|
|
||||||
all:$(OBJ)
|
|
||||||
$(CC) $(LDFLAGS) $(OBJ) -o consumer `mysql_config --cflags --libs`
|
|
||||||
%.o:%.c
|
|
||||||
$(CC) $(CFLAGS) $< -o $@
|
|
||||||
|
|
||||||
clean:
|
|
||||||
-rm *.o
|
|
||||||
-rm *~
|
|
12
rabbitmq_consumer/SETUP
Normal file
12
rabbitmq_consumer/SETUP
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
This is a fast guide to setting up the RabbitMQ Consumer.
|
||||||
|
|
||||||
|
Configure CMake:
|
||||||
|
|
||||||
|
cmake .
|
||||||
|
|
||||||
|
Install:
|
||||||
|
|
||||||
|
make install
|
||||||
|
|
||||||
|
After installation configure the 'consumer.cnf' file. Refer to README for details
|
||||||
|
about the required values.
|
@ -115,7 +115,7 @@ int connectToServer(MYSQL* server)
|
|||||||
|
|
||||||
|
|
||||||
if(result==NULL){
|
if(result==NULL){
|
||||||
fprintf(out_fd,"Error: Could not connect to MySQL server: %s\n",mysql_error(server));
|
fprintf(out_fd,"\33[31;1mError\33[0m: Could not connect to MySQL server: %s\n",mysql_error(server));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,18 +134,18 @@ int connectToServer(MYSQL* server)
|
|||||||
memset(qstr,0,bsz);
|
memset(qstr,0,bsz);
|
||||||
sprintf(qstr,DB_DATABASE,c_inst->dbname);
|
sprintf(qstr,DB_DATABASE,c_inst->dbname);
|
||||||
if(mysql_query(server,qstr)){
|
if(mysql_query(server,qstr)){
|
||||||
fprintf(stderr,"Error: Could not send query MySQL server: %s\n",mysql_error(server));
|
fprintf(stderr,"\33[31;1mError\33[0m: Could not send query MySQL server: %s\n",mysql_error(server));
|
||||||
}
|
}
|
||||||
memset(qstr,0,bsz);
|
memset(qstr,0,bsz);
|
||||||
sprintf(qstr,"USE %s;",c_inst->dbname);
|
sprintf(qstr,"USE %s;",c_inst->dbname);
|
||||||
if(mysql_query(server,qstr)){
|
if(mysql_query(server,qstr)){
|
||||||
fprintf(stderr,"Error: Could not send query MySQL server: %s\n",mysql_error(server));
|
fprintf(stderr,"\33[31;1mError\33[0m: Could not send query MySQL server: %s\n",mysql_error(server));
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(qstr,0,bsz);
|
memset(qstr,0,bsz);
|
||||||
sprintf(qstr,"%s",DB_TABLE);
|
sprintf(qstr,"%s",DB_TABLE);
|
||||||
if(mysql_query(server,qstr)){
|
if(mysql_query(server,qstr)){
|
||||||
fprintf(stderr,"Error: Could not send query MySQL server: %s\n",mysql_error(server));
|
fprintf(stderr,"\33[31;1mError\33[0m: Could not send query MySQL server: %s\n",mysql_error(server));
|
||||||
}
|
}
|
||||||
|
|
||||||
free(qstr);
|
free(qstr);
|
||||||
@ -414,14 +414,14 @@ int main(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(amqp_socket_open(socket, c_inst->hostname, c_inst->port)){
|
if(amqp_socket_open(socket, c_inst->hostname, c_inst->port)){
|
||||||
fprintf(stderr, "RabbitMQ Error: Cannot open socket.\n");
|
fprintf(stderr, "\33[31;1mRabbitMQ Error\33[0m: Cannot open socket.\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = amqp_login(conn, c_inst->vhost, 0, 131072, 0, AMQP_SASL_METHOD_PLAIN, c_inst->user, c_inst->passwd);
|
ret = amqp_login(conn, c_inst->vhost, 0, 131072, 0, AMQP_SASL_METHOD_PLAIN, c_inst->user, c_inst->passwd);
|
||||||
|
|
||||||
if(ret.reply_type != AMQP_RESPONSE_NORMAL){
|
if(ret.reply_type != AMQP_RESPONSE_NORMAL){
|
||||||
fprintf(stderr, "RabbitMQ Error: Cannot login to server.\n");
|
fprintf(stderr, "\33[31;1mRabbitMQ Error\33[0m: Cannot login to server.\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -429,7 +429,7 @@ int main(int argc, char** argv)
|
|||||||
ret = amqp_get_rpc_reply(conn);
|
ret = amqp_get_rpc_reply(conn);
|
||||||
|
|
||||||
if(ret.reply_type != AMQP_RESPONSE_NORMAL){
|
if(ret.reply_type != AMQP_RESPONSE_NORMAL){
|
||||||
fprintf(stderr, "RabbitMQ Error: Cannot open channel.\n");
|
fprintf(stderr, "\33[31;1mRabbitMQ Error\33[0m: Cannot open channel.\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -458,7 +458,7 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
if(sendMessage(&db_inst,reply)){
|
if(sendMessage(&db_inst,reply)){
|
||||||
|
|
||||||
fprintf(stderr,"RabbitMQ Error: Received malformed message.\n");
|
fprintf(stderr,"\33[31;1mRabbitMQ Error\33[0m: Received malformed message.\n");
|
||||||
amqp_basic_reject(conn,channel,decoded->delivery_tag,0);
|
amqp_basic_reject(conn,channel,decoded->delivery_tag,0);
|
||||||
amqp_destroy_message(reply);
|
amqp_destroy_message(reply);
|
||||||
|
|
||||||
@ -470,7 +470,7 @@ int main(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
fprintf(stderr,"RabbitMQ Error: Received method from server: %s\n",amqp_method_name(frame.payload.method.id));
|
fprintf(stderr,"\33[31;1mRabbitMQ Error\33[0m: Received method from server: %s\n",amqp_method_name(frame.payload.method.id));
|
||||||
all_ok = 0;
|
all_ok = 0;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
0
rabbitmq_consumer/inih/LICENSE.txt
Executable file → Normal file
0
rabbitmq_consumer/inih/LICENSE.txt
Executable file → Normal file
0
rabbitmq_consumer/inih/README.txt
Executable file → Normal file
0
rabbitmq_consumer/inih/README.txt
Executable file → Normal file
0
rabbitmq_consumer/inih/cpp/INIReader.cpp
Executable file → Normal file
0
rabbitmq_consumer/inih/cpp/INIReader.cpp
Executable file → Normal file
0
rabbitmq_consumer/inih/cpp/INIReader.h
Executable file → Normal file
0
rabbitmq_consumer/inih/cpp/INIReader.h
Executable file → Normal file
0
rabbitmq_consumer/inih/cpp/INIReaderTest.cpp
Executable file → Normal file
0
rabbitmq_consumer/inih/cpp/INIReaderTest.cpp
Executable file → Normal file
0
rabbitmq_consumer/inih/examples/config.def
Executable file → Normal file
0
rabbitmq_consumer/inih/examples/config.def
Executable file → Normal file
0
rabbitmq_consumer/inih/examples/ini_dump.c
Executable file → Normal file
0
rabbitmq_consumer/inih/examples/ini_dump.c
Executable file → Normal file
0
rabbitmq_consumer/inih/examples/ini_example.c
Executable file → Normal file
0
rabbitmq_consumer/inih/examples/ini_example.c
Executable file → Normal file
0
rabbitmq_consumer/inih/examples/ini_xmacros.c
Executable file → Normal file
0
rabbitmq_consumer/inih/examples/ini_xmacros.c
Executable file → Normal file
0
rabbitmq_consumer/inih/examples/test.ini
Executable file → Normal file
0
rabbitmq_consumer/inih/examples/test.ini
Executable file → Normal file
@ -1,19 +0,0 @@
|
|||||||
# Simple makefile to build inih as a static library using g++
|
|
||||||
|
|
||||||
SRC = ../ini.c
|
|
||||||
OBJ = $(SRC:.c=.o)
|
|
||||||
OUT = libinih.a
|
|
||||||
INCLUDES = -I..
|
|
||||||
CCFLAGS = -g -O2
|
|
||||||
CC = g++
|
|
||||||
|
|
||||||
default: $(OUT)
|
|
||||||
|
|
||||||
.c.o:
|
|
||||||
$(CC) $(INCLUDES) $(CCFLAGS) $(EXTRACCFLAGS) -c $< -o $@
|
|
||||||
|
|
||||||
$(OUT): $(OBJ)
|
|
||||||
ar rcs $(OUT) $(OBJ) $(EXTRAARFLAGS)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f $(OBJ) $(OUT)
|
|
0
rabbitmq_consumer/inih/ini.c
Executable file → Normal file
0
rabbitmq_consumer/inih/ini.c
Executable file → Normal file
0
rabbitmq_consumer/inih/ini.h
Executable file → Normal file
0
rabbitmq_consumer/inih/ini.h
Executable file → Normal file
0
rabbitmq_consumer/inih/tests/bad_comment.ini
Executable file → Normal file
0
rabbitmq_consumer/inih/tests/bad_comment.ini
Executable file → Normal file
0
rabbitmq_consumer/inih/tests/bad_multi.ini
Executable file → Normal file
0
rabbitmq_consumer/inih/tests/bad_multi.ini
Executable file → Normal file
0
rabbitmq_consumer/inih/tests/bad_section.ini
Executable file → Normal file
0
rabbitmq_consumer/inih/tests/bad_section.ini
Executable file → Normal file
0
rabbitmq_consumer/inih/tests/baseline_multi.txt
Executable file → Normal file
0
rabbitmq_consumer/inih/tests/baseline_multi.txt
Executable file → Normal file
0
rabbitmq_consumer/inih/tests/baseline_single.txt
Executable file → Normal file
0
rabbitmq_consumer/inih/tests/baseline_single.txt
Executable file → Normal file
0
rabbitmq_consumer/inih/tests/bom.ini
Executable file → Normal file
0
rabbitmq_consumer/inih/tests/bom.ini
Executable file → Normal file
0
rabbitmq_consumer/inih/tests/multi_line.ini
Executable file → Normal file
0
rabbitmq_consumer/inih/tests/multi_line.ini
Executable file → Normal file
0
rabbitmq_consumer/inih/tests/normal.ini
Executable file → Normal file
0
rabbitmq_consumer/inih/tests/normal.ini
Executable file → Normal file
0
rabbitmq_consumer/inih/tests/unittest.c
Executable file → Normal file
0
rabbitmq_consumer/inih/tests/unittest.c
Executable file → Normal file
0
rabbitmq_consumer/inih/tests/user_error.ini
Executable file → Normal file
0
rabbitmq_consumer/inih/tests/user_error.ini
Executable file → Normal file
@ -1,80 +0,0 @@
|
|||||||
# This file is distributed as part of the MariaDB Corporation MaxScale. It is free
|
|
||||||
# software: you can redistribute it and/or modify it under the terms of the
|
|
||||||
# GNU General Public License as published by the Free Software Foundation,
|
|
||||||
# version 2.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
||||||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
||||||
# details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License along with
|
|
||||||
# this program; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
#
|
|
||||||
# Copyright MariaDB Corporation Ab 2013
|
|
||||||
#
|
|
||||||
# Revision History
|
|
||||||
# Date Who Description
|
|
||||||
# 14/06/13 Mark Riddoch Initial implementation
|
|
||||||
# 17/06/13 Mark Riddoch Addition of documentation and depend
|
|
||||||
# targets
|
|
||||||
# 18/06/13 Mark Riddoch Addition of install target
|
|
||||||
# 21/06/13 Mark Riddoch Addition of inih
|
|
||||||
# 08/07/13 Mark Riddoch Addition of monitor modules
|
|
||||||
# 16/07/13 Mark Riddoch Renamed things to match the new naming
|
|
||||||
|
|
||||||
include ../build_gateway.inc
|
|
||||||
include ../makefile.inc
|
|
||||||
|
|
||||||
DEST=$(HOME)/usr/local/skysql
|
|
||||||
|
|
||||||
all:
|
|
||||||
(cd inih/extra ; make -f Makefile.static)
|
|
||||||
(cd core ; touch depend.mk ; make)
|
|
||||||
(cd modules/routing; touch depend.mk ;make)
|
|
||||||
(cd modules/routing/readwritesplit; touch depend.mk ;make)
|
|
||||||
(cd modules/protocol; touch depend.mk ;make)
|
|
||||||
(cd modules/monitor; touch depend.mk ;make)
|
|
||||||
(cd modules/filter; touch depend.mk ;make)
|
|
||||||
|
|
||||||
cleantests:
|
|
||||||
$(MAKE) -C test cleantests
|
|
||||||
|
|
||||||
buildtests:
|
|
||||||
$(MAKE) -C test HAVE_SRV=$(HAVE_SRV) buildtests
|
|
||||||
|
|
||||||
testall:
|
|
||||||
$(MAKE) -C test HAVE_SRV=$(HAVE_SRV) testall
|
|
||||||
|
|
||||||
clean:
|
|
||||||
(cd Documentation; $(DEL) html)
|
|
||||||
(cd core; touch depend.mk ; make clean)
|
|
||||||
(cd modules/routing; touch depend.mk ; make clean)
|
|
||||||
(cd modules/protocol; touch depend.mk ; make clean)
|
|
||||||
(cd modules/monitor; touch depend.mk ; make clean)
|
|
||||||
(cd modules/filter; touch depend.mk ; make clean)
|
|
||||||
|
|
||||||
depend:
|
|
||||||
(cd core; touch depend.mk ; make depend)
|
|
||||||
(cd modules/routing; touch depend.mk ; make depend)
|
|
||||||
(cd modules/protocol; touch depend.mk ; make depend)
|
|
||||||
(cd modules/monitor; touch depend.mk ; make depend)
|
|
||||||
(cd modules/filter; touch depend.mk ; make depend)
|
|
||||||
|
|
||||||
install:
|
|
||||||
@mkdir -p $(DEST)
|
|
||||||
@mkdir -p $(DEST)
|
|
||||||
@mkdir -p $(DEST)/modules
|
|
||||||
@mkdir -p $(DEST)/log
|
|
||||||
@mkdir -p $(DEST)/etc
|
|
||||||
@mkdir -p $(DEST)/mysql
|
|
||||||
@mkdir -p $(DEST)/lib
|
|
||||||
@mkdir -p $(DEST)/Documentation
|
|
||||||
install -b MaxScale_template.cnf $(DEST)/etc
|
|
||||||
install ../Documentation/*.pdf $(DEST)/Documentation
|
|
||||||
(cd core; make DEST=$(DEST) install)
|
|
||||||
(cd modules/routing; make DEST=$(DEST) install)
|
|
||||||
(cd modules/protocol; make DEST=$(DEST) install)
|
|
||||||
(cd modules/monitor; make DEST=$(DEST) install)
|
|
||||||
(cd modules/filter; make DEST=$(DEST) install)
|
|
@ -1,132 +0,0 @@
|
|||||||
# This file is distributed as part of the MariaDB Corporation MaxScale. It is free
|
|
||||||
# software: you can redistribute it and/or modify it under the terms of the
|
|
||||||
# GNU General Public License as published by the Free Software Foundation,
|
|
||||||
# version 2.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
||||||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
||||||
# details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License along with
|
|
||||||
# this program; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
#
|
|
||||||
# Copyright MariaDB Corporation Ab 2013
|
|
||||||
#
|
|
||||||
# Revision History
|
|
||||||
# Date Who Description
|
|
||||||
# 13/06/13 Mark Riddoch Addition of -rdynamic to allow libraries
|
|
||||||
# to resolve symbols in the main executable
|
|
||||||
# 17/06/13 Mark Riddoch Addition of dependency generation
|
|
||||||
# 24/06/13 Massimiliano Pinto Addition of libmysqlclient and its
|
|
||||||
# includes do this for launching the
|
|
||||||
# gateway: export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH:/packages/mariadb-5.5.25/libmysql
|
|
||||||
# 27/06/13 Vilho Raatikka Added logmanager-related libs and
|
|
||||||
# headers so that liblog_manager.so can
|
|
||||||
# be linked in.
|
|
||||||
# 28/06/13 Vilho Raatikka Added query classifier-related libs and
|
|
||||||
# commented out mysql client headers and
|
|
||||||
# lib to avoid conflicts. MARIADB_SRC_PATH
|
|
||||||
# is set in build_gateway.inc. Examples
|
|
||||||
# are behind SS_DEBUG macros.
|
|
||||||
# 29/06/13 Vilho Raatikka Reverted Query classifier changes because
|
|
||||||
# gateway needs mysql client lib, not qc.
|
|
||||||
# 24/07/13 Mark Ridoch Addition of encryption routines
|
|
||||||
# 30/05/14 Mark Riddoch Filter API added
|
|
||||||
# 25/07/14 Mark Riddoch Addition of hints
|
|
||||||
# 29/08/14 Mark Riddoch Added housekeeper
|
|
||||||
|
|
||||||
include ../../build_gateway.inc
|
|
||||||
|
|
||||||
LOGPATH := $(ROOT_PATH)/log_manager
|
|
||||||
UTILSPATH := $(ROOT_PATH)/utils
|
|
||||||
|
|
||||||
CC=cc
|
|
||||||
|
|
||||||
CFLAGS=-c -I/usr/include -I../include -I../modules/include -I../inih \
|
|
||||||
$(MYSQL_HEADERS) \
|
|
||||||
-I$(LOGPATH) -I$(UTILSPATH) \
|
|
||||||
-Wall -pedantic -g
|
|
||||||
|
|
||||||
LDFLAGS=-rdynamic -L$(LOGPATH) \
|
|
||||||
-Wl,-rpath,$(DEST)/lib \
|
|
||||||
-Wl,-rpath,$(LOGPATH) -Wl,-rpath,$(UTILSPATH) \
|
|
||||||
-Wl,-rpath,$(EMBEDDED_LIB)
|
|
||||||
|
|
||||||
|
|
||||||
LIBS=-L$(EMBEDDED_LIB) \
|
|
||||||
-lmysqld \
|
|
||||||
-lz -lm -lcrypt -lcrypto -ldl -laio -lrt -pthread -llog_manager \
|
|
||||||
-L../inih/extra -linih -lssl -lstdc++
|
|
||||||
|
|
||||||
include ../../makefile.inc
|
|
||||||
|
|
||||||
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 \
|
|
||||||
poll.c config.c users.c hashtable.c dbusers.c thread.c gwbitmask.c \
|
|
||||||
monitor.c adminusers.c secrets.c filter.c modutil.c hint.c \
|
|
||||||
housekeeper.c memlog.c
|
|
||||||
|
|
||||||
HDRS= ../include/atomic.h ../include/buffer.h ../include/dcb.h \
|
|
||||||
../include/gw.h ../modules/include/mysql_client_server_protocol.h \
|
|
||||||
../include/session.h ../include/spinlock.h ../include/thread.h \
|
|
||||||
../include/modules.h ../include/poll.h ../include/config.h \
|
|
||||||
../include/users.h ../include/hashtable.h ../include/gwbitmask.h \
|
|
||||||
../include/adminusers.h ../include/version.h ../include/maxscale.h \
|
|
||||||
../include/filter.h ../include/modutil.h ../hint.h \
|
|
||||||
../include/housekeeper.h ../include/memlog.h
|
|
||||||
|
|
||||||
OBJ=$(SRCS:.c=.o)
|
|
||||||
|
|
||||||
KOBJS=maxkeys.o secrets.o utils.o
|
|
||||||
POBJS=maxpasswd.o secrets.o utils.o
|
|
||||||
|
|
||||||
all: maxscale maxkeys maxpasswd
|
|
||||||
|
|
||||||
cleantests:
|
|
||||||
$(MAKE) -C test cleantests
|
|
||||||
|
|
||||||
buildtests:
|
|
||||||
$(MAKE) -C test buildtests
|
|
||||||
|
|
||||||
runtests:
|
|
||||||
$(MAKE) -C test runtests
|
|
||||||
|
|
||||||
testall:
|
|
||||||
$(MAKE) -C test testall
|
|
||||||
|
|
||||||
maxscale: $(OBJ)
|
|
||||||
$(CC) $(LDFLAGS) $(OBJ) $(UTILSPATH)/skygw_utils.o $(LIBS) -o $@
|
|
||||||
|
|
||||||
maxkeys: $(KOBJS)
|
|
||||||
$(CC) $(LDFLAGS) $(KOBJS) $(UTILSPATH)/skygw_utils.o $(LIBS) -o $@
|
|
||||||
|
|
||||||
maxpasswd: $(POBJS)
|
|
||||||
$(CC) $(LDFLAGS) $(POBJS) $(UTILSPATH)/skygw_utils.o $(LIBS) -o $@
|
|
||||||
|
|
||||||
.c.o:
|
|
||||||
$(CC) $(CFLAGS) $< -o $@
|
|
||||||
|
|
||||||
|
|
||||||
../include/version.h: ../../VERSION
|
|
||||||
echo '#define MAXSCALE_VERSION "'`cat ../../VERSION`'"' > ../include/version.h
|
|
||||||
|
|
||||||
clean:
|
|
||||||
$(DEL) $(OBJ) maxscale
|
|
||||||
$(DEL) *.so
|
|
||||||
|
|
||||||
tags:
|
|
||||||
ctags $(SRCS) $(HDRS)
|
|
||||||
|
|
||||||
depend: ../include/version.h
|
|
||||||
@$(DEL) depend.mk
|
|
||||||
cc -M $(CFLAGS) $(SRCS) > depend.mk
|
|
||||||
|
|
||||||
install: maxscale maxkeys maxpasswd
|
|
||||||
@mkdir -p $(DEST)/bin
|
|
||||||
install -D maxscale maxkeys maxpasswd $(DEST)/bin
|
|
||||||
install -D $(EMBEDDED_LIB)/$(LIB) $(DEST)/lib
|
|
||||||
install -D $(ERRMSG)/errmsg.sys $(DEST)/mysql
|
|
||||||
|
|
||||||
include depend.mk
|
|
@ -32,6 +32,20 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <mysql_client_server_protocol.h>
|
#include <mysql_client_server_protocol.h>
|
||||||
#include <modutil.h>
|
#include <modutil.h>
|
||||||
|
|
||||||
|
/** Defined in log_manager.cc */
|
||||||
|
extern int lm_enabled_logfiles_bitmask;
|
||||||
|
extern size_t log_ses_count[];
|
||||||
|
extern __thread log_info_t tls_log_info;
|
||||||
|
|
||||||
|
static void modutil_reply_routing_error(
|
||||||
|
DCB* backend_dcb,
|
||||||
|
int error,
|
||||||
|
char* state,
|
||||||
|
char* errstr,
|
||||||
|
uint32_t flags);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a GWBUF structure is a MySQL COM_QUERY packet
|
* Check if a GWBUF structure is a MySQL COM_QUERY packet
|
||||||
*
|
*
|
||||||
@ -760,3 +774,77 @@ modutil_get_rows(GWBUF* buffer)
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Create parse error and EPOLLIN event to event queue of the backend DCB.
|
||||||
|
* When event is notified the error message is processed as error reply and routed
|
||||||
|
* upstream to client.
|
||||||
|
*
|
||||||
|
* @param backend_dcb DCB where event is added
|
||||||
|
* @param errstr Plain-text string error
|
||||||
|
* @param flags GWBUF type flags
|
||||||
|
*/
|
||||||
|
void modutil_reply_parse_error(
|
||||||
|
DCB* backend_dcb,
|
||||||
|
char* errstr,
|
||||||
|
uint32_t flags)
|
||||||
|
{
|
||||||
|
CHK_DCB(backend_dcb);
|
||||||
|
modutil_reply_routing_error(backend_dcb, 1064, "42000", errstr, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create authentication error and EPOLLIN event to event queue of the backend DCB.
|
||||||
|
* When event is notified the error message is processed as error reply and routed
|
||||||
|
* upstream to client.
|
||||||
|
*
|
||||||
|
* @param backend_dcb DCB where event is added
|
||||||
|
* @param errstr Plain-text string error
|
||||||
|
* @param flags GWBUF type flags
|
||||||
|
*/
|
||||||
|
void modutil_reply_auth_error(
|
||||||
|
DCB* backend_dcb,
|
||||||
|
char* errstr,
|
||||||
|
uint32_t flags)
|
||||||
|
{
|
||||||
|
CHK_DCB(backend_dcb);
|
||||||
|
modutil_reply_routing_error(backend_dcb, 1045, "28000", errstr, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create error message and EPOLLIN event to event queue of the backend DCB.
|
||||||
|
* When event is notified the message is processed as error reply and routed
|
||||||
|
* upstream to client.
|
||||||
|
*
|
||||||
|
* @param backend_dcb DCB where event is added
|
||||||
|
* @param error SQL error number
|
||||||
|
* @param state SQL state
|
||||||
|
* @param errstr Plain-text string error
|
||||||
|
* @param flags GWBUF type flags
|
||||||
|
*/
|
||||||
|
static void modutil_reply_routing_error(
|
||||||
|
DCB* backend_dcb,
|
||||||
|
int error,
|
||||||
|
char* state,
|
||||||
|
char* errstr,
|
||||||
|
uint32_t flags)
|
||||||
|
{
|
||||||
|
GWBUF* buf;
|
||||||
|
CHK_DCB(backend_dcb);
|
||||||
|
|
||||||
|
buf = modutil_create_mysql_err_msg(1, 0, error, state, errstr);
|
||||||
|
free(errstr);
|
||||||
|
|
||||||
|
if (buf == NULL)
|
||||||
|
{
|
||||||
|
LOGIF(LE, (skygw_log_write_flush(
|
||||||
|
LOGFILE_ERROR,
|
||||||
|
"Error : Creating routing error message failed.")));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/** Set flags that help router to process reply correctly */
|
||||||
|
gwbuf_set_type(buf, flags);
|
||||||
|
/** Create an incoming event for backend DCB */
|
||||||
|
poll_add_epollin_event_to_dcb(backend_dcb, buf);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
@ -1020,7 +1020,10 @@ SERV_PROTOCOL *lptr;
|
|||||||
ptr->name, lptr->protocol,
|
ptr->name, lptr->protocol,
|
||||||
(lptr && lptr->address) ? lptr->address : "*",
|
(lptr && lptr->address) ? lptr->address : "*",
|
||||||
lptr->port,
|
lptr->port,
|
||||||
(lptr->listener->session->state == SESSION_STATE_LISTENER_STOPPED) ? "Stopped" : "Running"
|
(!lptr->listener ||
|
||||||
|
!lptr->listener->session ||
|
||||||
|
lptr->listener->session->state == SESSION_STATE_LISTENER_STOPPED) ?
|
||||||
|
"Stopped" : "Running"
|
||||||
);
|
);
|
||||||
|
|
||||||
lptr = lptr->next;
|
lptr = lptr->next;
|
||||||
|
@ -1,121 +0,0 @@
|
|||||||
# cleantests - clean local and subdirectories' tests
|
|
||||||
# buildtests - build all local and subdirectories' tests
|
|
||||||
# runtests - run all local tests
|
|
||||||
# testall - clean, build and run local and subdirectories' tests
|
|
||||||
|
|
||||||
include ../../../build_gateway.inc
|
|
||||||
include ../../../makefile.inc
|
|
||||||
include ../../../test.inc
|
|
||||||
|
|
||||||
CC=cc
|
|
||||||
TESTLOG := $(shell pwd)/testcore.log
|
|
||||||
|
|
||||||
LOGPATH := $(ROOT_PATH)/log_manager
|
|
||||||
UTILSPATH := $(ROOT_PATH)/utils
|
|
||||||
|
|
||||||
LDFLAGS=-rdynamic -L$(LOGPATH) -L$(EMBEDDED_LIB) \
|
|
||||||
-Wl,-rpath,$(DEST)/lib \
|
|
||||||
-Wl,-rpath,$(LOGPATH) -Wl,-rpath,$(UTILSPATH) \
|
|
||||||
-Wl,-rpath,$(EMBEDDED_LIB)
|
|
||||||
|
|
||||||
LIBS= -L$(EMBEDDED_LIB) -lmysqld \
|
|
||||||
-lz -lm -lcrypt -lcrypto -ldl -laio -lrt -pthread -llog_manager \
|
|
||||||
-L../../inih/extra -linih -lssl -lstdc++
|
|
||||||
|
|
||||||
TESTS=testhash testspinlock testbuffer testmodutil testpoll testservice testdcb testfilter testadminusers testmemlog
|
|
||||||
|
|
||||||
cleantests:
|
|
||||||
- $(DEL) *.o
|
|
||||||
- $(DEL) testhash
|
|
||||||
- $(DEL) *~
|
|
||||||
|
|
||||||
testall:
|
|
||||||
$(MAKE) cleantests
|
|
||||||
$(MAKE) DEBUG=Y buildtests
|
|
||||||
$(MAKE) runtests
|
|
||||||
|
|
||||||
buildtests : $(TESTS)
|
|
||||||
|
|
||||||
testhash: testhash.c
|
|
||||||
$(CC) $(CFLAGS) \
|
|
||||||
-I$(ROOT_PATH)/server/include \
|
|
||||||
-I$(ROOT_PATH)/utils \
|
|
||||||
testhash.c ../hashtable.o ../atomic.o ../spinlock.o -o testhash
|
|
||||||
|
|
||||||
testmysqlusers: test_mysql_users.c
|
|
||||||
$(CC) $(CFLAGS) \
|
|
||||||
-I$(ROOT_PATH)/server/include \
|
|
||||||
-I$(ROOT_PATH)/utils \
|
|
||||||
test_mysql_users.c ../hashtable.o ../atomic.o ../modutil.o ../spinlock.o -o testmysqlusers
|
|
||||||
|
|
||||||
|
|
||||||
testspinlock: testspinlock.c
|
|
||||||
$(CC) $(CFLAGS) \
|
|
||||||
-I$(ROOT_PATH)/server/include \
|
|
||||||
-I$(ROOT_PATH)/utils \
|
|
||||||
testspinlock.c ../spinlock.o ../atomic.o ../thread.o -o testspinlock
|
|
||||||
|
|
||||||
testmodutil: testmodutil.c
|
|
||||||
$(CC) $(CFLAGS) \
|
|
||||||
-I$(ROOT_PATH)/server/include \
|
|
||||||
-I$(ROOT_PATH)/utils \
|
|
||||||
testmodutil.c ../modutil.o ../buffer.o ../atomic.o -o testmodutil
|
|
||||||
|
|
||||||
testbuffer: testbuffer.c
|
|
||||||
$(CC) $(CFLAGS) \
|
|
||||||
-I$(ROOT_PATH)/server/include \
|
|
||||||
-I$(ROOT_PATH)/utils \
|
|
||||||
testbuffer.c ../buffer.o ../atomic.o -o testbuffer
|
|
||||||
|
|
||||||
testpoll: testpoll.c
|
|
||||||
$(CC) $(CFLAGS) $(LDFLAGS) \
|
|
||||||
-I$(ROOT_PATH)/server/include \
|
|
||||||
-I$(ROOT_PATH)/utils \
|
|
||||||
-I$(ROOT_PATH)/log_manager \
|
|
||||||
testpoll.c libcore.a $(UTILSPATH)/skygw_utils.o $(LIBS) -o testpoll
|
|
||||||
|
|
||||||
testservice: testservice.c
|
|
||||||
$(CC) $(CFLAGS) $(LDFLAGS) \
|
|
||||||
-I$(ROOT_PATH)/server/include \
|
|
||||||
-I$(ROOT_PATH)/utils \
|
|
||||||
-I$(ROOT_PATH)/log_manager \
|
|
||||||
testservice.c libcore.a $(UTILSPATH)/skygw_utils.o $(LIBS) -o testservice
|
|
||||||
|
|
||||||
testdcb: testdcb.c
|
|
||||||
$(CC) $(CFLAGS) $(LDFLAGS) \
|
|
||||||
-I$(ROOT_PATH)/server/include \
|
|
||||||
-I$(ROOT_PATH)/utils \
|
|
||||||
-I$(ROOT_PATH)/log_manager \
|
|
||||||
testdcb.c libcore.a $(UTILSPATH)/skygw_utils.o $(LIBS) -o testdcb
|
|
||||||
|
|
||||||
testfilter: testfilter.c libcore.a
|
|
||||||
$(CC) $(CFLAGS) $(LDFLAGS) \
|
|
||||||
-I$(ROOT_PATH)/server/include \
|
|
||||||
-I$(ROOT_PATH)/utils \
|
|
||||||
testfilter.c libcore.a $(UTILSPATH)/skygw_utils.o $(LIBS) -o testfilter
|
|
||||||
|
|
||||||
testadminusers: testadminusers.c libcore.a
|
|
||||||
$(CC) $(CFLAGS) $(LDFLAGS) \
|
|
||||||
-I$(ROOT_PATH)/server/include \
|
|
||||||
-I$(ROOT_PATH)/utils \
|
|
||||||
testadminusers.c libcore.a $(UTILSPATH)/skygw_utils.o $(LIBS) -o testadminusers
|
|
||||||
|
|
||||||
testmemlog: testmemlog.c libcore.a
|
|
||||||
$(CC) $(CFLAGS) $(LDFLAGS) \
|
|
||||||
-I$(ROOT_PATH)/server/include \
|
|
||||||
-I$(ROOT_PATH)/utils \
|
|
||||||
testmemlog.c libcore.a $(UTILSPATH)/skygw_utils.o $(LIBS) -o testmemlog
|
|
||||||
|
|
||||||
|
|
||||||
libcore.a: ../*.o
|
|
||||||
ar rv libcore.a ../*.o
|
|
||||||
|
|
||||||
runtests: $(TESTS)
|
|
||||||
@echo "" > $(TESTLOG)
|
|
||||||
@echo "-------------------------------" >> $(TESTLOG)
|
|
||||||
@echo $(shell date) >> $(TESTLOG)
|
|
||||||
@echo "Test MaxScale core" >> $(TESTLOG)
|
|
||||||
@echo "-------------------------------" >> $(TESTLOG)
|
|
||||||
$(foreach var,$(TESTS),./runtest.sh $(var) $(TESTLOG);)
|
|
||||||
@echo "" >> $(TESTLOG)
|
|
||||||
@cat $(TESTLOG) >> $(TEST_MAXSCALE_LOG)
|
|
@ -62,6 +62,8 @@ extern int modutil_send_mysql_err_packet(DCB *, int, int, int, const char *, con
|
|||||||
GWBUF* modutil_get_next_MySQL_packet(GWBUF** p_readbuf);
|
GWBUF* modutil_get_next_MySQL_packet(GWBUF** p_readbuf);
|
||||||
GWBUF* modutil_get_complete_packets(GWBUF** p_readbuf);
|
GWBUF* modutil_get_complete_packets(GWBUF** p_readbuf);
|
||||||
int modutil_MySQL_query_len(GWBUF* buf, int* nbytes_missing);
|
int modutil_MySQL_query_len(GWBUF* buf, int* nbytes_missing);
|
||||||
|
void modutil_reply_parse_error(DCB* backend_dcb, char* errstr, uint32_t flags);
|
||||||
|
void modutil_reply_auth_error(DCB* backend_dcb, char* errstr, uint32_t flags);
|
||||||
|
|
||||||
GWBUF *modutil_create_mysql_err_msg(
|
GWBUF *modutil_create_mysql_err_msg(
|
||||||
int packet_number,
|
int packet_number,
|
||||||
|
@ -43,6 +43,11 @@
|
|||||||
*/
|
*/
|
||||||
typedef void *ROUTER;
|
typedef void *ROUTER;
|
||||||
|
|
||||||
|
typedef enum error_action {
|
||||||
|
ERRACT_NEW_CONNECTION = 0x001,
|
||||||
|
ERRACT_REPLY_CLIENT = 0x002,
|
||||||
|
ERRACT_RESET = 0x004
|
||||||
|
} error_action_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @verbatim
|
* @verbatim
|
||||||
@ -66,12 +71,6 @@ typedef void *ROUTER;
|
|||||||
*
|
*
|
||||||
* @see load_module
|
* @see load_module
|
||||||
*/
|
*/
|
||||||
typedef enum error_action {
|
|
||||||
ERRACT_NEW_CONNECTION = 0x001,
|
|
||||||
ERRACT_REPLY_CLIENT = 0x002
|
|
||||||
} error_action_t;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct router_object {
|
typedef struct router_object {
|
||||||
ROUTER *(*createInstance)(SERVICE *service, char **options);
|
ROUTER *(*createInstance)(SERVICE *service, char **options);
|
||||||
void *(*newSession)(ROUTER *instance, SESSION *session);
|
void *(*newSession)(ROUTER *instance, SESSION *session);
|
||||||
|
0
server/inih/LICENSE.txt
Executable file → Normal file
0
server/inih/LICENSE.txt
Executable file → Normal file
0
server/inih/README.txt
Executable file → Normal file
0
server/inih/README.txt
Executable file → Normal file
0
server/inih/cpp/INIReader.cpp
Executable file → Normal file
0
server/inih/cpp/INIReader.cpp
Executable file → Normal file
0
server/inih/cpp/INIReader.h
Executable file → Normal file
0
server/inih/cpp/INIReader.h
Executable file → Normal file
0
server/inih/cpp/INIReaderTest.cpp
Executable file → Normal file
0
server/inih/cpp/INIReaderTest.cpp
Executable file → Normal file
0
server/inih/examples/config.def
Executable file → Normal file
0
server/inih/examples/config.def
Executable file → Normal file
0
server/inih/examples/ini_dump.c
Executable file → Normal file
0
server/inih/examples/ini_dump.c
Executable file → Normal file
0
server/inih/examples/ini_example.c
Executable file → Normal file
0
server/inih/examples/ini_example.c
Executable file → Normal file
0
server/inih/examples/ini_xmacros.c
Executable file → Normal file
0
server/inih/examples/ini_xmacros.c
Executable file → Normal file
0
server/inih/examples/test.ini
Executable file → Normal file
0
server/inih/examples/test.ini
Executable file → Normal file
@ -1,19 +0,0 @@
|
|||||||
# Simple makefile to build inih as a static library using g++
|
|
||||||
|
|
||||||
SRC = ../ini.c
|
|
||||||
OBJ = $(SRC:.c=.o)
|
|
||||||
OUT = libinih.a
|
|
||||||
INCLUDES = -I..
|
|
||||||
CCFLAGS = -g -O2
|
|
||||||
CC = g++
|
|
||||||
|
|
||||||
default: $(OUT)
|
|
||||||
|
|
||||||
.c.o:
|
|
||||||
$(CC) $(INCLUDES) $(CCFLAGS) $(EXTRACCFLAGS) -c $< -o $@
|
|
||||||
|
|
||||||
$(OUT): $(OBJ)
|
|
||||||
ar rcs $(OUT) $(OBJ) $(EXTRAARFLAGS)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f $(OBJ) $(OUT)
|
|
0
server/inih/ini.c
Executable file → Normal file
0
server/inih/ini.c
Executable file → Normal file
0
server/inih/ini.h
Executable file → Normal file
0
server/inih/ini.h
Executable file → Normal file
0
server/inih/tests/bad_comment.ini
Executable file → Normal file
0
server/inih/tests/bad_comment.ini
Executable file → Normal file
0
server/inih/tests/bad_multi.ini
Executable file → Normal file
0
server/inih/tests/bad_multi.ini
Executable file → Normal file
0
server/inih/tests/bad_section.ini
Executable file → Normal file
0
server/inih/tests/bad_section.ini
Executable file → Normal file
0
server/inih/tests/baseline_multi.txt
Executable file → Normal file
0
server/inih/tests/baseline_multi.txt
Executable file → Normal file
0
server/inih/tests/baseline_single.txt
Executable file → Normal file
0
server/inih/tests/baseline_single.txt
Executable file → Normal file
0
server/inih/tests/bom.ini
Executable file → Normal file
0
server/inih/tests/bom.ini
Executable file → Normal file
0
server/inih/tests/multi_line.ini
Executable file → Normal file
0
server/inih/tests/multi_line.ini
Executable file → Normal file
0
server/inih/tests/normal.ini
Executable file → Normal file
0
server/inih/tests/normal.ini
Executable file → Normal file
0
server/inih/tests/unittest.bat
Executable file → Normal file
0
server/inih/tests/unittest.bat
Executable file → Normal file
0
server/inih/tests/unittest.c
Executable file → Normal file
0
server/inih/tests/unittest.c
Executable file → Normal file
0
server/inih/tests/user_error.ini
Executable file → Normal file
0
server/inih/tests/user_error.ini
Executable file → Normal file
@ -1,117 +0,0 @@
|
|||||||
# This file is distributed as part of MaxScale form MariaDB Corporation. It is free
|
|
||||||
# software: you can redistribute it and/or modify it under the terms of the
|
|
||||||
# GNU General Public License as published by the Free Software Foundation,
|
|
||||||
# version 2.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
||||||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
||||||
# details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License along with
|
|
||||||
# this program; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
#
|
|
||||||
# Copyright MariaDB Corporation Ab 2014
|
|
||||||
#
|
|
||||||
# Revision History
|
|
||||||
# Date Who Description
|
|
||||||
# 29/05/14 Mark Riddoch Initial module development
|
|
||||||
|
|
||||||
include ../../../build_gateway.inc
|
|
||||||
|
|
||||||
LOGPATH := $(ROOT_PATH)/log_manager
|
|
||||||
QCLASSPATH := $(ROOT_PATH)/query_classifier
|
|
||||||
UTILSPATH := $(ROOT_PATH)/utils
|
|
||||||
|
|
||||||
CC=cc
|
|
||||||
CFLAGS=-c -fPIC -I/usr/include -I../include -I../../include -I$(LOGPATH) -I$(QCLASSPATH) \
|
|
||||||
-I$(UTILSPATH) -I$(MYSQL_ROOT) -Wall -g
|
|
||||||
|
|
||||||
include ../../../makefile.inc
|
|
||||||
|
|
||||||
LDFLAGS=-shared -L$(LOGPATH) -L$(EMBEDDED_LIB) -L$(QCLASSPATH) -Wl,-rpath,$(DEST)/lib \
|
|
||||||
-Wl,-rpath,$(LOGPATH) -Wl,-rpath,$(UTILSPATH)
|
|
||||||
|
|
||||||
TESTSRCS=testfilter.c
|
|
||||||
TESTOBJ=$(TESTSRCS:.c=.o)
|
|
||||||
QLASRCS=qlafilter.c
|
|
||||||
QLAOBJ=$(QLASRCS:.c=.o)
|
|
||||||
REGEXSRCS=regexfilter.c
|
|
||||||
REGEXOBJ=$(REGEXSRCS:.c=.o)
|
|
||||||
TOPNSRCS=topfilter.c
|
|
||||||
TOPNOBJ=$(TOPNSRCS:.c=.o)
|
|
||||||
TEESRCS=tee.c
|
|
||||||
TEEOBJ=$(TEESRCS:.c=.o)
|
|
||||||
MQSRCS=mqfilter.c
|
|
||||||
MQOBJ=$(MQSRCS:.c=.o)
|
|
||||||
SRCS=$(TESTSRCS) $(QLASRCS) $(REGEXSRCS) $(TOPNSRCS) $(TEESRCS)
|
|
||||||
OBJ=$(SRCS:.c=.o)
|
|
||||||
LIBS=$(UTILSPATH)/skygw_utils.o -lssl -llog_manager
|
|
||||||
MODULES= libtestfilter.so libqlafilter.so libregexfilter.so libtopfilter.so libhintfilter.so libtee.so
|
|
||||||
|
|
||||||
ifndef BUILD_RABBITMQ
|
|
||||||
BUILD_RABBITMQ=N
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(BUILD_RABBITMQ),Y)
|
|
||||||
SRCS += $(MQSRCS)
|
|
||||||
MODULES += libmqfilter.so
|
|
||||||
LIBS += -lrabbitmq -lquery_classifier
|
|
||||||
endif
|
|
||||||
|
|
||||||
all: $(MODULES)
|
|
||||||
|
|
||||||
libtestfilter.so: $(TESTOBJ)
|
|
||||||
$(CC) $(LDFLAGS) $(TESTOBJ) $(LIBS) -o $@
|
|
||||||
|
|
||||||
libmqfilter.so: $(MQOBJ)
|
|
||||||
$(CC) $(LDFLAGS) $(MQOBJ) $(LIBS) -o $@
|
|
||||||
|
|
||||||
libqlafilter.so: $(QLAOBJ)
|
|
||||||
$(CC) $(LDFLAGS) $(QLAOBJ) $(LIBS) -o $@
|
|
||||||
|
|
||||||
libregexfilter.so: $(REGEXOBJ)
|
|
||||||
$(CC) $(LDFLAGS) $(REGEXOBJ) $(LIBS) -o $@
|
|
||||||
|
|
||||||
libtopfilter.so: $(TOPNOBJ)
|
|
||||||
$(CC) $(LDFLAGS) $(TOPNOBJ) $(LIBS) -o $@
|
|
||||||
|
|
||||||
libtee.so: $(TEEOBJ)
|
|
||||||
$(CC) $(LDFLAGS) $(TEEOBJ) $(LIBS) -o $@
|
|
||||||
|
|
||||||
libhintfilter.so:
|
|
||||||
(cd hint; touch depend.mk ; make; cp $@ ..)
|
|
||||||
|
|
||||||
.c.o:
|
|
||||||
$(CC) $(CFLAGS) $< -o $@
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f $(OBJ) $(MODULES)
|
|
||||||
(cd hint; touch depend.mk; make clean)
|
|
||||||
|
|
||||||
tags:
|
|
||||||
ctags $(SRCS) $(HDRS)
|
|
||||||
(cd hint; touch depend.mk; make tags)
|
|
||||||
|
|
||||||
depend:
|
|
||||||
@rm -f depend.mk
|
|
||||||
cc -M $(CFLAGS) $(SRCS) > depend.mk
|
|
||||||
(cd hint; touch depend.mk; make depend)
|
|
||||||
|
|
||||||
install: $(MODULES)
|
|
||||||
install -D $(MODULES) $(DEST)/modules
|
|
||||||
|
|
||||||
cleantests:
|
|
||||||
$(MAKE) -C test cleantests
|
|
||||||
|
|
||||||
buildtests:
|
|
||||||
$(MAKE) -C test DEBUG=Y buildtests
|
|
||||||
|
|
||||||
runtests:
|
|
||||||
$(MAKE) -C test runtests
|
|
||||||
|
|
||||||
testall:
|
|
||||||
$(MAKE) -C test testall
|
|
||||||
|
|
||||||
include depend.mk
|
|
@ -686,11 +686,13 @@ void link_rules(char* rule, FW_INSTANCE* instance)
|
|||||||
user = (USER*)calloc(1,sizeof(USER));
|
user = (USER*)calloc(1,sizeof(USER));
|
||||||
|
|
||||||
if(user == NULL){
|
if(user == NULL){
|
||||||
|
free(rulelist);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((user->lock = (SPINLOCK*)malloc(sizeof(SPINLOCK))) == NULL){
|
if((user->lock = (SPINLOCK*)malloc(sizeof(SPINLOCK))) == NULL){
|
||||||
free(user);
|
free(user);
|
||||||
|
free(rulelist);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -750,7 +752,21 @@ void parse_rule(char* rule, FW_INSTANCE* instance)
|
|||||||
RULELIST* rlist = NULL;
|
RULELIST* rlist = NULL;
|
||||||
|
|
||||||
ruledef = (RULE*)calloc(1,sizeof(RULE));
|
ruledef = (RULE*)calloc(1,sizeof(RULE));
|
||||||
|
|
||||||
|
if(ruledef == NULL)
|
||||||
|
{
|
||||||
|
skygw_log_write(LOGFILE_ERROR,"Error : Memory allocation failed.");
|
||||||
|
goto retblock;
|
||||||
|
}
|
||||||
|
|
||||||
rlist = (RULELIST*)calloc(1,sizeof(RULELIST));
|
rlist = (RULELIST*)calloc(1,sizeof(RULELIST));
|
||||||
|
|
||||||
|
if(rlist == NULL)
|
||||||
|
{
|
||||||
|
free(ruledef);
|
||||||
|
skygw_log_write(LOGFILE_ERROR,"Error : Memory allocation failed.");
|
||||||
|
goto retblock;
|
||||||
|
}
|
||||||
ruledef->name = strdup(tok);
|
ruledef->name = strdup(tok);
|
||||||
ruledef->type = RT_UNDEFINED;
|
ruledef->type = RT_UNDEFINED;
|
||||||
ruledef->on_queries = QUERY_OP_UNDEFINED;
|
ruledef->on_queries = QUERY_OP_UNDEFINED;
|
||||||
@ -843,12 +859,17 @@ void parse_rule(char* rule, FW_INSTANCE* instance)
|
|||||||
}
|
}
|
||||||
|
|
||||||
str = calloc(((tok - start) + 1),sizeof(char));
|
str = calloc(((tok - start) + 1),sizeof(char));
|
||||||
|
if(str == NULL)
|
||||||
|
{
|
||||||
|
skygw_log_write_flush(LOGFILE_ERROR, "Fatal Error: malloc returned NULL.");
|
||||||
|
goto retblock;
|
||||||
|
}
|
||||||
re = (regex_t*)malloc(sizeof(regex_t));
|
re = (regex_t*)malloc(sizeof(regex_t));
|
||||||
|
|
||||||
if(re == NULL || str == NULL){
|
if(re == NULL){
|
||||||
skygw_log_write_flush(LOGFILE_ERROR, "Fatal Error: malloc returned NULL.");
|
skygw_log_write_flush(LOGFILE_ERROR, "Fatal Error: malloc returned NULL.");
|
||||||
|
free(str);
|
||||||
return;
|
goto retblock;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(str, start, (tok-start));
|
memcpy(str, start, (tok-start));
|
||||||
@ -857,9 +878,11 @@ void parse_rule(char* rule, FW_INSTANCE* instance)
|
|||||||
skygw_log_write(LOGFILE_ERROR, "fwfilter: Invalid regular expression '%s'.", str);
|
skygw_log_write(LOGFILE_ERROR, "fwfilter: Invalid regular expression '%s'.", str);
|
||||||
free(re);
|
free(re);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
ruledef->type = RT_REGEX;
|
ruledef->type = RT_REGEX;
|
||||||
ruledef->data = (void*) re;
|
ruledef->data = (void*) re;
|
||||||
|
}
|
||||||
free(str);
|
free(str);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -929,6 +952,7 @@ createInstance(char **options, FILTER_PARAMETER **params)
|
|||||||
|
|
||||||
if ((my_instance = calloc(1, sizeof(FW_INSTANCE))) == NULL ||
|
if ((my_instance = calloc(1, sizeof(FW_INSTANCE))) == NULL ||
|
||||||
(my_instance->lock = (SPINLOCK*)malloc(sizeof(SPINLOCK))) == NULL){
|
(my_instance->lock = (SPINLOCK*)malloc(sizeof(SPINLOCK))) == NULL){
|
||||||
|
skygw_log_write(LOGFILE_ERROR, "Memory allocation for firewall filter failed.");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -947,11 +971,23 @@ createInstance(char **options, FILTER_PARAMETER **params)
|
|||||||
|
|
||||||
for(i = 0;params[i];i++){
|
for(i = 0;params[i];i++){
|
||||||
if(strcmp(params[i]->name, "rules") == 0){
|
if(strcmp(params[i]->name, "rules") == 0){
|
||||||
|
|
||||||
|
if(filename)
|
||||||
|
free(filename);
|
||||||
|
|
||||||
filename = strdup(params[i]->value);
|
filename = strdup(params[i]->value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(filename == NULL)
|
||||||
|
{
|
||||||
|
skygw_log_write(LOGFILE_ERROR, "Unable to find rule file for firewall filter.");
|
||||||
|
free(my_instance);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if((file = fopen(filename,"rb")) == NULL ){
|
if((file = fopen(filename,"rb")) == NULL ){
|
||||||
|
skygw_log_write(LOGFILE_ERROR, "Error while opening rule file for firewall filter.");
|
||||||
free(my_instance);
|
free(my_instance);
|
||||||
free(filename);
|
free(filename);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -964,6 +1000,8 @@ createInstance(char **options, FILTER_PARAMETER **params)
|
|||||||
|
|
||||||
if(fgets(buffer,2048,file) == NULL){
|
if(fgets(buffer,2048,file) == NULL){
|
||||||
if(ferror(file)){
|
if(ferror(file)){
|
||||||
|
skygw_log_write(LOGFILE_ERROR, "Error while reading rule file for firewall filter.");
|
||||||
|
fclose(file);
|
||||||
free(my_instance);
|
free(my_instance);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -976,8 +1014,8 @@ createInstance(char **options, FILTER_PARAMETER **params)
|
|||||||
if((nl = strchr(buffer,'\n')) != NULL && ((char*)nl - (char*)buffer) < 2048){
|
if((nl = strchr(buffer,'\n')) != NULL && ((char*)nl - (char*)buffer) < 2048){
|
||||||
*nl = '\0';
|
*nl = '\0';
|
||||||
}
|
}
|
||||||
parse_rule(buffer,my_instance);
|
|
||||||
|
|
||||||
|
parse_rule(buffer,my_instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(file);
|
fclose(file);
|
||||||
@ -1075,15 +1113,25 @@ GWBUF* gen_dummy_error(FW_SESSION* session, char* msg)
|
|||||||
{
|
{
|
||||||
GWBUF* buf;
|
GWBUF* buf;
|
||||||
char* errmsg;
|
char* errmsg;
|
||||||
DCB* dcb = session->session->client;
|
DCB* dcb;
|
||||||
MYSQL_session* mysql_session = (MYSQL_session*)session->session->data;
|
MYSQL_session* mysql_session;
|
||||||
unsigned int errlen;
|
unsigned int errlen;
|
||||||
|
|
||||||
|
if(session == NULL || session->session == NULL ||
|
||||||
|
session->session->data == NULL ||
|
||||||
|
session->session->client == NULL)
|
||||||
|
{
|
||||||
|
skygw_log_write_flush(LOGFILE_ERROR, "Error : Firewall filter session missing data.");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
dcb = session->session->client;
|
||||||
|
mysql_session = (MYSQL_session*)session->session->data;
|
||||||
errlen = msg != NULL ? strlen(msg) : 0;
|
errlen = msg != NULL ? strlen(msg) : 0;
|
||||||
errmsg = (char*)malloc((512 + errlen)*sizeof(char));
|
errmsg = (char*)malloc((512 + errlen)*sizeof(char));
|
||||||
|
|
||||||
if(errmsg == NULL){
|
if(errmsg == NULL){
|
||||||
skygw_log_write_flush(LOGFILE_ERROR, "Fatal Error: malloc returned NULL.");
|
skygw_log_write_flush(LOGFILE_ERROR, "Fatal Error: Memory allocation failed.");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1110,6 +1158,7 @@ GWBUF* gen_dummy_error(FW_SESSION* session, char* msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
buf = modutil_create_mysql_err_msg(1,0,1141,"HY000", (const char*)errmsg);
|
buf = modutil_create_mysql_err_msg(1,0,1141,"HY000", (const char*)errmsg);
|
||||||
|
free(errmsg);
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
@ -1192,7 +1241,7 @@ bool rule_matches(FW_INSTANCE* my_instance, FW_SESSION* my_session, GWBUF *queue
|
|||||||
char emsg[512];
|
char emsg[512];
|
||||||
int qlen;
|
int qlen;
|
||||||
bool is_sql, is_real, matches;
|
bool is_sql, is_real, matches;
|
||||||
skygw_query_op_t optype;
|
skygw_query_op_t optype = QUERY_OP_UNDEFINED;
|
||||||
STRLINK* strln = NULL;
|
STRLINK* strln = NULL;
|
||||||
QUERYSPEED* queryspeed = NULL;
|
QUERYSPEED* queryspeed = NULL;
|
||||||
QUERYSPEED* rule_qs = NULL;
|
QUERYSPEED* rule_qs = NULL;
|
||||||
@ -1469,7 +1518,7 @@ bool check_match_any(FW_INSTANCE* my_instance, FW_SESSION* my_session, GWBUF *qu
|
|||||||
*/
|
*/
|
||||||
bool check_match_all(FW_INSTANCE* my_instance, FW_SESSION* my_session, GWBUF *queue, USER* user)
|
bool check_match_all(FW_INSTANCE* my_instance, FW_SESSION* my_session, GWBUF *queue, USER* user)
|
||||||
{
|
{
|
||||||
bool is_sql, rval;
|
bool is_sql, rval = 0;
|
||||||
int qlen;
|
int qlen;
|
||||||
char *fullquery = NULL,*ptr;
|
char *fullquery = NULL,*ptr;
|
||||||
|
|
||||||
|
@ -1,70 +0,0 @@
|
|||||||
# This file is distributed as part of MaxScale form MariaDB Corporation. It is free
|
|
||||||
# software: you can redistribute it and/or modify it under the terms of the
|
|
||||||
# GNU General Public License as published by the Free Software Foundation,
|
|
||||||
# version 2.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
||||||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
||||||
# details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License along with
|
|
||||||
# this program; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
#
|
|
||||||
# Copyright MariaDB Corporation Ab 2014
|
|
||||||
#
|
|
||||||
# Revision History
|
|
||||||
# Date Who Description
|
|
||||||
# 21/07/14 Mark Riddoch Initial module development
|
|
||||||
|
|
||||||
include ../../../../build_gateway.inc
|
|
||||||
|
|
||||||
LOGPATH := $(ROOT_PATH)/log_manager
|
|
||||||
UTILSPATH := $(ROOT_PATH)/utils
|
|
||||||
|
|
||||||
CC=cc
|
|
||||||
CFLAGS=-c -fPIC -I/usr/include -I../../include -I../../../include -I$(LOGPATH) \
|
|
||||||
-I$(UTILSPATH) -Wall -g
|
|
||||||
|
|
||||||
include ../../../../makefile.inc
|
|
||||||
|
|
||||||
LDFLAGS=-shared -L$(LOGPATH) -Wl,-rpath,$(DEST)/lib \
|
|
||||||
-Wl,-rpath,$(LOGPATH) -Wl,-rpath,$(UTILSPATH)
|
|
||||||
|
|
||||||
SRCS= hintfilter.c hintparser.c
|
|
||||||
OBJ=$(SRCS:.c=.o)
|
|
||||||
LIBS=$(UTILSPATH)/skygw_utils.o -lssl -llog_manager
|
|
||||||
|
|
||||||
libhintfilter.so: $(OBJ)
|
|
||||||
$(CC) $(LDFLAGS) $(OBJ) $(LIBS) -o $@
|
|
||||||
|
|
||||||
.c.o:
|
|
||||||
$(CC) $(CFLAGS) $< -o $@
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f $(OBJ) libhintfilter.so
|
|
||||||
|
|
||||||
tags:
|
|
||||||
ctags $(SRCS) $(HDRS)
|
|
||||||
|
|
||||||
depend:
|
|
||||||
@rm -f depend.mk
|
|
||||||
cc -M $(CFLAGS) $(SRCS) > depend.mk
|
|
||||||
|
|
||||||
install: $(MODULES)
|
|
||||||
install -D $(MODULES) $(DEST)/modules
|
|
||||||
|
|
||||||
cleantests:
|
|
||||||
$(MAKE) -C test cleantests
|
|
||||||
|
|
||||||
buildtests:
|
|
||||||
$(MAKE) -C test DEBUG=Y buildtests
|
|
||||||
|
|
||||||
runtests:
|
|
||||||
$(MAKE) -C test runtests
|
|
||||||
|
|
||||||
testall:
|
|
||||||
$(MAKE) -C test testall
|
|
||||||
|
|
||||||
include depend.mk
|
|
@ -1,80 +0,0 @@
|
|||||||
# This file is distributed as part of MaxScale form MariaDB Corporation. It is free
|
|
||||||
# software: you can redistribute it and/or modify it under the terms of the
|
|
||||||
# GNU General Public License as published by the Free Software Foundation,
|
|
||||||
# version 2.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
||||||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
||||||
# details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License along with
|
|
||||||
# this program; if not, write to the Free Software Foundation, Inc., 51
|
|
||||||
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
#
|
|
||||||
# Copyright MariaDB Corporation Ab 2014
|
|
||||||
|
|
||||||
include ../../../../build_gateway.inc
|
|
||||||
|
|
||||||
LOGPATH := $(ROOT_PATH)/log_manager
|
|
||||||
UTILSPATH := $(ROOT_PATH)/utils
|
|
||||||
QCLASSPATH := $(ROOT_PATH)/query_classifier
|
|
||||||
COREPATH := $(ROOT_PATH)/server/core
|
|
||||||
|
|
||||||
CC=cc
|
|
||||||
CFLAGS=-c -fPIC -I/usr/include -I../../include -I../../../include \
|
|
||||||
-I$(LOGPATH) -I$(UTILSPATH) -I./ -I$(ROOT_PATH)/server/inih -I$(QCLASSPATH) \
|
|
||||||
$(MYSQL_HEADERS) -Wall -g
|
|
||||||
|
|
||||||
include ../../../../makefile.inc
|
|
||||||
|
|
||||||
LDFLAGS=-rdynamic -L$(LOGPATH) -L$(UTILSPATH) -L$(EMBEDDED_LIB) \
|
|
||||||
-Wl,-rpath,$(DEST)/lib \
|
|
||||||
-Wl,-rpath,$(LOGPATH) -Wl,-rpath,$(UTILSPATH) \
|
|
||||||
-Wl,-rpath,$(EMBEDDED_LIB)
|
|
||||||
|
|
||||||
SRCS=harness_util.c harness_common.c
|
|
||||||
OBJ=$(SRCS:.c=.o)
|
|
||||||
COREOBJ=$(COREPATH)/load_utils.o $(COREPATH)/dcb.o $(COREPATH)/utils.o \
|
|
||||||
$(COREPATH)/gw_utils.o $(COREPATH)/buffer.o $(COREPATH)/poll.o \
|
|
||||||
$(COREPATH)/spinlock.o $(COREPATH)/gwbitmask.o $(COREPATH)/session.o \
|
|
||||||
$(COREPATH)/atomic.o $(COREPATH)/hashtable.o $(COREPATH)/filter.o $(COREPATH)/modutil.o $(ROOT_PATH)/server/inih/ini.o \
|
|
||||||
$(COREPATH)/hint.o $(COREPATH)/config.o $(COREPATH)/service.o $(COREPATH)/server.o $(COREPATH)/monitor.o $(COREPATH)/housekeeper.o $(COREPATH)/adminusers.o $(COREPATH)/dbusers.o $(COREPATH)/thread.o $(COREPATH)/users.o $(COREPATH)/secrets.o
|
|
||||||
LIBS= $(UTILSPATH)/skygw_utils.o -lssl -pthread -llog_manager -lmysqld -ldl -lcrypto -lcrypt -lm
|
|
||||||
MODULES := $(wildcard ../*.so)
|
|
||||||
|
|
||||||
all: build
|
|
||||||
|
|
||||||
build:$(OBJ)
|
|
||||||
$(CC) $(OBJ) $(COREOBJ) $(LDFLAGS) $(LIBS) -o harness
|
|
||||||
$(MAKE) -C ../
|
|
||||||
cp ../*.so ./
|
|
||||||
|
|
||||||
%.o: %.c
|
|
||||||
$(CC) $(CFLAGS) $< -o $@
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f *.o
|
|
||||||
rm -f *.so
|
|
||||||
rm -f harness
|
|
||||||
cleantests:clean
|
|
||||||
rm *.output
|
|
||||||
buildtests:build
|
|
||||||
|
|
||||||
testall:
|
|
||||||
$(MAKE) cleantests
|
|
||||||
$(MAKE) buildtests
|
|
||||||
$(MAKE) runtests
|
|
||||||
|
|
||||||
runtests:
|
|
||||||
@echo ""
|
|
||||||
@echo "-------------------------------"
|
|
||||||
@echo "$(shell date)"
|
|
||||||
@echo "Test Filter harness"
|
|
||||||
@echo "-------------------------------"
|
|
||||||
@echo "Testing hints... "
|
|
||||||
@./hint_tests.sh
|
|
||||||
@echo ""
|
|
||||||
|
|
||||||
documentation:
|
|
||||||
doxygen doxygen.conf
|
|
0
server/modules/filter/test/fwfilter/fwtest.cnf.in
Executable file → Normal file
0
server/modules/filter/test/fwfilter/fwtest.cnf.in
Executable file → Normal file
0
server/modules/filter/test/fwfilter/fwtest.expected
Executable file → Normal file
0
server/modules/filter/test/fwfilter/fwtest.expected
Executable file → Normal file
0
server/modules/filter/test/fwfilter/fwtest.input
Executable file → Normal file
0
server/modules/filter/test/fwfilter/fwtest.input
Executable file → Normal file
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user