Commit 83cce1ca authored by unknown's avatar unknown
Browse files

Merge mysql.com:/home/cps/mysql/trees/mysql-5.0

into mysql.com:/home/cps/mysql/devel/im-fix-review


server-tools/instance-manager/Makefile.am:
  Auto merged
support-files/Makefile.am:
  Auto merged
support-files/mysql.spec.sh:
  Auto merged
parents 265bc984 deba12cd
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -30,10 +30,8 @@ liboptions_a_CPPFLAGS= $(CPPFLAGS) \
	-DDEFAULT_LOG_FILE_NAME="$(localstatedir)/mysqlmanager.log" \
	-DDEFAULT_SOCKET_FILE_NAME="$(localstatedir)/mysqlmanager.sock" \
	-DDEFAULT_PASSWORD_FILE_NAME="$(sysconfdir)/mysqlmanager.passwd" \
	-DDEFAULT_MYSQLD_PATH="$(bindir)/mysqld$(EXEEXT)" \
	-DDEFAULT_USER="root" \
	-DDEFAULT_PASSWORD="" \
	-DDEFAULT_MONITORING_INTERVAL="5" \
	-DDEFAULT_MYSQLD_PATH="$(libexecdir)/mysqld$(EXEEXT)" \
	-DDEFAULT_MONITORING_INTERVAL="20" \
	-DDEFAULT_PORT="2273" \
	-DPROTOCOL_VERSION=@PROTOCOL_VERSION@

@@ -59,7 +57,7 @@ client_settings.h: Makefile
	rm -f $(srcdir)/client_settings.h
	@LN_CP_F@ $(top_srcdir)/sql/client_settings.h $(srcdir)/client_settings.h

bin_PROGRAMS= mysqlmanager
libexec_PROGRAMS= mysqlmanager

mysqlmanager_SOURCES=	command.cc command.h mysqlmanager.cc \
			manager.h manager.cc log.h log.cc \
@@ -75,7 +73,8 @@ mysqlmanager_SOURCES= command.cc command.h mysqlmanager.cc \
			instance_options.h instance_options.cc \
			buffer.h buffer.cc parse.cc parse.h \
			guardian.cc guardian.h \
                        mysql_manager_error.h client_func.c
			parse_output.cc parse_output.h \
                        mysql_manager_error.h

mysqlmanager_LDADD=	liboptions.a \
			libnet.a \
+18 −6
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@

  RETURN
    0 - ok
    1 - The buffer came to 16Mb barrier
    1 - got an error in reserve()
*/

int Buffer::append(uint position, const char *string, uint len_arg)
@@ -71,7 +71,7 @@ int Buffer::append(uint position, const char *string, uint len_arg)

  RETURN
    0 - ok
    1 - The buffer came to 16Mb barrier
    1 - realloc error or we have come to the 16Mb barrier
*/

int Buffer::reserve(uint position, uint len_arg)
@@ -81,10 +81,10 @@ int Buffer::reserve(uint position, uint len_arg)

  if (position + len_arg>= buffer_size)
  {
    buffer= (char *) realloc(buffer,
    buffer= (char *) my_realloc(buffer,
                                min(MAX_BUFFER_SIZE,
                                    max((uint) (buffer_size*1.5),
                                     position + len_arg)));
                                        position + len_arg)), MYF(0));
    if (buffer == NULL)
      goto err;
    buffer_size= (uint) (buffer_size*1.5);
@@ -92,6 +92,18 @@ int Buffer::reserve(uint position, uint len_arg)
  return 0;

err:
  error= 1;
  return 1;
}


int Buffer::get_size()
{
  return buffer_size;
}


int Buffer::is_error()
{
  return error;
}
+12 −3
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */

#include <my_global.h>
#include <my_sys.h>

#ifdef __GNUC__
#pragma interface
@@ -36,11 +37,17 @@ class Buffer
  /* maximum buffer size is 16Mb */
  enum { MAX_BUFFER_SIZE= 16777216 };
  size_t buffer_size;
  /* Error flag. Triggered if we get an error of some kind */
  int error;
public:
  Buffer()
  Buffer(size_t buffer_size_arg= BUFFER_INITIAL_SIZE)
    :buffer_size(BUFFER_INITIAL_SIZE), error(0)
  {
    buffer=(char *) malloc(BUFFER_INITIAL_SIZE);
    buffer_size= BUFFER_INITIAL_SIZE;
    /*
      As append() will invokes realloc() anyway, it's ok if malloc returns 0
    */
    if (!(buffer= (char*) my_malloc(buffer_size, MYF(0))))
        buffer_size= 0;
  }

  ~Buffer()
