Added sync logs command to maxadmin

Added maxadmin command to flush all logs to disk. This will allow tests
to gather all logs without having to wait for the logs to be flushed by
the log flusher thread.
This commit is contained in:
Markus Makela 2015-11-17 07:16:14 +02:00
parent b828b04c05
commit 6641c42ef9

View File

@ -306,6 +306,38 @@ struct subcommand shutdownoptions[] = {
}
};
static void sync_logs(DCB *dcb)
{
if (mxs_log_flush_sync() == 0)
{
dcb_printf(dcb, "Logs flushed to disk\n");
}
else
{
dcb_printf(dcb, "Failed to flush logs to disk. Read the error log for "
"more details.\n");
}
}
struct subcommand syncoptions[] =
{
{
"logs",
0,
sync_logs,
"Flush log files to disk",
"Flush log files to disk",
{0, 0, 0}
},
{
NULL,
0,
NULL,
NULL,
NULL,
{0, 0, 0}
}
};
static void restart_service(DCB *dcb, SERVICE *service);
static void restart_monitor(DCB *dcb, MONITOR *monitor);
@ -722,6 +754,7 @@ static struct {
{ "set", setoptions },
{ "show", showoptions },
{ "shutdown", shutdownoptions },
{ "sync", syncoptions },
{ NULL, NULL }
};