Merge branch 'develop' into 1.2.1-binlog_router_trx
This commit is contained in:
@ -61,9 +61,17 @@ if(GIT_FOUND)
|
|||||||
message(STATUS "Found git ${GIT_VERSION_STRING}")
|
message(STATUS "Found git ${GIT_VERSION_STRING}")
|
||||||
execute_process(COMMAND ${GIT_EXECUTABLE} rev-list --max-count=1 HEAD
|
execute_process(COMMAND ${GIT_EXECUTABLE} rev-list --max-count=1 HEAD
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
OUTPUT_VARIABLE GIT_COMMIT)
|
OUTPUT_VARIABLE GIT_COMMIT
|
||||||
string(REPLACE "\n" "" MAXSCALE_COMMIT ${GIT_COMMIT})
|
ERROR_VARIABLE GIT_ERROR
|
||||||
message(STATUS "Commit ID: ${MAXSCALE_COMMIT}")
|
RESULT_VARIABLE GIT_RVAL)
|
||||||
|
if(${GIT_RVAL} EQUAL 0)
|
||||||
|
string(REPLACE "\n" "" MAXSCALE_COMMIT ${GIT_COMMIT})
|
||||||
|
message(STATUS "Commit ID: ${MAXSCALE_COMMIT}")
|
||||||
|
else()
|
||||||
|
message(STATUS "Git exited with non-zero value: ${GIT_ERROR}")
|
||||||
|
message(STATUS "Could not find repository in source folder, MaxScale commit ID will not be resolved. Will use 'source-build' for commit ID.")
|
||||||
|
set(MAXSCALE_COMMIT "source-build")
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
message(WARNING "Could not find git, MaxScale commit ID will not be resolved. Will use 'source-build' for commit ID.")
|
message(WARNING "Could not find git, MaxScale commit ID will not be resolved. Will use 'source-build' for commit ID.")
|
||||||
set(MAXSCALE_COMMIT "source-build")
|
set(MAXSCALE_COMMIT "source-build")
|
||||||
|
@ -1359,59 +1359,104 @@ return_succp:
|
|||||||
return succp;
|
return succp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper for skygw_log_write and friends.
|
||||||
|
*
|
||||||
|
* @param id The id of the log file.
|
||||||
|
* @param flush Whether the log should be flushed.
|
||||||
|
* @param len The length of the formatted string, as calculated by vsnprintf.
|
||||||
|
* @param str The printf format string.
|
||||||
|
* @param valist The arguments of /str/.
|
||||||
|
*
|
||||||
|
* @return 0 if the logging to at least one log succeeded.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static int log_write(logfile_id_t id,
|
||||||
|
bool flush,
|
||||||
|
size_t len,
|
||||||
|
const char* str,
|
||||||
|
va_list valist)
|
||||||
|
{
|
||||||
|
int rv = 0;
|
||||||
|
|
||||||
|
if (logmanager_register(true))
|
||||||
|
{
|
||||||
|
CHK_LOGMANAGER(lm);
|
||||||
|
|
||||||
|
int attempts = 0;
|
||||||
|
int successes = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add one for line feed.
|
||||||
|
*/
|
||||||
|
len += sizeof(char);
|
||||||
|
|
||||||
|
for (int i = LOGFILE_FIRST; i <= LOGFILE_LAST; i <<= 1)
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* If a particular log is enabled in general and it is enabled for
|
||||||
|
* the current session, log the stuff.
|
||||||
|
*/
|
||||||
|
if (LOG_IS_ENABLED(i) && ((i & id) != 0))
|
||||||
|
{
|
||||||
|
++attempts;
|
||||||
|
|
||||||
|
const bool use_valist = true;
|
||||||
|
const bool spread_down = true;
|
||||||
|
const bool rotate = false;
|
||||||
|
|
||||||
|
if (logmanager_write_log((logfile_id_t)i, flush, use_valist, spread_down, rotate,
|
||||||
|
len, str, valist) == 0)
|
||||||
|
{
|
||||||
|
++successes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
logmanager_unregister();
|
||||||
|
|
||||||
|
// Only if logging was attempted and nothing succeeded, it is considered a failure.
|
||||||
|
if ((attempts != 0) && (successes == 0))
|
||||||
|
{
|
||||||
|
rv = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rv = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
int skygw_log_write_flush(
|
int skygw_log_write_flush(
|
||||||
logfile_id_t id,
|
logfile_id_t id,
|
||||||
const char* str,
|
const char* str,
|
||||||
...)
|
...)
|
||||||
{
|
{
|
||||||
int i,err = 0;
|
int err = 0;
|
||||||
va_list valist;
|
va_list valist;
|
||||||
size_t len;
|
|
||||||
|
|
||||||
if (!logmanager_register(true))
|
|
||||||
{
|
|
||||||
err = -1;
|
|
||||||
goto return_err;
|
|
||||||
}
|
|
||||||
CHK_LOGMANAGER(lm);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find out the length of log string (to be formatted str).
|
* Find out the length of log string (to be formatted str).
|
||||||
*/
|
*/
|
||||||
va_start(valist, str);
|
va_start(valist, str);
|
||||||
len = sizeof(char) * vsnprintf(NULL, 0, str, valist);
|
size_t len = vsnprintf(NULL, 0, str, valist);
|
||||||
va_end(valist);
|
va_end(valist);
|
||||||
/**
|
|
||||||
* Add one for line feed.
|
if (len >= 0) {
|
||||||
*/
|
const bool flush = true;
|
||||||
len += sizeof(char);
|
|
||||||
/**
|
|
||||||
* Write log string to buffer and add to file write list.
|
|
||||||
*/
|
|
||||||
for (i = LOGFILE_FIRST; i<=LOGFILE_LAST ;i <<=1)
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* If particular log is disabled in general and it is not enabled for
|
|
||||||
* the current session, check the next log.
|
|
||||||
*/
|
|
||||||
if (!LOG_IS_ENABLED(i) || (i & id) == 0)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
va_start(valist, str);
|
va_start(valist, str);
|
||||||
err = logmanager_write_log((logfile_id_t)i, true, true, true, false, len, str, valist);
|
err = log_write(id, flush, len, str, valist);
|
||||||
va_end(valist);
|
va_end(valist);
|
||||||
|
|
||||||
if (err != 0) {
|
if (err != 0)
|
||||||
|
{
|
||||||
fprintf(stderr, "skygw_log_write_flush failed.\n");
|
fprintf(stderr, "skygw_log_write_flush failed.\n");
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logmanager_unregister();
|
|
||||||
return_err:
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1422,60 +1467,29 @@ int skygw_log_write(
|
|||||||
const char* str,
|
const char* str,
|
||||||
...)
|
...)
|
||||||
{
|
{
|
||||||
int i,err = 0;
|
int err = 0;
|
||||||
va_list valist;
|
va_list valist;
|
||||||
size_t len;
|
|
||||||
|
|
||||||
if (!logmanager_register(true))
|
/**
|
||||||
{
|
* Find out the length of log string (to be formatted str).
|
||||||
err = -1;
|
*/
|
||||||
goto return_err;
|
va_start(valist, str);
|
||||||
}
|
size_t len = vsnprintf(NULL, 0, str, valist);
|
||||||
CHK_LOGMANAGER(lm);
|
va_end(valist);
|
||||||
|
|
||||||
/**
|
if (len >= 0) {
|
||||||
* If particular log is disabled in general and it is not enabled for
|
const bool flush = false;
|
||||||
* the current session, then unregister and return.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Find out the length of log string (to be formatted str).
|
|
||||||
*/
|
|
||||||
va_start(valist, str);
|
va_start(valist, str);
|
||||||
len = vsnprintf(NULL, 0, str, valist);
|
err = log_write(id, flush, len, str, valist);
|
||||||
va_end(valist);
|
va_end(valist);
|
||||||
/**
|
|
||||||
* Add one for line feed.
|
|
||||||
*/
|
|
||||||
len += 1;
|
|
||||||
/**
|
|
||||||
* Write log string to buffer and add to file write list.
|
|
||||||
*/
|
|
||||||
|
|
||||||
for (i = LOGFILE_FIRST; i<=LOGFILE_LAST; i <<=1)
|
if (err != 0) {
|
||||||
{
|
fprintf(stderr, "skygw_log_write failed.\n");
|
||||||
/**
|
|
||||||
* If particular log is disabled in general and it is not enabled for
|
|
||||||
* the current session, check the next log.
|
|
||||||
*/
|
|
||||||
if (!LOG_IS_ENABLED(i) || (i & id) == 0)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
va_start(valist, str);
|
|
||||||
err = logmanager_write_log((logfile_id_t)i, false, true, true, false, len, str, valist);
|
|
||||||
va_end(valist);
|
|
||||||
|
|
||||||
if (err != 0) {
|
|
||||||
fprintf(stderr, "skygw_log_write failed.\n");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
logmanager_unregister();
|
return err;
|
||||||
return_err:
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1702,7 +1702,7 @@ int main(int argc, char **argv)
|
|||||||
* machine.
|
* machine.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
snprintf(datadir,PATH_MAX,"%s/data",get_datadir());
|
snprintf(datadir,PATH_MAX, "%s", get_datadir());
|
||||||
datadir[PATH_MAX] = '\0';
|
datadir[PATH_MAX] = '\0';
|
||||||
if(mkdir(datadir, 0777) != 0){
|
if(mkdir(datadir, 0777) != 0){
|
||||||
|
|
||||||
@ -1713,7 +1713,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(datadir,PATH_MAX, "%s/data/data%d", get_datadir(), getpid());
|
snprintf(datadir,PATH_MAX, "%s/data%d", get_datadir(), getpid());
|
||||||
|
|
||||||
if(mkdir(datadir, 0777) != 0){
|
if(mkdir(datadir, 0777) != 0){
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ static const char* default_piddir = "@MAXSCALE_VARDIR@/run/maxscale"; /*< This s
|
|||||||
* the /var/run folder is an old standard and the newer FSH 3.0
|
* the /var/run folder is an old standard and the newer FSH 3.0
|
||||||
* uses /run for PID files.*/
|
* uses /run for PID files.*/
|
||||||
static const char* default_logdir = "@MAXSCALE_VARDIR@/log/maxscale";
|
static const char* default_logdir = "@MAXSCALE_VARDIR@/log/maxscale";
|
||||||
static const char* default_datadir = "@MAXSCALE_VARDIR@/lib/maxscale";
|
static const char* default_datadir = "@MAXSCALE_VARDIR@/lib/maxscale/data";
|
||||||
static const char* default_libdir = "@CMAKE_INSTALL_PREFIX@/@MAXSCALE_LIBDIR@";
|
static const char* default_libdir = "@CMAKE_INSTALL_PREFIX@/@MAXSCALE_LIBDIR@";
|
||||||
static const char* default_cachedir = "@MAXSCALE_VARDIR@/cache/maxscale";
|
static const char* default_cachedir = "@MAXSCALE_VARDIR@/cache/maxscale";
|
||||||
static const char* default_langdir = "@MAXSCALE_VARDIR@/lib/maxscale";
|
static const char* default_langdir = "@MAXSCALE_VARDIR@/lib/maxscale";
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
threads=4
|
threads=4
|
||||||
libdir=@CMAKE_INSTALL_PREFIX@/@MAXSCALE_LIBDIR@
|
libdir=@CMAKE_INSTALL_PREFIX@/@MAXSCALE_LIBDIR@
|
||||||
logdir=@CMAKE_INSTALL_PREFIX@/
|
logdir=@CMAKE_INSTALL_PREFIX@/
|
||||||
datadir=@CMAKE_INSTALL_PREFIX@/
|
datadir=@CMAKE_INSTALL_PREFIX@/data/
|
||||||
cachedir=@CMAKE_INSTALL_PREFIX@/
|
cachedir=@CMAKE_INSTALL_PREFIX@/
|
||||||
language=@CMAKE_INSTALL_PREFIX@/lib/maxscale/
|
language=@CMAKE_INSTALL_PREFIX@/lib/maxscale/
|
||||||
piddir=@CMAKE_INSTALL_PREFIX@/
|
piddir=@CMAKE_INSTALL_PREFIX@/
|
||||||
|
Reference in New Issue
Block a user