Commit 7c35c3d5 authored by unknown's avatar unknown
Browse files

Polishing:

  - change some return types from int to bool;
  - add [ERROR] tag to log_error() output;
  - add [INFO] tag to log_info() output;
  - change log messages to be more consistent.


server-tools/instance-manager/IMService.cpp:
  Log polishing.
server-tools/instance-manager/commands.cc:
  Log polishing.
server-tools/instance-manager/commands.h:
  Eliminate warnings.
server-tools/instance-manager/instance.cc:
  Log polishing.
server-tools/instance-manager/instance_map.cc:
  Log polishing.
server-tools/instance-manager/instance_options.cc:
  1) Log polishing.
  2) Change int-return type to bool.
server-tools/instance-manager/instance_options.h:
  Change int-return type to bool.
server-tools/instance-manager/listener.cc:
  Log polishing.
server-tools/instance-manager/log.cc:
  Log polishing.
server-tools/instance-manager/log.h:
  Log polishing.
server-tools/instance-manager/manager.cc:
  Log polishing.
server-tools/instance-manager/mysql_connection.cc:
  Log polishing.
server-tools/instance-manager/mysql_connection.h:
  Change int-return type to bool.
server-tools/instance-manager/mysqlmanager.cc:
  Log polishing.
server-tools/instance-manager/priv.cc:
  Log polishing.
server-tools/instance-manager/thread_registry.cc:
  1. Print pthread_t as (unsigned long), not as (signed long)
  to avoid negative identifiers in output.
  2. Print thread id after it will be initialized, not before.
server-tools/instance-manager/user_map.cc:
  Log polishing.
parent cbfff730
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -54,24 +54,24 @@ int HandleServiceOptions()
  if (Options::Service::install_as_service)
  {
    if (winService.IsInstalled())
      log_info("Service is already installed");
      log_info("Service is already installed.");
    else if (winService.Install())
      log_info("Service installed successfully");
      log_info("Service installed successfully.");
    else
    {
      log_info("Service failed to install");
      log_error("Service failed to install.");
      ret_val= 1;
    }
  }
  else if (Options::Service::remove_service)
  {
    if (! winService.IsInstalled())
      log_info("Service is not installed");
      log_info("Service is not installed.");
    else if (winService.Remove())
      log_info("Service removed successfully");
      log_info("Service removed successfully.");
    else
    {
      log_info("Service failed to remove");
      log_error("Service failed to remove.");
      ret_val= 1;
    }
  }
