Merge branch 'develop' into MXS-329-develop-20151111

This commit is contained in:
Markus Makela
2015-11-13 07:44:23 +02:00
66 changed files with 4807 additions and 4056 deletions

View File

@ -621,29 +621,48 @@ struct subcommand removeoptions[] = {
static void
flushlog(DCB *pdcb, char *logname)
{
if (logname == NULL)
bool unrecognized = false;
bool deprecated = false;
if (!strcasecmp(logname, "error"))
{
}
else if (!strcasecmp(logname, "error"))
{
skygw_log_rotate(LOGFILE_ERROR);
deprecated = true;
}
else if (!strcasecmp(logname, "message"))
{
skygw_log_rotate(LOGFILE_MESSAGE);
deprecated = true;
}
else if (!strcasecmp(logname, "trace"))
{
skygw_log_rotate(LOGFILE_TRACE);
deprecated = true;
}
else if (!strcasecmp(logname, "debug"))
{
skygw_log_rotate(LOGFILE_DEBUG);
deprecated = true;
}
else if (!strcasecmp(logname, "maxscale"))
{
; // nop
}
else
{
dcb_printf(pdcb, "Unexpected logfile name, expected "
"error, message, trace or debug.\n");
unrecognized = true;
}
if (unrecognized)
{
dcb_printf(pdcb, "Unexpected logfile name '%s', expected: 'maxscale'.\n", logname);
}
else
{
mxs_log_rotate();
if (deprecated)
{
dcb_printf(pdcb,
"'%s' is deprecated, currently there is only one log 'maxscale', "
"which was rotated.\n", logname);
}
}
}
@ -655,10 +674,7 @@ flushlog(DCB *pdcb, char *logname)
static void
flushlogs(DCB *pdcb)
{
skygw_log_rotate(LOGFILE_ERROR);
skygw_log_rotate(LOGFILE_MESSAGE);
skygw_log_rotate(LOGFILE_TRACE);
skygw_log_rotate(LOGFILE_DEBUG);
mxs_log_rotate();
}
@ -678,8 +694,8 @@ struct subcommand flushoptions[] = {
"logs",
0,
flushlogs,
"Flush the content of all log files, close that logs, rename them and open a new log files",
"Flush the content of all log files, close that logs, rename them and open a new log files",
"Flush the content of all log files, close those logs, rename them and open a new log files",
"Flush the content of all log files, close those logs, rename them and open a new log files",
{0, 0, 0}
},
{
@ -1100,40 +1116,6 @@ restart_service(DCB *dcb, SERVICE *service)
serviceRestart(service);
}
static struct {
char *str;
unsigned int bit;
} ServerBits[] = {
{ "running", SERVER_RUNNING },
{ "master", SERVER_MASTER },
{ "slave", SERVER_SLAVE },
{ "synced", SERVER_JOINED },
{ "ndb", SERVER_NDB },
{ "maintenance", SERVER_MAINT },
{ "maint", SERVER_MAINT },
{ NULL, 0 }
};
/**
* Map the server status bit
*
* @param str String representation
* @return bit value or 0 on error
*/
static unsigned int
server_map_status(char *str)
{
int i;
for (i = 0; ServerBits[i].str; i++)
{
if (!strcasecmp(str, ServerBits[i].str))
{
return ServerBits[i].bit;
}
}
return 0;
}
/**
* Set the status bit of a server
*
@ -1603,7 +1585,7 @@ static void enable_log_priority(DCB *dcb, char *arg1)
if (priority != -1)
{
mxs_log_enable_priority(priority);
mxs_log_set_priority_enabled(priority, true);
}
else
{
@ -1621,7 +1603,7 @@ static void disable_log_priority(DCB *dcb, char *arg1)
if (priority != -1)
{
mxs_log_enable_priority(priority);
mxs_log_set_priority_enabled(priority, false);
}
else
{