Merge branch '2.0' into develop-2.0-merge

This commit is contained in:
Markus Makela 2016-09-21 14:59:30 +03:00
commit eaf43ca92d
6 changed files with 82 additions and 33 deletions

View File

@ -304,8 +304,9 @@ endif()
# NOTE: If you make changes here, ensure they are compatible with the
# situation in gwdirs.h.in.
if (NOT CMAKE_INSTALL_PREFIX EQUAL "/usr")
if (NOT PACKAGE)
install(DIRECTORY DESTINATION var/cache/maxscale)
install(DIRECTORY DESTINATION var/log/maxscale)
install(DIRECTORY DESTINATION var/run/maxscale)
install(DIRECTORY DESTINATION var/lib/maxscale)
endif()

View File

@ -14,11 +14,27 @@ The required steps are as follows:
$ sudo useradd -g maxscale maxscale
$ cd /usr/local
$ sudo tar -xzvf maxscale-x.y.z.OS.tar.gz
$ sudo ln -s maxscale-x.y.z maxscale
$ sudo ln -s maxscale-x.y.z.OS maxscale
$ cd maxscale
$ chown -R maxscale var
$ sudo chown -R maxscale var
Creating the symbolic link is necessary, since MariaDB MaxScale has been built with with the assumption that its base-directory is `/usr/local/maxscale`. It also makes it easy to switch between different versions of MariaDB MaxScale that have been installed side by side in `/usr/local`; just make the symbolic link point to another installation.
Creating the symbolic link is necessary, since MariaDB MaxScale has been built with with the assumption that its base-directory, that is, the directory under which all its sub-directories are found, is `/usr/local/maxscale`.
The symbolic link also makes it easy to switch between different versions of MariaDB MaxScale that have been installed side by side in `/usr/local`; just make the symbolic link point to another installation.
In addition, the first time you install MariaDB MaxScale from a tarball you need to create the following directories:
$ sudo mkdir /var/log/maxscale
$ sudo mkdir /var/lib/maxscale
$ sudo mkdir /var/run/maxscale
$ sudo mkdir /var/cache/maxscale
and make `maxscale` the owner of them:
$ sudo chown maxscale /var/log/maxscale
$ sudo chown maxscale /var/lib/maxscale
$ sudo chown maxscale /var/run/maxscale
$ sudo chown maxscale /var/cache/maxscale
The following step is to create the MariaDB MaxScale configuration file `/etc/maxscale.cnf`. The file `etc/maxscale.cnf.template` can be used as a base. Please refer to [Configuration Guide](Configuration-Guide.md) for details.
@ -40,17 +56,13 @@ The next step is to create the MaxScale configuration file `maxscale-x.y.z/etc/m
When the configuration file has been created, MariaDB MaxScale can be started.
$ cd maxscale-x.y.z
$ LD_LIBRARY_PATH=lib/maxscale bin/maxscale -d --basedir=.
$ cd maxscale-x.y.z.OS
$ bin/maxscale -d --basedir=.
With the flag `--basedir`, MariaDB MaxScale is told where the `bin`, `etc`, `lib`
and `var` directories are found. Unless it is specified, MariaDB MaxScale assumes
the directories are found in `/usr/local/maxscale` and the configuration
file in `/etc`.
With the flag `--basedir`, MariaDB MaxScale is told where the `lib`, `etc` and `var` directories are found. Unless it is specified, MariaDB MaxScale assumes the `lib` directory is found in `/usr/local/maxscale`, and the `var` and `etc` directories in `/`.
It is also possible to specify the directories and the location of the
configuration file individually. Invoke MaxScale like
It is also possible to specify the directories and the location of the configuration file individually. Invoke MaxScale like
$ LD_LIBRARY_PATH=lib/maxscale bin/maxscale --help
$ bin/maxscale --help
to find out the appropriate flags.

View File

@ -10,6 +10,26 @@ set(MAXSCALE_DOCDIR ${CMAKE_INSTALL_DOCDIR}/maxscale CACHE PATH "Documentation i
set(MAXSCALE_VARDIR /var CACHE PATH "Data file path (usually /var/)")
set(MAXSCALE_CONFDIR /etc CACHE PATH "Configuration file installation path (/etc/)")
# Default values for directories and subpaths where files are searched. These
# are used in `server/include/gwdirs.h.in`.
set(DEFAULT_PID_SUBPATH "run/maxscale" CACHE PATH "Default PID file subpath")
set(DEFAULT_LOG_SUBPATH "log/maxscale" CACHE PATH "Default log subpath")
set(DEFAULT_DATA_SUBPATH "lib/maxscale" CACHE PATH "Default datadir subpath")
set(DEFAULT_LIB_SUBPATH "${MAXSCALE_LIBDIR}" CACHE PATH "Default library subpath")
set(DEFAULT_CACHE_SUBPATH "cache/maxscale" CACHE PATH "Default cache subpath")
set(DEFAULT_LANG_SUBPATH "lib/maxscale" CACHE PATH "Default language file subpath")
set(DEFAULT_EXEC_SUBPATH "${MAXSCALE_BINDIR}" CACHE PATH "Default executable subpath")
set(DEFAULT_CONFIG_SUBPATH "etc" CACHE PATH "Default configuration subpath")
set(DEFAULT_PIDDIR ${MAXSCALE_VARDIR}/${DEFAULT_PID_SUBPATH} CACHE PATH "Default PID file directory")
set(DEFAULT_LOGDIR ${MAXSCALE_VARDIR}/${DEFAULT_LOG_SUBPATH} CACHE PATH "Default log directory")
set(DEFAULT_DATADIR ${MAXSCALE_VARDIR}/${DEFAULT_DATA_SUBPATH} CACHE PATH "Default datadir path")
set(DEFAULT_LIBDIR ${CMAKE_INSTALL_PREFIX}/${DEFAULT_LIB_SUBPATH}/ CACHE PATH "Default library path")
set(DEFAULT_CACHEDIR ${MAXSCALE_VARDIR}/${DEFAULT_CACHE_SUBPATH} CACHE PATH "Default cache directory")
set(DEFAULT_LANGDIR ${MAXSCALE_VARDIR}/${DEFAULT_LANG_SUBPATH} CACHE PATH "Default language file directory")
set(DEFAULT_EXECDIR ${CMAKE_INSTALL_PREFIX}/${DEFAULT_EXEC_SUBPATH} CACHE PATH "Default executable directory")
set(DEFAULT_CONFIGDIR /${DEFAULT_CONFIG_SUBPATH} CACHE PATH "Default configuration directory")
# Massage TARGET_COMPONENT into a list
if (TARGET_COMPONENT)
string(REPLACE "," ";" TARGET_COMPONENT ${TARGET_COMPONENT})

View File

@ -2,16 +2,29 @@
message(STATUS "Generating tar.gz packages")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
set(MAXSCALE_BINDIR /bin CACHE PATH "" FORCE)
set(MAXSCALE_LIBDIR /lib CACHE PATH "" FORCE)
set(MAXSCALE_LIBDIR /lib/maxscale CACHE PATH "" FORCE)
set(MAXSCALE_SHAREDIR /share CACHE PATH "" FORCE)
set(MAXSCALE_DOCDIR /share CACHE PATH "" FORCE)
set(MAXSCALE_VARDIR /var CACHE PATH "" FORCE)
set(MAXSCALE_CONFDIR /etc CACHE PATH "" FORCE)
set(CMAKE_INSTALL_PREFIX "/" CACHE PATH "" FORCE)
set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib" CACHE PATH "" FORCE)
set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib/maxscale/" CACHE PATH "" FORCE)
set(CMAKE_INSTALL_DATADIR /share CACHE PATH "" FORCE)
set(DEFAULT_LIB_SUBPATH /lib/maxscale CACHE PATH "" FORCE)
set(DEFAULT_LIBDIR "/usr/local/maxscale/lib/maxscale" CACHE PATH "" FORCE)
set(CPACK_GENERATOR "TGZ")
# Include the var directories in the tarball
#
# On some platforms with certain CMake versions, installing empty directories
# with tarballs does not work. As a workaround, the .cmake-tgz-workaround file
# is installed into the would-be empty directories.
file(WRITE ${CMAKE_BINARY_DIR}/.cmake-tgz-workaround "")
install(FILES ${CMAKE_BINARY_DIR}/.cmake-tgz-workaround DESTINATION var/cache/maxscale)
install(FILES ${CMAKE_BINARY_DIR}/.cmake-tgz-workaround DESTINATION var/log/maxscale)
install(FILES ${CMAKE_BINARY_DIR}/.cmake-tgz-workaround DESTINATION var/run/maxscale)
install(FILES ${CMAKE_BINARY_DIR}/.cmake-tgz-workaround DESTINATION var/lib/maxscale)
if(DISTRIB_SUFFIX)
set(CPACK_PACKAGE_FILE_NAME "maxscale-${MAXSCALE_VERSION}.${DISTRIB_SUFFIX}")
else()

View File

@ -21,30 +21,31 @@
EXTERN_C_BLOCK_BEGIN
// NOTE: If you make changes here, ensure they are compatible with the
// situation in <root>/CMakeLists.txt, where directories are installed.
#define MXS_DEFAULT_PID_SUBPATH "run/maxscale"
#define MXS_DEFAULT_LOG_SUBPATH "log/maxscale"
#define MXS_DEFAULT_DATA_SUBPATH "lib/maxscale"
#define MXS_DEFAULT_LIB_SUBPATH "@MAXSCALE_LIBDIR@"
#define MXS_DEFAULT_CACHE_SUBPATH "cache/maxscale"
#define MXS_DEFAULT_LANG_SUBPATH "lib/maxscale"
#define MXS_DEFAULT_EXEC_SUBPATH "@MAXSCALE_BINDIR@"
#define MXS_DEFAULT_CONFIG_SUBPATH "etc"
/**
* All of the following DEFAULT_* variables are defined in cmake/install_layout.cmake
*/
#define MXS_DEFAULT_PID_SUBPATH "@DEFAULT_PID_SUBPATH@"
#define MXS_DEFAULT_LOG_SUBPATH "@DEFAULT_LOG_SUBPATH@"
#define MXS_DEFAULT_DATA_SUBPATH "@DEFAULT_DATA_SUBPATH@"
#define MXS_DEFAULT_LIB_SUBPATH "@DEFAULT_LIB_SUBPATH@"
#define MXS_DEFAULT_CACHE_SUBPATH "@DEFAULT_CACHE_SUBPATH@"
#define MXS_DEFAULT_LANG_SUBPATH "@DEFAULT_LANG_SUBPATH@"
#define MXS_DEFAULT_EXEC_SUBPATH "@DEFAULT_EXEC_SUBPATH@"
#define MXS_DEFAULT_CONFIG_SUBPATH "@DEFAULT_CONFIG_SUBPATH@"
/** Default file locations, configured by CMake */
static const char* default_cnf_fname = "maxscale.cnf";
static const char* default_configdir = "/" MXS_DEFAULT_CONFIG_SUBPATH;
static const char* default_configdir = "@DEFAULT_CONFIGDIR@";
/*< This should be changed to just /run eventually,
* the /var/run folder is an old standard and the newer FSH 3.0
* uses /run for PID files.*/
static const char* default_piddir = "@MAXSCALE_VARDIR@/" MXS_DEFAULT_PID_SUBPATH;
static const char* default_logdir = "@MAXSCALE_VARDIR@/" MXS_DEFAULT_LOG_SUBPATH;
static const char* default_datadir = "@MAXSCALE_VARDIR@/" MXS_DEFAULT_DATA_SUBPATH;
static const char* default_libdir = "@CMAKE_INSTALL_PREFIX@/" MXS_DEFAULT_LIB_SUBPATH;
static const char* default_cachedir = "@MAXSCALE_VARDIR@/" MXS_DEFAULT_CACHE_SUBPATH;
static const char* default_langdir = "@MAXSCALE_VARDIR@/" MXS_DEFAULT_LANG_SUBPATH;
static const char* default_execdir = "@CMAKE_INSTALL_PREFIX@/" MXS_DEFAULT_EXEC_SUBPATH;
static const char* default_piddir = "@DEFAULT_PIDDIR@";
static const char* default_logdir = "@DEFAULT_LOGDIR@";
static const char* default_datadir = "@DEFAULT_DATADIR@";
static const char* default_libdir = "@DEFAULT_LIBDIR@";
static const char* default_cachedir = "@DEFAULT_CACHEDIR@";
static const char* default_langdir = "@DEFAULT_LANGDIR@";
static const char* default_execdir = "@DEFAULT_EXECDIR@";
static char* configdir = NULL;
static char* logdir = NULL;

View File

@ -345,6 +345,8 @@ static bool connect_server(backend_ref_t *bref, SESSION *session, bool execute_h
if (bref->bref_dcb != NULL)
{
bref_clear_state(bref, BREF_CLOSED);
if (!execute_history || execute_sescmd_history(bref))
{
/** Add a callback for unresponsive server */