@@ -50,6 +57,8 @@ class Buffer

public:
  char *buffer;
  int get_size();
  int is_error();
  int append(uint position, const char *string, uint len_arg);
  int reserve(uint position, uint len_arg);
};
+0 −32
Original line number Diff line number Diff line
#include <my_global.h>
#include <my_sys.h>
#include <mysql.h>

/*
  Currently we cannot use libmysqlclient directly becouse of the linking
  issues. Here we provide needed libmysqlclient functions.
  TODO: to think how to use libmysqlclient code instead of copy&paste.
  The other possible solution is to use simple_command directly.
*/

const char * STDCALL
mysql_get_server_info(MYSQL *mysql)
{
  return((char*) mysql->server_version);
}

int STDCALL
mysql_ping(MYSQL *mysql)
{
  DBUG_ENTER("mysql_ping");
  DBUG_RETURN(simple_command(mysql,COM_PING,0,0,0));
}

int STDCALL
mysql_shutdown(MYSQL *mysql, enum mysql_enum_shutdown_level shutdown_level)
{
  uchar level[1];
  DBUG_ENTER("mysql_shutdown");
  level[0]= (uchar) shutdown_level;
  DBUG_RETURN(simple_command(mysql, COM_SHUTDOWN, (char *)level, 1, 0));
}
+13 −31
Original line number Diff line number Diff line
@@ -175,7 +175,7 @@ int Show_instance_status::do_command(struct st_net *net,
    if (instance->is_running())
    {
      store_to_string(&send_buff, (char *) "online", &position);
      store_to_string(&send_buff, mysql_get_server_info(&(instance->mysql)), &position);
      store_to_string(&send_buff, "unknown", &position);
    }
    else
    {
@@ -184,7 +184,8 @@ int Show_instance_status::do_command(struct st_net *net,
    }


    if (my_net_write(net, send_buff.buffer, (uint) position))
    if (send_buff.is_error() ||
        my_net_write(net, send_buff.buffer, (uint) position))
      goto err;
  }

@@ -270,38 +271,18 @@ int Show_instance_options::do_command(struct st_net *net,
      store_to_string(&send_buff,
                     (char *) instance->options.mysqld_path,
                     &position);
      if (my_net_write(net, send_buff.buffer, (uint) position))
      if (send_buff.is_error() ||
          my_net_write(net, send_buff.buffer, (uint) position))
        goto err;
    }

    if (instance->options.is_guarded != NULL)
    if (instance->options.nonguarded != NULL)
    {
      position= 0;
      store_to_string(&send_buff, (char *) "guarded", &position);
      store_to_string(&send_buff, (char *) "nonguarded", &position);
      store_to_string(&send_buff, "", &position);
      if (my_net_write(net, send_buff.buffer, (uint) position))
        goto err;
    }

    if (instance->options.mysqld_user != NULL)
    {
      position= 0;
      store_to_string(&send_buff, (char *) "admin-user", &position);
      store_to_string(&send_buff,
                      (char *) instance->options.mysqld_user,
                      &position);
      if (my_net_write(net, send_buff.buffer, (uint) position))
        goto err;
    }

    if (instance->options.mysqld_password != NULL)
    {
      position= 0;
      store_to_string(&send_buff, (char *) "admin-password", &position);
      store_to_string(&send_buff,
                      (char *) instance->options.mysqld_password,
                      &position);
      if (my_net_write(net, send_buff.buffer, (uint) position))
      if (send_buff.is_error() ||
          my_net_write(net, send_buff.buffer, (uint) position))
        goto err;
    }

@@ -318,7 +299,8 @@ int Show_instance_options::do_command(struct st_net *net,
      store_to_string(&send_buff, option_value + 1, &position);
      /* join name and the value into the same option again */
      *option_value= '=';
      if (my_net_write(net, send_buff.buffer, (uint) position))
      if (send_buff.is_error() ||
          my_net_write(net, send_buff.buffer, (uint) position))
        goto err;
    }
  }
@@ -372,7 +354,7 @@ int Start_instance::execute(struct st_net *net, ulong connection_id)
    if (err_code= instance->start())
      return err_code;

    if (instance->options.is_guarded != NULL)
    if (instance->options.nonguarded == NULL)
        instance_map->guardian->guard(instance);

    net_send_ok(net, connection_id);
@@ -403,7 +385,7 @@ int Stop_instance::execute(struct st_net *net, ulong connection_id)
  }
  else
  {
    if (instance->options.is_guarded != NULL)
    if (instance->options.nonguarded == NULL)
        instance_map->guardian->
               stop_guard(instance);
    if ((err_code= instance->stop()))
Loading