@@ -81,7 +81,7 @@ int HandleServiceOptions()

    if (!winService.Init())
    {
      log_info("Service failed to initialize.");
      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"
+1 −1
Original line number Diff line number Diff line
@@ -1539,7 +1539,7 @@ int Set_option::process_option(Instance *instance, Named_value *option)
  if (instance->is_mysqld_compatible() &&
      Instance_options::is_option_im_specific(option->get_name()))
  {
      log_error("Error: IM-option (%s) can not be used "
      log_error("IM-option (%s) can not be used "
                "in the configuration of mysqld-compatible instance (%s).",
                (const char *) option->get_name(),
                (const char *) instance->get_name()->str);
+20 −0
Original line number Diff line number Diff line
@@ -37,6 +37,10 @@

class Show_instances: public Command
{
public:
  Show_instances()
  { }

public:
  int execute(st_net *net, ulong connection_id);

@@ -53,6 +57,10 @@ class Show_instances: public Command

class Flush_instances: public Command
{
public:
  Flush_instances()
  { }

public:
  int execute(st_net *net, ulong connection_id);
};
@@ -311,6 +319,10 @@ class Abstract_option_cmd: public Command

class Set_option: public Abstract_option_cmd
{
public:
  Set_option()
  { }

protected:
  virtual bool parse_args(const char **text);
  virtual int process_option(Instance *instance, Named_value *option);
@@ -324,6 +336,10 @@ class Set_option: public Abstract_option_cmd

class Unset_option: public Abstract_option_cmd
{
public:
  Unset_option()
  { }

protected:
  virtual bool parse_args(const char **text);
  virtual int process_option(Instance *instance, Named_value *option);
@@ -341,6 +357,10 @@ class Unset_option: public Abstract_option_cmd

class Syntax_error: public Command
{
public:
  Syntax_error()
  { }

public:
  int execute(st_net *net, ulong connection_id);
};
+4 −5
Original line number Diff line number Diff line
@@ -170,7 +170,7 @@ static bool start_process(Instance_options *instance_options,
    /* exec never returns */
    exit(1);
  case -1:
    log_info("Instance '%s': can not start mysqld: fork() failed.",
    log_error("Instance '%s': can not start mysqld: fork() failed.",
              (const char *) instance_options->instance_name.str);
    return TRUE;
  }
@@ -699,10 +699,9 @@ void Instance::kill_mysqld(int signum)
  /* Kill suceeded */
  if (signum == SIGKILL)      /* really killed instance with SIGKILL */
  {
    log_error("The instance '%s' is being stopped forcibly. Normally"
              "it should not happen. Probably the instance has been"
              "hanging. You should also check your IM setup",
    log_error("Instance '%s': killed.",
              (const char *) options.instance_name.str);

    /* After sucessful hard kill the pidfile need to be removed */
    options.unlink_pidfile();
  }
+12 −12
Original line number Diff line number Diff line
@@ -336,14 +336,14 @@ int Instance_map::create_instance(const LEX_STRING *instance_name,

  if (!instance)
  {
    log_error("Error: can not allocate instance (name: '%s').",
    log_error("Can not allocate instance (name: '%s').",
              (const char *) instance_name->str);
    return ER_OUT_OF_RESOURCES;
  }

  if (instance->init(instance_name))
  {
    log_error("Error: can not initialize instance (name: '%s').",
    log_error("Can not initialize instance (name: '%s').",
              (const char *) instance_name->str);
    delete instance;
    return ER_OUT_OF_RESOURCES;
@@ -356,7 +356,7 @@ int Instance_map::create_instance(const LEX_STRING *instance_name,
    if (instance->is_mysqld_compatible() &&
        Instance_options::is_option_im_specific(option.get_name()))
    {
      log_error("Error: IM-option (%s) can not be used "
      log_error("IM-option (%s) can not be used "
                "in configuration of mysqld-compatible instance (%s).",
                (const char *) option.get_name(),
                (const char *) instance_name->str);
@@ -373,7 +373,7 @@ int Instance_map::create_instance(const LEX_STRING *instance_name,

  if (instance->complete_initialization())
  {
    log_error("Error: can not complete initialization of instance (name: '%s').",
    log_error("Can not complete initialization of instance (name: '%s').",
              (const char *) instance_name->str);
    delete instance;
    return ER_OUT_OF_RESOURCES;
@@ -382,7 +382,7 @@ int Instance_map::create_instance(const LEX_STRING *instance_name,

  if (add_instance(instance))
  {
    log_error("Error: can not register instance (name: '%s').",
    log_error("Can not register instance (name: '%s').",
              (const char *) instance_name->str);
    delete instance;
    return ER_OUT_OF_RESOURCES;
@@ -426,7 +426,7 @@ bool Instance_map::complete_initialization()

  if (create_instance(&Instance::DFLT_INSTANCE_NAME, NULL))
  {
    log_error("Error: could not create default instance.");
    log_error("Can not create default instance.");
    return TRUE;
  }

@@ -441,7 +441,7 @@ bool Instance_map::complete_initialization()
    break;

  default:
    log_error("Error: could not add default instance to the config file.");
    log_error("Can not add default instance to the config file.");

    Instance *instance= find(&Instance::DFLT_INSTANCE_NAME);

@@ -499,7 +499,7 @@ int Instance_map::load()
  if (my_search_option_files(Options::Main::config_file, &argc,
                             (char ***) &argv, &args_used,
                             process_option, (void*) this))
    log_info("Falling back to compiled-in defaults");
    log_info("Falling back to compiled-in defaults.");

  return complete_initialization();
}
@@ -566,7 +566,7 @@ int create_instance_in_file(const LEX_STRING *instance_name,

  if (my_access(Options::Main::config_file, W_OK))
  {
    log_error("Error: configuration file (%s) does not exist.",
    log_error("Configuration file (%s) does not exist.",
              (const char *) Options::Main::config_file);
    return ER_CONF_FILE_DOES_NOT_EXIST;
  }
@@ -575,7 +575,7 @@ int create_instance_in_file(const LEX_STRING *instance_name,

  if (cnf_file <= 0)
  {
    log_error("Error: can not open configuration file (%s): %s.",
    log_error("Can not open configuration file (%s): %s.",
              (const char *) Options::Main::config_file,
              (const char *) strerror(errno));
    return ER_ACCESS_OPTION_FILE;
@@ -588,7 +588,7 @@ int create_instance_in_file(const LEX_STRING *instance_name,
      my_write(cnf_file, (byte*)"]", 1,   MYF(MY_NABP)) ||
      my_write(cnf_file, (byte*)NEWLINE, NEWLINE_LEN, MYF(MY_NABP)))
  {
    log_error("Error: can not write to configuration file (%s): %s.",
    log_error("Can not write to configuration file (%s): %s.",
              (const char *) Options::Main::config_file,
              (const char *) strerror(errno));
    my_close(cnf_file, MYF(0));
@@ -612,7 +612,7 @@ int create_instance_in_file(const LEX_STRING *instance_name,
    if (my_write(cnf_file, (byte*)option_str, option_str_len, MYF(MY_NABP)) ||
        my_write(cnf_file, (byte*)NEWLINE, NEWLINE_LEN, MYF(MY_NABP)))
    {
      log_error("Error: can not write to configuration file (%s): %s.",
      log_error("Can not write to configuration file (%s): %s.",
                (const char *) Options::Main::config_file,
                (const char *) strerror(errno));
      my_close(cnf_file, MYF(0));
Loading