1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Patch for IM in scope of working on BUG#24415: Instance manager test

im_daemon_life_cycle fails randomly.

1. Move IM-angel functionality into a separate file, create Angel class.
2. Be more verbose;
3. Fix typo in FLUSH INSTANCES implementation;
4. Polishing.


mysql-test/r/im_options.result:
  Updated result file.
mysql-test/t/im_cmd_line.imtest:
  Updated test.
server-tools/instance-manager/IMService.cpp:
  Move HandleServiceOptions() into IMService::main().
server-tools/instance-manager/IMService.h:
  Move HandleServiceOptions() into IMService::main().
server-tools/instance-manager/Makefile.am:
  Added angel.cc and angel.h.
server-tools/instance-manager/WindowsService.cpp:
  Initialize class-members in constructor.
server-tools/instance-manager/WindowsService.h:
  Initialize class-members in constructor.
server-tools/instance-manager/commands.cc:
  Return actual error code (ER_OUT_OF_RESOURCES or ER_THERE_IS_ACTIVE_INSTANCE)
  from FLUSH INSTANCES.
server-tools/instance-manager/manager.cc:
  1. Return actual error code from Manager::flush_instances().
  2. Be more verbose.
server-tools/instance-manager/manager.h:
  Return actual error code from Manager::flush_instances().
server-tools/instance-manager/mysqlmanager.cc:
  Move IM-angel functionality into separate file (angel.cc).
server-tools/instance-manager/priv.cc:
  Use return bool datatype instead int{ 0, 1 }.
server-tools/instance-manager/priv.h:
  Use return bool datatype instead int{ 0, 1 }.
server-tools/instance-manager/angel.cc:
  IM-angel functionality.
server-tools/instance-manager/angel.h:
  IM-angel functionality.
This commit is contained in:
unknown
2007-02-18 15:45:28 +03:00
parent 64a6018594
commit f2f1e4d852
15 changed files with 655 additions and 353 deletions

View File

@ -15,17 +15,19 @@
#include <windows.h>
#include <signal.h>
#include "log.h"
#include "options.h"
#include "IMService.h"
#include "log.h"
#include "manager.h"
#include "options.h"
static const char * const IM_SVC_USERNAME= NULL;
static const char * const IM_SVC_PASSWORD= NULL;
IMService::IMService(void)
:WindowsService("MySqlManager", "MySQL Manager")
{
serviceName= "MySqlManager";
displayName= "MySQL Manager";
username= NULL;
password= NULL;
}
IMService::~IMService(void)
@ -60,50 +62,63 @@ void IMService::Log(const char *msg)
log_info(msg);
}
int HandleServiceOptions()
int IMService::main()
{
int ret_val= 0;
IMService winService;
if (Options::Service::install_as_service)
{
if (winService.IsInstalled())
{
log_info("Service is already installed.");
else if (winService.Install())
return 1;
}
if (winService.Install(IM_SVC_USERNAME, IM_SVC_PASSWORD))
{
log_info("Service installed successfully.");
return 0;
}
else
{
log_error("Service failed to install.");
ret_val= 1;
return 1;
}
}
else if (Options::Service::remove_service)
if (Options::Service::remove_service)
{
if (! winService.IsInstalled())
if (!winService.IsInstalled())
{
log_info("Service is not installed.");
else if (winService.Remove())
return 1;
}
if (winService.Remove())
{
log_info("Service removed successfully.");
return 0;
}
else
{
log_error("Service failed to remove.");
ret_val= 1;
return 1;
}
}
else
log_info("Initializing Instance Manager service...");
if (!winService.Init())
{
log_info("Initializing Instance Manager service...");
log_error("Service failed to initialize.");
if (!winService.Init())
{
log_error("Service failed to initialize.");
fprintf(stderr,
"The service should be started by Windows Service Manager.\n"
"The MySQL Manager should be started with '--standalone'\n"
"to run from command line.");
ret_val= 1;
}
fprintf(stderr,
"The service should be started by Windows Service Manager.\n"
"The MySQL Manager should be started with '--standalone'\n"
"to run from command line.");
return 1;
}
return ret_val;
return 0;
}